12#ifndef __T_COSE_CRYPTO_H__
13#define __T_COSE_CRYPTO_H__
67#define T_COSE_EC_P256_SIG_SIZE 64
79#define T_COSE_MAX_EC_SIG_SIZE T_COSE_EC_P256_SIG_SIZE
90static inline size_t t_cose_signature_size(int32_t cose_sig_alg_id);
222#define T_COSE_CRYPTO_EC_P256_COORD_SIZE 32
274 int32_t *cose_curve_id,
309#define T_COSE_CRYPTO_SHA256_SIZE 32
345 int32_t cose_hash_alg_id);
402static inline size_t t_cose_signature_size(int32_t cose_sig_alg_id)
404 switch(cose_sig_alg_id) {
The context for use with the hash adaptation layer here.
UsefulBufC and UsefulBuf are simple data structures to hold a pointer and length for a binary data.
The non-const UsefulBuf typically used for some allocated memory that is to be filled in.
Defines common to all public t_cose interfaces.
t_cose_err_t
Error codes return by t_cose.
enum t_cose_err_t t_cose_crypto_pub_key_sign(int32_t cose_alg_id, int32_t key_select, struct useful_buf_c hash_to_sign, struct useful_buf signature_buffer, struct useful_buf_c *signature)
Perform public key signing.
enum t_cose_err_t t_cose_crypto_pub_key_verify(int32_t cose_alg_id, int32_t key_select, struct useful_buf_c key_id, struct useful_buf_c hash_to_verify, struct useful_buf_c signature)
perform public key signature verification.
void t_cose_crypto_hash_update(struct t_cose_crypto_hash *hash_ctx, struct useful_buf_c data_to_hash)
Feed data into a cryptographic hash.
enum t_cose_err_t t_cose_crypto_get_ec_pub_key(int32_t key_select, struct useful_buf_c kid, int32_t *cose_curve_id, struct useful_buf buf_to_hold_x_coord, struct useful_buf buf_to_hold_y_coord, struct useful_buf_c *x_coord, struct useful_buf_c *y_coord)
Get an elliptic curve public key.
enum t_cose_err_t t_cose_crypto_hash_finish(struct t_cose_crypto_hash *hash_ctx, struct useful_buf buffer_to_hold_result, struct useful_buf_c *hash_result)
Finish a cryptographic hash.
enum t_cose_err_t t_cose_crypto_hash_start(struct t_cose_crypto_hash *hash_ctx, int32_t cose_hash_alg_id)
Start cryptographic hash.
#define T_COSE_EC_P256_SIG_SIZE
Size of the signature output for the NIST P-256 Curve.
Constants from COSE standard and IANA registry.
#define COSE_ALGORITHM_ES256
Indicates ECDSA with SHA-256.
This is a TF-M coding style version of UsefulBuf.