if(c->thread)
thread_destroy(&c->thread);
+ if(c->rsa)
+ rsa_free(c->rsa);
+
free(c);
}
return true;
}
+
+void rsa_free(rsa_t *rsa) {
+ gcry_mpi_release(rsa->n);
+ gcry_mpi_release(rsa->e);
+ gcry_mpi_release(rsa->d);
+}
extern size_t rsa_size(rsa_t *rsa);
extern bool rsa_public_encrypt(rsa_t *rsa, void *in, size_t len, void *out);
extern bool rsa_private_decrypt(rsa_t *rsa, void *in, size_t len, void *out);
+extern void rsa_free(rsa_t *rsa);
#endif
logger(LOG_ERR, "Unable to perform RSA decryption: %s", ERR_error_string(ERR_get_error(), NULL));
return false;
}
+
+void rsa_free(rsa_t *rsa) {
+ RSA_free(*rsa);
+}
extern size_t rsa_size(rsa_t *rsa);
extern bool rsa_public_encrypt(rsa_t *rsa, void *in, size_t inlen, void *out);
extern bool rsa_private_decrypt(rsa_t *rsa, void *in, size_t inlen, void *out);
+extern void rsa_free(rsa_t *rsa);
#endif