cipher_close(&c->outcipher);
digest_close(&c->outdigest);
+ ecdsa_free(&c->ecdsa);
+ rsa_free(&c->rsa);
+
if(c->hischallenge)
free(c->hischallenge);
return true;
}
+
+bool ecdsa_active(ecdsa_t *ecdsa) {
+ return *ecdsa;
+}
+
+void ecdsa_free(ecdsa_t *ecdsa) {
+ if(*ecdsa) {
+ EC_KEY_free(*ecdsa);
+ *ecdsa = NULL;
+ }
+}
extern size_t ecdsa_size(ecdsa_t *ecdsa);
extern bool ecdsa_sign(ecdsa_t *ecdsa, const void *in, size_t inlen, void *out);
extern bool ecdsa_verify(ecdsa_t *ecdsa, const void *in, size_t inlen, const void *out);
+extern bool ecdsa_active(ecdsa_t *ecdsa);
+extern void ecdsa_free(ecdsa_t *ecdsa);
#endif
logger(LOG_ERR, "Unable to perform RSA decryption: %s", ERR_error_string(ERR_get_error(), NULL));
return false;
}
+
+bool rsa_active(rsa_t *rsa) {
+ return *rsa;
+}
+
+void rsa_free(rsa_t *rsa) {
+ if(*rsa) {
+ RSA_free(*rsa);
+ *rsa = NULL;
+ }
+}
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 bool rsa_active(rsa_t *rsa);
+extern void rsa_free(rsa_t *rsa);
+
#endif