Loading...
Searching...
No Matches
psa_cryptocell_310_ecc_common.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2021 HAW Hamburg
3 * SPDX-License-Identifier: LGPL-2.1-only
4 */
5
6#pragma once
7
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24#include "psa/crypto.h"
25
26#include "sns_silib.h"
27#include "crys_ecpki_build.h"
28#include "crys_ecpki_ecdsa.h"
29#include "crys_ecpki_kg.h"
30#include "crys_ecpki_domain.h"
31
37#define MAP_PSA_HASH_TO_CRYS_HASH_AFTER(hash) \
38 ((hash == PSA_ALG_SHA_1) ? CRYS_ECPKI_AFTER_HASH_SHA1_mode : \
39 (hash == PSA_ALG_SHA_224) ? CRYS_ECPKI_AFTER_HASH_SHA224_mode : \
40 (hash == PSA_ALG_SHA_256) ? CRYS_ECPKI_AFTER_HASH_SHA256_mode : \
41 (hash == PSA_ALG_SHA_384) ? CRYS_ECPKI_AFTER_HASH_SHA384_mode : \
42 (hash == PSA_ALG_SHA_512) ? CRYS_ECPKI_AFTER_HASH_SHA512_mode : \
43 0)
44
50#define MAP_PSA_HASH_TO_CRYS_HASH_BEFORE(hash) \
51 ((hash == PSA_ALG_SHA_1) ? CRYS_ECPKI_HASH_SHA1_mode : \
52 (hash == PSA_ALG_SHA_224) ? CRYS_ECPKI_HASH_SHA224_mode : \
53 (hash == PSA_ALG_SHA_256) ? CRYS_ECPKI_HASH_SHA256_mode : \
54 (hash == PSA_ALG_SHA_384) ? CRYS_ECPKI_HASH_SHA384_mode : \
55 (hash == PSA_ALG_SHA_512) ? CRYS_ECPKI_HASH_SHA512_mode : \
56 0)
57
69 uint8_t *pub_key_buffer,
70 uint32_t *priv_key_buffer_length,
71 uint32_t *pub_key_buffer_length,
72 CRYS_ECPKI_DomainID_t domain);
73
85 uint8_t *pub_key_buffer,
86 uint32_t priv_key_buffer_length,
87 uint32_t *pub_key_buffer_length,
88 CRYS_ECPKI_DomainID_t domain);
89
104 uint32_t priv_key_size,
105 const uint8_t *input,
106 size_t input_length,
107 uint8_t *signature,
108 size_t *signature_length,
109 CRYS_ECPKI_HASH_OpMode_t hash_mode,
110 CRYS_ECPKI_DomainID_t domain);
111
127 size_t pub_key_size,
128 const uint8_t *input,
129 size_t input_length,
130 const uint8_t *signature,
131 size_t signature_length,
132 CRYS_ECPKI_HASH_OpMode_t hash_mode,
133 CRYS_ECPKI_DomainID_t domain);
134
135#ifdef __cplusplus
136}
137#endif
138
Function declarations for PSA Crypto.
int32_t psa_status_t
Status code type used for all PSA Certified APIs.
Definition error.h:37
psa_status_t cryptocell_310_common_ecc_generate_key_pair(uint8_t *priv_key_buffer, uint8_t *pub_key_buffer, uint32_t *priv_key_buffer_length, uint32_t *pub_key_buffer_length, CRYS_ECPKI_DomainID_t domain)
Common ECC key generation function.
psa_status_t cryptocell_310_common_ecc_sign(const uint8_t *priv_key, uint32_t priv_key_size, const uint8_t *input, size_t input_length, uint8_t *signature, size_t *signature_length, CRYS_ECPKI_HASH_OpMode_t hash_mode, CRYS_ECPKI_DomainID_t domain)
Common ECC signature function.
psa_status_t cryptocell_310_common_ecc_derive_pub_key(const uint8_t *priv_key_buffer, uint8_t *pub_key_buffer, uint32_t priv_key_buffer_length, uint32_t *pub_key_buffer_length, CRYS_ECPKI_DomainID_t domain)
Common ECC public key derivation function (not supported)
psa_status_t cryptocell_310_common_ecc_verify(const uint8_t *pub_key, size_t pub_key_size, const uint8_t *input, size_t input_length, const uint8_t *signature, size_t signature_length, CRYS_ECPKI_HASH_OpMode_t hash_mode, CRYS_ECPKI_DomainID_t domain)
Common ECC verification function.