OLD | NEW |
1 /* Software-Based Trusted Platform Module (TPM) Emulator for Linux | 1 /* Software-based Trusted Platform Module (TPM) Emulator |
2 * Copyright (C) 2004 Mario Strasser <mast@gmx.net>, | 2 * Copyright (C) 2004-2010 Mario Strasser <mast@gmx.net> |
3 * | 3 * |
4 * This module is free software; you can redistribute it and/or modify | 4 * This module is free software; you can redistribute it and/or modify |
5 * it under the terms of the GNU General Public License as published | 5 * it under the terms of the GNU General Public License as published |
6 * by the Free Software Foundation; either version 2 of the License, | 6 * by the Free Software Foundation; either version 2 of the License, |
7 * or (at your option) any later version. | 7 * or (at your option) any later version. |
8 * | 8 * |
9 * This module is distributed in the hope that it will be useful, | 9 * This module is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
12 * GNU General Public License for more details. | 12 * GNU General Public License for more details. |
13 * | 13 * |
14 * $Id$ | 14 * $Id: sha1.h 364 2010-02-11 10:24:45Z mast $ |
15 */ | 15 */ |
16 | 16 |
17 #ifndef _SHA1_H_ | 17 #ifndef _SHA1_H_ |
18 #define _SHA1_H_ | 18 #define _SHA1_H_ |
19 | 19 |
20 #include <stddef.h> | 20 #include <stddef.h> |
21 #include <stdint.h> | 21 #include <stdint.h> |
22 | 22 |
23 #define SHA1_DIGEST_LENGTH 20 | 23 #define SHA1_DIGEST_LENGTH 20 |
24 | 24 |
25 typedef struct { | 25 typedef struct { |
26 uint32_t h[5]; | 26 uint32_t h[5]; |
27 uint32_t count_lo, count_hi; | 27 uint32_t count_lo, count_hi; |
28 uint8_t buf[64]; | 28 uint8_t buf[64]; |
29 } tpm_sha1_ctx_t; | 29 } tpm_sha1_ctx_t; |
30 | 30 |
31 void tpm_sha1_init(tpm_sha1_ctx_t *ctx); | 31 void tpm_sha1_init(tpm_sha1_ctx_t *ctx); |
32 | 32 |
33 void tpm_sha1_update(tpm_sha1_ctx_t *ctx, const uint8_t *data, size_t length); | 33 void tpm_sha1_update(tpm_sha1_ctx_t *ctx, const uint8_t *data, size_t length); |
34 | 34 |
35 void tpm_sha1_update_be32(tpm_sha1_ctx_t *ctx, uint32_t data); | 35 void tpm_sha1_update_be32(tpm_sha1_ctx_t *ctx, uint32_t data); |
36 | 36 |
37 void tpm_sha1_final(tpm_sha1_ctx_t *ctx, uint8_t digest[SHA1_DIGEST_LENGTH]); | 37 void tpm_sha1_final(tpm_sha1_ctx_t *ctx, uint8_t digest[SHA1_DIGEST_LENGTH]); |
38 | 38 |
39 #endif /* _SHA1_H_ */ | 39 #endif /* _SHA1_H_ */ |
OLD | NEW |