Ignore:
Timestamp:
Feb 7, 2019, 8:36:33 AM (5 years ago)
Author:
coas-nagasima
Message:

wolfsslを3.15.7にバージョンアップ

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asp3_tinet_ecnl_arm/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/sha512.h

    r352 r372  
    11/* sha512.h
    22 *
    3  * Copyright (C) 2006-2017 wolfSSL Inc.
     3 * Copyright (C) 2006-2018 wolfSSL Inc.
    44 *
    55 * This file is part of wolfSSL.
     
    2020 */
    2121
     22/*!
     23    \file wolfssl/wolfcrypt/sha512.h
     24*/
     25
    2226
    2327#ifndef WOLF_CRYPT_SHA512_H
     
    2630#include <wolfssl/wolfcrypt/types.h>
    2731
    28 #ifdef WOLFSSL_SHA512
     32#if defined(WOLFSSL_SHA512) || defined(WOLFSSL_SHA384)
    2933
    30 /* for fips @wc_fips */
    31 #ifdef HAVE_FIPS
     34#if defined(HAVE_FIPS) && \
     35    defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     36    #include <wolfssl/wolfcrypt/fips.h>
     37#endif /* HAVE_FIPS_VERSION >= 2 */
     38
     39#if defined(HAVE_FIPS) && \
     40        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
     41    #ifdef WOLFSSL_SHA512
    3242    #define wc_Sha512             Sha512
    3343    #define WC_SHA512             SHA512
     
    3545    #define WC_SHA512_DIGEST_SIZE SHA512_DIGEST_SIZE
    3646    #define WC_SHA512_PAD_SIZE    SHA512_PAD_SIZE
     47    #endif /* WOLFSSL_SHA512 */
    3748    #ifdef WOLFSSL_SHA384
    3849        #define wc_Sha384             Sha384
     
    4758        #define CYASSL_SHA384
    4859    #endif
     60        /* for fips @wc_fips */
    4961    #include <cyassl/ctaocrypt/sha512.h>
    5062#endif
     
    5466#endif
    5567
    56 #ifndef HAVE_FIPS /* avoid redefinition of structs */
     68/* avoid redefinition of structs */
     69#if !defined(HAVE_FIPS) || \
     70    (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
    5771
    5872#ifdef WOLFSSL_ASYNC_CRYPT
     
    6074#endif
    6175
    62 #ifndef NO_OLD_WC_NAMES
     76#if defined(_MSC_VER)
     77    #define SHA512_NOINLINE __declspec(noinline)
     78#elif defined(__GNUC__)
     79    #define SHA512_NOINLINE __attribute__((noinline))
     80#else
     81    #define SHA512_NOINLINE
     82#endif
     83
     84#ifdef WOLFSSL_SHA512
     85
     86#if !defined(NO_OLD_SHA_NAMES)
     87    #define SHA512             WC_SHA512
     88#endif
     89
     90#if !defined(NO_OLD_WC_NAMES)
    6391    #define Sha512             wc_Sha512
    64     #define SHA512             WC_SHA512
    6592    #define SHA512_BLOCK_SIZE  WC_SHA512_BLOCK_SIZE
    6693    #define SHA512_DIGEST_SIZE WC_SHA512_DIGEST_SIZE
     
    6895#endif
    6996
     97#endif /* WOLFSSL_SHA512 */
     98
    7099/* in bytes */
    71100enum {
    72     WC_SHA512              =   4,   /* hash type unique */
     101#ifdef WOLFSSL_SHA512
     102    WC_SHA512              =   WC_HASH_TYPE_SHA512,
     103#endif
    73104    WC_SHA512_BLOCK_SIZE   = 128,
    74105    WC_SHA512_DIGEST_SIZE  =  64,
     
    77108
    78109
     110#ifdef WOLFSSL_IMX6_CAAM
     111    #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h"
     112#else
    79113/* wc_Sha512 digest */
    80114typedef struct wc_Sha512 {
     115    word64  digest[WC_SHA512_DIGEST_SIZE / sizeof(word64)];
     116    word64  buffer[WC_SHA512_BLOCK_SIZE  / sizeof(word64)];
    81117    word32  buffLen;   /* in bytes          */
    82118    word64  loLen;     /* length in bytes   */
    83119    word64  hiLen;     /* length in bytes   */
    84     word64  digest[WC_SHA512_DIGEST_SIZE / sizeof(word64)];
    85     word64  buffer[WC_SHA512_BLOCK_SIZE  / sizeof(word64)];
    86120    void*   heap;
     121#ifdef USE_INTEL_SPEEDUP
     122    const byte* data;
     123#endif
    87124#ifdef WOLFSSL_ASYNC_CRYPT
    88125    WC_ASYNC_DEV asyncDev;
    89126#endif /* WOLFSSL_ASYNC_CRYPT */
     127#ifdef WOLFSSL_SMALL_STACK_CACHE
     128    word64* W;
     129#endif
    90130} wc_Sha512;
     131#endif
    91132
    92133#endif /* HAVE_FIPS */
     134
     135#ifdef WOLFSSL_SHA512
    93136
    94137WOLFSSL_API int wc_InitSha512(wc_Sha512*);
    95138WOLFSSL_API int wc_InitSha512_ex(wc_Sha512*, void*, int);
    96139WOLFSSL_API int wc_Sha512Update(wc_Sha512*, const byte*, word32);
     140WOLFSSL_API int wc_Sha512FinalRaw(wc_Sha512*, byte*);
    97141WOLFSSL_API int wc_Sha512Final(wc_Sha512*, byte*);
    98142WOLFSSL_API void wc_Sha512Free(wc_Sha512*);
     
    101145WOLFSSL_API int wc_Sha512Copy(wc_Sha512* src, wc_Sha512* dst);
    102146
     147#endif /* WOLFSSL_SHA512 */
     148
    103149#if defined(WOLFSSL_SHA384)
    104150
    105 #ifndef HAVE_FIPS /* avoid redefinition of structs */
     151/* avoid redefinition of structs */
     152#if !defined(HAVE_FIPS) || \
     153    (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
    106154
    107 #ifndef NO_OLD_WC_NAMES
     155#if !defined(NO_OLD_SHA_NAMES)
     156    #define SHA384             WC_SHA384
     157#endif
     158
     159#if !defined(NO_OLD_WC_NAMES)
    108160    #define Sha384             wc_Sha384
    109     #define SHA384             WC_SHA384
    110161    #define SHA384_BLOCK_SIZE  WC_SHA384_BLOCK_SIZE
    111162    #define SHA384_DIGEST_SIZE WC_SHA384_DIGEST_SIZE
     
    115166/* in bytes */
    116167enum {
    117     WC_SHA384              =   5,   /* hash type unique */
     168    WC_SHA384              =   WC_HASH_TYPE_SHA384,
    118169    WC_SHA384_BLOCK_SIZE   =   WC_SHA512_BLOCK_SIZE,
    119170    WC_SHA384_DIGEST_SIZE  =   48,
    120171    WC_SHA384_PAD_SIZE     =   WC_SHA512_PAD_SIZE
    121172};
     173
    122174
    123175typedef wc_Sha512 wc_Sha384;
     
    127179WOLFSSL_API int wc_InitSha384_ex(wc_Sha384*, void*, int);
    128180WOLFSSL_API int wc_Sha384Update(wc_Sha384*, const byte*, word32);
     181WOLFSSL_API int wc_Sha384FinalRaw(wc_Sha384*, byte*);
    129182WOLFSSL_API int wc_Sha384Final(wc_Sha384*, byte*);
    130183WOLFSSL_API void wc_Sha384Free(wc_Sha384*);
     
    139192#endif
    140193
    141 #endif /* WOLFSSL_SHA512 */
     194#endif /* WOLFSSL_SHA512 || WOLFSSL_SHA384 */
    142195#endif /* WOLF_CRYPT_SHA512_H */
    143196
Note: See TracChangeset for help on using the changeset viewer.