1/*	$NetBSD: lutil_md5.h,v 1.3 2021/08/14 16:14:55 christos Exp $	*/
2
3/* $OpenLDAP$ */
4/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 *
6 * Copyright 1998-2021 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
23LDAP_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
33struct lutil_MD5Context {
34	ber_uint_t buf[4];
35	ber_uint_t bits[2];
36	unsigned char in[64];
37};
38
39LDAP_LUTIL_F( void )
40lutil_MD5Init LDAP_P((
41	struct lutil_MD5Context *context));
42
43LDAP_LUTIL_F( void )
44lutil_MD5Update LDAP_P((
45	struct lutil_MD5Context *context,
46	unsigned char const *buf,
47	ber_len_t len));
48
49LDAP_LUTIL_F( void )
50lutil_MD5Final LDAP_P((
51	unsigned char digest[16],
52	struct lutil_MD5Context *context));
53
54LDAP_LUTIL_F( void )
55lutil_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 */
62typedef struct lutil_MD5Context lutil_MD5_CTX;
63
64LDAP_END_DECL
65
66#endif /* _LUTIL_MD5_H_ */
67