File sha1.h
FileList > device > util > sha1.h
Go to the source code of this file
This file contains SHA-1 definitions and functions. More...
#include <stddef.h>
#include <stdint.h>
Classes
Type | Name |
---|---|
struct | mbedtls_sha1_context The SHA-1 context structure. |
Public Types
Type | Name |
---|---|
typedef struct mbedtls_sha1_context | mbedtls_sha1_context The SHA-1 context structure. |
Public Functions
Type | Name |
---|---|
int | mbedtls_internal_sha1_process (mbedtls_sha1_context * ctx, const unsigned char data) SHA-1 process data block (internal use only). |
int | mbedtls_sha1 (const unsigned char * input, size_t ilen, unsigned char output) This function calculates the SHA-1 checksum of a buffer. |
void | mbedtls_sha1_clone (mbedtls_sha1_context * dst, const mbedtls_sha1_context * src) This function clones the state of a SHA-1 context. |
int | mbedtls_sha1_finish (mbedtls_sha1_context * ctx, unsigned char output) This function finishes the SHA-1 operation, and writes the result to the output buffer. |
void | mbedtls_sha1_free (mbedtls_sha1_context * ctx) This function clears a SHA-1 context. |
void | mbedtls_sha1_init (mbedtls_sha1_context * ctx) This function initializes a SHA-1 context. |
int | mbedtls_sha1_starts (mbedtls_sha1_context * ctx) This function starts a SHA-1 checksum calculation. |
int | mbedtls_sha1_update (mbedtls_sha1_context * ctx, const unsigned char * input, size_t ilen) This function feeds an input buffer into an ongoing SHA-1 checksum calculation. |
Macros
Type | Name |
---|---|
define | MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED -0x006E |
define | MBEDTLS_ERR_SHA1_BAD_INPUT_DATA -0x0073 |
define | MBEDTLS_PRIVATE (x) x |
Detailed Description
The Secure Hash Algorithm 1 (SHA-1) cryptographic hash function is defined in FIPS 180-4: Secure Hash Standard (SHS).
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Public Types Documentation
typedef mbedtls_sha1_context
The SHA-1 context structure.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Public Functions Documentation
function mbedtls_internal_sha1_process
SHA-1 process data block (internal use only).
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
ctx
The SHA-1 context to use. This must be initialized.data
The data block being processed. This must be a readable buffer of length64
Bytes.
Returns:
0
on success.
Returns:
A negative error code on failure.
function mbedtls_sha1
This function calculates the SHA-1 checksum of a buffer.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
input
The buffer holding the input data. This must be a readable buffer of lengthilen
Bytes.ilen
The length of the input datainput
in Bytes.output
The SHA-1 checksum result. This must be a writable buffer of length20
Bytes.
Returns:
0
on success.
Returns:
A negative error code on failure.
function mbedtls_sha1_clone
This function clones the state of a SHA-1 context.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
dst
The SHA-1 context to clone to. This must be initialized.src
The SHA-1 context to clone from. This must be initialized.
function mbedtls_sha1_finish
This function finishes the SHA-1 operation, and writes the result to the output buffer.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
ctx
The SHA-1 context to use. This must be initialized and have a hash operation started.output
The SHA-1 checksum result. This must be a writable buffer of length20
Bytes.
Returns:
0
on success.
Returns:
A negative error code on failure.
function mbedtls_sha1_free
This function clears a SHA-1 context.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
ctx
The SHA-1 context to clear. This may beNULL
, in which case this function does nothing. If it is notNULL
, it must point to an initialized SHA-1 context.
function mbedtls_sha1_init
This function initializes a SHA-1 context.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
ctx
The SHA-1 context to initialize. This must not beNULL
.
function mbedtls_sha1_starts
This function starts a SHA-1 checksum calculation.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
ctx
The SHA-1 context to initialize. This must be initialized.
Returns:
0
on success.
Returns:
A negative error code on failure.
function mbedtls_sha1_update
This function feeds an input buffer into an ongoing SHA-1 checksum calculation.
Warning:
SHA-1 is considered a weak message digest and its use constitutes a security risk. We recommend considering stronger message digests instead.
Parameters:
ctx
The SHA-1 context. This must be initialized and have a hash operation started.input
The buffer holding the input data. This must be a readable buffer of lengthilen
Bytes.ilen
The length of the input datainput
in Bytes.
Returns:
0
on success.
Returns:
A negative error code on failure.
Macro Definition Documentation
define MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED
define MBEDTLS_ERR_SHA1_BAD_INPUT_DATA
SHA-1 input data was malformed.
define MBEDTLS_PRIVATE
The documentation for this class was generated from the following file src/jac/device/util/sha1.h