X-Git-Url: http://git.silcnet.org/gitweb/?a=blobdiff_plain;f=lib%2Fsilccrypt%2Fsilchmac.c;h=d3484983c7ce2f0d39fae90c744d79e5232714f7;hb=789adec4bf1addc3ef7fb47d6370f5b3fe308376;hp=1edfb3813049610adf3f17f67cc704ea9a2b2b77;hpb=4760d6aa6c3248d7e6757d2e7e7a19a834b2dc34;p=silc.git diff --git a/lib/silccrypt/silchmac.c b/lib/silccrypt/silchmac.c index 1edfb381..d3484983 100644 --- a/lib/silccrypt/silchmac.c +++ b/lib/silccrypt/silchmac.c @@ -190,6 +190,10 @@ char *silc_hmac_get_supported() void silc_hmac_set_key(SilcHmac hmac, const unsigned char *key, unsigned int key_len) { + if (hmac->key) { + memset(hmac->key, 0, hmac->key_len); + silc_free(hmac->key); + } hmac->key = silc_calloc(key_len, sizeof(unsigned char)); hmac->key_len = key_len; memcpy(hmac->key, key, key_len);