version 1.82, 2014/05/14 15:56:41 |
version 1.83, 2014/05/14 16:02:34 |
|
|
} |
} |
|
|
#ifndef VERIFYONLY |
#ifndef VERIFYONLY |
|
#define HASHBUFSIZE 224 |
struct checksum { |
struct checksum { |
char file[1024]; |
char file[1024]; |
char hash[224]; |
char hash[HASHBUFSIZE]; |
char algo[32]; |
char algo[32]; |
}; |
}; |
|
|
static void |
static void |
recodehash(char *hash) |
recodehash(char *hash) |
{ |
{ |
uint8_t data[112]; |
uint8_t data[HASHBUFSIZE / 2]; |
int i, rv; |
int i, rv; |
|
|
if (strlen(hash) == SHA256_DIGEST_STRING_LENGTH || |
if (strlen(hash) == SHA256_DIGEST_STRING_LENGTH || |
|
|
if ((rv = b64_pton(hash, data, sizeof(data))) == -1) |
if ((rv = b64_pton(hash, data, sizeof(data))) == -1) |
errx(1, "invalid base64 encoding"); |
errx(1, "invalid base64 encoding"); |
for (i = 0; i < rv; i++) |
for (i = 0; i < rv; i++) |
snprintf(hash + i * 2, 1024 - i * 2, "%2.2x", data[i]); |
snprintf(hash + i * 2, HASHBUFSIZE - i * 2, "%2.2x", data[i]); |
} |
} |
|
|
static void |
static void |