mirror of
https://github.com/openssl/openssl.git
synced 2024-12-09 05:51:54 +08:00
95ffe86dbc
His own words are: The patch adds no new functionality (other than a simple test package) to the libraries, but it allows them to be compiled with Perl5.6.0. It has only been tested under "Red Hat Linux release 7.0 (Guinness)" with the unpatched verion of OpenSSL 0.9.6 released last September.
86 lines
1.5 KiB
Plaintext
86 lines
1.5 KiB
Plaintext
|
|
#include "openssl.h"
|
|
|
|
int boot_digest()
|
|
{
|
|
SSLeay_add_all_digests();
|
|
return(1);
|
|
}
|
|
|
|
MODULE = OpenSSL::MD PACKAGE = OpenSSL::MD PREFIX = p5_EVP_MD_
|
|
|
|
PROTOTYPES: ENABLE
|
|
VERSIONCHECK: DISABLE
|
|
|
|
# OpenSSL::MD::new(name) name= md2, md5, sha, sha1, or mdc2
|
|
# md->name() - returns the name
|
|
# md->init() - reinitalises the digest
|
|
# md->update(data) - adds more data to digest
|
|
# digest=md->final() - returns digest
|
|
#
|
|
|
|
void
|
|
p5_EVP_MD_new(...)
|
|
PREINIT:
|
|
EVP_MD_CTX *ctx;
|
|
const EVP_MD *md;
|
|
char *name;
|
|
PPCODE:
|
|
if ((items == 1) && SvPOK(ST(0)))
|
|
name=SvPV_nolen(ST(0));
|
|
else if ((items == 2) && SvPOK(ST(1)))
|
|
name=SvPV_nolen(ST(1));
|
|
else
|
|
croak("Usage: OpenSSL::MD::new(type)");
|
|
PUSHs(sv_newmortal());
|
|
md=EVP_get_digestbyname(name);
|
|
if (md != NULL)
|
|
{
|
|
ctx=malloc(sizeof(EVP_MD_CTX));
|
|
EVP_DigestInit(ctx,md);
|
|
sv_setref_pv(ST(0), "OpenSSL::MD", (void*)ctx);
|
|
}
|
|
|
|
datum
|
|
p5_EVP_MD_name(ctx)
|
|
EVP_MD_CTX *ctx
|
|
CODE:
|
|
RETVAL.dptr=OBJ_nid2ln(EVP_MD_CTX_type(ctx));
|
|
RETVAL.dsize=strlen(RETVAL.dptr);
|
|
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
void
|
|
p5_EVP_MD_init(ctx)
|
|
EVP_MD_CTX *ctx
|
|
CODE:
|
|
EVP_DigestInit(ctx,EVP_MD_CTX_type(ctx));
|
|
|
|
void
|
|
p5_EVP_MD_update(ctx, in)
|
|
EVP_MD_CTX *ctx
|
|
datum in
|
|
CODE:
|
|
EVP_DigestUpdate(ctx,in.dptr,in.dsize);
|
|
|
|
datum
|
|
p5_EVP_MD_final(ctx)
|
|
EVP_MD_CTX *ctx
|
|
PREINIT:
|
|
char md[EVP_MAX_MD_SIZE];
|
|
int len;
|
|
CODE:
|
|
EVP_DigestFinal(ctx,md,&len);
|
|
RETVAL.dptr=md;
|
|
RETVAL.dsize=len;
|
|
OUTPUT:
|
|
RETVAL
|
|
|
|
void
|
|
p5_EVP_MD_DESTROY(ctx)
|
|
EVP_MD_CTX *ctx
|
|
CODE:
|
|
free((char *)ctx);
|
|
|