]> pd.if.org Git - zpackage/blob - libtomcrypt/src/pk/ecc/ecc_get_size.c
commit files needed for zpm-fetchurl
[zpackage] / libtomcrypt / src / pk / ecc / ecc_get_size.c
1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
2  *
3  * LibTomCrypt is a library that provides various cryptographic
4  * algorithms in a highly modular and flexible manner.
5  *
6  * The library is free for all purposes without any express
7  * guarantee it works.
8  */
9
10 /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b
11  *
12  * All curves taken from NIST recommendation paper of July 1999
13  * Available at http://csrc.nist.gov/cryptval/dss.htm
14  */
15 #include "tomcrypt.h"
16
17 /**
18   @file ecc_get_size.c
19   ECC Crypto, Tom St Denis
20 */
21
22 #ifdef LTC_MECC
23
24 /**
25   Get the size of an ECC key
26   @param key    The key to get the size of
27   @return The size (octets) of the key or INT_MAX on error
28 */
29 int ecc_get_size(ecc_key *key)
30 {
31    LTC_ARGCHK(key != NULL);
32    if (ltc_ecc_is_valid_idx(key->idx))
33       return key->dp->size;
34    else
35       return INT_MAX; /* large value known to cause it to fail when passed to ecc_make_key() */
36 }
37
38 #endif
39 /* ref:         $Format:%D$ */
40 /* git commit:  $Format:%H$ */
41 /* commit time: $Format:%ai$ */
42