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

Side by Side Diff: crypto/hmac_unittest.cc

Issue 1539353003: Switch to standard integer types in crypto/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 5 years 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/hmac_openssl.cc ('k') | crypto/hmac_win.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <stddef.h>
6
5 #include <string> 7 #include <string>
6 8
9 #include "base/macros.h"
7 #include "crypto/hmac.h" 10 #include "crypto/hmac.h"
8 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
9 12
10 static const size_t kSHA1DigestSize = 20; 13 static const size_t kSHA1DigestSize = 20;
11 static const size_t kSHA256DigestSize = 32; 14 static const size_t kSHA256DigestSize = 32;
12 15
13 static const char* kSimpleKey = 16 static const char* kSimpleKey =
14 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" 17 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
15 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" 18 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
16 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA" 19 "\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA\xAA"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 crypto::HMAC hmac(crypto::HMAC::SHA1); 289 crypto::HMAC hmac(crypto::HMAC::SHA1);
287 ASSERT_TRUE(hmac.Init(NULL, 0)); 290 ASSERT_TRUE(hmac.Init(NULL, 0));
288 291
289 unsigned char digest[kSHA1DigestSize]; 292 unsigned char digest[kSHA1DigestSize];
290 EXPECT_TRUE(hmac.Sign(data, digest, kSHA1DigestSize)); 293 EXPECT_TRUE(hmac.Sign(data, digest, kSHA1DigestSize));
291 EXPECT_EQ(0, memcmp(kExpectedDigest, digest, kSHA1DigestSize)); 294 EXPECT_EQ(0, memcmp(kExpectedDigest, digest, kSHA1DigestSize));
292 295
293 EXPECT_TRUE(hmac.Verify( 296 EXPECT_TRUE(hmac.Verify(
294 data, base::StringPiece(kExpectedDigest, kSHA1DigestSize))); 297 data, base::StringPiece(kExpectedDigest, kSHA1DigestSize)));
295 } 298 }
OLDNEW
« no previous file with comments | « crypto/hmac_openssl.cc ('k') | crypto/hmac_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698