Modify the 'speed' application so it now uses RSA_sign and RSA_verify
instead of RSA_private_encrypt and RSA_public_decrypt
This commit is contained in:
parent
d4cf2f1882
commit
c91e125934
23
apps/speed.c
23
apps/speed.c
@ -959,22 +959,22 @@ int MAIN(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RAND_bytes(buf,30);
|
RAND_bytes(buf,36);
|
||||||
#ifndef NO_RSA
|
#ifndef NO_RSA
|
||||||
for (j=0; j<RSA_NUM; j++)
|
for (j=0; j<RSA_NUM; j++)
|
||||||
{
|
{
|
||||||
|
int ret;
|
||||||
if (!rsa_doit[j]) continue;
|
if (!rsa_doit[j]) continue;
|
||||||
rsa_num=RSA_private_encrypt(30,buf,buf2,rsa_key[j],
|
ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num, rsa_key[j]);
|
||||||
RSA_PKCS1_PADDING);
|
|
||||||
pkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j],
|
pkey_print_message("private","rsa",rsa_c[j][0],rsa_bits[j],
|
||||||
RSA_SECONDS);
|
RSA_SECONDS);
|
||||||
/* RSA_blinding_on(rsa_key[j],NULL); */
|
/* RSA_blinding_on(rsa_key[j],NULL); */
|
||||||
Time_F(START);
|
Time_F(START);
|
||||||
for (count=0,run=1; COND(rsa_c[j][0]); count++)
|
for (count=0,run=1; COND(rsa_c[j][0]); count++)
|
||||||
{
|
{
|
||||||
rsa_num=RSA_private_encrypt(30,buf,buf2,rsa_key[j],
|
ret=RSA_sign(NID_md5_sha1, buf,36, buf2, &rsa_num,
|
||||||
RSA_PKCS1_PADDING);
|
rsa_key[j]);
|
||||||
if (rsa_num <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"RSA private encrypt failure\n");
|
BIO_printf(bio_err,"RSA private encrypt failure\n");
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
@ -989,18 +989,17 @@ int MAIN(int argc, char **argv)
|
|||||||
rsa_count=count;
|
rsa_count=count;
|
||||||
|
|
||||||
#if 1
|
#if 1
|
||||||
rsa_num2=RSA_public_decrypt(rsa_num,buf2,buf,rsa_key[j],
|
ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num, rsa_key[j]);
|
||||||
RSA_PKCS1_PADDING);
|
|
||||||
pkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j],
|
pkey_print_message("public","rsa",rsa_c[j][1],rsa_bits[j],
|
||||||
RSA_SECONDS);
|
RSA_SECONDS);
|
||||||
Time_F(START);
|
Time_F(START);
|
||||||
for (count=0,run=1; COND(rsa_c[j][1]); count++)
|
for (count=0,run=1; COND(rsa_c[j][1]); count++)
|
||||||
{
|
{
|
||||||
rsa_num2=RSA_public_decrypt(rsa_num,buf2,buf,rsa_key[j],
|
ret=RSA_verify(NID_md5_sha1, buf,36, buf2, rsa_num,
|
||||||
RSA_PKCS1_PADDING);
|
rsa_key[j]);
|
||||||
if (rsa_num2 <= 0)
|
if (ret <= 0)
|
||||||
{
|
{
|
||||||
BIO_printf(bio_err,"RSA public decrypt failure\n");
|
BIO_printf(bio_err,"RSA verify failure\n");
|
||||||
ERR_print_errors(bio_err);
|
ERR_print_errors(bio_err);
|
||||||
count=1;
|
count=1;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user