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

Side by Side Diff: net/ntlm/des_unittest.cc

Issue 2873673002: Add unit tests for NTLMv1 portable implementation (Closed)
Patch Set: Rebase Created 3 years, 5 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/ntlm/des.cc ('k') | net/ntlm/md4.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 <string.h> 5 #include <string.h>
6 6
7 #include "net/http/des.h" 7 #include "net/ntlm/des.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace net { 10 namespace net {
11 11
12 // This test vector comes from the NSS FIPS power-up self-test. 12 // This test vector comes from the NSS FIPS power-up self-test.
13 TEST(DESTest, KnownAnswerTest1) { 13 TEST(DESTest, KnownAnswerTest1) {
14 // DES known key (56-bits). 14 // DES known key (56-bits).
15 static const uint8_t des_known_key[] = "ANSI DES"; 15 static const uint8_t des_known_key[] = "ANSI DES";
16 16
17 // DES known plaintext (64-bits). 17 // DES known plaintext (64-bits).
(...skipping 19 matching lines...) Expand all
37 static const uint8_t known_ciphertext[] = {0x82, 0xdc, 0xba, 0xfb, 37 static const uint8_t known_ciphertext[] = {0x82, 0xdc, 0xba, 0xfb,
38 0xde, 0xab, 0x66, 0x02}; 38 0xde, 0xab, 0x66, 0x02};
39 uint8_t ciphertext[8]; 39 uint8_t ciphertext[8];
40 memset(ciphertext, 0xaf, sizeof(ciphertext)); 40 memset(ciphertext, 0xaf, sizeof(ciphertext));
41 41
42 DESEncrypt(key, plaintext, ciphertext); 42 DESEncrypt(key, plaintext, ciphertext);
43 EXPECT_EQ(0, memcmp(ciphertext, known_ciphertext, 8)); 43 EXPECT_EQ(0, memcmp(ciphertext, known_ciphertext, 8));
44 } 44 }
45 45
46 } // namespace net 46 } // namespace net
OLDNEW
« no previous file with comments | « net/ntlm/des.cc ('k') | net/ntlm/md4.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698