mirror of
https://github.com/3proxy/3proxy.git
synced 2026-11-26 23:59:41 +08:00
Use native Windows crypto for MD4/MD5
This commit is contained in:
1 parent
37b1ab8169
commit
fbc0953d5c
8 files changed
+241
-85
No files matched your search
+8
-11
@@ -8,6 +8,7 @@
|
||||
|
||||
#ifndef NORADIUS
|
||||
#include "proxy.h"
|
||||
#include "mdhash.h"
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#define AUTH_VECTOR_LEN 16
|
||||
@@ -185,7 +186,7 @@ char *strNcpy(char *dest, const char *src, int n)
|
||||
return dest;
|
||||
}
|
||||
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
#if !defined(_WIN32) && OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
extern EVP_MD *md4_hash;
|
||||
extern EVP_MD *md5_hash;
|
||||
#endif
|
||||
@@ -194,16 +195,12 @@ extern EVP_MD *md5_hash;
|
||||
void md5_calc(unsigned char *output, unsigned char *input,
|
||||
unsigned int inlen)
|
||||
{
|
||||
EVP_MD_CTX *ctx = EVP_MD_CTX_new();
|
||||
unsigned int len = 0;
|
||||
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
|
||||
EVP_DigestInit_ex(ctx, md5_hash, NULL);
|
||||
#else
|
||||
EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
|
||||
#endif
|
||||
EVP_DigestUpdate(ctx, input, inlen);
|
||||
EVP_DigestFinal_ex(ctx, output, &len);
|
||||
EVP_MD_CTX_free(ctx);
|
||||
mdh_ctx *ctx = mdh_init(MDH_MD5);
|
||||
unsigned int len = 16;
|
||||
if(!ctx) return;
|
||||
mdh_update(ctx, input, inlen);
|
||||
mdh_final(ctx, output, &len);
|
||||
mdh_free(ctx);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user