diff options
Diffstat (limited to 'packet.c')
-rw-r--r-- | packet.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: packet.c,v 1.146 2007/05/31 23:34:29 djm Exp $ */ | 1 | /* $OpenBSD: packet.c,v 1.147 2007/06/05 06:52:37 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -629,7 +629,8 @@ set_newkeys(int mode) | |||
629 | enc = &newkeys[mode]->enc; | 629 | enc = &newkeys[mode]->enc; |
630 | mac = &newkeys[mode]->mac; | 630 | mac = &newkeys[mode]->mac; |
631 | comp = &newkeys[mode]->comp; | 631 | comp = &newkeys[mode]->comp; |
632 | memset(mac->key, 0, mac->key_len); | 632 | if (mac->md != NULL) |
633 | mac_clear(mac); | ||
633 | xfree(enc->name); | 634 | xfree(enc->name); |
634 | xfree(enc->iv); | 635 | xfree(enc->iv); |
635 | xfree(enc->key); | 636 | xfree(enc->key); |
@@ -644,14 +645,17 @@ set_newkeys(int mode) | |||
644 | enc = &newkeys[mode]->enc; | 645 | enc = &newkeys[mode]->enc; |
645 | mac = &newkeys[mode]->mac; | 646 | mac = &newkeys[mode]->mac; |
646 | comp = &newkeys[mode]->comp; | 647 | comp = &newkeys[mode]->comp; |
647 | if (mac->md != NULL) | 648 | if (mac->md != NULL) { |
649 | mac_init(mac); | ||
648 | mac->enabled = 1; | 650 | mac->enabled = 1; |
651 | } | ||
649 | DBG(debug("cipher_init_context: %d", mode)); | 652 | DBG(debug("cipher_init_context: %d", mode)); |
650 | cipher_init(cc, enc->cipher, enc->key, enc->key_len, | 653 | cipher_init(cc, enc->cipher, enc->key, enc->key_len, |
651 | enc->iv, enc->block_size, crypt_type); | 654 | enc->iv, enc->block_size, crypt_type); |
652 | /* Deleting the keys does not gain extra security */ | 655 | /* Deleting the keys does not gain extra security */ |
653 | /* memset(enc->iv, 0, enc->block_size); | 656 | /* memset(enc->iv, 0, enc->block_size); |
654 | memset(enc->key, 0, enc->key_len); */ | 657 | memset(enc->key, 0, enc->key_len); |
658 | memset(mac->key, 0, mac->key_len); */ | ||
655 | if ((comp->type == COMP_ZLIB || | 659 | if ((comp->type == COMP_ZLIB || |
656 | (comp->type == COMP_DELAYED && after_authentication)) && | 660 | (comp->type == COMP_DELAYED && after_authentication)) && |
657 | comp->enabled == 0) { | 661 | comp->enabled == 0) { |