Loading...
Searching...
No Matches
psa_cryptocell_310_ecc_common.h File Reference

Common ECC functions used by all PSA Crypto wrappers for the CryptoCell 310 ECC APIs. More...

Detailed Description

Common ECC functions used by all PSA Crypto wrappers for the CryptoCell 310 ECC APIs.

Author
Lena Boeckmann lena..nosp@m.boec.nosp@m.kmann.nosp@m.@haw.nosp@m.-hamb.nosp@m.urg..nosp@m.de

Definition in file psa_cryptocell_310_ecc_common.h.

#include "psa/crypto.h"
#include "sns_silib.h"
#include "crys_ecpki_build.h"
#include "crys_ecpki_ecdsa.h"
#include "crys_ecpki_kg.h"
#include "crys_ecpki_domain.h"
+ Include dependency graph for psa_cryptocell_310_ecc_common.h:

Go to the source code of this file.

#define MAP_PSA_HASH_TO_CRYS_HASH_AFTER(hash)
 Map PSA hash encodings to CryptoCell specific hash encodings.
 
#define MAP_PSA_HASH_TO_CRYS_HASH_BEFORE(hash)
 Map PSA hash encodings to CryptoCell specific hash encodings.
 
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.
 

Macro Definition Documentation

◆ MAP_PSA_HASH_TO_CRYS_HASH_AFTER

#define MAP_PSA_HASH_TO_CRYS_HASH_AFTER (   hash)
Value:
((hash == PSA_ALG_SHA_1) ? CRYS_ECPKI_AFTER_HASH_SHA1_mode : \
(hash == PSA_ALG_SHA_224) ? CRYS_ECPKI_AFTER_HASH_SHA224_mode : \
(hash == PSA_ALG_SHA_256) ? CRYS_ECPKI_AFTER_HASH_SHA256_mode : \
(hash == PSA_ALG_SHA_384) ? CRYS_ECPKI_AFTER_HASH_SHA384_mode : \
(hash == PSA_ALG_SHA_512) ? CRYS_ECPKI_AFTER_HASH_SHA512_mode : \
0)
#define PSA_ALG_SHA_224
The SHA-224 message-digest algorithm.
Definition algorithm.h:142
#define PSA_ALG_SHA_1
The SHA-1 message-digest algorithm.
Definition algorithm.h:134
#define PSA_ALG_SHA_384
The SHA-384 message-digest algorithm.
Definition algorithm.h:158
#define PSA_ALG_SHA_256
The SHA-256 message-digest algorithm.
Definition algorithm.h:150
#define PSA_ALG_SHA_512
The SHA-512 message-digest algorithm.
Definition algorithm.h:166

Map PSA hash encodings to CryptoCell specific hash encodings.

Parameters
hashpsa_algorithm_t

Definition at line 41 of file psa_cryptocell_310_ecc_common.h.

◆ MAP_PSA_HASH_TO_CRYS_HASH_BEFORE

#define MAP_PSA_HASH_TO_CRYS_HASH_BEFORE (   hash)
Value:
((hash == PSA_ALG_SHA_1) ? CRYS_ECPKI_HASH_SHA1_mode : \
(hash == PSA_ALG_SHA_224) ? CRYS_ECPKI_HASH_SHA224_mode : \
(hash == PSA_ALG_SHA_256) ? CRYS_ECPKI_HASH_SHA256_mode : \
(hash == PSA_ALG_SHA_384) ? CRYS_ECPKI_HASH_SHA384_mode : \
(hash == PSA_ALG_SHA_512) ? CRYS_ECPKI_HASH_SHA512_mode : \
0)

Map PSA hash encodings to CryptoCell specific hash encodings.

Parameters
hashpsa_algorithm_t

Definition at line 54 of file psa_cryptocell_310_ecc_common.h.

Function Documentation

◆ cryptocell_310_common_ecc_generate_key_pair()

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.

Parameters
priv_key_bufferOutput buffer to write ECC private key
pub_key_bufferOutput buffer to write ECC public key
priv_key_buffer_lengthOutput pointer to write private key length
pub_key_buffer_lengthOutput pointer to write public key length
domainECC domain of type CRYS_ECPKI_DomainID_t
Returns
psa_status_t

◆ cryptocell_310_common_ecc_sign()

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.

Parameters
priv_keyPointer to ECC private key
priv_key_sizeSize of private key
inputInput to sign (hash or original message depending on hash_mode )
input_lengthLength of the input
signatureOutput buffer to write the generated signature
signature_lengthPointer to store the actual length of the signature
hash_modeMode used to hash the message of type CRYS_ECPKI_HASH_OpMode_t
domainECC domain of type CRYS_ECPKI_DomainID_t
Returns
psa_status_t

◆ cryptocell_310_common_ecc_verify()

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.

Parameters
pub_keyPointer to ECC public key
pub_key_sizeSize of public key
inputInput to verify (hash or original message depending on hash_mode )
input_lengthLength of the input
signatureBuffer containing the signature to be verified
signature_lengthActual length of the signature
hash_modeMode used to hash the message of type CRYS_ECPKI_HASH_OpMode_t
domainECC domain of type CRYS_ECPKI_DomainID_t
Returns
psa_status_t