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.
sha256.h
00001 /* sha256.h 00002 * 00003 * Copyright (C) 2006-2016 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 /* code submitted by raphael.huck@efixo.com */ 00024 00025 #ifndef WOLF_CRYPT_SHA256_H 00026 #define WOLF_CRYPT_SHA256_H 00027 00028 #include <wolfssl/wolfcrypt/types.h> 00029 00030 #ifndef NO_SHA256 00031 00032 #ifdef HAVE_FIPS 00033 /* for fips @wc_fips */ 00034 #include <cyassl/ctaocrypt/sha256.h> 00035 #endif 00036 00037 00038 #ifdef __cplusplus 00039 extern "C" { 00040 #endif 00041 00042 #ifndef HAVE_FIPS /* avoid redefinition of structs */ 00043 #ifdef WOLFSSL_PIC32MZ_HASH 00044 #include "port/pic32/pic32mz-crypt.h" 00045 #endif 00046 00047 /* in bytes */ 00048 enum { 00049 SHA256 = 2, /* hash type unique */ 00050 SHA256_BLOCK_SIZE = 64, 00051 SHA256_DIGEST_SIZE = 32, 00052 SHA256_PAD_SIZE = 56 00053 }; 00054 00055 #ifndef WOLFSSL_TI_HASH 00056 00057 /* Sha256 digest */ 00058 typedef struct Sha256 { 00059 word32 buffLen; /* in bytes */ 00060 word32 loLen; /* length in bytes */ 00061 word32 hiLen; /* length in bytes */ 00062 word32 digest[SHA256_DIGEST_SIZE / sizeof(word32)]; 00063 word32 buffer[SHA256_BLOCK_SIZE / sizeof(word32)]; 00064 #ifdef WOLFSSL_PIC32MZ_HASH 00065 pic32mz_desc desc ; /* Crypt Engine descriptor */ 00066 #endif 00067 } Sha256; 00068 00069 #else /* WOLFSSL_TI_HASH */ 00070 #include "wolfssl/wolfcrypt/port/ti/ti-hash.h" 00071 #endif 00072 00073 #endif /* HAVE_FIPS */ 00074 00075 WOLFSSL_API int wc_InitSha256(Sha256*); 00076 WOLFSSL_API int wc_Sha256Update(Sha256*, const byte*, word32); 00077 WOLFSSL_API int wc_Sha256Final(Sha256*, byte*); 00078 00079 #ifdef __cplusplus 00080 } /* extern "C" */ 00081 #endif 00082 00083 #endif /* NO_SHA256 */ 00084 #endif /* WOLF_CRYPT_SHA256_H */ 00085 00086
Generated on Tue Jul 12 2022 15:55:20 by
1.7.2