Modified mbed TLS headers for AES functionality only to reduce build size

Dependents:   BLE_Gateway_Linker_fix BLE_Gateway

Fork of mbedtls by sandbox

Committer:
electronichamsters
Date:
Mon Jul 10 04:00:25 2017 +0000
Revision:
5:f09f5ed830ca
Parent:
1:24750b9ad5ef
working gateway

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Christopher Haster 1:24750b9ad5ef 1 /**
Christopher Haster 1:24750b9ad5ef 2 * \file mbedtls_md2.h
Christopher Haster 1:24750b9ad5ef 3 *
Christopher Haster 1:24750b9ad5ef 4 * \brief MD2 message digest algorithm (hash function)
Christopher Haster 1:24750b9ad5ef 5 *
Christopher Haster 1:24750b9ad5ef 6 * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
Christopher Haster 1:24750b9ad5ef 7 * SPDX-License-Identifier: Apache-2.0
Christopher Haster 1:24750b9ad5ef 8 *
Christopher Haster 1:24750b9ad5ef 9 * Licensed under the Apache License, Version 2.0 (the "License"); you may
Christopher Haster 1:24750b9ad5ef 10 * not use this file except in compliance with the License.
Christopher Haster 1:24750b9ad5ef 11 * You may obtain a copy of the License at
Christopher Haster 1:24750b9ad5ef 12 *
Christopher Haster 1:24750b9ad5ef 13 * http://www.apache.org/licenses/LICENSE-2.0
Christopher Haster 1:24750b9ad5ef 14 *
Christopher Haster 1:24750b9ad5ef 15 * Unless required by applicable law or agreed to in writing, software
Christopher Haster 1:24750b9ad5ef 16 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
Christopher Haster 1:24750b9ad5ef 17 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Christopher Haster 1:24750b9ad5ef 18 * See the License for the specific language governing permissions and
Christopher Haster 1:24750b9ad5ef 19 * limitations under the License.
Christopher Haster 1:24750b9ad5ef 20 *
Christopher Haster 1:24750b9ad5ef 21 * This file is part of mbed TLS (https://tls.mbed.org)
Christopher Haster 1:24750b9ad5ef 22 */
Christopher Haster 1:24750b9ad5ef 23 #ifndef MBEDTLS_MD2_H
Christopher Haster 1:24750b9ad5ef 24 #define MBEDTLS_MD2_H
Christopher Haster 1:24750b9ad5ef 25
Christopher Haster 1:24750b9ad5ef 26 #if !defined(MBEDTLS_CONFIG_FILE)
Christopher Haster 1:24750b9ad5ef 27 #include "config.h"
Christopher Haster 1:24750b9ad5ef 28 #else
Christopher Haster 1:24750b9ad5ef 29 #include MBEDTLS_CONFIG_FILE
Christopher Haster 1:24750b9ad5ef 30 #endif
Christopher Haster 1:24750b9ad5ef 31
Christopher Haster 1:24750b9ad5ef 32 #include <stddef.h>
Christopher Haster 1:24750b9ad5ef 33
Christopher Haster 1:24750b9ad5ef 34 #if !defined(MBEDTLS_MD2_ALT)
Christopher Haster 1:24750b9ad5ef 35 // Regular implementation
Christopher Haster 1:24750b9ad5ef 36 //
Christopher Haster 1:24750b9ad5ef 37
Christopher Haster 1:24750b9ad5ef 38 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 39 extern "C" {
Christopher Haster 1:24750b9ad5ef 40 #endif
Christopher Haster 1:24750b9ad5ef 41
Christopher Haster 1:24750b9ad5ef 42 /**
Christopher Haster 1:24750b9ad5ef 43 * \brief MD2 context structure
Christopher Haster 1:24750b9ad5ef 44 */
Christopher Haster 1:24750b9ad5ef 45 typedef struct
Christopher Haster 1:24750b9ad5ef 46 {
Christopher Haster 1:24750b9ad5ef 47 unsigned char cksum[16]; /*!< checksum of the data block */
Christopher Haster 1:24750b9ad5ef 48 unsigned char state[48]; /*!< intermediate digest state */
Christopher Haster 1:24750b9ad5ef 49 unsigned char buffer[16]; /*!< data block being processed */
Christopher Haster 1:24750b9ad5ef 50 size_t left; /*!< amount of data in buffer */
Christopher Haster 1:24750b9ad5ef 51 }
Christopher Haster 1:24750b9ad5ef 52 mbedtls_md2_context;
Christopher Haster 1:24750b9ad5ef 53
Christopher Haster 1:24750b9ad5ef 54 /**
Christopher Haster 1:24750b9ad5ef 55 * \brief Initialize MD2 context
Christopher Haster 1:24750b9ad5ef 56 *
Christopher Haster 1:24750b9ad5ef 57 * \param ctx MD2 context to be initialized
Christopher Haster 1:24750b9ad5ef 58 */
Christopher Haster 1:24750b9ad5ef 59 void mbedtls_md2_init( mbedtls_md2_context *ctx );
Christopher Haster 1:24750b9ad5ef 60
Christopher Haster 1:24750b9ad5ef 61 /**
Christopher Haster 1:24750b9ad5ef 62 * \brief Clear MD2 context
Christopher Haster 1:24750b9ad5ef 63 *
Christopher Haster 1:24750b9ad5ef 64 * \param ctx MD2 context to be cleared
Christopher Haster 1:24750b9ad5ef 65 */
Christopher Haster 1:24750b9ad5ef 66 void mbedtls_md2_free( mbedtls_md2_context *ctx );
Christopher Haster 1:24750b9ad5ef 67
Christopher Haster 1:24750b9ad5ef 68 /**
Christopher Haster 1:24750b9ad5ef 69 * \brief Clone (the state of) an MD2 context
Christopher Haster 1:24750b9ad5ef 70 *
Christopher Haster 1:24750b9ad5ef 71 * \param dst The destination context
Christopher Haster 1:24750b9ad5ef 72 * \param src The context to be cloned
Christopher Haster 1:24750b9ad5ef 73 */
Christopher Haster 1:24750b9ad5ef 74 void mbedtls_md2_clone( mbedtls_md2_context *dst,
Christopher Haster 1:24750b9ad5ef 75 const mbedtls_md2_context *src );
Christopher Haster 1:24750b9ad5ef 76
Christopher Haster 1:24750b9ad5ef 77 /**
Christopher Haster 1:24750b9ad5ef 78 * \brief MD2 context setup
Christopher Haster 1:24750b9ad5ef 79 *
Christopher Haster 1:24750b9ad5ef 80 * \param ctx context to be initialized
Christopher Haster 1:24750b9ad5ef 81 */
Christopher Haster 1:24750b9ad5ef 82 void mbedtls_md2_starts( mbedtls_md2_context *ctx );
Christopher Haster 1:24750b9ad5ef 83
Christopher Haster 1:24750b9ad5ef 84 /**
Christopher Haster 1:24750b9ad5ef 85 * \brief MD2 process buffer
Christopher Haster 1:24750b9ad5ef 86 *
Christopher Haster 1:24750b9ad5ef 87 * \param ctx MD2 context
Christopher Haster 1:24750b9ad5ef 88 * \param input buffer holding the data
Christopher Haster 1:24750b9ad5ef 89 * \param ilen length of the input data
Christopher Haster 1:24750b9ad5ef 90 */
Christopher Haster 1:24750b9ad5ef 91 void mbedtls_md2_update( mbedtls_md2_context *ctx, const unsigned char *input, size_t ilen );
Christopher Haster 1:24750b9ad5ef 92
Christopher Haster 1:24750b9ad5ef 93 /**
Christopher Haster 1:24750b9ad5ef 94 * \brief MD2 final digest
Christopher Haster 1:24750b9ad5ef 95 *
Christopher Haster 1:24750b9ad5ef 96 * \param ctx MD2 context
Christopher Haster 1:24750b9ad5ef 97 * \param output MD2 checksum result
Christopher Haster 1:24750b9ad5ef 98 */
Christopher Haster 1:24750b9ad5ef 99 void mbedtls_md2_finish( mbedtls_md2_context *ctx, unsigned char output[16] );
Christopher Haster 1:24750b9ad5ef 100
Christopher Haster 1:24750b9ad5ef 101 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 102 }
Christopher Haster 1:24750b9ad5ef 103 #endif
Christopher Haster 1:24750b9ad5ef 104
Christopher Haster 1:24750b9ad5ef 105 #else /* MBEDTLS_MD2_ALT */
Christopher Haster 1:24750b9ad5ef 106 #include "md2_alt.h"
Christopher Haster 1:24750b9ad5ef 107 #endif /* MBEDTLS_MD2_ALT */
Christopher Haster 1:24750b9ad5ef 108
Christopher Haster 1:24750b9ad5ef 109 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 110 extern "C" {
Christopher Haster 1:24750b9ad5ef 111 #endif
Christopher Haster 1:24750b9ad5ef 112
Christopher Haster 1:24750b9ad5ef 113 /**
Christopher Haster 1:24750b9ad5ef 114 * \brief Output = MD2( input buffer )
Christopher Haster 1:24750b9ad5ef 115 *
Christopher Haster 1:24750b9ad5ef 116 * \param input buffer holding the data
Christopher Haster 1:24750b9ad5ef 117 * \param ilen length of the input data
Christopher Haster 1:24750b9ad5ef 118 * \param output MD2 checksum result
Christopher Haster 1:24750b9ad5ef 119 */
Christopher Haster 1:24750b9ad5ef 120 void mbedtls_md2( const unsigned char *input, size_t ilen, unsigned char output[16] );
Christopher Haster 1:24750b9ad5ef 121
Christopher Haster 1:24750b9ad5ef 122 /**
Christopher Haster 1:24750b9ad5ef 123 * \brief Checkup routine
Christopher Haster 1:24750b9ad5ef 124 *
Christopher Haster 1:24750b9ad5ef 125 * \return 0 if successful, or 1 if the test failed
Christopher Haster 1:24750b9ad5ef 126 */
Christopher Haster 1:24750b9ad5ef 127 int mbedtls_md2_self_test( int verbose );
Christopher Haster 1:24750b9ad5ef 128
Christopher Haster 1:24750b9ad5ef 129 /* Internal use */
Christopher Haster 1:24750b9ad5ef 130 void mbedtls_md2_process( mbedtls_md2_context *ctx );
Christopher Haster 1:24750b9ad5ef 131
Christopher Haster 1:24750b9ad5ef 132 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 133 }
Christopher Haster 1:24750b9ad5ef 134 #endif
Christopher Haster 1:24750b9ad5ef 135
Christopher Haster 1:24750b9ad5ef 136 #endif /* mbedtls_md2.h */