proper initialization and disposal of keying material

This commit is contained in:
Andreas Steffen
2009-01-15 01:52:44 +00:00
parent 182ebf85e6
commit b59f154b09
2 changed files with 8 additions and 3 deletions
+3 -1
View File
@@ -242,7 +242,9 @@ static bool allocate_spi(private_child_create_t *this)
static status_t select_and_install(private_child_create_t *this, bool no_dh) static status_t select_and_install(private_child_create_t *this, bool no_dh)
{ {
status_t status; status_t status;
chunk_t nonce_i, nonce_r, encr_i, integ_i, encr_r, integ_r; chunk_t nonce_i, nonce_r;
chunk_t encr_i = chunk_empty, encr_r = chunk_empty;
chunk_t integ_i = chunk_empty, integ_r = chunk_empty;
linked_list_t *my_ts, *other_ts; linked_list_t *my_ts, *other_ts;
host_t *me, *other, *other_vip, *my_vip; host_t *me, *other, *other_vip, *my_vip;
+5 -2
View File
@@ -151,8 +151,11 @@ static inline void chunk_free(chunk_t *chunk)
*/ */
static inline void chunk_clear(chunk_t *chunk) static inline void chunk_clear(chunk_t *chunk)
{ {
memset(chunk->ptr, 0, chunk->len); if (chunk->ptr)
chunk_free(chunk); {
memset(chunk->ptr, 0, chunk->len);
chunk_free(chunk);
}
} }
/** /**