mirror of
https://github.com/esp8266/Arduino.git
synced 2025-06-12 01:53:07 +03:00
Updater signature validation - format incompatible w/RFC8017 (#6250)
* Add hash OID to signature verification (#6201) * Add legacy signing option * Describe and use the legacy option of signing.py
This commit is contained in:
committed by
david gauchard
parent
7036297920
commit
6272b49406
@ -848,6 +848,10 @@ const void *HashSHA256::hash() {
|
||||
return (const void*) _sha256;
|
||||
}
|
||||
|
||||
const unsigned char *HashSHA256::oid() {
|
||||
return BR_HASH_OID_SHA256;
|
||||
}
|
||||
|
||||
// SHA256 verifier
|
||||
uint32_t SigningVerifier::length()
|
||||
{
|
||||
@ -869,7 +873,7 @@ bool SigningVerifier::verify(UpdaterHashClass *hash, const void *signature, uint
|
||||
bool ret;
|
||||
unsigned char vrf[hash->len()];
|
||||
br_rsa_pkcs1_vrfy vrfy = br_rsa_pkcs1_vrfy_get_default();
|
||||
ret = vrfy((const unsigned char *)signature, signatureLen, NULL, sizeof(vrf), _pubKey->getRSA(), vrf);
|
||||
ret = vrfy((const unsigned char *)signature, signatureLen, hash->oid(), sizeof(vrf), _pubKey->getRSA(), vrf);
|
||||
if (!ret || memcmp(vrf, hash->hash(), sizeof(vrf)) ) {
|
||||
return false;
|
||||
} else {
|
||||
@ -896,4 +900,4 @@ make_stack_thunk(br_ssl_engine_sendrec_buf);
|
||||
|
||||
#endif
|
||||
|
||||
};
|
||||
};
|
||||
|
Reference in New Issue
Block a user