 Chromium Code Reviews
 Chromium Code Reviews Issue 1378613004:
  Set Token-Binding HTTP header  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@tb-tls-ext-new
    
  
    Issue 1378613004:
  Set Token-Binding HTTP header  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@tb-tls-ext-new| OLD | NEW | 
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "net/ssl/token_binding.h" | |
| 6 | |
| 7 #include <openssl/bytestring.h> | |
| 8 #include <openssl/mem.h> | |
| 9 | |
| 10 #include "net/base/net_errors.h" | |
| 11 | |
| 12 namespace net { | |
| 13 | |
| 14 int BuildTokenBindingMessageFromTokenBindings( | |
| 15 const std::vector<std::string>& token_bindings, | |
| 16 std::string* out) { | |
| 17 CBB tb_message, tb_messages; | |
| 18 uint8_t* out_data; | |
| 19 size_t out_len; | |
| 
mattm
2015/10/01 01:53:01
move these down to where they are first used
 
nharper
2015/10/01 20:25:46
Done.
 | |
| 20 if (!CBB_init(&tb_message, 0) || | |
| 21 !CBB_add_u16_length_prefixed(&tb_message, &tb_messages)) { | |
| 22 CBB_cleanup(&tb_message); | |
| 23 return ERR_FAILED; | |
| 24 } | |
| 25 for (const std::string& token_binding : token_bindings) { | |
| 26 if (!CBB_add_bytes(&tb_messages, reinterpret_cast<uint8*>(const_cast<char*>( | |
| 27 token_binding.data())), | |
| 28 token_binding.size())) { | |
| 29 CBB_cleanup(&tb_message); | |
| 30 return ERR_FAILED; | |
| 31 } | |
| 32 } | |
| 33 if (!CBB_finish(&tb_message, &out_data, &out_len)) { | |
| 34 CBB_cleanup(&tb_message); | |
| 35 return ERR_FAILED; | |
| 36 } | |
| 37 out->assign(reinterpret_cast<char*>(out_data), out_len); | |
| 38 OPENSSL_free(out_data); | |
| 39 return OK; | |
| 40 } | |
| 41 | |
| 42 } // namespace net | |
| OLD | NEW |