bn_nist.c: cumulative update from master.

PR: 2981, 2837