2011-01-06 14:20:01 +00:00
|
|
|
/**
|
|
|
|
* \file md_wrap.h
|
2014-05-01 11:03:14 +00:00
|
|
|
*
|
2011-01-06 14:20:01 +00:00
|
|
|
* \brief Message digest wrappers.
|
|
|
|
*
|
2015-03-24 11:13:30 +00:00
|
|
|
* \warning This in an internal header. Do not include directly.
|
|
|
|
*
|
2011-01-06 14:20:01 +00:00
|
|
|
* \author Adriaan de Jong <dejong@fox-it.com>
|
|
|
|
*
|
2015-03-24 11:13:30 +00:00
|
|
|
* Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
|
2011-01-06 14:20:01 +00:00
|
|
|
*
|
2015-03-06 13:17:10 +00:00
|
|
|
* This file is part of mbed TLS (https://tls.mbed.org)
|
2011-01-06 14:20:01 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
#ifndef MBEDTLS_MD_WRAP_H
|
|
|
|
#define MBEDTLS_MD_WRAP_H
|
2011-01-06 14:20:01 +00:00
|
|
|
|
2015-04-08 10:49:31 +00:00
|
|
|
#if !defined(MBEDTLS_CONFIG_FILE)
|
2011-08-15 09:07:52 +00:00
|
|
|
#include "config.h"
|
2014-04-29 10:39:06 +00:00
|
|
|
#else
|
2015-04-08 10:49:31 +00:00
|
|
|
#include MBEDTLS_CONFIG_FILE
|
2014-04-29 10:39:06 +00:00
|
|
|
#endif
|
2015-02-13 14:12:07 +00:00
|
|
|
|
2011-08-15 09:07:52 +00:00
|
|
|
#include "md.h"
|
2011-01-06 14:20:01 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2015-03-24 11:13:30 +00:00
|
|
|
/**
|
|
|
|
* Message digest information.
|
|
|
|
* Allows message digest functions to be called in a generic way.
|
|
|
|
*/
|
2015-04-08 10:49:31 +00:00
|
|
|
struct mbedtls_md_info_t
|
2015-04-02 13:43:57 +00:00
|
|
|
{
|
2015-03-24 11:13:30 +00:00
|
|
|
/** Digest identifier */
|
2015-04-08 10:49:31 +00:00
|
|
|
mbedtls_md_type_t type;
|
2015-03-24 11:13:30 +00:00
|
|
|
|
|
|
|
/** Name of the message digest */
|
|
|
|
const char * name;
|
|
|
|
|
|
|
|
/** Output length of the digest function */
|
|
|
|
int size;
|
|
|
|
|
2015-03-24 15:48:22 +00:00
|
|
|
/** Block length of the digest function */
|
|
|
|
int block_size;
|
|
|
|
|
2015-03-24 11:13:30 +00:00
|
|
|
/** Digest initialisation function */
|
|
|
|
void (*starts_func)( void *ctx );
|
|
|
|
|
|
|
|
/** Digest update function */
|
|
|
|
void (*update_func)( void *ctx, const unsigned char *input, size_t ilen );
|
|
|
|
|
|
|
|
/** Digest finalisation function */
|
|
|
|
void (*finish_func)( void *ctx, unsigned char *output );
|
|
|
|
|
|
|
|
/** Generic digest function */
|
|
|
|
void (*digest_func)( const unsigned char *input, size_t ilen,
|
|
|
|
unsigned char *output );
|
|
|
|
|
|
|
|
/** Generic file digest function */
|
|
|
|
int (*file_func)( const char *path, unsigned char *output );
|
|
|
|
|
|
|
|
/** Allocate a new context */
|
|
|
|
void * (*ctx_alloc_func)( void );
|
|
|
|
|
|
|
|
/** Free the given context */
|
|
|
|
void (*ctx_free_func)( void *ctx );
|
|
|
|
|
|
|
|
/** Internal use only */
|
|
|
|
void (*process_func)( void *ctx, const unsigned char *input );
|
|
|
|
};
|
|
|
|
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_MD2_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_md2_info;
|
2011-01-06 14:20:01 +00:00
|
|
|
#endif
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_MD4_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_md4_info;
|
2011-01-06 14:20:01 +00:00
|
|
|
#endif
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_MD5_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_md5_info;
|
2011-01-06 14:20:01 +00:00
|
|
|
#endif
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_RIPEMD160_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_ripemd160_info;
|
2014-01-17 19:41:32 +00:00
|
|
|
#endif
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_SHA1_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_sha1_info;
|
2011-01-06 14:20:01 +00:00
|
|
|
#endif
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_SHA256_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_sha224_info;
|
|
|
|
extern const mbedtls_md_info_t mbedtls_sha256_info;
|
2011-01-06 14:20:01 +00:00
|
|
|
#endif
|
2015-04-08 10:49:31 +00:00
|
|
|
#if defined(MBEDTLS_SHA512_C)
|
|
|
|
extern const mbedtls_md_info_t mbedtls_sha384_info;
|
|
|
|
extern const mbedtls_md_info_t mbedtls_sha512_info;
|
2011-01-06 14:20:01 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-08 10:49:31 +00:00
|
|
|
#endif /* MBEDTLS_MD_WRAP_H */
|