summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdsa/ecs_ossl.c
diff options
context:
space:
mode:
authorjsing <>2018-06-13 15:08:08 +0000
committerjsing <>2018-06-13 15:08:08 +0000
commitbe60d0cf0b244ebdb15f1b61031c677d37279477 (patch)
tree94e8b3bf64b48024482fc1204d9161630d517339 /src/lib/libcrypto/ecdsa/ecs_ossl.c
parent68fd9f4f1b62c5bdb7aedef5855563e416297dd9 (diff)
downloadopenbsd-be60d0cf0b244ebdb15f1b61031c677d37279477.tar.gz
openbsd-be60d0cf0b244ebdb15f1b61031c677d37279477.tar.bz2
openbsd-be60d0cf0b244ebdb15f1b61031c677d37279477.zip
MFC: Avoid a timing side-channel leak when generating DSA and ECDSA
signatures. This is caused by an attempt to do fast modular arithmetic, which introduces branches that leak information regarding secret values. Issue identified and reported by Keegan Ryan of NCC Group. ok beck@ tb@
Diffstat (limited to 'src/lib/libcrypto/ecdsa/ecs_ossl.c')
-rw-r--r--src/lib/libcrypto/ecdsa/ecs_ossl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/libcrypto/ecdsa/ecs_ossl.c b/src/lib/libcrypto/ecdsa/ecs_ossl.c
index c7f4bcbe03..09f3bf8416 100644
--- a/src/lib/libcrypto/ecdsa/ecs_ossl.c
+++ b/src/lib/libcrypto/ecdsa/ecs_ossl.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: ecs_ossl.c,v 1.9 2017/01/29 17:49:23 beck Exp $ */ 1/* $OpenBSD: ecs_ossl.c,v 1.9.2.1 2018/06/13 15:08:08 jsing Exp $ */
2/* 2/*
3 * Written by Nils Larsch for the OpenSSL project 3 * Written by Nils Larsch for the OpenSSL project
4 */ 4 */
@@ -273,7 +273,7 @@ ecdsa_do_sign(const unsigned char *dgst, int dgst_len,
273 ECDSAerror(ERR_R_BN_LIB); 273 ECDSAerror(ERR_R_BN_LIB);
274 goto err; 274 goto err;
275 } 275 }
276 if (!BN_mod_add_quick(s, tmp, m, order)) { 276 if (!BN_mod_add(s, tmp, m, order, ctx)) {
277 ECDSAerror(ERR_R_BN_LIB); 277 ECDSAerror(ERR_R_BN_LIB);
278 goto err; 278 goto err;
279 } 279 }