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

Side by Side Diff: crypto/hmac_win.cc

Issue 686883002: Add crypto/wincrypt_shim.h wrapper header to resolve BoringSSL conflicts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sleevi comments Created 6 years, 1 month 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 | « crypto/crypto.gypi ('k') | crypto/scoped_capi_types.h » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "crypto/hmac.h" 5 #include "crypto/hmac.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <wincrypt.h>
9 8
10 #include <algorithm> 9 #include <algorithm>
11 #include <vector> 10 #include <vector>
12 11
13 #include "base/logging.h" 12 #include "base/logging.h"
14 #include "crypto/scoped_capi_types.h" 13 #include "crypto/scoped_capi_types.h"
15 #include "crypto/third_party/nss/chromium-blapi.h" 14 #include "crypto/third_party/nss/chromium-blapi.h"
16 #include "crypto/third_party/nss/chromium-sha256.h" 15 #include "crypto/third_party/nss/chromium-sha256.h"
16 #include "crypto/wincrypt_shim.h"
17 17
18 namespace crypto { 18 namespace crypto {
19 19
20 namespace { 20 namespace {
21 21
22 // Implementation of HMAC-SHA-256: 22 // Implementation of HMAC-SHA-256:
23 // 23 //
24 // SHA-256 is supported in Windows XP SP3 or later. We still need to support 24 // SHA-256 is supported in Windows XP SP3 or later. We still need to support
25 // Windows XP SP2, so unfortunately we have to implement HMAC-SHA-256 here. 25 // Windows XP SP2, so unfortunately we have to implement HMAC-SHA-256 here.
26 26
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 200
201 if (!CryptHashData(hash, reinterpret_cast<const BYTE*>(data.data()), 201 if (!CryptHashData(hash, reinterpret_cast<const BYTE*>(data.data()),
202 static_cast<DWORD>(data.size()), 0)) 202 static_cast<DWORD>(data.size()), 0))
203 return false; 203 return false;
204 204
205 DWORD sha1_size = static_cast<DWORD>(digest_length); 205 DWORD sha1_size = static_cast<DWORD>(digest_length);
206 return !!CryptGetHashParam(hash, HP_HASHVAL, digest, &sha1_size, 0); 206 return !!CryptGetHashParam(hash, HP_HASHVAL, digest, &sha1_size, 0);
207 } 207 }
208 208
209 } // namespace crypto 209 } // namespace crypto
OLDNEW
« no previous file with comments | « crypto/crypto.gypi ('k') | crypto/scoped_capi_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698