chg: [client] Reset HMAC for each d4 packet

pull/23/head
Gerard Wagener 2018-12-20 14:55:49 +01:00
parent 081f3e027e
commit 788aad117e
1 changed files with 2 additions and 0 deletions

View File

@ -200,6 +200,8 @@ void d4_transfert(d4_t* d4)
d4_update_header(d4, nread);
//Do HMAC on header and payload. HMAC field is 0 during computation
if (d4->ctx) {
bzero(d4->ctx,sizeof(hmac_sha256_ctx));
hmac_sha256_init(d4->ctx, (uint8_t*)d4->conf[KEY], strlen(d4->conf[KEY]));
hmac_sha256_update(d4->ctx, (const unsigned char*)&d4->header,
sizeof(d4_header_t));
hmac_sha256_update(d4->ctx, (const unsigned char*)buf, nread);