Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(555)

Issue 1209283004: Implement VerifySignedData() for ECDSA, RSA PKCS#1 and RSA PSS. (Closed)

Created:
5 years, 5 months ago by eroman
Modified:
5 years, 4 months ago
Reviewers:
Ryan Sleevi, davidben
CC:
chromium-reviews, cbentzel+watch_chromium.org, davidben
Base URL:
https://chromium.googlesource.com/chromium/src.git@parse_pss
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Implement VerifySignedData() for ECDSA, RSA PKCS#1 and RSA PSS. The implementation is specifically for BoringSSL. BUG=410574 Committed: https://crrev.com/2b124dbcd72c180b2865dc0448e280d2e3e7cbe4 Cr-Commit-Position: refs/heads/master@{#340633}

Patch Set 1 #

Patch Set 2 : moar tests #

Patch Set 3 : moar tests #

Patch Set 4 : Rename Pkcs1_5 --> Pkcs1 #

Patch Set 5 : moar test #

Patch Set 6 : rebase #

Patch Set 7 : clarify that signature_value is NOT the BIT STRING itself, but the byte contents #

Total comments: 29

Patch Set 8 : address some of david's comments #

Patch Set 9 : Add (failing) unittests to catch signature/algorithm mismatch #

Patch Set 10 : Switch to d2i_EC_PUBKEY / d2i_RSA_PUBKEY #

Patch Set 11 : add a todo with respect to spki's algorithm restrictions #

Patch Set 12 : restrict recognized named curves #

Patch Set 13 : rebase onto factory approach #

Patch Set 14 : rebase (CreateFromDer has different signature now) #

Patch Set 15 : Rebase (some stuff chagned in dependent cls) #

