From f3e54c15d9cd1b465ba25c44e47a83c433c2e0eb Mon Sep 17 00:00:00 2001 From: tb Date: Wed, 2 Aug 2023 08:31:12 +0000 Subject: [PATCH] Remove the unused flags member of BN_BLINDING Nothing sets this, so remove it along with BN_BLINDING_NO_{UPDATE,RECREATE} and some checks that are always true. ok jsing --- lib/libcrypto/bn/bn_blind.c | 8 +++----- lib/libcrypto/bn/bn_local.h | 6 +----- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/lib/libcrypto/bn/bn_blind.c b/lib/libcrypto/bn/bn_blind.c index 54b75c294ba..6c434bef060 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.26 2023/08/02 08:26:55 tb Exp $ */ +/* $OpenBSD: bn_blind.c,v 1.27 2023/08/02 08:31:12 tb Exp $ */ /* ==================================================================== * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * @@ -126,7 +126,6 @@ struct bn_blinding_st { BIGNUM *mod; CRYPTO_THREADID tid; int counter; - unsigned long flags; BN_MONT_CTX *m_ctx; int (*bn_mod_exp)(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx); @@ -196,12 +195,11 @@ BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx) if (b->counter == -1) b->counter = 0; - if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL && - !(b->flags & BN_BLINDING_NO_RECREATE)) { + if (++b->counter == BN_BLINDING_COUNTER && b->e != NULL) { /* re-create blinding parameters */ if (!BN_BLINDING_create_param(b, NULL, NULL, ctx, NULL, NULL)) goto err; - } else if (!(b->flags & BN_BLINDING_NO_UPDATE)) { + } else { if (!BN_mod_mul(b->A, b->A, b->A, b->mod, ctx)) goto err; if (!BN_mod_mul(b->Ai, b->Ai, b->Ai, b->mod, ctx)) diff --git a/lib/libcrypto/bn/bn_local.h b/lib/libcrypto/bn/bn_local.h index c40002bed70..53d557dbe2f 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.28 2023/08/02 08:26:55 tb Exp $ */ +/* $OpenBSD: bn_local.h,v 1.29 2023/08/02 08:31:12 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -291,10 +291,6 @@ int BN_mod_exp_recp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p, int BN_div_recp(BIGNUM *dv, BIGNUM *rem, const BIGNUM *m, BN_RECP_CTX *recp, BN_CTX *ctx); -/* BN_BLINDING flags */ -#define BN_BLINDING_NO_UPDATE 0x00000001 -#define BN_BLINDING_NO_RECREATE 0x00000002 - BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod); void BN_BLINDING_free(BN_BLINDING *b); int BN_BLINDING_update(BN_BLINDING *b, BN_CTX *ctx); -- 2.20.1