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.
Dependents: CyaSSL-Twitter-OAuth4Tw Example-client-tls-cert TwitterReader TweetTest ... more
sha3.h
00001 /* sha3.h 00002 * 00003 * Copyright (C) 2006-2020 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 /* sha3.h for openssl */ 00023 00024 00025 #ifndef WOLFSSL_SHA3_H_ 00026 #define WOLFSSL_SHA3_H_ 00027 00028 #include <wolfssl/wolfcrypt/settings.h> 00029 #include <wolfssl/wolfcrypt/types.h > 00030 00031 #ifdef WOLFSSL_PREFIX 00032 #include "prefix_sha.h" 00033 #endif 00034 00035 #ifdef __cplusplus 00036 extern "C" { 00037 #endif 00038 00039 00040 /* Using ALIGN16 because when AES-NI is enabled digest and buffer in Sha3 00041 * struct are 16 byte aligned. Any dereference to those elements after casting 00042 * to Sha3 is expected to also be 16 byte aligned addresses. */ 00043 struct WOLFSSL_SHA3_CTX { 00044 /* big enough to hold wolfcrypt Sha3, but check on init */ 00045 ALIGN16 void* holder[(424 + WC_ASYNC_DEV_SIZE) / sizeof(void*)]; 00046 }; 00047 00048 #ifndef WOLFSSL_NOSHA3_224 00049 typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_224_CTX; 00050 00051 WOLFSSL_API int wolfSSL_SHA3_224_Init(WOLFSSL_SHA3_224_CTX*); 00052 WOLFSSL_API int wolfSSL_SHA3_224_Update(WOLFSSL_SHA3_224_CTX*, const void*, 00053 unsigned long); 00054 WOLFSSL_API int wolfSSL_SHA3_224_Final(unsigned char*, WOLFSSL_SHA3_224_CTX*); 00055 00056 enum { 00057 SHA3_224_DIGEST_LENGTH = 28 00058 }; 00059 00060 typedef WOLFSSL_SHA3_224_CTX SHA3_224_CTX; 00061 00062 #define SHA3_224_Init wolfSSL_SHA3_224_Init 00063 #define SHA3_224_Update wolfSSL_SHA3_224_Update 00064 #define SHA3_224_Final wolfSSL_SHA3_224_Final 00065 #if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) 00066 #define SHA3_224 wolfSSL_SHA3_224 00067 #endif 00068 #endif /* WOLFSSL_NOSHA3_224 */ 00069 00070 00071 #ifndef WOLFSSL_NOSHA3_256 00072 typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_256_CTX; 00073 00074 00075 WOLFSSL_API int wolfSSL_SHA3_256_Init(WOLFSSL_SHA3_256_CTX*); 00076 WOLFSSL_API int wolfSSL_SHA3_256_Update(WOLFSSL_SHA3_256_CTX*, const void*, 00077 unsigned long); 00078 WOLFSSL_API int wolfSSL_SHA3_256_Final(unsigned char*, WOLFSSL_SHA3_256_CTX*); 00079 00080 enum { 00081 SHA3_256_DIGEST_LENGTH = 32 00082 }; 00083 00084 00085 typedef WOLFSSL_SHA3_256_CTX SHA3_256_CTX; 00086 00087 #define SHA3_256_Init wolfSSL_SHA3_256_Init 00088 #define SHA3_256_Update wolfSSL_SHA3_256_Update 00089 #define SHA3_256_Final wolfSSL_SHA3_256_Final 00090 #if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) 00091 #define SHA3_256 wolfSSL_SHA3_256 00092 #endif 00093 #endif /* WOLFSSL_NOSHA3_256 */ 00094 00095 00096 typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_384_CTX; 00097 00098 WOLFSSL_API int wolfSSL_SHA3_384_Init(WOLFSSL_SHA3_384_CTX*); 00099 WOLFSSL_API int wolfSSL_SHA3_384_Update(WOLFSSL_SHA3_384_CTX*, const void*, 00100 unsigned long); 00101 WOLFSSL_API int wolfSSL_SHA3_384_Final(unsigned char*, WOLFSSL_SHA3_384_CTX*); 00102 00103 enum { 00104 SHA3_384_DIGEST_LENGTH = 48 00105 }; 00106 00107 typedef WOLFSSL_SHA3_384_CTX SHA3_384_CTX; 00108 00109 #define SHA3_384_Init wolfSSL_SHA3_384_Init 00110 #define SHA3_384_Update wolfSSL_SHA3_384_Update 00111 #define SHA3_384_Final wolfSSL_SHA3_384_Final 00112 #if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) 00113 #define SHA3_384 wolfSSL_SHA3_384 00114 #endif 00115 00116 00117 #ifndef WOLFSSL_NOSHA3_512 00118 00119 typedef struct WOLFSSL_SHA3_CTX WOLFSSL_SHA3_512_CTX; 00120 00121 WOLFSSL_API int wolfSSL_SHA3_512_Init(WOLFSSL_SHA3_512_CTX*); 00122 WOLFSSL_API int wolfSSL_SHA3_512_Update(WOLFSSL_SHA3_512_CTX*, const void*, 00123 unsigned long); 00124 WOLFSSL_API int wolfSSL_SHA3_512_Final(unsigned char*, WOLFSSL_SHA3_512_CTX*); 00125 00126 enum { 00127 SHA3_512_DIGEST_LENGTH = 64 00128 }; 00129 00130 00131 typedef WOLFSSL_SHA3_512_CTX SHA3_512_CTX; 00132 00133 #define SHA3_512_Init wolfSSL_SHA3_512_Init 00134 #define SHA3_512_Update wolfSSL_SHA3_512_Update 00135 #define SHA3_512_Final wolfSSL_SHA3_512_Final 00136 #if defined(NO_OLD_WC_NAMES) && !defined(HAVE_FIPS) && !defined(HAVE_SELFTEST) 00137 #define SHA3_512 wolfSSL_SHA3_512 00138 #endif 00139 #endif /* WOLFSSL_NOSHA3_512 */ 00140 00141 00142 00143 00144 #ifdef __cplusplus 00145 } /* extern "C" */ 00146 #endif 00147 00148 00149 #endif /* WOLFSSL_SHA3_H_ */ 00150 00151
Generated on Tue Jul 12 2022 20:58:42 by
 1.7.2
 1.7.2