Skip to content

Update to mbedtls version to 3.0.0 #33

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

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ci/c-tests/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ci/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

#################
Expand All @@ -32,7 +32,7 @@ fi
# C Tests #
###########

cp /tmp/NVChip .
cp /tmp/ondisk/NVChip .
# Start and configure TPM server
tpm_server &
sleep 5
Expand Down
8 changes: 4 additions & 4 deletions src/asymmetric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
14 changes: 7 additions & 7 deletions src/key_management.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down