nexmon – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 1 | /* |
2 | * FIPS-180-2 compliant SHA-2 implementation (only sha256 so far) |
||
3 | * |
||
4 | * This program is free software; you can redistribute it and/or modify |
||
5 | * it under the terms of the GNU General Public License as published by |
||
6 | * the Free Software Foundation; either version 2 of the License, or |
||
7 | * (at your option) any later version. |
||
8 | * |
||
9 | * This program is distributed in the hope that it will be useful, |
||
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
12 | * GNU General Public License for more details. |
||
13 | * |
||
14 | * You should have received a copy of the GNU General Public License |
||
15 | * along with this program; if not, write to the Free Software |
||
16 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
||
17 | |||
18 | */ |
||
19 | |||
20 | #ifndef _SHA2_H |
||
21 | #define _SHA2_H |
||
22 | |||
23 | #include "ws_symbol_export.h" |
||
24 | |||
25 | #define SHA256_DIGEST_LEN 32 |
||
26 | #define SHA256_BLOCK_SIZE 64 |
||
27 | |||
28 | typedef struct |
||
29 | { |
||
30 | guint64 total; |
||
31 | guint32 state[8]; |
||
32 | guint8 buffer[SHA256_BLOCK_SIZE]; |
||
33 | } |
||
34 | sha256_context; |
||
35 | |||
36 | WS_DLL_PUBLIC |
||
37 | void sha256_starts( sha256_context *ctx ); |
||
38 | WS_DLL_PUBLIC |
||
39 | void sha256_update( sha256_context *ctx, const guint8 *input, guint32 length ); |
||
40 | WS_DLL_PUBLIC |
||
41 | void sha256_finish( sha256_context *ctx, guint8 digest[SHA256_DIGEST_LEN] ); |
||
42 | |||
43 | |||
44 | typedef struct { |
||
45 | sha256_context ctx; |
||
46 | guint8 k_opad[SHA256_BLOCK_SIZE]; |
||
47 | } |
||
48 | sha256_hmac_context; |
||
49 | |||
50 | WS_DLL_PUBLIC |
||
51 | void sha256_hmac_starts( sha256_hmac_context *hctx, const guint8 *key, guint32 keylen ); |
||
52 | WS_DLL_PUBLIC |
||
53 | void sha256_hmac_update( sha256_hmac_context *hctx, const guint8 *buf, guint32 buflen ); |
||
54 | WS_DLL_PUBLIC |
||
55 | void sha256_hmac_finish( sha256_hmac_context *hctx, guint8 digest[SHA256_DIGEST_LEN] ); |
||
56 | WS_DLL_PUBLIC |
||
57 | void sha256_hmac( const guint8 *key, guint32 keylen, const guint8 *buf, guint32 buflen, |
||
58 | guint8 digest[SHA256_DIGEST_LEN] ); |
||
59 | |||
60 | |||
61 | |||
62 | #endif /* _SHA2_H */ |
||
63 | |||
64 | /* |
||
65 | * Editor modelines - http://www.wireshark.org/tools/modelines.html |
||
66 | * |
||
67 | * Local variables: |
||
68 | * c-basic-offset: 4 |
||
69 | * tab-width: 8 |
||
70 | * indent-tabs-mode: nil |
||
71 | * End: |
||
72 | * |
||
73 | * vi: set shiftwidth=4 tabstop=8 expandtab: |
||
74 | * :indentSize=4:tabSize=8:noTabs=true: |
||
75 | */ |