-
Notifications
You must be signed in to change notification settings - Fork 109
/
Copy pathpsklib.h
58 lines (53 loc) · 2.14 KB
/
psklib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
/**
* Copyright Notice:
* Copyright 2023 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/
#ifndef REQUESTER_PSKLIB_H
#define REQUESTER_PSKLIB_H
#include "hal/base.h"
#include "internal/libspdm_lib_config.h"
#if LIBSPDM_ENABLE_CAPABILITY_PSK_CAP
/**
* Derive HMAC-based Expand key Derivation Function (HKDF) Expand, based upon the negotiated HKDF
* algorithm.
*
* @param base_hash_algo Indicates the hash algorithm.
* @param psk_hint Pointer to the peer-provided PSK Hint.
* @param psk_hint_size PSK Hint size in bytes.
* @param info Pointer to the application specific info.
* @param info_size Info size in bytes.
* @param out Pointer to buffer to receive HKDF value.
* @param out_size Size of HKDF bytes to generate.
*
* @retval true HKDF generated successfully.
* @retval false HKDF generation failed.
**/
extern bool libspdm_psk_handshake_secret_hkdf_expand(
spdm_version_number_t spdm_version,
uint32_t base_hash_algo, const uint8_t *psk_hint,
size_t psk_hint_size, const uint8_t *info,
size_t info_size, uint8_t *out, size_t out_size);
/**
* Derive HMAC-based Expand key Derivation Function (HKDF) Expand, based upon the negotiated HKDF
* algorithm.
*
* @param base_hash_algo Indicates the hash algorithm.
* @param psk_hint Pointer to the peer-provided PSK Hint.
* @param psk_hint_size PSK Hint size in bytes.
* @param info Pointer to the application specific info.
* @param info_size Info size in bytes.
* @param out Pointer to buffer to receive HKDF value.
* @param out_size Size of HKDF bytes to generate.
*
* @retval true HKDF generated successfully.
* @retval false HKDF generation failed.
**/
extern bool libspdm_psk_master_secret_hkdf_expand(
spdm_version_number_t spdm_version,
uint32_t base_hash_algo,
const uint8_t *psk_hint, size_t psk_hint_size,
const uint8_t *info, size_t info_size,
uint8_t *out, size_t out_size);
#endif /* LIBSPDM_ENABLE_CAPABILITY_PSK_CAP */
#endif /* REQUESTER_PSKLIB_H */