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

Side by Side Diff: net/quic/crypto/aes_128_gcm_12_decrypter_nss.cc

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/quic/crypto/aes_128_gcm_12_decrypter.h" 5 #include "net/quic/crypto/aes_128_gcm_12_decrypter.h"
6 6
7 #include <pk11pub.h> 7 #include <pk11pub.h>
8 #include <secerr.h> 8 #include <secerr.h>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 kNoncePrefixSize) { 212 kNoncePrefixSize) {
213 static_assert(kKeySize <= kMaxKeySize, "key size too big"); 213 static_assert(kKeySize <= kMaxKeySize, "key size too big");
214 static_assert(kNoncePrefixSize <= kMaxNoncePrefixSize, 214 static_assert(kNoncePrefixSize <= kMaxNoncePrefixSize,
215 "nonce prefix size too big"); 215 "nonce prefix size too big");
216 ignore_result(g_gcm_support_checker.Get()); 216 ignore_result(g_gcm_support_checker.Get());
217 } 217 }
218 218
219 Aes128Gcm12Decrypter::~Aes128Gcm12Decrypter() {} 219 Aes128Gcm12Decrypter::~Aes128Gcm12Decrypter() {}
220 220
221 void Aes128Gcm12Decrypter::FillAeadParams(StringPiece nonce, 221 void Aes128Gcm12Decrypter::FillAeadParams(StringPiece nonce,
222 StringPiece associated_data, 222 const StringPiece& associated_data,
223 size_t auth_tag_size, 223 size_t auth_tag_size,
224 AeadParams* aead_params) const { 224 AeadParams* aead_params) const {
225 aead_params->len = sizeof(aead_params->data.gcm_params); 225 aead_params->len = sizeof(aead_params->data.gcm_params);
226 CK_GCM_PARAMS* gcm_params = &aead_params->data.gcm_params; 226 CK_GCM_PARAMS* gcm_params = &aead_params->data.gcm_params;
227 gcm_params->pIv = 227 gcm_params->pIv =
228 reinterpret_cast<CK_BYTE*>(const_cast<char*>(nonce.data())); 228 reinterpret_cast<CK_BYTE*>(const_cast<char*>(nonce.data()));
229 gcm_params->ulIvLen = nonce.size(); 229 gcm_params->ulIvLen = nonce.size();
230 gcm_params->pAAD = 230 gcm_params->pAAD =
231 reinterpret_cast<CK_BYTE*>(const_cast<char*>(associated_data.data())); 231 reinterpret_cast<CK_BYTE*>(const_cast<char*>(associated_data.data()));
232 gcm_params->ulAADLen = associated_data.size(); 232 gcm_params->ulAADLen = associated_data.size();
233 gcm_params->ulTagBits = auth_tag_size * 8; 233 gcm_params->ulTagBits = auth_tag_size * 8;
234 } 234 }
235 235
236 } // namespace net 236 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/crypto/aes_128_gcm_12_decrypter.h ('k') | net/quic/crypto/aes_128_gcm_12_decrypter_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698