return mpi ? !err : true;
}
+rsa_t *rsa_new(void) {
+ return xzalloc(sizeof(rsa_t));
+}
+
rsa_t *rsa_set_hex_public_key(const char *n, const char *e) {
- rsa_t *rsa = xzalloc(sizeof(rsa_t));
+ rsa_t *rsa = rsa_new();
gcry_error_t err = gcry_mpi_scan(&rsa->n, GCRYMPI_FMT_HEX, n, 0, NULL);
}
rsa_t *rsa_set_hex_private_key(const char *n, const char *e, const char *d) {
- rsa_t *rsa = xzalloc(sizeof(rsa_t));
+ rsa_t *rsa = rsa_new();
gcry_error_t err = gcry_mpi_scan(&rsa->n, GCRYMPI_FMT_HEX, n, 0, NULL);
return NULL;
}
- rsa_t *rsa = xzalloc(sizeof(rsa_t));
+ rsa_t *rsa = rsa_new();
if(!ber_skip_sequence(&derp, &derlen)
|| !ber_read_mpi(&derp, &derlen, &rsa->n)
return NULL;
}
- rsa_t *rsa = xzalloc(sizeof(rsa_t));
+ rsa_t *rsa = rsa_new();
if(!ber_skip_sequence(&derp, &derlen)
|| !ber_read_mpi(&derp, &derlen, NULL)