OSDN Git Service

1b435c5df8e3562bf92e9ba70b7c5774c9717b3f
[pf3gnuchains/gcc-fork.git] / libjava / gnu / gcj / io / shs.h
1 /* --------------------------------- SHS.H ------------------------------- */
2
3 /*
4  * NIST proposed Secure Hash Standard. 
5  *
6  * Written 2 September 1992, Peter C. Gutmann.
7  * This implementation placed in the public domain. 
8  *
9  * Comments to pgut1@cs.aukuni.ac.nz 
10  */
11
12 /* Useful defines/typedefs */
13
14 #ifndef SHS_H
15 #define SHS_H
16
17 #include<config.h>
18 #if HAVE_INTTYPES_H
19 # include <inttypes.h>
20 #else
21 # if HAVE_STDINT_H
22 #  include <stdint.h>
23 # else
24 typedef unsigned int uint8_t __attribute__((mode(QI)));
25 /* This is a blatant hack: on Solaris 2.5, pthread.h defines uint32_t
26    in pthread.h, which we sometimes include.  We protect our
27    definition the same way Solaris 2.5 does, to avoid redefining it.  */
28 #  ifndef _UINT32_T
29 typedef unsigned int uint32_t __attribute__((mode(SI)));
30 #  endif
31 # endif
32 #endif
33
34 /* The SHS block size and message digest sizes, in bytes */
35
36 #define SHS_BLOCKSIZE   64
37 #define SHS_DIGESTSIZE  20
38
39 /* The structure for storing SHS info */
40
41 typedef struct {
42        uint32_t digest [5];    /* Message digest */
43        uint32_t countLo, countHi;      /* 64-bit bit count */
44        uint32_t data [16];             /* SHS data buffer */
45 } SHS_INFO;
46
47 /* Turn off prototypes if requested */
48 #if (defined(NOPROTO) && defined(PROTO))
49 #       undef PROTO
50 #endif
51
52 /* Used to remove arguments in function prototypes for non-ANSI C */
53 #ifdef PROTO
54 #       define OF(a) a
55 #else   /* !PROTO */
56 #       define OF(a) ()
57 #endif  /* ?PROTO */
58
59 #define local   static
60
61 void shsInit OF((SHS_INFO *shsInfo));
62 void shsUpdate OF((SHS_INFO *shsInfo, uint8_t *buffer, int count));
63 void shsFinal OF((SHS_INFO *shsInfo));
64
65 #endif