Skip to content

Commit

Permalink
Merge pull request #362 from ionut-arm/update-tss
Browse files Browse the repository at this point in the history
Update to latest TSS crate version
  • Loading branch information
hug-dev authored Mar 23, 2021
2 parents 7b71524 + 657e785 commit c726b31
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
16 changes: 12 additions & 4 deletions Cargo.lock

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

7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
[package]
name = "parsec-service"
version = "0.6.0"
authors = ["Anton Antonov <anton.antonov@arm.com>",
"Paul Howard <paul.howard@arm.com>",
"Ionut Mihalcea <ionut.mihalcea@arm.com>",
"Hugues de Valon <hugues.devalon@arm.com>"]
authors = ["Parsec Project Contributors"]
description = "A language-agnostic API to secure services in a platform-agnostic way"
license = "Apache-2.0"
repository = "https://github.com/parallaxsecond/parsec"
Expand Down Expand Up @@ -32,7 +29,7 @@ log = { version = "0.4.14", features = ["serde"] }
cryptoki = { version = "0.1.0", optional = true, features = ["psa-crypto-conversions"] }
picky-asn1-der = { version = "0.2.4", optional = true }
picky-asn1 = { version = "0.3.1", optional = true }
tss-esapi = { version = "4.0.10-alpha.2", optional = true }
tss-esapi = { version = "5.0.0", optional = true }
bincode = "1.3.1"
structopt = "0.3.21"
derivative = "2.2.0"
Expand Down
3 changes: 2 additions & 1 deletion src/providers/tpm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ use std::collections::HashSet;
use std::io::ErrorKind;
use std::str::FromStr;
use std::sync::Mutex;
use tss_esapi::constants::algorithm::{Cipher, HashingAlgorithm};
use tss_esapi::abstraction::cipher::Cipher;
use tss_esapi::interface_types::algorithm::HashingAlgorithm;
use tss_esapi::interface_types::resource_handles::Hierarchy;
use tss_esapi::Tcti;
use uuid::Uuid;
Expand Down
15 changes: 8 additions & 7 deletions src/providers/tpm/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ use picky_asn1_x509::{RSAPrivateKey, RSAPublicKey};
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
use tss_esapi::abstraction::transient::KeyParams;
use tss_esapi::constants::algorithm::{EllipticCurve, HashingAlgorithm};
use tss_esapi::constants::response_code::Tss2ResponseCodeKind;
use tss_esapi::interface_types::algorithm::HashingAlgorithm;
use tss_esapi::interface_types::ecc::EccCurve;
use tss_esapi::utils::{
AsymSchemeUnion, PublicKey, Signature, SignatureData, TpmsContext, RSA_KEY_SIZES,
};
Expand Down Expand Up @@ -159,19 +160,19 @@ fn convert_hash_to_tpm(hash: Hash) -> Result<HashingAlgorithm> {
}
}

fn convert_curve_to_tpm(key_attributes: Attributes) -> Result<EllipticCurve> {
fn convert_curve_to_tpm(key_attributes: Attributes) -> Result<EccCurve> {
match key_attributes.key_type {
Type::EccKeyPair {
curve_family: EccFamily::SecpR1,
}
| Type::EccPublicKey {
curve_family: EccFamily::SecpR1,
} => match key_attributes.bits {
192 => Ok(EllipticCurve::NistP192),
224 => Ok(EllipticCurve::NistP224),
256 => Ok(EllipticCurve::NistP256),
384 => Ok(EllipticCurve::NistP384),
512 => Ok(EllipticCurve::NistP521),
192 => Ok(EccCurve::NistP192),
224 => Ok(EccCurve::NistP224),
256 => Ok(EccCurve::NistP256),
384 => Ok(EccCurve::NistP384),
512 => Ok(EccCurve::NistP521),
_ => Err(ResponseStatus::PsaErrorNotSupported),
},
_ => Err(ResponseStatus::PsaErrorNotSupported),
Expand Down

0 comments on commit c726b31

Please sign in to comment.