psa_cryptocell_310_ecc_common.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2021 HAW Hamburg
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser
5  * General Public License v2.1. See the file LICENSE in the top level
6  * directory for more details.
7  */
8 
21 #ifndef PSA_CRYPTOCELL_310_ECC_COMMON_H
22 #define PSA_CRYPTOCELL_310_ECC_COMMON_H
23 
24 #ifdef __cplusplus
25 extern "C" {
26 #endif
27 
28 #include "psa/crypto.h"
29 
30 #include "sns_silib.h"
31 #include "crys_ecpki_build.h"
32 #include "crys_ecpki_ecdsa.h"
33 #include "crys_ecpki_kg.h"
34 #include "crys_ecpki_domain.h"
35 
41 #define MAP_PSA_HASH_TO_CRYS_HASH_AFTER(hash) \
42  ((hash == PSA_ALG_SHA_1) ? CRYS_ECPKI_AFTER_HASH_SHA1_mode : \
43  (hash == PSA_ALG_SHA_224) ? CRYS_ECPKI_AFTER_HASH_SHA224_mode : \
44  (hash == PSA_ALG_SHA_256) ? CRYS_ECPKI_AFTER_HASH_SHA256_mode : \
45  (hash == PSA_ALG_SHA_384) ? CRYS_ECPKI_AFTER_HASH_SHA384_mode : \
46  (hash == PSA_ALG_SHA_512) ? CRYS_ECPKI_AFTER_HASH_SHA512_mode : \
47  0)
48 
54 #define MAP_PSA_HASH_TO_CRYS_HASH_BEFORE(hash) \
55  ((hash == PSA_ALG_SHA_1) ? CRYS_ECPKI_HASH_SHA1_mode : \
56  (hash == PSA_ALG_SHA_224) ? CRYS_ECPKI_HASH_SHA224_mode : \
57  (hash == PSA_ALG_SHA_256) ? CRYS_ECPKI_HASH_SHA256_mode : \
58  (hash == PSA_ALG_SHA_384) ? CRYS_ECPKI_HASH_SHA384_mode : \
59  (hash == PSA_ALG_SHA_512) ? CRYS_ECPKI_HASH_SHA512_mode : \
60  0)
61 
73  uint8_t *pub_key_buffer,
74  uint32_t *priv_key_buffer_length,
75  uint32_t *pub_key_buffer_length,
76  CRYS_ECPKI_DomainID_t domain);
77 
89  uint8_t *pub_key_buffer,
90  uint32_t priv_key_buffer_length,
91  uint32_t *pub_key_buffer_length,
92  CRYS_ECPKI_DomainID_t domain);
93 
108  uint32_t priv_key_size,
109  const uint8_t *input,
110  size_t input_length,
111  uint8_t *signature,
112  size_t *signature_length,
113  CRYS_ECPKI_HASH_OpMode_t hash_mode,
114  CRYS_ECPKI_DomainID_t domain);
115 
131  size_t pub_key_size,
132  const uint8_t *input,
133  size_t input_length,
134  const uint8_t *signature,
135  size_t signature_length,
136  CRYS_ECPKI_HASH_OpMode_t hash_mode,
137  CRYS_ECPKI_DomainID_t domain);
138 
139 #ifdef __cplusplus
140 }
141 #endif
142 
143 #endif /* PSA_CRYPTOCELL_310_ECC_COMMON_H */
Function declarations for PSA Crypto.
int32_t psa_status_t
Status code type used for all PSA Certified APIs.
Definition: error.h:40
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.