Skip to content

Commit

Permalink
Revert "Fix Timing Oracle in RSA decryption"
Browse files Browse the repository at this point in the history
This reverts commit b1892d2.

Except for the moving derive_kdk to a separate function.

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #20281)
  • Loading branch information
bernd-edlinger authored and t8m committed Apr 4, 2023
1 parent 34e4a96 commit 4209ce6
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 670 deletions.
14 changes: 14 additions & 0 deletions crypto/bn/bn_blind.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@

#define BN_BLINDING_COUNTER 32

struct bn_blinding_st {
BIGNUM *A;
BIGNUM *Ai;
BIGNUM *e;
BIGNUM *mod; /* just a reference */
CRYPTO_THREAD_ID 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);
CRYPTO_RWLOCK *lock;
};

BN_BLINDING *BN_BLINDING_new(const BIGNUM *A, const BIGNUM *Ai, BIGNUM *mod)
{
BN_BLINDING *ret = NULL;
Expand Down
14 changes: 0 additions & 14 deletions crypto/bn/bn_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,20 +293,6 @@ struct bn_gencb_st {
} cb;
};

struct bn_blinding_st {
BIGNUM *A;
BIGNUM *Ai;
BIGNUM *e;
BIGNUM *mod; /* just a reference */
CRYPTO_THREAD_ID 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);
CRYPTO_RWLOCK *lock;
};

/*-
* BN_window_bits_for_exponent_size -- macro for sliding window mod_exp functions
*
Expand Down
2 changes: 1 addition & 1 deletion crypto/bn/build.info
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ $COMMON=bn_add.c bn_div.c bn_exp.c bn_lib.c bn_ctx.c bn_mul.c \
bn_mod.c bn_conv.c bn_rand.c bn_shift.c bn_word.c bn_blind.c \
bn_kron.c bn_sqrt.c bn_gcd.c bn_prime.c bn_sqr.c \
bn_recp.c bn_mont.c bn_mpi.c bn_exp2.c bn_gf2m.c bn_nist.c \
bn_intern.c bn_dh.c bn_rsa_fips186_4.c bn_const.c rsa_sup_mul.c
bn_intern.c bn_dh.c bn_rsa_fips186_4.c bn_const.c
SOURCE[../../libcrypto]=$COMMON $BNASM bn_print.c bn_err.c bn_srp.c
DEFINE[../../libcrypto]=$BNDEF
IF[{- !$disabled{'deprecated-0.9.8'} -}]
Expand Down

0 comments on commit 4209ce6

Please sign in to comment.