There's a slight possibility that a is 0 in BN_sub_word(), and might