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_sha1.h
Christopher Haster 1:24750b9ad5ef 3 *
Christopher Haster 1:24750b9ad5ef 4 * \brief SHA-1 cryptographic 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_SHA1_H
Christopher Haster 1:24750b9ad5ef 24 #define MBEDTLS_SHA1_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 #include <stdint.h>
Christopher Haster 1:24750b9ad5ef 34
Christopher Haster 1:24750b9ad5ef 35 #if !defined(MBEDTLS_SHA1_ALT)
Christopher Haster 1:24750b9ad5ef 36 // Regular implementation
Christopher Haster 1:24750b9ad5ef 37 //
Christopher Haster 1:24750b9ad5ef 38
Christopher Haster 1:24750b9ad5ef 39 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 40 extern "C" {
Christopher Haster 1:24750b9ad5ef 41 #endif
Christopher Haster 1:24750b9ad5ef 42
Christopher Haster 1:24750b9ad5ef 43 /**
Christopher Haster 1:24750b9ad5ef 44 * \brief SHA-1 context structure
Christopher Haster 1:24750b9ad5ef 45 */
Christopher Haster 1:24750b9ad5ef 46 typedef struct
Christopher Haster 1:24750b9ad5ef 47 {
Christopher Haster 1:24750b9ad5ef 48 uint32_t total[2]; /*!< number of bytes processed */
Christopher Haster 1:24750b9ad5ef 49 uint32_t state[5]; /*!< intermediate digest state */
Christopher Haster 1:24750b9ad5ef 50 unsigned char buffer[64]; /*!< data block being processed */
Christopher Haster 1:24750b9ad5ef 51 }
Christopher Haster 1:24750b9ad5ef 52 mbedtls_sha1_context;
Christopher Haster 1:24750b9ad5ef 53
Christopher Haster 1:24750b9ad5ef 54 /**
Christopher Haster 1:24750b9ad5ef 55 * \brief Initialize SHA-1 context
Christopher Haster 1:24750b9ad5ef 56 *
Christopher Haster 1:24750b9ad5ef 57 * \param ctx SHA-1 context to be initialized
Christopher Haster 1:24750b9ad5ef 58 */
Christopher Haster 1:24750b9ad5ef 59 void mbedtls_sha1_init( mbedtls_sha1_context *ctx );
Christopher Haster 1:24750b9ad5ef 60
Christopher Haster 1:24750b9ad5ef 61 /**
Christopher Haster 1:24750b9ad5ef 62 * \brief Clear SHA-1 context
Christopher Haster 1:24750b9ad5ef 63 *
Christopher Haster 1:24750b9ad5ef 64 * \param ctx SHA-1 context to be cleared
Christopher Haster 1:24750b9ad5ef 65 */
Christopher Haster 1:24750b9ad5ef 66 void mbedtls_sha1_free( mbedtls_sha1_context *ctx );
Christopher Haster 1:24750b9ad5ef 67
Christopher Haster 1:24750b9ad5ef 68 /**
Christopher Haster 1:24750b9ad5ef 69 * \brief Clone (the state of) a SHA-1 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_sha1_clone( mbedtls_sha1_context *dst,
Christopher Haster 1:24750b9ad5ef 75 const mbedtls_sha1_context *src );
Christopher Haster 1:24750b9ad5ef 76
Christopher Haster 1:24750b9ad5ef 77 /**
Christopher Haster 1:24750b9ad5ef 78 * \brief SHA-1 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_sha1_starts( mbedtls_sha1_context *ctx );
Christopher Haster 1:24750b9ad5ef 83
Christopher Haster 1:24750b9ad5ef 84 /**
Christopher Haster 1:24750b9ad5ef 85 * \brief SHA-1 process buffer
Christopher Haster 1:24750b9ad5ef 86 *
Christopher Haster 1:24750b9ad5ef 87 * \param ctx SHA-1 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_sha1_update( mbedtls_sha1_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 SHA-1 final digest
Christopher Haster 1:24750b9ad5ef 95 *
Christopher Haster 1:24750b9ad5ef 96 * \param ctx SHA-1 context
Christopher Haster 1:24750b9ad5ef 97 * \param output SHA-1 checksum result
Christopher Haster 1:24750b9ad5ef 98 */
Christopher Haster 1:24750b9ad5ef 99 void mbedtls_sha1_finish( mbedtls_sha1_context *ctx, unsigned char output[20] );
Christopher Haster 1:24750b9ad5ef 100
Christopher Haster 1:24750b9ad5ef 101 /* Internal use */
Christopher Haster 1:24750b9ad5ef 102 void mbedtls_sha1_process( mbedtls_sha1_context *ctx, const unsigned char data[64] );
Christopher Haster 1:24750b9ad5ef 103
Christopher Haster 1:24750b9ad5ef 104 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 105 }
Christopher Haster 1:24750b9ad5ef 106 #endif
Christopher Haster 1:24750b9ad5ef 107
Christopher Haster 1:24750b9ad5ef 108 #else /* MBEDTLS_SHA1_ALT */
Christopher Haster 1:24750b9ad5ef 109 #include "sha1_alt.h"
Christopher Haster 1:24750b9ad5ef 110 #endif /* MBEDTLS_SHA1_ALT */
Christopher Haster 1:24750b9ad5ef 111
Christopher Haster 1:24750b9ad5ef 112 #ifdef __cplusplus
Christopher Haster 1:24750b9ad5ef 113 extern "C" {
Christopher Haster 1:24750b9ad5ef 114 #endif
Christopher Haster 1:24750b9ad5ef 115
Christopher Haster 1:24750b9ad5ef 116 /**
Christopher Haster 1:24750b9ad5ef 117 * \brief Output = SHA-1( input buffer )
Christopher Haster 1:24750b9ad5ef 118 *
Christopher Haster 1:24750b9ad5ef 119 * \param input buffer holding the data
Christopher Haster 1:24750b9ad5ef 120 * \param ilen length of the input data
Christopher Haster 1:24750b9ad5ef 121 * \param output SHA-1 checksum result
Christopher Haster 1:24750b9ad5ef 122 */
Christopher Haster 1:24750b9ad5ef 123 void mbedtls_sha1( const unsigned char *input, size_t ilen, unsigned char output[20] );
Christopher Haster 1:24750b9ad5ef 124
Christopher Haster 1:24750b9ad5ef 125 /**
Christopher Haster 1:24750b9ad5ef 126 * \brief Checkup routine
Christopher Haster 1:24750b9ad5ef 127 *
Christopher Haster 1:24750b9ad5ef 128 * \return 0 if successful, or 1 if the test failed
Christopher Haster 1:24750b9ad5ef 129 */
Christopher Haster 1:24750b9ad5ef 130 int mbedtls_sha1_self_test( int verbose );
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_sha1.h */