diff --git a/src/tofu.c b/src/tofu.c

index 6f12a4e0dfafa563de2836b13da910ae2fd65895..de3746563ed3e0c515a5c52a053f3a535fda5e09 100644

--- a/src/tofu.c

+++ b/src/tofu.c

@@ -53,13 +53,13 @@ rc = X509_V_ERR_CERT_HAS_EXPIRED;

goto invalid_cert;

}

- unsigned char md[256 / 8];

+ unsigned char md[512 / 8];

const EVP_MD *sha512 = EVP_sha512();

unsigned int len = sizeof(md);

rc = X509_digest(cert, sha512, md, &len);

assert(rc == 1);

- char fingerprint[256 / 8 * 3];

+ char fingerprint[512 / 8 * 3];

for (size_t i = 0; i < sizeof(md); ++i) {

snprintf(&fingerprint[i * 3], 4, "%02X%s",

md[i], i + 1 == sizeof(md) ? "" : ":");