123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396 |
- /*!
- \ingroup wolfCrypt
- \brief This function will return the OID for the wc_HashType provided.
- \return OID returns value greater than 0
- \return HASH_TYPE_E hash type not supported.
- \return BAD_FUNC_ARG one of the provided arguments is incorrect.
- \param hash_type A hash type from the “enum wc_HashType” such
- as “WC_HASH_TYPE_SHA256”.
- _Example_
- \code
- enum wc_HashType hash_type = WC_HASH_TYPE_SHA256;
- int oid = wc_HashGetOID(hash_type);
- if (oid > 0) {
- // Success
- }
- \endcode
- \sa wc_HashGetDigestSize
- \sa wc_Hash
- */
- int wc_HashGetOID(enum wc_HashType hash_type);
- /*!
- \ingroup wolfCrypt
- \brief This function returns the size of the digest (output) for a
- hash_type. The returns size is used to make sure the output buffer
- provided to wc_Hash is large enough.
- \return Success A positive return value indicates the digest size
- for the hash.
- \return Error Returns HASH_TYPE_E if hash_type is not supported.
- \return Failure Returns BAD_FUNC_ARG if an invalid hash_type was used.
- \param hash_type A hash type from the “enum wc_HashType” such as
- “WC_HASH_TYPE_SHA256”.
- _Example_
- \code
- int hash_len = wc_HashGetDigestSize(hash_type);
- if (hash_len <= 0) {
- WOLFSSL_MSG("Invalid hash type/len");
- return BAD_FUNC_ARG;
- }
- \endcode
- \sa wc_Hash
- */
- int wc_HashGetDigestSize(enum wc_HashType hash_type);
- /*!
- \ingroup wolfCrypt
- \brief This function performs a hash on the provided data buffer
- and returns it in the hash buffer provided.
- \return 0 Success, else error (such as BAD_FUNC_ARG or BUFFER_E).
- \param hash_type A hash type from the “enum wc_HashType”
- such as “WC_HASH_TYPE_SHA256”.
- \param data Pointer to buffer containing the data to hash.
- \param data_len Length of the data buffer.
- \param hash Pointer to buffer used to output the final hash to.
- \param hash_len Length of the hash buffer.
- _Example_
- \code
- enum wc_HashType hash_type = WC_HASH_TYPE_SHA256;
- int hash_len = wc_HashGetDigestSize(hash_type);
- if (hash_len > 0) {
- int ret = wc_Hash(hash_type, data, data_len, hash_data, hash_len);
- if(ret == 0) {
- // Success
- }
- }
- \endcode
- \sa wc_HashGetDigestSize
- */
- int wc_Hash(enum wc_HashType hash_type,
- const byte* data, word32 data_len,
- byte* hash, word32 hash_len);
- /*!
- \ingroup MD5
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the data.
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- const byte* data;
- word32 data_len;
- byte* hash;
- int ret;
- ...
- ret = wc_Md5Hash(data, data_len, hash);
- if (ret != 0) {
- // Md5 Hash Failure Case.
- }
- \endcode
- \sa wc_Md5Hash
- \sa wc_Md5Final
- \sa wc_InitMd5
- */
- int wc_Md5Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully ….
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_ShaHash
- \sa wc_ShaFinal
- \sa wc_InitSha
- */
- int wc_ShaHash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Success
- \return <0 Error
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitSha224
- \sa wc_Sha224Update
- \sa wc_Sha224Final
- */
- int wc_Sha224Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully …
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_Sha256Hash
- \sa wc_Sha256Final
- \sa wc_InitSha256
- */
- int wc_Sha256Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_Sha384Hash
- \sa wc_Sha384Final
- \sa wc_InitSha384
- */
- int wc_Sha384Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the inputted data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_Sha512Hash
- \sa wc_Sha512Final
- \sa wc_InitSha512
- */
- int wc_Sha512Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitSha3_224
- \sa wc_Sha3_224_Update
- \sa wc_Sha3_224_Final
- */
- int wc_Sha3_224Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitSha3_256
- \sa wc_Sha3_256_Update
- \sa wc_Sha3_256_Final
- */
- int wc_Sha3_256Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitSha3_384
- \sa wc_Sha3_384_Update
- \sa wc_Sha3_384_Final
- */
- int wc_Sha3_384Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the inputted data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitSha3_512
- \sa wc_Sha3_512_Update
- \sa wc_Sha3_512_Final
- */
- int wc_Sha3_512Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the inputted data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitShake128
- \sa wc_Shake128_Update
- \sa wc_Shake128_Final
- */
- int wc_Shake128Hash(const byte* data, word32 len, byte* hash);
- /*!
- \ingroup SHA
- \brief Convenience function, handles all the hashing and places the
- result into hash.
- \return 0 Returned upon successfully hashing the inputted data
- \return Memory_E memory error, unable to allocate memory. This is only
- possible with the small stack option enabled.
- \param data the data to hash
- \param len the length of data
- \param hash Byte array to hold hash value.
- _Example_
- \code
- none
- \endcode
- \sa wc_InitShake256
- \sa wc_Shake256_Update
- \sa wc_Shake256_Final
- */
- int wc_Shake256Hash(const byte* data, word32 len, byte* hash);
|