Modified mbed TLS headers for AES functionality only to reduce build size
Dependents: BLE_Gateway_Linker_fix BLE_Gateway
Fork of mbedtls by
mbedtls/ripemd160.h@5:f09f5ed830ca, 2017-07-10 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
Christopher Haster |
1:24750b9ad5ef | 1 | /** |
Christopher Haster |
1:24750b9ad5ef | 2 | * \file mbedtls_ripemd160.h |
Christopher Haster |
1:24750b9ad5ef | 3 | * |
Christopher Haster |
1:24750b9ad5ef | 4 | * \brief RIPE MD-160 message digest |
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_RIPEMD160_H |
Christopher Haster |
1:24750b9ad5ef | 24 | #define MBEDTLS_RIPEMD160_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_RIPEMD160_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 RIPEMD-160 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_ripemd160_context; |
Christopher Haster |
1:24750b9ad5ef | 53 | |
Christopher Haster |
1:24750b9ad5ef | 54 | /** |
Christopher Haster |
1:24750b9ad5ef | 55 | * \brief Initialize RIPEMD-160 context |
Christopher Haster |
1:24750b9ad5ef | 56 | * |
Christopher Haster |
1:24750b9ad5ef | 57 | * \param ctx RIPEMD-160 context to be initialized |
Christopher Haster |
1:24750b9ad5ef | 58 | */ |
Christopher Haster |
1:24750b9ad5ef | 59 | void mbedtls_ripemd160_init( mbedtls_ripemd160_context *ctx ); |
Christopher Haster |
1:24750b9ad5ef | 60 | |
Christopher Haster |
1:24750b9ad5ef | 61 | /** |
Christopher Haster |
1:24750b9ad5ef | 62 | * \brief Clear RIPEMD-160 context |
Christopher Haster |
1:24750b9ad5ef | 63 | * |
Christopher Haster |
1:24750b9ad5ef | 64 | * \param ctx RIPEMD-160 context to be cleared |
Christopher Haster |
1:24750b9ad5ef | 65 | */ |
Christopher Haster |
1:24750b9ad5ef | 66 | void mbedtls_ripemd160_free( mbedtls_ripemd160_context *ctx ); |
Christopher Haster |
1:24750b9ad5ef | 67 | |
Christopher Haster |
1:24750b9ad5ef | 68 | /** |
Christopher Haster |
1:24750b9ad5ef | 69 | * \brief Clone (the state of) an RIPEMD-160 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_ripemd160_clone( mbedtls_ripemd160_context *dst, |
Christopher Haster |
1:24750b9ad5ef | 75 | const mbedtls_ripemd160_context *src ); |
Christopher Haster |
1:24750b9ad5ef | 76 | |
Christopher Haster |
1:24750b9ad5ef | 77 | /** |
Christopher Haster |
1:24750b9ad5ef | 78 | * \brief RIPEMD-160 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_ripemd160_starts( mbedtls_ripemd160_context *ctx ); |
Christopher Haster |
1:24750b9ad5ef | 83 | |
Christopher Haster |
1:24750b9ad5ef | 84 | /** |
Christopher Haster |
1:24750b9ad5ef | 85 | * \brief RIPEMD-160 process buffer |
Christopher Haster |
1:24750b9ad5ef | 86 | * |
Christopher Haster |
1:24750b9ad5ef | 87 | * \param ctx RIPEMD-160 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_ripemd160_update( mbedtls_ripemd160_context *ctx, |
Christopher Haster |
1:24750b9ad5ef | 92 | const unsigned char *input, size_t ilen ); |
Christopher Haster |
1:24750b9ad5ef | 93 | |
Christopher Haster |
1:24750b9ad5ef | 94 | /** |
Christopher Haster |
1:24750b9ad5ef | 95 | * \brief RIPEMD-160 final digest |
Christopher Haster |
1:24750b9ad5ef | 96 | * |
Christopher Haster |
1:24750b9ad5ef | 97 | * \param ctx RIPEMD-160 context |
Christopher Haster |
1:24750b9ad5ef | 98 | * \param output RIPEMD-160 checksum result |
Christopher Haster |
1:24750b9ad5ef | 99 | */ |
Christopher Haster |
1:24750b9ad5ef | 100 | void mbedtls_ripemd160_finish( mbedtls_ripemd160_context *ctx, unsigned char output[20] ); |
Christopher Haster |
1:24750b9ad5ef | 101 | |
Christopher Haster |
1:24750b9ad5ef | 102 | /* Internal use */ |
Christopher Haster |
1:24750b9ad5ef | 103 | void mbedtls_ripemd160_process( mbedtls_ripemd160_context *ctx, const unsigned char data[64] ); |
Christopher Haster |
1:24750b9ad5ef | 104 | |
Christopher Haster |
1:24750b9ad5ef | 105 | #ifdef __cplusplus |
Christopher Haster |
1:24750b9ad5ef | 106 | } |
Christopher Haster |
1:24750b9ad5ef | 107 | #endif |
Christopher Haster |
1:24750b9ad5ef | 108 | |
Christopher Haster |
1:24750b9ad5ef | 109 | #else /* MBEDTLS_RIPEMD160_ALT */ |
Christopher Haster |
1:24750b9ad5ef | 110 | #include "ripemd160.h" |
Christopher Haster |
1:24750b9ad5ef | 111 | #endif /* MBEDTLS_RIPEMD160_ALT */ |
Christopher Haster |
1:24750b9ad5ef | 112 | |
Christopher Haster |
1:24750b9ad5ef | 113 | #ifdef __cplusplus |
Christopher Haster |
1:24750b9ad5ef | 114 | extern "C" { |
Christopher Haster |
1:24750b9ad5ef | 115 | #endif |
Christopher Haster |
1:24750b9ad5ef | 116 | |
Christopher Haster |
1:24750b9ad5ef | 117 | /** |
Christopher Haster |
1:24750b9ad5ef | 118 | * \brief Output = RIPEMD-160( input buffer ) |
Christopher Haster |
1:24750b9ad5ef | 119 | * |
Christopher Haster |
1:24750b9ad5ef | 120 | * \param input buffer holding the data |
Christopher Haster |
1:24750b9ad5ef | 121 | * \param ilen length of the input data |
Christopher Haster |
1:24750b9ad5ef | 122 | * \param output RIPEMD-160 checksum result |
Christopher Haster |
1:24750b9ad5ef | 123 | */ |
Christopher Haster |
1:24750b9ad5ef | 124 | void mbedtls_ripemd160( const unsigned char *input, size_t ilen, |
Christopher Haster |
1:24750b9ad5ef | 125 | unsigned char output[20] ); |
Christopher Haster |
1:24750b9ad5ef | 126 | |
Christopher Haster |
1:24750b9ad5ef | 127 | /** |
Christopher Haster |
1:24750b9ad5ef | 128 | * \brief Checkup routine |
Christopher Haster |
1:24750b9ad5ef | 129 | * |
Christopher Haster |
1:24750b9ad5ef | 130 | * \return 0 if successful, or 1 if the test failed |
Christopher Haster |
1:24750b9ad5ef | 131 | */ |
Christopher Haster |
1:24750b9ad5ef | 132 | int mbedtls_ripemd160_self_test( int verbose ); |
Christopher Haster |
1:24750b9ad5ef | 133 | |
Christopher Haster |
1:24750b9ad5ef | 134 | #ifdef __cplusplus |
Christopher Haster |
1:24750b9ad5ef | 135 | } |
Christopher Haster |
1:24750b9ad5ef | 136 | #endif |
Christopher Haster |
1:24750b9ad5ef | 137 | |
Christopher Haster |
1:24750b9ad5ef | 138 | #endif /* mbedtls_ripemd160.h */ |