Skip to content
This repository has been archived by the owner on Mar 3, 2024. It is now read-only.

Commit

Permalink
libminitotp: tidy hmac-sha1 implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
00-matt committed Sep 10, 2019
1 parent 2d1825f commit 6f1dd5d
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions libminitotp/hmac-sha1.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,6 @@

#include "sha1.h"

static void fix_key(const uint8_t *key, size_t key_len, uint8_t fixed_key[64]) {
memset(fixed_key, 0, 64);

if (key_len > 64) {
struct sha1_ctx ctx;
sha1_init(&ctx);
sha1_update(&ctx, (const uint8_t *)key, key_len);
sha1_finalise(&ctx, fixed_key);
return;
}

memcpy(fixed_key, key, key_len > 64 ? 64 : key_len);
}

#include <stdio.h>

void hmac_sha1(const uint8_t *key, size_t key_len, const uint8_t *message,
size_t message_len, uint8_t digest[20]) {
struct sha1_ctx ctx;
Expand Down

0 comments on commit 6f1dd5d

Please sign in to comment.