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