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

Unified Diff: net/http/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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/http/des.cc ('k') | net/http/http_auth_handler_ntlm_portable.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/des_unittest.cc
diff --git a/net/http/des_unittest.cc b/net/http/des_unittest.cc
deleted file mode 100644
index 63172bb7e9b336762e3ccf578f8ffb459af68e1b..0000000000000000000000000000000000000000
--- a/net/http/des_unittest.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include <string.h>
-
-#include "net/http/des.h"
-#include "testing/gtest/include/gtest/gtest.h"
-
-namespace net {
-
-// This test vector comes from the NSS FIPS power-up self-test.
-TEST(DESTest, KnownAnswerTest1) {
- // DES known key (56-bits).
- static const uint8_t des_known_key[] = "ANSI DES";
-
- // DES known plaintext (64-bits).
- static const uint8_t des_ecb_known_plaintext[] = "Netscape";
-
- // DES known ciphertext (64-bits).
- static const uint8_t des_ecb_known_ciphertext[] = {0x26, 0x14, 0xe9, 0xc3,
- 0x28, 0x80, 0x50, 0xb0};
-
- uint8_t ciphertext[8];
- memset(ciphertext, 0xaf, sizeof(ciphertext));
-
- DESEncrypt(des_known_key, des_ecb_known_plaintext, ciphertext);
- EXPECT_EQ(0, memcmp(ciphertext, des_ecb_known_ciphertext, 8));
-}
-
-// This test vector comes from NIST Special Publication 800-17, Modes of
-// Operation Validation System (MOVS): Requirements and Procedures, Appendix
-// A, page 124.
-TEST(DESTest, KnownAnswerTest2) {
- static const uint8_t key[] = {0x10, 0x31, 0x6e, 0x02, 0x8c, 0x8f, 0x3b, 0x4a};
- static const uint8_t plaintext[] = {0, 0, 0, 0, 0, 0, 0, 0};
- static const uint8_t known_ciphertext[] = {0x82, 0xdc, 0xba, 0xfb,
- 0xde, 0xab, 0x66, 0x02};
- uint8_t ciphertext[8];
- memset(ciphertext, 0xaf, sizeof(ciphertext));
-
- DESEncrypt(key, plaintext, ciphertext);
- EXPECT_EQ(0, memcmp(ciphertext, known_ciphertext, 8));
-}
-
-} // namespace net
« no previous file with comments | « net/http/des.cc ('k') | net/http/http_auth_handler_ntlm_portable.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698