diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/bn/bn_mpi.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lib/libcrypto/bn/bn_mpi.c b/src/lib/libcrypto/bn/bn_mpi.c index 4801192b50..9b743cca8c 100644 --- a/src/lib/libcrypto/bn/bn_mpi.c +++ b/src/lib/libcrypto/bn/bn_mpi.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: bn_mpi.c,v 1.8 2017/01/29 17:49:22 beck Exp $ */ | 1 | /* $OpenBSD: bn_mpi.c,v 1.9 2022/11/09 01:05:45 tobhe 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 | * |
| @@ -92,8 +92,9 @@ BN_bn2mpi(const BIGNUM *a, unsigned char *d) | |||
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | BIGNUM * | 94 | BIGNUM * |
| 95 | BN_mpi2bn(const unsigned char *d, int n, BIGNUM *a) | 95 | BN_mpi2bn(const unsigned char *d, int n, BIGNUM *ain) |
| 96 | { | 96 | { |
| 97 | BIGNUM *a = ain; | ||
| 97 | long len; | 98 | long len; |
| 98 | int neg = 0; | 99 | int neg = 0; |
| 99 | 100 | ||
| @@ -121,8 +122,11 @@ BN_mpi2bn(const unsigned char *d, int n, BIGNUM *a) | |||
| 121 | d += 4; | 122 | d += 4; |
| 122 | if ((*d) & 0x80) | 123 | if ((*d) & 0x80) |
| 123 | neg = 1; | 124 | neg = 1; |
| 124 | if (BN_bin2bn(d, (int)len, a) == NULL) | 125 | if (BN_bin2bn(d, (int)len, a) == NULL) { |
| 126 | if (ain == NULL) | ||
| 127 | BN_free(a); | ||
| 125 | return (NULL); | 128 | return (NULL); |
| 129 | } | ||
| 126 | a->neg = neg; | 130 | a->neg = neg; |
| 127 | if (neg) { | 131 | if (neg) { |
| 128 | BN_clear_bit(a, BN_num_bits(a) - 1); | 132 | BN_clear_bit(a, BN_num_bits(a) - 1); |
