ldns documentation

- Main Page
- Related Pages
- Data Structures
- Files

- File List
- Globals

Data Structures | Macros | Typedefs | Functions
sha2.h File Reference

Go to the source code of this file.

## Data Structures
struct | _ldns_sha256_CTX
struct | _ldns_sha512_CTX

## Macros
#define | LDNS_SHA256_BLOCK_LENGTH 64
#define | LDNS_SHA256_DIGEST_LENGTH 32
#define | LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1)
#define | LDNS_SHA384_BLOCK_LENGTH 128
#define | LDNS_SHA384_DIGEST_LENGTH 48
#define | LDNS_SHA384_DIGEST_STRING_LENGTH (LDNS_SHA384_DIGEST_LENGTH * 2 + 1)
#define | LDNS_SHA512_BLOCK_LENGTH 128
#define | LDNS_SHA512_DIGEST_LENGTH 64
#define | LDNS_SHA512_DIGEST_STRING_LENGTH (LDNS_SHA512_DIGEST_LENGTH * 2 + 1)

## Typedefs
typedef struct _ldns_sha256_CTX | ldns_sha256_CTX
typedef struct _ldns_sha512_CTX | ldns_sha512_CTX
typedef ldns_sha512_CTX | ldns_sha384_CTX

## Functions
void | ldns_sha256_init (ldns_sha256_CTX *)
void | ldns_sha256_update (ldns_sha256_CTX *, const uint8_t *, size_t)
void | ldns_sha256_final (uint8_t[32], ldns_sha256_CTX *)
void | ldns_sha384_init (ldns_sha384_CTX *)
void | ldns_sha384_update (ldns_sha384_CTX *, const uint8_t *, size_t)
void | ldns_sha384_final (uint8_t[48], ldns_sha384_CTX *)
void | ldns_sha512_init (ldns_sha512_CTX *)
void | ldns_sha512_update (ldns_sha512_CTX *, const uint8_t *, size_t)
void | ldns_sha512_final (uint8_t[64], ldns_sha512_CTX *)
unsigned char * | ldns_sha256 (unsigned char *data, unsigned int data_len, unsigned char *digest)
| Convenience function to digest a fixed block of data at once. More...
unsigned char * | ldns_sha384 (unsigned char *data, unsigned int data_len, unsigned char *digest)
| Convenience function to digest a fixed block of data at once. More...
unsigned char * | ldns_sha512 (unsigned char *data, unsigned int data_len, unsigned char *digest)
| Convenience function to digest a fixed block of data at once. More...

## Macro Definition Documentation

#define LDNS_SHA256_BLOCK_LENGTH 64

Definition at line 69 of file sha2.h.

#define LDNS_SHA256_DIGEST_LENGTH 32

Definition at line 70 of file sha2.h.

#define LDNS_SHA256_DIGEST_STRING_LENGTH (LDNS_SHA256_DIGEST_LENGTH * 2 + 1)

Definition at line 71 of file sha2.h.

#define LDNS_SHA384_BLOCK_LENGTH 128

Definition at line 72 of file sha2.h.

#define LDNS_SHA384_DIGEST_LENGTH 48

Definition at line 73 of file sha2.h.

#define LDNS_SHA384_DIGEST_STRING_LENGTH (LDNS_SHA384_DIGEST_LENGTH * 2 + 1)

Definition at line 74 of file sha2.h.

#define LDNS_SHA512_BLOCK_LENGTH 128

Definition at line 75 of file sha2.h.

#define LDNS_SHA512_DIGEST_LENGTH 64

Definition at line 76 of file sha2.h.

#define LDNS_SHA512_DIGEST_STRING_LENGTH (LDNS_SHA512_DIGEST_LENGTH * 2 + 1)

Definition at line 77 of file sha2.h.

## Typedef Documentation

typedef struct _ldns_sha256_CTX ldns_sha256_CTX

typedef struct _ldns_sha512_CTX ldns_sha512_CTX

typedef ldns_sha512_CTX ldns_sha384_CTX

Definition at line 93 of file sha2.h.

## Function Documentation

void ldns_sha256_init | ( | ldns_sha256_CTX * |  | ) |

Definition at line 315 of file sha2.c.

