Check BN_dup results in rsa_check

(cherry picked from commit a47235f4f5)
This commit is contained in:
Mark Andrews 2022-09-26 12:06:44 +10:00
parent 6b37a69213
commit 9f8eadd289

View file

@ -991,6 +991,9 @@ rsa_check(RSA *rsa, RSA *pub) {
}
} else {
n = BN_dup(n2);
if (n == NULL) {
return (ISC_R_NOMEMORY);
}
}
if (e1 != NULL) {
if (BN_cmp(e1, e2) != 0) {
@ -1001,6 +1004,12 @@ rsa_check(RSA *rsa, RSA *pub) {
}
} else {
e = BN_dup(e2);
if (e == NULL) {
if (n != NULL) {
BN_free(n);
}
return (ISC_R_NOMEMORY);
}
}
if (RSA_set0_key(rsa, n, e, NULL) == 0) {
if (n != NULL) {