12#ifndef __T_COSE_SIGN1_VERIFY_H__
13#define __T_COSE_SIGN1_VERIFY_H__
19#include "qcbor/qcbor_common.h"
28#ifndef QCBOR_SPIFFY_DECODE
29#error This version of t_cose requires a version of QCBOR that supports spiffy decode
82 struct q_useful_buf_c
kid;
86 struct q_useful_buf_c
iv;
92#ifndef T_COSE_DISABLE_CONTENT_TYPE
109#define T_COSE_UNSET_ALGORITHM_ID 0
121#define T_COSE_OPT_ALLOW_SHORT_CIRCUIT 0x00000001
131#define T_COSE_OPT_REQUIRE_KID 0x00000002
148#define T_COSE_OPT_TAG_REQUIRED 0x00000004
160#define T_COSE_OPT_TAG_PROHIBITED 0x00000010
177#define T_COSE_OPT_DECODE_ONLY 0x00000008
188#define T_COSE_OPT_UNKNOWN_CRIT_ALLOWED 0x00000020
197#define T_COSE_MAX_TAGS_TO_RETURN 4
208 uint32_t option_flags;
211#ifndef T_COSE_DISABLE_EDDSA
223 size_t auxiliary_buffer_size;
238 uint32_t option_flags);
318 struct q_useful_buf auxiliary_buffer);
393 struct q_useful_buf_c sign1,
394 struct q_useful_buf_c *payload,
427 struct q_useful_buf_c sign1,
428 struct q_useful_buf_c aad,
429 struct q_useful_buf_c *payload,
459 struct q_useful_buf_c cose_sign1,
460 struct q_useful_buf_c aad,
461 struct q_useful_buf_c detached_payload,
495 uint32_t option_flags)
497 memset(me, 0,
sizeof(*me));
498 me->option_flags = option_flags;
500#ifndef T_COSE_DISABLE_EDDSA
513 me->verification_key = verification_key;
518 struct q_useful_buf auxiliary_buffer)
520#ifndef T_COSE_DISABLE_EDDSA
524 (void)auxiliary_buffer;
531#ifndef T_COSE_DISABLE_EDDSA
532 return me->auxiliary_buffer_size;
541static inline uint64_t
546 return CBOR_TAG_INVALID64;
548 return context->auTags[n];
572 struct q_useful_buf_c sign1,
573 struct q_useful_buf_c aad,
574 struct q_useful_buf_c *payload,
581 struct q_useful_buf_c sign1,
582 struct q_useful_buf_c *payload,
596 struct q_useful_buf_c cose_sign1,
597 struct q_useful_buf_c aad,
598 struct q_useful_buf_c *payload,
612 struct q_useful_buf_c cose_sign1,
613 struct q_useful_buf_c aad,
614 struct q_useful_buf_c detached_payload,
This is a TF-M coding style version of UsefulBuf. See UsefulBuf for documentation of these functions.
Definition t_cose_common.h:186
Definition t_cose_sign1_verify.h:71
struct q_useful_buf_c iv
Definition t_cose_sign1_verify.h:86
struct q_useful_buf_c kid
Definition t_cose_sign1_verify.h:82
int32_t cose_algorithm_id
Definition t_cose_sign1_verify.h:78
struct q_useful_buf_c partial_iv
Definition t_cose_sign1_verify.h:90
uint32_t content_type_uint
Definition t_cose_sign1_verify.h:100
struct q_useful_buf_c content_type_tstr
Definition t_cose_sign1_verify.h:95
Definition t_cose_sign1_verify.h:205
struct q_useful_buf auxiliary_buffer
Definition t_cose_sign1_verify.h:217
This file contains definitions common to all public t_cose interfaces.
t_cose_err_t
Definition t_cose_common.h:250
static size_t t_cose_sign1_verify_auxiliary_buffer_size(struct t_cose_sign1_verify_ctx *context)
Get the required auxiliary buffer size for the most recent verification operation.
Definition t_cose_sign1_verify.h:529
static enum t_cose_err_t t_cose_sign1_verify_detached(struct t_cose_sign1_verify_ctx *context, struct q_useful_buf_c cose_sign1, struct q_useful_buf_c aad, struct q_useful_buf_c detached_payload, struct t_cose_parameters *parameters)
Verify a COSE_Sign1 with detached payload.
Definition t_cose_sign1_verify.h:611
#define T_COSE_MAX_TAGS_TO_RETURN
Definition t_cose_sign1_verify.h:197
static uint64_t t_cose_sign1_get_nth_tag(const struct t_cose_sign1_verify_ctx *context, size_t n)
Return unprocessed tags from most recent signature verify.
Definition t_cose_sign1_verify.h:542
static void t_cose_sign1_verify_init(struct t_cose_sign1_verify_ctx *context, uint32_t option_flags)
Initialize for COSE_Sign1 message verification.
Definition t_cose_sign1_verify.h:494
static void t_cose_sign1_set_verification_key(struct t_cose_sign1_verify_ctx *context, struct t_cose_key verification_key)
Set key for COSE_Sign1 message verification.
Definition t_cose_sign1_verify.h:510
static enum t_cose_err_t t_cose_sign1_verify(struct t_cose_sign1_verify_ctx *context, struct q_useful_buf_c sign1, struct q_useful_buf_c *payload, struct t_cose_parameters *parameters)
Verify a COSE_Sign1.
Definition t_cose_sign1_verify.h:580
static enum t_cose_err_t t_cose_sign1_verify_aad(struct t_cose_sign1_verify_ctx *context, struct q_useful_buf_c sign1, struct q_useful_buf_c aad, struct q_useful_buf_c *payload, struct t_cose_parameters *parameters)
Verify a COSE_Sign1 with Additional Authenticated Data.
Definition t_cose_sign1_verify.h:595
enum t_cose_err_t t_cose_sign1_verify_internal(struct t_cose_sign1_verify_ctx *me, struct q_useful_buf_c sign1, struct q_useful_buf_c aad, struct q_useful_buf_c *payload, struct t_cose_parameters *parameters, bool is_detached)
Semi-private function to verify a COSE_Sign1.
static void t_cose_sign1_verify_set_auxiliary_buffer(struct t_cose_sign1_verify_ctx *context, struct q_useful_buf auxiliary_buffer)
Configure a buffer used to serialize the Sig_Structure.
Definition t_cose_sign1_verify.h:517