aboutsummaryrefslogtreecommitdiffstats
path: root/lib/crypto/c_src
diff options
context:
space:
mode:
authorDoug Hogan <[email protected]>2019-01-05 13:42:34 -0800
committerDoug Hogan <[email protected]>2019-01-08 01:11:59 -0800
commitf03e582f0cdc2518ecd3b231c721d45b48381fed (patch)
tree123690a2327a243cc490d112d5e2ce5d5d408d94 /lib/crypto/c_src
parent30c7fa8f5a6b7874d5ab144665bb560f2c89e9a1 (diff)
downloadotp-f03e582f0cdc2518ecd3b231c721d45b48381fed.tar.gz
otp-f03e582f0cdc2518ecd3b231c721d45b48381fed.tar.bz2
otp-f03e582f0cdc2518ecd3b231c721d45b48381fed.zip
Revamp test_rsa_sign()
Diffstat (limited to 'lib/crypto/c_src')
-rw-r--r--lib/crypto/c_src/otp_test_engine.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/lib/crypto/c_src/otp_test_engine.c b/lib/crypto/c_src/otp_test_engine.c
index 26a64161dc..f971dbc3ca 100644
--- a/lib/crypto/c_src/otp_test_engine.c
+++ b/lib/crypto/c_src/otp_test_engine.c
@@ -387,11 +387,10 @@ int test_rsa_sign(int dtype,
/* The key */
const RSA *rsa)
{
- int slen;
fprintf(stderr, "test_rsa_sign (dtype=%i) called m_len=%u *siglen=%u\r\n", dtype, m_len, *siglen);
if (!sigret) {
fprintf(stderr, "sigret = NULL\r\n");
- return -1;
+ goto err;
}
/* {int i;
@@ -403,14 +402,20 @@ int test_rsa_sign(int dtype,
if ((sizeof(fake_flag) == m_len)
&& bcmp(m,fake_flag,m_len) == 0) {
+ int slen;
+
printf("To be faked\r\n");
/* To be faked */
- slen = RSA_size(rsa);
- add_test_data(sigret, slen); /* The signature is 0,1,2...255,0,1... */
- *siglen = slen; /* Must set this. Why? */
+ if ((slen = RSA_size(rsa)) < 0)
+ goto err;
+ add_test_data(sigret, (unsigned int)slen); /* The signature is 0,1,2...255,0,1... */
+ *siglen = (unsigned int)slen; /* Must set this. Why? */
return 1; /* 1 = success */
}
return 0;
+
+ err:
+ return -1;
}
int test_rsa_verify(int dtype,