diff options
author | tb <> | 2022-03-29 13:48:40 +0000 |
---|---|---|
committer | tb <> | 2022-03-29 13:48:40 +0000 |
commit | 5474ea01ccbb75c0e017bd0a7735e0bbb8b14e9f (patch) | |
tree | bd8cffdd42f6e8545d22fd002284a758daa1262b /src/lib | |
parent | a97f0ea2828f58e05b3ffba41815914bcca8be95 (diff) | |
download | openbsd-5474ea01ccbb75c0e017bd0a7735e0bbb8b14e9f.tar.gz openbsd-5474ea01ccbb75c0e017bd0a7735e0bbb8b14e9f.tar.bz2 openbsd-5474ea01ccbb75c0e017bd0a7735e0bbb8b14e9f.zip |
Do not zero cofactor on ec_guess_cofactor() success
The cofactor we tried to calculate should only be zeroed if we failed
to compute it.
ok inoguchi jsing
Diffstat (limited to 'src/lib')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 45df1329ff..455d44a942 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.42 2022/03/29 13:44:06 tb Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.43 2022/03/29 13:48:40 tb Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -321,10 +321,14 @@ ec_guess_cofactor(EC_GROUP *group) | |||
321 | goto err; | 321 | goto err; |
322 | 322 | ||
323 | ret = 1; | 323 | ret = 1; |
324 | |||
324 | err: | 325 | err: |
325 | BN_CTX_end(ctx); | 326 | BN_CTX_end(ctx); |
326 | BN_CTX_free(ctx); | 327 | BN_CTX_free(ctx); |
327 | BN_zero(&group->cofactor); | 328 | |
329 | if (ret != 1) | ||
330 | BN_zero(&group->cofactor); | ||
331 | |||
328 | return ret; | 332 | return ret; |
329 | } | 333 | } |
330 | 334 | ||