mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-17 08:40:52 +00:00
update sign_image to work with the new public key records
This commit is contained in:
parent
a1a5ff1592
commit
54ee8ffd83
1 changed files with 12 additions and 7 deletions
|
|
@ -194,9 +194,13 @@ pub fn sign_image(
|
||||||
// Now we can use the private key data.
|
// Now we can use the private key data.
|
||||||
let signing_key = SigningKey::from_bytes(&secbytes);
|
let signing_key = SigningKey::from_bytes(&secbytes);
|
||||||
|
|
||||||
// derive a private key
|
// This is handy code to remember - a quick way to get the public key from the private key. Just
|
||||||
let sk = Ed25519KeyPair::from_pkcs8_maybe_unchecked(&private_key.contents)
|
// in case I need this in the future to sanity check some values.
|
||||||
.map_err(|e| format!("{}", e))?;
|
/*
|
||||||
|
let sk = Ed25519KeyPair::from_pkcs8_maybe_unchecked(&private_key.contents)
|
||||||
|
.map_err(|e| format!("{}", e))?;
|
||||||
|
let pubkey = sk.public_key();
|
||||||
|
*/
|
||||||
|
|
||||||
let function_code = match function_code {
|
let function_code = match function_code {
|
||||||
Some("boot0") => FunctionCode::Boot0,
|
Some("boot0") => FunctionCode::Boot0,
|
||||||
|
|
@ -216,10 +220,11 @@ pub fn sign_image(
|
||||||
semver,
|
semver,
|
||||||
pubkeys: [Pubkey::default(), Pubkey::default(), Pubkey::default(), Pubkey::default()],
|
pubkeys: [Pubkey::default(), Pubkey::default(), Pubkey::default(), Pubkey::default()],
|
||||||
};
|
};
|
||||||
sealed_fields.pubkeys[3].aad_len = 0;
|
|
||||||
sealed_fields.pubkeys[3].pk.copy_from_slice(sk.public_key().as_ref());
|
// whack in all the public keys, defined in the bao1x-api crate
|
||||||
sealed_fields.pubkeys[3].tag =
|
for (dst, src) in sealed_fields.pubkeys.iter_mut().zip(bao1x_api::pubkeys::PUBKEY_HEADER.iter()) {
|
||||||
u32::from_le_bytes(*bao1x_api::signatures::KEYSLOT_INITIAL_TAGS[3]);
|
dst.populate_from(src);
|
||||||
|
}
|
||||||
|
|
||||||
let mut protected = Vec::new();
|
let mut protected = Vec::new();
|
||||||
protected.extend_from_slice(sealed_fields.as_ref());
|
protected.extend_from_slice(sealed_fields.as_ref());
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue