comparison ecc.c @ 857:c19acba28590

use oldstyle comments
author Matt Johnston <matt@ucc.asn.au>
date Thu, 14 Nov 2013 22:03:30 +0800
parents 04ede40a529a
children 30ab30e46452
comparison
equal deleted inserted replaced
856:f56c41030c15 857:c19acba28590
78 m_mp_alloc_init_multi(&key->pubkey.x, &key->pubkey.y, 78 m_mp_alloc_init_multi(&key->pubkey.x, &key->pubkey.y,
79 &key->pubkey.z, &key->k, NULL); 79 &key->pubkey.z, &key->k, NULL);
80 return key; 80 return key;
81 } 81 }
82 82
83 // Copied from libtomcrypt ecc_import.c (version there is static), modified 83 /* Copied from libtomcrypt ecc_import.c (version there is static), modified
84 // for different mp_int pointer without LTC_SOURCE 84 for different mp_int pointer without LTC_SOURCE */
85 static int ecc_is_point(ecc_key *key) 85 static int ecc_is_point(ecc_key *key)
86 { 86 {
87 mp_int *prime, *b, *t1, *t2; 87 mp_int *prime, *b, *t1, *t2;
88 int err; 88 int err;
89 89
189 if (ecc_is_point(key) != CRYPT_OK) { 189 if (ecc_is_point(key) != CRYPT_OK) {
190 TRACE(("failed, not a point")) 190 TRACE(("failed, not a point"))
191 goto out; 191 goto out;
192 } 192 }
193 193
194 // SEC1 3.2.3.1 Check that Q != 0 194 /* SEC1 3.2.3.1 Check that Q != 0 */
195 if (mp_cmp_d(key->pubkey.x, 0) == LTC_MP_EQ) { 195 if (mp_cmp_d(key->pubkey.x, 0) == LTC_MP_EQ) {
196 TRACE(("failed, x == 0")) 196 TRACE(("failed, x == 0"))
197 goto out; 197 goto out;
198 } 198 }
199 if (mp_cmp_d(key->pubkey.y, 0) == LTC_MP_EQ) { 199 if (mp_cmp_d(key->pubkey.y, 0) == LTC_MP_EQ) {
214 214
215 return key; 215 return key;
216 216
217 } 217 }
218 218
219 // a modified version of libtomcrypt's "ecc_shared_secret" to output 219 /* a modified version of libtomcrypt's "ecc_shared_secret" to output
220 // a mp_int instead. 220 a mp_int instead. */
221 mp_int * dropbear_ecc_shared_secret(ecc_key *public_key, ecc_key *private_key) 221 mp_int * dropbear_ecc_shared_secret(ecc_key *public_key, ecc_key *private_key)
222 { 222 {
223 ecc_point *result = NULL; 223 ecc_point *result = NULL;
224 mp_int *prime = NULL, *shared_secret = NULL; 224 mp_int *prime = NULL, *shared_secret = NULL;
225 int err = DROPBEAR_FAILURE; 225 int err = DROPBEAR_FAILURE;