From a5a260ca52efb43083d654805dce773580102cb9 Mon Sep 17 00:00:00 2001 From: Jack Lloyd Date: Sun, 17 Jul 2016 11:55:26 -0400 Subject: Remove deprecated hashes MD2, HAS-160, and RIPEMD-128 --- src/lib/asn1/oid_lookup/default.cpp | 1 - src/lib/hash/has160/has160.cpp | 162 ------------------------ src/lib/hash/has160/has160.h | 39 ------ src/lib/hash/has160/info.txt | 5 - src/lib/hash/hash.cpp | 24 ---- src/lib/hash/md2/info.txt | 1 - src/lib/hash/md2/md2.cpp | 112 ----------------- src/lib/hash/md2/md2.h | 41 ------ src/lib/hash/rmd128/info.txt | 5 - src/lib/hash/rmd128/rmd128.cpp | 173 -------------------------- src/lib/hash/rmd128/rmd128.h | 38 ------ src/lib/pk_pad/hash_id/hash_id.cpp | 17 --- src/lib/prov/openssl/openssl_hash.cpp | 4 - src/tests/data/hash/has160.vec | 22 ---- src/tests/data/hash/md2.vec | 226 ---------------------------------- src/tests/data/hash/parallel.vec | 3 - src/tests/data/hash/ripemd128.vec | 24 ---- src/tests/data/mac/hmac.vec | 42 ------- src/tests/data/pbkdf/pbkdf1.vec | 25 ---- src/tests/data/pubkey/rsa_sig.vec | 35 ------ 20 files changed, 999 deletions(-) delete mode 100644 src/lib/hash/has160/has160.cpp delete mode 100644 src/lib/hash/has160/has160.h delete mode 100644 src/lib/hash/has160/info.txt delete mode 100644 src/lib/hash/md2/info.txt delete mode 100644 src/lib/hash/md2/md2.cpp delete mode 100644 src/lib/hash/md2/md2.h delete mode 100644 src/lib/hash/rmd128/info.txt delete mode 100644 src/lib/hash/rmd128/rmd128.cpp delete mode 100644 src/lib/hash/rmd128/rmd128.h delete mode 100644 src/tests/data/hash/has160.vec delete mode 100644 src/tests/data/hash/md2.vec delete mode 100644 src/tests/data/hash/ripemd128.vec diff --git a/src/lib/asn1/oid_lookup/default.cpp b/src/lib/asn1/oid_lookup/default.cpp index 0d64a8bef..8b9d97e38 100644 --- a/src/lib/asn1/oid_lookup/default.cpp +++ b/src/lib/asn1/oid_lookup/default.cpp @@ -93,7 +93,6 @@ const char* default_oid_list() "1.2.840.113549.1.9.16.3.8 = Compression.Zlib" "\n" "1.2.840.113549.1.1.1 = RSA/EME-PKCS1-v1_5" "\n" - "1.2.840.113549.1.1.2 = RSA/EMSA3(MD2)" "\n" "1.2.840.113549.1.1.4 = RSA/EMSA3(MD5)" "\n" "1.2.840.113549.1.1.5 = RSA/EMSA3(SHA-160)" "\n" "1.2.840.113549.1.1.11 = RSA/EMSA3(SHA-256)" "\n" diff --git a/src/lib/hash/has160/has160.cpp b/src/lib/hash/has160/has160.cpp deleted file mode 100644 index 114b5f8b5..000000000 --- a/src/lib/hash/has160/has160.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/* -* HAS-160 -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include - -namespace Botan { - -namespace HAS_160_F { - -/* -* HAS-160 F1 Function -*/ -inline void F1(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, - u32bit msg, u32bit rot) - { - E += rotate_left(A, rot) + (D ^ (B & (C ^ D))) + msg; - B = rotate_left(B, 10); - } - -/* -* HAS-160 F2 Function -*/ -inline void F2(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, - u32bit msg, u32bit rot) - { - E += rotate_left(A, rot) + (B ^ C ^ D) + msg + 0x5A827999; - B = rotate_left(B, 17); - } - -/* -* HAS-160 F3 Function -*/ -inline void F3(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, - u32bit msg, u32bit rot) - { - E += rotate_left(A, rot) + (C ^ (B | ~D)) + msg + 0x6ED9EBA1; - B = rotate_left(B, 25); - } - -/* -* HAS-160 F4 Function -*/ -inline void F4(u32bit A, u32bit& B, u32bit C, u32bit D, u32bit& E, - u32bit msg, u32bit rot) - { - E += rotate_left(A, rot) + (B ^ C ^ D) + msg + 0x8F1BBCDC; - B = rotate_left(B, 30); - } - -} - -/* -* HAS-160 Compression Function -*/ -void HAS_160::compress_n(const byte input[], size_t blocks) - { - using namespace HAS_160_F; - - u32bit A = m_digest[0], B = m_digest[1], C = m_digest[2], - D = m_digest[3], E = m_digest[4]; - - for(size_t i = 0; i != blocks; ++i) - { - load_le(m_X.data(), input, 16); - - m_X[16] = m_X[ 0] ^ m_X[ 1] ^ m_X[ 2] ^ m_X[ 3]; - m_X[17] = m_X[ 4] ^ m_X[ 5] ^ m_X[ 6] ^ m_X[ 7]; - m_X[18] = m_X[ 8] ^ m_X[ 9] ^ m_X[10] ^ m_X[11]; - m_X[19] = m_X[12] ^ m_X[13] ^ m_X[14] ^ m_X[15]; - F1(A,B,C,D,E,m_X[18], 5); F1(E,A,B,C,D,m_X[ 0],11); - F1(D,E,A,B,C,m_X[ 1], 7); F1(C,D,E,A,B,m_X[ 2],15); - F1(B,C,D,E,A,m_X[ 3], 6); F1(A,B,C,D,E,m_X[19],13); - F1(E,A,B,C,D,m_X[ 4], 8); F1(D,E,A,B,C,m_X[ 5],14); - F1(C,D,E,A,B,m_X[ 6], 7); F1(B,C,D,E,A,m_X[ 7],12); - F1(A,B,C,D,E,m_X[16], 9); F1(E,A,B,C,D,m_X[ 8],11); - F1(D,E,A,B,C,m_X[ 9], 8); F1(C,D,E,A,B,m_X[10],15); - F1(B,C,D,E,A,m_X[11], 6); F1(A,B,C,D,E,m_X[17],12); - F1(E,A,B,C,D,m_X[12], 9); F1(D,E,A,B,C,m_X[13],14); - F1(C,D,E,A,B,m_X[14], 5); F1(B,C,D,E,A,m_X[15],13); - - m_X[16] = m_X[ 3] ^ m_X[ 6] ^ m_X[ 9] ^ m_X[12]; - m_X[17] = m_X[ 2] ^ m_X[ 5] ^ m_X[ 8] ^ m_X[15]; - m_X[18] = m_X[ 1] ^ m_X[ 4] ^ m_X[11] ^ m_X[14]; - m_X[19] = m_X[ 0] ^ m_X[ 7] ^ m_X[10] ^ m_X[13]; - F2(A,B,C,D,E,m_X[18], 5); F2(E,A,B,C,D,m_X[ 3],11); - F2(D,E,A,B,C,m_X[ 6], 7); F2(C,D,E,A,B,m_X[ 9],15); - F2(B,C,D,E,A,m_X[12], 6); F2(A,B,C,D,E,m_X[19],13); - F2(E,A,B,C,D,m_X[15], 8); F2(D,E,A,B,C,m_X[ 2],14); - F2(C,D,E,A,B,m_X[ 5], 7); F2(B,C,D,E,A,m_X[ 8],12); - F2(A,B,C,D,E,m_X[16], 9); F2(E,A,B,C,D,m_X[11],11); - F2(D,E,A,B,C,m_X[14], 8); F2(C,D,E,A,B,m_X[ 1],15); - F2(B,C,D,E,A,m_X[ 4], 6); F2(A,B,C,D,E,m_X[17],12); - F2(E,A,B,C,D,m_X[ 7], 9); F2(D,E,A,B,C,m_X[10],14); - F2(C,D,E,A,B,m_X[13], 5); F2(B,C,D,E,A,m_X[ 0],13); - - m_X[16] = m_X[ 5] ^ m_X[ 7] ^ m_X[12] ^ m_X[14]; - m_X[17] = m_X[ 0] ^ m_X[ 2] ^ m_X[ 9] ^ m_X[11]; - m_X[18] = m_X[ 4] ^ m_X[ 6] ^ m_X[13] ^ m_X[15]; - m_X[19] = m_X[ 1] ^ m_X[ 3] ^ m_X[ 8] ^ m_X[10]; - F3(A,B,C,D,E,m_X[18], 5); F3(E,A,B,C,D,m_X[12],11); - F3(D,E,A,B,C,m_X[ 5], 7); F3(C,D,E,A,B,m_X[14],15); - F3(B,C,D,E,A,m_X[ 7], 6); F3(A,B,C,D,E,m_X[19],13); - F3(E,A,B,C,D,m_X[ 0], 8); F3(D,E,A,B,C,m_X[ 9],14); - F3(C,D,E,A,B,m_X[ 2], 7); F3(B,C,D,E,A,m_X[11],12); - F3(A,B,C,D,E,m_X[16], 9); F3(E,A,B,C,D,m_X[ 4],11); - F3(D,E,A,B,C,m_X[13], 8); F3(C,D,E,A,B,m_X[ 6],15); - F3(B,C,D,E,A,m_X[15], 6); F3(A,B,C,D,E,m_X[17],12); - F3(E,A,B,C,D,m_X[ 8], 9); F3(D,E,A,B,C,m_X[ 1],14); - F3(C,D,E,A,B,m_X[10], 5); F3(B,C,D,E,A,m_X[ 3],13); - - m_X[16] = m_X[ 2] ^ m_X[ 7] ^ m_X[ 8] ^ m_X[13]; - m_X[17] = m_X[ 3] ^ m_X[ 4] ^ m_X[ 9] ^ m_X[14]; - m_X[18] = m_X[ 0] ^ m_X[ 5] ^ m_X[10] ^ m_X[15]; - m_X[19] = m_X[ 1] ^ m_X[ 6] ^ m_X[11] ^ m_X[12]; - F4(A,B,C,D,E,m_X[18], 5); F4(E,A,B,C,D,m_X[ 7],11); - F4(D,E,A,B,C,m_X[ 2], 7); F4(C,D,E,A,B,m_X[13],15); - F4(B,C,D,E,A,m_X[ 8], 6); F4(A,B,C,D,E,m_X[19],13); - F4(E,A,B,C,D,m_X[ 3], 8); F4(D,E,A,B,C,m_X[14],14); - F4(C,D,E,A,B,m_X[ 9], 7); F4(B,C,D,E,A,m_X[ 4],12); - F4(A,B,C,D,E,m_X[16], 9); F4(E,A,B,C,D,m_X[15],11); - F4(D,E,A,B,C,m_X[10], 8); F4(C,D,E,A,B,m_X[ 5],15); - F4(B,C,D,E,A,m_X[ 0], 6); F4(A,B,C,D,E,m_X[17],12); - F4(E,A,B,C,D,m_X[11], 9); F4(D,E,A,B,C,m_X[ 6],14); - F4(C,D,E,A,B,m_X[ 1], 5); F4(B,C,D,E,A,m_X[12],13); - - A = (m_digest[0] += A); - B = (m_digest[1] += B); - C = (m_digest[2] += C); - D = (m_digest[3] += D); - E = (m_digest[4] += E); - - input += hash_block_size(); - } - } - -/* -* Copy out the digest -*/ -void HAS_160::copy_out(byte output[]) - { - copy_out_vec_le(output, output_length(), m_digest); - } - -/* -* Clear memory of sensitive data -*/ -void HAS_160::clear() - { - MDx_HashFunction::clear(); - zeroise(m_X); - m_digest[0] = 0x67452301; - m_digest[1] = 0xEFCDAB89; - m_digest[2] = 0x98BADCFE; - m_digest[3] = 0x10325476; - m_digest[4] = 0xC3D2E1F0; - } - -} diff --git a/src/lib/hash/has160/has160.h b/src/lib/hash/has160/has160.h deleted file mode 100644 index 7ef090eb7..000000000 --- a/src/lib/hash/has160/has160.h +++ /dev/null @@ -1,39 +0,0 @@ -/* -* HAS-160 -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_HAS_160_H__ -#define BOTAN_HAS_160_H__ - -#include - -namespace Botan { - -/** -* HAS-160, a Korean hash function standardized in -* TTAS.KO-12.0011/R1. Used in conjunction with KCDSA -*/ -class BOTAN_DLL HAS_160 final : public MDx_HashFunction - { - public: - std::string name() const override { return "HAS-160"; } - size_t output_length() const override { return 20; } - HashFunction* clone() const override { return new HAS_160; } - - void clear() override; - - HAS_160() : MDx_HashFunction(64, false, true), m_X(20), m_digest(5) - { clear(); } - private: - void compress_n(const byte[], size_t blocks) override; - void copy_out(byte[]) override; - - secure_vector m_X, m_digest; - }; - -} - -#endif diff --git a/src/lib/hash/has160/info.txt b/src/lib/hash/has160/info.txt deleted file mode 100644 index cf403dad5..000000000 --- a/src/lib/hash/has160/info.txt +++ /dev/null @@ -1,5 +0,0 @@ -define HAS_160 20131128 - - -mdx_hash - diff --git a/src/lib/hash/hash.cpp b/src/lib/hash/hash.cpp index 9a15c7998..42a7666b6 100644 --- a/src/lib/hash/hash.cpp +++ b/src/lib/hash/hash.cpp @@ -25,18 +25,10 @@ #include #endif -#if defined(BOTAN_HAS_HAS_160) - #include -#endif - #if defined(BOTAN_HAS_KECCAK) #include #endif -#if defined(BOTAN_HAS_MD2) - #include -#endif - #if defined(BOTAN_HAS_MD4) #include #endif @@ -45,10 +37,6 @@ #include #endif -#if defined(BOTAN_HAS_RIPEMD_128) - #include -#endif - #if defined(BOTAN_HAS_RIPEMD_160) #include #endif @@ -147,18 +135,10 @@ BOTAN_REGISTER_NAMED_T(HashFunction, "Parallel", Parallel, Parallel::make); BOTAN_REGISTER_HASH_NAMED_NOARGS(GOST_34_11, "GOST-R-34.11-94"); #endif -#if defined(BOTAN_HAS_HAS_160) -BOTAN_REGISTER_HASH_NAMED_NOARGS(HAS_160, "HAS-160"); -#endif - #if defined(BOTAN_HAS_KECCAK) BOTAN_REGISTER_HASH_NAMED_1LEN(Keccak_1600, "Keccak-1600", 512); #endif -#if defined(BOTAN_HAS_MD2) -BOTAN_REGISTER_HASH_NOARGS(MD2); -#endif - #if defined(BOTAN_HAS_MD4) BOTAN_REGISTER_HASH_NOARGS(MD4); #endif @@ -167,10 +147,6 @@ BOTAN_REGISTER_HASH_NOARGS(MD4); BOTAN_REGISTER_HASH_NOARGS(MD5); #endif -#if defined(BOTAN_HAS_RIPEMD_128) -BOTAN_REGISTER_HASH_NAMED_NOARGS(RIPEMD_128, "RIPEMD-128"); -#endif - #if defined(BOTAN_HAS_RIPEMD_160) BOTAN_REGISTER_HASH_NAMED_NOARGS(RIPEMD_160, "RIPEMD-160"); #endif diff --git a/src/lib/hash/md2/info.txt b/src/lib/hash/md2/info.txt deleted file mode 100644 index 8ea7dc393..000000000 --- a/src/lib/hash/md2/info.txt +++ /dev/null @@ -1 +0,0 @@ -define MD2 20131128 diff --git a/src/lib/hash/md2/md2.cpp b/src/lib/hash/md2/md2.cpp deleted file mode 100644 index f5e222610..000000000 --- a/src/lib/hash/md2/md2.cpp +++ /dev/null @@ -1,112 +0,0 @@ -/* -* MD2 -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include - -namespace Botan { - -/** -* MD2 Compression Function -*/ -void MD2::hash(const byte input[]) - { - static const byte SBOX[256] = { - 0x29, 0x2E, 0x43, 0xC9, 0xA2, 0xD8, 0x7C, 0x01, 0x3D, 0x36, 0x54, 0xA1, - 0xEC, 0xF0, 0x06, 0x13, 0x62, 0xA7, 0x05, 0xF3, 0xC0, 0xC7, 0x73, 0x8C, - 0x98, 0x93, 0x2B, 0xD9, 0xBC, 0x4C, 0x82, 0xCA, 0x1E, 0x9B, 0x57, 0x3C, - 0xFD, 0xD4, 0xE0, 0x16, 0x67, 0x42, 0x6F, 0x18, 0x8A, 0x17, 0xE5, 0x12, - 0xBE, 0x4E, 0xC4, 0xD6, 0xDA, 0x9E, 0xDE, 0x49, 0xA0, 0xFB, 0xF5, 0x8E, - 0xBB, 0x2F, 0xEE, 0x7A, 0xA9, 0x68, 0x79, 0x91, 0x15, 0xB2, 0x07, 0x3F, - 0x94, 0xC2, 0x10, 0x89, 0x0B, 0x22, 0x5F, 0x21, 0x80, 0x7F, 0x5D, 0x9A, - 0x5A, 0x90, 0x32, 0x27, 0x35, 0x3E, 0xCC, 0xE7, 0xBF, 0xF7, 0x97, 0x03, - 0xFF, 0x19, 0x30, 0xB3, 0x48, 0xA5, 0xB5, 0xD1, 0xD7, 0x5E, 0x92, 0x2A, - 0xAC, 0x56, 0xAA, 0xC6, 0x4F, 0xB8, 0x38, 0xD2, 0x96, 0xA4, 0x7D, 0xB6, - 0x76, 0xFC, 0x6B, 0xE2, 0x9C, 0x74, 0x04, 0xF1, 0x45, 0x9D, 0x70, 0x59, - 0x64, 0x71, 0x87, 0x20, 0x86, 0x5B, 0xCF, 0x65, 0xE6, 0x2D, 0xA8, 0x02, - 0x1B, 0x60, 0x25, 0xAD, 0xAE, 0xB0, 0xB9, 0xF6, 0x1C, 0x46, 0x61, 0x69, - 0x34, 0x40, 0x7E, 0x0F, 0x55, 0x47, 0xA3, 0x23, 0xDD, 0x51, 0xAF, 0x3A, - 0xC3, 0x5C, 0xF9, 0xCE, 0xBA, 0xC5, 0xEA, 0x26, 0x2C, 0x53, 0x0D, 0x6E, - 0x85, 0x28, 0x84, 0x09, 0xD3, 0xDF, 0xCD, 0xF4, 0x41, 0x81, 0x4D, 0x52, - 0x6A, 0xDC, 0x37, 0xC8, 0x6C, 0xC1, 0xAB, 0xFA, 0x24, 0xE1, 0x7B, 0x08, - 0x0C, 0xBD, 0xB1, 0x4A, 0x78, 0x88, 0x95, 0x8B, 0xE3, 0x63, 0xE8, 0x6D, - 0xE9, 0xCB, 0xD5, 0xFE, 0x3B, 0x00, 0x1D, 0x39, 0xF2, 0xEF, 0xB7, 0x0E, - 0x66, 0x58, 0xD0, 0xE4, 0xA6, 0x77, 0x72, 0xF8, 0xEB, 0x75, 0x4B, 0x0A, - 0x31, 0x44, 0x50, 0xB4, 0x8F, 0xED, 0x1F, 0x1A, 0xDB, 0x99, 0x8D, 0x33, - 0x9F, 0x11, 0x83, 0x14 }; - - buffer_insert(m_X, 16, input, hash_block_size()); - xor_buf(&m_X[32], m_X.data(), &m_X[16], hash_block_size()); - byte T = 0; - - for(size_t i = 0; i != 18; ++i) - { - for(size_t k = 0; k != 48; k += 8) - { - T = m_X[k ] ^= SBOX[T]; T = m_X[k+1] ^= SBOX[T]; - T = m_X[k+2] ^= SBOX[T]; T = m_X[k+3] ^= SBOX[T]; - T = m_X[k+4] ^= SBOX[T]; T = m_X[k+5] ^= SBOX[T]; - T = m_X[k+6] ^= SBOX[T]; T = m_X[k+7] ^= SBOX[T]; - } - - T += static_cast(i); - } - - T = m_checksum[15]; - for(size_t i = 0; i != hash_block_size(); ++i) - T = m_checksum[i] ^= SBOX[input[i] ^ T]; - } - -/** -* Update the hash -*/ -void MD2::add_data(const byte input[], size_t length) - { - buffer_insert(m_buffer, m_position, input, length); - - if(m_position + length >= hash_block_size()) - { - hash(m_buffer.data()); - input += (hash_block_size() - m_position); - length -= (hash_block_size() - m_position); - while(length >= hash_block_size()) - { - hash(input); - input += hash_block_size(); - length -= hash_block_size(); - } - copy_mem(m_buffer.data(), input, length); - m_position = 0; - } - m_position += length; - } - -/** -* Finalize a MD2 Hash -*/ -void MD2::final_result(byte output[]) - { - for(size_t i = m_position; i != hash_block_size(); ++i) - m_buffer[i] = static_cast(hash_block_size() - m_position); - - hash(m_buffer.data()); - hash(m_checksum.data()); - copy_mem(output, m_X.data(), output_length()); - clear(); - } - -/** -* Clear memory of sensitive data -*/ -void MD2::clear() - { - zeroise(m_X); - zeroise(m_checksum); - zeroise(m_buffer); - m_position = 0; - } - -} diff --git a/src/lib/hash/md2/md2.h b/src/lib/hash/md2/md2.h deleted file mode 100644 index 58629495a..000000000 --- a/src/lib/hash/md2/md2.h +++ /dev/null @@ -1,41 +0,0 @@ -/* -* MD2 -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_MD2_H__ -#define BOTAN_MD2_H__ - -#include - -namespace Botan { - -/** -* MD2 -*/ -class BOTAN_DLL MD2 final : public HashFunction - { - public: - std::string name() const override { return "MD2"; } - size_t output_length() const override { return 16; } - size_t hash_block_size() const override { return 16; } - HashFunction* clone() const override { return new MD2; } - - void clear() override; - - MD2() : m_X(48), m_checksum(16), m_buffer(16), m_position(0) - { clear(); } - private: - void add_data(const byte[], size_t) override; - void hash(const byte[]); - void final_result(byte[]) override; - - secure_vector m_X, m_checksum, m_buffer; - size_t m_position; - }; - -} - -#endif diff --git a/src/lib/hash/rmd128/info.txt b/src/lib/hash/rmd128/info.txt deleted file mode 100644 index 7d2a4eacd..000000000 --- a/src/lib/hash/rmd128/info.txt +++ /dev/null @@ -1,5 +0,0 @@ -define RIPEMD_128 20131128 - - -mdx_hash - diff --git a/src/lib/hash/rmd128/rmd128.cpp b/src/lib/hash/rmd128/rmd128.cpp deleted file mode 100644 index e520fa0c3..000000000 --- a/src/lib/hash/rmd128/rmd128.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/* -* RIPEMD-128 -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#include - -namespace Botan { - -namespace RIPEMD_128_F { - -/* -* RIPEMD-128 F1 Function -*/ -inline void F1(u32bit& A, u32bit B, u32bit C, u32bit D, - u32bit msg, u32bit shift) - { - A += (B ^ C ^ D) + msg; - A = rotate_left(A, shift); - } - -/* -* RIPEMD-128 F2 Function -*/ -inline void F2(u32bit& A, u32bit B, u32bit C, u32bit D, - u32bit msg, u32bit shift, u32bit magic) - { - A += (D ^ (B & (C ^ D))) + msg + magic; - A = rotate_left(A, shift); - } - -/* -* RIPEMD-128 F3 Function -*/ -inline void F3(u32bit& A, u32bit B, u32bit C, u32bit D, - u32bit msg, u32bit shift, u32bit magic) - { - A += (D ^ (B | ~C)) + msg + magic; - A = rotate_left(A, shift); - } - -/* -* RIPEMD-128 F4 Function -*/ -inline void F4(u32bit& A, u32bit B, u32bit C, u32bit D, - u32bit msg, u32bit shift, u32bit magic) - { - A += (C ^ (D & (B ^ C))) + msg + magic; - A = rotate_left(A, shift); - } - -} - -/* -* RIPEMD-128 Compression Function -*/ -void RIPEMD_128::compress_n(const byte input[], size_t blocks) - { - using namespace RIPEMD_128_F; - - const u32bit MAGIC2 = 0x5A827999, MAGIC3 = 0x6ED9EBA1, - MAGIC4 = 0x8F1BBCDC, MAGIC5 = 0x50A28BE6, - MAGIC6 = 0x5C4DD124, MAGIC7 = 0x6D703EF3; - - for(size_t i = 0; i != blocks; ++i) - { - load_le(m_M.data(), input, m_M.size()); - - u32bit A1 = m_digest[0], A2 = A1, B1 = m_digest[1], B2 = B1, - C1 = m_digest[2], C2 = C1, D1 = m_digest[3], D2 = D1; - - F1(A1,B1,C1,D1,m_M[ 0],11 ); F4(A2,B2,C2,D2,m_M[ 5], 8,MAGIC5); - F1(D1,A1,B1,C1,m_M[ 1],14 ); F4(D2,A2,B2,C2,m_M[14], 9,MAGIC5); - F1(C1,D1,A1,B1,m_M[ 2],15 ); F4(C2,D2,A2,B2,m_M[ 7], 9,MAGIC5); - F1(B1,C1,D1,A1,m_M[ 3],12 ); F4(B2,C2,D2,A2,m_M[ 0],11,MAGIC5); - F1(A1,B1,C1,D1,m_M[ 4], 5 ); F4(A2,B2,C2,D2,m_M[ 9],13,MAGIC5); - F1(D1,A1,B1,C1,m_M[ 5], 8 ); F4(D2,A2,B2,C2,m_M[ 2],15,MAGIC5); - F1(C1,D1,A1,B1,m_M[ 6], 7 ); F4(C2,D2,A2,B2,m_M[11],15,MAGIC5); - F1(B1,C1,D1,A1,m_M[ 7], 9 ); F4(B2,C2,D2,A2,m_M[ 4], 5,MAGIC5); - F1(A1,B1,C1,D1,m_M[ 8],11 ); F4(A2,B2,C2,D2,m_M[13], 7,MAGIC5); - F1(D1,A1,B1,C1,m_M[ 9],13 ); F4(D2,A2,B2,C2,m_M[ 6], 7,MAGIC5); - F1(C1,D1,A1,B1,m_M[10],14 ); F4(C2,D2,A2,B2,m_M[15], 8,MAGIC5); - F1(B1,C1,D1,A1,m_M[11],15 ); F4(B2,C2,D2,A2,m_M[ 8],11,MAGIC5); - F1(A1,B1,C1,D1,m_M[12], 6 ); F4(A2,B2,C2,D2,m_M[ 1],14,MAGIC5); - F1(D1,A1,B1,C1,m_M[13], 7 ); F4(D2,A2,B2,C2,m_M[10],14,MAGIC5); - F1(C1,D1,A1,B1,m_M[14], 9 ); F4(C2,D2,A2,B2,m_M[ 3],12,MAGIC5); - F1(B1,C1,D1,A1,m_M[15], 8 ); F4(B2,C2,D2,A2,m_M[12], 6,MAGIC5); - - F2(A1,B1,C1,D1,m_M[ 7], 7,MAGIC2); F3(A2,B2,C2,D2,m_M[ 6], 9,MAGIC6); - F2(D1,A1,B1,C1,m_M[ 4], 6,MAGIC2); F3(D2,A2,B2,C2,m_M[11],13,MAGIC6); - F2(C1,D1,A1,B1,m_M[13], 8,MAGIC2); F3(C2,D2,A2,B2,m_M[ 3],15,MAGIC6); - F2(B1,C1,D1,A1,m_M[ 1],13,MAGIC2); F3(B2,C2,D2,A2,m_M[ 7], 7,MAGIC6); - F2(A1,B1,C1,D1,m_M[10],11,MAGIC2); F3(A2,B2,C2,D2,m_M[ 0],12,MAGIC6); - F2(D1,A1,B1,C1,m_M[ 6], 9,MAGIC2); F3(D2,A2,B2,C2,m_M[13], 8,MAGIC6); - F2(C1,D1,A1,B1,m_M[15], 7,MAGIC2); F3(C2,D2,A2,B2,m_M[ 5], 9,MAGIC6); - F2(B1,C1,D1,A1,m_M[ 3],15,MAGIC2); F3(B2,C2,D2,A2,m_M[10],11,MAGIC6); - F2(A1,B1,C1,D1,m_M[12], 7,MAGIC2); F3(A2,B2,C2,D2,m_M[14], 7,MAGIC6); - F2(D1,A1,B1,C1,m_M[ 0],12,MAGIC2); F3(D2,A2,B2,C2,m_M[15], 7,MAGIC6); - F2(C1,D1,A1,B1,m_M[ 9],15,MAGIC2); F3(C2,D2,A2,B2,m_M[ 8],12,MAGIC6); - F2(B1,C1,D1,A1,m_M[ 5], 9,MAGIC2); F3(B2,C2,D2,A2,m_M[12], 7,MAGIC6); - F2(A1,B1,C1,D1,m_M[ 2],11,MAGIC2); F3(A2,B2,C2,D2,m_M[ 4], 6,MAGIC6); - F2(D1,A1,B1,C1,m_M[14], 7,MAGIC2); F3(D2,A2,B2,C2,m_M[ 9],15,MAGIC6); - F2(C1,D1,A1,B1,m_M[11],13,MAGIC2); F3(C2,D2,A2,B2,m_M[ 1],13,MAGIC6); - F2(B1,C1,D1,A1,m_M[ 8],12,MAGIC2); F3(B2,C2,D2,A2,m_M[ 2],11,MAGIC6); - - F3(A1,B1,C1,D1,m_M[ 3],11,MAGIC3); F2(A2,B2,C2,D2,m_M[15], 9,MAGIC7); - F3(D1,A1,B1,C1,m_M[10],13,MAGIC3); F2(D2,A2,B2,C2,m_M[ 5], 7,MAGIC7); - F3(C1,D1,A1,B1,m_M[14], 6,MAGIC3); F2(C2,D2,A2,B2,m_M[ 1],15,MAGIC7); - F3(B1,C1,D1,A1,m_M[ 4], 7,MAGIC3); F2(B2,C2,D2,A2,m_M[ 3],11,MAGIC7); - F3(A1,B1,C1,D1,m_M[ 9],14,MAGIC3); F2(A2,B2,C2,D2,m_M[ 7], 8,MAGIC7); - F3(D1,A1,B1,C1,m_M[15], 9,MAGIC3); F2(D2,A2,B2,C2,m_M[14], 6,MAGIC7); - F3(C1,D1,A1,B1,m_M[ 8],13,MAGIC3); F2(C2,D2,A2,B2,m_M[ 6], 6,MAGIC7); - F3(B1,C1,D1,A1,m_M[ 1],15,MAGIC3); F2(B2,C2,D2,A2,m_M[ 9],14,MAGIC7); - F3(A1,B1,C1,D1,m_M[ 2],14,MAGIC3); F2(A2,B2,C2,D2,m_M[11],12,MAGIC7); - F3(D1,A1,B1,C1,m_M[ 7], 8,MAGIC3); F2(D2,A2,B2,C2,m_M[ 8],13,MAGIC7); - F3(C1,D1,A1,B1,m_M[ 0],13,MAGIC3); F2(C2,D2,A2,B2,m_M[12], 5,MAGIC7); - F3(B1,C1,D1,A1,m_M[ 6], 6,MAGIC3); F2(B2,C2,D2,A2,m_M[ 2],14,MAGIC7); - F3(A1,B1,C1,D1,m_M[13], 5,MAGIC3); F2(A2,B2,C2,D2,m_M[10],13,MAGIC7); - F3(D1,A1,B1,C1,m_M[11],12,MAGIC3); F2(D2,A2,B2,C2,m_M[ 0],13,MAGIC7); - F3(C1,D1,A1,B1,m_M[ 5], 7,MAGIC3); F2(C2,D2,A2,B2,m_M[ 4], 7,MAGIC7); - F3(B1,C1,D1,A1,m_M[12], 5,MAGIC3); F2(B2,C2,D2,A2,m_M[13], 5,MAGIC7); - - F4(A1,B1,C1,D1,m_M[ 1],11,MAGIC4); F1(A2,B2,C2,D2,m_M[ 8],15 ); - F4(D1,A1,B1,C1,m_M[ 9],12,MAGIC4); F1(D2,A2,B2,C2,m_M[ 6], 5 ); - F4(C1,D1,A1,B1,m_M[11],14,MAGIC4); F1(C2,D2,A2,B2,m_M[ 4], 8 ); - F4(B1,C1,D1,A1,m_M[10],15,MAGIC4); F1(B2,C2,D2,A2,m_M[ 1],11 ); - F4(A1,B1,C1,D1,m_M[ 0],14,MAGIC4); F1(A2,B2,C2,D2,m_M[ 3],14 ); - F4(D1,A1,B1,C1,m_M[ 8],15,MAGIC4); F1(D2,A2,B2,C2,m_M[11],14 ); - F4(C1,D1,A1,B1,m_M[12], 9,MAGIC4); F1(C2,D2,A2,B2,m_M[15], 6 ); - F4(B1,C1,D1,A1,m_M[ 4], 8,MAGIC4); F1(B2,C2,D2,A2,m_M[ 0],14 ); - F4(A1,B1,C1,D1,m_M[13], 9,MAGIC4); F1(A2,B2,C2,D2,m_M[ 5], 6 ); - F4(D1,A1,B1,C1,m_M[ 3],14,MAGIC4); F1(D2,A2,B2,C2,m_M[12], 9 ); - F4(C1,D1,A1,B1,m_M[ 7], 5,MAGIC4); F1(C2,D2,A2,B2,m_M[ 2],12 ); - F4(B1,C1,D1,A1,m_M[15], 6,MAGIC4); F1(B2,C2,D2,A2,m_M[13], 9 ); - F4(A1,B1,C1,D1,m_M[14], 8,MAGIC4); F1(A2,B2,C2,D2,m_M[ 9],12 ); - F4(D1,A1,B1,C1,m_M[ 5], 6,MAGIC4); F1(D2,A2,B2,C2,m_M[ 7], 5 ); - F4(C1,D1,A1,B1,m_M[ 6], 5,MAGIC4); F1(C2,D2,A2,B2,m_M[10],15 ); - F4(B1,C1,D1,A1,m_M[ 2],12,MAGIC4); F1(B2,C2,D2,A2,m_M[14], 8 ); - - D2 = m_digest[1] + C1 + D2; - m_digest[1] = m_digest[2] + D1 + A2; - m_digest[2] = m_digest[3] + A1 + B2; - m_digest[3] = m_digest[0] + B1 + C2; - m_digest[0] = D2; - - input += hash_block_size(); - } - } - -/* -* Copy out the digest -*/ -void RIPEMD_128::copy_out(byte output[]) - { - copy_out_vec_le(output, output_length(), m_digest); - } - -/* -* Clear memory of sensitive data -*/ -void RIPEMD_128::clear() - { - MDx_HashFunction::clear(); - zeroise(m_M); - m_digest[0] = 0x67452301; - m_digest[1] = 0xEFCDAB89; - m_digest[2] = 0x98BADCFE; - m_digest[3] = 0x10325476; - } - -} diff --git a/src/lib/hash/rmd128/rmd128.h b/src/lib/hash/rmd128/rmd128.h deleted file mode 100644 index ba36ab902..000000000 --- a/src/lib/hash/rmd128/rmd128.h +++ /dev/null @@ -1,38 +0,0 @@ -/* -* RIPEMD-128 -* (C) 1999-2007 Jack Lloyd -* -* Botan is released under the Simplified BSD License (see license.txt) -*/ - -#ifndef BOTAN_RIPEMD_128_H__ -#define BOTAN_RIPEMD_128_H__ - -#include - -namespace Botan { - -/** -* RIPEMD-128 -*/ -class BOTAN_DLL RIPEMD_128 final : public MDx_HashFunction - { - public: - std::string name() const override { return "RIPEMD-128"; } - size_t output_length() const override { return 16; } - HashFunction* clone() const override { return new RIPEMD_128; } - - void clear() override; - - RIPEMD_128() : MDx_HashFunction(64, false, true), m_M(16), m_digest(4) - { clear(); } - private: - void compress_n(const byte[], size_t blocks) override; - void copy_out(byte[]) override; - - secure_vector m_M, m_digest; - }; - -} - -#endif diff --git a/src/lib/pk_pad/hash_id/hash_id.cpp b/src/lib/pk_pad/hash_id/hash_id.cpp index 882c30a4c..2af0f6878 100644 --- a/src/lib/pk_pad/hash_id/hash_id.cpp +++ b/src/lib/pk_pad/hash_id/hash_id.cpp @@ -12,18 +12,10 @@ namespace Botan { namespace { -const byte MD2_PKCS_ID[] = { -0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, -0xF7, 0x0D, 0x02, 0x02, 0x05, 0x00, 0x04, 0x10 }; - const byte MD5_PKCS_ID[] = { 0x30, 0x20, 0x30, 0x0C, 0x06, 0x08, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 }; -const byte RIPEMD_128_PKCS_ID[] = { -0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24, 0x03, 0x02, -0x02, 0x05, 0x00, 0x04, 0x14 }; - const byte RIPEMD_160_PKCS_ID[] = { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2B, 0x24, 0x03, 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 }; @@ -67,18 +59,10 @@ std::vector pkcs_hash_id(const std::string& name) if(name == "Parallel(MD5,SHA-160)") return std::vector(); - if(name == "MD2") - return std::vector(MD2_PKCS_ID, - MD2_PKCS_ID + sizeof(MD2_PKCS_ID)); - if(name == "MD5") return std::vector(MD5_PKCS_ID, MD5_PKCS_ID + sizeof(MD5_PKCS_ID)); - if(name == "RIPEMD-128") - return std::vector(RIPEMD_128_PKCS_ID, - RIPEMD_128_PKCS_ID + sizeof(RIPEMD_128_PKCS_ID)); - if(name == "RIPEMD-160") return std::vector(RIPEMD_160_PKCS_ID, RIPEMD_160_PKCS_ID + sizeof(RIPEMD_160_PKCS_ID)); @@ -127,7 +111,6 @@ byte ieee1363_hash_id(const std::string& name) if(name == "SHA-512") return 0x35; if(name == "RIPEMD-160") return 0x31; - if(name == "RIPEMD-128") return 0x32; if(name == "Whirlpool") return 0x37; diff --git a/src/lib/prov/openssl/openssl_hash.cpp b/src/lib/prov/openssl/openssl_hash.cpp index 574cfed91..c14c551e4 100644 --- a/src/lib/prov/openssl/openssl_hash.cpp +++ b/src/lib/prov/openssl/openssl_hash.cpp @@ -96,10 +96,6 @@ make_evp_hash_maker(const EVP_MD* md, const char* algo) BOTAN_REGISTER_OPENSSL_EVP_HASH("SHA-512", EVP_sha512); #endif -#if !defined(OPENSSL_NO_MD2) - BOTAN_REGISTER_OPENSSL_EVP_HASH("MD2", EVP_md2); -#endif - #if !defined(OPENSSL_NO_MD4) BOTAN_REGISTER_OPENSSL_EVP_HASH("MD4", EVP_md4); #endif diff --git a/src/tests/data/hash/has160.vec b/src/tests/data/hash/has160.vec deleted file mode 100644 index 1ec4fedea..000000000 --- a/src/tests/data/hash/has160.vec +++ /dev/null @@ -1,22 +0,0 @@ -[HAS-160] -In = -Out = 307964EF34151D37C8047ADEC7AB50F4FF89762D - -In = 61 -Out = 4872BCBC4CD0F0A9DC7C2F7045E5B43B6C830DB8 - -In = 616263 -Out = 975E810488CF2A3D49838478124AFCE4B1C78804 - -In = 6D65737361676520646967657374 -Out = 2338DBC8638D31225F73086246BA529F96710BC6 - -In = 6162636465666768696A6B6C6D6E6F707172737475767778797A -Out = 596185C9AB6703D0D0DBB98702BC0F5729CD1D3C - -In = 4142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A30313233343536373839 -Out = CB5D7EFBCA2F02E0FB7167CABB123AF5795764E5 - -In = 3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930 -Out = 07F05C8C0773C55CA3A5A695CE6ACA4C438911B5 - diff --git a/src/tests/data/hash/md2.vec b/src/tests/data/hash/md2.vec deleted file mode 100644 index 1bcd29c27..000000000 --- a/src/tests/data/hash/md2.vec +++ /dev/null @@ -1,226 +0,0 @@ -[MD2] -In = 25 -Out = A248ABDA0C79140E2D99170DAD36CBC8 - -In = 3386 -Out = 43C980AD45E7B3B1CD75CA4E7D9A723D - -In = A0A806 -Out = 0D4596E208051A05DFF8116455562630 - -In = 7664BC7A -Out = E561C90B5534D750BC251EB77A9E7870 - -In = 94A3C94A0C -Out = 2D8026BE7A76954A9E096343C39ECD8C - -In = 2BA359656CCD -Out = 2C549D1C220B32CDFC242874E6807B0B - -In = F62E1519F7C123 -Out = 7D473DB4CBC7B479443BE0F5BA34AB88 - -In = 731E26C302E41557 -Out = DFFFCBFDB186EDFC3174BD6118B9F4AE - -In = E96E54E58C275946D6 -Out = DDD255C1D97FFC23ADA446D630E648D8 - -In = A05EF276F00ADD9AA737 -Out = 7468B835B7FAB5B85E95BCEB563AF71B - -In = B2E29CEBCFE26335B65604 -Out = 96CCB8AEB6DC5B5D0502CA2DD5795197 - -In = 4A926951A34CFF9612086FA1 -Out = CA2A050506C450FDFF20DD7E4EE5339C - -In = 501771E1BB1766FD3FA714BCC1 -Out = FA6F95FB2DAF9E4E153D7D78590EE138 - -In = 07ED7EC95443B759D36E5699547E -Out = 61B549A5FB75E337A194E2FCA382DE25 - -In = 50AD2003A260C982EFECA7D5912BFF -Out = 6BA8E7DDD4019F159FF72514CFA156D9 - -In = 940866DDC4A37CD965DFFBE3E2B0C341 -Out = 6A92E7EB476CB01F9C404494260E3777 - -In = 62F3333A791881457264348DA07FB6B7C4 -Out = 61017AB161754960D3F1D1F1D10FE8F9 - -In = E68EA199397AD1D0C9A76BEB4D96722CBDA2 -Out = B373D1E21455608FCA99654850ECFFD6 - -In = A7A8C48263FC70A6A77374CD0E685773248D26 -Out = 07FF45303EA30885D7AACAAD2E16BD50 - -In = 654C952DA2E3C7998473AFCA3C9AF2AE89B2DE45 -Out = C9444F92EE581185EF649354CA8F4BCE - -In = A4D93A05DF87F08E3113EA2D0CAF8F70CBC2BE4B2A -Out = B46ADB25D38DA1F0E7F6F8C5DD129D40 - -In = EA12AE41BE9B71EBA74C9010C4C884FE5DC9B0C5C65A -Out = B6CFCF8CFDC2FE63CEAA66A5573FDA81 - -In = C3AF0ABC9A2B464A1C4F629908D1EC556F20F64084E733 -Out = 523441B8A2FB07E41E9B1B8CC5276660 - -In = 3C8BCC24A8DC88690F6B6C7CFB25DEF15D37335EC41C8C83 -Out = F80ADCB9C78CF9DE5211091CEC3E310E - -In = 65E2194B8A8B5B30F5C53D01F8431E8C20418EE6A06F89F87F -Out = 5833781CF79E57F605F9D73D3B7088CC - -In = 62FBD128DA286D5C6C5A3E73D463E5B31D7FB06F34DD050B3CDB -Out = 987C1F6BB686F3A983D611C22C5086BA - -In = DDA05271A7C4860D49D2CE62A0B59B11BDCAAF272898EB8E18F1A8 -Out = 779D23550876E50A7C19F4777C84984D - -In = AA8DB1791C56E3C88122A1AB77A9D8BCE0D53240C01B789DE7FCD594 -Out = 9540F40D24417EAD9465B26D8A7746CC - -In = A1C7EAF91BBB251411A86595BC66D4E5CCF227FB2D9913F3EFB4E69B3E -Out = D67F49DE6E7BB44071947A6C96774E02 - -In = 611B90477FDC084652039E3E3F55EB74EE1A3E14BB49A08882AB67EABA73 -Out = C7F8C0C4B53D40634A084A0E388186DC - -In = 5E9F73521E348BFBF3ECC570012AF45C9832F673FFC61CB034908EB91A6672 -Out = 03B6F0BCB2A99CE4CE51D92DBC9ED3B2 - -In = 275C7EC5230978B84D4D87B929EE90C04269B91A32A69BFE2B30E84361CD8905 -Out = 72721B4138FEE747BCB950DD01291C37 - -In = BFC3C421B77FDC497E417DF9A2E8A480CB975BED8E3B90F0BDFC567D66D8747D85 -Out = 92BCE15368AA8388D71E1CC5B4773536 - -In = C2B801C8419027751EF0C9EDBA783BDD703259834E0D28F1CC18BA82A2D9DCDDCD5D -Out = 7B194DE6324A19C54F9AFEB352EF9A8D - -In = 787B37C5C74098B78B693D33E5DD5A12BC2D502D3F69852DCB5CD56D6263E846F96ED4 -Out = F63A8C1958208D999F55917D9A1F3228 - -In = 0614889EFFDC294287D820C8A4459FA44CDD02CB1DE0F678493C959E7DD1DF90257AAF0F -Out = 1E20FBB25E31606B0B22FDFDD2639C71 - -In = 60D169B12C1ECC464591BA572EC74B454D417BBDC49A82F01B9A4FD1273404F6FEBB575E51 -Out = C23B75350BA0174D6A4BD629A8E43311 - -In = 642350615A9C6CBC8894D72176AB2EE4AF3413D15C4D4D9B38D071C95FC620FBAD6AB37FB8E5 -Out = 3D0C91CA852FB8C51AB9441D5A3C1F94 - -In = C6299D1B98BB473500364EC66A3DD9238DCCEA4F281005FF630E99B5C8D2A7AC5FB13C693ED05D -Out = E2B2458ADCFB7D0BCD4789EB9FC0D2CE - -In = 9D5AA26103830005ED7C966E120253DD7ADF49C56BD89B211B6B0D5B491066A52498736122A325F7 -Out = C8F205DEC0103264BEF4FA0501CF007C - -In = 7E038B83083785FDF4696310B579D3C0D98A0092FF2D71808C620225FC54E6973B907E5ED4A50BBD5F -Out = 91F01747135E4E9B18A95666FF4C8801 - -In = CBD41D36CC3F85C7427E3D04DB05E66D32FE7E9683A35B9ABC5B06185E24A867B954DDC4FD41E0379423 -Out = 96110102BF17E3CB91AF30EB0B527851 - -In = 61F01942CFBDCC748AAB816527D49848CF698A8AE5E5EDE8C3C9178EA5719EFBA60EB1C4C3324C6B1AFB2D -Out = 94EBDFBB3060FA8E7FCE7A4538CD6829 - -In = 3E96A6186BD855DF00FCE2693B1394151594448B516DE0B9C8D15396984222497B15EE0DFCD47AFBD8AC3F83 -Out = D39A82F44F8E7D8384938DD8C42C28AA - -In = 9C8CC760D830780DD8671282D6A2909E9D163BC54A04119586404BCBAF5489C79491AB236A4F9781CA58E58408 -Out = 1F902D98C973B382D084FBB40F0920AB - -In = 00A530B70C406BFD533C2642B94FF767EF4C7BCB28EA5CB69C62F52A01AC1A25F1EDD918719004757463E6663340 -Out = C7FA3641EC0626AC66FADE4B77FFC795 - -In = 8DAC93EB30AF1242B93B4C1C8D7D2A8E1320B2738C3D40E623E7380AFE596A783A902B6A19DF17D15356C24CEFBD66 -Out = 437FF6F86D68E35D5BC507AE88C8B0D3 - -In = C3D2DA59D6435405406E342683A324DE6844C527687521E43066270CDF8534C110FEEBD79B5F2FB00FA3B9A31E1D548F -Out = 7B4E56A2014BC8127D6DB1699128310D - -In = D178D2623180FA605C3379B2EF0D5A3272593EE49588708303F5744E8A26DC7F4E3B4435B85A8E68B5ECC40AC7DCB2039F -Out = CEC9CC7590DEAFB05FDA5D42C5CC3A71 - -In = 4B2C6190EBE39D5282026FDB3124D64094108DA1237FFD3A52ACA1BD96FBE752C4C3631C33913BD5DB067AB234C4628B2ED9 -Out = E0CABDA82227CE74EA7550053F942E74 - -In = 9A75285DE0B739BBEC8AF7A791FEF5375A8E722134B6299D6FF167F43BF80F5CCD838F76AC2278C6CA5BE7E5C339ACEB8BF77A -Out = 117451E0A38EA5E87D6817003D9DC6B1 - -In = A2ABD527204652A5DC3C672A1E47F5CA34FB1D7F300580F63B463959991DE6DE1472EB21CAD19D4636C26B0F1FA99CBE6DA4CD70 -Out = EDBEAC9A8676D1BA66949F71B7BE5005 - -In = FB2063EF9B211AB8ACF3D1256DEB4E30D1B6DF1882308FD7F80F27C2141DA8A89551B878410D914C4099DB464738EA337335828434 -Out = 4DF72B07A43EF126FBDEAD01E51ABAAA - -In = 41DEB68691AFCB42C865CF29EC0C2698CE621594ACD0D3443B8D025F6A4547DFD058740A837867A2C1E204CCEB27740C343BDA0AB6B2 -Out = 83A4F9739748D0402BA738757FCC517A - -In = 38C8C56CE471F839B8FD15AB3AF0E1D1A3FA494E7DFE660D5224E1C8D43907E5CBC56CECCCBB44CEC1AFFF26EA7594E33D05789DC49E76 -Out = 07A7A27D722092692035AAF579751495 - -In = 6AAE2909D84B75F7AF3155E85660A1CB224DF40A4EA6CEF0C0F28AD149F3486AC3E837E7283E07803522CCE7000D0213C73B09FE77500852 -Out = C7324E5968CC534F8B98406165C5ACF5 - -In = 9934BAEAF002C98F527AB248B8D44520456FD552409845CF1E666E41151DD3383E5F658DD3AEE63DCBB94BF5ADE141D753B57BDC3BD22D6648 -Out = 985711D04A1636B27B98EFC2DB61A806 - -In = 69C8BB8FB1ADA90D0B9739E62AA1090D12C750945EC15F28D03886BDD1ADCED7169948E085B56996D4537A35F72FEB5313F3B7BB3DEBA66B2B84 -Out = 709578A0AA3DBF9CE4BE69AF71E1AECB - -In = 1EEA19E3548286905BE1092F54EC9E372DBB9950E77EAF7E9C55031232D8D70AC9DEC5D71FACC235EA339B859D54C4D3245F8702D535467E918F86 -Out = 26BC86988B1C278EEEFA648345431254 - -In = 24215B243E36C2EFC561CABA961A170C0EC406344AD712DF5DFF62CB80B4A12C08FC009E4A359306601ADDF31845A88F927BD86566634466BA15E5BA -Out = 2BB96ED578D8C61B39DEA925DCDE859F - -In = 4B6AFF3B20CA5685D3E173AD26E443D38748340B209D63E60F26988AA4C31FEE142783DA23BDE5D322C6AF97599C63183EAAC6B9DBC3611E6C2C32054A -Out = F54BBB34D01EDA10B43753BE8BB9C219 - -In = 26C82DDB40254A854F3FDD1334F1A191101730DCE43972881706FFA4D307D7D9159893252B25732F3976DE9675C7128990D7E321CB023221E2A89BA7E066 -Out = 951FBE39B9172884541297FC8DD4C2BE - -In = F357FE7BE2CFC971379457338EBEB69A40286C9C0FE5DB16888E2E270EAD23BCF7F70031770B08B5C7C4CFF2E49C6BF9844F773B3F84C49C575173C691CAFF -Out = C2AE33C5E43079851FC8D2671F5F4CB9 - -In = F5A11AC76D127223FD9E95B3E743B7EFD13BDE1E502D0E81E33EC85852420EFB353595BB7591E11E3A79FAE079239EE4C87FD141BAE6C6B7019B9A57BB6498E0 -Out = 45F83BFC62EBAFF4EA00678A138D7E7B - -In = CE9C44FA430FCB3BACFF6B384A2A6C2B0617C0737DB20B0B78D86C6F7C341D19801AC2E4400822DAE74DFA40A4468CF5D1081D3290FF35AB4775790E22FAA58BCB -Out = 882D31790CC7FA4B512EF4A00B1F5180 - -In = BE2FBB79CC864E84C625D71F9886DC29F9D5D387BBA4AABC2DF2C8C75FA45C759E192E0EE1A31BCD51618402D8898E8EB937630F6211734AFC590F99AA67BAA0DA69 -Out = 497353E9FFE29110092E859CEC5B366E - -In = 53726A30175CCB0EEE5B91B542E7FFA6EC7C2DD20784563D5D379B0DD5F632060B9B9FB6264AC792830B6555767F91BD0D6808134624E7A2D8901A6BA01F558BE4A549 -Out = 2CADCE7ECC0BC5DF4043C9A3F4F838B7 - -In = -Out = 8350E5A3E24C153DF2275C9F80692773 - -In = 61 -Out = 32EC01EC4A6DAC72C0AB96FB34C0B5D1 - -In = 616263 -Out = DA853B0D3F88D99B30283A69E6DED6BB - -In = 6D65737361676520646967657374 -Out = AB4F496BFB2A530B219FF33031FE06B0 - -In = 6162636465666768696A6B6C6D6E6F707172737475767778797A -Out = 4E8DDFF3650292AB5A4108C3AA47940B - -In = 4142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A30313233343536373839 -Out = DA33DEF2A42DF13975352846C30338CD - -In = 3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930 -Out = D5976F79D83D3A0DC9806C3C66F3EFD8 - -In = 91F1999647F001F7B4D4452CF7C07B64A994EFD25DCDBD9F6B260A77C8855AEB3EE8C65EAEE6397DF26F58A1729BF7A12ACFCF1C4C07A760B829D4158164A57037C15FBFCFFCD85C987C9FB5319AEF44484965425FDEED7D182861A0F3F9BA42BCE7CA288355DF484BC4476B1C587C401BD6196A401A9A99BEC075E8B99CEC15B3E9292F6399F61E00B27837AF4CCCDAAFB235E90282A08C979628E084C66FF24E6E180AB9BE50E274861E174FB511760CB2EB48A2A50D9D70C97B864236BD6AB8C2D9BE95E44FD317FBE6135B800C00E2422068F399F6F9427340AD4ED5CAA1DD96C76EFA688679F577FDBC02624F7D936A199A9CEFBB4F2A9FD15A1A81ABD5703A55FE3911455C8F0BBDB6C6479B24BF8501654DE0593F52713A53929E46FCECBF708ED4EF00768352682B8BF7731F2682991D3CE26497BD4419B6BD67A04907C6A1D84B2B7C2B8C622EAE73AE49D978DEEF8214AACCDFDDBAE1F10D19AB6BB7D38D5BEA2A6141A55BEF2BEFB605FBF01A88BB7294E4952283731BE737EC395B8B537558BE7889CC9C43C855F6CBF4131FB2FA17D72E334F775466F1B9C70A4325DFAFF502D71ECC73E113871EBED295D9FD66EB2F8CCF456075666C9FFC121BFAD286C457AC1191354CD5AFC3F8678CCDC3371B2D86F378182B7F40517FB36DB0194A0D517D9CF235D91001FFE86F7386717B9CDA393C712E3E2628768EA5FB41B1E26B11615B6187E0CE73015FE6811420C1A2CB00D69399C91AE4A21F759B31CCE31CF01F0F9D1E40162130EDE0ADC73B641121F1286FE03619B2768E1FA021311CEDC5B124EDD6B1AAED550CC3AE65E0DDE172F9A8CF136D417C859DA5C1B6F2166810AA46BFBBC2C13B1D23EECA6159CB09D511233A50FCE4DB27E3D35728CA1F35C1A5D538BC4B1F2D95C8B8B424B346FEC0EDBE78D727B9E982EC2DA3CC81238D2317648CCDCEED1C887E97FDAA0E764807F5503FC97A555D99B417185F75F06CCE3646E6C1900A64DAB07881D074FDCB400043275A4D23C5AB64FA7ABA88D225EFA9AA399A7C18640B09D37F189D5B8AE4256D20A50B5BC26DB9DD6B2A81436A098DB8283BC6BC64C07B0F700A2BB0A4440DF1BB4B63197EEEB31039AEA6B2517B54D5B6F93F9432D94E5C6755F4B847635C8E70E7B66A2ACC479B36BEEF513B583CEBBB97310DA9B96111B137E37A3DB5656A1E3C2F7DF8F7A84857FF376F6AB085C80A3A3733D519677805DC1AB9F0278C78A2A55026EB6998761E8F1853EEE64B843B74714CBA56B578766942B241D32000384C9634E09BCC45E80F5CBC32B86C33AF2E96E0602CD081DC9174B33F1506951A560C0141F940E3F2E84133C137F7002F0C7CBD7D86429963C1B5F8BC3996685FDA856C4548F3317904D4EFE606070F783E7BD746537170A9EBE29967C36A2CA8ED8AC08114C24CC860013195 -Out = 3A1237D02204327A5D2CB7CEDF024363 - diff --git a/src/tests/data/hash/parallel.vec b/src/tests/data/hash/parallel.vec index 544ecc0b8..537e4941e 100644 --- a/src/tests/data/hash/parallel.vec +++ b/src/tests/data/hash/parallel.vec @@ -5,9 +5,6 @@ Out = D41D8CD98F00B204E9800998ECF8427EDA39A3EE5E6B4B0D3255BFEF95601890AFD80709 In = 61 Out = 0CC175B9C0F1B6A831C399E26977266186F7E437FAA5A7FCE15D1DDCB9EAEAEA377667B8 -[Parallel(SHA-160,RIPEMD-128,Tiger(24,3))] -In = -Out = DA39A3EE5E6B4B0D3255BFEF95601890AFD80709CDF26213A150DC3ECB610F18F6B38B463293AC630C13F0245F92BBB1766E16167A4E58492DDE73F3 [Parallel(SHA-256,SHA-512)] In = diff --git a/src/tests/data/hash/ripemd128.vec b/src/tests/data/hash/ripemd128.vec deleted file mode 100644 index 526ac26c3..000000000 --- a/src/tests/data/hash/ripemd128.vec +++ /dev/null @@ -1,24 +0,0 @@ -[RIPEMD-128] -In = -Out = CDF26213A150DC3ECB610F18F6B38B46 - -In = 61 -Out = 86BE7AFA339D0FC7CFC785E72F578D33 - -In = 616263 -Out = C14A12199C66E4BA84636B0F69144C77 - -In = 6D65737361676520646967657374 -Out = 9E327B3D6E523062AFC1132D7DF9D1B8 - -In = 6162636465666768696A6B6C6D6E6F707172737475767778797A -Out = FD2AA607F71DC8F510714922B371834E - -In = 6162636462636465636465666465666765666768666768696768696A68696A6B696A6B6C6A6B6C6D6B6C6D6E6C6D6E6F6D6E6F706E6F7071 -Out = A1AA0689D0FAFA2DDC22E88B49133A06 - -In = 4142434445464748494A4B4C4D4E4F505152535455565758595A6162636465666768696A6B6C6D6E6F707172737475767778797A30313233343536373839 -Out = D1E959EB179C911FAEA4624C60C5C702 - -In = 3132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930313233343536373839303132333435363738393031323334353637383930 -Out = 3F45EF194732C2DBB2C4A2C769795FA3 diff --git a/src/tests/data/mac/hmac.vec b/src/tests/data/mac/hmac.vec index 2db21bc3a..8a210f622 100644 --- a/src/tests/data/mac/hmac.vec +++ b/src/tests/data/mac/hmac.vec @@ -1,28 +1,3 @@ -[HMAC(HAS-160)] -Key = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B -In = 4869205468657265 -Out = F5B44115A53F716B6F488DE1098EE7C251418623 - -Key = 4A656665 -In = 7768617420646F2079612077616E7420666F72206E6F7468696E673F -Out = A74547C1EF0AA147C7428AB7E71664549BE2A412 - -Key = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -In = DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD -Out = E4C91BC71782FA44A56BE1A34AAE167E8FFC9734 - -Key = 0102030405060708090A0B0C0D0E0F10111213141516171819 -In = CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD -Out = 14D1055DA875222053BF1180BBEF8892EBA3AC30 - -Key = 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C -In = 546573742057697468205472756E636174696F6E -Out = 124131A293F1FDF3D6B11E2B7F7A1F5B12E42D58 - -Key = A766901C8630F7DB3A3FC2A9747A6E2593452BE7 -In = 54657374205573696E67204C6172676572205468616E20426C6F636B2D53697A65204B6579202D2048617368204B6579204669727374 -Out = 63750D67AF40E3FDE33526545D300972A1527053 - [HMAC(MD5)] Key = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B In = 4869205468657265 @@ -65,23 +40,6 @@ Key = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA In = DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD Out = 125D7342B9AC11CD91A39AF48AA17B4F63F175D3 -[HMAC(RIPEMD-128)] -Key = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B -In = 4869205468657265 -Out = FBF61F9492AA4BBF81C172E84E0734DB - -Key = 0102030405060708090A0B0C0D0E0F10111213141516171819 -In = CDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCDCD -Out = BDBBD7CF03E44B5AA60AF815BE4D2294 - -Key = AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA -In = DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD -Out = 09F0B2846D2F543DA363CBEC8D62A38D - -Key = 0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C0C -In = 546573742057697468205472756E636174696F6E -Out = E79808F24B25FD031C155F0D551D9A3A - [HMAC(RIPEMD-160)] Key = 0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B0B In = 4869205468657265 diff --git a/src/tests/data/pbkdf/pbkdf1.vec b/src/tests/data/pbkdf/pbkdf1.vec index 910225671..ebcad175b 100644 --- a/src/tests/data/pbkdf/pbkdf1.vec +++ b/src/tests/data/pbkdf/pbkdf1.vec @@ -1,28 +1,3 @@ -[PBKDF1(MD2)] -Salt = 40CF117C3865E0CF -Iterations = 1000 -Passphrase = qalzsegt -OutputLen = 16 -Output = 7C1991F3F38A09D70CF3B1ACADB70BC6 - -Salt = 3A2484CE5D3E1B4D -Iterations = 1 -Passphrase = vnhazjfsixbomxqu -OutputLen = 14 -Output = 677500EDA9F0C5E96E0A11F90FB9 - -Salt = 5D838B0F4FA22BFA2157F9083D87F8752E0495BB2113012761EF11B66E87C3CB -Iterations = 15 -Passphrase = fheetneqbdmqqqnyywioqjfloivccquj -OutputLen = 14 -Output = 91A5B689156B441BF27DD2BDD276 - -Salt = F22D341361B47E3390107BD973FDC0D3E0BC02A3 -Iterations = 2 -Passphrase = snbyinjpuikqvxxgrlkf -OutputLen = 14 -Output = 49516935CC9F438BAFA30FF038FB - [PBKDF1(SHA-1)] Salt = 40AC5837560251C275AF5E30A6A3074E57CED38E Iterations = 6 diff --git a/src/tests/data/pubkey/rsa_sig.vec b/src/tests/data/pubkey/rsa_sig.vec index 18a9b55d4..c352d9205 100644 --- a/src/tests/data/pubkey/rsa_sig.vec +++ b/src/tests/data/pubkey/rsa_sig.vec @@ -148,34 +148,6 @@ Q = 1230750235930523558307236321284100548115636187714970826267882300302842003242 Msg = 7072696F6E636F7270 Signature = 3697C05A657A8904C792E750515BCB11751D2D4C4C1460FA6055A10A2C5F2320CFF2D82C0CF086E2E213CF5C4A4BE890F5C0A9F98789710646A500DA83333AE1CC6A24E99167B97B7E7EC06FDC789037DF23F6FD1608695643C7D7C6462A0B37AD926FCA364A826DE539CC89419C99397C7FA1F1CD244B0C7D3C27E77B6A4D4806E749B1291A23F8F3E6873BC8DE349F871530AE11CF4EC42E27B6E3BACAA3DD6A40AE51463EDE39B510E94F0A177328F868C91B5C35F13AF0FEF0AA4AD88B4D -Padding = EMSA2(RIPEMD-128) -E = 65537 -P = 30591693737094154398644675106263504379403477948171972807479302421847529767632977161255649292854912675261964092642711 -Q = 31525024883528724188040731298623782591495821826748348507751579753638841973946458485234899643279818175890294937993923 -Msg = 7072696F6E636F7270 -Signature = 63F9A46002EEDF74A3B21A58AF360C78A0389A6FA469CC6C7F3F37B9298CB666C59CF993CD3EE741C8D6896F61135D2223C3D02B0AE001DF8EC270968F8E999FFD7575F437747E2C0B4181EB3ACFE51ADAD24924D75E86EFA2DF4531FFD1A718 - -Padding = EMSA2(RIPEMD-128) -E = 65537 -P = 11368704817493700936626798101362768879783044260988520494361719476728922843998377669065479558745853594969303776632392636949534709425028326966830332407456469 -Q = 9684487867711295418823781796724517181902035719252962858645278138706345583963475964914903197851100677565676778379867627016873935743015879344315952280921497 -Msg = 7072696F6E636F7270 -Signature = 38CDF4F149F7CAE46ECC24C32F98F30A73DA6B57F0281009493CBCCEE2B902F66DCCCFDEBB1422992BBB4D62030D24FF6674C27163CE4015A3BC899CFE6A01ACC06A7E0CC36754ABFAD8D19F5E7372747557FC9B2F5F8F19563F33AFD0D4E3CAF639657922468457E44032E72E865517E095B728E8ED3169D37B45374E53D692 - -Padding = EMSA2(RIPEMD-128) -E = 65537 -P = 10956194440658320049047729680960152925819370311069301949033136303301068775619599159427539489120149146834377875796551819542266815993042087568426345655131063 -Q = 11986780240363843518427773639089419606869264001112076030161437852470908569084952935419795370924750564016439000250807088636901980967687072395457882311344897 -Msg = 7072696F6E636F7270 -Signature = 9CC6743EA34FB010B0B64975E37CF4C90BEDC063B9CA90F543CCA616C67D16A8EA0883DCAE11FBA595CA8D42F45DA84532E8173149A55196D01E45588FF372A1D95DEBC58353B3892810F43F58A935E85AFF87B46BCB77C6176422E887BA3671F44BD6112DB0E4A56B44BBED76EFDB01B079C43FE9AD593E65162C9FDB92B42A - -Padding = EMSA2(RIPEMD-128) -E = 65537 -P = 1493081647698257945592425302627367854663037689833333929117233432578015307914302171317912605123690754688685850444755947537141942728014076444513969199742840661797737512811613534281996660649365617513329258624026915628665059410835817137 -Q = 1434999624111100962071127937019397971456655559334726656774903057601210861257928542953329948471592610705125168742255043941163545301111407190719456116794170236473765293978010431337821276552432801148592363931604509551245440889306772481 -Msg = 7072696F6E636F7270 -Signature = 3D2E76A438D4B927C4578B27EAAD666CC041D4495A14A462A530BC81AF115D961C4CF840E9B146C83BE619E9D7730ACC4589DC17665CB4B10A19E021BF4E5BD0F7A1CAF720BC4677B809F6E2BD6A15B94590A5DA3F03E83D819B1A429F22D595D2D042468EF602944508915C88480AAE928ABA32B4CC8FB4C7125496623912FCEBFF28D8DB33CAF008AB6B7195019DF8BAC96E23238EA8EC60D1C9527D91EC4018AA23A50B8B3998BB70006EC441334C1301D0A47C160FCE995A14831A737681 - Padding = EMSA2(RIPEMD-160) E = 65537 P = 33925778159875562458694815508122384232436989268432608178008054088773285675555263909583338719156234691017896174716511 @@ -267,13 +239,6 @@ Q = 1300628500736091066469357724169131719350514861299470388096939255066412050709 Msg = 2C88F626457046190AEB16FF2A499DF5820240A5248074445B2D54DDF0C298F57BFF Signature = 0EB5DC0D319B97F56F1C71E381BC26F40012054BB9A597484946955886F83333D21E916D60C3FB667869383CF9AAF6C0A98641ECECCB9F3BD71943696A78609E6324386B2030D2B2DEF1692677E205282617AA40EBAEB48C86B884CF51884BC807BE2D7C83AE3C671DB24E141B76646F0466B0DBFF20362991D465F7A0F7B4324E54092A742E0FE4C66A200AF324706B7D1BDE1C0371AB5FAFD58EBDE5555D24DECF399553C94E45A3E5B3F491BEF76EA9B08C41C2F233F13F83C99D6D88EDAD -Padding = EMSA3(MD2) -E = 65537 -P = 23443439767333138692938389505422341860387525814723848738690073331642118819681 -Q = 23234950162188993388155927630085331316851060055334470382368804331834850828939 -Msg = 45766572796F6E65206765747320467269646179206F66662E -Signature = 05FA6A812FC7DF8BF4F2542509E03E846E11B9C620BE2009EFB440EFBCC669216994AC04F341B57D05202D428FB2A27B5C77DFD9B15BFC3D559353503410C1E1 - Padding = EMSA3(MD5) E = 17 P = 13029564622157791280616891297384459345543528892729268050647908228725108502227809382105716872483480064224030258864846430267698903993578412414816903162894041 -- cgit v1.2.3