]> git.ipfire.org Git - thirdparty/openssl.git/blame - doc/crypto/EVP_PKEY_new.pod
Unify <TYPE>_up_ref methods signature and behaviour.
[thirdparty/openssl.git] / doc / crypto / EVP_PKEY_new.pod
CommitLineData
d30e4c5b
DSH
1=pod
2
3=head1 NAME
4
0c497e96 5EVP_PKEY_new, EVP_PKEY_up_ref, EVP_PKEY_free - private key allocation functions.
d30e4c5b
DSH
6
7=head1 SYNOPSIS
8
9 #include <openssl/evp.h>
10
11 EVP_PKEY *EVP_PKEY_new(void);
c5ebfcab 12 int EVP_PKEY_up_ref(EVP_PKEY *key);
d30e4c5b
DSH
13 void EVP_PKEY_free(EVP_PKEY *key);
14
15
16=head1 DESCRIPTION
17
0c497e96
DSH
18The EVP_PKEY_new() function allocates an empty B<EVP_PKEY> structure which is
19used by OpenSSL to store private keys. The reference count is set to B<1>.
d30e4c5b 20
0c497e96
DSH
21EVP_PKEY_up_ref() increments the reference count of B<key>.
22
23EVP_PKEY_free() decrements the reference count of B<key> and, if the reference
24count is zero, frees it up. If B<key> is NULL, nothing is done.
d30e4c5b
DSH
25
26=head1 NOTES
27
0c497e96
DSH
28The B<EVP_PKEY> structure is used by various OpenSSL functions which require a
29general private key without reference to any particular algorithm.
d30e4c5b 30
0c497e96
DSH
31The structure returned by EVP_PKEY_new() is empty. To add a private key to this
32empty structure the functions described in L<EVP_PKEY_set1_RSA(3)> should be
33used.
d30e4c5b
DSH
34
35=head1 RETURN VALUES
36
0c497e96
DSH
37EVP_PKEY_new() returns either the newly allocated B<EVP_PKEY> structure or
38B<NULL> if an error occurred.
d30e4c5b 39
c5ebfcab 40EVP_PKEY_up_ref() returns 1 for success and 0 for failure.
d30e4c5b
DSH
41
42=head1 SEE ALSO
43
9b86974e 44L<EVP_PKEY_set1_RSA(3)>
d30e4c5b
DSH
45
46=head1 HISTORY
47
0c497e96
DSH
48EVP_PKEY_new() and EVP_PKEY_free() exist in all versions of OpenSSL.
49
50EVP_PKEY_up_ref() was first added to OpenSSL 1.1.0.
d30e4c5b
DSH
51
52=cut