mbed client on ethernet with LWIP
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Fork of mbed-client-classic-example-lwip by
mbedtls/source/md_wrap.c@11:cada08fc8a70, 2016-06-09 (annotated)
- Committer:
- mbedAustin
- Date:
- Thu Jun 09 17:08:36 2016 +0000
- Revision:
- 11:cada08fc8a70
Commit for public Consumption
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbedAustin | 11:cada08fc8a70 | 1 | /** |
mbedAustin | 11:cada08fc8a70 | 2 | * \file md_wrap.c |
mbedAustin | 11:cada08fc8a70 | 3 | * |
mbedAustin | 11:cada08fc8a70 | 4 | * \brief Generic message digest wrapper for mbed TLS |
mbedAustin | 11:cada08fc8a70 | 5 | * |
mbedAustin | 11:cada08fc8a70 | 6 | * \author Adriaan de Jong <dejong@fox-it.com> |
mbedAustin | 11:cada08fc8a70 | 7 | * |
mbedAustin | 11:cada08fc8a70 | 8 | * Copyright (C) 2006-2015, ARM Limited, All Rights Reserved |
mbedAustin | 11:cada08fc8a70 | 9 | * SPDX-License-Identifier: Apache-2.0 |
mbedAustin | 11:cada08fc8a70 | 10 | * |
mbedAustin | 11:cada08fc8a70 | 11 | * Licensed under the Apache License, Version 2.0 (the "License"); you may |
mbedAustin | 11:cada08fc8a70 | 12 | * not use this file except in compliance with the License. |
mbedAustin | 11:cada08fc8a70 | 13 | * You may obtain a copy of the License at |
mbedAustin | 11:cada08fc8a70 | 14 | * |
mbedAustin | 11:cada08fc8a70 | 15 | * http://www.apache.org/licenses/LICENSE-2.0 |
mbedAustin | 11:cada08fc8a70 | 16 | * |
mbedAustin | 11:cada08fc8a70 | 17 | * Unless required by applicable law or agreed to in writing, software |
mbedAustin | 11:cada08fc8a70 | 18 | * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT |
mbedAustin | 11:cada08fc8a70 | 19 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
mbedAustin | 11:cada08fc8a70 | 20 | * See the License for the specific language governing permissions and |
mbedAustin | 11:cada08fc8a70 | 21 | * limitations under the License. |
mbedAustin | 11:cada08fc8a70 | 22 | * |
mbedAustin | 11:cada08fc8a70 | 23 | * This file is part of mbed TLS (https://tls.mbed.org) |
mbedAustin | 11:cada08fc8a70 | 24 | */ |
mbedAustin | 11:cada08fc8a70 | 25 | |
mbedAustin | 11:cada08fc8a70 | 26 | #if !defined(MBEDTLS_CONFIG_FILE) |
mbedAustin | 11:cada08fc8a70 | 27 | #include "mbedtls/config.h" |
mbedAustin | 11:cada08fc8a70 | 28 | #else |
mbedAustin | 11:cada08fc8a70 | 29 | #include MBEDTLS_CONFIG_FILE |
mbedAustin | 11:cada08fc8a70 | 30 | #endif |
mbedAustin | 11:cada08fc8a70 | 31 | |
mbedAustin | 11:cada08fc8a70 | 32 | #if defined(MBEDTLS_MD_C) |
mbedAustin | 11:cada08fc8a70 | 33 | |
mbedAustin | 11:cada08fc8a70 | 34 | #include "mbedtls/md_internal.h" |
mbedAustin | 11:cada08fc8a70 | 35 | |
mbedAustin | 11:cada08fc8a70 | 36 | #if defined(MBEDTLS_MD2_C) |
mbedAustin | 11:cada08fc8a70 | 37 | #include "mbedtls/md2.h" |
mbedAustin | 11:cada08fc8a70 | 38 | #endif |
mbedAustin | 11:cada08fc8a70 | 39 | |
mbedAustin | 11:cada08fc8a70 | 40 | #if defined(MBEDTLS_MD4_C) |
mbedAustin | 11:cada08fc8a70 | 41 | #include "mbedtls/md4.h" |
mbedAustin | 11:cada08fc8a70 | 42 | #endif |
mbedAustin | 11:cada08fc8a70 | 43 | |
mbedAustin | 11:cada08fc8a70 | 44 | #if defined(MBEDTLS_MD5_C) |
mbedAustin | 11:cada08fc8a70 | 45 | #include "mbedtls/md5.h" |
mbedAustin | 11:cada08fc8a70 | 46 | #endif |
mbedAustin | 11:cada08fc8a70 | 47 | |
mbedAustin | 11:cada08fc8a70 | 48 | #if defined(MBEDTLS_RIPEMD160_C) |
mbedAustin | 11:cada08fc8a70 | 49 | #include "mbedtls/ripemd160.h" |
mbedAustin | 11:cada08fc8a70 | 50 | #endif |
mbedAustin | 11:cada08fc8a70 | 51 | |
mbedAustin | 11:cada08fc8a70 | 52 | #if defined(MBEDTLS_SHA1_C) |
mbedAustin | 11:cada08fc8a70 | 53 | #include "mbedtls/sha1.h" |
mbedAustin | 11:cada08fc8a70 | 54 | #endif |
mbedAustin | 11:cada08fc8a70 | 55 | |
mbedAustin | 11:cada08fc8a70 | 56 | #if defined(MBEDTLS_SHA256_C) |
mbedAustin | 11:cada08fc8a70 | 57 | #include "mbedtls/sha256.h" |
mbedAustin | 11:cada08fc8a70 | 58 | #endif |
mbedAustin | 11:cada08fc8a70 | 59 | |
mbedAustin | 11:cada08fc8a70 | 60 | #if defined(MBEDTLS_SHA512_C) |
mbedAustin | 11:cada08fc8a70 | 61 | #include "mbedtls/sha512.h" |
mbedAustin | 11:cada08fc8a70 | 62 | #endif |
mbedAustin | 11:cada08fc8a70 | 63 | |
mbedAustin | 11:cada08fc8a70 | 64 | #if defined(MBEDTLS_PLATFORM_C) |
mbedAustin | 11:cada08fc8a70 | 65 | #include "mbedtls/platform.h" |
mbedAustin | 11:cada08fc8a70 | 66 | #else |
mbedAustin | 11:cada08fc8a70 | 67 | #include <stdlib.h> |
mbedAustin | 11:cada08fc8a70 | 68 | #define mbedtls_calloc calloc |
mbedAustin | 11:cada08fc8a70 | 69 | #define mbedtls_free free |
mbedAustin | 11:cada08fc8a70 | 70 | #endif |
mbedAustin | 11:cada08fc8a70 | 71 | |
mbedAustin | 11:cada08fc8a70 | 72 | #if defined(MBEDTLS_MD2_C) |
mbedAustin | 11:cada08fc8a70 | 73 | |
mbedAustin | 11:cada08fc8a70 | 74 | static void md2_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 75 | { |
mbedAustin | 11:cada08fc8a70 | 76 | mbedtls_md2_starts( (mbedtls_md2_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 77 | } |
mbedAustin | 11:cada08fc8a70 | 78 | |
mbedAustin | 11:cada08fc8a70 | 79 | static void md2_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 80 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 81 | { |
mbedAustin | 11:cada08fc8a70 | 82 | mbedtls_md2_update( (mbedtls_md2_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 83 | } |
mbedAustin | 11:cada08fc8a70 | 84 | |
mbedAustin | 11:cada08fc8a70 | 85 | static void md2_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 86 | { |
mbedAustin | 11:cada08fc8a70 | 87 | mbedtls_md2_finish( (mbedtls_md2_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 88 | } |
mbedAustin | 11:cada08fc8a70 | 89 | |
mbedAustin | 11:cada08fc8a70 | 90 | static void *md2_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 91 | { |
mbedAustin | 11:cada08fc8a70 | 92 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_md2_context ) ); |
mbedAustin | 11:cada08fc8a70 | 93 | |
mbedAustin | 11:cada08fc8a70 | 94 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 95 | mbedtls_md2_init( (mbedtls_md2_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 96 | |
mbedAustin | 11:cada08fc8a70 | 97 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 98 | } |
mbedAustin | 11:cada08fc8a70 | 99 | |
mbedAustin | 11:cada08fc8a70 | 100 | static void md2_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 101 | { |
mbedAustin | 11:cada08fc8a70 | 102 | mbedtls_md2_free( (mbedtls_md2_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 103 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 104 | } |
mbedAustin | 11:cada08fc8a70 | 105 | |
mbedAustin | 11:cada08fc8a70 | 106 | static void md2_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 107 | { |
mbedAustin | 11:cada08fc8a70 | 108 | mbedtls_md2_clone( (mbedtls_md2_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 109 | (const mbedtls_md2_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 110 | } |
mbedAustin | 11:cada08fc8a70 | 111 | |
mbedAustin | 11:cada08fc8a70 | 112 | static void md2_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 113 | { |
mbedAustin | 11:cada08fc8a70 | 114 | ((void) data); |
mbedAustin | 11:cada08fc8a70 | 115 | |
mbedAustin | 11:cada08fc8a70 | 116 | mbedtls_md2_process( (mbedtls_md2_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 117 | } |
mbedAustin | 11:cada08fc8a70 | 118 | |
mbedAustin | 11:cada08fc8a70 | 119 | const mbedtls_md_info_t mbedtls_md2_info = { |
mbedAustin | 11:cada08fc8a70 | 120 | MBEDTLS_MD_MD2, |
mbedAustin | 11:cada08fc8a70 | 121 | "MD2", |
mbedAustin | 11:cada08fc8a70 | 122 | 16, |
mbedAustin | 11:cada08fc8a70 | 123 | 16, |
mbedAustin | 11:cada08fc8a70 | 124 | md2_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 125 | md2_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 126 | md2_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 127 | mbedtls_md2, |
mbedAustin | 11:cada08fc8a70 | 128 | md2_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 129 | md2_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 130 | md2_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 131 | md2_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 132 | }; |
mbedAustin | 11:cada08fc8a70 | 133 | |
mbedAustin | 11:cada08fc8a70 | 134 | #endif /* MBEDTLS_MD2_C */ |
mbedAustin | 11:cada08fc8a70 | 135 | |
mbedAustin | 11:cada08fc8a70 | 136 | #if defined(MBEDTLS_MD4_C) |
mbedAustin | 11:cada08fc8a70 | 137 | |
mbedAustin | 11:cada08fc8a70 | 138 | static void md4_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 139 | { |
mbedAustin | 11:cada08fc8a70 | 140 | mbedtls_md4_starts( (mbedtls_md4_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 141 | } |
mbedAustin | 11:cada08fc8a70 | 142 | |
mbedAustin | 11:cada08fc8a70 | 143 | static void md4_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 144 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 145 | { |
mbedAustin | 11:cada08fc8a70 | 146 | mbedtls_md4_update( (mbedtls_md4_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 147 | } |
mbedAustin | 11:cada08fc8a70 | 148 | |
mbedAustin | 11:cada08fc8a70 | 149 | static void md4_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 150 | { |
mbedAustin | 11:cada08fc8a70 | 151 | mbedtls_md4_finish( (mbedtls_md4_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 152 | } |
mbedAustin | 11:cada08fc8a70 | 153 | |
mbedAustin | 11:cada08fc8a70 | 154 | static void *md4_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 155 | { |
mbedAustin | 11:cada08fc8a70 | 156 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_md4_context ) ); |
mbedAustin | 11:cada08fc8a70 | 157 | |
mbedAustin | 11:cada08fc8a70 | 158 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 159 | mbedtls_md4_init( (mbedtls_md4_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 160 | |
mbedAustin | 11:cada08fc8a70 | 161 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 162 | } |
mbedAustin | 11:cada08fc8a70 | 163 | |
mbedAustin | 11:cada08fc8a70 | 164 | static void md4_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 165 | { |
mbedAustin | 11:cada08fc8a70 | 166 | mbedtls_md4_free( (mbedtls_md4_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 167 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 168 | } |
mbedAustin | 11:cada08fc8a70 | 169 | |
mbedAustin | 11:cada08fc8a70 | 170 | static void md4_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 171 | { |
mbedAustin | 11:cada08fc8a70 | 172 | mbedtls_md4_clone( (mbedtls_md4_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 173 | (const mbedtls_md4_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 174 | } |
mbedAustin | 11:cada08fc8a70 | 175 | |
mbedAustin | 11:cada08fc8a70 | 176 | static void md4_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 177 | { |
mbedAustin | 11:cada08fc8a70 | 178 | mbedtls_md4_process( (mbedtls_md4_context *) ctx, data ); |
mbedAustin | 11:cada08fc8a70 | 179 | } |
mbedAustin | 11:cada08fc8a70 | 180 | |
mbedAustin | 11:cada08fc8a70 | 181 | const mbedtls_md_info_t mbedtls_md4_info = { |
mbedAustin | 11:cada08fc8a70 | 182 | MBEDTLS_MD_MD4, |
mbedAustin | 11:cada08fc8a70 | 183 | "MD4", |
mbedAustin | 11:cada08fc8a70 | 184 | 16, |
mbedAustin | 11:cada08fc8a70 | 185 | 64, |
mbedAustin | 11:cada08fc8a70 | 186 | md4_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 187 | md4_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 188 | md4_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 189 | mbedtls_md4, |
mbedAustin | 11:cada08fc8a70 | 190 | md4_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 191 | md4_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 192 | md4_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 193 | md4_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 194 | }; |
mbedAustin | 11:cada08fc8a70 | 195 | |
mbedAustin | 11:cada08fc8a70 | 196 | #endif /* MBEDTLS_MD4_C */ |
mbedAustin | 11:cada08fc8a70 | 197 | |
mbedAustin | 11:cada08fc8a70 | 198 | #if defined(MBEDTLS_MD5_C) |
mbedAustin | 11:cada08fc8a70 | 199 | |
mbedAustin | 11:cada08fc8a70 | 200 | static void md5_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 201 | { |
mbedAustin | 11:cada08fc8a70 | 202 | mbedtls_md5_starts( (mbedtls_md5_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 203 | } |
mbedAustin | 11:cada08fc8a70 | 204 | |
mbedAustin | 11:cada08fc8a70 | 205 | static void md5_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 206 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 207 | { |
mbedAustin | 11:cada08fc8a70 | 208 | mbedtls_md5_update( (mbedtls_md5_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 209 | } |
mbedAustin | 11:cada08fc8a70 | 210 | |
mbedAustin | 11:cada08fc8a70 | 211 | static void md5_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 212 | { |
mbedAustin | 11:cada08fc8a70 | 213 | mbedtls_md5_finish( (mbedtls_md5_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 214 | } |
mbedAustin | 11:cada08fc8a70 | 215 | |
mbedAustin | 11:cada08fc8a70 | 216 | static void *md5_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 217 | { |
mbedAustin | 11:cada08fc8a70 | 218 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_md5_context ) ); |
mbedAustin | 11:cada08fc8a70 | 219 | |
mbedAustin | 11:cada08fc8a70 | 220 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 221 | mbedtls_md5_init( (mbedtls_md5_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 222 | |
mbedAustin | 11:cada08fc8a70 | 223 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 224 | } |
mbedAustin | 11:cada08fc8a70 | 225 | |
mbedAustin | 11:cada08fc8a70 | 226 | static void md5_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 227 | { |
mbedAustin | 11:cada08fc8a70 | 228 | mbedtls_md5_free( (mbedtls_md5_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 229 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 230 | } |
mbedAustin | 11:cada08fc8a70 | 231 | |
mbedAustin | 11:cada08fc8a70 | 232 | static void md5_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 233 | { |
mbedAustin | 11:cada08fc8a70 | 234 | mbedtls_md5_clone( (mbedtls_md5_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 235 | (const mbedtls_md5_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 236 | } |
mbedAustin | 11:cada08fc8a70 | 237 | |
mbedAustin | 11:cada08fc8a70 | 238 | static void md5_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 239 | { |
mbedAustin | 11:cada08fc8a70 | 240 | mbedtls_md5_process( (mbedtls_md5_context *) ctx, data ); |
mbedAustin | 11:cada08fc8a70 | 241 | } |
mbedAustin | 11:cada08fc8a70 | 242 | |
mbedAustin | 11:cada08fc8a70 | 243 | const mbedtls_md_info_t mbedtls_md5_info = { |
mbedAustin | 11:cada08fc8a70 | 244 | MBEDTLS_MD_MD5, |
mbedAustin | 11:cada08fc8a70 | 245 | "MD5", |
mbedAustin | 11:cada08fc8a70 | 246 | 16, |
mbedAustin | 11:cada08fc8a70 | 247 | 64, |
mbedAustin | 11:cada08fc8a70 | 248 | md5_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 249 | md5_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 250 | md5_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 251 | mbedtls_md5, |
mbedAustin | 11:cada08fc8a70 | 252 | md5_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 253 | md5_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 254 | md5_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 255 | md5_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 256 | }; |
mbedAustin | 11:cada08fc8a70 | 257 | |
mbedAustin | 11:cada08fc8a70 | 258 | #endif /* MBEDTLS_MD5_C */ |
mbedAustin | 11:cada08fc8a70 | 259 | |
mbedAustin | 11:cada08fc8a70 | 260 | #if defined(MBEDTLS_RIPEMD160_C) |
mbedAustin | 11:cada08fc8a70 | 261 | |
mbedAustin | 11:cada08fc8a70 | 262 | static void ripemd160_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 263 | { |
mbedAustin | 11:cada08fc8a70 | 264 | mbedtls_ripemd160_starts( (mbedtls_ripemd160_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 265 | } |
mbedAustin | 11:cada08fc8a70 | 266 | |
mbedAustin | 11:cada08fc8a70 | 267 | static void ripemd160_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 268 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 269 | { |
mbedAustin | 11:cada08fc8a70 | 270 | mbedtls_ripemd160_update( (mbedtls_ripemd160_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 271 | } |
mbedAustin | 11:cada08fc8a70 | 272 | |
mbedAustin | 11:cada08fc8a70 | 273 | static void ripemd160_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 274 | { |
mbedAustin | 11:cada08fc8a70 | 275 | mbedtls_ripemd160_finish( (mbedtls_ripemd160_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 276 | } |
mbedAustin | 11:cada08fc8a70 | 277 | |
mbedAustin | 11:cada08fc8a70 | 278 | static void *ripemd160_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 279 | { |
mbedAustin | 11:cada08fc8a70 | 280 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_ripemd160_context ) ); |
mbedAustin | 11:cada08fc8a70 | 281 | |
mbedAustin | 11:cada08fc8a70 | 282 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 283 | mbedtls_ripemd160_init( (mbedtls_ripemd160_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 284 | |
mbedAustin | 11:cada08fc8a70 | 285 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 286 | } |
mbedAustin | 11:cada08fc8a70 | 287 | |
mbedAustin | 11:cada08fc8a70 | 288 | static void ripemd160_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 289 | { |
mbedAustin | 11:cada08fc8a70 | 290 | mbedtls_ripemd160_free( (mbedtls_ripemd160_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 291 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 292 | } |
mbedAustin | 11:cada08fc8a70 | 293 | |
mbedAustin | 11:cada08fc8a70 | 294 | static void ripemd160_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 295 | { |
mbedAustin | 11:cada08fc8a70 | 296 | mbedtls_ripemd160_clone( (mbedtls_ripemd160_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 297 | (const mbedtls_ripemd160_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 298 | } |
mbedAustin | 11:cada08fc8a70 | 299 | |
mbedAustin | 11:cada08fc8a70 | 300 | static void ripemd160_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 301 | { |
mbedAustin | 11:cada08fc8a70 | 302 | mbedtls_ripemd160_process( (mbedtls_ripemd160_context *) ctx, data ); |
mbedAustin | 11:cada08fc8a70 | 303 | } |
mbedAustin | 11:cada08fc8a70 | 304 | |
mbedAustin | 11:cada08fc8a70 | 305 | const mbedtls_md_info_t mbedtls_ripemd160_info = { |
mbedAustin | 11:cada08fc8a70 | 306 | MBEDTLS_MD_RIPEMD160, |
mbedAustin | 11:cada08fc8a70 | 307 | "RIPEMD160", |
mbedAustin | 11:cada08fc8a70 | 308 | 20, |
mbedAustin | 11:cada08fc8a70 | 309 | 64, |
mbedAustin | 11:cada08fc8a70 | 310 | ripemd160_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 311 | ripemd160_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 312 | ripemd160_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 313 | mbedtls_ripemd160, |
mbedAustin | 11:cada08fc8a70 | 314 | ripemd160_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 315 | ripemd160_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 316 | ripemd160_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 317 | ripemd160_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 318 | }; |
mbedAustin | 11:cada08fc8a70 | 319 | |
mbedAustin | 11:cada08fc8a70 | 320 | #endif /* MBEDTLS_RIPEMD160_C */ |
mbedAustin | 11:cada08fc8a70 | 321 | |
mbedAustin | 11:cada08fc8a70 | 322 | #if defined(MBEDTLS_SHA1_C) |
mbedAustin | 11:cada08fc8a70 | 323 | |
mbedAustin | 11:cada08fc8a70 | 324 | static void sha1_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 325 | { |
mbedAustin | 11:cada08fc8a70 | 326 | mbedtls_sha1_starts( (mbedtls_sha1_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 327 | } |
mbedAustin | 11:cada08fc8a70 | 328 | |
mbedAustin | 11:cada08fc8a70 | 329 | static void sha1_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 330 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 331 | { |
mbedAustin | 11:cada08fc8a70 | 332 | mbedtls_sha1_update( (mbedtls_sha1_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 333 | } |
mbedAustin | 11:cada08fc8a70 | 334 | |
mbedAustin | 11:cada08fc8a70 | 335 | static void sha1_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 336 | { |
mbedAustin | 11:cada08fc8a70 | 337 | mbedtls_sha1_finish( (mbedtls_sha1_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 338 | } |
mbedAustin | 11:cada08fc8a70 | 339 | |
mbedAustin | 11:cada08fc8a70 | 340 | static void *sha1_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 341 | { |
mbedAustin | 11:cada08fc8a70 | 342 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_sha1_context ) ); |
mbedAustin | 11:cada08fc8a70 | 343 | |
mbedAustin | 11:cada08fc8a70 | 344 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 345 | mbedtls_sha1_init( (mbedtls_sha1_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 346 | |
mbedAustin | 11:cada08fc8a70 | 347 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 348 | } |
mbedAustin | 11:cada08fc8a70 | 349 | |
mbedAustin | 11:cada08fc8a70 | 350 | static void sha1_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 351 | { |
mbedAustin | 11:cada08fc8a70 | 352 | mbedtls_sha1_clone( (mbedtls_sha1_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 353 | (const mbedtls_sha1_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 354 | } |
mbedAustin | 11:cada08fc8a70 | 355 | |
mbedAustin | 11:cada08fc8a70 | 356 | static void sha1_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 357 | { |
mbedAustin | 11:cada08fc8a70 | 358 | mbedtls_sha1_free( (mbedtls_sha1_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 359 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 360 | } |
mbedAustin | 11:cada08fc8a70 | 361 | |
mbedAustin | 11:cada08fc8a70 | 362 | static void sha1_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 363 | { |
mbedAustin | 11:cada08fc8a70 | 364 | mbedtls_sha1_process( (mbedtls_sha1_context *) ctx, data ); |
mbedAustin | 11:cada08fc8a70 | 365 | } |
mbedAustin | 11:cada08fc8a70 | 366 | |
mbedAustin | 11:cada08fc8a70 | 367 | const mbedtls_md_info_t mbedtls_sha1_info = { |
mbedAustin | 11:cada08fc8a70 | 368 | MBEDTLS_MD_SHA1, |
mbedAustin | 11:cada08fc8a70 | 369 | "SHA1", |
mbedAustin | 11:cada08fc8a70 | 370 | 20, |
mbedAustin | 11:cada08fc8a70 | 371 | 64, |
mbedAustin | 11:cada08fc8a70 | 372 | sha1_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 373 | sha1_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 374 | sha1_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 375 | mbedtls_sha1, |
mbedAustin | 11:cada08fc8a70 | 376 | sha1_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 377 | sha1_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 378 | sha1_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 379 | sha1_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 380 | }; |
mbedAustin | 11:cada08fc8a70 | 381 | |
mbedAustin | 11:cada08fc8a70 | 382 | #endif /* MBEDTLS_SHA1_C */ |
mbedAustin | 11:cada08fc8a70 | 383 | |
mbedAustin | 11:cada08fc8a70 | 384 | /* |
mbedAustin | 11:cada08fc8a70 | 385 | * Wrappers for generic message digests |
mbedAustin | 11:cada08fc8a70 | 386 | */ |
mbedAustin | 11:cada08fc8a70 | 387 | #if defined(MBEDTLS_SHA256_C) |
mbedAustin | 11:cada08fc8a70 | 388 | |
mbedAustin | 11:cada08fc8a70 | 389 | static void sha224_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 390 | { |
mbedAustin | 11:cada08fc8a70 | 391 | mbedtls_sha256_starts( (mbedtls_sha256_context *) ctx, 1 ); |
mbedAustin | 11:cada08fc8a70 | 392 | } |
mbedAustin | 11:cada08fc8a70 | 393 | |
mbedAustin | 11:cada08fc8a70 | 394 | static void sha224_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 395 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 396 | { |
mbedAustin | 11:cada08fc8a70 | 397 | mbedtls_sha256_update( (mbedtls_sha256_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 398 | } |
mbedAustin | 11:cada08fc8a70 | 399 | |
mbedAustin | 11:cada08fc8a70 | 400 | static void sha224_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 401 | { |
mbedAustin | 11:cada08fc8a70 | 402 | mbedtls_sha256_finish( (mbedtls_sha256_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 403 | } |
mbedAustin | 11:cada08fc8a70 | 404 | |
mbedAustin | 11:cada08fc8a70 | 405 | static void sha224_wrap( const unsigned char *input, size_t ilen, |
mbedAustin | 11:cada08fc8a70 | 406 | unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 407 | { |
mbedAustin | 11:cada08fc8a70 | 408 | mbedtls_sha256( input, ilen, output, 1 ); |
mbedAustin | 11:cada08fc8a70 | 409 | } |
mbedAustin | 11:cada08fc8a70 | 410 | |
mbedAustin | 11:cada08fc8a70 | 411 | static void *sha224_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 412 | { |
mbedAustin | 11:cada08fc8a70 | 413 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_sha256_context ) ); |
mbedAustin | 11:cada08fc8a70 | 414 | |
mbedAustin | 11:cada08fc8a70 | 415 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 416 | mbedtls_sha256_init( (mbedtls_sha256_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 417 | |
mbedAustin | 11:cada08fc8a70 | 418 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 419 | } |
mbedAustin | 11:cada08fc8a70 | 420 | |
mbedAustin | 11:cada08fc8a70 | 421 | static void sha224_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 422 | { |
mbedAustin | 11:cada08fc8a70 | 423 | mbedtls_sha256_free( (mbedtls_sha256_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 424 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 425 | } |
mbedAustin | 11:cada08fc8a70 | 426 | |
mbedAustin | 11:cada08fc8a70 | 427 | static void sha224_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 428 | { |
mbedAustin | 11:cada08fc8a70 | 429 | mbedtls_sha256_clone( (mbedtls_sha256_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 430 | (const mbedtls_sha256_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 431 | } |
mbedAustin | 11:cada08fc8a70 | 432 | |
mbedAustin | 11:cada08fc8a70 | 433 | static void sha224_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 434 | { |
mbedAustin | 11:cada08fc8a70 | 435 | mbedtls_sha256_process( (mbedtls_sha256_context *) ctx, data ); |
mbedAustin | 11:cada08fc8a70 | 436 | } |
mbedAustin | 11:cada08fc8a70 | 437 | |
mbedAustin | 11:cada08fc8a70 | 438 | const mbedtls_md_info_t mbedtls_sha224_info = { |
mbedAustin | 11:cada08fc8a70 | 439 | MBEDTLS_MD_SHA224, |
mbedAustin | 11:cada08fc8a70 | 440 | "SHA224", |
mbedAustin | 11:cada08fc8a70 | 441 | 28, |
mbedAustin | 11:cada08fc8a70 | 442 | 64, |
mbedAustin | 11:cada08fc8a70 | 443 | sha224_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 444 | sha224_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 445 | sha224_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 446 | sha224_wrap, |
mbedAustin | 11:cada08fc8a70 | 447 | sha224_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 448 | sha224_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 449 | sha224_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 450 | sha224_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 451 | }; |
mbedAustin | 11:cada08fc8a70 | 452 | |
mbedAustin | 11:cada08fc8a70 | 453 | static void sha256_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 454 | { |
mbedAustin | 11:cada08fc8a70 | 455 | mbedtls_sha256_starts( (mbedtls_sha256_context *) ctx, 0 ); |
mbedAustin | 11:cada08fc8a70 | 456 | } |
mbedAustin | 11:cada08fc8a70 | 457 | |
mbedAustin | 11:cada08fc8a70 | 458 | static void sha256_wrap( const unsigned char *input, size_t ilen, |
mbedAustin | 11:cada08fc8a70 | 459 | unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 460 | { |
mbedAustin | 11:cada08fc8a70 | 461 | mbedtls_sha256( input, ilen, output, 0 ); |
mbedAustin | 11:cada08fc8a70 | 462 | } |
mbedAustin | 11:cada08fc8a70 | 463 | |
mbedAustin | 11:cada08fc8a70 | 464 | const mbedtls_md_info_t mbedtls_sha256_info = { |
mbedAustin | 11:cada08fc8a70 | 465 | MBEDTLS_MD_SHA256, |
mbedAustin | 11:cada08fc8a70 | 466 | "SHA256", |
mbedAustin | 11:cada08fc8a70 | 467 | 32, |
mbedAustin | 11:cada08fc8a70 | 468 | 64, |
mbedAustin | 11:cada08fc8a70 | 469 | sha256_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 470 | sha224_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 471 | sha224_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 472 | sha256_wrap, |
mbedAustin | 11:cada08fc8a70 | 473 | sha224_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 474 | sha224_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 475 | sha224_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 476 | sha224_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 477 | }; |
mbedAustin | 11:cada08fc8a70 | 478 | |
mbedAustin | 11:cada08fc8a70 | 479 | #endif /* MBEDTLS_SHA256_C */ |
mbedAustin | 11:cada08fc8a70 | 480 | |
mbedAustin | 11:cada08fc8a70 | 481 | #if defined(MBEDTLS_SHA512_C) |
mbedAustin | 11:cada08fc8a70 | 482 | |
mbedAustin | 11:cada08fc8a70 | 483 | static void sha384_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 484 | { |
mbedAustin | 11:cada08fc8a70 | 485 | mbedtls_sha512_starts( (mbedtls_sha512_context *) ctx, 1 ); |
mbedAustin | 11:cada08fc8a70 | 486 | } |
mbedAustin | 11:cada08fc8a70 | 487 | |
mbedAustin | 11:cada08fc8a70 | 488 | static void sha384_update_wrap( void *ctx, const unsigned char *input, |
mbedAustin | 11:cada08fc8a70 | 489 | size_t ilen ) |
mbedAustin | 11:cada08fc8a70 | 490 | { |
mbedAustin | 11:cada08fc8a70 | 491 | mbedtls_sha512_update( (mbedtls_sha512_context *) ctx, input, ilen ); |
mbedAustin | 11:cada08fc8a70 | 492 | } |
mbedAustin | 11:cada08fc8a70 | 493 | |
mbedAustin | 11:cada08fc8a70 | 494 | static void sha384_finish_wrap( void *ctx, unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 495 | { |
mbedAustin | 11:cada08fc8a70 | 496 | mbedtls_sha512_finish( (mbedtls_sha512_context *) ctx, output ); |
mbedAustin | 11:cada08fc8a70 | 497 | } |
mbedAustin | 11:cada08fc8a70 | 498 | |
mbedAustin | 11:cada08fc8a70 | 499 | static void sha384_wrap( const unsigned char *input, size_t ilen, |
mbedAustin | 11:cada08fc8a70 | 500 | unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 501 | { |
mbedAustin | 11:cada08fc8a70 | 502 | mbedtls_sha512( input, ilen, output, 1 ); |
mbedAustin | 11:cada08fc8a70 | 503 | } |
mbedAustin | 11:cada08fc8a70 | 504 | |
mbedAustin | 11:cada08fc8a70 | 505 | static void *sha384_ctx_alloc( void ) |
mbedAustin | 11:cada08fc8a70 | 506 | { |
mbedAustin | 11:cada08fc8a70 | 507 | void *ctx = mbedtls_calloc( 1, sizeof( mbedtls_sha512_context ) ); |
mbedAustin | 11:cada08fc8a70 | 508 | |
mbedAustin | 11:cada08fc8a70 | 509 | if( ctx != NULL ) |
mbedAustin | 11:cada08fc8a70 | 510 | mbedtls_sha512_init( (mbedtls_sha512_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 511 | |
mbedAustin | 11:cada08fc8a70 | 512 | return( ctx ); |
mbedAustin | 11:cada08fc8a70 | 513 | } |
mbedAustin | 11:cada08fc8a70 | 514 | |
mbedAustin | 11:cada08fc8a70 | 515 | static void sha384_ctx_free( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 516 | { |
mbedAustin | 11:cada08fc8a70 | 517 | mbedtls_sha512_free( (mbedtls_sha512_context *) ctx ); |
mbedAustin | 11:cada08fc8a70 | 518 | mbedtls_free( ctx ); |
mbedAustin | 11:cada08fc8a70 | 519 | } |
mbedAustin | 11:cada08fc8a70 | 520 | |
mbedAustin | 11:cada08fc8a70 | 521 | static void sha384_clone_wrap( void *dst, const void *src ) |
mbedAustin | 11:cada08fc8a70 | 522 | { |
mbedAustin | 11:cada08fc8a70 | 523 | mbedtls_sha512_clone( (mbedtls_sha512_context *) dst, |
mbedAustin | 11:cada08fc8a70 | 524 | (const mbedtls_sha512_context *) src ); |
mbedAustin | 11:cada08fc8a70 | 525 | } |
mbedAustin | 11:cada08fc8a70 | 526 | |
mbedAustin | 11:cada08fc8a70 | 527 | static void sha384_process_wrap( void *ctx, const unsigned char *data ) |
mbedAustin | 11:cada08fc8a70 | 528 | { |
mbedAustin | 11:cada08fc8a70 | 529 | mbedtls_sha512_process( (mbedtls_sha512_context *) ctx, data ); |
mbedAustin | 11:cada08fc8a70 | 530 | } |
mbedAustin | 11:cada08fc8a70 | 531 | |
mbedAustin | 11:cada08fc8a70 | 532 | const mbedtls_md_info_t mbedtls_sha384_info = { |
mbedAustin | 11:cada08fc8a70 | 533 | MBEDTLS_MD_SHA384, |
mbedAustin | 11:cada08fc8a70 | 534 | "SHA384", |
mbedAustin | 11:cada08fc8a70 | 535 | 48, |
mbedAustin | 11:cada08fc8a70 | 536 | 128, |
mbedAustin | 11:cada08fc8a70 | 537 | sha384_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 538 | sha384_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 539 | sha384_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 540 | sha384_wrap, |
mbedAustin | 11:cada08fc8a70 | 541 | sha384_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 542 | sha384_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 543 | sha384_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 544 | sha384_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 545 | }; |
mbedAustin | 11:cada08fc8a70 | 546 | |
mbedAustin | 11:cada08fc8a70 | 547 | static void sha512_starts_wrap( void *ctx ) |
mbedAustin | 11:cada08fc8a70 | 548 | { |
mbedAustin | 11:cada08fc8a70 | 549 | mbedtls_sha512_starts( (mbedtls_sha512_context *) ctx, 0 ); |
mbedAustin | 11:cada08fc8a70 | 550 | } |
mbedAustin | 11:cada08fc8a70 | 551 | |
mbedAustin | 11:cada08fc8a70 | 552 | static void sha512_wrap( const unsigned char *input, size_t ilen, |
mbedAustin | 11:cada08fc8a70 | 553 | unsigned char *output ) |
mbedAustin | 11:cada08fc8a70 | 554 | { |
mbedAustin | 11:cada08fc8a70 | 555 | mbedtls_sha512( input, ilen, output, 0 ); |
mbedAustin | 11:cada08fc8a70 | 556 | } |
mbedAustin | 11:cada08fc8a70 | 557 | |
mbedAustin | 11:cada08fc8a70 | 558 | const mbedtls_md_info_t mbedtls_sha512_info = { |
mbedAustin | 11:cada08fc8a70 | 559 | MBEDTLS_MD_SHA512, |
mbedAustin | 11:cada08fc8a70 | 560 | "SHA512", |
mbedAustin | 11:cada08fc8a70 | 561 | 64, |
mbedAustin | 11:cada08fc8a70 | 562 | 128, |
mbedAustin | 11:cada08fc8a70 | 563 | sha512_starts_wrap, |
mbedAustin | 11:cada08fc8a70 | 564 | sha384_update_wrap, |
mbedAustin | 11:cada08fc8a70 | 565 | sha384_finish_wrap, |
mbedAustin | 11:cada08fc8a70 | 566 | sha512_wrap, |
mbedAustin | 11:cada08fc8a70 | 567 | sha384_ctx_alloc, |
mbedAustin | 11:cada08fc8a70 | 568 | sha384_ctx_free, |
mbedAustin | 11:cada08fc8a70 | 569 | sha384_clone_wrap, |
mbedAustin | 11:cada08fc8a70 | 570 | sha384_process_wrap, |
mbedAustin | 11:cada08fc8a70 | 571 | }; |
mbedAustin | 11:cada08fc8a70 | 572 | |
mbedAustin | 11:cada08fc8a70 | 573 | #endif /* MBEDTLS_SHA512_C */ |
mbedAustin | 11:cada08fc8a70 | 574 | |
mbedAustin | 11:cada08fc8a70 | 575 | #endif /* MBEDTLS_MD_C */ |