summaryrefslogtreecommitdiff
path: root/jni/ruby/ext/digest/rmd160
diff options
context:
space:
mode:
authorJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-16 18:49:26 +0900
committerJari Vetoniemi <jari.vetoniemi@indooratlas.com>2020-03-30 00:39:06 +0900
commitfcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch)
tree64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/ext/digest/rmd160
Fresh start
Diffstat (limited to 'jni/ruby/ext/digest/rmd160')
-rw-r--r--jni/ruby/ext/digest/rmd160/Makefile297
-rw-r--r--jni/ruby/ext/digest/rmd160/depend28
-rw-r--r--jni/ruby/ext/digest/rmd160/extconf.h8
-rw-r--r--jni/ruby/ext/digest/rmd160/extconf.rb27
-rw-r--r--jni/ruby/ext/digest/rmd160/rmd160.c463
-rw-r--r--jni/ruby/ext/digest/rmd160/rmd160.h56
-rw-r--r--jni/ruby/ext/digest/rmd160/rmd160init.c45
-rw-r--r--jni/ruby/ext/digest/rmd160/rmd160ossl.c8
-rw-r--r--jni/ruby/ext/digest/rmd160/rmd160ossl.h19
9 files changed, 951 insertions, 0 deletions
diff --git a/jni/ruby/ext/digest/rmd160/Makefile b/jni/ruby/ext/digest/rmd160/Makefile
new file mode 100644
index 0000000..86c5ef2
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/Makefile
@@ -0,0 +1,297 @@
+
+SHELL = /bin/sh
+
+# V=0 quiet, V=1 verbose. other values don't work.
+V = 0
+Q1 = $(V:1=)
+Q = $(Q1:0=@)
+ECHO1 = $(V:1=@:)
+ECHO = $(ECHO1:0=@echo)
+NULLCMD = :
+
+#### Start of system configuration section. ####
+top_srcdir = $(topdir)/.
+srcdir = $(top_srcdir)/ext/digest/rmd160
+topdir = ../../..
+hdrdir = $(top_srcdir)/include
+arch_hdrdir = $(extout)/include/$(arch)
+PATH_SEPARATOR = :
+VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby
+RUBYLIB =
+RUBYOPT = -
+prefix = $(DESTDIR)/usr/local
+rubysitearchprefix = $(rubylibprefix)/$(sitearch)
+rubyarchprefix = $(rubylibprefix)/$(arch)
+rubylibprefix = $(libdir)/$(RUBY_BASE_NAME)
+exec_prefix = $(prefix)
+vendorarchhdrdir = $(vendorhdrdir)/$(sitearch)
+sitearchhdrdir = $(sitehdrdir)/$(sitearch)
+rubyarchhdrdir = $(rubyhdrdir)/$(arch)
+vendorhdrdir = $(rubyhdrdir)/vendor_ruby
+sitehdrdir = $(rubyhdrdir)/site_ruby
+rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME)
+vendorarchdir = $(vendorlibdir)/$(sitearch)
+vendorlibdir = $(vendordir)/$(ruby_version)
+vendordir = $(rubylibprefix)/vendor_ruby
+sitearchdir = $(sitelibdir)/$(sitearch)
+sitelibdir = $(sitedir)/$(ruby_version)
+sitedir = $(rubylibprefix)/site_ruby
+rubyarchdir = $(rubylibdir)/$(arch)
+rubylibdir = $(rubylibprefix)/$(ruby_version)
+sitearchincludedir = $(includedir)/$(sitearch)
+archincludedir = $(includedir)/$(arch)
+sitearchlibdir = $(libdir)/$(sitearch)
+archlibdir = $(libdir)/$(arch)
+ridir = $(datarootdir)/$(RI_BASE_NAME)
+mandir = $(datarootdir)/man
+localedir = $(datarootdir)/locale
+libdir = $(exec_prefix)/lib
+psdir = $(docdir)
+pdfdir = $(docdir)
+dvidir = $(docdir)
+htmldir = $(docdir)
+infodir = $(datarootdir)/info
+docdir = $(datarootdir)/doc/$(PACKAGE)
+oldincludedir = $(DESTDIR)/usr/include
+includedir = $(prefix)/include
+localstatedir = $(prefix)/var
+sharedstatedir = $(prefix)/com
+sysconfdir = $(prefix)/etc
+datadir = $(datarootdir)
+datarootdir = $(prefix)/share
+libexecdir = $(exec_prefix)/libexec
+sbindir = $(exec_prefix)/sbin
+bindir = $(exec_prefix)/bin
+archdir = $(rubyarchdir)
+
+
+CC = gcc
+CXX = g++
+LIBRUBY = $(LIBRUBY_SO)
+LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a
+LIBRUBYARG_SHARED = -Wl,-R$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)
+LIBRUBYARG_STATIC = -Wl,-R$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static
+empty =
+OUTFLAG = -o $(empty)
+COUTFLAG = -o $(empty)
+
+RUBY_EXTCONF_H = extconf.h
+cflags = $(optflags) $(debugflags) $(warnflags)
+optflags = -O3 -fno-fast-math
+debugflags = -ggdb3
+warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat
+CCDLFLAGS = -fPIC
+CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG)
+INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) -I$(srcdir)/..
+DEFS =
+CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" $(DEFS) $(cppflags)
+CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG)
+ldflags = -L. -fstack-protector -rdynamic -Wl,-export-dynamic
+dldflags =
+ARCH_FLAG =
+DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG)
+LDSHARED = $(CC) -shared
+LDSHAREDXX = $(CXX) -shared
+AR = ar
+EXEEXT =
+
+RUBY_INSTALL_NAME = $(RUBY_BASE_NAME)
+RUBY_SO_NAME = ruby
+RUBYW_INSTALL_NAME =
+RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version)
+RUBYW_BASE_NAME = rubyw
+RUBY_BASE_NAME = ruby
+
+arch = x86_64-linux
+sitearch = $(arch)
+ruby_version = 2.2.0
+ruby = $(topdir)/miniruby -I'$(topdir)' -I'$(top_srcdir)/lib' -I'$(extout)/$(arch)' -I'$(extout)/common'
+RUBY = $(ruby)
+ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H)
+
+RM = rm -f
+RM_RF = $(RUBY) -run -e rm -- -rf
+RMDIRS = rmdir --ignore-fail-on-non-empty -p
+MAKEDIRS = /bin/mkdir -p
+INSTALL = /usr/bin/install -c
+INSTALL_PROG = $(INSTALL) -m 0755
+INSTALL_DATA = $(INSTALL) -m 644
+COPY = cp
+TOUCH = exit >
+
+#### End of system configuration section. ####
+
+preload = digest
+
+libpath = . $(topdir)
+LIBPATH = -L. -L$(topdir)
+DEFFILE =
+
+CLEANFILES = mkmf.log
+DISTCLEANFILES =
+DISTCLEANDIRS =
+
+extout = $(topdir)/.ext
+extout_prefix = $(extout)$(target_prefix)/
+target_prefix = /digest
+LOCAL_LIBS =
+LIBS = $(LIBRUBYARG_SHARED) -lcrypto -lssl -lcrypto -lpthread -lgmp -ldl -lcrypt -lm -lc
+ORIG_SRCS = rmd160init.c rmd160.c rmd160ossl.c
+SRCS = $(ORIG_SRCS) rmd160init.c rmd160ossl.c
+OBJS = rmd160init.o rmd160ossl.o
+HDRS = $(srcdir)/rmd160.h $(srcdir)/rmd160ossl.h $(srcdir)/extconf.h
+TARGET = rmd160
+TARGET_NAME = rmd160
+TARGET_ENTRY = Init_$(TARGET_NAME)
+DLLIB = $(TARGET).so
+EXTSTATIC =
+STATIC_LIB = $(TARGET).a
+
+TIMESTAMP_DIR = $(extout)/.timestamp
+BINDIR = $(extout)/bin
+RUBYCOMMONDIR = $(extout)/common
+RUBYLIBDIR = $(RUBYCOMMONDIR)$(target_prefix)
+RUBYARCHDIR = $(extout)/$(arch)$(target_prefix)
+HDRDIR = $(extout)/include/ruby$(target_prefix)
+ARCHHDRDIR = $(extout)/include/$(arch)/ruby$(target_prefix)
+
+TARGET_SO = $(RUBYARCHDIR)/$(DLLIB)
+CLEANLIBS = $(RUBYARCHDIR)/$(TARGET).so
+CLEANOBJS = *.o *.bak
+
+all: install
+static: all
+.PHONY: all install static install-so install-rb
+.PHONY: clean clean-so clean-static clean-rb
+
+clean-static::
+clean-rb-default::
+clean-rb::
+clean-so::
+clean: clean-so clean-static clean-rb-default clean-rb
+ -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time
+
+distclean-rb-default::
+distclean-rb::
+distclean-so::
+distclean-static::
+distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb
+ -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log
+ -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES)
+ -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true
+
+realclean: distclean
+install: install-so install-rb
+
+install-so: $(RUBYARCHDIR)/$(DLLIB)
+clean-so::
+ -$(Q)$(RM) $(RUBYARCHDIR)/$(DLLIB)
+ -$(Q)$(RMDIRS) $(RUBYARCHDIR) 2> /dev/null || true
+clean-static::
+ -$(Q)$(RM) $(STATIC_LIB)
+install-rb: pre-install-rb install-rb-default
+install-rb-default: pre-install-rb-default
+pre-install-rb: Makefile
+pre-install-rb-default: Makefile
+pre-install-rb-default:
+ @$(NULLCMD)
+$(TIMESTAMP_DIR)/.RUBYARCHDIR.-.digest.time:
+ $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR)
+ $(Q) $(TOUCH) $@
+
+site-install: site-install-so site-install-rb
+site-install-so: install-so
+site-install-rb: install-rb
+
+.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S
+
+.cc.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cc.S:
+ $(ECHO) translating $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
+
+.mm.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.mm.S:
+ $(ECHO) translating $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
+
+.cxx.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cxx.S:
+ $(ECHO) translating $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
+
+.cpp.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $<
+
+.cpp.S:
+ $(ECHO) translating $(<)
+ $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $<
+
+.c.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+.c.S:
+ $(ECHO) translating $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
+
+.m.o:
+ $(ECHO) compiling $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $<
+
+.m.S:
+ $(ECHO) translating $(<)
+ $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $<
+
+$(RUBYARCHDIR)/$(DLLIB): $(OBJS) Makefile $(TIMESTAMP_DIR)/.RUBYARCHDIR.-.digest.time
+ $(ECHO) linking shared-object digest/$(DLLIB)
+ -$(Q)$(RM) $(@)
+ $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS)
+
+$(STATIC_LIB): $(OBJS)
+ -$(Q)$(RM) $(@)
+ $(ECHO) linking static-library $(@)
+ $(Q) $(AR) cru $@ $(OBJS)
+ -$(Q)ranlib $(@) 2> /dev/null || true
+
+###
+$(OBJS): $(RUBY_EXTCONF_H)
+
+rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+
+# AUTOGENERATED DEPENDENCIES START
+rmd160init.o: $(RUBY_EXTCONF_H)
+rmd160init.o: $(arch_hdrdir)/ruby/config.h
+rmd160init.o: $(hdrdir)/ruby/defines.h
+rmd160init.o: $(hdrdir)/ruby/intern.h
+rmd160init.o: $(hdrdir)/ruby/missing.h
+rmd160init.o: $(hdrdir)/ruby/ruby.h
+rmd160init.o: $(hdrdir)/ruby/st.h
+rmd160init.o: $(hdrdir)/ruby/subst.h
+rmd160init.o: $(top_srcdir)/ext/digest/digest.h
+rmd160init.o: $(top_srcdir)/include/ruby.h
+rmd160init.o: rmd160init.c
+rmd160init.o: rmd160ossl.h
+rmd160ossl.o: $(RUBY_EXTCONF_H)
+rmd160ossl.o: $(arch_hdrdir)/ruby/config.h
+rmd160ossl.o: $(hdrdir)/ruby/defines.h
+rmd160ossl.o: $(hdrdir)/ruby/intern.h
+rmd160ossl.o: $(hdrdir)/ruby/missing.h
+rmd160ossl.o: $(hdrdir)/ruby/ruby.h
+rmd160ossl.o: $(hdrdir)/ruby/st.h
+rmd160ossl.o: $(hdrdir)/ruby/subst.h
+rmd160ossl.o: $(top_srcdir)/ext/digest/defs.h
+rmd160ossl.o: $(top_srcdir)/include/ruby.h
+rmd160ossl.o: rmd160ossl.c
+rmd160ossl.o: rmd160ossl.h
+# AUTOGENERATED DEPENDENCIES END
diff --git a/jni/ruby/ext/digest/rmd160/depend b/jni/ruby/ext/digest/rmd160/depend
new file mode 100644
index 0000000..49cf2af
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/depend
@@ -0,0 +1,28 @@
+rmd160.o: rmd160.c rmd160.h $(srcdir)/../defs.h $(HDRS) $(ruby_headers)
+
+# AUTOGENERATED DEPENDENCIES START
+rmd160init.o: $(RUBY_EXTCONF_H)
+rmd160init.o: $(arch_hdrdir)/ruby/config.h
+rmd160init.o: $(hdrdir)/ruby/defines.h
+rmd160init.o: $(hdrdir)/ruby/intern.h
+rmd160init.o: $(hdrdir)/ruby/missing.h
+rmd160init.o: $(hdrdir)/ruby/ruby.h
+rmd160init.o: $(hdrdir)/ruby/st.h
+rmd160init.o: $(hdrdir)/ruby/subst.h
+rmd160init.o: $(top_srcdir)/ext/digest/digest.h
+rmd160init.o: $(top_srcdir)/include/ruby.h
+rmd160init.o: rmd160init.c
+rmd160init.o: rmd160ossl.h
+rmd160ossl.o: $(RUBY_EXTCONF_H)
+rmd160ossl.o: $(arch_hdrdir)/ruby/config.h
+rmd160ossl.o: $(hdrdir)/ruby/defines.h
+rmd160ossl.o: $(hdrdir)/ruby/intern.h
+rmd160ossl.o: $(hdrdir)/ruby/missing.h
+rmd160ossl.o: $(hdrdir)/ruby/ruby.h
+rmd160ossl.o: $(hdrdir)/ruby/st.h
+rmd160ossl.o: $(hdrdir)/ruby/subst.h
+rmd160ossl.o: $(top_srcdir)/ext/digest/defs.h
+rmd160ossl.o: $(top_srcdir)/include/ruby.h
+rmd160ossl.o: rmd160ossl.c
+rmd160ossl.o: rmd160ossl.h
+# AUTOGENERATED DEPENDENCIES END
diff --git a/jni/ruby/ext/digest/rmd160/extconf.h b/jni/ruby/ext/digest/rmd160/extconf.h
new file mode 100644
index 0000000..bcacaee
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/extconf.h
@@ -0,0 +1,8 @@
+#ifndef EXTCONF_H
+#define EXTCONF_H
+#define NDEBUG 1
+#define HAVE_CONFIG_H 1
+#define HAVE_RIPEMD160_TRANSFORM 1
+#define HAVE_OPENSSL_RIPEMD_H 1
+#define HAVE_SYS_CDEFS_H 1
+#endif
diff --git a/jni/ruby/ext/digest/rmd160/extconf.rb b/jni/ruby/ext/digest/rmd160/extconf.rb
new file mode 100644
index 0000000..6b870e9
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/extconf.rb
@@ -0,0 +1,27 @@
+# -*- coding: us-ascii -*-
+# $RoughId: extconf.rb,v 1.3 2001/08/14 19:54:51 knu Exp $
+# $Id: extconf.rb 47802 2014-10-05 02:03:55Z nobu $
+
+require "mkmf"
+
+$defs << "-DNDEBUG" << "-DHAVE_CONFIG_H"
+$INCFLAGS << " -I$(srcdir)/.."
+
+$objs = [ "rmd160init.#{$OBJEXT}" ]
+
+if !with_config("bundled-rmd160") &&
+ (dir_config("openssl")
+ pkg_config("openssl")
+ require File.expand_path('../../../openssl/deprecation', __FILE__)
+ have_library("crypto")) &&
+ OpenSSL.check_func("RIPEMD160_Transform", "openssl/ripemd.h")
+ $objs << "rmd160ossl.#{$OBJEXT}"
+else
+ $objs << "rmd160.#{$OBJEXT}"
+end
+
+have_header("sys/cdefs.h")
+
+$preload = %w[digest]
+
+create_makefile("digest/rmd160")
diff --git a/jni/ruby/ext/digest/rmd160/rmd160.c b/jni/ruby/ext/digest/rmd160/rmd160.c
new file mode 100644
index 0000000..0b834f3
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/rmd160.c
@@ -0,0 +1,463 @@
+/* $NetBSD: rmd160.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $ */
+/* $RoughId: rmd160.c,v 1.2 2001/07/13 19:49:10 knu Exp $ */
+/* $Id: rmd160.c 46827 2014-07-15 14:59:20Z nobu $ */
+
+/********************************************************************\
+ *
+ * FILE: rmd160.c
+ *
+ * CONTENTS: A sample C-implementation of the RIPEMD-160
+ * hash-function.
+ * TARGET: any computer with an ANSI C compiler
+ *
+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ * (Arranged for libc by Todd C. Miller)
+ * DATE: 1 March 1996
+ * VERSION: 1.0
+ *
+ * Copyright (c) Katholieke Universiteit Leuven
+ * 1996, All Rights Reserved
+ *
+\********************************************************************/
+
+#include "rmd160.h"
+
+#ifndef lint
+/* __RCSID("$NetBSD: rmd160.c,v 1.1.1.1 2001/03/06 11:21:05 agc Exp $"); */
+#endif /* not lint */
+
+/* header files */
+
+#ifdef HAVE_SYS_ENDIAN_H_
+#include <sys/endian.h>
+#endif
+
+#ifdef HAVE_MACHINE_ENDIAN_H_
+#include <machine/endian.h>
+#endif
+
+/* #include "namespace.h" */
+
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifndef _DIAGASSERT
+#define _DIAGASSERT(cond) assert(cond)
+#endif
+
+
+/********************************************************************/
+
+/* macro definitions */
+
+/* collect four bytes into one word: */
+#define BYTES_TO_DWORD(strptr) \
+ (((uint32_t) *((strptr)+3) << 24) | \
+ ((uint32_t) *((strptr)+2) << 16) | \
+ ((uint32_t) *((strptr)+1) << 8) | \
+ ((uint32_t) *(strptr)))
+
+/* ROL(x, n) cyclically rotates x over n bits to the left */
+/* x must be of an unsigned 32 bits type and 0 <= n < 32. */
+#define ROL(x, n) (((x) << (n)) | ((x) >> (32-(n))))
+
+/* the three basic functions F(), G() and H() */
+#define F(x, y, z) ((x) ^ (y) ^ (z))
+#define G(x, y, z) (((x) & (y)) | (~(x) & (z)))
+#define H(x, y, z) (((x) | ~(y)) ^ (z))
+#define I(x, y, z) (((x) & (z)) | ((y) & ~(z)))
+#define J(x, y, z) ((x) ^ ((y) | ~(z)))
+
+/* the eight basic operations FF() through III() */
+#define FF(a, b, c, d, e, x, s) { \
+ (a) += F((b), (c), (d)) + (x); \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define GG(a, b, c, d, e, x, s) { \
+ (a) += G((b), (c), (d)) + (x) + 0x5a827999U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define HH(a, b, c, d, e, x, s) { \
+ (a) += H((b), (c), (d)) + (x) + 0x6ed9eba1U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define II(a, b, c, d, e, x, s) { \
+ (a) += I((b), (c), (d)) + (x) + 0x8f1bbcdcU; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define JJ(a, b, c, d, e, x, s) { \
+ (a) += J((b), (c), (d)) + (x) + 0xa953fd4eU; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define FFF(a, b, c, d, e, x, s) { \
+ (a) += F((b), (c), (d)) + (x); \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define GGG(a, b, c, d, e, x, s) { \
+ (a) += G((b), (c), (d)) + (x) + 0x7a6d76e9U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define HHH(a, b, c, d, e, x, s) { \
+ (a) += H((b), (c), (d)) + (x) + 0x6d703ef3U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define III(a, b, c, d, e, x, s) { \
+ (a) += I((b), (c), (d)) + (x) + 0x5c4dd124U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+#define JJJ(a, b, c, d, e, x, s) { \
+ (a) += J((b), (c), (d)) + (x) + 0x50a28be6U; \
+ (a) = ROL((a), (s)) + (e); \
+ (c) = ROL((c), 10); \
+}
+
+/********************************************************************/
+
+int
+RMD160_Init(RMD160_CTX *context)
+{
+
+ _DIAGASSERT(context != NULL);
+
+ /* ripemd-160 initialization constants */
+ context->state[0] = 0x67452301U;
+ context->state[1] = 0xefcdab89U;
+ context->state[2] = 0x98badcfeU;
+ context->state[3] = 0x10325476U;
+ context->state[4] = 0xc3d2e1f0U;
+ context->length[0] = context->length[1] = 0;
+ context->buflen = 0;
+ return 1;
+}
+
+/********************************************************************/
+
+void
+RMD160_Transform(uint32_t state[5], const uint32_t block[16])
+{
+ uint32_t aa, bb, cc, dd, ee;
+ uint32_t aaa, bbb, ccc, ddd, eee;
+
+ _DIAGASSERT(state != NULL);
+ _DIAGASSERT(block != NULL);
+
+ aa = aaa = state[0];
+ bb = bbb = state[1];
+ cc = ccc = state[2];
+ dd = ddd = state[3];
+ ee = eee = state[4];
+
+ /* round 1 */
+ FF(aa, bb, cc, dd, ee, block[ 0], 11);
+ FF(ee, aa, bb, cc, dd, block[ 1], 14);
+ FF(dd, ee, aa, bb, cc, block[ 2], 15);
+ FF(cc, dd, ee, aa, bb, block[ 3], 12);
+ FF(bb, cc, dd, ee, aa, block[ 4], 5);
+ FF(aa, bb, cc, dd, ee, block[ 5], 8);
+ FF(ee, aa, bb, cc, dd, block[ 6], 7);
+ FF(dd, ee, aa, bb, cc, block[ 7], 9);
+ FF(cc, dd, ee, aa, bb, block[ 8], 11);
+ FF(bb, cc, dd, ee, aa, block[ 9], 13);
+ FF(aa, bb, cc, dd, ee, block[10], 14);
+ FF(ee, aa, bb, cc, dd, block[11], 15);
+ FF(dd, ee, aa, bb, cc, block[12], 6);
+ FF(cc, dd, ee, aa, bb, block[13], 7);
+ FF(bb, cc, dd, ee, aa, block[14], 9);
+ FF(aa, bb, cc, dd, ee, block[15], 8);
+
+ /* round 2 */
+ GG(ee, aa, bb, cc, dd, block[ 7], 7);
+ GG(dd, ee, aa, bb, cc, block[ 4], 6);
+ GG(cc, dd, ee, aa, bb, block[13], 8);
+ GG(bb, cc, dd, ee, aa, block[ 1], 13);
+ GG(aa, bb, cc, dd, ee, block[10], 11);
+ GG(ee, aa, bb, cc, dd, block[ 6], 9);
+ GG(dd, ee, aa, bb, cc, block[15], 7);
+ GG(cc, dd, ee, aa, bb, block[ 3], 15);
+ GG(bb, cc, dd, ee, aa, block[12], 7);
+ GG(aa, bb, cc, dd, ee, block[ 0], 12);
+ GG(ee, aa, bb, cc, dd, block[ 9], 15);
+ GG(dd, ee, aa, bb, cc, block[ 5], 9);
+ GG(cc, dd, ee, aa, bb, block[ 2], 11);
+ GG(bb, cc, dd, ee, aa, block[14], 7);
+ GG(aa, bb, cc, dd, ee, block[11], 13);
+ GG(ee, aa, bb, cc, dd, block[ 8], 12);
+
+ /* round 3 */
+ HH(dd, ee, aa, bb, cc, block[ 3], 11);
+ HH(cc, dd, ee, aa, bb, block[10], 13);
+ HH(bb, cc, dd, ee, aa, block[14], 6);
+ HH(aa, bb, cc, dd, ee, block[ 4], 7);
+ HH(ee, aa, bb, cc, dd, block[ 9], 14);
+ HH(dd, ee, aa, bb, cc, block[15], 9);
+ HH(cc, dd, ee, aa, bb, block[ 8], 13);
+ HH(bb, cc, dd, ee, aa, block[ 1], 15);
+ HH(aa, bb, cc, dd, ee, block[ 2], 14);
+ HH(ee, aa, bb, cc, dd, block[ 7], 8);
+ HH(dd, ee, aa, bb, cc, block[ 0], 13);
+ HH(cc, dd, ee, aa, bb, block[ 6], 6);
+ HH(bb, cc, dd, ee, aa, block[13], 5);
+ HH(aa, bb, cc, dd, ee, block[11], 12);
+ HH(ee, aa, bb, cc, dd, block[ 5], 7);
+ HH(dd, ee, aa, bb, cc, block[12], 5);
+
+ /* round 4 */
+ II(cc, dd, ee, aa, bb, block[ 1], 11);
+ II(bb, cc, dd, ee, aa, block[ 9], 12);
+ II(aa, bb, cc, dd, ee, block[11], 14);
+ II(ee, aa, bb, cc, dd, block[10], 15);
+ II(dd, ee, aa, bb, cc, block[ 0], 14);
+ II(cc, dd, ee, aa, bb, block[ 8], 15);
+ II(bb, cc, dd, ee, aa, block[12], 9);
+ II(aa, bb, cc, dd, ee, block[ 4], 8);
+ II(ee, aa, bb, cc, dd, block[13], 9);
+ II(dd, ee, aa, bb, cc, block[ 3], 14);
+ II(cc, dd, ee, aa, bb, block[ 7], 5);
+ II(bb, cc, dd, ee, aa, block[15], 6);
+ II(aa, bb, cc, dd, ee, block[14], 8);
+ II(ee, aa, bb, cc, dd, block[ 5], 6);
+ II(dd, ee, aa, bb, cc, block[ 6], 5);
+ II(cc, dd, ee, aa, bb, block[ 2], 12);
+
+ /* round 5 */
+ JJ(bb, cc, dd, ee, aa, block[ 4], 9);
+ JJ(aa, bb, cc, dd, ee, block[ 0], 15);
+ JJ(ee, aa, bb, cc, dd, block[ 5], 5);
+ JJ(dd, ee, aa, bb, cc, block[ 9], 11);
+ JJ(cc, dd, ee, aa, bb, block[ 7], 6);
+ JJ(bb, cc, dd, ee, aa, block[12], 8);
+ JJ(aa, bb, cc, dd, ee, block[ 2], 13);
+ JJ(ee, aa, bb, cc, dd, block[10], 12);
+ JJ(dd, ee, aa, bb, cc, block[14], 5);
+ JJ(cc, dd, ee, aa, bb, block[ 1], 12);
+ JJ(bb, cc, dd, ee, aa, block[ 3], 13);
+ JJ(aa, bb, cc, dd, ee, block[ 8], 14);
+ JJ(ee, aa, bb, cc, dd, block[11], 11);
+ JJ(dd, ee, aa, bb, cc, block[ 6], 8);
+ JJ(cc, dd, ee, aa, bb, block[15], 5);
+ JJ(bb, cc, dd, ee, aa, block[13], 6);
+
+ /* parallel round 1 */
+ JJJ(aaa, bbb, ccc, ddd, eee, block[ 5], 8);
+ JJJ(eee, aaa, bbb, ccc, ddd, block[14], 9);
+ JJJ(ddd, eee, aaa, bbb, ccc, block[ 7], 9);
+ JJJ(ccc, ddd, eee, aaa, bbb, block[ 0], 11);
+ JJJ(bbb, ccc, ddd, eee, aaa, block[ 9], 13);
+ JJJ(aaa, bbb, ccc, ddd, eee, block[ 2], 15);
+ JJJ(eee, aaa, bbb, ccc, ddd, block[11], 15);
+ JJJ(ddd, eee, aaa, bbb, ccc, block[ 4], 5);
+ JJJ(ccc, ddd, eee, aaa, bbb, block[13], 7);
+ JJJ(bbb, ccc, ddd, eee, aaa, block[ 6], 7);
+ JJJ(aaa, bbb, ccc, ddd, eee, block[15], 8);
+ JJJ(eee, aaa, bbb, ccc, ddd, block[ 8], 11);
+ JJJ(ddd, eee, aaa, bbb, ccc, block[ 1], 14);
+ JJJ(ccc, ddd, eee, aaa, bbb, block[10], 14);
+ JJJ(bbb, ccc, ddd, eee, aaa, block[ 3], 12);
+ JJJ(aaa, bbb, ccc, ddd, eee, block[12], 6);
+
+ /* parallel round 2 */
+ III(eee, aaa, bbb, ccc, ddd, block[ 6], 9);
+ III(ddd, eee, aaa, bbb, ccc, block[11], 13);
+ III(ccc, ddd, eee, aaa, bbb, block[ 3], 15);
+ III(bbb, ccc, ddd, eee, aaa, block[ 7], 7);
+ III(aaa, bbb, ccc, ddd, eee, block[ 0], 12);
+ III(eee, aaa, bbb, ccc, ddd, block[13], 8);
+ III(ddd, eee, aaa, bbb, ccc, block[ 5], 9);
+ III(ccc, ddd, eee, aaa, bbb, block[10], 11);
+ III(bbb, ccc, ddd, eee, aaa, block[14], 7);
+ III(aaa, bbb, ccc, ddd, eee, block[15], 7);
+ III(eee, aaa, bbb, ccc, ddd, block[ 8], 12);
+ III(ddd, eee, aaa, bbb, ccc, block[12], 7);
+ III(ccc, ddd, eee, aaa, bbb, block[ 4], 6);
+ III(bbb, ccc, ddd, eee, aaa, block[ 9], 15);
+ III(aaa, bbb, ccc, ddd, eee, block[ 1], 13);
+ III(eee, aaa, bbb, ccc, ddd, block[ 2], 11);
+
+ /* parallel round 3 */
+ HHH(ddd, eee, aaa, bbb, ccc, block[15], 9);
+ HHH(ccc, ddd, eee, aaa, bbb, block[ 5], 7);
+ HHH(bbb, ccc, ddd, eee, aaa, block[ 1], 15);
+ HHH(aaa, bbb, ccc, ddd, eee, block[ 3], 11);
+ HHH(eee, aaa, bbb, ccc, ddd, block[ 7], 8);
+ HHH(ddd, eee, aaa, bbb, ccc, block[14], 6);
+ HHH(ccc, ddd, eee, aaa, bbb, block[ 6], 6);
+ HHH(bbb, ccc, ddd, eee, aaa, block[ 9], 14);
+ HHH(aaa, bbb, ccc, ddd, eee, block[11], 12);
+ HHH(eee, aaa, bbb, ccc, ddd, block[ 8], 13);
+ HHH(ddd, eee, aaa, bbb, ccc, block[12], 5);
+ HHH(ccc, ddd, eee, aaa, bbb, block[ 2], 14);
+ HHH(bbb, ccc, ddd, eee, aaa, block[10], 13);
+ HHH(aaa, bbb, ccc, ddd, eee, block[ 0], 13);
+ HHH(eee, aaa, bbb, ccc, ddd, block[ 4], 7);
+ HHH(ddd, eee, aaa, bbb, ccc, block[13], 5);
+
+ /* parallel round 4 */
+ GGG(ccc, ddd, eee, aaa, bbb, block[ 8], 15);
+ GGG(bbb, ccc, ddd, eee, aaa, block[ 6], 5);
+ GGG(aaa, bbb, ccc, ddd, eee, block[ 4], 8);
+ GGG(eee, aaa, bbb, ccc, ddd, block[ 1], 11);
+ GGG(ddd, eee, aaa, bbb, ccc, block[ 3], 14);
+ GGG(ccc, ddd, eee, aaa, bbb, block[11], 14);
+ GGG(bbb, ccc, ddd, eee, aaa, block[15], 6);
+ GGG(aaa, bbb, ccc, ddd, eee, block[ 0], 14);
+ GGG(eee, aaa, bbb, ccc, ddd, block[ 5], 6);
+ GGG(ddd, eee, aaa, bbb, ccc, block[12], 9);
+ GGG(ccc, ddd, eee, aaa, bbb, block[ 2], 12);
+ GGG(bbb, ccc, ddd, eee, aaa, block[13], 9);
+ GGG(aaa, bbb, ccc, ddd, eee, block[ 9], 12);
+ GGG(eee, aaa, bbb, ccc, ddd, block[ 7], 5);
+ GGG(ddd, eee, aaa, bbb, ccc, block[10], 15);
+ GGG(ccc, ddd, eee, aaa, bbb, block[14], 8);
+
+ /* parallel round 5 */
+ FFF(bbb, ccc, ddd, eee, aaa, block[12] , 8);
+ FFF(aaa, bbb, ccc, ddd, eee, block[15] , 5);
+ FFF(eee, aaa, bbb, ccc, ddd, block[10] , 12);
+ FFF(ddd, eee, aaa, bbb, ccc, block[ 4] , 9);
+ FFF(ccc, ddd, eee, aaa, bbb, block[ 1] , 12);
+ FFF(bbb, ccc, ddd, eee, aaa, block[ 5] , 5);
+ FFF(aaa, bbb, ccc, ddd, eee, block[ 8] , 14);
+ FFF(eee, aaa, bbb, ccc, ddd, block[ 7] , 6);
+ FFF(ddd, eee, aaa, bbb, ccc, block[ 6] , 8);
+ FFF(ccc, ddd, eee, aaa, bbb, block[ 2] , 13);
+ FFF(bbb, ccc, ddd, eee, aaa, block[13] , 6);
+ FFF(aaa, bbb, ccc, ddd, eee, block[14] , 5);
+ FFF(eee, aaa, bbb, ccc, ddd, block[ 0] , 15);
+ FFF(ddd, eee, aaa, bbb, ccc, block[ 3] , 13);
+ FFF(ccc, ddd, eee, aaa, bbb, block[ 9] , 11);
+ FFF(bbb, ccc, ddd, eee, aaa, block[11] , 11);
+
+ /* combine results */
+ ddd += cc + state[1]; /* final result for state[0] */
+ state[1] = state[2] + dd + eee;
+ state[2] = state[3] + ee + aaa;
+ state[3] = state[4] + aa + bbb;
+ state[4] = state[0] + bb + ccc;
+ state[0] = ddd;
+}
+
+/********************************************************************/
+
+void
+RMD160_Update(RMD160_CTX *context, const uint8_t *data, size_t nbytes)
+{
+ uint32_t X[16];
+ uint32_t ofs = 0;
+ uint32_t i;
+#ifdef WORDS_BIGENDIAN
+ uint32_t j;
+#endif
+
+ _DIAGASSERT(context != NULL);
+ _DIAGASSERT(data != NULL);
+
+ /* update length[] */
+#if SIZEOF_SIZE_T * CHAR_BIT > 32
+ context->length[1] += (uint32_t)((context->length[0] + nbytes) >> 32);
+#else
+ if (context->length[0] + nbytes < context->length[0])
+ context->length[1]++; /* overflow to msb of length */
+#endif
+ context->length[0] += (uint32_t)nbytes;
+
+ (void)memset(X, 0, sizeof(X));
+
+ if ( context->buflen + nbytes < 64 )
+ {
+ (void)memcpy(context->bbuffer + context->buflen, data, nbytes);
+ context->buflen += (uint32_t)nbytes;
+ }
+ else
+ {
+ /* process first block */
+ ofs = 64 - context->buflen;
+ (void)memcpy(context->bbuffer + context->buflen, data, ofs);
+#ifndef WORDS_BIGENDIAN
+ (void)memcpy(X, context->bbuffer, sizeof(X));
+#else
+ for (j=0; j < 16; j++)
+ X[j] = BYTES_TO_DWORD(context->bbuffer + (4 * j));
+#endif
+ RMD160_Transform(context->state, X);
+ nbytes -= ofs;
+
+ /* process remaining complete blocks */
+ for (i = 0; i < (nbytes >> 6); i++) {
+#ifndef WORDS_BIGENDIAN
+ (void)memcpy(X, data + (64 * i) + ofs, sizeof(X));
+#else
+ for (j=0; j < 16; j++)
+ X[j] = BYTES_TO_DWORD(data + (64 * i) + (4 * j) + ofs);
+#endif
+ RMD160_Transform(context->state, X);
+ }
+
+ /*
+ * Put last bytes from data into context's buffer
+ */
+ context->buflen = (uint32_t)nbytes & 63;
+ memcpy(context->bbuffer, data + (64 * i) + ofs, context->buflen);
+ }
+}
+
+/********************************************************************/
+
+int
+RMD160_Finish(RMD160_CTX *context, uint8_t digest[20])
+{
+ uint32_t i;
+ uint32_t X[16];
+#ifdef WORDS_BIGENDIAN
+ uint32_t j;
+#endif
+
+ _DIAGASSERT(digest != NULL);
+ _DIAGASSERT(context != NULL);
+
+ /* append the bit m_n == 1 */
+ context->bbuffer[context->buflen] = (uint8_t)'\200';
+
+ (void)memset(context->bbuffer + context->buflen + 1, 0,
+ 63 - context->buflen);
+#ifndef WORDS_BIGENDIAN
+ (void)memcpy(X, context->bbuffer, sizeof(X));
+#else
+ for (j=0; j < 16; j++)
+ X[j] = BYTES_TO_DWORD(context->bbuffer + (4 * j));
+#endif
+ if ((context->buflen) > 55) {
+ /* length goes to next block */
+ RMD160_Transform(context->state, X);
+ (void)memset(X, 0, sizeof(X));
+ }
+
+ /* append length in bits */
+ X[14] = context->length[0] << 3;
+ X[15] = (context->length[0] >> 29) |
+ (context->length[1] << 3);
+ RMD160_Transform(context->state, X);
+
+ if (digest != NULL) {
+ for (i = 0; i < 20; i += 4) {
+ /* extracts the 8 least significant bits. */
+ digest[i] = context->state[i>>2];
+ digest[i + 1] = (context->state[i>>2] >> 8);
+ digest[i + 2] = (context->state[i>>2] >> 16);
+ digest[i + 3] = (context->state[i>>2] >> 24);
+ }
+ }
+ return 1;
+}
+
+/************************ end of file rmd160.c **********************/
diff --git a/jni/ruby/ext/digest/rmd160/rmd160.h b/jni/ruby/ext/digest/rmd160/rmd160.h
new file mode 100644
index 0000000..9a2135f
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/rmd160.h
@@ -0,0 +1,56 @@
+/* $NetBSD: rmd160.h,v 1.2 2000/07/07 10:47:06 ad Exp $ */
+/* $RoughId: rmd160.h,v 1.3 2002/02/24 08:14:31 knu Exp $ */
+/* $Id: rmd160.h 46827 2014-07-15 14:59:20Z nobu $ */
+
+/********************************************************************\
+ *
+ * FILE: rmd160.h
+ *
+ * CONTENTS: Header file for a sample C-implementation of the
+ * RIPEMD-160 hash-function.
+ * TARGET: any computer with an ANSI C compiler
+ *
+ * AUTHOR: Antoon Bosselaers, ESAT-COSIC
+ * DATE: 1 March 1996
+ * VERSION: 1.0
+ *
+ * Copyright (c) Katholieke Universiteit Leuven
+ * 1996, All Rights Reserved
+ *
+\********************************************************************/
+
+/*
+ * from OpenBSD: rmd160.h,v 1.4 1999/08/16 09:59:04 millert Exp
+ */
+
+#ifndef _RMD160_H_
+#define _RMD160_H_
+
+#include "defs.h"
+
+typedef struct {
+ uint32_t state[5]; /* state (ABCDE) */
+ uint32_t length[2]; /* number of bits */
+ uint8_t bbuffer[64]; /* overflow buffer */
+ uint32_t buflen; /* number of chars in bbuffer */
+} RMD160_CTX;
+
+#ifdef RUBY
+#define RMD160_Init rb_Digest_RMD160_Init
+#define RMD160_Transform rb_Digest_RMD160_Transform
+#define RMD160_Update rb_Digest_RMD160_Update
+#define RMD160_Finish rb_Digest_RMD160_Finish
+#endif
+
+__BEGIN_DECLS
+int RMD160_Init _((RMD160_CTX *));
+void RMD160_Transform _((uint32_t[5], const uint32_t[16]));
+void RMD160_Update _((RMD160_CTX *, const uint8_t *, size_t));
+int RMD160_Finish _((RMD160_CTX *, uint8_t[20]));
+__END_DECLS
+
+#define RMD160_BLOCK_LENGTH 64
+#define RMD160_DIGEST_LENGTH 20
+#define RMD160_DIGEST_STRING_LENGTH (RMD160_DIGEST_LENGTH * 2 + 1)
+
+#endif /* !_RMD160_H_ */
diff --git a/jni/ruby/ext/digest/rmd160/rmd160init.c b/jni/ruby/ext/digest/rmd160/rmd160init.c
new file mode 100644
index 0000000..05978ec
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/rmd160init.c
@@ -0,0 +1,45 @@
+/* $RoughId: rmd160init.c,v 1.3 2001/07/13 20:00:43 knu Exp $ */
+/* $Id: rmd160init.c 47745 2014-09-30 08:29:02Z nobu $ */
+
+#include "digest.h"
+#if defined(HAVE_OPENSSL_RIPEMD_H)
+#include "rmd160ossl.h"
+#else
+#include "rmd160.h"
+#endif
+
+static const rb_digest_metadata_t rmd160 = {
+ RUBY_DIGEST_API_VERSION,
+ RMD160_DIGEST_LENGTH,
+ RMD160_BLOCK_LENGTH,
+ sizeof(RMD160_CTX),
+ (rb_digest_hash_init_func_t)RMD160_Init,
+ (rb_digest_hash_update_func_t)RMD160_Update,
+ (rb_digest_hash_finish_func_t)RMD160_Finish,
+};
+
+/*
+ * A class for calculating message digests using RIPEMD-160
+ * cryptographic hash function, designed by Hans Dobbertin, Antoon
+ * Bosselaers, and Bart Preneel.
+ */
+void
+Init_rmd160(void)
+{
+ VALUE mDigest, cDigest_Base, cDigest_RMD160;
+
+ rb_require("digest");
+
+#if 0
+ mDigest = rb_define_module("Digest"); /* let rdoc know */
+#endif
+ mDigest = rb_path2class("Digest");
+ cDigest_Base = rb_path2class("Digest::Base");
+
+ cDigest_RMD160 = rb_define_class_under(mDigest, "RMD160", cDigest_Base);
+
+#undef RUBY_UNTYPED_DATA_WARNING
+#define RUBY_UNTYPED_DATA_WARNING 0
+ rb_ivar_set(cDigest_RMD160, rb_intern("metadata"),
+ Data_Wrap_Struct(0, 0, 0, (void *)&rmd160));
+}
diff --git a/jni/ruby/ext/digest/rmd160/rmd160ossl.c b/jni/ruby/ext/digest/rmd160/rmd160ossl.c
new file mode 100644
index 0000000..9f97274
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/rmd160ossl.c
@@ -0,0 +1,8 @@
+/* $Id: rmd160ossl.c 25189 2009-10-02 12:04:37Z akr $ */
+
+#include "defs.h"
+#include "rmd160ossl.h"
+
+void RMD160_Finish(RMD160_CTX *ctx, char *buf) {
+ RIPEMD160_Final((unsigned char *)buf, ctx);
+}
diff --git a/jni/ruby/ext/digest/rmd160/rmd160ossl.h b/jni/ruby/ext/digest/rmd160/rmd160ossl.h
new file mode 100644
index 0000000..c7b1fd4
--- /dev/null
+++ b/jni/ruby/ext/digest/rmd160/rmd160ossl.h
@@ -0,0 +1,19 @@
+/* $Id: rmd160ossl.h 25189 2009-10-02 12:04:37Z akr $ */
+
+#ifndef RMD160OSSL_H_INCLUDED
+#define RMD160OSSL_H_INCLUDED
+
+#include <stddef.h>
+#include <openssl/ripemd.h>
+
+#define RMD160_CTX RIPEMD160_CTX
+
+#define RMD160_Init RIPEMD160_Init
+#define RMD160_Update RIPEMD160_Update
+
+#define RMD160_BLOCK_LENGTH RIPEMD160_CBLOCK
+#define RMD160_DIGEST_LENGTH RIPEMD160_DIGEST_LENGTH
+
+void RMD160_Finish(RMD160_CTX *ctx, char *buf);
+
+#endif