diff options
| author | Cy Schubert <cy@FreeBSD.org> | 2021-08-16 23:55:17 +0000 |
|---|---|---|
| committer | Cy Schubert <cy@FreeBSD.org> | 2021-08-16 23:57:03 +0000 |
| commit | 625f1c1312fb7defbd148c8ba121a0cf058707ef (patch) | |
| tree | 31510b9372850c8a8dd3e0a8dac37308308d8429 /validator/val_secalgo.h | |
| parent | d60fa10fd872db7e3d8cb1e161cfdae026c43b14 (diff) | |
unbound: Vendor import 1.13.2vendor/unbound/1.13.2
Diffstat (limited to 'validator/val_secalgo.h')
| -rw-r--r-- | validator/val_secalgo.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/validator/val_secalgo.h b/validator/val_secalgo.h index 52aaeb9f6d36..8b6080dc24a2 100644 --- a/validator/val_secalgo.h +++ b/validator/val_secalgo.h @@ -43,6 +43,7 @@ #ifndef VALIDATOR_VAL_SECALGO_H #define VALIDATOR_VAL_SECALGO_H struct sldns_buffer; +struct secalgo_hash; /** Return size of nsec3 hash algorithm, 0 if not supported */ size_t nsec3_hash_algo_size_supported(int id); @@ -68,6 +69,48 @@ int secalgo_nsec3_hash(int algo, unsigned char* buf, size_t len, void secalgo_hash_sha256(unsigned char* buf, size_t len, unsigned char* res); /** + * Start a hash of type sha384. Allocates structure, then inits it, + * so that a series of updates can be performed, before the final result. + * @return hash structure. NULL on malloc failure or no support. + */ +struct secalgo_hash* secalgo_hash_create_sha384(void); + +/** + * Start a hash of type sha512. Allocates structure, then inits it, + * so that a series of updates can be performed, before the final result. + * @return hash structure. NULL on malloc failure or no support. + */ +struct secalgo_hash* secalgo_hash_create_sha512(void); + +/** + * Update a hash with more information to add to it. + * @param hash: the hash that is updated. + * @param data: data to add. + * @param len: length of data. + * @return false on failure. + */ +int secalgo_hash_update(struct secalgo_hash* hash, uint8_t* data, size_t len); + +/** + * Get the final result of the hash. + * @param hash: the hash that has had updates to it. + * @param result: where to store the result. + * @param maxlen: length of the result buffer, eg. size of the allocation. + * If not large enough the routine fails. + * @param resultlen: the length of the result, returned to the caller. + * How much of maxlen is used. + * @return false on failure. + */ +int secalgo_hash_final(struct secalgo_hash* hash, uint8_t* result, + size_t maxlen, size_t* resultlen); + +/** + * Delete the hash structure. + * @param hash: the hash to delete. + */ +void secalgo_hash_delete(struct secalgo_hash* hash); + +/** * Return size of DS digest according to its hash algorithm. * @param algo: DS digest algo. * @return size in bytes of digest, or 0 if not supported. |
