#include "ldap_pvt.h"
#include "lutil_md5.h"
+/* We should replace MD5 with a faster hash */
+#define HASH_BYTES LUTIL_MD5_BYTES
+#define HASH_CONTEXT lutil_MD5_CTX
+#define HASH_Init(c) lutil_MD5Init(c)
+#define HASH_Update(c,buf,len) lutil_MD5Update(c,buf,len)
+#define HASH_Final(d,c) lutil_MD5Final(d,c)
+
/* recycled validatation routines */
#define berValidate blobValidate
int i;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
mlen = strlen( mr->smr_oid );
for( i=0; values[i] != NULL; i++ ) {
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
values[i]->bv_val, values[i]->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[i] = ber_bvdup( &digest );
}
{
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value = (struct berval *) assertValue;
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
keys = ch_malloc( sizeof( struct berval * ) * 2 );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[0] = ber_bvdup( &digest );
keys[1] = NULL;
int i;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
for( i=0; values[i] != NULL; i++ ) {
struct berval *value = values[i];
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[i] = ber_bvdup( &digest );
}
{
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
keys = ch_malloc( sizeof( struct berval * ) * 2 );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[0] = ber_bvdup( &digest );
keys[1] = NULL;
ber_len_t i, nkeys;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
max = value->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1);
for( j=0; j<max; j++ ) {
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j],
SLAP_INDEX_SUBSTR_MAXLEN );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-j], j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
ber_len_t nkeys = 0;
size_t slen, mlen, klen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
return LDAP_SUCCESS;
}
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
j <= value->bv_len - SLAP_INDEX_SUBSTR_MAXLEN;
j += SLAP_INDEX_SUBSTR_STEP )
{
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-klen], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
int i;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
struct berval *value = ber_bvdup( values[i] );
ldap_pvt_str2upper( value->bv_val );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
ber_bvfree( value );
{
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
keys = ch_malloc( sizeof( struct berval * ) * 2 );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[0] = ber_bvdup( &digest );
keys[1] = NULL;
ber_len_t i, nkeys;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
max = value->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1);
for( j=0; j<max; j++ ) {
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j],
SLAP_INDEX_SUBSTR_MAXLEN );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-j], j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
ber_len_t nkeys = 0;
size_t slen, mlen, klen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
return LDAP_SUCCESS;
}
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
ber_bvfree( value );
keys[nkeys++] = ber_bvdup( &digest );
j <= value->bv_len - SLAP_INDEX_SUBSTR_MAXLEN;
j += SLAP_INDEX_SUBSTR_STEP )
{
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-klen], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
ber_bvfree( value );
keys[nkeys++] = ber_bvdup( &digest );
int i;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
for( i=0; values[i] != NULL; i++ ) {
struct berval *value = values[i];
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[i] = ber_bvdup( &digest );
}
{
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
keys = ch_malloc( sizeof( struct berval * ) * 2 );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[0] = ber_bvdup( &digest );
keys[1] = NULL;
ber_len_t i, nkeys;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
max = value->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1);
for( j=0; j<max; j++ ) {
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j],
SLAP_INDEX_SUBSTR_MAXLEN );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-j], j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
ber_len_t nkeys = 0;
size_t slen, mlen, klen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
return LDAP_SUCCESS;
}
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
j <= value->bv_len - SLAP_INDEX_SUBSTR_MAXLEN;
j += SLAP_INDEX_SUBSTR_STEP )
{
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-klen], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
int i;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
struct berval *value = ber_bvdup( values[i] );
ldap_pvt_str2upper( value->bv_val );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
ber_bvfree( value );
{
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
keys = ch_malloc( sizeof( struct berval * ) * 2 );
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, value->bv_len );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[0] = ber_bvdup( &digest );
keys[1] = NULL;
ber_len_t i, nkeys;
size_t slen, mlen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval digest;
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
/* we should have at least one value at this point */
assert( values != NULL && values[0] != NULL );
max = value->bv_len - ( SLAP_INDEX_SUBSTR_MAXLEN - 1);
for( j=0; j<max; j++ ) {
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j],
SLAP_INDEX_SUBSTR_MAXLEN );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_INITIAL ) {
pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
if( flags & SLAP_INDEX_SUBSTR_FINAL ) {
pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-j], j );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
ber_len_t nkeys = 0;
size_t slen, mlen, klen;
struct berval **keys;
- lutil_MD5_CTX MD5context;
- unsigned char MD5digest[LUTIL_MD5_BYTES];
+ HASH_CONTEXT HASHcontext;
+ unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
return LDAP_SUCCESS;
}
- digest.bv_val = MD5digest;
- digest.bv_len = sizeof(MD5digest);
+ digest.bv_val = HASHdigest;
+ digest.bv_len = sizeof(HASHdigest);
slen = strlen( syntax->ssyn_oid );
mlen = strlen( mr->smr_oid );
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
value->bv_val, klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
ber_bvfree( value );
keys[nkeys++] = ber_bvdup( &digest );
j <= value->bv_len - SLAP_INDEX_SUBSTR_MAXLEN;
j += SLAP_INDEX_SUBSTR_STEP )
{
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[j], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
keys[nkeys++] = ber_bvdup( &digest );
}
klen = SLAP_INDEX_SUBSTR_MAXLEN < value->bv_len
? SLAP_INDEX_SUBSTR_MAXLEN : value->bv_len;
- lutil_MD5Init( &MD5context );
+ HASH_Init( &HASHcontext );
if( prefix != NULL && prefix->bv_len > 0 ) {
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
prefix->bv_val, prefix->bv_len );
}
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&pre, sizeof( pre ) );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
syntax->ssyn_oid, slen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
mr->smr_oid, mlen );
- lutil_MD5Update( &MD5context,
+ HASH_Update( &HASHcontext,
&value->bv_val[value->bv_len-klen], klen );
- lutil_MD5Final( MD5digest, &MD5context );
+ HASH_Final( HASHdigest, &HASHcontext );
ber_bvfree( value );
keys[nkeys++] = ber_bvdup( &digest );