mbed TLS Build
include/mbedtls/md_internal.h@0:cdf462088d13, 2017-01-05 (annotated)
- Committer:
- markrad
- Date:
- Thu Jan 05 00:18:44 2017 +0000
- Revision:
- 0:cdf462088d13
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
markrad | 0:cdf462088d13 | 1 | /** |
markrad | 0:cdf462088d13 | 2 | * \file md_internal.h |
markrad | 0:cdf462088d13 | 3 | * |
markrad | 0:cdf462088d13 | 4 | * \brief Message digest wrappers. |
markrad | 0:cdf462088d13 | 5 | * |
markrad | 0:cdf462088d13 | 6 | * \warning This in an internal header. Do not include directly. |
markrad | 0:cdf462088d13 | 7 | * |
markrad | 0:cdf462088d13 | 8 | * \author Adriaan de Jong <dejong@fox-it.com> |
markrad | 0:cdf462088d13 | 9 | * |
markrad | 0:cdf462088d13 | 10 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
markrad | 0:cdf462088d13 | 11 | * SPDX-License-Identifier: Apache-2.0 |
markrad | 0:cdf462088d13 | 12 | * |
markrad | 0:cdf462088d13 | 13 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
markrad | 0:cdf462088d13 | 14 | * not use this file except in compliance with the License. |
markrad | 0:cdf462088d13 | 15 | * You may obtain a copy of the License at |
markrad | 0:cdf462088d13 | 16 | * |
markrad | 0:cdf462088d13 | 17 | * http://www.apache.org/licenses/LICENSE-2.0 |
markrad | 0:cdf462088d13 | 18 | * |
markrad | 0:cdf462088d13 | 19 | * Unless required by applicable law or agreed to in writing, software |
markrad | 0:cdf462088d13 | 20 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
markrad | 0:cdf462088d13 | 21 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
markrad | 0:cdf462088d13 | 22 | * See the License for the specific language governing permissions and |
markrad | 0:cdf462088d13 | 23 | * limitations under the License. |
markrad | 0:cdf462088d13 | 24 | * |
markrad | 0:cdf462088d13 | 25 | * This file is part of mbed TLS (https://tls.mbed.org) |
markrad | 0:cdf462088d13 | 26 | */ |
markrad | 0:cdf462088d13 | 27 | #ifndef MBEDTLS_MD_WRAP_H |
markrad | 0:cdf462088d13 | 28 | #define MBEDTLS_MD_WRAP_H |
markrad | 0:cdf462088d13 | 29 | |
markrad | 0:cdf462088d13 | 30 | #if !defined(MBEDTLS_CONFIG_FILE) |
markrad | 0:cdf462088d13 | 31 | #include "config.h" |
markrad | 0:cdf462088d13 | 32 | #else |
markrad | 0:cdf462088d13 | 33 | #include MBEDTLS_CONFIG_FILE |
markrad | 0:cdf462088d13 | 34 | #endif |
markrad | 0:cdf462088d13 | 35 | |
markrad | 0:cdf462088d13 | 36 | #include "md.h" |
markrad | 0:cdf462088d13 | 37 | |
markrad | 0:cdf462088d13 | 38 | #ifdef __cplusplus |
markrad | 0:cdf462088d13 | 39 | extern "C" { |
markrad | 0:cdf462088d13 | 40 | #endif |
markrad | 0:cdf462088d13 | 41 | |
markrad | 0:cdf462088d13 | 42 | /** |
markrad | 0:cdf462088d13 | 43 | * Message digest information. |
markrad | 0:cdf462088d13 | 44 | * Allows message digest functions to be called in a generic way. |
markrad | 0:cdf462088d13 | 45 | */ |
markrad | 0:cdf462088d13 | 46 | struct mbedtls_md_info_t |
markrad | 0:cdf462088d13 | 47 | { |
markrad | 0:cdf462088d13 | 48 | /** Digest identifier */ |
markrad | 0:cdf462088d13 | 49 | mbedtls_md_type_t type; |
markrad | 0:cdf462088d13 | 50 | |
markrad | 0:cdf462088d13 | 51 | /** Name of the message digest */ |
markrad | 0:cdf462088d13 | 52 | const char * name; |
markrad | 0:cdf462088d13 | 53 | |
markrad | 0:cdf462088d13 | 54 | /** Output length of the digest function in bytes */ |
markrad | 0:cdf462088d13 | 55 | int size; |
markrad | 0:cdf462088d13 | 56 | |
markrad | 0:cdf462088d13 | 57 | /** Block length of the digest function in bytes */ |
markrad | 0:cdf462088d13 | 58 | int block_size; |
markrad | 0:cdf462088d13 | 59 | |
markrad | 0:cdf462088d13 | 60 | /** Digest initialisation function */ |
markrad | 0:cdf462088d13 | 61 | void (*starts_func)( void *ctx ); |
markrad | 0:cdf462088d13 | 62 | |
markrad | 0:cdf462088d13 | 63 | /** Digest update function */ |
markrad | 0:cdf462088d13 | 64 | void (*update_func)( void *ctx, const unsigned char *input, size_t ilen ); |
markrad | 0:cdf462088d13 | 65 | |
markrad | 0:cdf462088d13 | 66 | /** Digest finalisation function */ |
markrad | 0:cdf462088d13 | 67 | void (*finish_func)( void *ctx, unsigned char *output ); |
markrad | 0:cdf462088d13 | 68 | |
markrad | 0:cdf462088d13 | 69 | /** Generic digest function */ |
markrad | 0:cdf462088d13 | 70 | void (*digest_func)( const unsigned char *input, size_t ilen, |
markrad | 0:cdf462088d13 | 71 | unsigned char *output ); |
markrad | 0:cdf462088d13 | 72 | |
markrad | 0:cdf462088d13 | 73 | /** Allocate a new context */ |
markrad | 0:cdf462088d13 | 74 | void * (*ctx_alloc_func)( void ); |
markrad | 0:cdf462088d13 | 75 | |
markrad | 0:cdf462088d13 | 76 | /** Free the given context */ |
markrad | 0:cdf462088d13 | 77 | void (*ctx_free_func)( void *ctx ); |
markrad | 0:cdf462088d13 | 78 | |
markrad | 0:cdf462088d13 | 79 | /** Clone state from a context */ |
markrad | 0:cdf462088d13 | 80 | void (*clone_func)( void *dst, const void *src ); |
markrad | 0:cdf462088d13 | 81 | |
markrad | 0:cdf462088d13 | 82 | /** Internal use only */ |
markrad | 0:cdf462088d13 | 83 | void (*process_func)( void *ctx, const unsigned char *input ); |
markrad | 0:cdf462088d13 | 84 | }; |
markrad | 0:cdf462088d13 | 85 | |
markrad | 0:cdf462088d13 | 86 | #if defined(MBEDTLS_MD2_C) |
markrad | 0:cdf462088d13 | 87 | extern const mbedtls_md_info_t mbedtls_md2_info; |
markrad | 0:cdf462088d13 | 88 | #endif |
markrad | 0:cdf462088d13 | 89 | #if defined(MBEDTLS_MD4_C) |
markrad | 0:cdf462088d13 | 90 | extern const mbedtls_md_info_t mbedtls_md4_info; |
markrad | 0:cdf462088d13 | 91 | #endif |
markrad | 0:cdf462088d13 | 92 | #if defined(MBEDTLS_MD5_C) |
markrad | 0:cdf462088d13 | 93 | extern const mbedtls_md_info_t mbedtls_md5_info; |
markrad | 0:cdf462088d13 | 94 | #endif |
markrad | 0:cdf462088d13 | 95 | #if defined(MBEDTLS_RIPEMD160_C) |
markrad | 0:cdf462088d13 | 96 | extern const mbedtls_md_info_t mbedtls_ripemd160_info; |
markrad | 0:cdf462088d13 | 97 | #endif |
markrad | 0:cdf462088d13 | 98 | #if defined(MBEDTLS_SHA1_C) |
markrad | 0:cdf462088d13 | 99 | extern const mbedtls_md_info_t mbedtls_sha1_info; |
markrad | 0:cdf462088d13 | 100 | #endif |
markrad | 0:cdf462088d13 | 101 | #if defined(MBEDTLS_SHA256_C) |
markrad | 0:cdf462088d13 | 102 | extern const mbedtls_md_info_t mbedtls_sha224_info; |
markrad | 0:cdf462088d13 | 103 | extern const mbedtls_md_info_t mbedtls_sha256_info; |
markrad | 0:cdf462088d13 | 104 | #endif |
markrad | 0:cdf462088d13 | 105 | #if defined(MBEDTLS_SHA512_C) |
markrad | 0:cdf462088d13 | 106 | extern const mbedtls_md_info_t mbedtls_sha384_info; |
markrad | 0:cdf462088d13 | 107 | extern const mbedtls_md_info_t mbedtls_sha512_info; |
markrad | 0:cdf462088d13 | 108 | #endif |
markrad | 0:cdf462088d13 | 109 | |
markrad | 0:cdf462088d13 | 110 | #ifdef __cplusplus |
markrad | 0:cdf462088d13 | 111 | } |
markrad | 0:cdf462088d13 | 112 | #endif |
markrad | 0:cdf462088d13 | 113 | |
markrad | 0:cdf462088d13 | 114 | #endif /* MBEDTLS_MD_WRAP_H */ |