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