Commit 07a228ce authored by Brendan Moran's avatar Brendan Moran
Browse files

Provide public to key to signature verifiers rather than key ID

parent 34b32d83
......@@ -49,6 +49,8 @@ const uint8_t public_key[] = {
0x39, 0x91, 0xdb, 0x73, 0x38, 0xb4, 0xa8, 0x96,
};
const size_t public_key_size = sizeof(public_key);
const entrypoint_t entrypoints[] = {
{
SUIT_BOOTLOADER_SLOT_A_OFFSET + SUIT_BOOTLOADER_HEADER_SIZE,
......
......@@ -109,14 +109,12 @@ int suit_platform_verify_digest(int alg, const uint8_t *exp, size_t exp_len, con
int ES256_verify(
const uint8_t *msg, size_t msg_len,
const uint8_t *sig, size_t sig_len,
const uint8_t *kid, size_t kid_len)
const uint8_t *pub, size_t pub_len)
{
//TODO: SHA
uint8_t hash[32] = {0};
compute_sha256(hash, msg, msg_len);
//TODO: Lookup public key by key-id
if (uECC_verify(public_key, hash, sig)) {
if (uECC_verify(pub, hash, sig)) {
return CBOR_ERR_NONE;
}
else {
......@@ -131,12 +129,13 @@ int COSEAuthVerify(
int alg)
{
int rc;
//TODO: Lookup public key by key-id
switch (alg) {
case COSE_ES256:
rc = ES256_verify(
msg, msg_len,
sig, sig_len,
kid, kid_len);
public_key, public_key_size);
break;
default:
SET_ERROR(rc, CBOR_ERR_UNIMPLEMENTED);
......
......@@ -33,6 +33,7 @@ typedef struct entrypoint_s {
} entrypoint_t;
extern const uint8_t public_key[];
extern const size_t public_key_size;
extern const uint8_t class_id[16];
extern const uint8_t vendor_id[16];
extern const entrypoint_t entrypoints [];
......
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