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

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

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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/proxy/proxy_config_source.cc ('k') | net/quic/crypto/aes_128_gcm_12_decrypter_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 (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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 203
204 *out_len = output_len; 204 *out_len = output_len;
205 return SECSuccess; 205 return SECSuccess;
206 } 206 }
207 207
208 } // namespace 208 } // namespace
209 209
210 Aes128Gcm12Decrypter::Aes128Gcm12Decrypter() 210 Aes128Gcm12Decrypter::Aes128Gcm12Decrypter()
211 : AeadBaseDecrypter(CKM_AES_GCM, My_Decrypt, kKeySize, kAuthTagSize, 211 : AeadBaseDecrypter(CKM_AES_GCM, My_Decrypt, kKeySize, kAuthTagSize,
212 kNoncePrefixSize) { 212 kNoncePrefixSize) {
213 COMPILE_ASSERT(kKeySize <= kMaxKeySize, key_size_too_big); 213 static_assert(kKeySize <= kMaxKeySize, "key size too big");
214 COMPILE_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 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/proxy/proxy_config_source.cc ('k') | net/quic/crypto/aes_128_gcm_12_decrypter_openssl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698