]> pd.if.org Git - zpackage/blob - libtomcrypt/src/pk/ecc/ltc_ecc_is_valid_idx.c
commit files needed for zpm-fetchurl
[zpackage] / libtomcrypt / src / pk / ecc / ltc_ecc_is_valid_idx.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 ltc_ecc_is_valid_idx.c
19   ECC Crypto, Tom St Denis
20 */
21
22 #ifdef LTC_MECC
23
24 /** Returns whether an ECC idx is valid or not
25   @param n   The idx number to check
26   @return 1 if valid, 0 if not
27 */
28 int ltc_ecc_is_valid_idx(int n)
29 {
30    int x;
31
32    for (x = 0; ltc_ecc_sets[x].size != 0; x++);
33    /* -1 is a valid index --- indicating that the domain params were supplied by the user */
34    if ((n >= -1) && (n < x)) {
35       return 1;
36    }
37    return 0;
38 }
39
40 #endif
41 /* ref:         $Format:%D$ */
42 /* git commit:  $Format:%H$ */
43 /* commit time: $Format:%ai$ */
44