Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit f6ac4df

Browse files
committedMay 19, 2022
dup commit msg in the comment
1 parent 1e09be5 commit f6ac4df

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed
 

‎libraries/ESP8266WiFi/src/BearSSLHelpers.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -937,13 +937,14 @@ uint32_t SigningVerifier::length()
937937
// directly inside the class function for ease of use.
938938
extern "C" bool SigningVerifier_verify(PublicKey *_pubKey, UpdaterHashClass *hash, const void *signature, uint32_t signatureLen) {
939939
if (_pubKey->isRSA()) {
940-
bool ret;
941-
unsigned char vrf[64];
942-
if (hash->len() > 64) {
940+
// see https://github.com/earlephilhower/bearssl-esp8266/blob/6105635531027f5b298aa656d44be2289b2d434f/inc/bearssl_rsa.h#L257
941+
static constexpr int HashLengthMax = 64;
942+
unsigned char vrf[HashLengthMax];
943+
if (hash->len() > HashLengthMax) {
943944
return false;
944945
}
945946
br_rsa_pkcs1_vrfy vrfy = br_rsa_pkcs1_vrfy_get_default();
946-
ret = vrfy((const unsigned char *)signature, signatureLen, hash->oid(), hash->len(), _pubKey->getRSA(), vrf);
947+
bool ret = vrfy((const unsigned char *)signature, signatureLen, hash->oid(), hash->len(), _pubKey->getRSA(), vrf);
947948
if (!ret || memcmp(vrf, hash->hash(), sizeof(vrf)) ) {
948949
return false;
949950
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.