mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-09-26 19:31:08 -04:00
fixing compilation for openssl-1.1.0 (part 6)
This commit is contained in:
parent
70e2a67786
commit
5951f460f6
1 changed files with 15 additions and 2 deletions
|
@ -586,15 +586,19 @@ int ops_rsa_private_decrypt(unsigned char *out,const unsigned char *in,
|
||||||
char errbuf[1024];
|
char errbuf[1024];
|
||||||
|
|
||||||
orsa=RSA_new();
|
orsa=RSA_new();
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
orsa->n=rsa->n; // XXX: do we need n?
|
orsa->n=rsa->n; // XXX: do we need n?
|
||||||
orsa->d=srsa->d;
|
orsa->d=srsa->d;
|
||||||
orsa->p=srsa->q;
|
orsa->p=srsa->q;
|
||||||
orsa->q=srsa->p;
|
orsa->q=srsa->p;
|
||||||
|
orsa->e=rsa->e;
|
||||||
|
#else
|
||||||
|
RSA_set0_key(orsa,BN_dup(rsa->n),BN_dup(rsa->e),BN_dup(srsa->d)) ;
|
||||||
|
RSA_set0_factors(orsa,BN_dup(srsa->p),BN_dup(srsa->q));
|
||||||
|
#endif
|
||||||
|
|
||||||
/* debug */
|
/* debug */
|
||||||
orsa->e=rsa->e;
|
|
||||||
assert(RSA_check_key(orsa) == 1);
|
assert(RSA_check_key(orsa) == 1);
|
||||||
orsa->e=NULL;
|
|
||||||
/* end debug */
|
/* end debug */
|
||||||
|
|
||||||
n=RSA_private_decrypt(length,in,out,orsa,RSA_NO_PADDING);
|
n=RSA_private_decrypt(length,in,out,orsa,RSA_NO_PADDING);
|
||||||
|
@ -608,7 +612,10 @@ int ops_rsa_private_decrypt(unsigned char *out,const unsigned char *in,
|
||||||
ERR_error_string(err,&errbuf[0]);
|
ERR_error_string(err,&errbuf[0]);
|
||||||
fprintf(stderr,"openssl error : %s\n",errbuf);
|
fprintf(stderr,"openssl error : %s\n",errbuf);
|
||||||
}
|
}
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
orsa->n=orsa->d=orsa->p=orsa->q=NULL;
|
orsa->n=orsa->d=orsa->p=orsa->q=NULL;
|
||||||
|
orsa->e=NULL;
|
||||||
|
#endif
|
||||||
RSA_free(orsa);
|
RSA_free(orsa);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
@ -631,8 +638,12 @@ int ops_rsa_public_encrypt(unsigned char *out,const unsigned char *in,
|
||||||
// printf("ops_rsa_public_encrypt: length=%ld\n", length);
|
// printf("ops_rsa_public_encrypt: length=%ld\n", length);
|
||||||
|
|
||||||
orsa=RSA_new();
|
orsa=RSA_new();
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
orsa->n=rsa->n;
|
orsa->n=rsa->n;
|
||||||
orsa->e=rsa->e;
|
orsa->e=rsa->e;
|
||||||
|
#else
|
||||||
|
RSA_set0_key(orsa,BN_dup(rsa->n),BN_dup(rsa->e),NULL);
|
||||||
|
#endif
|
||||||
|
|
||||||
// printf("len: %ld\n", length);
|
// printf("len: %ld\n", length);
|
||||||
// ops_print_bn("n: ", orsa->n);
|
// ops_print_bn("n: ", orsa->n);
|
||||||
|
@ -647,7 +658,9 @@ int ops_rsa_public_encrypt(unsigned char *out,const unsigned char *in,
|
||||||
BIO_free(fd_out) ;
|
BIO_free(fd_out) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if OPENSSL_VERSION_NUMBER < 0x10100000L
|
||||||
orsa->n=orsa->e=NULL;
|
orsa->n=orsa->e=NULL;
|
||||||
|
#endif
|
||||||
RSA_free(orsa);
|
RSA_free(orsa);
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue