1 // SPDX-License-Identifier: BSD-2-Clause 2 /* LibTomCrypt, modular cryptographic library -- Tom St Denis 3 * 4 * LibTomCrypt is a library that provides various cryptographic 5 * algorithms in a highly modular and flexible manner. 6 * 7 * The library is free for all purposes without any express 8 * guarantee it works. 9 */ 10 11 #include "tomcrypt_private.h" 12 13 /** 14 @file ecc_sizes.c 15 ECC Crypto, Tom St Denis 16 */ 17 18 #ifdef LTC_MECC 19 ecc_sizes(int * low,int * high)20void ecc_sizes(int *low, int *high) 21 { 22 int i, size; 23 void *prime; 24 25 LTC_ARGCHKVD(low != NULL); 26 LTC_ARGCHKVD(high != NULL); 27 28 *low = INT_MAX; 29 *high = 0; 30 31 if (mp_init(&prime) == CRYPT_OK) { 32 for (i = 0; ltc_ecc_curves[i].prime != NULL; i++) { 33 if (mp_read_radix(prime, ltc_ecc_curves[i].prime, 16) == CRYPT_OK) { 34 size = mp_unsigned_bin_size(prime); 35 if (size < *low) *low = size; 36 if (size > *high) *high = size; 37 } 38 } 39 mp_clear(prime); 40 } 41 } 42 43 #endif 44 /* ref: $Format:%D$ */ 45 /* git commit: $Format:%H$ */ 46 /* commit time: $Format:%ai$ */ 47 48