cram_md5.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include "lber.h"
#include "ldap.h"
#include "ldap-int.h"
#include <strings.h>
#include "sec.h"
/* text is the challenge, key is the password, digest is an allocated
buffer (min 16 chars) which will contain the resulting digest */
{
unsigned char k_ipad[65];
unsigned char k_opad[65];
unsigned char tk[16];
int i;
if (key_len > 64){
key_len = 16;
}
for (i=0; i<64; i++){
k_ipad[i] ^= 0x36;
k_opad[i] ^= 0x5c;
}
/* Perform inner MD5 */
/* Perform outer MD5 */
return;
}
char *dn,
{
int res;
unsigned char digest[16];
char *theHDigest;
return (LDAP_PARAM_ERROR);
}
if ((res = ldap_sasl_bind_s(ld, NULL, LDAP_SASL_CRAM_MD5, NULL, serverctrls, clientctrls, &challenge))
return (res);
}
return (LDAP_PARAM_ERROR);
}
if (theHDigest == NULL){
return (LDAP_NO_MEMORY);
}
return(LDAP_NO_MEMORY);
}
return (res);
}