Mercurial > dropbear
comparison keyimport.c @ 1045:31727a8abd4b
Use m_burn rather than memset
author | Thorsten Horstmann <thorsten.horstmann@web.de> |
---|---|
date | Tue, 24 Feb 2015 22:48:14 +0800 |
parents | d3925ed45a85 |
children | d144a6bece53 |
comparison
equal
deleted
inserted
replaced
1044:a5b785c12340 | 1045:31727a8abd4b |
---|---|
462 if (ret->encrypted && ret->keyblob_len % 8 != 0) { | 462 if (ret->encrypted && ret->keyblob_len % 8 != 0) { |
463 errmsg = "Encrypted key blob is not a multiple of cipher block size"; | 463 errmsg = "Encrypted key blob is not a multiple of cipher block size"; |
464 goto error; | 464 goto error; |
465 } | 465 } |
466 | 466 |
467 memset(buffer, 0, sizeof(buffer)); | 467 m_burn(buffer, sizeof(buffer)); |
468 return ret; | 468 return ret; |
469 | 469 |
470 error: | 470 error: |
471 memset(buffer, 0, sizeof(buffer)); | 471 m_burn(buffer, sizeof(buffer)); |
472 if (ret) { | 472 if (ret) { |
473 if (ret->keyblob) { | 473 if (ret->keyblob) { |
474 memset(ret->keyblob, 0, ret->keyblob_size); | 474 m_burn(ret->keyblob, ret->keyblob_size); |
475 m_free(ret->keyblob); | 475 m_free(ret->keyblob); |
476 } | 476 } |
477 memset(&ret, 0, sizeof(ret)); | |
478 m_free(ret); | 477 m_free(ret); |
479 } | 478 } |
480 if (fp) { | 479 if (fp) { |
481 fclose(fp); | 480 fclose(fp); |
482 } | 481 } |
492 int ret; | 491 int ret; |
493 | 492 |
494 if (!key) | 493 if (!key) |
495 return 0; | 494 return 0; |
496 ret = key->encrypted; | 495 ret = key->encrypted; |
497 memset(key->keyblob, 0, key->keyblob_size); | 496 m_burn(key->keyblob, key->keyblob_size); |
498 m_free(key->keyblob); | 497 m_free(key->keyblob); |
499 memset(&key, 0, sizeof(key)); | |
500 m_free(key); | 498 m_free(key); |
501 return ret; | 499 return ret; |
502 } | 500 } |
503 | 501 |
504 static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase)) | 502 static sign_key *openssh_read(const char *filename, char * UNUSED(passphrase)) |