Skip to content

Commit

Permalink
attest-data: Remove dependency on ed25519-dalek, use salty instead.
Browse files Browse the repository at this point in the history
The current version of curve25519-dalek uses rust features that aren't
available in the compiler version pinned by hubris. Since we're only
using one type and one constant from dalek it's easily replaced by the
salty crate.
  • Loading branch information
flihp committed Dec 11, 2023
1 parent f15309b commit 25bcefb
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion attest-data/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ edition = "2021"

[dependencies]
hubpack.workspace = true
ed25519-dalek.workspace = true
thiserror = { workspace = true, optional = true }
salty.workspace = true
serde = { workspace = true, features = ["derive"] }
serde_with = { workspace = true, features = ["macros"] }
sha3.workspace = true
Expand Down
14 changes: 2 additions & 12 deletions attest-data/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

#![cfg_attr(not(any(test, feature = "std")), no_std)]

use ed25519_dalek::{Signature, SignatureError, SIGNATURE_LENGTH};
use hubpack::SerializedSize;
use salty::constants::SIGNATURE_SERIALIZED_LENGTH;
use serde::{Deserialize, Serialize};
use serde_with::serde_as;
use sha3::{
Expand Down Expand Up @@ -57,7 +57,7 @@ pub const NONCE_SIZE: usize = SHA3_256_DIGEST_SIZE;
pub type Sha3_256Digest = ArrayBuf<SHA3_256_DIGEST_SIZE>;

/// An array of bytes sized appropriately for a sha3-256 digest.
pub type Ed25519Signature = ArrayBuf<SIGNATURE_LENGTH>;
pub type Ed25519Signature = ArrayBuf<SIGNATURE_SERIALIZED_LENGTH>;

/// Nonce is a newtype around an appropriately sized byte array.
pub type Nonce = ArrayBuf<NONCE_SIZE>;
Expand Down Expand Up @@ -128,13 +128,3 @@ impl<const N: usize> Default for Log<N> {
pub enum Attestation {
Ed25519(Ed25519Signature),
}

impl TryFrom<&Attestation> for Signature {
type Error = SignatureError;

fn try_from(attestation: &Attestation) -> Result<Self, Self::Error> {
match attestation {
Attestation::Ed25519(s) => Ok(Signature::from_bytes(&s.0)),
}
}
}
4 changes: 3 additions & 1 deletion verifier/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,9 @@ fn main() -> Result<()> {
hubpack::deserialize(&attestation).map_err(|e| {
anyhow!("Failed to deserialize Attestation: {}", e)
})?;
let signature = Signature::try_from(&attestation)?;
let signature = match attestation {
Attestation::Ed25519(s) => Signature::from_bytes(&s.0),
};

// - log_data: the hubpack encoded measurement log `hubpack(log)`
let log = fs::read(log)?;
Expand Down

0 comments on commit 25bcefb

Please sign in to comment.