-
Notifications
You must be signed in to change notification settings - Fork 67
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
Added psa_export_key & psa_generate_random to TS Provider #468
Added psa_export_key & psa_generate_random to TS Provider #468
Conversation
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.
Thanks!! I left a few comments below
667429d
to
0a63925
Compare
You can rebase on top of |
0a63925
to
c33f162
Compare
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.
👍🏻
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.
🙆♂️
pub fn generate_random(&self, size: usize) -> Result<Vec<u8>, Error> { | ||
info!("Handling GenerateRandom request"); | ||
let open_req: GenerateRandomIn = GenerateRandomIn { | ||
size: size.try_into().unwrap(), // Can't fail usize->u64 conversion |
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.
Couldn't it fail on 32 bits platforms? Looks like impl From<std::num::TryFromIntError> for Error
is there so you can probably just use ?
instead of unwrap
here?
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.
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.
Oh, but looking at that implementation, maybe size as u64
would be better, like in the try_from_unbounded
implementation linked above.
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.
Right that is the safe direction here. Could fail on 128 bits platforms 🤡
I would personally prefer try_into()?
if that works easily but I'm ok with the as
if not. Just so that when reading the code you don't have to think about it too much
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.
Changed to size: size.try_into()?
if that works
…ovider. References parallaxsecond#341 Signed-off-by: Matt Davis <matt.davis@arm.com>
c33f162
to
1ea4e06
Compare
References #341
Waiting on #467 for breaking changes.