diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a077ecb..20e271f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: toolchain: stable override: true - name: Download Mbed Crypto - run: git clone -b mbedtls-2.27.0 https://github.com/ARMmbed/mbedtls.git + run: git clone -b v3.0.0 https://github.com/ARMmbed/mbedtls.git - name: armv7-unknown-linux-gnueabihf run: | rustup target add armv7-unknown-linux-gnueabihf diff --git a/.travis.yml b/.travis.yml index 4a8f6b6..8efd388 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ script: # Compile Mbed Crypto for the test application - git clone https://github.com/ARMmbed/mbedtls.git - pushd mbedtls - - git checkout mbedtls-2.27.0 + - git checkout v3.0.0 - ./scripts/config.py crypto - ./scripts/config.py set MBEDTLS_PSA_CRYPTO_SE_C - SHARED=1 make diff --git a/ci/c-tests/main.c b/ci/c-tests/main.c index 1e1b28e..9ab1ce9 100644 --- a/ci/c-tests/main.c +++ b/ci/c-tests/main.c @@ -53,7 +53,7 @@ int main() PSA_KEY_LIFETIME_FROM_PERSISTENCE_AND_LOCATION(PSA_KEY_PERSISTENCE_DEFAULT, (psa_key_location_t)0x000001)); psa_set_key_usage_flags(&key_pair_attributes, PSA_KEY_USAGE_SIGN_HASH | PSA_KEY_USAGE_VERIFY_HASH); psa_set_key_algorithm(&key_pair_attributes, alg); - psa_set_key_type(&key_pair_attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_CURVE_SECP_R1)); + psa_set_key_type(&key_pair_attributes, PSA_KEY_TYPE_ECC_KEY_PAIR(PSA_ECC_FAMILY_SECP_R1)); psa_set_key_bits(&key_pair_attributes, 256U); status = psa_generate_key(&key_pair_attributes, &key_pair_handle); diff --git a/ci/ci.sh b/ci/ci.sh index 1d16f8f..31688eb 100755 --- a/ci/ci.sh +++ b/ci/ci.sh @@ -14,7 +14,7 @@ then git clone https://github.com/ARMmbed/mbedtls.git fi pushd mbedtls -git checkout mbedtls-2.27.0 +git checkout v3.0.0 popd ################# @@ -32,7 +32,7 @@ fi # C Tests # ########### -cp /tmp/NVChip . +cp /tmp/ondisk/NVChip . # Start and configure TPM server tpm_server & sleep 5 diff --git a/src/asymmetric.rs b/src/asymmetric.rs index b08f56a..37f11c4 100644 --- a/src/asymmetric.rs +++ b/src/asymmetric.rs @@ -10,10 +10,10 @@ use psa_crypto::types::algorithm::AsymmetricSignature; use std::convert::TryFrom; pub(super) static METHODS: psa_drv_se_asymmetric_t = psa_drv_se_asymmetric_t { - p_sign: Some(p_sign), - p_verify: Some(p_verify), - p_encrypt: None, - p_decrypt: None, + private_p_sign: Some(p_sign), + private_p_verify: Some(p_verify), + private_p_encrypt: None, + private_p_decrypt: None, }; unsafe extern "C" fn p_sign( diff --git a/src/key_management.rs b/src/key_management.rs index 612a75b..565888e 100644 --- a/src/key_management.rs +++ b/src/key_management.rs @@ -10,13 +10,13 @@ use psa_crypto::types::key::Attributes; use std::convert::TryFrom; pub(super) static METHODS: psa_drv_se_key_management_t = psa_drv_se_key_management_t { - p_allocate: Some(p_allocate), - p_validate_slot_number: Some(p_validate_slot_number), - p_import: Some(p_import), - p_generate: Some(p_generate), - p_destroy: Some(p_destroy), - p_export: None, - p_export_public: Some(p_export_public), + private_p_allocate: Some(p_allocate), + private_p_validate_slot_number: Some(p_validate_slot_number), + private_p_import: Some(p_import), + private_p_generate: Some(p_generate), + private_p_destroy: Some(p_destroy), + private_p_export: None, + private_p_export_public: Some(p_export_public), }; unsafe extern "C" fn p_allocate( diff --git a/src/lib.rs b/src/lib.rs index ef8b52f..b4bf181 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -67,15 +67,15 @@ lazy_static! { /// Parsec SE Driver structure #[no_mangle] pub static mut PARSEC_SE_DRIVER: psa_drv_se_t = psa_drv_se_t { - hal_version: 5, - persistent_data_size: 0, - p_init: Some(p_init), - key_management: &key_management::METHODS as *const psa_drv_se_key_management_t, - mac: ptr::null(), - cipher: ptr::null(), - aead: ptr::null(), - asymmetric: &asymmetric::METHODS as *const psa_drv_se_asymmetric_t, - derivation: ptr::null(), + private_hal_version: 5, + private_persistent_data_size: 0, + private_p_init: Some(p_init), + private_key_management: &key_management::METHODS as *const psa_drv_se_key_management_t, + private_mac: ptr::null(), + private_cipher: ptr::null(), + private_aead: ptr::null(), + private_asymmetric: &asymmetric::METHODS as *const psa_drv_se_asymmetric_t, + private_derivation: ptr::null(), }; unsafe extern "C" fn p_init(