diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-05-25 09:56:14 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2013-05-25 10:50:21 +0200 |
commit | ed6766e3fed3aceb172cee68a29e60c545aba7c5 (patch) | |
tree | c212256b8c9e2fe4a4c0ca4c5803fb4f3d1baa8e /extra/gnutls_openssl.c | |
parent | 85117f89d6dc053f9acc4bd05479f9cdd8fcc933 (diff) | |
download | gnutls-ed6766e3fed3aceb172cee68a29e60c545aba7c5.tar.gz |
modified openssl compat API to use the exported API
Diffstat (limited to 'extra/gnutls_openssl.c')
-rw-r--r-- | extra/gnutls_openssl.c | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/extra/gnutls_openssl.c b/extra/gnutls_openssl.c index e8cbe675d3..c43ae08b69 100644 --- a/extra/gnutls_openssl.c +++ b/extra/gnutls_openssl.c @@ -847,23 +847,22 @@ RAND_egd_bytes (const char *path, int bytes) void MD5_Init (MD5_CTX * ctx) { - ctx->handle = gnutls_malloc (sizeof (digest_hd_st)); - if (!ctx->handle) +int ret; + ret = gnutls_hash_init((void*)&ctx->handle, GNUTLS_DIG_MD5); + if (ret < 0) abort (); - _gnutls_hash_init (ctx->handle, GNUTLS_DIG_MD5); } void MD5_Update (MD5_CTX * ctx, const void *buf, int len) { - _gnutls_hash (ctx->handle, buf, len); + gnutls_hash (ctx->handle, buf, len); } void MD5_Final (unsigned char *md, MD5_CTX * ctx) { - _gnutls_hash_deinit (ctx->handle, md); - gnutls_free (ctx->handle); + gnutls_hash_deinit (ctx->handle, md); } unsigned char * @@ -872,7 +871,7 @@ MD5 (const unsigned char *buf, unsigned long len, unsigned char *md) if (!md) return NULL; - _gnutls_hash_fast (GNUTLS_DIG_MD5, buf, len, md); + gnutls_hash_fast (GNUTLS_DIG_MD5, buf, len, md); return md; } @@ -880,23 +879,22 @@ MD5 (const unsigned char *buf, unsigned long len, unsigned char *md) void RIPEMD160_Init (RIPEMD160_CTX * ctx) { - ctx->handle = gnutls_malloc (sizeof (digest_hd_st)); - if (!ctx->handle) +int ret; + ret = gnutls_hash_init((void*)&ctx->handle, GNUTLS_DIG_RMD160); + if (ret < 0) abort (); - _gnutls_hash_init (ctx->handle, GNUTLS_DIG_RMD160); } void RIPEMD160_Update (RIPEMD160_CTX * ctx, const void *buf, int len) { - _gnutls_hash (ctx->handle, buf, len); + gnutls_hash (ctx->handle, buf, len); } void RIPEMD160_Final (unsigned char *md, RIPEMD160_CTX * ctx) { - _gnutls_hash_deinit (ctx->handle, md); - gnutls_free (ctx->handle); + gnutls_hash_deinit (ctx->handle, md); } unsigned char * @@ -905,7 +903,7 @@ RIPEMD160 (const unsigned char *buf, unsigned long len, unsigned char *md) if (!md) return NULL; - _gnutls_hash_fast (GNUTLS_DIG_RMD160, buf, len, md); + gnutls_hash_fast (GNUTLS_DIG_RMD160, buf, len, md); return md; } |