diff options
author | tb <> | 2023-07-01 14:57:51 +0000 |
---|---|---|
committer | tb <> | 2023-07-01 14:57:51 +0000 |
commit | 219f0b07279a03e1a7dae34072df1b15ffc8ffb1 (patch) | |
tree | 8477e7253d9f72f62d945ad92f912690e2a0f18b /src/lib | |
parent | acc8e0dc5dfd0fa2bf579af0455366907f4cf0ce (diff) | |
download | openbsd-219f0b07279a03e1a7dae34072df1b15ffc8ffb1.tar.gz openbsd-219f0b07279a03e1a7dae34072df1b15ffc8ffb1.tar.bz2 openbsd-219f0b07279a03e1a7dae34072df1b15ffc8ffb1.zip |
Garbage collect the now unused len
Diffstat (limited to 'src/lib')
-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 | } |