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

Side by Side Diff: net/ssl/token_binding.cc

Issue 1918903002: Rename net/ _openssl files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix unused method. Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « net/ssl/token_binding.h ('k') | net/ssl/token_binding_openssl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/ssl/token_binding.h" 5 #include "net/ssl/token_binding.h"
6 6
7 #include <openssl/bytestring.h> 7 #include <openssl/bytestring.h>
8 #include <openssl/ec.h> 8 #include <openssl/ec.h>
9 #include <openssl/evp.h> 9 #include <openssl/evp.h>
10 #include <openssl/mem.h> 10 #include <openssl/mem.h>
(...skipping 15 matching lines...) Expand all
26 return CBB_add_u8(out, TB_PARAM_ECDSAP256) && 26 return CBB_add_u8(out, TB_PARAM_ECDSAP256) &&
27 CBB_add_u8_length_prefixed(out, &ec_point) && 27 CBB_add_u8_length_prefixed(out, &ec_point) &&
28 EC_POINT_point2cbb(&ec_point, EC_KEY_get0_group(ec_key), 28 EC_POINT_point2cbb(&ec_point, EC_KEY_get0_group(ec_key),
29 EC_KEY_get0_public_key(ec_key), 29 EC_KEY_get0_public_key(ec_key),
30 POINT_CONVERSION_UNCOMPRESSED, nullptr) && 30 POINT_CONVERSION_UNCOMPRESSED, nullptr) &&
31 CBB_flush(out); 31 CBB_flush(out);
32 } 32 }
33 33
34 } // namespace 34 } // namespace
35 35
36 bool IsTokenBindingSupported() {
37 return true;
38 }
39
40 bool SignTokenBindingEkm(base::StringPiece ekm, 36 bool SignTokenBindingEkm(base::StringPiece ekm,
41 crypto::ECPrivateKey* key, 37 crypto::ECPrivateKey* key,
42 std::vector<uint8_t>* out) { 38 std::vector<uint8_t>* out) {
43 size_t sig_len; 39 size_t sig_len;
44 const uint8_t* ekm_data = reinterpret_cast<const uint8_t*>(ekm.data()); 40 const uint8_t* ekm_data = reinterpret_cast<const uint8_t*>(ekm.data());
45 crypto::ScopedEVP_PKEY_CTX pctx(EVP_PKEY_CTX_new(key->key(), nullptr)); 41 crypto::ScopedEVP_PKEY_CTX pctx(EVP_PKEY_CTX_new(key->key(), nullptr));
46 if (!EVP_PKEY_sign_init(pctx.get()) || 42 if (!EVP_PKEY_sign_init(pctx.get()) ||
47 !EVP_PKEY_sign(pctx.get(), nullptr, &sig_len, ekm_data, ekm.size())) { 43 !EVP_PKEY_sign(pctx.get(), nullptr, &sig_len, ekm_data, ekm.size())) {
48 return false; 44 return false;
49 } 45 }
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 !EVP_PKEY_verify( 153 !EVP_PKEY_verify(
158 pctx.get(), reinterpret_cast<const uint8_t*>(signature.data()), 154 pctx.get(), reinterpret_cast<const uint8_t*>(signature.data()),
159 signature.size(), reinterpret_cast<const uint8_t*>(ekm.data()), 155 signature.size(), reinterpret_cast<const uint8_t*>(ekm.data()),
160 ekm.size())) { 156 ekm.size())) {
161 return false; 157 return false;
162 } 158 }
163 return true; 159 return true;
164 } 160 }
165 161
166 } // namespace net 162 } // namespace net
OLDNEW
« no previous file with comments | « net/ssl/token_binding.h ('k') | net/ssl/token_binding_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698