diff options
| author | deraadt <> | 2016-03-04 16:23:30 +0000 |
|---|---|---|
| committer | deraadt <> | 2016-03-04 16:23:30 +0000 |
| commit | 5a8200b9524c9bceedeb01dec021bdfe4b411500 (patch) | |
| tree | 00955abc6574e6b918442044ff6d1efdfd9d65d8 /src/lib/libcrypto/bn/bn_lib.c | |
| parent | 53e590cd0b88d318840cd7b01b428951c8a35458 (diff) | |
| download | openbsd-5a8200b9524c9bceedeb01dec021bdfe4b411500.tar.gz openbsd-5a8200b9524c9bceedeb01dec021bdfe4b411500.tar.bz2 openbsd-5a8200b9524c9bceedeb01dec021bdfe4b411500.zip | |
graduate bn_expand() to a real function. the openssl version of this
uses a macro with multiple-evaluations of arguments (different amount
than the previous version..), but doug/bcook's inline version makes
BIGNUM not opaque [problem spotted by naddy]
ok doug
Diffstat (limited to 'src/lib/libcrypto/bn/bn_lib.c')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_lib.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/lib/libcrypto/bn/bn_lib.c b/src/lib/libcrypto/bn/bn_lib.c index 7cc76c1e85..311ec2044d 100644 --- a/src/lib/libcrypto/bn/bn_lib.c +++ b/src/lib/libcrypto/bn/bn_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_lib.c,v 1.34 2015/09/10 15:56:25 jsing Exp $ */ | 1 | /* $OpenBSD: bn_lib.c,v 1.35 2016/03/04 16:23:30 deraadt Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -550,6 +550,18 @@ BN_get_word(const BIGNUM *a) | |||
| 550 | return 0; | 550 | return 0; |
| 551 | } | 551 | } |
| 552 | 552 | ||
| 553 | BIGNUM * | ||
| 554 | bn_expand(BIGNUM *a, int bits) | ||
| 555 | { | ||
| 556 | if (bits > (INT_MAX - BN_BITS2 + 1)) | ||
| 557 | return (NULL); | ||
| 558 | |||
| 559 | if (((bits + BN_BITS2 - 1) / BN_BITS2) <= a->dmax) | ||
| 560 | return (a); | ||
| 561 | |||
| 562 | return bn_expand2(a, (bits + BN_BITS2 - 1) / BN_BITS2); | ||
| 563 | } | ||
| 564 | |||
| 553 | int | 565 | int |
| 554 | BN_set_word(BIGNUM *a, BN_ULONG w) | 566 | BN_set_word(BIGNUM *a, BN_ULONG w) |
| 555 | { | 567 | { |
