Debian Codegraph @

crt/s2n/tests/features/S2N_LIBCRYPTO_SUPPORTS_HKDF.c

raw symbols SCIP
1 /*
2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License").
5 * You may not use this file except in compliance with the License.
6 * A copy of the License is located at
7 *
8 * http://aws.amazon.com/apache2.0
9 *
10 * or in the "license" file accompanying this file. This file is distributed
11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12 * express or implied. See the License for the specific language governing
13 * permissions and limitations under the License.
14 */
15
16 #include <openssl/digest.h>
17 #include <openssl/hkdf.h>
18
19 #define TEST_BUFFER_SIZE 64
20
21 int main()
22 {
23 uint8_t out_key[TEST_BUFFER_SIZE] = { 0 };
24 const uint8_t secret[TEST_BUFFER_SIZE] = { 0 };
25 const uint8_t salt[TEST_BUFFER_SIZE] = { 0 };
26 const uint8_t info[TEST_BUFFER_SIZE] = { 0 };
27 const uint8_t prk[TEST_BUFFER_SIZE] = { 0 };
28
29 HKDF(out_key, TEST_BUFFER_SIZE, EVP_sha256(),
30 secret, TEST_BUFFER_SIZE,
31 salt, TEST_BUFFER_SIZE,
32 info, TEST_BUFFER_SIZE);
33
34 size_t out_len = TEST_BUFFER_SIZE;
35 HKDF_extract(out_key, &out_len, EVP_sha256(),
36 secret, TEST_BUFFER_SIZE,
37 salt, TEST_BUFFER_SIZE);
38
39 HKDF_expand(out_key, TEST_BUFFER_SIZE, EVP_sha256(),
40 prk, TEST_BUFFER_SIZE,
41 info, TEST_BUFFER_SIZE);
42
43 return 0;
44 }