OLD | NEW |
1 /* | 1 /* |
2 * hmac.h | 2 * hmac.h |
3 * | 3 * |
4 * interface to hmac auth_type_t | 4 * interface to hmac auth_type_t |
5 * | 5 * |
6 * David A. McGrew | 6 * David A. McGrew |
7 * Cisco Systems, Inc. | 7 * Cisco Systems, Inc. |
8 * | 8 * |
9 */ | 9 */ |
10 /* | 10 /* |
11 * | 11 * |
12 * Copyright (c) 2001-2006, Cisco Systems, Inc. | 12 * Copyright (c) 2001-2006,2013, Cisco Systems, Inc. |
13 * All rights reserved. | 13 * All rights reserved. |
14 * | 14 * |
15 * Redistribution and use in source and binary forms, with or without | 15 * Redistribution and use in source and binary forms, with or without |
16 * modification, are permitted provided that the following conditions | 16 * modification, are permitted provided that the following conditions |
17 * are met: | 17 * are met: |
18 * | 18 * |
19 * Redistributions of source code must retain the above copyright | 19 * Redistributions of source code must retain the above copyright |
20 * notice, this list of conditions and the following disclaimer. | 20 * notice, this list of conditions and the following disclaimer. |
21 * | 21 * |
22 * Redistributions in binary form must reproduce the above | 22 * Redistributions in binary form must reproduce the above |
(...skipping 23 matching lines...) Expand all Loading... |
46 #ifndef HMAC_H | 46 #ifndef HMAC_H |
47 #define HMAC_H | 47 #define HMAC_H |
48 | 48 |
49 #include "auth.h" | 49 #include "auth.h" |
50 #include "sha1.h" | 50 #include "sha1.h" |
51 | 51 |
52 typedef struct { | 52 typedef struct { |
53 uint8_t opad[64]; | 53 uint8_t opad[64]; |
54 sha1_ctx_t ctx; | 54 sha1_ctx_t ctx; |
55 sha1_ctx_t init_ctx; | 55 sha1_ctx_t init_ctx; |
| 56 #ifdef OPENSSL |
| 57 int ctx_initialized; |
| 58 int init_ctx_initialized; |
| 59 #endif |
56 } hmac_ctx_t; | 60 } hmac_ctx_t; |
57 | 61 |
58 err_status_t | 62 err_status_t |
59 hmac_alloc(auth_t **a, int key_len, int out_len); | 63 hmac_alloc(auth_t **a, int key_len, int out_len); |
60 | 64 |
61 err_status_t | 65 err_status_t |
62 hmac_dealloc(auth_t *a); | 66 hmac_dealloc(auth_t *a); |
63 | 67 |
64 err_status_t | 68 err_status_t |
65 hmac_init(hmac_ctx_t *state, const uint8_t *key, int key_len); | 69 hmac_init(hmac_ctx_t *state, const uint8_t *key, int key_len); |
66 | 70 |
67 err_status_t | 71 err_status_t |
68 hmac_start(hmac_ctx_t *state); | 72 hmac_start(hmac_ctx_t *state); |
69 | 73 |
70 err_status_t | 74 err_status_t |
71 hmac_update(hmac_ctx_t *state, const uint8_t *message, int msg_octets); | 75 hmac_update(hmac_ctx_t *state, const uint8_t *message, int msg_octets); |
72 | 76 |
73 err_status_t | 77 err_status_t |
74 hmac_compute(hmac_ctx_t *state, const void *message, | 78 hmac_compute(hmac_ctx_t *state, const void *message, |
75 int msg_octets, int tag_len, uint8_t *result); | 79 int msg_octets, int tag_len, uint8_t *result); |
76 | 80 |
77 | 81 |
78 #endif /* HMAC_H */ | 82 #endif /* HMAC_H */ |
OLD | NEW |