return RSA_size(*rsa);
}
+/**
+ * free an RSA structure
+ *
+ * \param rsa pointer to the RSA struct to free
+ *
+ * This must be called for any key obtained by get_rsa_key().
+ */
+void rsa_free(RSA *rsa)
+{
+ if (rsa)
+ RSA_free(rsa);
+}
+
/**
* decrypt a buffer using an RSA key
*
if (ret < 0)
return ret;
ret = RSA_private_decrypt(rsa_inlen, inbuf, outbuf, rsa, RSA_PKCS1_PADDING);
+ rsa_free(rsa);
return (ret > 0)? ret : -E_DECRYPT;
}