mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
Bug 709575 - Remove unnecessary ipc/chromium files. r=cjones
This commit is contained in:
parent
98ba23ffe5
commit
10e6018920
@ -63,7 +63,6 @@ endif # }
|
||||
vpath %.cc \
|
||||
$(srcdir)/src/base \
|
||||
$(srcdir)/src/base/third_party/nspr \
|
||||
$(srcdir)/src/base/third_party/nss \
|
||||
$(srcdir)/src/chrome/common \
|
||||
$(NULL)
|
||||
|
||||
@ -98,7 +97,6 @@ CPPSRCS += \
|
||||
ref_counted.cc \
|
||||
revocable_store.cc \
|
||||
scoped_temp_dir.cc \
|
||||
sha2.cc \
|
||||
simple_thread.cc \
|
||||
stats_table.cc \
|
||||
string_escape.cc \
|
||||
@ -130,7 +128,6 @@ CPPSRCS += \
|
||||
message_router.cc \
|
||||
notification_service.cc \
|
||||
task_queue.cc \
|
||||
sha512.cc \
|
||||
$(NULL)
|
||||
|
||||
ifdef OS_WIN # {
|
||||
|
@ -1,24 +0,0 @@
|
||||
// Copyright (c) 2006-2008 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 "base/sha2.h"
|
||||
|
||||
#include "base/third_party/nss/blapi.h"
|
||||
#include "base/third_party/nss/sha256.h"
|
||||
|
||||
using namespace nss;
|
||||
|
||||
namespace base {
|
||||
|
||||
void SHA256HashString(const std::string& str, void* output, size_t len) {
|
||||
SHA256Context ctx;
|
||||
|
||||
SHA256_Begin(&ctx);
|
||||
SHA256_Update(&ctx, reinterpret_cast<const unsigned char*>(str.data()),
|
||||
static_cast<unsigned int>(str.length()));
|
||||
SHA256_End(&ctx, static_cast<unsigned char*>(output), NULL,
|
||||
static_cast<unsigned int>(len));
|
||||
}
|
||||
|
||||
} // namespace base
|
@ -1,27 +0,0 @@
|
||||
// Copyright (c) 2006-2008 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.
|
||||
|
||||
#ifndef BASE_SHA2_H__
|
||||
#define BASE_SHA2_H__
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace base {
|
||||
|
||||
// These functions perform SHA-256 operations.
|
||||
//
|
||||
// Functions for SHA-384 and SHA-512 can be added when the need arises.
|
||||
|
||||
enum {
|
||||
SHA256_LENGTH = 32 // length in bytes of a SHA-256 hash
|
||||
};
|
||||
|
||||
// Computes the SHA-256 hash of the input string 'str' and stores the first
|
||||
// 'len' bytes of the hash in the output buffer 'output'. If 'len' > 32,
|
||||
// only 32 bytes (the full hash) are stored in the 'output' buffer.
|
||||
void SHA256HashString(const std::string& str, void* output, size_t len);
|
||||
|
||||
} // namespace base
|
||||
|
||||
#endif // BASE_SHA2_H__
|
@ -1,78 +0,0 @@
|
||||
// Copyright (c) 2006-2008 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 "base/sha2.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
#include "testing/gtest/include/gtest/gtest.h"
|
||||
|
||||
TEST(Sha256Test, Test1) {
|
||||
// Example B.1 from FIPS 180-2: one-block message.
|
||||
std::string input1 = "abc";
|
||||
int expected1[] = { 0xba, 0x78, 0x16, 0xbf,
|
||||
0x8f, 0x01, 0xcf, 0xea,
|
||||
0x41, 0x41, 0x40, 0xde,
|
||||
0x5d, 0xae, 0x22, 0x23,
|
||||
0xb0, 0x03, 0x61, 0xa3,
|
||||
0x96, 0x17, 0x7a, 0x9c,
|
||||
0xb4, 0x10, 0xff, 0x61,
|
||||
0xf2, 0x00, 0x15, 0xad };
|
||||
|
||||
uint8 output1[base::SHA256_LENGTH];
|
||||
base::SHA256HashString(input1, output1, sizeof(output1));
|
||||
for (size_t i = 0; i < base::SHA256_LENGTH; i++)
|
||||
EXPECT_EQ(expected1[i], static_cast<int>(output1[i]));
|
||||
|
||||
uint8 output_truncated1[4]; // 4 bytes == 32 bits
|
||||
base::SHA256HashString(input1, output_truncated1, sizeof(output_truncated1));
|
||||
for (size_t i = 0; i < sizeof(output_truncated1); i++)
|
||||
EXPECT_EQ(expected1[i], static_cast<int>(output_truncated1[i]));
|
||||
}
|
||||
|
||||
TEST(Sha256Test, Test2) {
|
||||
// Example B.2 from FIPS 180-2: multi-block message.
|
||||
std::string input2 =
|
||||
"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq";
|
||||
int expected2[] = { 0x24, 0x8d, 0x6a, 0x61,
|
||||
0xd2, 0x06, 0x38, 0xb8,
|
||||
0xe5, 0xc0, 0x26, 0x93,
|
||||
0x0c, 0x3e, 0x60, 0x39,
|
||||
0xa3, 0x3c, 0xe4, 0x59,
|
||||
0x64, 0xff, 0x21, 0x67,
|
||||
0xf6, 0xec, 0xed, 0xd4,
|
||||
0x19, 0xdb, 0x06, 0xc1 };
|
||||
|
||||
uint8 output2[base::SHA256_LENGTH];
|
||||
base::SHA256HashString(input2, output2, sizeof(output2));
|
||||
for (size_t i = 0; i < base::SHA256_LENGTH; i++)
|
||||
EXPECT_EQ(expected2[i], static_cast<int>(output2[i]));
|
||||
|
||||
uint8 output_truncated2[6];
|
||||
base::SHA256HashString(input2, output_truncated2, sizeof(output_truncated2));
|
||||
for (size_t i = 0; i < sizeof(output_truncated2); i++)
|
||||
EXPECT_EQ(expected2[i], static_cast<int>(output_truncated2[i]));
|
||||
}
|
||||
|
||||
TEST(Sha256Test, Test3) {
|
||||
// Example B.3 from FIPS 180-2: long message.
|
||||
std::string input3(1000000, 'a'); // 'a' repeated a million times
|
||||
int expected3[] = { 0xcd, 0xc7, 0x6e, 0x5c,
|
||||
0x99, 0x14, 0xfb, 0x92,
|
||||
0x81, 0xa1, 0xc7, 0xe2,
|
||||
0x84, 0xd7, 0x3e, 0x67,
|
||||
0xf1, 0x80, 0x9a, 0x48,
|
||||
0xa4, 0x97, 0x20, 0x0e,
|
||||
0x04, 0x6d, 0x39, 0xcc,
|
||||
0xc7, 0x11, 0x2c, 0xd0 };
|
||||
|
||||
uint8 output3[base::SHA256_LENGTH];
|
||||
base::SHA256HashString(input3, output3, sizeof(output3));
|
||||
for (size_t i = 0; i < base::SHA256_LENGTH; i++)
|
||||
EXPECT_EQ(expected3[i], static_cast<int>(output3[i]));
|
||||
|
||||
uint8 output_truncated3[12];
|
||||
base::SHA256HashString(input3, output_truncated3, sizeof(output_truncated3));
|
||||
for (size_t i = 0; i < sizeof(output_truncated3); i++)
|
||||
EXPECT_EQ(expected3[i], static_cast<int>(output_truncated3[i]));
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
The original code is the Network Security Services (NSS), licensed under
|
||||
the MPL/GPL/LGPL tri-license (http://www.mozilla.org/MPL/).
|
||||
|
||||
We extracted the SHA-256 source files, eliminated unneeded dependencies,
|
||||
deleted or commented out unused code, and tweaked them for Chrome's source
|
||||
tree. sha512.c is renamed sha512.cc so that it can include Chrome's C++
|
||||
header "base/basictypes.h". We define NOUNROLL256 to reduce the object code
|
||||
size.
|
105
ipc/chromium/src/base/third_party/nss/blapi.h
vendored
105
ipc/chromium/src/base/third_party/nss/blapi.h
vendored
@ -1,105 +0,0 @@
|
||||
/*
|
||||
* crypto.h - public data structures and prototypes for the crypto library
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1994-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dr Vipul Gupta <vipul.gupta@sun.com>, Sun Microsystems Laboratories
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: blapi.h,v 1.27 2007/11/09 18:49:32 wtc%google.com Exp $ */
|
||||
|
||||
#ifndef _BLAPI_H_
|
||||
#define _BLAPI_H_
|
||||
|
||||
#include "base/third_party/nss/blapit.h"
|
||||
|
||||
namespace nss {
|
||||
|
||||
/******************************************/
|
||||
|
||||
extern SHA256Context *SHA256_NewContext(void);
|
||||
extern void SHA256_DestroyContext(SHA256Context *cx, bool freeit);
|
||||
extern void SHA256_Begin(SHA256Context *cx);
|
||||
extern void SHA256_Update(SHA256Context *cx, const unsigned char *input,
|
||||
unsigned int inputLen);
|
||||
extern void SHA256_End(SHA256Context *cx, unsigned char *digest,
|
||||
unsigned int *digestLen, unsigned int maxDigestLen);
|
||||
extern SECStatus SHA256_HashBuf(unsigned char *dest, const unsigned char *src,
|
||||
uint32 src_length);
|
||||
extern SECStatus SHA256_Hash(unsigned char *dest, const char *src);
|
||||
extern void SHA256_TraceState(SHA256Context *cx);
|
||||
extern unsigned int SHA256_FlattenSize(SHA256Context *cx);
|
||||
extern SECStatus SHA256_Flatten(SHA256Context *cx,unsigned char *space);
|
||||
extern SHA256Context * SHA256_Resurrect(unsigned char *space, void *arg);
|
||||
extern void SHA256_Clone(SHA256Context *dest, SHA256Context *src);
|
||||
|
||||
/******************************************/
|
||||
|
||||
extern SHA512Context *SHA512_NewContext(void);
|
||||
extern void SHA512_DestroyContext(SHA512Context *cx, bool freeit);
|
||||
extern void SHA512_Begin(SHA512Context *cx);
|
||||
extern void SHA512_Update(SHA512Context *cx, const unsigned char *input,
|
||||
unsigned int inputLen);
|
||||
extern void SHA512_End(SHA512Context *cx, unsigned char *digest,
|
||||
unsigned int *digestLen, unsigned int maxDigestLen);
|
||||
extern SECStatus SHA512_HashBuf(unsigned char *dest, const unsigned char *src,
|
||||
uint32 src_length);
|
||||
extern SECStatus SHA512_Hash(unsigned char *dest, const char *src);
|
||||
extern void SHA512_TraceState(SHA512Context *cx);
|
||||
extern unsigned int SHA512_FlattenSize(SHA512Context *cx);
|
||||
extern SECStatus SHA512_Flatten(SHA512Context *cx,unsigned char *space);
|
||||
extern SHA512Context * SHA512_Resurrect(unsigned char *space, void *arg);
|
||||
extern void SHA512_Clone(SHA512Context *dest, SHA512Context *src);
|
||||
|
||||
/******************************************/
|
||||
|
||||
extern SHA384Context *SHA384_NewContext(void);
|
||||
extern void SHA384_DestroyContext(SHA384Context *cx, bool freeit);
|
||||
extern void SHA384_Begin(SHA384Context *cx);
|
||||
extern void SHA384_Update(SHA384Context *cx, const unsigned char *input,
|
||||
unsigned int inputLen);
|
||||
extern void SHA384_End(SHA384Context *cx, unsigned char *digest,
|
||||
unsigned int *digestLen, unsigned int maxDigestLen);
|
||||
extern SECStatus SHA384_HashBuf(unsigned char *dest, const unsigned char *src,
|
||||
uint32 src_length);
|
||||
extern SECStatus SHA384_Hash(unsigned char *dest, const char *src);
|
||||
extern void SHA384_TraceState(SHA384Context *cx);
|
||||
extern unsigned int SHA384_FlattenSize(SHA384Context *cx);
|
||||
extern SECStatus SHA384_Flatten(SHA384Context *cx,unsigned char *space);
|
||||
extern SHA384Context * SHA384_Resurrect(unsigned char *space, void *arg);
|
||||
extern void SHA384_Clone(SHA384Context *dest, SHA384Context *src);
|
||||
|
||||
} // namespace nss
|
||||
|
||||
#endif /* _BLAPI_H_ */
|
91
ipc/chromium/src/base/third_party/nss/blapit.h
vendored
91
ipc/chromium/src/base/third_party/nss/blapit.h
vendored
@ -1,91 +0,0 @@
|
||||
/*
|
||||
* blapit.h - public data structures for the crypto library
|
||||
*
|
||||
* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1994-2000
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Dr Vipul Gupta <vipul.gupta@sun.com> and
|
||||
* Douglas Stebila <douglas@stebila.ca>, Sun Microsystems Laboratories
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
/* $Id: blapit.h,v 1.20 2007/02/28 19:47:37 rrelyea%redhat.com Exp $ */
|
||||
|
||||
#ifndef _BLAPIT_H_
|
||||
#define _BLAPIT_H_
|
||||
|
||||
#include "base/third_party/nspr/prtypes.h"
|
||||
|
||||
/*
|
||||
** A status code. Status's are used by procedures that return status
|
||||
** values. Again the motivation is so that a compiler can generate
|
||||
** warnings when return values are wrong. Correct testing of status codes:
|
||||
**
|
||||
** SECStatus rv;
|
||||
** rv = some_function (some_argument);
|
||||
** if (rv != SECSuccess)
|
||||
** do_an_error_thing();
|
||||
**
|
||||
*/
|
||||
typedef enum _SECStatus {
|
||||
SECWouldBlock = -2,
|
||||
SECFailure = -1,
|
||||
SECSuccess = 0
|
||||
} SECStatus;
|
||||
|
||||
#define SHA256_LENGTH 32 /* bytes */
|
||||
#define SHA384_LENGTH 48 /* bytes */
|
||||
#define SHA512_LENGTH 64 /* bytes */
|
||||
#define HASH_LENGTH_MAX SHA512_LENGTH
|
||||
|
||||
/*
|
||||
* Input block size for each hash algorithm.
|
||||
*/
|
||||
|
||||
#define SHA256_BLOCK_LENGTH 64 /* bytes */
|
||||
#define SHA384_BLOCK_LENGTH 128 /* bytes */
|
||||
#define SHA512_BLOCK_LENGTH 128 /* bytes */
|
||||
#define HASH_BLOCK_LENGTH_MAX SHA512_BLOCK_LENGTH
|
||||
|
||||
/***************************************************************************
|
||||
** Opaque objects
|
||||
*/
|
||||
|
||||
struct SHA256ContextStr ;
|
||||
struct SHA512ContextStr ;
|
||||
|
||||
typedef struct SHA256ContextStr SHA256Context;
|
||||
typedef struct SHA512ContextStr SHA512Context;
|
||||
/* SHA384Context is really a SHA512ContextStr. This is not a mistake. */
|
||||
typedef struct SHA512ContextStr SHA384Context;
|
||||
|
||||
#endif /* _BLAPIT_H_ */
|
51
ipc/chromium/src/base/third_party/nss/sha256.h
vendored
51
ipc/chromium/src/base/third_party/nss/sha256.h
vendored
@ -1,51 +0,0 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Netscape security libraries.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2002
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef _SHA_256_H_
|
||||
#define _SHA_256_H_
|
||||
|
||||
#include "base/third_party/nspr/prtypes.h"
|
||||
|
||||
struct SHA256ContextStr {
|
||||
union {
|
||||
PRUint32 w[64]; /* message schedule, input buffer, plus 48 words */
|
||||
PRUint8 b[256];
|
||||
} u;
|
||||
PRUint32 h[8]; /* 8 state variables */
|
||||
PRUint32 sizeHi,sizeLo; /* 64-bit count of hashed bytes. */
|
||||
};
|
||||
|
||||
#endif /* _SHA_256_H_ */
|
1397
ipc/chromium/src/base/third_party/nss/sha512.cc
vendored
1397
ipc/chromium/src/base/third_party/nss/sha512.cc
vendored
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user