Commit 17be959f authored by David Woodhouse's avatar David Woodhouse

Add openconnect_md5() function for NTLMv2

Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent ba7a9194
......@@ -2139,6 +2139,19 @@ int openconnect_sha1(unsigned char *result, void *data, int datalen)
return 0;
}
int openconnect_md5(unsigned char *result, void *data, int datalen)
{
gnutls_datum_t d;
size_t md5len = MD5_SIZE;
d.data = data;
d.size = datalen;
if (gnutls_fingerprint(GNUTLS_DIG_MD5, &d, result, &md5len))
return -1;
return 0;
}
int openconnect_random(void *bytes, int len)
{
if (gnutls_rnd(GNUTLS_RND_RANDOM, bytes, len))
......
......@@ -533,6 +533,7 @@ int cstp_handshake(struct openconnect_info *vpninfo, unsigned init);
int get_cert_md5_fingerprint(struct openconnect_info *vpninfo, OPENCONNECT_X509 *cert,
char *buf);
int openconnect_sha1(unsigned char *result, void *data, int len);
int openconnect_md5(unsigned char *result, void *data, int len);
int openconnect_random(void *bytes, int len);
int openconnect_local_cert_md5(struct openconnect_info *vpninfo,
char *buf);
......
......@@ -44,6 +44,17 @@ int openconnect_sha1(unsigned char *result, void *data, int len)
return 0;
}
int openconnect_md5(unsigned char *result, void *data, int len)
{
EVP_MD_CTX c;
EVP_MD_CTX_init(&c);
EVP_Digest(data, len, result, NULL, EVP_md5(), NULL);
EVP_MD_CTX_cleanup(&c);
return 0;
}
int openconnect_get_cert_DER(struct openconnect_info *vpninfo,
OPENCONNECT_X509 *cert, unsigned char **buf)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment