summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/rsa/rsa_sign.c
diff options
context:
space:
mode:
authordjm <djm@openbsd.org>2018-09-05 00:55:33 +0000
committerdjm <djm@openbsd.org>2018-09-05 00:55:33 +0000
commit2f115aa846580043bf0b23d9fcc2c382657c60f6 (patch)
treeb1dcb8e269bb67857fd9ca9ab329116ebb67890e /lib/libcrypto/rsa/rsa_sign.c
parentForgot to rename pf_frent_holes() prototype in previous commit. (diff)
downloadwireguard-openbsd-2f115aa846580043bf0b23d9fcc2c382657c60f6.tar.xz
wireguard-openbsd-2f115aa846580043bf0b23d9fcc2c382657c60f6.zip
use timing-safe compares for checking results in signature verification
(there are no known attacks, this is just inexpensive prudence) feedback and ok tb@ jsing@
Diffstat (limited to 'lib/libcrypto/rsa/rsa_sign.c')
-rw-r--r--lib/libcrypto/rsa/rsa_sign.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/libcrypto/rsa/rsa_sign.c b/lib/libcrypto/rsa/rsa_sign.c
index 2383259ddaf..50e07f4f1e2 100644
--- a/lib/libcrypto/rsa/rsa_sign.c
+++ b/lib/libcrypto/rsa/rsa_sign.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rsa_sign.c,v 1.30 2018/07/23 17:37:17 tb Exp $ */
+/* $OpenBSD: rsa_sign.c,v 1.31 2018/09/05 00:55:33 djm Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
@@ -214,7 +214,8 @@ int_rsa_verify(int type, const unsigned char *m, unsigned int m_len,
RSAerror(RSA_R_INVALID_MESSAGE_LENGTH);
goto err;
}
- if (memcmp(decrypt_buf, m, SSL_SIG_LENGTH) != 0) {
+ if (timingsafe_bcmp(decrypt_buf,
+ m, SSL_SIG_LENGTH) != 0) {
RSAerror(RSA_R_BAD_SIGNATURE);
goto err;
}
@@ -244,7 +245,7 @@ int_rsa_verify(int type, const unsigned char *m, unsigned int m_len,
goto err;
if (encoded_len != decrypt_len ||
- memcmp(encoded, decrypt_buf, encoded_len) != 0) {
+ timingsafe_bcmp(encoded, decrypt_buf, encoded_len) != 0) {
RSAerror(RSA_R_BAD_SIGNATURE);
goto err;
}