Return error if no cipher set for encrypted data type.
[oweals/openssl.git] / crypto / evp / pmeth_lib.c
index 5b8000d691c2f4667b9d20a94457eb0f6d5a5086..764271a36dd31dd9f2048fcde4334ff8b6f49dd7 100644 (file)
 typedef int sk_cmp_fn_type(const char * const *a, const char * const *b);
 STACK *app_pkey_methods = NULL;
 
-extern EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth, ec_pkey_meth;
+extern const EVP_PKEY_METHOD rsa_pkey_meth, dh_pkey_meth, dsa_pkey_meth;
+extern const EVP_PKEY_METHOD ec_pkey_meth, hmac_pkey_meth;
 
 static const EVP_PKEY_METHOD *standard_methods[] =
        {
        &rsa_pkey_meth,
        &dh_pkey_meth,
        &dsa_pkey_meth,
-       &ec_pkey_meth
+       &ec_pkey_meth,
+       &hmac_pkey_meth,
        };
 
 static int pmeth_cmp(const EVP_PKEY_METHOD * const *a,
@@ -289,6 +291,8 @@ int EVP_PKEY_meth_add0(const EVP_PKEY_METHOD *pmeth)
 
 void EVP_PKEY_CTX_free(EVP_PKEY_CTX *ctx)
        {
+       if (ctx == NULL)
+               return;
        if (ctx->pmeth && ctx->pmeth->cleanup)
                ctx->pmeth->cleanup(ctx);
        if (ctx->pkey)
@@ -386,6 +390,11 @@ EVP_PKEY *EVP_PKEY_CTX_get0_pkey(EVP_PKEY_CTX *ctx)
        return ctx->pkey;
        }
 
+EVP_PKEY *EVP_PKEY_CTX_get0_peerkey(EVP_PKEY_CTX *ctx)
+       {
+       return ctx->peerkey;
+       }
+       
 void EVP_PKEY_CTX_set_app_data(EVP_PKEY_CTX *ctx, void *data)
        {
        ctx->app_data = data;