assh/assh_hash.h header reference
Description
This header file contains descriptors for cryptographic hash function modules implemented and used in the library.
See also coremod.
Header inclusion
Members
Types
- struct assh_hash_algo_s
- typedef void (assh_hash_cleanup_t)(assh_hash_ctx_s *hctx)
- typedef assh_status_t (assh_hash_copy_t)(assh_hash_ctx_s *hctx_dst, const assh_hash_ctx_s *hctx_src)
- struct assh_hash_ctx_s
- typedef void (assh_hash_final_t)(assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
- typedef assh_status_t (assh_hash_init_t)(assh_context_s *c, assh_hash_ctx_s *hctx, const assh_hash_algo_s *algo)
- typedef void (assh_hash_update_t)(assh_hash_ctx_s *hctx, const void *data, size_t len)
Functions
- assh_status_t assh_hash_bignum(assh_context_s *ctx, assh_hash_ctx_s *hctx, const assh_bignum_s *bn)
- void assh_hash_bytes_as_string(assh_hash_ctx_s *hctx, const uint8_t *bytes, size_t len)
- void assh_hash_cleanup(assh_hash_ctx_s *hctx)
- assh_status_t assh_hash_copy(assh_hash_ctx_s *hctx_dst, assh_hash_ctx_s *hctx_src)
- void assh_hash_final(assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
- assh_status_t assh_hash_init(assh_context_s *c, assh_hash_ctx_s *hctx, const assh_hash_algo_s *algo)
- void assh_hash_payload_as_string(assh_hash_ctx_s *hctx, const assh_packet_s *p)
- void assh_hash_string(assh_hash_ctx_s *hctx, const uint8_t *str)
- void assh_hash_update(assh_hash_ctx_s *hctx, const void *data, size_t len)
Constants
- const assh_hash_algo_s assh_hash_md5
- const assh_hash_algo_s assh_hash_sha1
- const assh_hash_algo_s assh_hash_sha224
- const assh_hash_algo_s assh_hash_sha256
- const assh_hash_algo_s assh_hash_sha384
- const assh_hash_algo_s assh_hash_sha3_224
- const assh_hash_algo_s assh_hash_sha3_256
- const assh_hash_algo_s assh_hash_sha3_384
- const assh_hash_algo_s assh_hash_sha3_512
- const assh_hash_algo_s assh_hash_sha512
- const assh_hash_algo_s assh_hash_shake_128
- const assh_hash_algo_s assh_hash_shake_256
Macros
- ASSH_HASH_CLEANUP_FCN
- ASSH_HASH_COPY_FCN
- ASSH_HASH_FINAL_FCN
- ASSH_HASH_INIT_FCN
- ASSH_HASH_UPDATE_FCN
- ASSH_SAFETY_MD5
- ASSH_SAFETY_SHA1
- ASSH_SAFETY_SHA2_224
- ASSH_SAFETY_SHA2_256
- ASSH_SAFETY_SHA2_384
- ASSH_SAFETY_SHA2_512
- ASSH_SAFETY_SHA3_224
- ASSH_SAFETY_SHA3_256
- ASSH_SAFETY_SHA3_384
- ASSH_SAFETY_SHA3_512
- ASSH_SAFETY_SHAKE128
- ASSH_SAFETY_SHAKE256
Members detail
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 83.
This macro expands to:
void (n)(struct assh_hash_ctx_s *hctx)
See also assh_hash_cleanup_t.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 58.
This macro expands to:
ASSH_WARN_UNUSED_RESULT assh_status_t (n)(struct assh_hash_ctx_s *hctx_dst,
const struct assh_hash_ctx_s *hctx_src)
See also assh_hash_copy_t.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 75.
This macro expands to:
void (n)(struct assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
See also assh_hash_final_t.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 48.
This macro expands to:
ASSH_WARN_UNUSED_RESULT assh_status_t (n)(struct assh_context_s *c,
struct assh_hash_ctx_s *hctx,
const struct assh_hash_algo_s *algo)
See also assh_hash_init_t.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 67.
This macro expands to:
void (n)(struct assh_hash_ctx_s *hctx, const void *data, size_t len)
See also assh_hash_update_t.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 187.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 188.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 189.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 190.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 191.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 192.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 193.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 194.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 195.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 196.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 197.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This macro is for internal use only.
This macro is declared in assh/assh_hash.h source file, line 198.
safety factor of common hash functions.
See also assh_hash_algo_s::sign_safety.
This struct is for internal use only.
This struct is declared in assh/assh_hash.h source file, line 93.
This struct is the hashing module interface structure.
Field | Description |
---|---|
const char * name; | |
assh_hash_init_t * f_init; | |
assh_hash_copy_t * f_copy; | |
assh_hash_update_t * f_update; | |
assh_hash_final_t * f_final; | |
assh_hash_cleanup_t * f_cleanup; | |
uint16_t ctx_size; | Size of the context structure needed to initialize the algorithm. |
uint8_t hash_size; | Hash function output size, 0 for variable size output. |
uint8_t block_size; | Hash algorithm block size. |
assh_safety_t sign_safety:8; | This relates to the collision resistance of the hash function. It is mostly relevant when involved in signature algorithms and does not necessarily impact other constructions like HMAC and key derivation. |
assh_status_t assh_hash_bignum(assh_context_s *ctx, assh_hash_ctx_s *hctx, const assh_bignum_s *bn)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 130.
This function convert the big number to the ssh mpint representation and hash the resulting buffer.
void assh_hash_bytes_as_string(assh_hash_ctx_s *hctx, const uint8_t *bytes, size_t len)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 122.
This function hashes an array of bytes as if it was stored as a ssh string. This means that a 32 bits headers with the array length is first generated and hashed.
void assh_hash_cleanup(assh_hash_ctx_s *hctx)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 182.
This function releases resources allocated by the assh_hash_init and assh_hash_copy functions. .
See also assh_hash_cleanup.
typedef void (assh_hash_cleanup_t)(assh_hash_ctx_s *hctx)
This typedef is for internal use only.
This typedef is declared in assh/assh_hash.h source file, line 89.
This declaration involves expansion of the ASSH_HASH_CLEANUP_FCN macro.
This typedef defines the function type for the hash context cleanup operation of the hash module interface.
See also assh_hash_cleanup.
assh_status_t assh_hash_copy(assh_hash_ctx_s *hctx_dst, assh_hash_ctx_s *hctx_src)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 158.
This function creates a copy of the hash algorithm context. The new context must be released as if it was created by assh_hash_init.
typedef assh_status_t (assh_hash_copy_t)(assh_hash_ctx_s *hctx_dst, const assh_hash_ctx_s *hctx_src)
This typedef is for internal use only.
This typedef is declared in assh/assh_hash.h source file, line 65.
This declaration involves expansion of the ASSH_HASH_COPY_FCN macro.
This typedef defines the function type for the hash context copy operation of the hash module interface. .
See also assh_hash_copy.
This struct is for internal use only.
This struct is declared in assh/assh_hash.h source file, line 44.
This struct is the base structure for hash contexts
Field | Description |
---|---|
const assh_hash_algo_s * algo; |
void assh_hash_final(assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 173.
This function produce the hash output. It can be called multiple times when the hash algorithm has a variable length output.
typedef void (assh_hash_final_t)(assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
This typedef is for internal use only.
This typedef is declared in assh/assh_hash.h source file, line 81.
This declaration involves expansion of the ASSH_HASH_FINAL_FCN macro.
This typedef defines the function type for the hash output operation of the hash module interface.
See also assh_hash_final.
assh_status_t assh_hash_init(assh_context_s *c, assh_hash_ctx_s *hctx, const assh_hash_algo_s *algo)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 147.
This function initializes an hash algorithm context. The hctx argument must points to a buffer allocated in secure memory of size given by assh_hash_algo_s::ctx_size.
typedef assh_status_t (assh_hash_init_t)(assh_context_s *c, assh_hash_ctx_s *hctx, const assh_hash_algo_s *algo)
This typedef is for internal use only.
This typedef is declared in assh/assh_hash.h source file, line 56.
This declaration involves expansion of the ASSH_HASH_INIT_FCN macro.
This typedef defines the function type for the hash initialization operation of the hash module interface.
See also assh_hash_init.
const assh_hash_algo_s assh_hash_md5
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 203.
This constant is the md5 hash algorithm implementation descriptor.
void assh_hash_payload_as_string(assh_hash_ctx_s *hctx, const assh_packet_s *p)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 138.
This function hash the packet payload. The packet must contain a valid 32 bits size header; not check is performed by this function.
const assh_hash_algo_s assh_hash_sha1
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 207.
This constant is the sha1 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha224
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 211.
This constant is a sha2 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha256
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 212.
This constant is a sha2 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha384
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 213.
This constant is a sha2 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha3_224
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 218.
This constant is a sha3 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha3_256
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 219.
This constant is a sha3 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha3_384
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 220.
This constant is a sha3 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha3_512
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 221.
This constant is a sha3 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_sha512
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 214.
This constant is a sha2 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_shake_128
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 222.
This constant is a sha3 hash algorithm implementation descriptor.
const assh_hash_algo_s assh_hash_shake_256
This constant is for internal use only.
This constant is declared in assh/assh_hash.h source file, line 223.
This constant is a sha3 hash algorithm implementation descriptor.
void assh_hash_string(assh_hash_ctx_s *hctx, const uint8_t *str)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 116.
This function hashes a ssh string. The string must contain a valid 32 bits size header. No bound checking is performed by this function.
void assh_hash_update(assh_hash_ctx_s *hctx, const void *data, size_t len)
This function is for internal use only.
This function is declared in assh/assh_hash.h source file, line 165.
This function updates the hash context with new input data.
typedef void (assh_hash_update_t)(assh_hash_ctx_s *hctx, const void *data, size_t len)
This typedef is for internal use only.
This typedef is declared in assh/assh_hash.h source file, line 73.
This declaration involves expansion of the ASSH_HASH_UPDATE_FCN macro.
This typedef defines the function type for the hash update operation of the hash module interface.
See also assh_hash_update.