-
Notifications
You must be signed in to change notification settings - Fork 104
/
asymsignlib.h
77 lines (72 loc) · 2.81 KB
/
asymsignlib.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/**
* Copyright Notice:
* Copyright 2021-2024 DMTF. All rights reserved.
* License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/libspdm/blob/main/LICENSE.md
**/
#ifndef RESPONDER_ASYMSIGNLIB_H
#define RESPONDER_ASYMSIGNLIB_H
#include "hal/base.h"
#include "internal/libspdm_lib_config.h"
#include "library/spdm_return_status.h"
#include "industry_standard/spdm.h"
#if LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP
/**
* This functions returns the opaque data in a CHALLENGE_AUTH response.
*
* @param spdm_context A pointer to the SPDM context.
* @param spdm_version Indicates the negotiated s version.
*
* @param slot_id The number of slot for the certificate chain.
*
* @param measurement_summary_hash The measurement summary hash.
* @param measurement_summary_hash_size The size of measurement summary hash.
*
* @param opaque_data
* A pointer to a destination buffer whose size, in bytes, is opaque_data_size. The opaque data is
* copied to this buffer.
*
* @param opaque_data_size
* On input, indicates the size, in bytes, of the destination buffer.
* On output, indicates the size of the opaque data.
**/
extern bool libspdm_challenge_opaque_data(
#if LIBSPDM_HAL_PASS_SPDM_CONTEXT
void *spdm_context,
#endif
spdm_version_number_t spdm_version,
uint8_t slot_id,
uint8_t *measurement_summary_hash,
size_t measurement_summary_hash_size,
void *opaque_data,
size_t *opaque_data_size);
#endif/*LIBSPDM_ENABLE_CAPABILITY_CHAL_CAP*/
/**
* Sign an SPDM message data.
*
* @param spdm_context A pointer to the SPDM context.
* @param spdm_version Indicates the negotiated s version.
* @param base_asym_algo Indicates the signing algorithm.
* @param base_hash_algo Indicates the hash algorithm.
* @param is_data_hash Indicate the message type.
* If true, raw message before hash.
* If false, message hash.
* @param message A pointer to a message to be signed.
* @param message_size The size, in bytes, of the message to be signed.
* @param signature A pointer to a destination buffer to store the signature.
* @param sig_size On input, indicates the size, in bytes, of the destination buffer to
* store the signature.
* On output, indicates the size, in bytes, of the signature in the buffer.
*
* @retval true Signing success.
* @retval false Signing fail.
**/
extern bool libspdm_responder_data_sign(
#if LIBSPDM_HAL_PASS_SPDM_CONTEXT
void *spdm_context,
#endif
spdm_version_number_t spdm_version,
uint8_t op_code, uint32_t base_asym_algo,
uint32_t base_hash_algo, bool is_data_hash,
const uint8_t *message, size_t message_size,
uint8_t *signature, size_t *sig_size);
#endif /* RESPONDER_ASYMSIGNLIB_H */