Go to the source code of this file.
Data Structures | |
union | _ldns_sha2_buffer_union |
Macros | |
#define | ldns_sha256_SHORT_BLOCK_LENGTH (LDNS_SHA256_BLOCK_LENGTH - 8) |
#define | ldns_sha384_SHORT_BLOCK_LENGTH (LDNS_SHA384_BLOCK_LENGTH - 16) |
#define | ldns_sha512_SHORT_BLOCK_LENGTH (LDNS_SHA512_BLOCK_LENGTH - 16) |
#define | REVERSE32(w, x) |
#define | REVERSE64(w, x) |
#define | ADDINC128(w, n) |
#define | SHA2_USE_MEMSET_MEMCPY 1 |
#define | MEMSET_BZERO(p, l) memset((p), 0, (l)) |
#define | MEMCPY_BCOPY(d, s, l) memcpy((d), (s), (l)) |
#define | R(b, x) ((x) >> (b)) |
#define | S32(b, x) (((x) >> (b)) | ((x) << (32 - (b)))) |
#define | S64(b, x) (((x) >> (b)) | ((x) << (64 - (b)))) |
#define | Ch(x, y, z) (((x) & (y)) ^ ((~(x)) & (z))) |
#define | Maj(x, y, z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
#define | Sigma0_256(x) (S32(2, (x)) ^ S32(13, (x)) ^ S32(22, (x))) |
#define | Sigma1_256(x) (S32(6, (x)) ^ S32(11, (x)) ^ S32(25, (x))) |
#define | sigma0_256(x) (S32(7, (x)) ^ S32(18, (x)) ^ R(3 , (x))) |
#define | sigma1_256(x) (S32(17, (x)) ^ S32(19, (x)) ^ R(10, (x))) |
#define | Sigma0_512(x) (S64(28, (x)) ^ S64(34, (x)) ^ S64(39, (x))) |
#define | Sigma1_512(x) (S64(14, (x)) ^ S64(18, (x)) ^ S64(41, (x))) |
#define | sigma0_512(x) (S64( 1, (x)) ^ S64( 8, (x)) ^ R( 7, (x))) |
#define | sigma1_512(x) (S64(19, (x)) ^ S64(61, (x)) ^ R( 6, (x))) |
Typedefs | |
typedef uint8_t | sha2_byte |
typedef uint32_t | sha2_word32 |
typedef uint64_t | sha2_word64 |
typedef union _ldns_sha2_buffer_union | ldns_sha2_buffer_union |
Functions | |
void | ldns_sha256_init (ldns_sha256_CTX *context) |
void | ldns_sha256_update (ldns_sha256_CTX *context, const sha2_byte *data, size_t len) |
void | ldns_sha256_final (sha2_byte digest[32], ldns_sha256_CTX *context) |
unsigned char * | ldns_sha256 (const unsigned char *data, unsigned int data_len, unsigned char *digest) |
Convenience function to digest a fixed block of data at once. More... | |
void | ldns_sha512_init (ldns_sha512_CTX *context) |
void | ldns_sha512_update (ldns_sha512_CTX *context, const sha2_byte *data, size_t len) |
void | ldns_sha512_final (sha2_byte digest[64], ldns_sha512_CTX *context) |
unsigned char * | ldns_sha512 (const unsigned char *data, unsigned int data_len, unsigned char *digest) |
Convenience function to digest a fixed block of data at once. More... | |
void | ldns_sha384_init (ldns_sha384_CTX *context) |
void | ldns_sha384_update (ldns_sha384_CTX *context, const sha2_byte *data, size_t len) |
void | ldns_sha384_final (sha2_byte digest[48], ldns_sha384_CTX *context) |
unsigned char * | ldns_sha384 (const unsigned char *data, unsigned int data_len, unsigned char *digest) |
Convenience function to digest a fixed block of data at once. More... | |
#define ldns_sha256_SHORT_BLOCK_LENGTH (LDNS_SHA256_BLOCK_LENGTH - 8) |
#define ldns_sha384_SHORT_BLOCK_LENGTH (LDNS_SHA384_BLOCK_LENGTH - 16) |
#define ldns_sha512_SHORT_BLOCK_LENGTH (LDNS_SHA512_BLOCK_LENGTH - 16) |
#define REVERSE32 | ( | w, | |
x | |||
) |
#define REVERSE64 | ( | w, | |
x | |||
) |
#define ADDINC128 | ( | w, | |
n | |||
) |
#define Maj | ( | x, | |
y, | |||
z | |||
) | (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) |
typedef uint32_t sha2_word32 |
typedef uint64_t sha2_word64 |
typedef union _ldns_sha2_buffer_union ldns_sha2_buffer_union |
void ldns_sha256_init | ( | ldns_sha256_CTX * | context | ) |
Definition at line 315 of file sha2.c.
References MEMCPY_BCOPY, and _ldns_sha256_CTX::state.
void ldns_sha256_update | ( | ldns_sha256_CTX * | context, |
const sha2_byte * | data, | ||
size_t | len | ||
) |
Definition at line 502 of file sha2.c.
References _ldns_sha256_CTX::bitcount, _ldns_sha256_CTX::buffer, LDNS_SHA256_BLOCK_LENGTH, and MEMCPY_BCOPY.
void ldns_sha256_final | ( | sha2_byte | digest[32], |
ldns_sha256_CTX * | context | ||
) |
Definition at line 557 of file sha2.c.
References _ldns_sha256_CTX::bitcount, _ldns_sha256_CTX::buffer, LDNS_SHA256_BLOCK_LENGTH, ldns_sha256_SHORT_BLOCK_LENGTH, MEMSET_BZERO, and REVERSE64.
unsigned char* ldns_sha256 | ( | const unsigned char * | data, |
unsigned int | data_len, | ||
unsigned char * | digest | ||
) |
Convenience function to digest a fixed block of data at once.
[in] | data | the data to digest |
[in] | data_len | the length of data in bytes |
[out] | digest | the length of data in bytes This pointer MUST have LDNS_SHA256_DIGEST_LENGTH bytes available |
Definition at line 624 of file sha2.c.
References ldns_sha256_final(), ldns_sha256_init(), and ldns_sha256_update().
void ldns_sha512_init | ( | ldns_sha512_CTX * | context | ) |
Definition at line 634 of file sha2.c.
References MEMCPY_BCOPY, and _ldns_sha512_CTX::state.
void ldns_sha512_update | ( | ldns_sha512_CTX * | context, |
const sha2_byte * | data, | ||
size_t | len | ||
) |
Definition at line 815 of file sha2.c.
References ADDINC128, _ldns_sha512_CTX::bitcount, _ldns_sha512_CTX::buffer, LDNS_SHA512_BLOCK_LENGTH, and MEMCPY_BCOPY.
void ldns_sha512_final | ( | sha2_byte | digest[64], |
ldns_sha512_CTX * | context | ||
) |
unsigned char* ldns_sha512 | ( | const unsigned char * | data, |
unsigned int | data_len, | ||
unsigned char * | digest | ||
) |
Convenience function to digest a fixed block of data at once.
[in] | data | the data to digest |
[in] | data_len | the length of data in bytes |
[out] | digest | the length of data in bytes This pointer MUST have LDNS_SHA512_DIGEST_LENGTH bytes available |
Definition at line 938 of file sha2.c.
References ldns_sha512_final(), ldns_sha512_init(), and ldns_sha512_update().
void ldns_sha384_init | ( | ldns_sha384_CTX * | context | ) |
Definition at line 948 of file sha2.c.
References MEMCPY_BCOPY, and _ldns_sha512_CTX::state.
void ldns_sha384_update | ( | ldns_sha384_CTX * | context, |
const sha2_byte * | data, | ||
size_t | len | ||
) |
Definition at line 957 of file sha2.c.
References ldns_sha512_update().
void ldns_sha384_final | ( | sha2_byte | digest[48], |
ldns_sha384_CTX * | context | ||
) |
unsigned char* ldns_sha384 | ( | const unsigned char * | data, |
unsigned int | data_len, | ||
unsigned char * | digest | ||
) |
Convenience function to digest a fixed block of data at once.
[in] | data | the data to digest |
[in] | data_len | the length of data in bytes |
[out] | digest | the length of data in bytes This pointer MUST have LDNS_SHA384_DIGEST_LENGTH bytes available |
Definition at line 991 of file sha2.c.
References ldns_sha384_final(), ldns_sha384_init(), and ldns_sha384_update().