This is a port of cyaSSL 2.7.0.
Dependents: CyaSSL_DTLS_Cellular CyaSSL_DTLS_Ethernet
sha512.h
00001 /* sha512.h 00002 * 00003 * Copyright (C) 2006-2013 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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 void InitSha512(Sha512*); 00055 CYASSL_API void Sha512Update(Sha512*, const byte*, word32); 00056 CYASSL_API void 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 void InitSha384(Sha384*); 00081 CYASSL_API void Sha384Update(Sha384*, const byte*, word32); 00082 CYASSL_API void Sha384Final(Sha384*, byte*); 00083 00084 #endif /* CYASSL_SHA384 */ 00085 00086 #ifdef __cplusplus 00087 } /* extern "C" */ 00088 #endif 00089 00090 #endif /* CTAO_CRYPT_SHA512_H */ 00091 #endif /* CYASSL_SHA512 */
Generated on Tue Jul 12 2022 20:44:51 by 1.7.2