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

Unified Diff: net/quic/crypto/channel_id_openssl.cc

Issue 16638016: Implement ChannelIDVerifier using NSS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Disable QuicCryptoServerStreamTest.ChannelID. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/quic/crypto/channel_id_openssl.cc
===================================================================
--- net/quic/crypto/channel_id_openssl.cc (revision 203993)
+++ net/quic/crypto/channel_id_openssl.cc (working copy)
@@ -20,6 +20,14 @@
bool ChannelIDVerifier::Verify(StringPiece key,
StringPiece signed_data,
StringPiece signature) {
+ return VerifyRaw(key, signed_data, signature, true);
+}
+
+// static
+bool ChannelIDVerifier::VerifyRaw(StringPiece key,
+ StringPiece signed_data,
+ StringPiece signature,
+ bool is_channel_id_signature) {
if (key.size() != 32 * 2 ||
signature.size() != 32 * 2) {
return false;
@@ -65,10 +73,10 @@
SHA256_CTX sha256;
SHA256_Init(&sha256);
- SHA256_Update(&sha256, ChannelIDVerifier::kContextStr,
- strlen(ChannelIDVerifier::kContextStr) + 1);
- SHA256_Update(&sha256, ChannelIDVerifier::kClientToServerStr,
- strlen(ChannelIDVerifier::kClientToServerStr) + 1);
+ if (is_channel_id_signature) {
+ SHA256_Update(&sha256, kContextStr, strlen(kContextStr) + 1);
+ SHA256_Update(&sha256, kClientToServerStr, strlen(kClientToServerStr) + 1);
+ }
SHA256_Update(&sha256, signed_data.data(), signed_data.size());
unsigned char digest[SHA256_DIGEST_LENGTH];

Powered by Google App Engine
This is Rietveld 408576698