From 94363b601c66a006b29e800696205f3675c207a0 Mon Sep 17 00:00:00 2001 From: Steffen Jaeckel Date: Sun, 28 Sep 2014 22:52:32 +0200 Subject: [PATCH] add testcase to verify that this patch is working --- testprof/rsa_test.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/testprof/rsa_test.c b/testprof/rsa_test.c index ae27ec1..7e7e45c 100644 --- a/testprof/rsa_test.c +++ b/testprof/rsa_test.c @@ -291,6 +291,26 @@ for (cnt = 0; cnt < len; ) { return 1; } + /* verify with privKey but remove pointer to dP to test without CRT */ + + void* dP = privKey.dP; + privKey.dP = NULL; + /* change byte back to original */ + in[0] ^= 1; + DO(rsa_verify_hash(out, len, in, 20, hash_idx, 0, &stat, &privKey)); + /* change a byte */ + in[0] ^= 1; + DO(rsa_verify_hash(out, len, in, 20, hash_idx, 0, &stat2, &privKey)); + + if (!(stat == 1 && stat2 == 0)) { + fprintf(stderr, "rsa_verify_hash (unsalted, privKey) failed, %d, %d", stat, stat2); + rsa_free(&key); + rsa_free(&pubKey); + rsa_free(&privKey); + return 1; + } + privKey.dP = dP; + /* verify with pubKey */ /* change byte back to original */ in[0] ^= 1;