Back to index

openldap  2.4.31
lutil_md5.h
Go to the documentation of this file.
00001 /* $OpenLDAP$ */
00002 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00003  *
00004  * Copyright 1998-2012 The OpenLDAP Foundation.
00005  * All rights reserved.
00006  *
00007  * Redistribution and use in source and binary forms, with or without
00008  * modification, are permitted only as authorized by the OpenLDAP
00009  * Public License.
00010  *
00011  * A copy of this license is available in file LICENSE in the
00012  * top-level directory of the distribution or, alternatively, at
00013  * <http://www.OpenLDAP.org/license.html>.
00014  */
00015 
00016 #ifndef _LUTIL_MD5_H_
00017 #define _LUTIL_MD5_H_
00018 
00019 #include <lber_types.h>
00020 
00021 LDAP_BEGIN_DECL
00022 
00023 /* Unlike previous versions of this code, ber_int_t need not be exactly
00024    32 bits, merely 32 bits or more.  Choosing a data type which is 32
00025    bits instead of 64 is not important; speed is considerably more
00026    important.  ANSI guarantees that "unsigned long" will be big enough,
00027    and always using it seems to have few disadvantages.  */
00028 
00029 #define LUTIL_MD5_BYTES 16
00030 
00031 struct lutil_MD5Context {
00032        ber_uint_t buf[4];
00033        ber_uint_t bits[2];
00034        unsigned char in[64];
00035 };
00036 
00037 LDAP_LUTIL_F( void )
00038 lutil_MD5Init LDAP_P((
00039        struct lutil_MD5Context *context));
00040 
00041 LDAP_LUTIL_F( void )
00042 lutil_MD5Update LDAP_P((
00043        struct lutil_MD5Context *context,
00044        unsigned char const *buf,
00045        ber_len_t len));
00046 
00047 LDAP_LUTIL_F( void )
00048 lutil_MD5Final LDAP_P((
00049        unsigned char digest[16],
00050        struct lutil_MD5Context *context));
00051 
00052 LDAP_LUTIL_F( void )
00053 lutil_MD5Transform LDAP_P((
00054        ber_uint_t buf[4],
00055        const unsigned char in[64]));
00056 
00057 /*
00058  * This is needed to make RSAREF happy on some MS-DOS compilers.
00059  */
00060 typedef struct lutil_MD5Context lutil_MD5_CTX;
00061 
00062 LDAP_END_DECL
00063 
00064 #endif /* _LUTIL_MD5_H_ */