]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - openssl.c
vss: Add documentation of MAP_POPULATE.
[paraslash.git] / openssl.c
index 70a13aaab0b40339e3f042566a555c266375ad00..4895e176ba9cf7f86962d365f3d9514aed0f0180 100644 (file)
--- a/openssl.c
+++ b/openssl.c
@@ -55,6 +55,11 @@ void crypt_init(void)
        srandom(seed);
 }
 
+void crypt_shutdown(void)
+{
+       CRYPTO_cleanup_all_ex_data();
+}
+
 static int get_private_key(const char *path, RSA **rsa)
 {
        EVP_PKEY *pkey;
@@ -119,11 +124,11 @@ static int read_rsa_bignums(const unsigned char *blob, int blen, RSA **result)
                return -E_BIGNUM;
        ret = read_bignum(p, end - p, &e);
        if (ret < 0)
-               goto fail;
+               goto free_rsa;
        p += ret;
        ret = read_bignum(p, end - p, &n);
        if (ret < 0)
-               goto fail;
+               goto free_e;
 #ifdef HAVE_RSA_SET0_KEY
        RSA_set0_key(rsa, n, e, NULL);
 #else
@@ -132,7 +137,9 @@ static int read_rsa_bignums(const unsigned char *blob, int blen, RSA **result)
 #endif
        *result = rsa;
        return 1;
-fail:
+free_e:
+       BN_free(e);
+free_rsa:
        RSA_free(rsa);
        return ret;
 }