hkdf: when HMAC key is all zeros, still set a valid key length
[openssl.git] / doc / man3 / EVP_PKEY_set_type.pod
1 =pod
2
3 =head1 NAME
4
5 EVP_PKEY_set_type, EVP_PKEY_set_type_str, EVP_PKEY_set_type_by_keymgmt
6 - functions to change the EVP_PKEY type
7
8 =head1 SYNOPSIS
9
10  #include <openssl/evp.h>
11
12  int EVP_PKEY_set_type(EVP_PKEY *pkey, int type);
13  int EVP_PKEY_set_type_str(EVP_PKEY *pkey, const char *str, int len);
14  int EVP_PKEY_set_type_by_keymgmt(EVP_PKEY *pkey, EVP_KEYMGMT *keymgmt);
15
16 =head1 DESCRIPTION
17
18 All the functions described here behave the same in so far that they
19 clear all the previous key data and methods from I<pkey>, and reset it
20 to be of the type of key given by the different arguments.  If
21 I<pkey> is NULL, these functions will still return the same return
22 values as if it wasn't.
23
24 EVP_PKEY_set_type() initialises I<pkey> to contain an internal legacy
25 key.  When doing this, it finds a L<EVP_PKEY_ASN1_METHOD(3)>
26 corresponding to I<type>, and associates I<pkey> with the findings.
27 It is an error if no L<EVP_PKEY_ASN1_METHOD(3)> could be found for
28 I<type>.
29
30 EVP_PKEY_set_type_str() initialises I<pkey> to contain an internal legacy
31 key. When doing this, it finds a L<EVP_PKEY_ASN1_METHOD(3)>
32 corresponding to I<str> that has then length I<len>, and associates
33 I<pkey> with the findings.
34 It is an error if no L<EVP_PKEY_ASN1_METHOD(3)> could be found for
35 I<type>.
36
37 For both EVP_PKEY_set_type() and EVP_PKEY_set_type_str(), I<pkey> gets
38 a numeric type, which can be retrieved with L<EVP_PKEY_get_id(3)>.  This
39 numeric type is taken from the L<EVP_PKEY_ASN1_METHOD(3)> that was
40 found, and is equal to or closely related to I<type> in the case of
41 EVP_PKEY_set_type(), or related to I<str> in the case of
42 EVP_PKEY_set_type_str().
43
44 EVP_PKEY_set_type_by_keymgmt() initialises I<pkey> to contain an
45 internal provider side key.  When doing this, it associates I<pkey>
46 with I<keymgmt>.  For keys initialised like this, the numeric type
47 retrieved with L<EVP_PKEY_get_id(3)> will always be B<EVP_PKEY_NONE>.
48
49 =head1 RETURN VALUES
50
51 All functions described here return 1 if successful, or 0 on error.
52
53 =head1 SEE ALSO
54
55 L<EVP_PKEY_assign(3)>, L<EVP_PKEY_get_id(3)>, L<EVP_PKEY_get0_RSA(3)>,
56 L<EVP_PKEY_copy_parameters(3)>, L<EVP_PKEY_ASN1_METHOD(3)>,
57 L<EVP_KEYMGMT(3)>
58
59 =head1 COPYRIGHT
60
61 Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
62
63 Licensed under the Apache License 2.0 (the "License").  You may not use
64 this file except in compliance with the License.  You can obtain a copy
65 in the file LICENSE in the source distribution or at
66 L<https://www.openssl.org/source/license.html>.
67
68 =cut