1 /** 2 * \file md_internal.h 3 * 4 * \brief Message digest wrappers. 5 * 6 * \warning This in an internal header. Do not include directly. 7 * 8 * \author Adriaan de Jong <dejong@fox-it.com> 9 */ 10 /* 11 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved 12 * Copyright (C) 2018-2022, Intel Corporation. 13 * SPDX-License-Identifier: Apache-2.0 14 * 15 * Licensed under the Apache License, Version 2.0 (the "License"); you may 16 * not use this file except in compliance with the License. 17 * You may obtain a copy of the License at 18 * 19 * http://www.apache.org/licenses/LICENSE-2.0 20 * 21 * Unless required by applicable law or agreed to in writing, software 22 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 23 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 * See the License for the specific language governing permissions and 25 * limitations under the License. 26 * 27 * This file is part of mbed TLS (https://tls.mbed.org) 28 */ 29 #ifndef MBEDTLS_MD_WRAP_H 30 #define MBEDTLS_MD_WRAP_H 31 32 #include "md.h" 33 34 /** 35 * Message digest information. 36 * Allows message digest functions to be called in a generic way. 37 */ 38 struct mbedtls_md_info 39 { 40 /** Digest identifier */ 41 mbedtls_md_type_t type; 42 43 /** Name of the message digest */ 44 const char * name; 45 46 /** Output length of the digest function in bytes */ 47 int32_t size; 48 49 /** Block length of the digest function in bytes */ 50 size_t block_size; 51 52 /** Digest initialisation function */ 53 int32_t (*starts_func)( void *ctx ); 54 55 /** Digest update function */ 56 int32_t (*update_func)( void *ctx, const uint8_t *input, size_t ilen ); 57 58 /** Digest finalisation function */ 59 int32_t (*finish_func)( void *ctx, uint8_t *output ); 60 61 /** Generic digest function */ 62 int32_t (*digest_func)( const uint8_t *input, size_t ilen, 63 uint8_t *output ); 64 65 /** Clone state from a context */ 66 void (*clone_func)( void *dst, const void *src ); 67 68 /** Internal use only */ 69 int32_t (*process_func)( void *ctx, const uint8_t *input ); 70 }; 71 72 extern const mbedtls_md_info_t mbedtls_sha256_info; 73 74 #endif /* MBEDTLS_MD_WRAP_H */ 75