5 EVP_PKEY_new, EVP_PKEY_up_ref, EVP_PKEY_free - private key allocation functions
9 #include <openssl/evp.h>
11 EVP_PKEY *EVP_PKEY_new(void);
12 int EVP_PKEY_up_ref(EVP_PKEY *key);
13 void EVP_PKEY_free(EVP_PKEY *key);
18 The EVP_PKEY_new() function allocates an empty B<EVP_PKEY> structure which is
19 used by OpenSSL to store private keys. The reference count is set to B<1>.
21 EVP_PKEY_up_ref() increments the reference count of B<key>.
23 EVP_PKEY_free() decrements the reference count of B<key> and, if the reference
24 count is zero, frees it up. If B<key> is NULL, nothing is done.
28 The B<EVP_PKEY> structure is used by various OpenSSL functions which require a
29 general private key without reference to any particular algorithm.
31 The structure returned by EVP_PKEY_new() is empty. To add a private key to this
32 empty structure the functions described in L<EVP_PKEY_set1_RSA(3)> should be
37 EVP_PKEY_new() returns either the newly allocated B<EVP_PKEY> structure or
38 B<NULL> if an error occurred.
40 EVP_PKEY_up_ref() returns 1 for success and 0 for failure.
44 L<EVP_PKEY_set1_RSA(3)>
48 EVP_PKEY_new() and EVP_PKEY_free() exist in all versions of OpenSSL.
50 EVP_PKEY_up_ref() was first added to OpenSSL 1.1.0.
54 Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
56 Licensed under the OpenSSL license (the "License"). You may not use
57 this file except in compliance with the License. You can obtain a copy
58 in the file LICENSE in the source distribution or at
59 L<https://www.openssl.org/source/license.html>.