diff options
author | Niels Möller <nisse@lysator.liu.se> | 2010-03-25 12:18:53 +0100 |
---|---|---|
committer | Niels Möller <nisse@lysator.liu.se> | 2010-03-25 12:18:53 +0100 |
commit | a8e38bdf161ecd67cecc30c255775ad261aaae9f (patch) | |
tree | 7e3c27729c3b9543f783b8d1ccc2300c24315193 /sha.h | |
parent | a43c646808f4a0f8982ce183cc984c6d5a96760d (diff) | |
download | nettle-a8e38bdf161ecd67cecc30c255775ad261aaae9f.tar.gz |
* Makefile.in (nettle_SOURCES): Added sha384-meta.c.
* sha384-meta.c: New file.
* sha.h: Added declarations for sha384. Some are aliases for the
corresponding sha512 definition.
* sha512.c (sha512_write_digest): New function.
(sha512_digest): Use it.
(sha384_init): New function.
(sha384_digest): New function.
Rev: nettle/ChangeLog:1.59
Rev: nettle/Makefile.in:1.19
Rev: nettle/nettle-meta.h:1.4
Rev: nettle/sha.h:1.5
Rev: nettle/sha384-meta.c:1.1
Rev: nettle/sha512.c:1.4
Diffstat (limited to 'sha.h')
-rw-r--r-- | sha.h | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -39,6 +39,8 @@ extern "C" { #define sha256_init nettle_sha256_init #define sha256_update nettle_sha256_update #define sha256_digest nettle_sha256_digest +#define sha384_init nettle_sha384_init +#define sha384_digest nettle_sha384_digest #define sha512_init nettle_sha512_init #define sha512_update nettle_sha512_update #define sha512_digest nettle_sha512_digest @@ -147,6 +149,24 @@ sha512_digest(struct sha512_ctx *ctx, void _nettle_sha512_compress(uint64_t *state, const uint8_t *data, const uint64_t *k); +/* SHA384. */ +/* This is the same algorithm as SHA512, but with different initial + state and truncated output. */ + +#define SHA384_DIGEST_SIZE 48 +#define SHA384_DATA_SIZE SHA512_DATA_SIZE +#define sha384_ctx sha512_ctx + +void +sha384_init(struct sha512_ctx *ctx); + +#define sha384_update nettle_sha512_update + +void +sha384_digest(struct sha512_ctx *ctx, + unsigned length, + uint8_t *digest); + #ifdef __cplusplus } #endif |