RESOLVED FIXED 171213
[GCrypt] CryptoKeyRSA: implement create(), keySizeInBits(), buildAlgorithm(), exportData()
https://bugs.webkit.org/show_bug.cgi?id=171213
Summary [GCrypt] CryptoKeyRSA: implement create(), keySizeInBits(), buildAlgorithm(),...
Zan Dobersek
Reported 2017-04-24 00:56:22 PDT
[GCrypt] CryptoKeyRSA: implement create(), keySizeInBits(), buildAlgorithm(), exportData()
Attachments
Patch (12.72 KB, patch)
2017-04-24 01:19 PDT, Zan Dobersek
no flags
Patch for landing (12.72 KB, patch)
2017-04-25 22:54 PDT, Zan Dobersek
no flags
Zan Dobersek
Comment 1 2017-04-24 01:19:34 PDT
Michael Catanzaro
Comment 2 2017-04-24 06:53:04 PDT
Comment on attachment 307961 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307961&action=review Looks good. Please wait for Jiewen before committing, as usual. > Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:337 > + // dp -- d mod (p - 1) Thank you for the comments. ;) > Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:341 > + gcry_mpi_sub_ui(pm1MPI, pm1MPI, 1); Do you think it would be safer to use an extra local variable for the result here (i.e. have both pMPI and pm1MPI locals)? I'm sure this is fine now and probably will be forever, but it could be disastrous if future versions of GCrypt can't handle the first parameter being the same as a subsequent parameter. That's probably paranoid though.
Zan Dobersek
Comment 3 2017-04-24 07:37:02 PDT
Comment on attachment 307961 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=307961&action=review >> Source/WebCore/crypto/gcrypt/CryptoKeyRSAGCrypt.cpp:341 >> + gcry_mpi_sub_ui(pm1MPI, pm1MPI, 1); > > Do you think it would be safer to use an extra local variable for the result here (i.e. have both pMPI and pm1MPI locals)? I'm sure this is fine now and probably will be forever, but it could be disastrous if future versions of GCrypt can't handle the first parameter being the same as a subsequent parameter. That's probably paranoid though. This makes sense, I think. We could definitely avoid any bug that might manifest in libgcrypt due to aliased pointers being passed to gcry_mpi_*() functions. In this case, all this can be simplified into plain-allocating pm1MPI and then calling gcry_mpi_sub_ui(pm1MPI, pMP1, 1). I'll switch to that.
Zan Dobersek
Comment 4 2017-04-25 22:54:27 PDT
Created attachment 308219 [details] Patch for landing
Zan Dobersek
Comment 5 2017-04-26 00:40:30 PDT
Comment on attachment 308219 [details] Patch for landing Clearing flags on attachment: 308219 Committed r215796: <http://trac.webkit.org/changeset/215796>
Zan Dobersek
Comment 6 2017-04-26 00:40:34 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.