Skip to content

Commit cf64feb

Browse files
author
tb
committed
Drop the unused BN_BLINDING argument of BN_BLINDING_create_param()
1 parent 2752fbc commit cf64feb

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

src/lib/libcrypto/bn/bn_blind.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: bn_blind.c,v 1.35 2023/08/08 15:10:34 tb Exp $ */
1+
/* $OpenBSD: bn_blind.c,v 1.36 2023/08/08 15:18:24 tb Exp $ */
22
/* ====================================================================
33
* Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved.
44
*
@@ -291,15 +291,13 @@ BN_BLINDING_thread_id(BN_BLINDING *b)
291291
}
292292

293293
BN_BLINDING *
294-
BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
294+
BN_BLINDING_create_param(const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
295295
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
296296
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx), BN_MONT_CTX *m_ctx)
297297
{
298298
BN_BLINDING *ret = NULL;
299299

300-
if ((ret = b) == NULL)
301-
ret = BN_BLINDING_new(e, m);
302-
if (ret == NULL)
300+
if ((ret = BN_BLINDING_new(e, m)) == NULL)
303301
goto err;
304302

305303
if (bn_mod_exp != NULL)
@@ -313,8 +311,7 @@ BN_BLINDING_create_param(BN_BLINDING *b, const BIGNUM *e, BIGNUM *m, BN_CTX *ctx
313311
return ret;
314312

315313
err:
316-
if (ret != b)
317-
BN_BLINDING_free(ret);
314+
BN_BLINDING_free(ret);
318315

319316
return NULL;
320317
}

src/lib/libcrypto/bn/bn_local.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: bn_local.h,v 1.33 2023/08/03 18:53:55 tb Exp $ */
1+
/* $OpenBSD: bn_local.h,v 1.34 2023/08/08 15:18:24 tb Exp $ */
22
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
33
* All rights reserved.
44
*
@@ -297,8 +297,7 @@ int BN_BLINDING_convert(BIGNUM *n, BIGNUM *r, BN_BLINDING *b, BN_CTX *);
297297
int BN_BLINDING_invert(BIGNUM *n, const BIGNUM *r, BN_BLINDING *b, BN_CTX *);
298298

299299
CRYPTO_THREADID *BN_BLINDING_thread_id(BN_BLINDING *);
300-
BN_BLINDING *BN_BLINDING_create_param(BN_BLINDING *b,
301-
const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
300+
BN_BLINDING *BN_BLINDING_create_param(const BIGNUM *e, BIGNUM *m, BN_CTX *ctx,
302301
int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,
303302
const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx),
304303
BN_MONT_CTX *m_ctx);

src/lib/libcrypto/rsa/rsa_crpt.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: rsa_crpt.c,v 1.24 2023/08/08 13:49:45 tb Exp $ */
1+
/* $OpenBSD: rsa_crpt.c,v 1.25 2023/08/08 15:18:24 tb Exp $ */
22
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
33
* All rights reserved.
44
*
@@ -209,13 +209,14 @@ RSA_setup_blinding(RSA *rsa, BN_CTX *in_ctx)
209209
BN_init(&n);
210210
BN_with_flags(&n, rsa->n, BN_FLG_CONSTTIME);
211211

212-
if ((ret = BN_BLINDING_create_param(NULL, e, &n, ctx,
213-
rsa->meth->bn_mod_exp, rsa->_method_mod_n)) == NULL) {
212+
if ((ret = BN_BLINDING_create_param(e, &n, ctx, rsa->meth->bn_mod_exp,
213+
rsa->_method_mod_n)) == NULL) {
214214
RSAerror(ERR_R_BN_LIB);
215215
goto err;
216216
}
217217
CRYPTO_THREADID_current(BN_BLINDING_thread_id(ret));
218-
err:
218+
219+
err:
219220
BN_CTX_end(ctx);
220221
if (ctx != in_ctx)
221222
BN_CTX_free(ctx);

0 commit comments

Comments
 (0)