comparison ecdsa.c @ 1105:c339657c9758

Turn local key_indent variable into char *
author Gaël PORTAY <gael.portay@gmail.com>
date Sat, 02 May 2015 22:24:02 +0200
parents 063c38ea622b
children 4f3335bba3d9
comparison
equal deleted inserted replaced
1104:5806c644469a 1105:c339657c9758
138 return new_key; 138 return new_key;
139 } 139 }
140 140
141 void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key) { 141 void buf_put_ecdsa_pub_key(buffer *buf, ecc_key *key) {
142 struct dropbear_ecc_curve *curve = NULL; 142 struct dropbear_ecc_curve *curve = NULL;
143 unsigned char key_ident[30]; 143 char key_ident[30];
144 144
145 curve = curve_for_dp(key->dp); 145 curve = curve_for_dp(key->dp);
146 snprintf((char*)key_ident, sizeof(key_ident), "ecdsa-sha2-%s", curve->name); 146 snprintf(key_ident, sizeof(key_ident), "ecdsa-sha2-%s", curve->name);
147 buf_putstring(buf, key_ident, strlen(key_ident)); 147 buf_putstring(buf, (const unsigned char *) key_ident, strlen(key_ident));
148 buf_putstring(buf, curve->name, strlen(curve->name)); 148 buf_putstring(buf, curve->name, strlen(curve->name));
149 buf_put_ecc_raw_pubkey_string(buf, key); 149 buf_put_ecc_raw_pubkey_string(buf, key);
150 } 150 }
151 151
152 void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key) { 152 void buf_put_ecdsa_priv_key(buffer *buf, ecc_key *key) {
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];
163 void *e = NULL, *p = NULL, *s = NULL, *r; 163 void *e = NULL, *p = NULL, *s = NULL, *r;
164 unsigned char key_ident[30]; 164 char key_ident[30];
165 buffer *sigbuf = NULL; 165 buffer *sigbuf = NULL;
166 166
167 TRACE(("buf_put_ecdsa_sign")) 167 TRACE(("buf_put_ecdsa_sign"))
168 curve = curve_for_dp(key->dp); 168 curve = curve_for_dp(key->dp);
169 169
220 if (ltc_mp.compare_d(s, 0) != LTC_MP_EQ) { 220 if (ltc_mp.compare_d(s, 0) != LTC_MP_EQ) {
221 break; 221 break;
222 } 222 }
223 } 223 }
224 224
225 snprintf((char*)key_ident, sizeof(key_ident), "ecdsa-sha2-%s", curve->name); 225 snprintf(key_ident, sizeof(key_ident), "ecdsa-sha2-%s", curve->name);
226 buf_putstring(buf, key_ident, strlen(key_ident)); 226 buf_putstring(buf, (const unsigned char *) key_ident, strlen(key_ident));
227 /* enough for nistp521 */ 227 /* enough for nistp521 */
228 sigbuf = buf_new(200); 228 sigbuf = buf_new(200);
229 buf_putmpint(sigbuf, (mp_int*)r); 229 buf_putmpint(sigbuf, (mp_int*)r);
230 buf_putmpint(sigbuf, (mp_int*)s); 230 buf_putmpint(sigbuf, (mp_int*)s);
231 buf_putbufstring(buf, sigbuf); 231 buf_putbufstring(buf, sigbuf);