comparison signkey.c @ 594:a98a2138364a

Improve capitalisation for all logged strings
author Matt Johnston <matt@ucc.asn.au>
date Wed, 23 Feb 2011 15:50:30 +0000
parents b50f0107e505
children a48a1f6ab43e
comparison
equal deleted inserted replaced
593:ea103e4476ce 594:a98a2138364a
60 if (type == DROPBEAR_SIGNKEY_DSS) { 60 if (type == DROPBEAR_SIGNKEY_DSS) {
61 *namelen = SSH_SIGNKEY_DSS_LEN; 61 *namelen = SSH_SIGNKEY_DSS_LEN;
62 return SSH_SIGNKEY_DSS; 62 return SSH_SIGNKEY_DSS;
63 } 63 }
64 #endif 64 #endif
65 dropbear_exit("bad key type %d", type); 65 dropbear_exit("Bad key type %d", type);
66 return NULL; /* notreached */ 66 return NULL; /* notreached */
67 } 67 }
68 68
69 /* Returns DROPBEAR_SIGNKEY_RSA, DROPBEAR_SIGNKEY_DSS, 69 /* Returns DROPBEAR_SIGNKEY_RSA, DROPBEAR_SIGNKEY_DSS,
70 * or DROPBEAR_SIGNKEY_NONE */ 70 * or DROPBEAR_SIGNKEY_NONE */
213 if (type == DROPBEAR_SIGNKEY_RSA) { 213 if (type == DROPBEAR_SIGNKEY_RSA) {
214 buf_put_rsa_pub_key(pubkeys, key->rsakey); 214 buf_put_rsa_pub_key(pubkeys, key->rsakey);
215 } 215 }
216 #endif 216 #endif
217 if (pubkeys->len == 0) { 217 if (pubkeys->len == 0) {
218 dropbear_exit("bad key types in buf_put_pub_key"); 218 dropbear_exit("Bad key types in buf_put_pub_key");
219 } 219 }
220 220
221 buf_setpos(pubkeys, 0); 221 buf_setpos(pubkeys, 0);
222 buf_putstring(buf, buf_getptr(pubkeys, pubkeys->len), 222 buf_putstring(buf, buf_getptr(pubkeys, pubkeys->len),
223 pubkeys->len); 223 pubkeys->len);
244 buf_put_rsa_priv_key(buf, key->rsakey); 244 buf_put_rsa_priv_key(buf, key->rsakey);
245 TRACE(("leave buf_put_priv_key: rsa done")) 245 TRACE(("leave buf_put_priv_key: rsa done"))
246 return; 246 return;
247 } 247 }
248 #endif 248 #endif
249 dropbear_exit("bad key types in put pub key"); 249 dropbear_exit("Bad key types in put pub key");
250 } 250 }
251 251
252 void sign_key_free(sign_key *key) { 252 void sign_key_free(sign_key *key) {
253 253
254 TRACE(("enter sign_key_free")) 254 TRACE(("enter sign_key_free"))
378 if (type == DROPBEAR_SIGNKEY_RSA) { 378 if (type == DROPBEAR_SIGNKEY_RSA) {
379 buf_put_rsa_sign(sigblob, key->rsakey, data, len); 379 buf_put_rsa_sign(sigblob, key->rsakey, data, len);
380 } 380 }
381 #endif 381 #endif
382 if (sigblob->len == 0) { 382 if (sigblob->len == 0) {
383 dropbear_exit("non-matching signing type"); 383 dropbear_exit("Non-matching signing type");
384 } 384 }
385 buf_setpos(sigblob, 0); 385 buf_setpos(sigblob, 0);
386 buf_putstring(buf, buf_getptr(sigblob, sigblob->len), 386 buf_putstring(buf, buf_getptr(sigblob, sigblob->len),
387 sigblob->len); 387 sigblob->len);
388 388
410 #ifdef DROPBEAR_DSS 410 #ifdef DROPBEAR_DSS
411 if (bloblen == DSS_SIGNATURE_SIZE && 411 if (bloblen == DSS_SIGNATURE_SIZE &&
412 memcmp(ident, SSH_SIGNKEY_DSS, identlen) == 0) { 412 memcmp(ident, SSH_SIGNKEY_DSS, identlen) == 0) {
413 m_free(ident); 413 m_free(ident);
414 if (key->dsskey == NULL) { 414 if (key->dsskey == NULL) {
415 dropbear_exit("no dss key to verify signature"); 415 dropbear_exit("No DSS key to verify signature");
416 } 416 }
417 return buf_dss_verify(buf, key->dsskey, data, len); 417 return buf_dss_verify(buf, key->dsskey, data, len);
418 } 418 }
419 #endif 419 #endif
420 420
421 #ifdef DROPBEAR_RSA 421 #ifdef DROPBEAR_RSA
422 if (memcmp(ident, SSH_SIGNKEY_RSA, identlen) == 0) { 422 if (memcmp(ident, SSH_SIGNKEY_RSA, identlen) == 0) {
423 m_free(ident); 423 m_free(ident);
424 if (key->rsakey == NULL) { 424 if (key->rsakey == NULL) {
425 dropbear_exit("no rsa key to verify signature"); 425 dropbear_exit("No RSA key to verify signature");
426 } 426 }
427 return buf_rsa_verify(buf, key->rsakey, data, len); 427 return buf_rsa_verify(buf, key->rsakey, data, len);
428 } 428 }
429 #endif 429 #endif
430 430
431 m_free(ident); 431 m_free(ident);
432 dropbear_exit("non-matching signing type"); 432 dropbear_exit("Non-matching signing type");
433 return DROPBEAR_FAILURE; 433 return DROPBEAR_FAILURE;
434 } 434 }
435 #endif /* DROPBEAR_SIGNKEY_VERIFY */ 435 #endif /* DROPBEAR_SIGNKEY_VERIFY */
436 436
437 #ifdef DROPBEAR_KEY_LINES /* ie we're using authorized_keys or known_hosts */ 437 #ifdef DROPBEAR_KEY_LINES /* ie we're using authorized_keys or known_hosts */