Fix Visual Studio compiling errors

This commit is contained in:
Zhi Guan
2022-10-06 14:23:30 +08:00
parent ad023d33f7
commit 58fda1f721
3 changed files with 26 additions and 6 deletions

View File

@@ -84,9 +84,9 @@ struct {
int test_hmac(const DIGEST *digest, const char *key_hex, const char *data_hex, const char *hmac_hex)
{
HMAC_CTX ctx;
uint8_t key[strlen(key_hex)/2];
uint8_t data[strlen(data_hex)/2];
uint8_t hmac[strlen(hmac_hex)/2];
uint8_t key = malloc(strlen(key_hex)/2); // FIXME: malloc
uint8_t data = malloc(strlen(data_hex)/2);
uint8_t hmac = malloc(strlen(hmac_hex) / 2);
uint8_t buf[64];
size_t len;
@@ -103,6 +103,9 @@ int test_hmac(const DIGEST *digest, const char *key_hex, const char *data_hex, c
return 0;
}
printf("ok\n");
if (key) free(key);
if (data) free(data);
if (hmac) free(hmac);
return 1;
}