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: HTTPClient-SSL HTTPClient-SSL HTTPClient-SSL HTTPClient-SSL
sha.h
00001 /* sha.h 00002 * 00003 * Copyright (C) 2006-2014 wolfSSL Inc. 00004 * 00005 * This file is part of CyaSSL. 00006 * 00007 * CyaSSL 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 * CyaSSL 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-1301, USA 00020 */ 00021 00022 00023 #ifndef NO_SHA 00024 00025 #ifndef CTAO_CRYPT_SHA_H 00026 #define CTAO_CRYPT_SHA_H 00027 00028 #include <cyassl/ctaocrypt/types.h> 00029 00030 #ifdef __cplusplus 00031 extern "C" { 00032 #endif 00033 00034 00035 /* in bytes */ 00036 enum { 00037 #ifdef STM32F2_HASH 00038 SHA_REG_SIZE = 4, /* STM32 register size, bytes */ 00039 #endif 00040 SHA = 1, /* hash type unique */ 00041 SHA_BLOCK_SIZE = 64, 00042 SHA_DIGEST_SIZE = 20, 00043 SHA_PAD_SIZE = 56 00044 }; 00045 00046 #ifdef CYASSL_PIC32MZ_HASH 00047 #include "port/pic32/pic32mz-crypt.h" 00048 #endif 00049 00050 /* Sha digest */ 00051 typedef struct Sha { 00052 word32 buffLen; /* in bytes */ 00053 word32 loLen; /* length in bytes */ 00054 word32 hiLen; /* length in bytes */ 00055 word32 buffer[SHA_BLOCK_SIZE / sizeof(word32)]; 00056 #ifndef CYASSL_PIC32MZ_HASH 00057 word32 digest[SHA_DIGEST_SIZE / sizeof(word32)]; 00058 #else 00059 word32 digest[PIC32_HASH_SIZE / sizeof(word32)]; 00060 pic32mz_desc desc; /* Crypt Engine descripter */ 00061 #endif 00062 } Sha; 00063 00064 00065 CYASSL_API int InitSha(Sha*); 00066 CYASSL_API int ShaUpdate(Sha*, const byte*, word32); 00067 CYASSL_API int ShaFinal(Sha*, byte*); 00068 CYASSL_API int ShaHash(const byte*, word32, byte*); 00069 00070 00071 #ifdef HAVE_FIPS 00072 /* fips wrapper calls, user can call direct */ 00073 CYASSL_API int InitSha_fips(Sha*); 00074 CYASSL_API int ShaUpdate_fips(Sha*, const byte*, word32); 00075 CYASSL_API int ShaFinal_fips(Sha*, byte*); 00076 #ifndef FIPS_NO_WRAPPERS 00077 /* if not impl or fips.c impl wrapper force fips calls if fips build */ 00078 #define InitSha InitSha_fips 00079 #define ShaUpdate ShaUpdate_fips 00080 #define ShaFinal ShaFinal_fips 00081 #endif /* FIPS_NO_WRAPPERS */ 00082 00083 #endif /* HAVE_FIPS */ 00084 00085 00086 #ifdef __cplusplus 00087 } /* extern "C" */ 00088 #endif 00089 00090 #endif /* CTAO_CRYPT_SHA_H */ 00091 #endif /* NO_SHA */ 00092
Generated on Wed Jul 13 2022 02:33:57 by
1.7.2