diff options
author | Pauli <paul.dale@oracle.com> | 2020-11-10 17:05:30 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2020-11-12 08:21:47 +1000 |
commit | 93c87f745d5694b829d5b52d371d478b063a1fba (patch) | |
tree | 42786e9927584bbfb1f4ee2719957d8960054c03 | |
parent | d8701e25239dc3d0c9d871e53873f592420f71d0 (diff) |
rsa_test: add return value check
Fixes #13361
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13362)
-rw-r--r-- | test/rsa_test.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/test/rsa_test.c b/test/rsa_test.c index 67f2980881..5e7529876a 100644 --- a/test/rsa_test.c +++ b/test/rsa_test.c @@ -231,18 +231,20 @@ static int pad_unknown(void) static int rsa_setkey(RSA** key, unsigned char* ctext, int idx) { int clen = 0; + *key = RSA_new(); - switch (idx) { - case 0: - clen = key1(*key, ctext); - break; - case 1: - clen = key2(*key, ctext); - break; - case 2: - clen = key3(*key, ctext); - break; - } + if (*key != NULL) + switch (idx) { + case 0: + clen = key1(*key, ctext); + break; + case 1: + clen = key2(*key, ctext); + break; + case 2: + clen = key3(*key, ctext); + break; + } return clen; } |