source: UsbWattMeter/trunk/wolfssl-3.7.0/wolfssl/wolfcrypt/sha512.h@ 164

Last change on this file since 164 was 164, checked in by coas-nagasima, 6 years ago

TOPPERS/ECNLサンプルアプリ「USB充電器電力計」を追加

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
  • Property svn:mime-type set to text/x-chdr
File size: 2.7 KB
Line 
1/* sha512.h
2 *
3 * Copyright (C) 2006-2015 wolfSSL Inc.
4 *
5 * This file is part of wolfSSL. (formerly known as CyaSSL)
6 *
7 * wolfSSL is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * wolfSSL is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 */
21
22#ifndef WOLF_CRYPT_SHA512_H
23#define WOLF_CRYPT_SHA512_H
24
25#include <wolfssl/wolfcrypt/types.h>
26
27#ifdef WOLFSSL_SHA512
28
29/* for fips @wc_fips */
30#ifdef HAVE_FIPS
31 #define CYASSL_SHA512
32 #if defined(WOLFSSL_SHA384)
33 #define CYASSL_SHA384
34 #endif
35 #include <cyassl/ctaocrypt/sha512.h>
36#endif
37
38#ifdef __cplusplus
39 extern "C" {
40#endif
41
42#ifndef HAVE_FIPS /* avoid redefinition of structs */
43
44/* in bytes */
45enum {
46 SHA512 = 4, /* hash type unique */
47 SHA512_BLOCK_SIZE = 128,
48 SHA512_DIGEST_SIZE = 64,
49 SHA512_PAD_SIZE = 112
50};
51
52
53/* Sha512 digest */
54typedef struct Sha512 {
55 word32 buffLen; /* in bytes */
56 word32 loLen; /* length in bytes */
57 word32 hiLen; /* length in bytes */
58 word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)];
59 word64 buffer[SHA512_BLOCK_SIZE / sizeof(word64)];
60} Sha512;
61
62#endif /* HAVE_FIPS */
63
64WOLFSSL_API int wc_InitSha512(Sha512*);
65WOLFSSL_API int wc_Sha512Update(Sha512*, const byte*, word32);
66WOLFSSL_API int wc_Sha512Final(Sha512*, byte*);
67
68#if defined(WOLFSSL_SHA384)
69
70#ifndef HAVE_FIPS /* avoid redefinition of structs */
71/* in bytes */
72enum {
73 SHA384 = 5, /* hash type unique */
74 SHA384_BLOCK_SIZE = 128,
75 SHA384_DIGEST_SIZE = 48,
76 SHA384_PAD_SIZE = 112
77};
78
79
80/* Sha384 digest */
81typedef struct Sha384 {
82 word32 buffLen; /* in bytes */
83 word32 loLen; /* length in bytes */
84 word32 hiLen; /* length in bytes */
85 word64 digest[SHA512_DIGEST_SIZE / sizeof(word64)]; /* for transform 512 */
86 word64 buffer[SHA384_BLOCK_SIZE / sizeof(word64)];
87} Sha384;
88#endif /* HAVE_FIPS */
89
90WOLFSSL_API int wc_InitSha384(Sha384*);
91WOLFSSL_API int wc_Sha384Update(Sha384*, const byte*, word32);
92WOLFSSL_API int wc_Sha384Final(Sha384*, byte*);
93
94#endif /* WOLFSSL_SHA384 */
95
96#ifdef __cplusplus
97 } /* extern "C" */
98#endif
99
100#endif /* WOLFSSL_SHA512 */
101#endif /* WOLF_CRYPT_SHA512_H */
102
Note: See TracBrowser for help on using the repository browser.