mirror of
https://github.com/cryb-to/cryb-to.git
synced 2024-11-23 22:25:46 +00:00
Remove a mostly pointless timing attack countermeasure.
This commit is contained in:
parent
cd10966e07
commit
4467480786
1 changed files with 0 additions and 9 deletions
|
@ -55,19 +55,10 @@ hmac_sha1_init(hmac_sha1_ctx *ctx, const void *key, size_t keylen)
|
|||
uint8_t ipad[64];
|
||||
|
||||
memset(ctx, 0, sizeof *ctx);
|
||||
#if 1
|
||||
if (keylen > sizeof ctx->key)
|
||||
sha1_complete(key, keylen, ctx->key);
|
||||
else
|
||||
memcpy(ctx->key, key, keylen);
|
||||
#else
|
||||
uint8_t keybuf[sizeof ctx->key] = { 0 };
|
||||
sha1_complete(key, keylen, keybuf);
|
||||
if (keylen > sizeof ctx->key)
|
||||
memcpy(ctx->key, keybuf, SHA1_DIGEST_LEN);
|
||||
else
|
||||
memcpy(ctx->key, key, keylen);
|
||||
#endif
|
||||
sha1_init(&ctx->sha1_ctx);
|
||||
for (unsigned int i = 0; i < sizeof ipad; ++i)
|
||||
ipad[i] = 0x36 ^ ctx->key[i];
|
||||
|
|
Loading…
Reference in a new issue