[BACK]Return to sha1.h CVS log [TXT][DIR] Up to [local] / src / include

Annotation of src/include/sha1.h, Revision 1.16

1.16    ! espie       1: /*     $OpenBSD: sha1.h,v 1.15 2003/10/07 22:17:27 avsm Exp $  */
1.5       millert     2:
                      3: /*
                      4:  * SHA-1 in C
                      5:  * By Steve Reid <steve@edmweb.com>
                      6:  * 100% Public Domain
                      7:  */
1.1       millert     8:
1.2       millert     9: #ifndef _SHA1_H
                     10: #define _SHA1_H
                     11:
1.1       millert    12: typedef struct {
1.5       millert    13:     u_int32_t state[5];
1.11      millert    14:     u_int32_t count[2];
1.16    ! espie      15:     unsigned char buffer[64];
1.5       millert    16: } SHA1_CTX;
1.11      millert    17:
                     18: #include <sys/cdefs.h>
                     19:
                     20: __BEGIN_DECLS
1.16    ! espie      21: void SHA1Transform(u_int32_t [5], const unsigned char [64])
1.15      avsm       22:                __attribute__((__bounded__(__minbytes__,1,5)))
                     23:                __attribute__((__bounded__(__minbytes__,2,64)));
1.16    ! espie      24: void SHA1Init(SHA1_CTX *);
        !            25: void SHA1Update(SHA1_CTX *, const unsigned char *, unsigned int)
1.15      avsm       26:                __attribute__((__bounded__(__string__,2,3)));
1.16    ! espie      27: void SHA1Final(unsigned char [20], SHA1_CTX *)
1.15      avsm       28:                __attribute__((__bounded__(__minbytes__,1,20)));
                     29: char *SHA1End(SHA1_CTX *, char *)
                     30:                __attribute__((__bounded__(__minbytes__,2,41)));
                     31: char *SHA1File(char *, char *)
                     32:                __attribute__((__bounded__(__minbytes__,2,41)));
1.16    ! espie      33: char *SHA1Data(const unsigned char *, size_t, char *)
1.15      avsm       34:                __attribute__((__bounded__(__string__,1,2)))
                     35:                __attribute__((__bounded__(__minbytes__,3,41)));
1.11      millert    36: __END_DECLS
1.9       angelos    37:
                     38: #define SHA1_DIGESTSIZE       20
                     39: #define SHA1_BLOCKSIZE        64
1.11      millert    40: #define HTONDIGEST(x) do {                                              \
                     41:         x[0] = htonl(x[0]);                                             \
                     42:         x[1] = htonl(x[1]);                                             \
                     43:         x[2] = htonl(x[2]);                                             \
                     44:         x[3] = htonl(x[3]);                                             \
                     45:         x[4] = htonl(x[4]); } while (0)
                     46:
                     47: #define NTOHDIGEST(x) do {                                              \
                     48:         x[0] = ntohl(x[0]);                                             \
                     49:         x[1] = ntohl(x[1]);                                             \
                     50:         x[2] = ntohl(x[2]);                                             \
                     51:         x[3] = ntohl(x[3]);                                             \
                     52:         x[4] = ntohl(x[4]); } while (0)
1.2       millert    53:
                     54: #endif /* _SHA1_H */