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_rx/trunk/wolfssl-3.12.2/wolfssl/wolfcrypt/sha256.h

    r337 r372  
    2020 */
    2121
     22/*!
     23    \file wolfssl/wolfcrypt/sha256.h
     24*/
     25
    2226
    2327/* code submitted by raphael.huck@efixo.com */
     
    3034#ifndef NO_SHA256
    3135
    32 #ifdef HAVE_FIPS
     36#if defined(HAVE_FIPS) && \
     37    defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2)
     38    #include <wolfssl/wolfcrypt/fips.h>
     39#endif /* HAVE_FIPS_VERSION >= 2 */
     40
     41#if defined(HAVE_FIPS) && \
     42        (!defined(HAVE_FIPS_VERSION) || (HAVE_FIPS_VERSION < 2))
    3343    #define wc_Sha256             Sha256
    3444    #define WC_SHA256             SHA256
     
    5868#endif
    5969
    60 #ifndef HAVE_FIPS /* avoid redefinition of structs */
     70/* avoid redefinition of structs */
     71#if !defined(HAVE_FIPS) || \
     72    (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
    6173
    6274#ifdef WOLFSSL_MICROCHIP_PIC32MZ
    6375    #include <wolfssl/wolfcrypt/port/pic32/pic32mz-crypt.h>
    6476#endif
     77#ifdef STM32_HASH
     78    #include <wolfssl/wolfcrypt/port/st/stm32.h>
     79#endif
    6580#ifdef WOLFSSL_ASYNC_CRYPT
    6681    #include <wolfssl/wolfcrypt/async.h>
    6782#endif
     83#if defined(WOLFSSL_DEVCRYPTO) && defined(WOLFSSL_DEVCRYPTO_HASH)
     84    #include <wolfssl/wolfcrypt/port/devcrypto/wc_devcrypto.h>
     85#endif
     86
     87#if defined(_MSC_VER)
     88    #define SHA256_NOINLINE __declspec(noinline)
     89#elif defined(__GNUC__)
     90    #define SHA256_NOINLINE __attribute__((noinline))
     91#else
     92    #define SHA256_NOINLINE
     93#endif
     94
     95#if !defined(NO_OLD_SHA_NAMES)
     96    #define SHA256             WC_SHA256
     97#endif
    6898
    6999#ifndef NO_OLD_WC_NAMES
    70100    #define Sha256             wc_Sha256
    71     #define SHA256             WC_SHA256
    72101    #define SHA256_BLOCK_SIZE  WC_SHA256_BLOCK_SIZE
    73102    #define SHA256_DIGEST_SIZE WC_SHA256_DIGEST_SIZE
     
    77106/* in bytes */
    78107enum {
    79     WC_SHA256              =  2,   /* hash type unique */
     108    WC_SHA256              =  WC_HASH_TYPE_SHA256,
    80109    WC_SHA256_BLOCK_SIZE   = 64,
    81110    WC_SHA256_DIGEST_SIZE  = 32,
     
    83112};
    84113
    85 #ifndef WOLFSSL_TI_HASH
    86 
     114
     115#ifdef WOLFSSL_TI_HASH
     116    #include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
     117#elif defined(WOLFSSL_IMX6_CAAM)
     118    #include "wolfssl/wolfcrypt/port/caam/wolfcaam_sha.h"
     119#elif defined(WOLFSSL_AFALG_HASH)
     120    #include "wolfssl/wolfcrypt/port/af_alg/afalg_hash.h"
     121#else
    87122/* wc_Sha256 digest */
    88123typedef struct wc_Sha256 {
    89124#ifdef FREESCALE_LTC_SHA
    90125    ltc_hash_ctx_t ctx;
     126#elif defined(STM32_HASH)
     127    STM32_HASH_Context stmCtx;
    91128#else
    92129    /* alignment on digest and buffer speeds up ARMv8 crypto operations */
     
    97134    word32  hiLen;     /* length in bytes   */
    98135    void*   heap;
     136#ifdef USE_INTEL_SPEEDUP
     137    const byte* data;
     138#endif
    99139#ifdef WOLFSSL_PIC32MZ_HASH
    100140    hashUpdCache cache; /* cache for updates */
    101 #endif
    102 #if defined(STM32_HASH) && defined(WOLFSSL_STM32_CUBEMX)
    103     HASH_HandleTypeDef hashHandle;
    104141#endif
    105142#ifdef WOLFSSL_ASYNC_CRYPT
    106143    WC_ASYNC_DEV asyncDev;
    107144#endif /* WOLFSSL_ASYNC_CRYPT */
    108 #endif /* FREESCALE_LTC_SHA */
     145#ifdef WOLFSSL_SMALL_STACK_CACHE
     146    word32* W;
     147#endif
     148#ifdef WOLFSSL_DEVCRYPTO_HASH
     149    WC_CRYPTODEV ctx;
     150    byte*  msg;
     151    word32 used;
     152    word32 len;
     153#endif
     154#endif
    109155} wc_Sha256;
    110156
    111 #else
    112     #include "wolfssl/wolfcrypt/port/ti/ti-hash.h"
    113157#endif
    114158
     
    118162WOLFSSL_API int wc_InitSha256_ex(wc_Sha256*, void*, int);
    119163WOLFSSL_API int wc_Sha256Update(wc_Sha256*, const byte*, word32);
     164WOLFSSL_API int wc_Sha256FinalRaw(wc_Sha256*, byte*);
    120165WOLFSSL_API int wc_Sha256Final(wc_Sha256*, byte*);
    121166WOLFSSL_API void wc_Sha256Free(wc_Sha256*);
     
    129174
    130175#ifdef WOLFSSL_SHA224
    131 #ifndef HAVE_FIPS /* avoid redefinition of structs */
     176/* avoid redefinition of structs */
     177#if !defined(HAVE_FIPS) || \
     178    (defined(HAVE_FIPS_VERSION) && (HAVE_FIPS_VERSION >= 2))
    132179
    133180#ifndef NO_OLD_WC_NAMES
     
    141188/* in bytes */
    142189enum {
    143     WC_SHA224              =   8,   /* hash type unique */
     190    WC_SHA224              =   WC_HASH_TYPE_SHA224,
    144191    WC_SHA224_BLOCK_SIZE   =   WC_SHA256_BLOCK_SIZE,
    145192    WC_SHA224_DIGEST_SIZE  =   28,
    146193    WC_SHA224_PAD_SIZE     =   WC_SHA256_PAD_SIZE
    147194};
     195
    148196
    149197typedef wc_Sha256 wc_Sha224;
Note: See TracChangeset for help on using the changeset viewer.