Mercurial > dropbear
comparison libtomcrypt/src/pk/ecc/ecc_ansi_x963_import.c @ 1471:6dba84798cd5
Update to libtomcrypt 1.18.1, merged with Dropbear changes
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Fri, 09 Feb 2018 21:44:05 +0800 |
parents | f849a5ca2efc |
children |
comparison
equal
deleted
inserted
replaced
1470:8bba51a55704 | 1471:6dba84798cd5 |
---|---|
3 * LibTomCrypt is a library that provides various cryptographic | 3 * LibTomCrypt is a library that provides various cryptographic |
4 * algorithms in a highly modular and flexible manner. | 4 * algorithms in a highly modular and flexible manner. |
5 * | 5 * |
6 * The library is free for all purposes without any express | 6 * The library is free for all purposes without any express |
7 * guarantee it works. | 7 * guarantee it works. |
8 * | |
9 * Tom St Denis, [email protected], http://libtom.org | |
10 */ | 8 */ |
11 | 9 |
12 /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b | 10 /* Implements ECC over Z/pZ for curve y^2 = x^3 - 3x + b |
13 * | 11 * |
14 * All curves taken from NIST recommendation paper of July 1999 | 12 * All curves taken from NIST recommendation paper of July 1999 |
17 #include "tomcrypt.h" | 15 #include "tomcrypt.h" |
18 | 16 |
19 /** | 17 /** |
20 @file ecc_ansi_x963_import.c | 18 @file ecc_ansi_x963_import.c |
21 ECC Crypto, Tom St Denis | 19 ECC Crypto, Tom St Denis |
22 */ | 20 */ |
23 | 21 |
24 #ifdef LTC_MECC | 22 #ifdef LTC_MECC |
25 | 23 |
26 /** Import an ANSI X9.63 format public key | 24 /** Import an ANSI X9.63 format public key |
27 @param in The input data to read | 25 @param in The input data to read |
28 @param inlen The length of the input data | 26 @param inlen The length of the input data |
29 @param key [out] destination to store imported key \ | 27 @param key [out] destination to store imported key \ |
30 */ | 28 */ |
31 int ecc_ansi_x963_import(const unsigned char *in, unsigned long inlen, ecc_key *key) | 29 int ecc_ansi_x963_import(const unsigned char *in, unsigned long inlen, ecc_key *key) |
34 } | 32 } |
35 | 33 |
36 int ecc_ansi_x963_import_ex(const unsigned char *in, unsigned long inlen, ecc_key *key, ltc_ecc_set_type *dp) | 34 int ecc_ansi_x963_import_ex(const unsigned char *in, unsigned long inlen, ecc_key *key, ltc_ecc_set_type *dp) |
37 { | 35 { |
38 int x, err; | 36 int x, err; |
39 | 37 |
40 LTC_ARGCHK(in != NULL); | 38 LTC_ARGCHK(in != NULL); |
41 LTC_ARGCHK(key != NULL); | 39 LTC_ARGCHK(key != NULL); |
42 | 40 |
43 /* must be odd */ | 41 /* must be odd */ |
44 if ((inlen & 1) == 0) { | 42 if ((inlen & 1) == 0) { |
45 return CRYPT_INVALID_ARG; | 43 return CRYPT_INVALID_ARG; |
46 } | 44 } |
47 | 45 |
97 return err; | 95 return err; |
98 } | 96 } |
99 | 97 |
100 #endif | 98 #endif |
101 | 99 |
102 /* $Source$ */ | 100 /* ref: $Format:%D$ */ |
103 /* $Revision$ */ | 101 /* git commit: $Format:%H$ */ |
104 /* $Date$ */ | 102 /* commit time: $Format:%ai$ */ |