blob: aa35784010de63563a8d71a0d849e7692305f9c3 [file] [log] [blame]
Gabor Mezeia3eecd22022-02-09 16:57:26 +01001/*
2 * Copyright The Mbed TLS Contributors
3 * SPDX-License-Identifier: Apache-2.0
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License"); you may
6 * not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef MBEDTLS_SSL_TLS13_INVASIVE_H
19#define MBEDTLS_SSL_TLS13_INVASIVE_H
20
21#include "common.h"
22
23#if defined(MBEDTLS_PSA_CRYPTO_C)
24#include "psa/crypto.h"
25#endif
26
27#if defined(MBEDTLS_TEST_HOOKS)
28
29#if defined(MBEDTLS_PSA_CRYPTO_C)
30
31/**
32 * \brief Expand the supplied \p prk into several additional pseudorandom
33 * keys, which is the output of the HKDF.
34 *
35 * \param alg The HMAC algorithm to use (\c #PSA_ALG_HMAC( PSA_ALG_XXX )
36 * value such that PSA_ALG_XXX is a hash algorithm and
37 * #PSA_ALG_IS_HMAC(\p alg) is true).
38 * \param prk A pseudorandom key of \p prk_len bytes. \p prk is
39 * usually the output from the HKDF extract step.
40 * \param prk_len The length in bytes of \p prk.
41 * \param info An optional context and application specific information
42 * string. This can be a zero-length string.
43 * \param info_len The length of \p info in bytes.
44 * \param okm The output keying material of \p okm_len bytes.
45 * \param okm_len The length of the output keying material in bytes. This
46 * must be less than or equal to
47 * 255 * #PSA_HASH_LENGTH( \p alg ) bytes.
48 *
49 * \return 0 on success.
50 * \return #PSA_ERROR_INVALID_ARGUMENT when the parameters are invalid.
51 * \return An PSA_ERROR_* error for errors returned from the underlying
52 * PSA layer.
53 */
54psa_status_t mbedtls_psa_hkdf_expand( psa_algorithm_t alg,
55 const unsigned char *prk, size_t prk_len,
56 const unsigned char *info, size_t info_len,
57 unsigned char *okm, size_t okm_len );
58
59#endif /* MBEDTLS_PSA_CRYPTO_C */
60
61#endif /* MBEDTLS_TEST_HOOKS */
62
63#endif /* MBEDTLS_SSL_TLS13_INVASIVE_H */