assh/assh_hash.h header reference
Description [link]
This header file contains descriptors for cryptographic hash function modules implemented and used in the library.
See also coremod.
Header inclusion [link]
Members [link]
Types [link]
- struct assh_hash_algo_s
- typedef void (assh_hash_cleanup_t)(struct assh_hash_ctx_s *hctx)
- typedef assh_status_t (assh_hash_copy_t)(struct assh_hash_ctx_s *hctx_dst, const struct assh_hash_ctx_s *hctx_src)
- struct assh_hash_ctx_s
- typedef void (assh_hash_final_t)(struct assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
- typedef assh_status_t (assh_hash_init_t)(struct assh_context_s *c, struct assh_hash_ctx_s *hctx, const struct assh_hash_algo_s *algo)
- typedef void (assh_hash_update_t)(struct assh_hash_ctx_s *hctx, const void *data, size_t len)
Functions [link]
- assh_status_t assh_hash_bignum(struct assh_context_s *ctx, struct assh_hash_ctx_s *hctx, const struct assh_bignum_s *bn)
- void assh_hash_bytes_as_string(struct assh_hash_ctx_s *hctx, const uint8_t *bytes, size_t len)
- void assh_hash_cleanup(struct assh_hash_ctx_s *hctx)
- assh_status_t assh_hash_copy(struct assh_hash_ctx_s *hctx_dst, struct assh_hash_ctx_s *hctx_src)
- void assh_hash_final(struct assh_hash_ctx_s *hctx, uint8_t *hash, size_t len)
- assh_status_t assh_hash_init(struct assh_context_s *c, struct assh_hash_ctx_s *hctx, const struct assh_hash_algo_s *algo)
- void assh_hash_payload_as_string(struct assh_hash_ctx_s *hctx, const struct assh_packet_s *p)
- void assh_hash_string(struct assh_hash_ctx_s *hctx, const uint8_t *str)
- void assh_hash_update(struct assh_hash_ctx_s *hctx, const void *data, size_t len)
Constants [link]
- const struct assh_hash_algo_s assh_hash_md5
- const struct assh_hash_algo_s assh_hash_sha1
- const struct assh_hash_algo_s assh_hash_sha224
- const struct assh_hash_algo_s assh_hash_sha256
- const struct assh_hash_algo_s assh_hash_sha384
- const struct assh_hash_algo_s assh_hash_sha3_224
- const struct assh_hash_algo_s assh_hash_sha3_256
- const struct assh_hash_algo_s assh_hash_sha3_384
- const struct assh_hash_algo_s assh_hash_sha3_512
- const struct assh_hash_algo_s assh_hash_sha512
- const struct assh_hash_algo_s assh_hash_shake_128
- const struct assh_hash_algo_s assh_hash_shake_256
Macros [link]
- 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 [link]
#define ASSH_HASH_CLEANUP_FCN(n) [link]
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.
#define ASSH_HASH_COPY_FCN(n) [link]
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.
#define ASSH_HASH_FINAL_FCN(n) [link]
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.
#define ASSH_HASH_INIT_FCN(n) [link]
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.
#define ASSH_HASH_UPDATE_FCN(n) [link]
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.
#define ASSH_SAFETY_MD5 10 [link]
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.
#define ASSH_SAFETY_SHA1 20 [link]
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.
#define ASSH_SAFETY_SHA2_224 43 [link]
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.
#define ASSH_SAFETY_SHA2_256 50 [link]
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.
#define ASSH_SAFETY_SHA2_384 75 [link]
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.
#define ASSH_SAFETY_SHA2_512 99 [link]
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.
#define ASSH_SAFETY_SHA3_224 43 [link]
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.
#define ASSH_SAFETY_SHA3_256 50 [link]
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.
#define ASSH_SAFETY_SHA3_384 75 [link]
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.
#define ASSH_SAFETY_SHA3_512 99 [link]
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.
#define ASSH_SAFETY_SHAKE128 50 [link]
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.
#define ASSH_SAFETY_SHAKE256 99 [link]
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.
struct assh_hash_algo_s [link]
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(struct assh_context_s *ctx, struct assh_hash_ctx_s *hctx, const struct assh_bignum_s *bn) [link]
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(struct assh_hash_ctx_s *hctx, const uint8_t *bytes, size_t len) [link]
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(struct assh_hash_ctx_s *hctx) [link]
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)(struct assh_hash_ctx_s *hctx) [link]
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(struct assh_hash_ctx_s *hctx_dst, struct assh_hash_ctx_s *hctx_src) [link]
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)(struct assh_hash_ctx_s *hctx_dst, const struct assh_hash_ctx_s *hctx_src) [link]
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.
struct assh_hash_ctx_s [link]
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 struct assh_hash_algo_s * algo; |
void assh_hash_final(struct assh_hash_ctx_s *hctx, uint8_t *hash, size_t len) [link]
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)(struct assh_hash_ctx_s *hctx, uint8_t *hash, size_t len) [link]
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(struct assh_context_s *c, struct assh_hash_ctx_s *hctx, const struct assh_hash_algo_s *algo) [link]
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)(struct assh_context_s *c, struct assh_hash_ctx_s *hctx, const struct assh_hash_algo_s *algo) [link]
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 struct assh_hash_algo_s assh_hash_md5 [link]
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(struct assh_hash_ctx_s *hctx, const struct assh_packet_s *p) [link]
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 struct assh_hash_algo_s assh_hash_sha1 [link]
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 struct assh_hash_algo_s assh_hash_sha224 [link]
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 struct assh_hash_algo_s assh_hash_sha256 [link]
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 struct assh_hash_algo_s assh_hash_sha384 [link]
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 struct assh_hash_algo_s assh_hash_sha3_224 [link]
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 struct assh_hash_algo_s assh_hash_sha3_256 [link]
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 struct assh_hash_algo_s assh_hash_sha3_384 [link]
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 struct assh_hash_algo_s assh_hash_sha3_512 [link]
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 struct assh_hash_algo_s assh_hash_sha512 [link]
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 struct assh_hash_algo_s assh_hash_shake_128 [link]
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 struct assh_hash_algo_s assh_hash_shake_256 [link]
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(struct assh_hash_ctx_s *hctx, const uint8_t *str) [link]
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(struct assh_hash_ctx_s *hctx, const void *data, size_t len) [link]
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)(struct assh_hash_ctx_s *hctx, const void *data, size_t len) [link]
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.