summaryrefslogtreecommitdiff
path: root/chromium/crypto/ghash_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/crypto/ghash_unittest.cc')
-rw-r--r--chromium/crypto/ghash_unittest.cc61
1 files changed, 31 insertions, 30 deletions
diff --git a/chromium/crypto/ghash_unittest.cc b/chromium/crypto/ghash_unittest.cc
index 5dd88ed5c8d..01f9cf4304d 100644
--- a/chromium/crypto/ghash_unittest.cc
+++ b/chromium/crypto/ghash_unittest.cc
@@ -2,10 +2,14 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <algorithm>
-
#include "crypto/ghash.h"
+#include <stddef.h>
+#include <stdint.h>
+
+#include <algorithm>
+
+#include "base/macros.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace crypto {
@@ -15,45 +19,42 @@ namespace {
// Test vectors are taken from Appendix B of
// http://csrc.nist.gov/groups/ST/toolkit/BCM/documents/proposedmodes/gcm/gcm-revised-spec.pdf
-static const uint8 kKey1[16] = {
- 0x66, 0xe9, 0x4b, 0xd4, 0xef, 0x8a, 0x2c, 0x3b,
- 0x88, 0x4c, 0xfa, 0x59, 0xca, 0x34, 0x2b, 0x2e,
+static const uint8_t kKey1[16] = {
+ 0x66, 0xe9, 0x4b, 0xd4, 0xef, 0x8a, 0x2c, 0x3b,
+ 0x88, 0x4c, 0xfa, 0x59, 0xca, 0x34, 0x2b, 0x2e,
};
-static const uint8 kCiphertext2[] = {
- 0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92,
- 0xf3, 0x28, 0xc2, 0xb9, 0x71, 0xb2, 0xfe, 0x78,
+static const uint8_t kCiphertext2[] = {
+ 0x03, 0x88, 0xda, 0xce, 0x60, 0xb6, 0xa3, 0x92,
+ 0xf3, 0x28, 0xc2, 0xb9, 0x71, 0xb2, 0xfe, 0x78,
};
-static const uint8 kKey3[16] = {
- 0xb8, 0x3b, 0x53, 0x37, 0x08, 0xbf, 0x53, 0x5d,
- 0x0a, 0xa6, 0xe5, 0x29, 0x80, 0xd5, 0x3b, 0x78,
+static const uint8_t kKey3[16] = {
+ 0xb8, 0x3b, 0x53, 0x37, 0x08, 0xbf, 0x53, 0x5d,
+ 0x0a, 0xa6, 0xe5, 0x29, 0x80, 0xd5, 0x3b, 0x78,
};
-static const uint8 kCiphertext3[] = {
- 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24,
- 0x4b, 0x72, 0x21, 0xb7, 0x84, 0xd0, 0xd4, 0x9c,
- 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02, 0xa4, 0xe0,
- 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e,
- 0x21, 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c,
- 0x7d, 0x8f, 0x6a, 0x5a, 0xac, 0x84, 0xaa, 0x05,
- 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac, 0x97,
- 0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85,
+static const uint8_t kCiphertext3[] = {
+ 0x42, 0x83, 0x1e, 0xc2, 0x21, 0x77, 0x74, 0x24, 0x4b, 0x72, 0x21,
+ 0xb7, 0x84, 0xd0, 0xd4, 0x9c, 0xe3, 0xaa, 0x21, 0x2f, 0x2c, 0x02,
+ 0xa4, 0xe0, 0x35, 0xc1, 0x7e, 0x23, 0x29, 0xac, 0xa1, 0x2e, 0x21,
+ 0xd5, 0x14, 0xb2, 0x54, 0x66, 0x93, 0x1c, 0x7d, 0x8f, 0x6a, 0x5a,
+ 0xac, 0x84, 0xaa, 0x05, 0x1b, 0xa3, 0x0b, 0x39, 0x6a, 0x0a, 0xac,
+ 0x97, 0x3d, 0x58, 0xe0, 0x91, 0x47, 0x3f, 0x59, 0x85,
};
-static const uint8 kAdditional4[] = {
- 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
- 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef,
- 0xab, 0xad, 0xda, 0xd2,
+static const uint8_t kAdditional4[] = {
+ 0xfe, 0xed, 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed,
+ 0xfa, 0xce, 0xde, 0xad, 0xbe, 0xef, 0xab, 0xad, 0xda, 0xd2,
};
struct TestCase {
- const uint8* key;
- const uint8* additional;
+ const uint8_t* key;
+ const uint8_t* additional;
unsigned additional_length;
- const uint8* ciphertext;
+ const uint8_t* ciphertext;
unsigned ciphertext_length;
- const uint8 expected[16];
+ const uint8_t expected[16];
};
static const TestCase kTestCases[] = {
@@ -104,7 +105,7 @@ static const TestCase kTestCases[] = {
};
TEST(GaloisHash, TestCases) {
- uint8 out[16];
+ uint8_t out[16];
for (size_t i = 0; i < arraysize(kTestCases); ++i) {
const TestCase& test = kTestCases[i];
@@ -120,7 +121,7 @@ TEST(GaloisHash, TestCases) {
}
TEST(GaloisHash, VaryLengths) {
- uint8 out[16];
+ uint8_t out[16];
for (size_t chunk_size = 1; chunk_size < 16; chunk_size++) {
for (size_t i = 0; i < arraysize(kTestCases); ++i) {