Commit 93f39820 authored by danh-arm's avatar danh-arm Committed by GitHub
Browse files

Merge pull request #844 from antonio-nino-diaz-arm/an/no-timingsafe

Revert "tbbr: Use constant-time bcmp() to compare hashes"
parents 8da12f61 fabd21ad
...@@ -217,7 +217,7 @@ static int verify_hash(void *data_ptr, unsigned int data_len, ...@@ -217,7 +217,7 @@ static int verify_hash(void *data_ptr, unsigned int data_len,
} }
/* Compare values */ /* Compare values */
rc = timingsafe_bcmp(data_hash, hash, mbedtls_md_get_size(md_info)); rc = memcmp(data_hash, hash, mbedtls_md_get_size(md_info));
if (rc != 0) { if (rc != 0) {
return CRYPTO_ERR_HASH; return CRYPTO_ERR_HASH;
} }
......
...@@ -393,7 +393,7 @@ static int cert_parse(void *img, unsigned int img_len) ...@@ -393,7 +393,7 @@ static int cert_parse(void *img, unsigned int img_len)
if (sig_alg1.len != sig_alg2.len) { if (sig_alg1.len != sig_alg2.len) {
return IMG_PARSER_ERR_FORMAT; return IMG_PARSER_ERR_FORMAT;
} }
if (0 != timingsafe_bcmp(sig_alg1.p, sig_alg2.p, sig_alg1.len)) { if (0 != memcmp(sig_alg1.p, sig_alg2.p, sig_alg1.len)) {
return IMG_PARSER_ERR_FORMAT; return IMG_PARSER_ERR_FORMAT;
} }
memcpy(&sig_alg, &sig_alg1, sizeof(sig_alg)); memcpy(&sig_alg, &sig_alg1, sizeof(sig_alg));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment