Add functions to get the private/public key size for a curve (#73)

This commit is contained in:
Ken MacKay
2016-03-08 21:29:40 -08:00
parent 171475934d
commit b6c0cdbe7d
2 changed files with 20 additions and 0 deletions
+8
View File
@@ -195,6 +195,14 @@ uECC_RNG_Function uECC_get_rng(void) {
return g_rng_function;
}
int uECC_curve_private_key_size(uECC_Curve curve) {
return BITS_TO_BYTES(curve->num_n_bits);
}
int uECC_curve_public_key_size(uECC_Curve curve) {
return 2 * curve->num_bytes;
}
#if !asm_clear
uECC_VLI_API void uECC_vli_clear(uECC_word_t *vli, wordcount_t num_words) {
wordcount_t i;
+12
View File
@@ -130,6 +130,18 @@ Returns the function that will be used to generate random bytes.
*/
uECC_RNG_Function uECC_get_rng(void);
/* uECC_curve_private_key_size() function.
Returns the size of a private key for the curve in bytes.
*/
int uECC_curve_private_key_size(uECC_Curve curve);
/* uECC_curve_public_key_size() function.
Returns the size of a public key for the curve in bytes.
*/
int uECC_curve_public_key_size(uECC_Curve curve);
/* uECC_make_key() function.
Create a public/private key pair.