Add Whirlpool to EVP.
authorAndy Polyakov <appro@openssl.org>
Wed, 30 Nov 2005 20:57:23 +0000 (20:57 +0000)
committerAndy Polyakov <appro@openssl.org>
Wed, 30 Nov 2005 20:57:23 +0000 (20:57 +0000)
crypto/evp/Makefile
crypto/evp/c_alld.c
crypto/evp/m_wp.c [new file with mode: 0644]

index 74aed8d6b73aa9da90bb44572309b351e858598a..4f1bd8fe4e4c37eb61446cf90fa45e1803b0de8d 100644 (file)
@@ -22,7 +22,7 @@ LIBSRC= encode.c digest.c evp_enc.c evp_key.c evp_acnf.c \
        e_des.c e_bf.c e_idea.c e_des3.c \
        e_rc4.c e_aes.c names.c \
        e_xcbc_d.c e_rc2.c e_cast.c e_rc5.c \
-       m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c \
+       m_null.c m_md2.c m_md4.c m_md5.c m_sha.c m_sha1.c m_wp.c \
        m_dss.c m_dss1.c m_mdc2.c m_ripemd.c m_ecdsa.c\
        p_open.c p_seal.c p_sign.c p_verify.c p_lib.c p_enc.c p_dec.c \
        bio_md.c bio_b64.c bio_enc.c evp_err.c e_null.c \
@@ -34,7 +34,7 @@ LIBOBJ=       encode.o digest.o evp_enc.o evp_key.o evp_acnf.o \
        e_des.o e_bf.o e_idea.o e_des3.o \
        e_rc4.o e_aes.o names.o \
        e_xcbc_d.o e_rc2.o e_cast.o e_rc5.o \
-       m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o \
+       m_null.o m_md2.o m_md4.o m_md5.o m_sha.o m_sha1.o m_wp.o \
        m_dss.o m_dss1.o m_mdc2.o m_ripemd.o m_ecdsa.o\
        p_open.o p_seal.o p_sign.o p_verify.o p_lib.o p_enc.o p_dec.o \
        bio_md.o bio_b64.o bio_enc.o evp_err.o e_null.o \
@@ -505,6 +505,19 @@ m_sha1.o: ../../include/openssl/safestack.h ../../include/openssl/sha.h
 m_sha1.o: ../../include/openssl/stack.h ../../include/openssl/symhacks.h
 m_sha1.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
 m_sha1.o: ../cryptlib.h m_sha1.c
+m_wp.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
+m_wp.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
+m_wp.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
+m_wp.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h
+m_wp.o: ../../include/openssl/err.h ../../include/openssl/evp.h
+m_wp.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h
+m_wp.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h
+m_wp.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h
+m_wp.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h
+m_wp.o: ../../include/openssl/sha.h ../../include/openssl/stack.h
+m_wp.o: ../../include/openssl/symhacks.h ../../include/openssl/whrlpool.h
+m_wp.o: ../../include/openssl/x509.h ../../include/openssl/x509_vfy.h
+m_wp.o: ../cryptlib.h m_wp.c
 names.o: ../../e_os.h ../../include/openssl/asn1.h ../../include/openssl/bio.h
 names.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h
 names.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h
index d270b0ee033168fa97783d4a93c5b81bf496238a..5032e7c2f014f3720d92098491d6d887c748282c 100644 (file)
@@ -110,5 +110,8 @@ void OpenSSL_add_all_digests(void)
 #ifndef OPENSSL_NO_SHA512
        EVP_add_digest(EVP_sha384());
        EVP_add_digest(EVP_sha512());
+#endif
+#ifndef OPENSSL_NO_WHIRLPOOL
+       EVP_add_digest(EVP_whirlpool());
 #endif
        }
diff --git a/crypto/evp/m_wp.c b/crypto/evp/m_wp.c
new file mode 100644 (file)
index 0000000..1ce47c0
--- /dev/null
@@ -0,0 +1,42 @@
+/* crypto/evp/m_wp.c */
+
+#include <stdio.h>
+#include "cryptlib.h"
+
+#ifndef OPENSSL_NO_WHIRLPOOL
+
+#include <openssl/evp.h>
+#include <openssl/objects.h>
+#include <openssl/x509.h>
+#include <openssl/whrlpool.h>
+
+static int init(EVP_MD_CTX *ctx)
+       { return WHIRLPOOL_Init(ctx->md_data); }
+
+static int update(EVP_MD_CTX *ctx,const void *data,size_t count)
+       { return WHIRLPOOL_Update(ctx->md_data,data,count); }
+
+static int final(EVP_MD_CTX *ctx,unsigned char *md)
+       { return WHIRLPOOL_Final(md,ctx->md_data); }
+
+static const EVP_MD whirlpool_md=
+       {
+       NID_whirlpool,
+       0,
+       WHIRLPOOL_DIGEST_LENGTH,
+       0,
+       init,
+       update,
+       final,
+       NULL,
+       NULL,
+       EVP_PKEY_NULL_method,
+       WHIRLPOOL_BBLOCK/8,
+       sizeof(EVP_MD *)+sizeof(WHIRLPOOL_CTX),
+       };
+
+const EVP_MD *EVP_whirlpool(void)
+       {
+       return(&whirlpool_md);
+       }
+#endif