mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-20 09:03:28 +00:00
upgrade API on helper tools
even though they run on the host, old pins inflate the codespace since they are part of the workspace
This commit is contained in:
parent
7c944fb4db
commit
01cec25388
2 changed files with 8 additions and 9 deletions
|
|
@ -20,8 +20,8 @@ pem = "0.8.3"
|
||||||
svd2utra = "0.1.22"
|
svd2utra = "0.1.22"
|
||||||
xmas-elf = "0.9.0"
|
xmas-elf = "0.9.0"
|
||||||
xous-semver = "0.1.2"
|
xous-semver = "0.1.2"
|
||||||
ed25519-dalek = "1.0.1"
|
ed25519-dalek = { version = "2.1.0", features = ["digest"] }
|
||||||
sha2 = { version = "0.9.5" }
|
sha2 = { version = "0.10.8" }
|
||||||
pkcs8 = { version = "0.8.0", features = ["pem"] }
|
pkcs8 = { version = "0.8.0", features = ["pem"] }
|
||||||
base64 = "0.20.0"
|
base64 = "0.20.0"
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
use std::io::{Error, ErrorKind, Read, Write};
|
use std::io::{Error, ErrorKind, Read, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use ed25519_dalek::{Digest, ExpandedSecretKey, PublicKey, SecretKey};
|
use ed25519_dalek::{DigestSigner, SigningKey};
|
||||||
use pkcs8::der::Decodable;
|
use pkcs8::der::Decodable;
|
||||||
use pkcs8::PrivateKeyInfo;
|
use pkcs8::PrivateKeyInfo;
|
||||||
use ring::signature::Ed25519KeyPair;
|
use ring::signature::Ed25519KeyPair;
|
||||||
use sha2::Sha512;
|
use sha2::{Digest, Sha512};
|
||||||
|
|
||||||
const LOADER_VERSION: u32 = 1;
|
const LOADER_VERSION: u32 = 1;
|
||||||
const LOADER_PREHASH_VERSION: u32 = 2;
|
const LOADER_PREHASH_VERSION: u32 = 2;
|
||||||
|
|
@ -139,12 +139,11 @@ pub fn sign_image_prehash(
|
||||||
// First 2 bytes of the `private_key` are a record specifier and length field. Check they are correct.
|
// First 2 bytes of the `private_key` are a record specifier and length field. Check they are correct.
|
||||||
assert!(private_key.private_key[0] == 0x4);
|
assert!(private_key.private_key[0] == 0x4);
|
||||||
assert!(private_key.private_key[1] == 0x20);
|
assert!(private_key.private_key[1] == 0x20);
|
||||||
|
let mut secbytes = [0u8; 32];
|
||||||
|
secbytes.copy_from_slice(&private_key.private_key[2..]);
|
||||||
// Now we can use the private key data.
|
// Now we can use the private key data.
|
||||||
let signing_key_compact =
|
let signing_key = SigningKey::from_bytes(&secbytes);
|
||||||
SecretKey::from_bytes(&private_key.private_key[2..]).map_err(|e| format!("{}", e))?;
|
let signature = signing_key.sign_digest(h);
|
||||||
let public_key = PublicKey::from(&signing_key_compact);
|
|
||||||
let signing_key = ExpandedSecretKey::from(&signing_key_compact);
|
|
||||||
let signature = signing_key.sign_prehashed(h, &public_key, None).map_err(|e| format!("{}", e))?;
|
|
||||||
|
|
||||||
dest_file.write_all(&LOADER_PREHASH_VERSION.to_le_bytes())?;
|
dest_file.write_all(&LOADER_PREHASH_VERSION.to_le_bytes())?;
|
||||||
dest_file.write_all(&(source.len() as u32).to_le_bytes())?;
|
dest_file.write_all(&(source.len() as u32).to_le_bytes())?;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue