summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/ecdsa/ecs_ossl.c
diff options
context:
space:
mode:
authorjsing <>2018-06-13 15:07:19 +0000
committerjsing <>2018-06-13 15:07:19 +0000
commitb6faac1f1a48896c4bea8877382f91ff23c964f7 (patch)
treeece62a633ca8cf87cfaec3ac556b1af956a6c209 /src/lib/libcrypto/ecdsa/ecs_ossl.c
parentba88944626ec9297c3c8cfa668f42b664c45a9cc (diff)
downloadopenbsd-b6faac1f1a48896c4bea8877382f91ff23c964f7.tar.gz
openbsd-b6faac1f1a48896c4bea8877382f91ff23c964f7.tar.bz2
openbsd-b6faac1f1a48896c4bea8877382f91ff23c964f7.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..e6745b115d 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.6.1 2018/06/13 15:07:19 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 }