blob: 5a3903dad30b888f306901c4e01b37f7324ecc0d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
/*
* $Id: md5.c,v 1.1 2004/11/14 07:26:26 paulus Exp $
*/
#include <stddef.h>
#include <pppd/ppp-crypto.h>
int rc_md5_calc(unsigned char *out, const unsigned char *in, unsigned int inl)
{
int retval = 0;
int outl = MD5_DIGEST_LENGTH;
PPP_MD_CTX *ctx = PPP_MD_CTX_new();
if (ctx) {
if (PPP_DigestInit(ctx, PPP_md5())) {
if (PPP_DigestUpdate(ctx, in, inl)) {
if (PPP_DigestFinal(ctx, out, &outl)) {
retval = 1;
}
}
}
PPP_MD_CTX_free(ctx);
}
return retval;
}
|