References _ldns_sha256_CTX::bitcount, _ldns_sha256_CTX::buffer, BYTE_ORDER, Ch, LDNS_SHA256_BLOCK_LENGTH, LDNS_SHA256_DIGEST_LENGTH, LITTLE_ENDIAN, Maj, MEMCPY_BCOPY, MEMSET_BZERO, REVERSE32, Sigma0_256, sigma0_256, Sigma1_256, sigma1_256, and _ldns_sha256_CTX::state.

void ldns_sha256_update | ( | ldns_sha256_CTX * | ,
|  | const uint8_t * | ,
|  | size_t |
| ) |  |

Definition at line 501 of file sha2.c.

References _ldns_sha256_CTX::bitcount, _ldns_sha256_CTX::buffer, LDNS_SHA256_BLOCK_LENGTH, and MEMCPY_BCOPY.

void ldns_sha256_final | ( | uint8_t | [32],
|  | ldns_sha256_CTX * |
| ) |  |

void ldns_sha384_init | ( | ldns_sha384_CTX * |  | ) |

Definition at line 941 of file sha2.c.

References _ldns_sha512_CTX::bitcount, _ldns_sha512_CTX::buffer, LDNS_SHA384_BLOCK_LENGTH, LDNS_SHA512_DIGEST_LENGTH, MEMCPY_BCOPY, MEMSET_BZERO, and _ldns_sha512_CTX::state.

void ldns_sha384_update | ( | ldns_sha384_CTX * | ,
|  | const uint8_t * | ,
|  | size_t |
| ) |  |

Definition at line 950 of file sha2.c.

References ldns_sha512_update().

void ldns_sha384_final | ( | uint8_t | [48],
|  | ldns_sha384_CTX * |
| ) |  |

void ldns_sha512_init | ( | ldns_sha512_CTX * |  | ) |

Definition at line 630 of file sha2.c.

References _ldns_sha512_CTX::bitcount, _ldns_sha512_CTX::buffer, BYTE_ORDER, Ch, LDNS_SHA512_BLOCK_LENGTH, LDNS_SHA512_DIGEST_LENGTH, LITTLE_ENDIAN, Maj, MEMCPY_BCOPY, MEMSET_BZERO, REVERSE64, Sigma0_512, sigma0_512, Sigma1_512, sigma1_512, and _ldns_sha512_CTX::state.

void ldns_sha512_update | ( | ldns_sha512_CTX * | ,
|  | const uint8_t * | ,
|  | size_t |
| ) |  |

Definition at line 810 of file sha2.c.

References ADDINC128, _ldns_sha512_CTX::bitcount, _ldns_sha512_CTX::buffer, LDNS_SHA512_BLOCK_LENGTH, ldns_sha512_SHORT_BLOCK_LENGTH, MEMCPY_BCOPY, MEMSET_BZERO, REVERSE64, _ldns_sha2_buffer_union::theChars, and _ldns_sha2_buffer_union::theLongs.

void ldns_sha512_final | ( | uint8_t | [64],
|  | ldns_sha512_CTX * |
| ) |  |

unsigned char* ldns_sha256 | ( | unsigned char * | data,
|  | unsigned int | data_len,
|  | unsigned char * | digest
| ) |  |

Convenience function to digest a fixed block of data at once.

Parameters

  [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

Returns
  the SHA1 digest of the given data

Definition at line 620 of file sha2.c.

References ldns_sha256_final(), ldns_sha256_init(), and ldns_sha256_update().

unsigned char* ldns_sha384 | ( | unsigned char * | data,
|  | unsigned int | data_len,
|  | unsigned char * | digest
| ) |  |

Convenience function to digest a fixed block of data at once.

Parameters

  [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

Returns
  the SHA1 digest of the given data

Definition at line 984 of file sha2.c.

References ldns_sha384_final(), ldns_sha384_init(), and ldns_sha384_update().

unsigned char* ldns_sha512 | ( | unsigned char * | data,
|  | unsigned int | data_len,
|  | unsigned char * | digest
| ) |  |

Convenience function to digest a fixed block of data at once.

Parameters

  [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

Returns
  the SHA1 digest of the given data

Definition at line 931 of file sha2.c.

References ldns_sha512_final(), ldns_sha512_init(), and ldns_sha512_update().