diff options
Diffstat (limited to 'crypto/bn/bn.c')
-rw-r--r-- | crypto/bn/bn.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/bn/bn.c b/crypto/bn/bn.c index 2263701f..0ecaf825 100644 --- a/crypto/bn/bn.c +++ b/crypto/bn/bn.c @@ -266,6 +266,18 @@ int BN_set_word(BIGNUM *bn, BN_ULONG value) { return 1; } +int bn_set_words(BIGNUM *bn, const BN_ULONG *words, size_t num) { + if (bn_wexpand(bn, num) == NULL) { + return 0; + } + memmove(bn->d, words, num * sizeof(BN_ULONG)); + /* |bn_wexpand| verified that |num| isn't too large. */ + bn->top = (int)num; + bn_correct_top(bn); + bn->neg = 0; + return 1; +} + int BN_is_negative(const BIGNUM *bn) { return bn->neg != 0; } |