Contiki-NG
Loading...
Searching...
No Matches

Files

file  ecc-algorithm.c
 Implementation of the cc2538 ECC Algorithms.
 
file  ecc-algorithm.h
 Header file for the cc2538 ECC Algorithms.
 

Functions

 PT_THREAD (ecc_compare(ecc_compare_state_t *state))
 Do a compare of two big numbers.
 
 PT_THREAD (ecc_multiply(ecc_multiply_state_t *state))
 Do a Multiplication on a EC.
 
 PT_THREAD (ecc_dsa_sign(ecc_dsa_sign_state_t *state))
 Sign a Hash.
 
 PT_THREAD (ecc_dsa_verify(ecc_dsa_verify_state_t *state))
 Verify Signature.
 

Detailed Description

This is a implementation of ECDH, ECDSA sign and ECDSA verify. It uses ecc-driver to communicate with the PKA. It uses continuations to free the main CPU / thread while the PKA is calculating.

Note
Only one request can be processed at a time. Maximal supported key length is 384bit (12 words).

Function Documentation

◆ PT_THREAD() [1/4]

PT_THREAD ( ecc_compare(ecc_compare_state_t *state) )

Do a compare of two big numbers.

This function can be used for ECDH as well as Calculating a Public Key for ECDSA

Definition at line 56 of file ecc-algorithm.c.

References bignum_cmp_get_result(), bignum_cmp_start(), pka_check_status(), PT_BEGIN, PT_END, and PT_WAIT_UNTIL.

◆ PT_THREAD() [2/4]

PT_THREAD ( ecc_dsa_sign(ecc_dsa_sign_state_t *state) )

Sign a Hash.

This function has to be called several times until the pt state is EXIT If the result code is 0 (SUCCESS) the signature can be read from point_r and signature_s

Definition at line 76 of file ecc-algorithm.c.

References bignum_add_get_result(), bignum_add_start(), bignum_inv_mod_get_result(), bignum_inv_mod_start(), bignum_mod_get_result(), bignum_mod_start(), bignum_mul_get_result(), bignum_mul_start(), ecc_mul_get_result(), ecc_mul_start(), pka_check_status(), PT_BEGIN, PT_END, and PT_WAIT_UNTIL.

◆ PT_THREAD() [3/4]

PT_THREAD ( ecc_dsa_verify(ecc_dsa_verify_state_t *state) )

Verify Signature.

This function has to be called several times until the pt state is EXIT If the result code is 0 (SUCCESS) the verification was success full.

Note
some error codes signal internal errors and others signal falls signatures.

Definition at line 134 of file ecc-algorithm.c.

References bignum_cmp_get_result(), bignum_cmp_start(), bignum_inv_mod_get_result(), bignum_inv_mod_start(), bignum_mod_get_result(), bignum_mod_start(), bignum_mul_get_result(), bignum_mul_start(), ecc_add_get_result(), ecc_add_start(), ecc_mul_get_result(), ecc_mul_start(), pka_check_status(), PKA_STATUS_A_GR_B, PKA_STATUS_A_LT_B, PKA_STATUS_SIGNATURE_INVALID, PT_BEGIN, PT_END, and PT_WAIT_UNTIL.

◆ PT_THREAD() [4/4]

PT_THREAD ( ecc_multiply(ecc_multiply_state_t *state) )

Do a Multiplication on a EC.

This function can be used for ECDH as well as Calculating a Public Key for ECDSA

Definition at line 66 of file ecc-algorithm.c.

References ecc_mul_get_result(), ecc_mul_start(), pka_check_status(), PT_BEGIN, PT_END, and PT_WAIT_UNTIL.