Patch Set 16 : Add more tests for key parsing (the rsaPss ones don't pass yet) #

Patch Set 17 : mark rsaPss key tests as DISABLED #

Total comments: 11

Patch Set 18 : Combine the ECDSA and RSA boringssl calls in one function #

Patch Set 19 : NULL --> nullptr #

Total comments: 26

Patch Set 20 : Modify InputFromString() to use a pointer instead of non-const ref #

Patch Set 21 : address more comments #

Patch Set 22 : use d2i_pubkey #

Patch Set 23 : #

Patch Set 24 : nop? #

Total comments: 34

Patch Set 25 : Address most comments #

Patch Set 26 : change signatureValue input to BIT STRING, and annotate tests with asn1parse #

Patch Set 27 : Fixup some comments #

Patch Set 28 : add more tests #

Patch Set 29 : add a test for non-BIT STRING signature value #

Total comments: 6

Patch Set 30 : Remove underscore from gtest names #

Patch Set 31 : Change format of test files #

Patch Set 32 : rebase onto master #

Patch Set 33 : rebase onto master #

Patch Set 34 : appease mscvc int --> bool cast #

Unified diffs Side-by-side diffs Delta from patch set Stats (+2309 lines, -0 lines) Patch
A net/cert/internal/verify_signed_data.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +38 lines, -0 lines 0 comments Download
A net/cert/internal/verify_signed_data.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 1 chunk +318 lines, -0 lines 0 comments Download
A net/cert/internal/verify_signed_data_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 1 chunk +281 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +49 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512-signature-not-bitstring.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +49 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512-spki-params-null.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +45 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512-using-ecdh-key.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +48 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512-using-ecmqv-key.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +48 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512-using-rsa-algorithm.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +48 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-prime256v1-sha512-wrong-signature-format.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +47 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-secp384r1-sha256.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +84 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-secp384r1-sha256-corrupted-data.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +53 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/ecdsa-using-rsa-key.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +51 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha1.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +53 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha1-bad-key-der-length.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +44 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha1-bad-key-der-null.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +52 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha1-key-params-absent.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +49 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha1-using-pss-key-no-params.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +51 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha1-wrong-algorithm.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +48 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha256.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +86 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha256-key-encoded-ber.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +62 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha256-spki-non-null-params.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +59 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha256-using-ecdsa-algorithm.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +55 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pkcs1-sha256-using-id-ea-rsa.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +54 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha1-salt20.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +53 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha1-salt20-using-pss-key-no-params.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +48 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha1-salt20-using-pss-key-with-null-params.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +50 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha1-wrong-salt.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +51 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha256-mgf1-sha512-salt33.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +67 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha256-salt10.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +65 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha256-salt10-using-pss-key-with-params.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +74 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-pss-sha256-salt10-using-pss-key-with-wrong-params.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +74 lines, -0 lines 0 comments Download
A net/data/verify_signed_data_unittest/rsa-using-ec-key.pem View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 1 chunk +52 lines, -0 lines 0 comments Download
M net/net.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 2 chunks +3 lines, -0 lines 0 comments Download

Dependent Patchsets:

Messages

Total messages: 43 (9 generated)
eroman
I am still in the process of adding more test data (which is tedious), but ...
5 years, 5 months ago (2015-07-02 17:49:07 UTC) #2
Ryan Sleevi
The std::string changes make me deeply uncomfortable - it's a big footgun (as shown when ...
5 years, 5 months ago (2015-07-07 14:07:31 UTC) #3
eroman
+davidben, since I think Ryan forgot to add after leaving questions for him :)
5 years, 5 months ago (2015-07-07 17:25:25 UTC) #4
davidben
https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc#newcode31 net/cert/internal/verify_signed_data.cc:31: #include <openssl/pkcs12.h> What's this include for? https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc#newcode52 net/cert/internal/verify_signed_data.cc:52: pkey->reset(d2i_PUBKEY(nullptr, ...
5 years, 5 months ago (2015-07-07 18:03:57 UTC) #6
eroman
https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.h File net/cert/internal/verify_signed_data.h (right): https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.h#newcode15 net/cert/internal/verify_signed_data.h:15: } On 2015/07/07 14:07:31, Ryan Sleevi (slow through 7-15 ...
5 years, 5 months ago (2015-07-07 18:07:01 UTC) #7
eroman
https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc#newcode31 net/cert/internal/verify_signed_data.cc:31: #include <openssl/pkcs12.h> On 2015/07/07 18:03:56, David Benjamin wrote: > ...
5 years, 5 months ago (2015-07-07 18:34:44 UTC) #8
davidben
https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/120001/net/cert/internal/verify_signed_data.cc#newcode52 net/cert/internal/verify_signed_data.cc:52: pkey->reset(d2i_PUBKEY(nullptr, &ptr, spki.Length())); On 2015/07/07 18:34:43, eroman wrote: > ...
5 years, 5 months ago (2015-07-07 18:53:21 UTC) #9
eroman
I have updated to using d2i_EC_PUBKEY() / d2i_RSA_PUBKEY() rather than the more generic d2i_PUBKEY(). This ...
5 years, 5 months ago (2015-07-07 21:19:47 UTC) #10
davidben
On 2015/07/07 21:19:47, eroman wrote: > I have updated to using d2i_EC_PUBKEY() / d2i_RSA_PUBKEY() rather ...
5 years, 5 months ago (2015-07-07 21:28:20 UTC) #11
eroman
In fact I imagine I should also be doing a whitelist for the allowed EC ...
5 years, 5 months ago (2015-07-07 21:28:37 UTC) #12
eroman
I have updated this CL, please take another look. I am still using BoringSSL's d2i_RSA_PUBKEY(), ...
5 years, 5 months ago (2015-07-15 02:09:47 UTC) #13
Ryan Sleevi
https://codereview.chromium.org/1209283004/diff/320001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/320001/net/cert/internal/verify_signed_data.cc#newcode12 net/cert/internal/verify_signed_data.cc:12: // not worth the effort at this point. iOS ...
5 years, 5 months ago (2015-07-16 04:05:24 UTC) #14
eroman
https://codereview.chromium.org/1209283004/diff/320001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/320001/net/cert/internal/verify_signed_data.cc#newcode12 net/cert/internal/verify_signed_data.cc:12: // not worth the effort at this point. On ...
5 years, 5 months ago (2015-07-16 17:34:08 UTC) #15
eroman
https://codereview.chromium.org/1209283004/diff/320001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/320001/net/cert/internal/verify_signed_data.cc#newcode279 net/cert/internal/verify_signed_data.cc:279: crypto::ScopedEVP_MD_CTX ctx(EVP_MD_CTX_create()); On 2015/07/16 17:34:07, eroman wrote: > On ...
5 years, 5 months ago (2015-07-18 22:44:23 UTC) #16
davidben
Ryan: What is the story with the usage-specific SPKIs like id-RSASSA-PSS, id-ecDH, and id-ecMQV anyway? ...
5 years, 5 months ago (2015-07-20 19:21:59 UTC) #17
eroman
> Ryan: What is the story with the usage-specific SPKIs like id-RSASSA-PSS, > id-ecDH, and ...
5 years, 5 months ago (2015-07-20 20:03:40 UTC) #18
davidben
> As far as id-RSASSA-PSS, even if we decide against implementing it for > certificate ...
5 years, 5 months ago (2015-07-20 21:17:23 UTC) #19
eroman
> Hrmf. Could WebCrypto not do that? That seems kind of obnoxious. :-/ Also means ...
5 years, 5 months ago (2015-07-20 22:28:08 UTC) #20
davidben
(Looking at current iteration of CL now.) https://codereview.chromium.org/1209283004/diff/360001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/360001/net/cert/internal/verify_signed_data.cc#newcode141 net/cert/internal/verify_signed_data.cc:141: if (!pkey ...
5 years, 5 months ago (2015-07-21 15:29:06 UTC) #21
davidben
One last set of comments. (Sorry, I should have done the more careful review on ...
5 years, 5 months ago (2015-07-21 16:26:27 UTC) #22
eroman
> One last set of comments. (Sorry, I should have done the more careful review ...
5 years, 5 months ago (2015-07-21 19:24:29 UTC) #23
davidben
https://codereview.chromium.org/1209283004/diff/460001/net/cert/internal/verify_signed_data.h File net/cert/internal/verify_signed_data.h (right): https://codereview.chromium.org/1209283004/diff/460001/net/cert/internal/verify_signed_data.h#newcode28 net/cert/internal/verify_signed_data.h:28: // not the BIT STRING's DER itself. On 2015/07/21 ...
5 years, 5 months ago (2015-07-21 19:41:14 UTC) #24
eroman
OK I have changed the signature parameter to being a BIT STRING, and updated all ...
5 years, 5 months ago (2015-07-22 02:10:30 UTC) #25
eroman
PTAL ready for review now (I uploaded the tests we discussed). I confirmed that using ...
5 years, 5 months ago (2015-07-22 03:16:36 UTC) #26
davidben
https://codereview.chromium.org/1209283004/diff/560001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/560001/net/cert/internal/verify_signed_data.cc#newcode306 net/cert/internal/verify_signed_data.cc:306: if (!parser.ReadBitStringNoUnusedBits(&signature_value)) Did you forget to include this change? ...
5 years, 5 months ago (2015-07-22 17:20:47 UTC) #27
eroman
https://codereview.chromium.org/1209283004/diff/560001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/560001/net/cert/internal/verify_signed_data.cc#newcode306 net/cert/internal/verify_signed_data.cc:306: if (!parser.ReadBitStringNoUnusedBits(&signature_value)) On 2015/07/22 17:20:47, David Benjamin wrote: > ...
5 years, 5 months ago (2015-07-22 17:46:10 UTC) #28
davidben
lgtm https://codereview.chromium.org/1209283004/diff/560001/net/cert/internal/verify_signed_data.cc File net/cert/internal/verify_signed_data.cc (right): https://codereview.chromium.org/1209283004/diff/560001/net/cert/internal/verify_signed_data.cc#newcode306 net/cert/internal/verify_signed_data.cc:306: if (!parser.ReadBitStringNoUnusedBits(&signature_value)) On 2015/07/22 17:46:10, eroman wrote: > ...
5 years, 5 months ago (2015-07-22 17:49:41 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1209283004/640001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1209283004/640001
5 years, 4 months ago (2015-07-27 23:23:48 UTC) #32
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_ng/builds/21234)
5 years, 4 months ago (2015-07-27 23:52:26 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1209283004/660001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1209283004/660001
5 years, 4 months ago (2015-07-28 00:10:38 UTC) #37
commit-bot: I haz the power
Try jobs failed on following builders: win8_chromium_ng on tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win8_chromium_ng/builds/21262)
5 years, 4 months ago (2015-07-28 00:25:59 UTC) #39
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1209283004/660001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1209283004/660001
5 years, 4 months ago (2015-07-28 02:35:56 UTC) #41
commit-bot: I haz the power
Committed patchset #34 (id:660001)
5 years, 4 months ago (2015-07-28 02:40:52 UTC) #42
commit-bot: I haz the power
5 years, 4 months ago (2015-07-28 02:41:51 UTC) #43
Message was sent while issue was closed.
Patchset 34 (id:??) landed as
https://crrev.com/2b124dbcd72c180b2865dc0448e280d2e3e7cbe4
Cr-Commit-Position: refs/heads/master@{#340633}

Powered by Google App Engine
This is Rietveld 408576698