mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-02 22:46:30 +02:00
added zlib and reorgnaized some stuff
This commit is contained in:
parent
bc5789665a
commit
fec94908c3
52 changed files with 8138 additions and 356 deletions
|
@ -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@
|
||||
|
|
37
cipher/md.c
37
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;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -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*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue