~ttx/openldap/lucid-gssapi-495418

« back to all changes in this revision

Viewing changes to include/lutil_sha1.h

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2008-07-10 14:45:49 UTC
  • Revision ID: james.westby@ubuntu.com-20080710144549-wck73med0e72gfyo
Tags: upstream-2.4.10
ImportĀ upstreamĀ versionĀ 2.4.10

Show diffs side-by-side

added added

removed removed

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