diff options
Diffstat (limited to 'src/lib/libcrypto/doc/EVP_PKEY_derive.pod')
-rw-r--r-- | src/lib/libcrypto/doc/EVP_PKEY_derive.pod | 94 |
1 files changed, 0 insertions, 94 deletions
diff --git a/src/lib/libcrypto/doc/EVP_PKEY_derive.pod b/src/lib/libcrypto/doc/EVP_PKEY_derive.pod deleted file mode 100644 index 09654e1b81..0000000000 --- a/src/lib/libcrypto/doc/EVP_PKEY_derive.pod +++ /dev/null | |||
@@ -1,94 +0,0 @@ | |||
1 | =pod | ||
2 | |||
3 | =head1 NAME | ||
4 | |||
5 | EVP_PKEY_derive_init, EVP_PKEY_derive_set_peer, EVP_PKEY_derive - derive public | ||
6 | key algorithm shared secret. | ||
7 | |||
8 | =head1 SYNOPSIS | ||
9 | |||
10 | #include <openssl/evp.h> | ||
11 | |||
12 | int EVP_PKEY_derive_init(EVP_PKEY_CTX *ctx); | ||
13 | int EVP_PKEY_derive_set_peer(EVP_PKEY_CTX *ctx, EVP_PKEY *peer); | ||
14 | int EVP_PKEY_derive(EVP_PKEY_CTX *ctx, unsigned char *key, size_t *keylen); | ||
15 | |||
16 | =head1 DESCRIPTION | ||
17 | |||
18 | The EVP_PKEY_derive_init() function initializes a public key algorithm | ||
19 | context using key B<pkey> for shared secret derivation. | ||
20 | |||
21 | The EVP_PKEY_derive_set_peer() function sets the peer key: this will normally | ||
22 | be a public key. | ||
23 | |||
24 | The EVP_PKEY_derive() derives a shared secret using B<ctx>. | ||
25 | If B<key> is B<NULL> then the maximum size of the output buffer is written to | ||
26 | the B<keylen> parameter. If B<key> is not B<NULL> then before the call the | ||
27 | B<keylen> parameter should contain the length of the B<key> buffer, if the call | ||
28 | is successful the shared secret is written to B<key> and the amount of data | ||
29 | written to B<keylen>. | ||
30 | |||
31 | =head1 NOTES | ||
32 | |||
33 | After the call to EVP_PKEY_derive_init() algorithm specific control | ||
34 | operations can be performed to set any appropriate parameters for the | ||
35 | operation. | ||
36 | |||
37 | The function EVP_PKEY_derive() can be called more than once on the same | ||
38 | context if several operations are performed using the same parameters. | ||
39 | |||
40 | =head1 RETURN VALUES | ||
41 | |||
42 | EVP_PKEY_derive_init() and EVP_PKEY_derive() return 1 for success and 0 | ||
43 | or a negative value for failure. In particular a return value of -2 | ||
44 | indicates the operation is not supported by the public key algorithm. | ||
45 | |||
46 | =head1 EXAMPLE | ||
47 | |||
48 | Derive shared secret (for example DH or EC keys): | ||
49 | |||
50 | #include <openssl/evp.h> | ||
51 | #include <openssl/rsa.h> | ||
52 | |||
53 | EVP_PKEY_CTX *ctx; | ||
54 | unsigned char *skey; | ||
55 | size_t skeylen; | ||
56 | EVP_PKEY *pkey, *peerkey; | ||
57 | /* NB: assumes pkey, peerkey have been already set up */ | ||
58 | |||
59 | ctx = EVP_PKEY_CTX_new(pkey); | ||
60 | if (!ctx) | ||
61 | /* Error occurred */ | ||
62 | if (EVP_PKEY_derive_init(ctx) <= 0) | ||
63 | /* Error */ | ||
64 | if (EVP_PKEY_derive_set_peer(ctx, peerkey) <= 0) | ||
65 | /* Error */ | ||
66 | |||
67 | /* Determine buffer length */ | ||
68 | if (EVP_PKEY_derive(ctx, NULL, &skeylen) <= 0) | ||
69 | /* Error */ | ||
70 | |||
71 | skey = malloc(skeylen); | ||
72 | |||
73 | if (!skey) | ||
74 | /* malloc failure */ | ||
75 | |||
76 | if (EVP_PKEY_derive(ctx, skey, &skeylen) <= 0) | ||
77 | /* Error */ | ||
78 | |||
79 | /* Shared secret is skey bytes written to buffer skey */ | ||
80 | |||
81 | =head1 SEE ALSO | ||
82 | |||
83 | L<EVP_PKEY_CTX_new(3)|EVP_PKEY_CTX_new(3)>, | ||
84 | L<EVP_PKEY_encrypt(3)|EVP_PKEY_encrypt(3)>, | ||
85 | L<EVP_PKEY_decrypt(3)|EVP_PKEY_decrypt(3)>, | ||
86 | L<EVP_PKEY_sign(3)|EVP_PKEY_sign(3)>, | ||
87 | L<EVP_PKEY_verify(3)|EVP_PKEY_verify(3)>, | ||
88 | L<EVP_PKEY_verify_recover(3)|EVP_PKEY_verify_recover(3)>, | ||
89 | |||
90 | =head1 HISTORY | ||
91 | |||
92 | These functions were first added to OpenSSL 1.0.0. | ||
93 | |||
94 | =cut | ||