Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
md5.h
00001 /* md5.h 00002 * 00003 * Copyright (C) 2006-2017 wolfSSL Inc. 00004 * 00005 * This file is part of wolfSSL. 00006 * 00007 * wolfSSL is free software; you can redistribute it and/or modify 00008 * it under the terms of the GNU General Public License as published by 00009 * the Free Software Foundation; either version 2 of the License, or 00010 * (at your option) any later version. 00011 * 00012 * wolfSSL is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 * GNU General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU General Public License 00018 * along with this program; if not, write to the Free Software 00019 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA 00020 */ 00021 00022 /*! 00023 \file wolfssl/wolfcrypt/md5.h 00024 */ 00025 00026 00027 #ifndef WOLF_CRYPT_MD5_H 00028 #define WOLF_CRYPT_MD5_H 00029 00030 #include <wolfcrypt/types.h> 00031 00032 #ifndef NO_MD5 00033 00034 #ifdef HAVE_FIPS 00035 #define wc_InitMd5 InitMd5 00036 #define wc_Md5Update Md5Update 00037 #define wc_Md5Final Md5Final 00038 #define wc_Md5Hash Md5Hash 00039 #endif 00040 00041 #ifdef __cplusplus 00042 extern "C" { 00043 #endif 00044 00045 #ifndef NO_OLD_WC_NAMES 00046 #define Md5 wc_Md5 00047 #define MD5 WC_MD5 00048 #define MD5_BLOCK_SIZE WC_MD5_BLOCK_SIZE 00049 #define MD5_DIGEST_SIZE WC_MD5_DIGEST_SIZE 00050 #define WC_MD5_PAD_SIZE WC_MD5_PAD_SIZE 00051 #endif 00052 00053 /* in bytes */ 00054 enum { 00055 WC_MD5 = WC_HASH_TYPE_MD5, 00056 WC_MD5_BLOCK_SIZE = 64, 00057 WC_MD5_DIGEST_SIZE = 16, 00058 WC_MD5_PAD_SIZE = 56 00059 }; 00060 00061 00062 #ifdef WOLFSSL_MICROCHIP_PIC32MZ 00063 #include <wolfcrypt/port/pic32/pic32mz-crypt.h> 00064 #endif 00065 #ifdef STM32_HASH 00066 #include <wolfcrypt/port/st/stm32.h> 00067 #endif 00068 #ifdef WOLFSSL_ASYNC_CRYPT 00069 #include <wolfcrypt/async.h> 00070 #endif 00071 00072 #ifdef WOLFSSL_TI_HASH 00073 #include "wolfcrypt/port/ti/ti-hash.h" 00074 #elif defined(WOLFSSL_IMX6_CAAM) 00075 #include "wolfcrypt/port/caam/wolfcaam_sha.h" 00076 #else 00077 00078 /* MD5 digest */ 00079 typedef struct wc_Md5 { 00080 #ifdef STM32_HASH 00081 STM32_HASH_Context stmCtx; 00082 #else 00083 word32 buffLen; /* in bytes */ 00084 word32 loLen; /* length in bytes */ 00085 word32 hiLen; /* length in bytes */ 00086 word32 buffer[WC_MD5_BLOCK_SIZE / sizeof(word32)]; 00087 #ifdef WOLFSSL_PIC32MZ_HASH 00088 word32 digest[PIC32_DIGEST_SIZE / sizeof(word32)]; 00089 #else 00090 word32 digest[WC_MD5_DIGEST_SIZE / sizeof(word32)]; 00091 #endif 00092 void* heap; 00093 #ifdef WOLFSSL_PIC32MZ_HASH 00094 hashUpdCache cache; /* cache for updates */ 00095 #endif 00096 #endif /* STM32_HASH */ 00097 #ifdef WOLFSSL_ASYNC_CRYPT 00098 WC_ASYNC_DEV asyncDev; 00099 #endif /* WOLFSSL_ASYNC_CRYPT */ 00100 } wc_Md5; 00101 00102 #endif /* WOLFSSL_TI_HASH */ 00103 00104 WOLFSSL_API int wc_InitMd5(wc_Md5*); 00105 WOLFSSL_API int wc_InitMd5_ex(wc_Md5*, void*, int); 00106 WOLFSSL_API int wc_Md5Update(wc_Md5*, const byte*, word32); 00107 WOLFSSL_API int wc_Md5Final(wc_Md5*, byte*); 00108 WOLFSSL_API void wc_Md5Free(wc_Md5*); 00109 00110 WOLFSSL_API int wc_Md5GetHash(wc_Md5*, byte*); 00111 WOLFSSL_API int wc_Md5Copy(wc_Md5*, wc_Md5*); 00112 00113 #ifdef WOLFSSL_PIC32MZ_HASH 00114 WOLFSSL_API void wc_Md5SizeSet(wc_Md5* md5, word32 len); 00115 #endif 00116 00117 #ifdef __cplusplus 00118 } /* extern "C" */ 00119 #endif 00120 00121 #endif /* NO_MD5 */ 00122 #endif /* WOLF_CRYPT_MD5_H */ 00123
Generated on Tue Jul 12 2022 16:58:06 by
1.7.2