diff options
author | jbj <devnull@localhost> | 2005-03-13 01:15:37 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2005-03-13 01:15:37 +0000 |
commit | 48972a87c8ce5f87464e54379e56cf0fd9573dc7 (patch) | |
tree | e8572d4e9de6782ad1bdc936dc71f4bc7fb57048 /rpmio/digest.c | |
parent | d9499c8bdb77c101f9b127848111235a61f9a5ea (diff) | |
download | rpm-48972a87c8ce5f87464e54379e56cf0fd9573dc7.tar.gz rpm-48972a87c8ce5f87464e54379e56cf0fd9573dc7.tar.bz2 rpm-48972a87c8ce5f87464e54379e56cf0fd9573dc7.zip |
Add support for sha256/sha384/sha512 (if available.).
Update beecrypt version.
CVS patchset: 7803
CVS date: 2005/03/13 01:15:37
Diffstat (limited to 'rpmio/digest.c')
-rw-r--r-- | rpmio/digest.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/rpmio/digest.c b/rpmio/digest.c index 2072279d9..5b4cde87c 100644 --- a/rpmio/digest.c +++ b/rpmio/digest.c @@ -77,6 +77,47 @@ rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags) ctx->Digest = (void *) sha1Digest; /*@=type@*/ break; +#if HAVE_BEECRYPT_API_H + case PGPHASHALGO_SHA256: + ctx->digestlen = 32; + ctx->datalen = 64; +/*@-sizeoftype@*/ /* FIX: union, not void pointer */ + ctx->paramlen = sizeof(sha256Param); +/*@=sizeoftype@*/ + ctx->param = xcalloc(1, ctx->paramlen); +/*@-type@*/ /* FIX: cast? */ + ctx->Reset = (void *) sha256Reset; + ctx->Update = (void *) sha256Update; + ctx->Digest = (void *) sha256Digest; +/*@=type@*/ + break; + case PGPHASHALGO_SHA384: + ctx->digestlen = 48; + ctx->datalen = 128; +/*@-sizeoftype@*/ /* FIX: union, not void pointer */ + ctx->paramlen = sizeof(sha384Param); +/*@=sizeoftype@*/ + ctx->param = xcalloc(1, ctx->paramlen); +/*@-type@*/ /* FIX: cast? */ + ctx->Reset = (void *) sha384Reset; + ctx->Update = (void *) sha384Update; + ctx->Digest = (void *) sha384Digest; +/*@=type@*/ + break; + case PGPHASHALGO_SHA512: + ctx->digestlen = 64; + ctx->datalen = 128; +/*@-sizeoftype@*/ /* FIX: union, not void pointer */ + ctx->paramlen = sizeof(sha512Param); +/*@=sizeoftype@*/ + ctx->param = xcalloc(1, ctx->paramlen); +/*@-type@*/ /* FIX: cast? */ + ctx->Reset = (void *) sha512Reset; + ctx->Update = (void *) sha512Update; + ctx->Digest = (void *) sha512Digest; +/*@=type@*/ + break; +#endif case PGPHASHALGO_RIPEMD160: case PGPHASHALGO_MD2: case PGPHASHALGO_TIGER192: |