Mbed OS Reference
Loading...
Searching...
No Matches
t_cose_common.h
Go to the documentation of this file.
1/*
2 * t_cose_common.h
3 *
4 * Copyright 2019, Laurence Lundblade
5 *
6 * SPDX-License-Identifier: BSD-3-Clause
7 *
8 * See BSD-3-Clause license in README.mdE.
9 */
10
11
12#ifndef __T_COSE_COMMON_H__
13#define __T_COSE_COMMON_H__
14
15
16/**
17 * \file t_cose_common.h
18 *
19 * \brief Defines common to all public t_cose interfaces.
20 *
21 */
22
23
24/* Private value. Intentionally not documented for Doxygen.
25 * This is the size allocated for the encoded protected headers. It
26 * needs to be big enough for make_protected_header() to succeed. It
27 * currently sized for one header with an algorithm ID up to 32 bits
28 * long -- one byte for the wrapping map, one byte for the label, 5
29 * bytes for the ID. If this is made accidentially too small, QCBOR will
30 * only return an error, and not overrun any buffers.
31 *
32 * 9 extra bytes are added, rounding it up to 16 total, in case some
33 * other protected header is to be added.
34 */
35#define T_COSE_SIGN1_MAX_PROT_HEADER (1+1+5+9)
36
37
38/**
39 * Error codes return by t_cose.
40 *
41 * Do not reorder these. It is OK to add
42 * new ones at the end.
43 */
45 /**
46 * Operation completed successfully
47 */
49 /**
50 * The requested signing algorithm is not supported.
51 */
53 /**
54 * Error constructing the protected headers.
55 */
57 /**
58 * The hash algorithm needed is not supported. Note that the
59 * signing algorithm identifier usually identifies the hash
60 * algorithm.
61 */
63 /**
64 * Some system failure when running the hash algorithm.
65 */
67 /**
68 * The buffer to receive a hash result is too small.
69 */
71 /**
72 * The buffer to receive result of a signing operation is too
73 * small.
74 */
76 /**
77 * The buffer to receive to receive a key is too small.
78 */
80 /**
81 * When verifying a \c COSE_Sign1, something is wrong with the
82 * format of the CBOR. For example, it is missing something like
83 * the payload.
84 */
86 /**
87 * When decoding some CBOR like a \c COSE_Sign1, the CBOR was not
88 * well-formed. Most likely what was supposed to be CBOR was is
89 * either not or it has been corrupted.
90 */
92 /**
93 * No algorithm ID was found when one is needed. For example, when
94 * verifying a \c COSE_Sign1.
95 */
97 /**
98 * No key ID was found when one is needed. For example, when
99 * verifying a \c COSE_Sign1.
100 */
102 /**
103 * Signature verification failed. For example, the cryptographic
104 * operations completed successfully but hash wasn't as expected.
105 */
107 /**
108 * Verification of a short-circuit signature failed.
109 */
111 /**
112 * Some (unspecified) argument was not valid.
113 */
115 /**
116 * Out of heap memory.
117 */
119 /**
120 * General unspecific failure.
121 */
123 /**
124 * Equivalent to \c PSA_ERROR_TAMPERING_DETECTED.
125 */
127 /**
128 * The key identified by a key slot of a key ID was not found.
129 */
131 /**
132 * The key was found, but it was the wrong type for the operation.
133 */
135 /**
136 * Error constructing the \c Sig_structure when signing or verify.
137 */
139 /**
140 * Signature was short-circuit. THe option to allow verification
141 * of short-circuit signatures was not set
142 */
145
146
147
148#endif /* __T_COSE_COMMON_H__ */
t_cose_err_t
Error codes return by t_cose.
Definition: t_cose_common.h:44
@ T_COSE_ERR_UNSUPPORTED_SIGNING_ALG
The requested signing algorithm is not supported.
Definition: t_cose_common.h:52
@ T_COSE_ERR_INSUFFICIENT_MEMORY
Out of heap memory.
@ T_COSE_ERR_WRONG_TYPE_OF_KEY
The key was found, but it was the wrong type for the operation.
@ T_COSE_ERR_SIG_BUFFER_SIZE
The buffer to receive result of a signing operation is too small.
Definition: t_cose_common.h:75
@ T_COSE_ERR_NO_KID
No key ID was found when one is needed.
@ T_COSE_ERR_UNSUPPORTED_HASH
The hash algorithm needed is not supported.
Definition: t_cose_common.h:62
@ T_COSE_ERR_HASH_GENERAL_FAIL
Some system failure when running the hash algorithm.
Definition: t_cose_common.h:66
@ T_COSE_ERR_CBOR_NOT_WELL_FORMED
When decoding some CBOR like a COSE_Sign1, the CBOR was not well-formed.
Definition: t_cose_common.h:91
@ T_COSE_ERR_SIGN1_FORMAT
When verifying a COSE_Sign1, something is wrong with the format of the CBOR.
Definition: t_cose_common.h:85
@ T_COSE_ERR_SHORT_CIRCUIT_SIG
Signature was short-circuit.
@ T_COSE_ERR_SIG_VERIFY
Signature verification failed.
@ T_COSE_ERR_BAD_SHORT_CIRCUIT_KID
Verification of a short-circuit signature failed.
@ T_COSE_ERR_PROTECTED_HEADERS
Error constructing the protected headers.
Definition: t_cose_common.h:56
@ T_COSE_ERR_TAMPERING_DETECTED
Equivalent to PSA_ERROR_TAMPERING_DETECTED.
@ T_COSE_ERR_SIG_STRUCT
Error constructing the Sig_structure when signing or verify.
@ T_COSE_ERR_HASH_BUFFER_SIZE
The buffer to receive a hash result is too small.
Definition: t_cose_common.h:70
@ T_COSE_ERR_UNKNOWN_KEY
The key identified by a key slot of a key ID was not found.
@ T_COSE_ERR_INVALID_ARGUMENT
Some (unspecified) argument was not valid.
@ T_COSE_ERR_FAIL
General unspecific failure.
@ T_COSE_SUCCESS
Operation completed successfully.
Definition: t_cose_common.h:48
@ T_COSE_ERR_NO_ALG_ID
No algorithm ID was found when one is needed.
Definition: t_cose_common.h:96
@ T_COSE_ERR_KEY_BUFFER_SIZE
The buffer to receive to receive a key is too small.
Definition: t_cose_common.h:79