aboutsummaryrefslogtreecommitdiffstats
path: root/cipher
diff options
context:
space:
mode:
Diffstat (limited to 'cipher')
-rw-r--r--cipher/Makefile.in3
-rw-r--r--cipher/md.c37
-rw-r--r--cipher/md.h1
3 files changed, 40 insertions, 1 deletions
diff --git a/cipher/Makefile.in b/cipher/Makefile.in
index e4ab5edac..aba727a92 100644
--- a/cipher/Makefile.in
+++ b/cipher/Makefile.in
@@ -72,7 +72,6 @@ G10_LOCALEDIR = @G10_LOCALEDIR@
GENCAT = @GENCAT@
GMOFILES = @GMOFILES@
GMSGFMT = @GMSGFMT@
-HAVE_ZLIB_H = @HAVE_ZLIB_H@
INSTOBJEXT = @INSTOBJEXT@
INTLDEPS = @INTLDEPS@
INTLLIBS = @INTLLIBS@
@@ -85,6 +84,8 @@ POFILES = @POFILES@
POSUB = @POSUB@
RANLIB = @RANLIB@
VERSION = @VERSION@
+ZLIBS = @ZLIBS@
+ZLIB_SUBDIR = @ZLIB_SUBDIR@
INCLUDES = -I$(top_srcdir)/include
EXTRA_DIST = @CIPHER_EXTRA_DIST@
diff --git a/cipher/md.c b/cipher/md.c
index c87f3286b..46083960f 100644
--- a/cipher/md.c
+++ b/cipher/md.c
@@ -28,6 +28,7 @@
#include "errors.h"
+
/*static FILE *dumpfp;*/
/****************
@@ -176,3 +177,39 @@ md_get_algo( MD_HANDLE a )
return 0;
}
+
+const byte *
+md_asn_oid( int algo, size_t *asnlen, size_t *mdlen )
+{
+ size_t alen, mlen;
+ byte *p;
+
+ if( algo == DIGEST_ALGO_MD5 ) {
+ static byte asn[18] = /* Object ID is 1.2.840.113549.2.5 */
+ { 0x30, 0x20, 0x30, 0x0c, 0x06, 0x08, 0x2a, 0x86,0x48,
+ 0x86, 0xf7, 0x0d, 0x02, 0x05, 0x05, 0x00, 0x04, 0x10 };
+ mlen = 16; alen = DIM(asn); p = asn;
+ }
+ else if( algo == DIGEST_ALGO_RMD160 ) {
+ static byte asn[15] = /* Object ID is 1.3.36.3.2.1 */
+ { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x24, 0x03,
+ 0x02, 0x01, 0x05, 0x00, 0x04, 0x14 };
+ mlen = 20; alen = DIM(asn); p = asn;
+ }
+ else if( algo == DIGEST_ALGO_SHA1 ) {
+ static byte asn[15] = /* Objet ID is 1.3.14.3.2.26 */
+ { 0x30, 0x21, 0x30, 0x09, 0x06, 0x05, 0x2b, 0x0e, 0x03,
+ 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14 };
+ mlen = 20; alen = DIM(asn); p = asn;
+ }
+ else
+ log_bug("md_asn_oid(%d)", algo );
+
+ if( asnlen )
+ *asnlen = alen;
+ if( mdlen )
+ *mdlen = mlen;
+ return p;
+}
+
+
diff --git a/cipher/md.h b/cipher/md.h
index 7a710e795..fc5d28df6 100644
--- a/cipher/md.h
+++ b/cipher/md.h
@@ -56,6 +56,7 @@ void md_write( MD_HANDLE a, byte *inbuf, size_t inlen);
void md_final(MD_HANDLE a);
byte *md_read( MD_HANDLE a, int algo );
int md_get_algo( MD_HANDLE a );
+const byte *md_asn_oid( int algo, size_t *asnlen, size_t *mdlen );
#define md_is_secure(a) ((a)->secure)
#endif /*G10_MD_H*/