1 /* $OpenBSD: sha1.h,v 1.24 2012/12/05 23:19:57 deraadt Exp $ */
5 * By Steve Reid <steve@edmweb.com>
14 #define SHA1_BLOCK_LENGTH 64
15 #define SHA1_DIGEST_LENGTH 20
16 #define SHA1_DIGEST_STRING_LENGTH (SHA1_DIGEST_LENGTH * 2 + 1)
21 u_int8_t buffer
[SHA1_BLOCK_LENGTH
];
24 void SHA1Init(SHA1_CTX
*);
25 void SHA1Pad(SHA1_CTX
*);
26 void SHA1Transform(u_int32_t
[5], const u_int8_t
[SHA1_BLOCK_LENGTH
])
27 __attribute__((__bounded__(__minbytes__
,1,5)))
28 __attribute__((__bounded__(__minbytes__
,2,SHA1_BLOCK_LENGTH
)));
29 void SHA1Update(SHA1_CTX
*, const u_int8_t
*, size_t)
30 __attribute__((__bounded__(__string__
,2,3)));
31 void SHA1Final(u_int8_t
[SHA1_DIGEST_LENGTH
], SHA1_CTX
*)
32 __attribute__((__bounded__(__minbytes__
,1,SHA1_DIGEST_LENGTH
)));
33 char *SHA1End(SHA1_CTX
*, char *)
34 __attribute__((__bounded__(__minbytes__
,2,SHA1_DIGEST_STRING_LENGTH
)));
35 char *SHA1File(const char *, char *)
36 __attribute__((__bounded__(__minbytes__
,2,SHA1_DIGEST_STRING_LENGTH
)));
37 char *SHA1FileChunk(const char *, char *, off_t
, off_t
)
38 __attribute__((__bounded__(__minbytes__
,2,SHA1_DIGEST_STRING_LENGTH
)));
39 char *SHA1Data(const u_int8_t
*, size_t, char *)
40 __attribute__((__bounded__(__string__
,1,2)))
41 __attribute__((__bounded__(__minbytes__
,3,SHA1_DIGEST_STRING_LENGTH
)));
43 #define HTONDIGEST(x) do { \
48 x[4] = htonl(x[4]); } while (0)
50 #define NTOHDIGEST(x) do { \
55 x[4] = ntohl(x[4]); } while (0)
57 #endif /* !WITH_OPENSSL */