summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorinoguchi <>2022-01-20 11:10:11 +0000
committerinoguchi <>2022-01-20 11:10:11 +0000
commit58a48f1e9c4f1c9c42f60ac854e4870e9d623585 (patch)
tree188ac6f2f8e131bb09f336fa7e50535c1d677dfe /src
parenta955910e693f0845dc59f4264502c16ec3aad590 (diff)
downloadopenbsd-58a48f1e9c4f1c9c42f60ac854e4870e9d623585.tar.gz
openbsd-58a48f1e9c4f1c9c42f60ac854e4870e9d623585.tar.bz2
openbsd-58a48f1e9c4f1c9c42f60ac854e4870e9d623585.zip
Add check for BN_sub return value
CID 24839 ok jsing@ millert@ tb@
Diffstat (limited to 'src')
-rw-r--r--src/lib/libcrypto/rsa/rsa_eay.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_eay.c b/src/lib/libcrypto/rsa/rsa_eay.c
index a45cad0d0a..0f8c324dcc 100644
--- a/src/lib/libcrypto/rsa/rsa_eay.c
+++ b/src/lib/libcrypto/rsa/rsa_eay.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_eay.c,v 1.53 2022/01/07 09:55:32 tb Exp $ */ 1/* $OpenBSD: rsa_eay.c,v 1.54 2022/01/20 11:10:11 inoguchi Exp $ */
2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 2/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
@@ -447,7 +447,8 @@ RSA_eay_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
447 goto err; 447 goto err;
448 448
449 if (padding == RSA_X931_PADDING) { 449 if (padding == RSA_X931_PADDING) {
450 BN_sub(f, rsa->n, ret); 450 if (!BN_sub(f, rsa->n, ret))
451 goto err;
451 if (BN_cmp(ret, f) > 0) 452 if (BN_cmp(ret, f) > 0)
452 res = f; 453 res = f;
453 else 454 else