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/hash.h

    r352 r372  
    2020 */
    2121
     22/*!
     23    \file wolfssl/wolfcrypt/hash.h
     24*/
    2225
    2326#ifndef WOLF_CRYPT_HASH_H
     
    3841    #include <wolfssl/wolfcrypt/sha512.h>
    3942#endif
     43#ifdef HAVE_BLAKE2
     44    #include <wolfssl/wolfcrypt/blake2.h>
     45#endif
     46#ifdef WOLFSSL_SHA3
     47    #include <wolfssl/wolfcrypt/sha3.h>
     48#endif
     49#ifndef NO_MD4
     50    #include <wolfssl/wolfcrypt/md4.h>
     51#endif
     52#ifdef WOLFSSL_MD2
     53    #include <wolfssl/wolfcrypt/md2.h>
     54#endif
     55
    4056
    4157#ifdef __cplusplus
     
    4359#endif
    4460
    45 /* Hash types */
    46 enum wc_HashType {
    47     WC_HASH_TYPE_NONE = 0,
    48     WC_HASH_TYPE_MD2 = 1,
    49     WC_HASH_TYPE_MD4 = 2,
    50     WC_HASH_TYPE_MD5 = 3,
    51     WC_HASH_TYPE_SHA = 4, /* SHA-1 (not old SHA-0) */
    52     WC_HASH_TYPE_SHA224 = 9,
    53     WC_HASH_TYPE_SHA256 = 5,
    54     WC_HASH_TYPE_SHA384 = 6,
    55     WC_HASH_TYPE_SHA512 = 7,
    56     WC_HASH_TYPE_MD5_SHA = 8,
    57 };
     61#if !defined(HAVE_FIPS) && !defined(NO_OLD_WC_NAMES)
     62    #define MAX_DIGEST_SIZE WC_MAX_DIGEST_SIZE
     63#endif
     64
    5865
    5966typedef union {
     
    8087/* Find largest possible digest size
    8188   Note if this gets up to the size of 80 or over check smallstack build */
    82 #if defined(WOLFSSL_SHA512)
     89#if defined(WOLFSSL_SHA3)
     90    #define WC_MAX_DIGEST_SIZE WC_SHA3_512_DIGEST_SIZE
     91    #define WC_MAX_BLOCK_SIZE  WC_SHA3_224_BLOCK_SIZE /* 224 is the largest block size */
     92#elif defined(WOLFSSL_SHA512)
    8393    #define WC_MAX_DIGEST_SIZE WC_SHA512_DIGEST_SIZE
     94    #define WC_MAX_BLOCK_SIZE  WC_SHA512_BLOCK_SIZE
     95#elif defined(HAVE_BLAKE2)
     96    #define WC_MAX_DIGEST_SIZE BLAKE2B_OUTBYTES
     97    #define WC_MAX_BLOCK_SIZE  BLAKE2B_BLOCKBYTES
    8498#elif defined(WOLFSSL_SHA384)
    8599    #define WC_MAX_DIGEST_SIZE WC_SHA384_DIGEST_SIZE
     100    #define WC_MAX_BLOCK_SIZE  WC_SHA384_BLOCK_SIZE
    86101#elif !defined(NO_SHA256)
    87102    #define WC_MAX_DIGEST_SIZE WC_SHA256_DIGEST_SIZE
     103    #define WC_MAX_BLOCK_SIZE  WC_SHA256_BLOCK_SIZE
    88104#elif defined(WOLFSSL_SHA224)
    89105    #define WC_MAX_DIGEST_SIZE WC_SHA224_DIGEST_SIZE
     106    #define WC_MAX_BLOCK_SIZE  WC_SHA224_BLOCK_SIZE
    90107#elif !defined(NO_SHA)
    91108    #define WC_MAX_DIGEST_SIZE WC_SHA_DIGEST_SIZE
     109    #define WC_MAX_BLOCK_SIZE  WC_SHA_BLOCK_SIZE
    92110#elif !defined(NO_MD5)
    93111    #define WC_MAX_DIGEST_SIZE WC_MD5_DIGEST_SIZE
     112    #define WC_MAX_BLOCK_SIZE  WC_MD5_BLOCK_SIZE
    94113#else
    95114    #define WC_MAX_DIGEST_SIZE 64 /* default to max size of 64 */
     115    #define WC_MAX_BLOCK_SIZE  128
    96116#endif
    97117
    98118#if !defined(NO_ASN) || !defined(NO_DH) || defined(HAVE_ECC)
    99119WOLFSSL_API int wc_HashGetOID(enum wc_HashType hash_type);
     120WOLFSSL_API enum wc_HashType wc_OidGetHash(int oid);
    100121#endif
    101122
     123WOLFSSL_API enum wc_HashType wc_HashTypeConvert(int hashType);
     124
    102125WOLFSSL_API int wc_HashGetDigestSize(enum wc_HashType hash_type);
     126WOLFSSL_API int wc_HashGetBlockSize(enum wc_HashType hash_type);
    103127WOLFSSL_API int wc_Hash(enum wc_HashType hash_type,
    104128    const byte* data, word32 data_len,
     
    111135WOLFSSL_API int wc_HashFinal(wc_HashAlg* hash, enum wc_HashType type,
    112136    byte* out);
    113 
     137WOLFSSL_API int wc_HashFree(wc_HashAlg* hash, enum wc_HashType type);
    114138
    115139#ifndef NO_MD5
     
    123147#endif
    124148
     149#ifdef WOLFSSL_SHA224
     150#include <wolfssl/wolfcrypt/sha256.h>
     151        WOLFSSL_API int wc_Sha224Hash(const byte*, word32, byte*);
     152    #endif /* defined(WOLFSSL_SHA224) */
     153
    125154#ifndef NO_SHA256
    126155#include <wolfssl/wolfcrypt/sha256.h>
    127156WOLFSSL_API int wc_Sha256Hash(const byte*, word32, byte*);
     157#endif
    128158
    129     #if defined(WOLFSSL_SHA224)
    130         WOLFSSL_API int wc_Sha224Hash(const byte*, word32, byte*);
    131     #endif /* defined(WOLFSSL_SHA224) */
    132 #endif
     159#ifdef WOLFSSL_SHA384
     160#include <wolfssl/wolfcrypt/sha512.h>
     161        WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
     162    #endif /* defined(WOLFSSL_SHA384) */
    133163
    134164#ifdef WOLFSSL_SHA512
    135165#include <wolfssl/wolfcrypt/sha512.h>
    136166WOLFSSL_API int wc_Sha512Hash(const byte*, word32, byte*);
    137 
    138     #if defined(WOLFSSL_SHA384)
    139         WOLFSSL_API int wc_Sha384Hash(const byte*, word32, byte*);
    140     #endif /* defined(WOLFSSL_SHA384) */
    141167#endif /* WOLFSSL_SHA512 */
    142168
Note: See TracChangeset for help on using the changeset viewer.