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 HTTPClient-SSL http_access ... more
sha512.h
00001 /* sha512.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 #ifdef CYASSL_SHA512 00024 00025 #ifndef CTAO_CRYPT_SHA512_H 00026 #define CTAO_CRYPT_SHA512_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 SHA512 = 4, /* hash type unique */ 00038 SHA512_BLOCK_SIZE = 128, 00039 SHA512_DIGEST_SIZE = 64, 00040 SHA512_PAD_SIZE = 112 00041 }; 00042 00043 00044 /* Sha512 digest */ 00045 typedef struct Sha512 { 00046 word32 buffLen; /* in bytes */ 00047 word32 loLen; /* length in bytes */ 00048 word32 hiLen; /* length in bytes */ 00049 word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; 00050 word64 buffer[SHA512_BLOCK_SIZE / sizeof(word64)]; 00051 } Sha512; 00052 00053 00054 CYASSL_API int InitSha512(Sha512*); 00055 CYASSL_API int Sha512Update(Sha512*, const byte*, word32); 00056 CYASSL_API int Sha512Final(Sha512*, byte*); 00057 00058 00059 #if defined(CYASSL_SHA384) || defined(HAVE_AESGCM) 00060 00061 /* in bytes */ 00062 enum { 00063 SHA384 = 5, /* hash type unique */ 00064 SHA384_BLOCK_SIZE = 128, 00065 SHA384_DIGEST_SIZE = 48, 00066 SHA384_PAD_SIZE = 112 00067 }; 00068 00069 00070 /* Sha384 digest */ 00071 typedef struct Sha384 { 00072 word32 buffLen; /* in bytes */ 00073 word32 loLen; /* length in bytes */ 00074 word32 hiLen; /* length in bytes */ 00075 word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; /* for transform 512 */ 00076 word64 buffer[SHA384_BLOCK_SIZE / sizeof(word64)]; 00077 } Sha384; 00078 00079 00080 CYASSL_API int InitSha384(Sha384*); 00081 CYASSL_API int Sha384Update(Sha384*, const byte*, word32); 00082 CYASSL_API int Sha384Final(Sha384*, byte*); 00083 00084 00085 #ifdef HAVE_FIPS 00086 /* fips wrapper calls, user can call direct */ 00087 CYASSL_API int InitSha512_fips(Sha512*); 00088 CYASSL_API int Sha512Update_fips(Sha512*, const byte*, word32); 00089 CYASSL_API int Sha512Final_fips(Sha512*, byte*); 00090 #ifndef FIPS_NO_WRAPPERS 00091 /* if not impl or fips.c impl wrapper force fips calls if fips build */ 00092 #define InitSha512 InitSha512_fips 00093 #define Sha512Update Sha512Update_fips 00094 #define Sha512Final Sha512Final_fips 00095 #endif /* FIPS_NO_WRAPPERS */ 00096 00097 /* fips wrapper calls, user can call direct */ 00098 CYASSL_API int InitSha384_fips(Sha384*); 00099 CYASSL_API int Sha384Update_fips(Sha384*, const byte*, word32); 00100 CYASSL_API int Sha384Final_fips(Sha384*, byte*); 00101 #ifndef FIPS_NO_WRAPPERS 00102 /* if not impl or fips.c impl wrapper force fips calls if fips build */ 00103 #define InitSha384 InitSha384_fips 00104 #define Sha384Update Sha384Update_fips 00105 #define Sha384Final Sha384Final_fips 00106 #endif /* FIPS_NO_WRAPPERS */ 00107 00108 #endif /* HAVE_FIPS */ 00109 00110 00111 #endif /* CYASSL_SHA384 */ 00112 00113 #ifdef __cplusplus 00114 } /* extern "C" */ 00115 #endif 00116 00117 #endif /* CTAO_CRYPT_SHA512_H */ 00118 #endif /* CYASSL_SHA512 */ 00119
Generated on Wed Jul 13 2022 02:18:40 by
 1.7.2
 1.7.2 
    