Contiki-NG
|
Driver for the cc2538 BigNum math functions of the PKC engine. More...
Files | |
file | bignum-driver.c |
Implementation of the cc2538 BigNum driver. | |
file | bignum-driver.h |
Header file for the cc2538 BigNum driver. | |
Functions | |
uint8_t | bignum_mod_start (const uint32_t *number, const uint8_t number_size, const uint32_t *modulus, const uint8_t modulus_size, uint32_t *result_vector, struct process *process) |
Starts the big number modulus operation. More... | |
uint8_t | bignum_mod_get_result (uint32_t *buffer, const uint8_t buffer_size, const uint32_t result_vector) |
Gets the result of the big number modulus operation. More... | |
uint8_t | bignum_cmp_start (const uint32_t *number1, const uint32_t *number2, const uint8_t size, struct process *process) |
Starts the comparison of two big numbers. More... | |
uint8_t | bignum_cmp_get_result (void) |
Gets the result of the comparison operation of two big numbers. More... | |
uint8_t | bignum_inv_mod_start (const uint32_t *number, const uint8_t number_size, const uint32_t *modulus, const uint8_t modulus_size, uint32_t *result_vector, struct process *process) |
Starts the big number inverse modulo operation. More... | |
uint8_t | bignum_inv_mod_get_result (uint32_t *buffer, const uint8_t buffer_size, const uint32_t result_vector) |
Gets the result of the big number inverse modulo operation. More... | |
uint8_t | bignum_mul_start (const uint32_t *multiplicand, const uint8_t multiplicand_size, const uint32_t *multiplier, const uint8_t multiplier_size, uint32_t *result_vector, struct process *process) |
Starts the big number multiplication. More... | |
uint8_t | bignum_mul_get_result (uint32_t *buffer, uint32_t *buffer_size, const uint32_t result_vector) |
Gets the results of the big number multiplication. More... | |
uint8_t | bignum_add_start (const uint32_t *number1, const uint8_t number1_size, const uint32_t *number2, const uint8_t number2_size, uint32_t *result_vector, struct process *process) |
Starts the addition of two big number. More... | |
uint8_t | bignum_add_get_result (uint32_t *buffer, uint32_t *buffer_size, const uint32_t result_vector) |
Gets the result of the addition operation on two big number. More... | |
uint8_t | bignum_subtract_start (const uint32_t *number1, const uint8_t number1_size, const uint32_t *number2, const uint8_t number2_size, uint32_t *result_vector, struct process *process) |
Starts the substract of two big number. More... | |
uint8_t | bignum_subtract_get_result (uint32_t *buffer, uint32_t *buffer_size, const uint32_t result_vector) |
Gets the result of big number subtract. More... | |
uint8_t | bignum_exp_mod_start (const uint32_t *number, const uint8_t number_size, const uint32_t *modulus, const uint8_t modulus_size, const uint32_t *base, const uint8_t base_size, uint32_t *result_vector, struct process *process) |
Starts the big number moduluar Exponentiation operation. More... | |
uint8_t | bignum_exp_mod_get_result (uint32_t *buffer, const uint8_t buffer_size, const uint32_t result_vector) |
Gets the result of the big number modulus operation result. More... | |
uint8_t | bignum_divide_start (const uint32_t *dividend, const uint8_t dividend_size, const uint32_t *divisor, const uint8_t divisor_size, uint32_t *result_vector, struct process *process) |
Starts the big number Divide. More... | |
uint8_t | bignum_divide_get_result (uint32_t *buffer, uint32_t *buffer_size, const uint32_t result_vector) |
Gets the results of the big number Divide. More... | |
Driver for the cc2538 BigNum math functions of the PKC engine.
uint8_t bignum_add_get_result | ( | uint32_t * | buffer, |
uint32_t * | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the result of the addition operation on two big number.
buffer | Pointer to buffer where the result needs to be stored. |
buffer_size | Address of the variable containing the length of the buffer. After the operation the actual length of the resultant is stored at this address. |
result_vector | Address of the result location which was provided by the start function |
This function gets the result of the addition operation on two big numbers, previously started using the function
PKA_STATUS_SUCCESS | if the operation is successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy performing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_FAILURE | if the operation is not successful. |
PKA_STATUS_BUF_UNDERFLOW | if the length of the provided buffer is less then the length of the result. |
Definition at line 605 of file bignum-driver.c.
uint8_t bignum_add_start | ( | const uint32_t * | number1, |
const uint8_t | number1_size, | ||
const uint32_t * | number2, | ||
const uint8_t | number2_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the addition of two big number.
number1 | Pointer to the buffer containing the first big mumber. |
number1_size | Size of the first big number in 32-bit word. |
number2 | Pointer to the buffer containing the second big number. |
number2_size | Size of the second big number in 32-bit word. |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the addition of the two big numbers.
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 534 of file bignum-driver.c.
uint8_t bignum_cmp_get_result | ( | void | ) |
Gets the result of the comparison operation of two big numbers.
This function provides the results of the comparison of two big numbers which was started using the
PKA_STATUS_OPERATION_INPRG | if the operation is in progress. |
PKA_STATUS_SUCCESS | if the two big numbers are equal. |
PKA_STATUS_A_GR_B | if the first number is greater than the second. |
PKA_STATUS_A_LT_B | if the first number is less than the second. |
Definition at line 249 of file bignum-driver.c.
uint8_t bignum_cmp_start | ( | const uint32_t * | number1, |
const uint32_t * | number2, | ||
uint8_t | size, | ||
struct process * | process | ||
) |
Starts the comparison of two big numbers.
number1 | Pointer to the first big number. |
number2 | Pointer to the second big number. |
size | Size of the big number in 32 bit size word. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the comparison of two big numbers pointed by number1 and number2. Note this function expects the size of the two big numbers equal.
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 190 of file bignum-driver.c.
uint8_t bignum_divide_get_result | ( | uint32_t * | buffer, |
uint32_t * | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the results of the big number Divide.
buffer | Pointer to buffer where the result needs to be stored. |
buffer_size | Address of the variable containing the length of the buffer. After the operation, the actual length of the resultant is stored at this address. |
result_vector | Address of the result location which was provided by the start function |
This function gets the result of the Divide of two big numbers operation previously started using the function
PKA_STATUS_SUCCESS | if the operation is successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy performing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_FAILURE | if the operation is not successful. |
PKA_STATUS_BUF_UNDERFLOW | if the length of the provided buffer is less then the length of the result. |
Definition at line 1011 of file bignum-driver.c.
uint8_t bignum_divide_start | ( | const uint32_t * | dividend, |
const uint8_t | dividend_size, | ||
const uint32_t * | divisor, | ||
const uint8_t | divisor_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the big number Divide.
dividend | Pointer to the buffer containing the big number dividend. |
dividend_size | Size of the dividend in 32-bit word. |
divisor | Pointer to the buffer containing the big number divisor. |
divisor_size | Size of the divisor in 32-bit word. |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the divide of the two big numbers.
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 924 of file bignum-driver.c.
uint8_t bignum_exp_mod_get_result | ( | uint32_t * | buffer, |
const uint8_t | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the result of the big number modulus operation result.
buffer | Pointer to buffer where the result needs to be stored. |
buffer_size | Size of the provided buffer in 32 bit size word. |
result_vector | Address of the result location which was provided by the start function |
This function gets the result of the big number modulus operation which was previously started using the function
PKA_STATUS_SUCCESS | if successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_BUF_UNDERFLOW | if the size is less than the length of the result. |
Definition at line 875 of file bignum-driver.c.
uint8_t bignum_exp_mod_start | ( | const uint32_t * | number, |
const uint8_t | number_size, | ||
const uint32_t * | modulus, | ||
const uint8_t | modulus_size, | ||
const uint32_t * | base, | ||
const uint8_t | base_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the big number moduluar Exponentiation operation.
number | Pointer to the Exponent on which moduluar Exponentiation operation needs to be carried out. |
number_size | Size of the the Exponent number number in 32-bit word. |
modulus | Pointer to the divisor. |
modulus_size | Size of the divisor modulus. |
base | Pointer to the Base. |
base_size | Size of the divisor base. |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the moduluar Exponentiation operation on the base num base using the Exponent number and the Modulus num modulus. The PKA RAM location where the result will be available is stored in
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 785 of file bignum-driver.c.
uint8_t bignum_inv_mod_get_result | ( | uint32_t * | buffer, |
const uint8_t | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the result of the big number inverse modulo operation.
buffer | Pointer to buffer where the result needs to be stored. |
buffer_size | Size of the provided buffer in 32 bit size word. |
result_vector | Address of the result location which was provided by the start function |
This function gets the result of the big number inverse modulo operation previously started using the function
PKA_STATUS_SUCCESS | if the operation is successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy performing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_BUF_UNDERFLOW | if the length of the provided buffer is less then the result. |
Definition at line 357 of file bignum-driver.c.
uint8_t bignum_inv_mod_start | ( | const uint32_t * | number, |
const uint8_t | number_size, | ||
const uint32_t * | modulus, | ||
const uint8_t | modulus_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the big number inverse modulo operation.
number | Pointer to the buffer containing the big number (dividend). |
number_size | Size of the number in 32 bit word. |
modulus | Pointer to the buffer containing the modulus. |
modulus_size | Size of the modulus in 32 bit word. |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the the inverse modulo operation on number using the divisor modulus.
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 286 of file bignum-driver.c.
uint8_t bignum_mod_get_result | ( | uint32_t * | buffer, |
const uint8_t | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the result of the big number modulus operation.
buffer | Pointer to buffer where the result needs to be stored. |
buffer_size | Size of the provided buffer in 32 bit size word. |
result_vector | Address of the result location which was provided by the start function |
This function gets the result of the big number modulus operation which was previously started using the function
PKA_STATUS_SUCCESS | if successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_BUF_UNDERFLOW | if the size is less than the length of the result. |
Definition at line 141 of file bignum-driver.c.
uint8_t bignum_mod_start | ( | const uint32_t * | number, |
const uint8_t | number_size, | ||
const uint32_t * | modulus, | ||
const uint8_t | modulus_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the big number modulus operation.
number | Pointer to the big number on which modulo operation needs to be carried out. |
number_size | Size of the big number |
modulus | Pointer to the divisor. |
modulus_size | Size of the divisor |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the modulo operation on the big num
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 64 of file bignum-driver.c.
uint8_t bignum_mul_get_result | ( | uint32_t * | buffer, |
uint32_t * | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the results of the big number multiplication.
buffer | Pointer to buffer where the result needs to be stored. |
buffer_size | Address of the variable containing the length of the buffer. After the operation, the actual length of the resultant is stored at this address. |
result_vector | Address of the result location which was provided by the start function |
This function gets the result of the multiplication of two big numbers operation previously started using the function
PKA_STATUS_SUCCESS | if the operation is successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy performing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_FAILURE | if the operation is not successful. |
PKA_STATUS_BUF_UNDERFLOW | if the length of the provided buffer is less then the length of the result. |
Definition at line 480 of file bignum-driver.c.
uint8_t bignum_mul_start | ( | const uint32_t * | multiplicand, |
const uint8_t | multiplicand_size, | ||
const uint32_t * | multiplier, | ||
const uint8_t | multiplier_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the big number multiplication.
multiplicand | Pointer to the buffer containing the big number multiplicand. |
multiplicand_size | Size of the multiplicand in 32-bit word. |
multiplier | Pointer to the buffer containing the big number multiplier. |
multiplier_size | Size of the multiplier in 32-bit word. |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the multiplication of the two big numbers.
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 407 of file bignum-driver.c.
uint8_t bignum_subtract_get_result | ( | uint32_t * | buffer, |
uint32_t * | buffer_size, | ||
const uint32_t | result_vector | ||
) |
Gets the result of big number subtract.
buffer | Pointer to store the result of subtraction. |
buffer_size | Address of the variable containing the length of the buffer. After the operation, the actual length of the resultant is stored at this address. |
result_vector | Address of the result location which was provided by the start function PKABigNumSubtractStart(). |
This function gets the result of PKABigNumSubtractStart().
PKA_STATUS_SUCCESS | if the operation is successful. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy performing the operation. |
PKA_STATUS_RESULT_0 | if the result is all zeroes. |
PKA_STATUS_FAILURE | if the operation is not successful. |
Definition at line 731 of file bignum-driver.c.
uint8_t bignum_subtract_start | ( | const uint32_t * | number1, |
const uint8_t | number1_size, | ||
const uint32_t * | number2, | ||
const uint8_t | number2_size, | ||
uint32_t * | result_vector, | ||
struct process * | process | ||
) |
Starts the substract of two big number.
number1 | Pointer to the buffer containing the first big mumber. |
number1_size | Size of the first big number in 32-bit word. |
number2 | Pointer to the buffer containing the second big number. |
number2_size | Size of the second big number in 32-bit word. |
result_vector | Pointer to the result vector location which will be set by this function. |
process | Process to be polled upon completion of the operation, or NULL |
This function starts the substraction of the two big numbers.
PKA_STATUS_SUCCESS | if successful in starting the operation. |
PKA_STATUS_OPERATION_INPRG | if the PKA hw module is busy doing some other operation. |
Definition at line 660 of file bignum-driver.c.