]> git.sur5r.net Git - openldap/blob - include/lutil_sha1.h
First cut at ber_set_option(NULL,LBER_OPT_MEMORY_FN, myrealloc) where
[openldap] / include / lutil_sha1.h
1 /*
2  * Copyright 1998,1999 The OpenLDAP Foundation, Redwood City, California, USA
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted only
6  * as authorized by the OpenLDAP Public License.  A copy of this
7  * license is available at http://www.OpenLDAP.org/license.html or
8  * in file LICENSE in the top-level directory of the distribution.
9  */
10
11 /* This version is based on:
12  *      $OpenBSD: sha1.h,v 1.8 1997/07/15 01:54:23 millert Exp $        */
13
14 #ifndef _LUTIL_SHA1_H_
15 #define _LUTIL_SHA1_H_
16
17 #include <ldap_cdefs.h>
18 #include <ac/bytes.h>
19
20 LDAP_BEGIN_DECL
21
22 /*
23  * SHA-1 in C
24  * By Steve Reid <steve@edmweb.com>
25  * 100% Public Domain
26  */
27
28 #ifndef LDAP_UINT32
29 #define LDAP_UINT32 1
30 typedef LDAP_UINT4 uint32;
31 #endif
32
33 typedef struct {
34     uint32 state[5];
35     uint32 count[2];  
36     unsigned char buffer[64];
37 } lutil_SHA1_CTX;
38   
39 LDAP_F( void )
40 lutil_SHA1Transform
41         LDAP_P((uint32 state[5], const unsigned char buffer[64]));
42
43 LDAP_F( void  )
44 lutil_SHA1Init
45         LDAP_P((lutil_SHA1_CTX *context));
46
47 LDAP_F( void  )
48 lutil_SHA1Update
49         LDAP_P((lutil_SHA1_CTX *context, const unsigned char *data, uint32 len));
50
51 LDAP_F( void  )
52 lutil_SHA1Final
53         LDAP_P((unsigned char digest[20], lutil_SHA1_CTX *context));
54
55 LDAP_F( char * )
56 lutil_SHA1End
57         LDAP_P((lutil_SHA1_CTX *, char *));
58
59 LDAP_F( char * )
60 lutil_SHA1File
61         LDAP_P((char *, char *));
62
63 LDAP_F( char * )
64 lutil_SHA1Data
65         LDAP_P((const unsigned char *, size_t, char *));
66
67 LDAP_END_DECL
68
69 #endif /* _LUTIL_SHA1_H_ */