Loading...
Searching...
No Matches
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
25extern "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
92 uint32_t priv_key_size,
93 const uint8_t *input,
94 size_t input_length,
95 uint8_t *signature,
96 size_t *signature_length,
97 CRYS_ECPKI_HASH_OpMode_t hash_mode,
98 CRYS_ECPKI_DomainID_t domain);
99
115 size_t pub_key_size,
116 const uint8_t *input,
117 size_t input_length,
118 const uint8_t *signature,
119 size_t signature_length,
120 CRYS_ECPKI_HASH_OpMode_t hash_mode,
121 CRYS_ECPKI_DomainID_t domain);
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif /* PSA_CRYPTOCELL_310_ECC_COMMON_H */
Function declarations for PSA Crypto.
int32_t psa_status_t
Function return status.
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_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.