Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 1 | /** |
| 2 | * \file md.h |
| 3 | * |
| 4 | * \brief Generic message digest wrapper |
| 5 | * |
| 6 | * \author Adriaan de Jong <dejong@fox-it.com> |
| 7 | * |
Manuel Pégourié-Gonnard | 0edee5e | 2015-01-26 15:29:40 +0000 | [diff] [blame^] | 8 | * Copyright (C) 2006-2011, ARM Limited, All Rights Reserved |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 9 | * |
Manuel Pégourié-Gonnard | 0edee5e | 2015-01-26 15:29:40 +0000 | [diff] [blame^] | 10 | * This file is part of mbed TLS (https://www.polarssl.org) |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 11 | * |
| 12 | * This program is free software; you can redistribute it and/or modify |
| 13 | * it under the terms of the GNU General Public License as published by |
| 14 | * the Free Software Foundation; either version 2 of the License, or |
| 15 | * (at your option) any later version. |
| 16 | * |
| 17 | * This program is distributed in the hope that it will be useful, |
| 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 20 | * GNU General Public License for more details. |
| 21 | * |
| 22 | * You should have received a copy of the GNU General Public License along |
| 23 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 24 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
| 25 | */ |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 26 | #ifndef POLARSSL_MD_H |
| 27 | #define POLARSSL_MD_H |
| 28 | |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 29 | #include <string.h> |
| 30 | |
Paul Bakker | 09b1ec6 | 2011-07-27 16:28:54 +0000 | [diff] [blame] | 31 | #if defined(_MSC_VER) && !defined(inline) |
Paul Bakker | af5c85f | 2011-04-18 03:47:52 +0000 | [diff] [blame] | 32 | #define inline _inline |
Paul Bakker | 569df2c | 2011-06-21 07:48:07 +0000 | [diff] [blame] | 33 | #else |
Paul Bakker | 09b1ec6 | 2011-07-27 16:28:54 +0000 | [diff] [blame] | 34 | #if defined(__ARMCC_VERSION) && !defined(inline) |
Paul Bakker | 569df2c | 2011-06-21 07:48:07 +0000 | [diff] [blame] | 35 | #define inline __inline |
Paul Bakker | 74fb74e | 2011-06-21 13:36:18 +0000 | [diff] [blame] | 36 | #endif /* __ARMCC_VERSION */ |
Paul Bakker | 569df2c | 2011-06-21 07:48:07 +0000 | [diff] [blame] | 37 | #endif /*_MSC_VER */ |
Paul Bakker | af5c85f | 2011-04-18 03:47:52 +0000 | [diff] [blame] | 38 | |
Paul Bakker | 9d78140 | 2011-05-09 16:17:09 +0000 | [diff] [blame] | 39 | #define POLARSSL_ERR_MD_FEATURE_UNAVAILABLE -0x5080 /**< The selected feature is not available. */ |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 40 | #define POLARSSL_ERR_MD_BAD_INPUT_DATA -0x5100 /**< Bad input parameters to function. */ |
| 41 | #define POLARSSL_ERR_MD_ALLOC_FAILED -0x5180 /**< Failed to allocate memory. */ |
Paul Bakker | 8913f82 | 2012-01-14 18:07:41 +0000 | [diff] [blame] | 42 | #define POLARSSL_ERR_MD_FILE_IO_ERROR -0x5200 /**< Opening or reading of file failed. */ |
Paul Bakker | 335db3f | 2011-04-25 15:28:35 +0000 | [diff] [blame] | 43 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 44 | typedef enum { |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 45 | POLARSSL_MD_NONE=0, |
| 46 | POLARSSL_MD_MD2, |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 47 | POLARSSL_MD_MD4, |
| 48 | POLARSSL_MD_MD5, |
| 49 | POLARSSL_MD_SHA1, |
| 50 | POLARSSL_MD_SHA224, |
| 51 | POLARSSL_MD_SHA256, |
| 52 | POLARSSL_MD_SHA384, |
| 53 | POLARSSL_MD_SHA512, |
| 54 | } md_type_t; |
| 55 | |
Paul Bakker | 1b57b06 | 2011-01-06 15:48:19 +0000 | [diff] [blame] | 56 | #define POLARSSL_MD_MAX_SIZE 64 /* longest known is SHA512 */ |
| 57 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 58 | /** |
| 59 | * Message digest information. Allows message digest functions to be called |
| 60 | * in a generic way. |
| 61 | */ |
| 62 | typedef struct { |
| 63 | /** Digest identifier */ |
| 64 | md_type_t type; |
| 65 | |
| 66 | /** Name of the message digest */ |
| 67 | const char * name; |
| 68 | |
| 69 | /** Output length of the digest function */ |
| 70 | int size; |
| 71 | |
| 72 | /** Digest initialisation function */ |
| 73 | void (*starts_func)( void *ctx ); |
| 74 | |
| 75 | /** Digest update function */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 76 | void (*update_func)( void *ctx, const unsigned char *input, size_t ilen ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 77 | |
| 78 | /** Digest finalisation function */ |
| 79 | void (*finish_func)( void *ctx, unsigned char *output ); |
| 80 | |
| 81 | /** Generic digest function */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 82 | void (*digest_func)( const unsigned char *input, size_t ilen, |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 83 | unsigned char *output ); |
| 84 | |
| 85 | /** Generic file digest function */ |
| 86 | int (*file_func)( const char *path, unsigned char *output ); |
| 87 | |
| 88 | /** HMAC Initialisation function */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 89 | void (*hmac_starts_func)( void *ctx, const unsigned char *key, size_t keylen ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 90 | |
| 91 | /** HMAC update function */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 92 | void (*hmac_update_func)( void *ctx, const unsigned char *input, size_t ilen ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 93 | |
| 94 | /** HMAC finalisation function */ |
| 95 | void (*hmac_finish_func)( void *ctx, unsigned char *output); |
| 96 | |
| 97 | /** HMAC context reset function */ |
| 98 | void (*hmac_reset_func)( void *ctx ); |
| 99 | |
| 100 | /** Generic HMAC function */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 101 | void (*hmac_func)( const unsigned char *key, size_t keylen, |
| 102 | const unsigned char *input, size_t ilen, |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 103 | unsigned char *output ); |
| 104 | |
| 105 | /** Allocate a new context */ |
| 106 | void * (*ctx_alloc_func)( void ); |
| 107 | |
| 108 | /** Free the given context */ |
| 109 | void (*ctx_free_func)( void *ctx ); |
| 110 | |
| 111 | } md_info_t; |
| 112 | |
| 113 | /** |
| 114 | * Generic message digest context. |
| 115 | */ |
| 116 | typedef struct { |
| 117 | /** Information about the associated message digest */ |
| 118 | const md_info_t *md_info; |
| 119 | |
| 120 | /** Digest-specific context */ |
| 121 | void *md_ctx; |
| 122 | } md_context_t; |
| 123 | |
| 124 | #define MD_CONTEXT_T_INIT { \ |
| 125 | NULL, /* md_info */ \ |
| 126 | NULL, /* md_ctx */ \ |
| 127 | } |
| 128 | |
| 129 | #ifdef __cplusplus |
| 130 | extern "C" { |
| 131 | #endif |
| 132 | |
| 133 | /** |
Paul Bakker | 72f6266 | 2011-01-16 21:27:44 +0000 | [diff] [blame] | 134 | * \brief Returns the list of digests supported by the generic digest module. |
| 135 | * |
| 136 | * \return a statically allocated array of digests, the last entry |
| 137 | * is 0. |
| 138 | */ |
| 139 | const int *md_list( void ); |
| 140 | |
| 141 | /** |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 142 | * \brief Returns the message digest information associated with the |
| 143 | * given digest name. |
| 144 | * |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 145 | * \param md_name Name of the digest to search for. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 146 | * |
| 147 | * \return The message digest information associated with md_name or |
| 148 | * NULL if not found. |
| 149 | */ |
| 150 | const md_info_t *md_info_from_string( const char *md_name ); |
| 151 | |
| 152 | /** |
| 153 | * \brief Returns the message digest information associated with the |
| 154 | * given digest type. |
| 155 | * |
| 156 | * \param md_type type of digest to search for. |
| 157 | * |
| 158 | * \return The message digest information associated with md_type or |
| 159 | * NULL if not found. |
| 160 | */ |
| 161 | const md_info_t *md_info_from_type( md_type_t md_type ); |
| 162 | |
| 163 | /** |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 164 | * \brief Initialises and fills the message digest context structure with |
| 165 | * the appropriate values. |
| 166 | * |
| 167 | * \param ctx context to initialise. May not be NULL. The |
| 168 | * digest-specific context (ctx->md_ctx) must be NULL. It will |
| 169 | * be allocated, and must be freed using md_free_ctx() later. |
| 170 | * \param md_info message digest to use. |
| 171 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 172 | * \returns \c 0 on success, \c POLARSSL_ERR_MD_BAD_INPUT_DATA on |
| 173 | * parameter failure, \c POLARSSL_ERR_MD_ALLOC_FAILED if |
Paul Bakker | 2028156 | 2011-11-11 10:34:04 +0000 | [diff] [blame] | 174 | * allocation of the digest-specific context failed. |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 175 | */ |
| 176 | int md_init_ctx( md_context_t *ctx, const md_info_t *md_info ); |
| 177 | |
| 178 | /** |
| 179 | * \brief Free the message-specific context of ctx. Freeing ctx itself |
| 180 | * remains the responsibility of the caller. |
| 181 | * |
Paul Bakker | f3b86c1 | 2011-01-27 15:24:17 +0000 | [diff] [blame] | 182 | * \param ctx Free the message-specific context |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 183 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 184 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 185 | * verification fails. |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 186 | */ |
| 187 | int md_free_ctx( md_context_t *ctx ); |
| 188 | |
| 189 | /** |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 190 | * \brief Returns the size of the message digest output. |
| 191 | * |
| 192 | * \param md_info message digest info |
| 193 | * |
| 194 | * \return size of the message digest output. |
| 195 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 196 | static inline unsigned char md_get_size( const md_info_t *md_info ) |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 197 | { |
Paul Bakker | cecfd95 | 2013-04-12 13:18:07 +0200 | [diff] [blame] | 198 | if( md_info == NULL ) |
| 199 | return( 0 ); |
| 200 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 201 | return md_info->size; |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * \brief Returns the type of the message digest output. |
| 206 | * |
| 207 | * \param md_info message digest info |
| 208 | * |
| 209 | * \return type of the message digest output. |
| 210 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 211 | static inline md_type_t md_get_type( const md_info_t *md_info ) |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 212 | { |
Paul Bakker | cecfd95 | 2013-04-12 13:18:07 +0200 | [diff] [blame] | 213 | if( md_info == NULL ) |
| 214 | return( POLARSSL_MD_NONE ); |
| 215 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 216 | return md_info->type; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * \brief Returns the name of the message digest output. |
| 221 | * |
| 222 | * \param md_info message digest info |
| 223 | * |
| 224 | * \return name of the message digest output. |
| 225 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 226 | static inline const char *md_get_name( const md_info_t *md_info ) |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 227 | { |
Paul Bakker | cecfd95 | 2013-04-12 13:18:07 +0200 | [diff] [blame] | 228 | if( md_info == NULL ) |
| 229 | return( NULL ); |
| 230 | |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 231 | return md_info->name; |
| 232 | } |
| 233 | |
| 234 | /** |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 235 | * \brief Set-up the given context for a new message digest |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 236 | * |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 237 | * \param ctx generic message digest context. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 238 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 239 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 240 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 241 | */ |
Paul Bakker | 562535d | 2011-01-20 16:42:01 +0000 | [diff] [blame] | 242 | int md_starts( md_context_t *ctx ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 243 | |
| 244 | /** |
| 245 | * \brief Generic message digest process buffer |
| 246 | * |
| 247 | * \param ctx Generic message digest context |
| 248 | * \param input buffer holding the datal |
| 249 | * \param ilen length of the input data |
| 250 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 251 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 252 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 253 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 254 | int md_update( md_context_t *ctx, const unsigned char *input, size_t ilen ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 255 | |
| 256 | /** |
| 257 | * \brief Generic message digest final digest |
| 258 | * |
| 259 | * \param ctx Generic message digest context |
| 260 | * \param output Generic message digest checksum result |
| 261 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 262 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 263 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 264 | */ |
| 265 | int md_finish( md_context_t *ctx, unsigned char *output ); |
| 266 | |
| 267 | /** |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 268 | * \brief Output = message_digest( input buffer ) |
| 269 | * |
| 270 | * \param md_info message digest info |
| 271 | * \param input buffer holding the data |
| 272 | * \param ilen length of the input data |
| 273 | * \param output Generic message digest checksum result |
| 274 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 275 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 276 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 277 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 278 | int md( const md_info_t *md_info, const unsigned char *input, size_t ilen, |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 279 | unsigned char *output ); |
| 280 | |
| 281 | /** |
| 282 | * \brief Output = message_digest( file contents ) |
| 283 | * |
| 284 | * \param md_info message digest info |
| 285 | * \param path input file name |
| 286 | * \param output generic message digest checksum result |
| 287 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 288 | * \return 0 if successful, POLARSSL_ERR_MD_FILE_OPEN_FAILED if fopen |
| 289 | * failed, POLARSSL_ERR_MD_FILE_READ_FAILED if fread failed, |
| 290 | * POLARSSL_ERR_MD_BAD_INPUT_DATA if md_info was NULL. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 291 | */ |
| 292 | int md_file( const md_info_t *md_info, const char *path, unsigned char *output ); |
| 293 | |
| 294 | /** |
| 295 | * \brief Generic HMAC context setup |
| 296 | * |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 297 | * \param ctx HMAC context to be initialized |
| 298 | * \param key HMAC secret key |
| 299 | * \param keylen length of the HMAC key |
| 300 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 301 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 302 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 303 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 304 | int md_hmac_starts( md_context_t *ctx, const unsigned char *key, size_t keylen ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 305 | |
| 306 | /** |
| 307 | * \brief Generic HMAC process buffer |
| 308 | * |
| 309 | * \param ctx HMAC context |
| 310 | * \param input buffer holding the data |
| 311 | * \param ilen length of the input data |
| 312 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 313 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 314 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 315 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 316 | int md_hmac_update( md_context_t *ctx, const unsigned char *input, size_t ilen ); |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 317 | |
| 318 | /** |
| 319 | * \brief Generic HMAC final digest |
| 320 | * |
| 321 | * \param ctx HMAC context |
| 322 | * \param output Generic HMAC checksum result |
| 323 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 324 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 325 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 326 | */ |
| 327 | int md_hmac_finish( md_context_t *ctx, unsigned char *output); |
| 328 | |
| 329 | /** |
| 330 | * \brief Generic HMAC context reset |
| 331 | * |
| 332 | * \param ctx HMAC context to be reset |
| 333 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 334 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 335 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 336 | */ |
| 337 | int md_hmac_reset( md_context_t *ctx ); |
| 338 | |
| 339 | /** |
| 340 | * \brief Output = Generic_HMAC( hmac key, input buffer ) |
| 341 | * |
| 342 | * \param md_info message digest info |
| 343 | * \param key HMAC secret key |
| 344 | * \param keylen length of the HMAC key |
| 345 | * \param input buffer holding the data |
| 346 | * \param ilen length of the input data |
| 347 | * \param output Generic HMAC-result |
| 348 | * |
Paul Bakker | 9c021ad | 2011-06-09 15:55:11 +0000 | [diff] [blame] | 349 | * \returns 0 on success, POLARSSL_ERR_MD_BAD_INPUT_DATA if parameter |
| 350 | * verification fails. |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 351 | */ |
Paul Bakker | 23986e5 | 2011-04-24 08:57:21 +0000 | [diff] [blame] | 352 | int md_hmac( const md_info_t *md_info, const unsigned char *key, size_t keylen, |
| 353 | const unsigned char *input, size_t ilen, |
Paul Bakker | 1737385 | 2011-01-06 14:20:01 +0000 | [diff] [blame] | 354 | unsigned char *output ); |
| 355 | |
| 356 | #ifdef __cplusplus |
| 357 | } |
| 358 | #endif |
| 359 | |
| 360 | #endif /* POLARSSL_MD_H */ |