Mercurial > dropbear
comparison ecdsa.c @ 1459:06d52bcb8094
Pointer parameter could be declared as pointing to const
author | Francois Perrad <francois.perrad@gadz.org> |
---|---|
date | Sat, 19 Aug 2017 17:16:13 +0200 |
parents | 750ec4ec4cbe |
children | d68d61e7056a |
comparison
equal
deleted
inserted
replaced
1458:bdd3802c8ac6 | 1459:06d52bcb8094 |
---|---|
13 return type == DROPBEAR_SIGNKEY_ECDSA_NISTP256 | 13 return type == DROPBEAR_SIGNKEY_ECDSA_NISTP256 |
14 || type == DROPBEAR_SIGNKEY_ECDSA_NISTP384 | 14 || type == DROPBEAR_SIGNKEY_ECDSA_NISTP384 |
15 || type == DROPBEAR_SIGNKEY_ECDSA_NISTP521; | 15 || type == DROPBEAR_SIGNKEY_ECDSA_NISTP521; |
16 } | 16 } |
17 | 17 |
18 enum signkey_type ecdsa_signkey_type(ecc_key * key) { | 18 enum signkey_type ecdsa_signkey_type(const ecc_key * key) { |
19 #if DROPBEAR_ECC_256 | 19 #if DROPBEAR_ECC_256 |
20 if (key->dp == ecc_curve_nistp256.dp) { | 20 if (key->dp == ecc_curve_nistp256.dp) { |
21 return DROPBEAR_SIGNKEY_ECDSA_NISTP256; | 21 return DROPBEAR_SIGNKEY_ECDSA_NISTP256; |
22 } | 22 } |
23 #endif | 23 #endif |
152 void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key) { | 152 void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key) { |
153 buf_put_ecdsa_pub_key(buf, key); | 153 buf_put_ecdsa_pub_key(buf, key); |
154 buf_putmpint(buf, key->k); | 154 buf_putmpint(buf, key->k); |
155 } | 155 } |
156 | 156 |
157 void buf_put_ecdsa_sign(buffer *buf, ecc_key *key, buffer *data_buf) { | 157 void buf_put_ecdsa_sign(buffer *buf, const ecc_key *key, const buffer *data_buf) { |
158 /* Based on libtomcrypt's ecc_sign_hash but without the asn1 */ | 158 /* Based on libtomcrypt's ecc_sign_hash but without the asn1 */ |
159 int err = DROPBEAR_FAILURE; | 159 int err = DROPBEAR_FAILURE; |
160 struct dropbear_ecc_curve *curve = NULL; | 160 struct dropbear_ecc_curve *curve = NULL; |
161 hash_state hs; | 161 hash_state hs; |
162 unsigned char hash[64]; | 162 unsigned char hash[64]; |
270 out: | 270 out: |
271 return ret; | 271 return ret; |
272 } | 272 } |
273 | 273 |
274 | 274 |
275 int buf_ecdsa_verify(buffer *buf, ecc_key *key, buffer *data_buf) { | 275 int buf_ecdsa_verify(buffer *buf, const ecc_key *key, const buffer *data_buf) { |
276 /* Based on libtomcrypt's ecc_verify_hash but without the asn1 */ | 276 /* Based on libtomcrypt's ecc_verify_hash but without the asn1 */ |
277 int ret = DROPBEAR_FAILURE; | 277 int ret = DROPBEAR_FAILURE; |
278 hash_state hs; | 278 hash_state hs; |
279 struct dropbear_ecc_curve *curve = NULL; | 279 struct dropbear_ecc_curve *curve = NULL; |
280 unsigned char hash[64]; | 280 unsigned char hash[64]; |