diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libcrypto/ecdh/ech_key.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/lib/libcrypto/ecdh/ech_key.c b/src/lib/libcrypto/ecdh/ech_key.c index f4d20cd0ce..7d4fba76fe 100644 --- a/src/lib/libcrypto/ecdh/ech_key.c +++ b/src/lib/libcrypto/ecdh/ech_key.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ech_key.c,v 1.25 2023/07/01 14:56:12 tb Exp $ */ | 1 | /* $OpenBSD: ech_key.c,v 1.26 2023/07/01 14:57:51 tb Exp $ */ |
| 2 | /* ==================================================================== | 2 | /* ==================================================================== |
| 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. | 3 | * Copyright 2002 Sun Microsystems, Inc. ALL RIGHTS RESERVED. |
| 4 | * | 4 | * |
| @@ -98,7 +98,7 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | |||
| 98 | const BIGNUM *priv_key; | 98 | const BIGNUM *priv_key; |
| 99 | const EC_GROUP* group; | 99 | const EC_GROUP* group; |
| 100 | unsigned char *buf = NULL; | 100 | unsigned char *buf = NULL; |
| 101 | int buflen, len; | 101 | int buflen; |
| 102 | int ret = -1; | 102 | int ret = -1; |
| 103 | 103 | ||
| 104 | if (outlen > INT_MAX) { | 104 | if (outlen > INT_MAX) { |
| @@ -141,9 +141,7 @@ ossl_ecdh_compute_key(void *out, size_t outlen, const EC_POINT *pub_key, | |||
| 141 | goto err; | 141 | goto err; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | buflen = ECDH_size(ecdh); | 144 | if ((buflen = ECDH_size(ecdh)) < BN_num_bytes(x)) { |
| 145 | len = BN_num_bytes(x); | ||
| 146 | if (len > buflen) { | ||
| 147 | ECDHerror(ERR_R_INTERNAL_ERROR); | 145 | ECDHerror(ERR_R_INTERNAL_ERROR); |
| 148 | goto err; | 146 | goto err; |
| 149 | } | 147 | } |
