1/* $OpenLDAP$ */ 2/* This work is part of OpenLDAP Software <http://www.openldap.org/>. 3 * 4 * Copyright 1998-2011 The OpenLDAP Foundation. 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted only as authorized by the OpenLDAP 9 * Public License. 10 * 11 * A copy of this license is available in file LICENSE in the 12 * top-level directory of the distribution or, alternatively, at 13 * <http://www.OpenLDAP.org/license.html>. 14 */ 15 16#ifndef _LUTIL_MD5_H_ 17#define _LUTIL_MD5_H_ 18 19#include <lber_types.h> 20 21LDAP_BEGIN_DECL 22 23/* Unlike previous versions of this code, ber_int_t need not be exactly 24 32 bits, merely 32 bits or more. Choosing a data type which is 32 25 bits instead of 64 is not important; speed is considerably more 26 important. ANSI guarantees that "unsigned long" will be big enough, 27 and always using it seems to have few disadvantages. */ 28 29#define LUTIL_MD5_BYTES 16 30 31struct lutil_MD5Context { 32 ber_uint_t buf[4]; 33 ber_uint_t bits[2]; 34 unsigned char in[64]; 35}; 36 37LDAP_LUTIL_F( void ) 38lutil_MD5Init LDAP_P(( 39 struct lutil_MD5Context *context)); 40 41LDAP_LUTIL_F( void ) 42lutil_MD5Update LDAP_P(( 43 struct lutil_MD5Context *context, 44 unsigned char const *buf, 45 ber_len_t len)); 46 47LDAP_LUTIL_F( void ) 48lutil_MD5Final LDAP_P(( 49 unsigned char digest[16], 50 struct lutil_MD5Context *context)); 51 52LDAP_LUTIL_F( void ) 53lutil_MD5Transform LDAP_P(( 54 ber_uint_t buf[4], 55 const unsigned char in[64])); 56 57/* 58 * This is needed to make RSAREF happy on some MS-DOS compilers. 59 */ 60typedef struct lutil_MD5Context lutil_MD5_CTX; 61 62LDAP_END_DECL 63 64#endif /* _LUTIL_MD5_H_ */ 65