Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Intel assembly behind x86_64 arch #93

Merged
merged 2 commits into from
Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ rcrypto = ["rand", "rsa", "sha2", "num-integer", "num-traits"]

[dependencies]
x86_64 = { version = "^0.14.6", default-features = false }
xsave = { version = "^2.0.0", default-features = false }
openssl = { version = "^0.10.36", optional = true }
bitflags = "^1.3.2"

Expand All @@ -36,6 +35,9 @@ rand = { version = "^0.8.4", optional = true }
sha2 = { version = "0.10.2", optional = true }
rsa = { version = "^0.6.0", optional = true }

[target.'cfg(target_arch = "x86_64")'.dependencies]
xsave = { version = "^2.0.0", default-features = false }

[dev-dependencies]
testaso = "0.1"
rstest = "^0.12.0"
2 changes: 1 addition & 1 deletion src/crypto/openssl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl super::PrivateKey for RS256PrivateKey {

Ok(super::SigData {
signature: arr_from_bn(&s),
modulus: arr_from_bn(&*m),
modulus: arr_from_bn(m),
exponent,
q1: arr_from_bn(&*q1),
q2: arr_from_bn(&*q2),
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ pub mod crypto;
pub mod page;
pub mod parameters;
pub mod signature;

#[cfg(target_arch = "x86_64")]
pub mod ssa;

/// SGX ENCLU Leaf Instructions
Expand Down
2 changes: 1 addition & 1 deletion src/page/class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use crate::page::{Flags, SecInfo};
/// page.
#[repr(u8)]
#[non_exhaustive]
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum Class {
/// SGX Enclave Control Structure (SECS)
Secs = 0,
Expand Down
2 changes: 1 addition & 1 deletion src/signature/hasher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use core::num::NonZeroU32;
use core::slice::from_raw_parts;

/// Input length is not a multiple of the page size
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub struct InvalidSize(());

/// Hashes an enclave producing a measurement
Expand Down
2 changes: 1 addition & 1 deletion src/ssa.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub use xsave::XSave;

/// Section 38.9.1.1, Table 38-9
#[non_exhaustive]
#[derive(Copy, Clone, Debug, PartialEq)]
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ExitType {
Hardware,
Software,
Expand Down