diff options
author | jsing <> | 2017-01-05 13:27:17 +0000 |
---|---|---|
committer | jsing <> | 2017-01-05 13:27:17 +0000 |
commit | 5dba3dbd2d7a30484442155a0ffb1f9626d6e774 (patch) | |
tree | 62ac81fdfaf7a43991efc926d2044e95a1718635 | |
parent | 23f78c10894bdcafda0fd7ff6a4d5a2088838193 (diff) | |
download | openbsd-5dba3dbd2d7a30484442155a0ffb1f9626d6e774.tar.gz openbsd-5dba3dbd2d7a30484442155a0ffb1f9626d6e774.tar.bz2 openbsd-5dba3dbd2d7a30484442155a0ffb1f9626d6e774.zip |
MFC: Avoid a side-channel cache-timing attack that can leak the ECDSA
private keys when signing. This is due to BN_mod_inverse() being used
without the constant time flag being set.
This issue was reported by Cesar Pereida Garcia and Billy Brumley
(Tampere University of Technology). The fix was developed by Cesar Pereida
Garcia.
-rw-r--r-- | src/lib/libssl/src/crypto/ecdsa/ecs_ossl.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/libssl/src/crypto/ecdsa/ecs_ossl.c b/src/lib/libssl/src/crypto/ecdsa/ecs_ossl.c index 31102138c0..3748b13f0d 100644 --- a/src/lib/libssl/src/crypto/ecdsa/ecs_ossl.c +++ b/src/lib/libssl/src/crypto/ecdsa/ecs_ossl.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ecs_ossl.c,v 1.6 2015/02/08 13:35:07 jsing Exp $ */ | 1 | /* $OpenBSD: ecs_ossl.c,v 1.6.2.1 2017/01/05 13:27:17 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Written by Nils Larsch for the OpenSSL project | 3 | * Written by Nils Larsch for the OpenSSL project |
4 | */ | 4 | */ |
@@ -142,6 +142,8 @@ ecdsa_sign_setup(EC_KEY *eckey, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
142 | if (!BN_add(k, k, order)) | 142 | if (!BN_add(k, k, order)) |
143 | goto err; | 143 | goto err; |
144 | 144 | ||
145 | BN_set_flags(k, BN_FLG_CONSTTIME); | ||
146 | |||
145 | /* compute r the x-coordinate of generator * k */ | 147 | /* compute r the x-coordinate of generator * k */ |
146 | if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) { | 148 | if (!EC_POINT_mul(group, tmp_point, k, NULL, NULL, ctx)) { |
147 | ECDSAerr(ECDSA_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB); | 149 | ECDSAerr(ECDSA_F_ECDSA_SIGN_SETUP, ERR_R_EC_LIB); |