From 3a5e91eca26284661fd2294dfc485305e5d5cc3d Mon Sep 17 00:00:00 2001 From: Nicolas Williams Date: Tue, 25 Oct 2022 22:20:45 -0500 Subject: [PATCH] hcrypto: Remove MD2 with prejudice We don't use it anywhere for anything. --- include/hcrypto/Makefile.am | 1 - lib/base/dll.c | 14 +++---- lib/hcrypto/Makefile.am | 3 -- lib/hcrypto/NTMakefile | 2 - lib/hcrypto/engine.h | 2 +- lib/hcrypto/evp-cc.c | 26 ------------ lib/hcrypto/evp-cc.h | 2 - lib/hcrypto/evp-hcrypto.c | 23 ----------- lib/hcrypto/evp-hcrypto.h | 2 - lib/hcrypto/evp-openssl.c | 9 ----- lib/hcrypto/evp-openssl.h | 2 - lib/hcrypto/evp-pkcs11.c | 1 - lib/hcrypto/evp-pkcs11.h | 4 -- lib/hcrypto/evp-w32.c | 1 - lib/hcrypto/evp-w32.h | 2 - lib/hcrypto/evp-wincng.c | 2 - lib/hcrypto/evp-wincng.h | 2 - lib/hcrypto/evp.c | 15 ------- lib/hcrypto/evp.h | 2 - lib/hcrypto/libhcrypto-exports.def | 9 ----- lib/hcrypto/md2.h | 63 ------------------------------ lib/hcrypto/mdtest.c | 30 +------------- lib/hcrypto/test_bulk.c | 3 -- lib/hcrypto/undef.h | 2 - lib/hcrypto/version-script.map | 8 ---- 25 files changed, 9 insertions(+), 221 deletions(-) delete mode 100644 lib/hcrypto/md2.h diff --git a/include/hcrypto/Makefile.am b/include/hcrypto/Makefile.am index f15c779a8..e9a59fd38 100644 --- a/include/hcrypto/Makefile.am +++ b/include/hcrypto/Makefile.am @@ -16,7 +16,6 @@ CLEANFILES = \ evp-hcrypto.h \ evp-cc.h \ hmac.h \ - md2.h \ md4.h \ md5.h \ pkcs12.h \ diff --git a/lib/base/dll.c b/lib/base/dll.c index 59c39137b..53f1f63bc 100644 --- a/lib/base/dll.c +++ b/lib/base/dll.c @@ -83,8 +83,8 @@ struct tls_values { static HEIMDAL_THREAD_LOCAL struct tls_values values; -static char dead_key; -#define DEAD_KEY ((void *)&dead_key) +static char dead_key[1]; +static void no_dtor(void *d) { (void)d; } void heim_w32_service_thread_detach(void *unused) @@ -112,7 +112,7 @@ heim_w32_service_thread_detach(void *unused) assert(i < key_defs->keys_start_idx + key_defs->keys_num); } dtor = key_defs->keys_dtors[i - key_defs->keys_start_idx]; - if (values.values[i] != NULL && dtor != NULL && dtor != DEAD_KEY) + if (values.values[i] != NULL && dtor != NULL && dtor != no_dtor) dtor(values.values[i]); values.values[i] = NULL; } @@ -151,7 +151,7 @@ heim_w32_key_create(HEIM_PRIV_thread_key *key, void (*dtor)(void *)) #if !defined(WIN32) (void) pthread_once(&pt_once, create_pt_key); - (void) pthread_setspecific(pt_key, DEAD_KEY); + (void) pthread_setspecific(pt_key, dead_key); #endif HEIMDAL_MUTEX_lock(&tls_key_defs_lock); @@ -267,7 +267,7 @@ heim_w32_delete_key(HEIM_PRIV_thread_key key) key_lookup(key, &key_defs, &dtor_idx, NULL); if (key_defs == NULL) return EINVAL; - key_defs->keys_dtors[dtor_idx] = DEAD_KEY; + key_defs->keys_dtors[dtor_idx] = no_dtor; return 0; } @@ -280,7 +280,7 @@ heim_w32_setspecific(HEIM_PRIV_thread_key key, void *value) size_t i; #if !defined(WIN32) - (void) pthread_setspecific(pt_key, DEAD_KEY); + (void) pthread_setspecific(pt_key, dead_key); #endif key_lookup(key, NULL, NULL, &dtor); @@ -305,7 +305,7 @@ heim_w32_setspecific(HEIM_PRIV_thread_key key, void *value) assert(key < values.values_num); - if (values.values[key] != NULL && dtor != NULL && dtor != DEAD_KEY) + if (values.values[key] != NULL && dtor != NULL && dtor != no_dtor) dtor(values.values[key]); values.values[key] = value; diff --git a/lib/hcrypto/Makefile.am b/lib/hcrypto/Makefile.am index bb36f7451..2b9b610c6 100644 --- a/lib/hcrypto/Makefile.am +++ b/lib/hcrypto/Makefile.am @@ -51,7 +51,6 @@ hcryptoinclude_HEADERS = \ evp-openssl.h \ evp-pkcs11.h \ hmac.h \ - md2.h \ md4.h \ md5.h \ pkcs12.h \ @@ -160,8 +159,6 @@ libhcrypto_la_SOURCES = \ hash.h \ hmac.c \ hmac.h \ - md2.c \ - md2.h \ md4.c \ md4.h \ md5.c \ diff --git a/lib/hcrypto/NTMakefile b/lib/hcrypto/NTMakefile index ec945009b..e3e50a7d5 100644 --- a/lib/hcrypto/NTMakefile +++ b/lib/hcrypto/NTMakefile @@ -76,7 +76,6 @@ INCFILES= \ $(HCRYPTOINCLUDEDIR)\evp-wincng.h \ $(HCRYPTOINCLUDEDIR)\evp-w32.h \ $(HCRYPTOINCLUDEDIR)\hmac.h \ - $(HCRYPTOINCLUDEDIR)\md2.h \ $(HCRYPTOINCLUDEDIR)\md4.h \ $(HCRYPTOINCLUDEDIR)\md5.h \ $(HCRYPTOINCLUDEDIR)\pkcs12.h \ @@ -124,7 +123,6 @@ libhcrypto_OBJs = \ $(OBJ)\evp-w32.obj \ $(OBJ)\engine.obj \ $(OBJ)\hmac.obj \ - $(OBJ)\md2.obj \ $(OBJ)\md4.obj \ $(OBJ)\md5.obj \ $(OBJ)\pkcs5.obj \ diff --git a/lib/hcrypto/engine.h b/lib/hcrypto/engine.h index e6fc5b92e..27c6ab6af 100644 --- a/lib/hcrypto/engine.h +++ b/lib/hcrypto/engine.h @@ -70,7 +70,7 @@ typedef struct hc_engine ENGINE; -#define NID_md2 0 +/*#define NID_md2 0 */ #define NID_md4 1 #define NID_md5 2 #define NID_sha1 4 diff --git a/lib/hcrypto/evp-cc.c b/lib/hcrypto/evp-cc.c index 4a377f1c3..7798519da 100644 --- a/lib/hcrypto/evp-cc.c +++ b/lib/hcrypto/evp-cc.c @@ -605,32 +605,6 @@ EVP_cc_rc2_64_cbc(void) #endif } -/** - * The CommonCrypto md2 provider - * - * @ingroup hcrypto_evp - */ - -const EVP_MD * -EVP_cc_md2(void) -{ -#ifdef HAVE_COMMONCRYPTO_COMMONDIGEST_H - static const struct hc_evp_md md2 = { - CC_MD2_DIGEST_LENGTH, - CC_MD2_BLOCK_BYTES, - sizeof(CC_MD2_CTX), - (hc_evp_md_init)CC_MD2_Init, - (hc_evp_md_update)CC_MD2_Update, - (hc_evp_md_final)CC_MD2_Final, - (hc_evp_md_cleanup)NULL - }; - return &md2; -#elif HCRYPTO_FALLBACK - return EVP_hcrypto_md2(); -#else - return NULL; -#endif -} /** * The CommonCrypto md4 provider diff --git a/lib/hcrypto/evp-cc.h b/lib/hcrypto/evp-cc.h index 4d131de01..f8576459a 100644 --- a/lib/hcrypto/evp-cc.h +++ b/lib/hcrypto/evp-cc.h @@ -37,7 +37,6 @@ #define HEIM_EVP_CC_H 1 /* symbol renaming */ -#define EVP_cc_md2 hc_EVP_cc_md2 #define EVP_cc_md4 hc_EVP_cc_md4 #define EVP_cc_md5 hc_EVP_cc_md5 #define EVP_cc_sha1 hc_EVP_cc_sha1 @@ -67,7 +66,6 @@ HC_CPP_BEGIN -const EVP_MD * EVP_cc_md2(void); const EVP_MD * EVP_cc_md4(void); const EVP_MD * EVP_cc_md5(void); const EVP_MD * EVP_cc_sha1(void); diff --git a/lib/hcrypto/evp-hcrypto.c b/lib/hcrypto/evp-hcrypto.c index 321efb08c..ee43e105a 100644 --- a/lib/hcrypto/evp-hcrypto.c +++ b/lib/hcrypto/evp-hcrypto.c @@ -51,7 +51,6 @@ #include #include -#include #include #include @@ -401,28 +400,6 @@ EVP_hcrypto_md4(void) return &md4; } -/** - * The message digest MD2 - hcrypto - * - * @return the message digest type. - * - * @ingroup hcrypto_evp - */ - -const EVP_MD * -EVP_hcrypto_md2(void) -{ - static const struct hc_evp_md md2 = { - 16, - 16, - sizeof(MD2_CTX), - (hc_evp_md_init)MD2_Init, - (hc_evp_md_update)MD2_Update, - (hc_evp_md_final)MD2_Final, - NULL - }; - return &md2; -} /* * diff --git a/lib/hcrypto/evp-hcrypto.h b/lib/hcrypto/evp-hcrypto.h index b7876c67c..6d4f1c872 100644 --- a/lib/hcrypto/evp-hcrypto.h +++ b/lib/hcrypto/evp-hcrypto.h @@ -37,7 +37,6 @@ #define HEIM_EVP_HCRYPTO_H 1 /* symbol renaming */ -#define EVP_hcrypto_md2 hc_EVP_hcrypto_md2 #define EVP_hcrypto_md4 hc_EVP_hcrypto_md4 #define EVP_hcrypto_md5 hc_EVP_hcrypto_md5 #define EVP_hcrypto_sha1 hc_EVP_hcrypto_sha1 @@ -67,7 +66,6 @@ HC_CPP_BEGIN -const EVP_MD * EVP_hcrypto_md2(void); const EVP_MD * EVP_hcrypto_md4(void); const EVP_MD * EVP_hcrypto_md5(void); const EVP_MD * EVP_hcrypto_sha1(void); diff --git a/lib/hcrypto/evp-openssl.c b/lib/hcrypto/evp-openssl.c index ca02862bf..179b385b7 100644 --- a/lib/hcrypto/evp-openssl.c +++ b/lib/hcrypto/evp-openssl.c @@ -580,15 +580,6 @@ OSSL_CIPHER_ALGORITHM(rc4_40, hc_EVP_CIPH_STREAM_CIPHER | hc_EVP_CIPH_VARIABLE_LENGTH) -/** - * The MD2 hash algorithm (OpenSSL provider) - * - * @return the MD2 EVP_MD pointer. - * - * @ingroup hcrypto_evp - */ -OSSL_MD_ALGORITHM(md2) - /** * The MD4 hash algorithm (OpenSSL provider) * diff --git a/lib/hcrypto/evp-openssl.h b/lib/hcrypto/evp-openssl.h index 225ff454a..ff285adee 100644 --- a/lib/hcrypto/evp-openssl.h +++ b/lib/hcrypto/evp-openssl.h @@ -37,7 +37,6 @@ #define HEIM_EVP_OSSL_H 1 /* symbol renaming */ -#define EVP_ossl_md2 hc_EVP_ossl_md2 #define EVP_ossl_md4 hc_EVP_ossl_md4 #define EVP_ossl_md5 hc_EVP_ossl_md5 #define EVP_ossl_sha1 hc_EVP_ossl_sha1 @@ -67,7 +66,6 @@ HC_CPP_BEGIN -const hc_EVP_MD * hc_EVP_ossl_md2(void); const hc_EVP_MD * hc_EVP_ossl_md4(void); const hc_EVP_MD * hc_EVP_ossl_md5(void); const hc_EVP_MD * hc_EVP_ossl_sha1(void); diff --git a/lib/hcrypto/evp-pkcs11.c b/lib/hcrypto/evp-pkcs11.c index b44871fa4..90e2b91be 100644 --- a/lib/hcrypto/evp-pkcs11.c +++ b/lib/hcrypto/evp-pkcs11.c @@ -819,7 +819,6 @@ PKCS11_CIPHER_ALGORITHM(rc4_40, 0, EVP_CIPH_STREAM_CIPHER | EVP_CIPH_VARIABLE_LENGTH) -PKCS11_MD_ALGORITHM(md2, CKM_MD2, 16, 16) #ifdef CKM_MD4 /* non-standard extension */ PKCS11_MD_ALGORITHM(md4, CKM_MD4, 16, 64) #else diff --git a/lib/hcrypto/evp-pkcs11.h b/lib/hcrypto/evp-pkcs11.h index 6d8a21f52..49d020a2f 100644 --- a/lib/hcrypto/evp-pkcs11.h +++ b/lib/hcrypto/evp-pkcs11.h @@ -35,7 +35,6 @@ /* symbol renaming */ -#define EVP_pkcs11_md2() hc_EVP_pkcs11_md2() #define EVP_pkcs11_md4() hc_EVP_pkcs11_md4() #define EVP_pkcs11_md5() hc_EVP_pkcs11_md5() #define EVP_pkcs11_sha1() hc_EVP_pkcs11_sha1() @@ -59,7 +58,6 @@ #define EVP_pkcs11_camellia_192_cbc() hc_EVP_pkcs11_camellia_192_cbc() #define EVP_pkcs11_camellia_256_cbc() hc_EVP_pkcs11_camellia_256_cbc() -#define EVP_pkcs11_hcrypto_md2() hc_EVP_pkcs11_hcrypto_md2() #define EVP_pkcs11_hcrypto_md4() hc_EVP_pkcs11_hcrypto_md4() #define EVP_pkcs11_hcrypto_md5() hc_EVP_pkcs11_hcrypto_md5() #define EVP_pkcs11_hcrypto_sha1() hc_EVP_pkcs11_hcrypto_sha1() @@ -89,7 +87,6 @@ HC_CPP_BEGIN * Strict PKCS#11 implementations (these will return NULL if the underlying * PKCS#11 implementation does not implement the cipher or hash). */ -const EVP_MD * hc_EVP_pkcs11_md2(void); const EVP_MD * hc_EVP_pkcs11_md4(void); const EVP_MD * hc_EVP_pkcs11_md5(void); const EVP_MD * hc_EVP_pkcs11_sha1(void); @@ -122,7 +119,6 @@ const EVP_CIPHER * hc_EVP_pkcs11_camellia_256_cbc(void); /* * PKCS#11 implementations with fallback to hcrypto. */ -const EVP_MD * hc_EVP_pkcs11_hcrypto_md2(void); const EVP_MD * hc_EVP_pkcs11_hcrypto_md4(void); const EVP_MD * hc_EVP_pkcs11_hcrypto_md5(void); const EVP_MD * hc_EVP_pkcs11_hcrypto_sha1(void); diff --git a/lib/hcrypto/evp-w32.c b/lib/hcrypto/evp-w32.c index 7d14d1f4f..ac2c6a53e 100644 --- a/lib/hcrypto/evp-w32.c +++ b/lib/hcrypto/evp-w32.c @@ -109,7 +109,6 @@ _hc_w32crypto_DllMain(HINSTANCE hinstDLL, return hc_EVP_hcrypto_ ##name (); \ } -EVP_W32CRYPTO_PROVIDER(EVP_MD, md2) EVP_W32CRYPTO_PROVIDER(EVP_MD, md4) EVP_W32CRYPTO_PROVIDER(EVP_MD, md5) EVP_W32CRYPTO_PROVIDER(EVP_MD, sha1) diff --git a/lib/hcrypto/evp-w32.h b/lib/hcrypto/evp-w32.h index 89bfa4d0a..6d3ba4596 100644 --- a/lib/hcrypto/evp-w32.h +++ b/lib/hcrypto/evp-w32.h @@ -34,7 +34,6 @@ #define HEIM_EVP_W32_H 1 /* symbol renaming */ -#define EVP_w32crypto_md2() hc_EVP_w32crypto_md2() #define EVP_w32crypto_md4() hc_EVP_w32crypto_md4() #define EVP_w32crypto_md5() hc_EVP_w32crypto_md5() #define EVP_w32crypto_sha1() hc_EVP_w32crypto_sha1() @@ -65,7 +64,6 @@ HC_CPP_BEGIN -const EVP_MD * hc_EVP_w32crypto_md2(void); const EVP_MD * hc_EVP_w32crypto_md4(void); const EVP_MD * hc_EVP_w32crypto_md5(void); const EVP_MD * hc_EVP_w32crypto_sha1(void); diff --git a/lib/hcrypto/evp-wincng.c b/lib/hcrypto/evp-wincng.c index 92974a91b..34ac3b324 100644 --- a/lib/hcrypto/evp-wincng.c +++ b/lib/hcrypto/evp-wincng.c @@ -700,7 +700,6 @@ wincng_md_cleanup(EVP_MD_CTX *ctx) } \ } while (0) -WINCNG_MD_ALGORITHM(md2, BCRYPT_MD2_ALGORITHM); WINCNG_MD_ALGORITHM(md4, BCRYPT_MD4_ALGORITHM); WINCNG_MD_ALGORITHM(md5, BCRYPT_MD5_ALGORITHM); WINCNG_MD_ALGORITHM(sha1, BCRYPT_SHA1_ALGORITHM); @@ -711,7 +710,6 @@ WINCNG_MD_ALGORITHM(sha512, BCRYPT_SHA512_ALGORITHM); static void wincng_md_algorithm_cleanup(void) { - WINCNG_MD_ALGORITHM_CLEANUP(md2); WINCNG_MD_ALGORITHM_CLEANUP(md4); WINCNG_MD_ALGORITHM_CLEANUP(md5); WINCNG_MD_ALGORITHM_CLEANUP(sha1); diff --git a/lib/hcrypto/evp-wincng.h b/lib/hcrypto/evp-wincng.h index ed7037a11..88d98303e 100644 --- a/lib/hcrypto/evp-wincng.h +++ b/lib/hcrypto/evp-wincng.h @@ -34,7 +34,6 @@ #define HEIM_EVP_WINCNG_H 1 /* symbol renaming */ -#define EVP_wincng_md2() EVP_wincng_md2() #define EVP_wincng_md4() EVP_wincng_md4() #define EVP_wincng_md5() EVP_wincng_md5() #define EVP_wincng_sha1() EVP_wincng_sha1() @@ -64,7 +63,6 @@ HC_CPP_BEGIN -const EVP_MD * hc_EVP_wincng_md2(void); const EVP_MD * hc_EVP_wincng_md4(void); const EVP_MD * hc_EVP_wincng_md5(void); const EVP_MD * hc_EVP_wincng_sha1(void); diff --git a/lib/hcrypto/evp.c b/lib/hcrypto/evp.c index 320e85283..dae1f809c 100644 --- a/lib/hcrypto/evp.c +++ b/lib/hcrypto/evp.c @@ -466,21 +466,6 @@ EVP_md4(void) HC_DEPRECATED_CRYPTO return EVP_DEF_OP(HCRYPTO_DEF_PROVIDER, md4); } -/** - * The message digest MD2 - * - * @return the message digest type. - * - * @ingroup hcrypto_evp - */ - -const EVP_MD * -EVP_md2(void) HC_DEPRECATED_CRYPTO -{ - hcrypto_validate(); - return EVP_DEF_OP(HCRYPTO_DEF_PROVIDER, md2); -} - /* * */ diff --git a/lib/hcrypto/evp.h b/lib/hcrypto/evp.h index 8893362db..820c500f4 100644 --- a/lib/hcrypto/evp.h +++ b/lib/hcrypto/evp.h @@ -81,7 +81,6 @@ #define EVP_des_cbc hc_EVP_des_cbc #define EVP_des_ede3_cbc hc_EVP_des_ede3_cbc #define EVP_enc_null hc_EVP_enc_null -#define EVP_md2 hc_EVP_md2 #define EVP_md4 hc_EVP_md4 #define EVP_md5 hc_EVP_md5 #define EVP_md_null hc_EVP_md_null @@ -250,7 +249,6 @@ HC_CPP_BEGIN */ const EVP_MD *EVP_md_null(void); -HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md2(void); HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md4(void); HC_DEPRECATED_CRYPTO const EVP_MD *EVP_md5(void); const EVP_MD *EVP_sha(void); diff --git a/lib/hcrypto/libhcrypto-exports.def b/lib/hcrypto/libhcrypto-exports.def index 9ce708258..b1e2d34b1 100644 --- a/lib/hcrypto/libhcrypto-exports.def +++ b/lib/hcrypto/libhcrypto-exports.def @@ -147,7 +147,6 @@ EXPORTS hc_EVP_camellia_256_cbc hc_EVP_enc_null hc_EVP_get_cipherbyname - hc_EVP_md2 hc_EVP_md4 hc_EVP_md5 hc_EVP_md_null @@ -162,7 +161,6 @@ EXPORTS hc_EVP_sha384 hc_EVP_sha512 -;! hc_EVP_cc_md2 ;! hc_EVP_cc_md4 ;! hc_EVP_cc_md5 ;! hc_EVP_cc_sha1 @@ -177,7 +175,6 @@ EXPORTS ;! hc_EVP_cc_aes_192_cfb8 ;! hc_EVP_cc_aes_256_cfb8 - hc_EVP_ossl_md2 hc_EVP_ossl_md4 hc_EVP_ossl_md5 hc_EVP_ossl_sha1 @@ -196,7 +193,6 @@ EXPORTS hc_EVP_ossl_rc4 hc_EVP_ossl_rc4_40 - hc_EVP_pkcs11_md2 hc_EVP_pkcs11_md4 hc_EVP_pkcs11_md5 hc_EVP_pkcs11_sha1 @@ -214,7 +210,6 @@ EXPORTS hc_EVP_pkcs11_rc4 hc_EVP_pkcs11_rc4_40 - hc_EVP_w32crypto_md2 ;! hc_EVP_w32crypto_md4 ;! hc_EVP_w32crypto_md5 ;! hc_EVP_w32crypto_sha1 ;! @@ -234,7 +229,6 @@ EXPORTS hc_EVP_w32crypto_aes_192_cfb8 ;! hc_EVP_w32crypto_aes_256_cfb8 ;! - hc_EVP_hcrypto_md2 hc_EVP_hcrypto_md4 hc_EVP_hcrypto_md5 hc_EVP_hcrypto_sha1 @@ -265,9 +259,6 @@ EXPORTS hc_HMAC_Init_ex hc_HMAC_Update hc_HMAC_size - hc_MD2_Final - hc_MD2_Init - hc_MD2_Update hc_MD4_Final hc_MD4_Init hc_MD4_Update diff --git a/lib/hcrypto/md2.h b/lib/hcrypto/md2.h deleted file mode 100644 index d82334eac..000000000 --- a/lib/hcrypto/md2.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (c) 2006 Kungliga Tekniska Högskolan - * (Royal Institute of Technology, Stockholm, Sweden). - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. Neither the name of the Institute nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -/* $Id$ */ - -#ifndef HEIM_MD2_H -#define HEIM_MD2_H 1 - -/* symbol renaming */ -#define MD2_Init hc_MD2_Init -#define MD2_Update hc_MD2_Update -#define MD2_Final hc_MD2_Final - -/* - * - */ - -#define MD2_DIGEST_LENGTH 16 - -struct md2 { - size_t len; - unsigned char data[16]; /* stored unalligned data between Update's */ - unsigned char checksum[16]; - unsigned char state[16]; /* lower 16 bytes of X */ -}; - -typedef struct md2 MD2_CTX; - -int MD2_Init (struct md2 *m); -int MD2_Update (struct md2 *m, const void *p, size_t len); -int MD2_Final (void *res, struct md2 *m); - -#endif /* HEIM_MD2_H */ diff --git a/lib/hcrypto/mdtest.c b/lib/hcrypto/mdtest.c index bf151355a..7ad93e356 100644 --- a/lib/hcrypto/mdtest.c +++ b/lib/hcrypto/mdtest.c @@ -39,7 +39,6 @@ #ifdef KRB5 #include #endif -#include #include #include #include @@ -55,15 +54,7 @@ struct hash_foo { int (*update)(void*, const void*, size_t); int (*final)(void*, void*); const EVP_MD * (*evp)(void); -} md2 = { - "MD2", - sizeof(MD2_CTX), - 16, - (void (*)(void*))MD2_Init, - (void (*)(void*,const void*, size_t))MD2_Update, - (void (*)(void*, void*))MD2_Final, - EVP_md2 -}, md4 = { +} md4 = { "MD4", sizeof(MD4_CTX), 16, @@ -121,24 +112,6 @@ struct test { unsigned char hash[64]; }; -struct test md2_tests[] = { - {"", - "\x83\x50\xe5\xa3\xe2\x4c\x15\x3d\xf2\x27\x5c\x9f\x80\x69\x27\x73" }, - {"a", - "\x32\xec\x01\xec\x4a\x6d\xac\x72\xc0\xab\x96\xfb\x34\xc0\xb5\xd1" }, - {"abc", - "\xda\x85\x3b\x0d\x3f\x88\xd9\x9b\x30\x28\x3a\x69\xe6\xde\xd6\xbb" }, - {"message digest", - "\xab\x4f\x49\x6b\xfb\x2a\x53\x0b\x21\x9f\xf3\x30\x31\xfe\x06\xb0" }, - {"abcdefghijklmnopqrstuvwxyz", - "\x4e\x8d\xdf\xf3\x65\x02\x92\xab\x5a\x41\x08\xc3\xaa\x47\x94\x0b" }, - {"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", - "\xda\x33\xde\xf2\xa4\x2d\xf1\x39\x75\x35\x28\x46\xc3\x03\x38\xcd" }, - {"12345678901234567890123456789012345678901234567890123456789012345678901234567890", - "\xd5\x97\x6f\x79\xd8\x3d\x3a\x0d\xc9\x80\x6c\x3c\x66\xf3\xef\xd8" }, - {NULL, { 0 } } -}; - struct test md4_tests[] = { {"", {0x31, 0xd6, 0xcf, 0xe0, 0xd1, 0x6a, 0xe9, 0x31, 0xb7, 0x3c, 0x59, @@ -338,7 +311,6 @@ int main (void) { return - hash_test(&md2, md2_tests) + hash_test(&md4, md4_tests) + hash_test(&md5, md5_tests) + hash_test(&sha1, sha1_tests) + diff --git a/lib/hcrypto/test_bulk.c b/lib/hcrypto/test_bulk.c index e3737fd1e..db5aeae1e 100644 --- a/lib/hcrypto/test_bulk.c +++ b/lib/hcrypto/test_bulk.c @@ -201,7 +201,6 @@ test_bulk_provider_hcrypto(void) test_bulk_cipher("hcrypto_aes_256_cfb8", EVP_hcrypto_aes_256_cfb8()); #endif test_bulk_cipher("hcrypto_rc4", EVP_hcrypto_rc4()); - test_bulk_digest("hcrypto_md2", EVP_hcrypto_md2()); test_bulk_digest("hcrypto_md4", EVP_hcrypto_md4()); test_bulk_digest("hcrypto_md5", EVP_hcrypto_md5()); test_bulk_digest("hcrypto_sha1", EVP_hcrypto_sha1()); @@ -219,7 +218,6 @@ test_bulk_provider_cc(void) test_bulk_cipher("cc_aes_256_cfb8", EVP_cc_aes_256_cfb8()); #endif test_bulk_cipher("cc_rc4", EVP_cc_rc4()); - test_bulk_digest("cc_md2", EVP_cc_md2()); test_bulk_digest("cc_md4", EVP_cc_md4()); test_bulk_digest("cc_md5", EVP_cc_md5()); test_bulk_digest("cc_sha1", EVP_cc_sha1()); @@ -238,7 +236,6 @@ test_bulk_provider_w32crypto(void) test_bulk_cipher("w32crypto_aes_256_cfb8", EVP_w32crypto_aes_256_cfb8()); #endif test_bulk_cipher("w32crypto_rc4", EVP_w32crypto_rc4()); - test_bulk_digest("w32crypto_md2", EVP_w32crypto_md2()); test_bulk_digest("w32crypto_md4", EVP_w32crypto_md4()); test_bulk_digest("w32crypto_md5", EVP_w32crypto_md5()); test_bulk_digest("w32crypto_sha1", EVP_w32crypto_sha1()); diff --git a/lib/hcrypto/undef.h b/lib/hcrypto/undef.h index 512b8c3f0..6de5734a2 100644 --- a/lib/hcrypto/undef.h +++ b/lib/hcrypto/undef.h @@ -116,7 +116,6 @@ #undef EVP_des_cbc #undef EVP_des_ede3_cbc #undef EVP_enc_null -#undef EVP_md2 #undef EVP_md4 #undef EVP_md5 #undef EVP_md_null @@ -158,7 +157,6 @@ #undef EVP_CIPH_ALWAYS_CALL_INIT #undef EVP_CIPH_RAND_KEY #undef EVP_CTRL_RAND_KEY -#undef NID_md2 #undef NID_md4 #undef NID_md5 #undef NID_sha1 diff --git a/lib/hcrypto/version-script.map b/lib/hcrypto/version-script.map index fbd8141db..b51d4bb60 100644 --- a/lib/hcrypto/version-script.map +++ b/lib/hcrypto/version-script.map @@ -154,7 +154,6 @@ HEIMDAL_CRYPTO_1.0 { hc_EVP_camellia_256_cbc; hc_EVP_enc_null; hc_EVP_get_cipherbyname; - hc_EVP_md2; hc_EVP_md4; hc_EVP_md5; hc_EVP_md_null; @@ -169,7 +168,6 @@ HEIMDAL_CRYPTO_1.0 { hc_EVP_sha384; hc_EVP_sha512; - hc_EVP_cc_md2; hc_EVP_cc_md4; hc_EVP_cc_md5; hc_EVP_cc_sha1; @@ -184,7 +182,6 @@ HEIMDAL_CRYPTO_1.0 { hc_EVP_cc_aes_192_cfb8; hc_EVP_cc_aes_256_cfb8; - hc_EVP_hcrypto_md2; hc_EVP_hcrypto_md4; hc_EVP_hcrypto_md5; hc_EVP_hcrypto_sha1; @@ -201,7 +198,6 @@ HEIMDAL_CRYPTO_1.0 { hc_EVP_hcrypto_rc4; hc_EVP_hcrypto_rc4_40; - hc_EVP_ossl_md2; hc_EVP_ossl_md4; hc_EVP_ossl_md5; hc_EVP_ossl_sha1; @@ -220,7 +216,6 @@ HEIMDAL_CRYPTO_1.0 { hc_EVP_ossl_rc4; hc_EVP_ossl_rc4_40; - hc_EVP_pkcs11_md2; hc_EVP_pkcs11_md4; hc_EVP_pkcs11_md5; hc_EVP_pkcs11_sha1; @@ -250,9 +245,6 @@ HEIMDAL_CRYPTO_1.0 { hc_HMAC_Init_ex; hc_HMAC_Update; hc_HMAC_size; - hc_MD2_Final; - hc_MD2_Init; - hc_MD2_Update; hc_MD4_Final; hc_MD4_Init; hc_MD4_Update;