Debian Codegraph @

crt/aws-c-cal/include/aws/cal/hkdf.h

raw symbols SCIP
1 #ifndef AWS_CAL_ECC_H
2 #define AWS_CAL_ECC_H
3 /**
4 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5 * SPDX-License-Identifier: Apache-2.0.
6 */
7 #include <aws/cal/exports.h>
8 #include <aws/common/byte_buf.h>
9 #include <aws/common/common.h>
10
11 AWS_PUSH_SANE_WARNING_LEVEL
12
13 AWS_EXTERN_C_BEGIN
14
15 /**
16 * Only supports SHA512 hmac for now.
17 * No reason other than thats the only one we need for now.
18 */
19 enum aws_hkdf_hmac_type {
20 HKDF_HMAC_SHA512,
21 };
22
23 /**
24 * Derive hkdf.
25 * hmac_type - type of hmac to use
26 * ikm - input keying material
27 * salt - salt (optional) all zeroes if not provided.
28 * info - extra info (optional).
29 * out_buf - must have enough capacity to fit result (i.e. have at least length left)
30 * length - length of generated key
31 */
32 AWS_CAL_API int aws_hkdf_derive(
33 struct aws_allocator *allocator,
34 enum aws_hkdf_hmac_type hmac_type,
35 struct aws_byte_cursor ikm,
36 struct aws_byte_cursor salt,
37 struct aws_byte_cursor info,
38 struct aws_byte_buf *out_buf,
39 size_t length);
40
41 typedef int(aws_hkdf_fn)(
42 struct aws_allocator *allocator,
43 enum aws_hkdf_hmac_type hmac_type,
44 struct aws_byte_cursor ikm,
45 struct aws_byte_cursor salt,
46 struct aws_byte_cursor info,
47 struct aws_byte_buf *out_buf,
48 size_t length);
49
50 AWS_CAL_API void aws_set_hkdf_fn(aws_hkdf_fn *fn);
51
52 AWS_EXTERN_C_END
53 AWS_POP_SANE_WARNING_LEVEL
54
55 #endif /* AWS_CAL_ECC_H */