From: tb Date: Tue, 8 Aug 2023 15:18:24 +0000 (+0000) Subject: Drop the unused BN_BLINDING argument of BN_BLINDING_create_param() X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=2a574e23b323ca91c310944d45270f0255b950ea;p=openbsd Drop the unused BN_BLINDING argument of BN_BLINDING_create_param() --- diff --git a/lib/libcrypto/bn/bn_blind.c b/lib/libcrypto/bn/bn_blind.c index 6ba9d99e628..f58a977bbab 100644 --- a/lib/libcrypto/bn/bn_blind.c +++ b/lib/libcrypto/bn/bn_blind.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_blind.c,v 1.35 2023/08/08 15:10:34 tb Exp $ */ +/* $OpenBSD: bn_blind.c,v 1.36 2023/08/08 15:18:24 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -291,15 +291,13 @@ BN_BLINDING_thread_id(BN_BLINDING *b) } BN_BLINDING * -BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, +BN_BLINDING_create_param(const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx) { BN_BLINDING *ret = NULL; - if ((ret = b) == NULL) - ret = BN_BLINDING_new(e, m); - if (ret == NULL) + if ((ret = BN_BLINDING_new(e, m)) == NULL) goto err; if (bn_mod_exp != NULL) @@ -313,8 +311,7 @@ BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx return ret; err: - if (ret != b) - BN_BLINDING_free(ret); + BN_BLINDING_free(ret); return NULL; } diff --git a/lib/libcrypto/bn/bn_local.h b/lib/libcrypto/bn/bn_local.h index 5b7e852d705..454892871b3 100644 --- a/lib/libcrypto/bn/bn_local.h +++ b/lib/libcrypto/bn/bn_local.h @@ -1,4 +1,4 @@ -/* $OpenBSD: bn_local.h,v 1.33 2023/08/03 18:53:55 tb Exp $ */ +/* $OpenBSD: bn_local.h,v 1.34 2023/08/08 15:18:24 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -297,8 +297,7 @@ int BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *); int BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *); CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *); -BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b, - const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, +BN_BLINDING *BN_BLINDING_create_param(const BIGNUM *e, BIGNUM *m, BN_CTX *ctx, int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx); diff --git a/lib/libcrypto/rsa/rsa_crpt.c b/lib/libcrypto/rsa/rsa_crpt.c index a53ec54b32a..99086735ea9 100644 --- a/lib/libcrypto/rsa/rsa_crpt.c +++ b/lib/libcrypto/rsa/rsa_crpt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rsa_crpt.c,v 1.24 2023/08/08 13:49:45 tb Exp $ */ +/* $OpenBSD: rsa_crpt.c,v 1.25 2023/08/08 15:18:24 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -209,13 +209,14 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx) BN_init(&n); BN_with_flags(&n, rsa->n, BN_FLG_CONSTTIME); - if ((ret = BN_BLINDING_create_param(NULL, e, &n, ctx, - rsa->meth->bn_mod_exp, rsa->_method_mod_n)) == NULL) { + if ((ret = BN_BLINDING_create_param(e, &n, ctx, rsa->meth->bn_mod_exp, + rsa->_method_mod_n)) == NULL) { RSAerror(ERR_R_BN_LIB); goto err; } CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret)); -err: + + err: BN_CTX_end(ctx); if (ctx != in_ctx) BN_CTX_free(ctx);