| 1 |
/* -*- Mode: C; c-file-style: "stroustrup" -*- */cxx . . $ `<file>/sha1.h`/ |
| 2 |
|
| 3 |
#if !defined( _sha1_h ) |
| 4 |
#define _sha1_hcxx . . $ `sha1.h:4:9`! |
| 5 |
|
| 6 |
/* for size_t */ |
| 7 |
#include <string.h> |
| 8 |
#include "types.h"cxx . . $ `<file>/types.h`/ |
| 9 |
|
| 10 |
#if defined( __cplusplus ) |
| 11 |
extern "C" { |
| 12 |
#endif |
| 13 |
|
| 14 |
#define SHA1_INPUT_BYTEScxx . . $ `sha1.h:14:9`! 64 /* 512 bits */ |
| 15 |
#define SHA1_INPUT_WORDScxx . . $ `sha1.h:15:9`! ( SHA1_INPUT_BYTEScxx . . $ `sha1.h:14:9`! >> 2 ) |
| 16 |
#define SHA1_DIGEST_WORDScxx . . $ `sha1.h:16:9`! 5 /* 160 bits */ |
| 17 |
#define SHA1_DIGEST_BYTEScxx . . $ `sha1.h:17:9`! ( SHA1_DIGEST_WORDScxx . . $ `sha1.h:16:9`! * 4 ) |
| 18 |
|
| 19 |
#if defined( OPENSSL ) |
| 20 |
|
| 21 |
#include <openssl/sha.h> |
| 22 |
#define SHA1_ctx SHA_CTX |
| 23 |
#define SHA1_Final( ctx, digest ) SHA1_Final( digest, ctx ) |
| 24 |
#undef SHA1_DIGEST_BYTES |
| 25 |
#define SHA1_DIGEST_BYTES SHA_DIGEST_LENGTH |
| 26 |
|
| 27 |
#define SHA1_Init_With_IV( ctx, iv ) \ |
| 28 |
do { \ |
| 29 |
(ctx)->h0 = iv[0]; \ |
| 30 |
(ctx)->h1 = iv[1]; \ |
| 31 |
(ctx)->h2 = iv[2]; \ |
| 32 |
(ctx)->h3 = iv[3]; \ |
| 33 |
(ctx)->h4 = iv[4]; \ |
| 34 |
(ctx)->Nh = 0; \ |
| 35 |
(ctx)->Nl = 0; \ |
| 36 |
(ctx)->num = 0l \ |
| 37 |
} while (0) |
| 38 |
|
| 39 |
#define SHA1_Transform( iv, data ) SHA1_Xform( iv, data ) |
| 40 |
|
| 41 |
#else |
| 42 |
|
| 43 |
typedef structcxx . . $ $anonymous_type_e14a02f8ac1b0f5_0# { |
| 44 |
word32cxx . . $ `types.h:24:13`! Hcxx . . $ $anonymous_type_e14a02f8ac1b0f5_0#H.[ SHA1_DIGEST_WORDScxx . . $ `sha1.h:16:9`! ]; |
| 45 |
#if defined( word64cxx . . $ `types.h:26:13`! ) |
| 46 |
word64cxx . . $ `types.h:26:13`! bitscxx . . $ $anonymous_type_e14a02f8ac1b0f5_0#bits.; /* we want a 64 bit word */ |
| 47 |
#else |
| 48 |
word32 hbits, lbits; /* if we don't have one we simulate it */ |
| 49 |
#endif |
| 50 |
bytecxx . . $ `types.h:10:9`! Mcxx . . $ $anonymous_type_e14a02f8ac1b0f5_0#M.[ SHA1_INPUT_BYTEScxx . . $ `sha1.h:14:9`! ]; |
| 51 |
} SHA1_ctxcxx . . $ SHA1_ctx#; |
| 52 |
|
| 53 |
void SHA1_Initcxx . . $ SHA1_Init(af9674f54835bdd6). ( SHA1_ctxcxx . . $ SHA1_ctx#* ); |
| 54 |
void SHA1_Updatecxx . . $ SHA1_Update(52847939212327bf).( SHA1_ctxcxx . . $ SHA1_ctx#*, const void*, size_t ); |
| 55 |
void SHA1_Finalcxx . . $ SHA1_Final(55a8d51a077ef09d). ( SHA1_ctxcxx . . $ SHA1_ctx#*, bytecxx . . $ `types.h:10:9`![ SHA1_DIGEST_BYTEScxx . . $ `sha1.h:17:9`! ] ); |
| •56 |
void SHA1_Transformcxx . . $ SHA1_Transform(7cc3180c6a470cbb).( word32cxx . . $ `types.h:24:13`! H[ SHA1_DIGEST_WORDScxx . . $ `sha1.h:16:9`! ], |
| 57 |
const bytecxx . . $ `types.h:10:9`! M[ SHA1_INPUT_BYTEScxx . . $ `sha1.h:14:9`! ] ); |
| 58 |
|
| 59 |
/* these provide extra access to internals of SHA1 for MDC and MACs */ |
| 60 |
|
| 61 |
void SHA1_Init_With_IVcxx . . $ SHA1_Init_With_IV(3690833e35d3762).( SHA1_ctxcxx . . $ SHA1_ctx#*, const bytecxx . . $ `types.h:10:9`![ SHA1_DIGEST_BYTEScxx . . $ `sha1.h:17:9`! ] ); |
| 62 |
|
| 63 |
#endif |
| 64 |
|
| 65 |
void SHA1_Xformcxx . . $ SHA1_Xform(7cc3180c6a470cbb).( word32cxx . . $ `types.h:24:13`![ SHA1_DIGEST_WORDScxx . . $ `sha1.h:16:9`! ], |
| 66 |
const bytecxx . . $ `types.h:10:9`![ SHA1_INPUT_BYTEScxx . . $ `sha1.h:14:9`! ] ); |
| 67 |
|
| 68 |
#if defined( __cplusplus ) |
| 69 |
} |
| 70 |
#endif |
| 71 |
|
| 72 |
#endif |