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

Side by Side Diff: components/webcrypto/nss/aes_gcm_nss.cc

Issue 1077273002: html_viewer: Move webcrypto to a place where html_viewer can use it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to ToT Created 5 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 | « components/webcrypto/nss/aes_cbc_nss.cc ('k') | components/webcrypto/nss/aes_kw_nss.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "base/numerics/safe_math.h" 5 #include "base/numerics/safe_math.h"
6 #include "base/stl_util.h" 6 #include "base/stl_util.h"
7 #include "content/child/webcrypto/crypto_data.h" 7 #include "components/webcrypto/crypto_data.h"
8 #include "content/child/webcrypto/nss/aes_algorithm_nss.h" 8 #include "components/webcrypto/nss/aes_algorithm_nss.h"
9 #include "content/child/webcrypto/nss/key_nss.h" 9 #include "components/webcrypto/nss/key_nss.h"
10 #include "content/child/webcrypto/nss/util_nss.h" 10 #include "components/webcrypto/nss/util_nss.h"
11 #include "content/child/webcrypto/status.h" 11 #include "components/webcrypto/status.h"
12 #include "content/child/webcrypto/webcrypto_util.h" 12 #include "components/webcrypto/webcrypto_util.h"
13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h" 13 #include "third_party/WebKit/public/platform/WebCryptoAlgorithmParams.h"
14 14
15 // At the time of this writing: 15 // At the time of this writing:
16 // * Windows and Mac builds ship with their own copy of NSS (3.15+) 16 // * Windows and Mac builds ship with their own copy of NSS (3.15+)
17 // * Linux builds use the system's libnss, which is 3.14 on Debian (but 3.15+ 17 // * Linux builds use the system's libnss, which is 3.14 on Debian (but 3.15+
18 // on other distros). 18 // on other distros).
19 // 19 //
20 // Since NSS provides AES-GCM support starting in version 3.15, it may be 20 // Since NSS provides AES-GCM support starting in version 3.15, it may be
21 // unavailable for Linux Chrome users. 21 // unavailable for Linux Chrome users.
22 // 22 //
23 // * !defined(CKM_AES_GCM) 23 // * !defined(CKM_AES_GCM)
24 // 24 //
25 // This means that at build time, the NSS header pkcs11t.h is older than 25 // This means that at build time, the NSS header pkcs11t.h is older than
26 // 3.15. However at runtime support may be present. 26 // 3.15. However at runtime support may be present.
27 // 27 //
28 // TODO(eroman): Simplify this once 3.15+ is required by Linux builds. 28 // TODO(eroman): Simplify this once 3.15+ is required by Linux builds.
29 #if !defined(CKM_AES_GCM) 29 #if !defined(CKM_AES_GCM)
30 #define CKM_AES_GCM 0x00001087 30 #define CKM_AES_GCM 0x00001087
31 31
32 struct CK_GCM_PARAMS { 32 struct CK_GCM_PARAMS {
33 CK_BYTE_PTR pIv; 33 CK_BYTE_PTR pIv;
34 CK_ULONG ulIvLen; 34 CK_ULONG ulIvLen;
35 CK_BYTE_PTR pAAD; 35 CK_BYTE_PTR pAAD;
36 CK_ULONG ulAADLen; 36 CK_ULONG ulAADLen;
37 CK_ULONG ulTagBits; 37 CK_ULONG ulTagBits;
38 }; 38 };
39 #endif // !defined(CKM_AES_GCM) 39 #endif // !defined(CKM_AES_GCM)
40 40
41 namespace content {
42
43 namespace webcrypto { 41 namespace webcrypto {
44 42
45 namespace { 43 namespace {
46 44
47 Status NssSupportsAesGcm() { 45 Status NssSupportsAesGcm() {
48 if (NssRuntimeSupport::Get()->IsAesGcmSupported()) 46 if (NssRuntimeSupport::Get()->IsAesGcmSupported())
49 return Status::Success(); 47 return Status::Success();
50 return Status::ErrorUnsupported( 48 return Status::ErrorUnsupported(
51 "NSS version doesn't support AES-GCM. Try using version 3.15 or later"); 49 "NSS version doesn't support AES-GCM. Try using version 3.15 or later");
52 } 50 }
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 } 173 }
176 }; 174 };
177 175
178 } // namespace 176 } // namespace
179 177
180 AlgorithmImplementation* CreatePlatformAesGcmImplementation() { 178 AlgorithmImplementation* CreatePlatformAesGcmImplementation() {
181 return new AesGcmImplementation; 179 return new AesGcmImplementation;
182 } 180 }
183 181
184 } // namespace webcrypto 182 } // namespace webcrypto
185
186 } // namespace content
OLDNEW
« no previous file with comments | « components/webcrypto/nss/aes_cbc_nss.cc ('k') | components/webcrypto/nss/aes_kw_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698