-bool rsa_set_hex_private_key(rsa_t *rsa, char *n, char *e, char *d) {
- *rsa = RSA_new();
- if(BN_hex2bn(&(*rsa)->n, n) != strlen(n))
- return false;
- if(BN_hex2bn(&(*rsa)->e, e) != strlen(e))
- return false;
- if(BN_hex2bn(&(*rsa)->d, d) != strlen(d))
+rsa_t *rsa_set_hex_private_key(char *n, char *e, char *d) {
+ rsa_t *rsa = RSA_new();
+ if(!rsa)
+ return NULL;
+
+ if(BN_hex2bn(&rsa->n, n) != strlen(n) || BN_hex2bn(&rsa->e, e) != strlen(e) || BN_hex2bn(&rsa->d, d) != strlen(d)) {
+ RSA_free(rsa);