-
Notifications
You must be signed in to change notification settings - Fork 71
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
Upgrade and clean dependencies #246
Conversation
9a6564a
to
21271c7
Compare
I have:
everytime I generate a key. I believe this is something wrong I do with casting but interesting in the sense that now all the tests are single-threaded and this error seems similar to the one we had before... |
Also adds a nightly workflow Signed-off-by: Hugues de Valon <hugues.devalon@arm.com>
RUN wget https://github.com/ARMmbed/mbed-crypto/archive/mbedcrypto-2.0.0.tar.gz | ||
RUN tar xf mbedcrypto-2.0.0.tar.gz | ||
RUN cd mbed-crypto-mbedcrypto-2.0.0 \ | ||
&& make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is no longer needed because psa-crypto-sys
does it for us 🤓
@@ -558,7 +563,7 @@ pub fn parsec_to_pkcs11_params( | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_TOKEN).with_bool(&CK_TRUE)); | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_PRIVATE).with_bool(&CK_FALSE)); | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_PUBLIC_EXPONENT).with_bytes(&PUBLIC_EXPONENT)); | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_MODULUS_BITS).with_ck_ulong(&attributes.bits)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how this was working before 🔫 attributes
is moved into this function but then freed! This reference would no longer be valid then...
I tried, after applying this change, to remove the mutex in the PKCS11 provider but the bug is still there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably because it's on the stack, the value is loaded somewhere and then deallocated but not cleared, so when the call is done it's still "valid". Just that sometimes something else gets written on top
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Hopefully this removes the last memory issues in the PKCS11 provider ... 😔
@@ -558,7 +563,7 @@ pub fn parsec_to_pkcs11_params( | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_TOKEN).with_bool(&CK_TRUE)); | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_PRIVATE).with_bool(&CK_FALSE)); | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_PUBLIC_EXPONENT).with_bytes(&PUBLIC_EXPONENT)); | |||
pub_template.push(CK_ATTRIBUTE::new(CKA_MODULUS_BITS).with_ck_ulong(&attributes.bits)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably because it's on the stack, the value is loaded somewhere and then deallocated but not cleared, so when the call is done it's still "valid". Just that sometimes something else gets written on top
@@ -73,8 +73,8 @@ fn check_format_import1() -> Result<()> { | |||
let key_name = String::from("check_format_import"); | |||
|
|||
let public_key = RSAPublicKey { | |||
modulus: IntegerAsn1::from_unsigned_bytes_be(example_modulus_1024()), | |||
public_exponent: IntegerAsn1::from_unsigned_bytes_be(vec![0x01, 0x00, 0x01]), | |||
modulus: IntegerAsn1::from_bytes_be_unsigned(example_modulus_1024()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👌
Also adds a nightly workflow
Signed-off-by: Hugues de Valon hugues.devalon@arm.com