summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rpmio/digest.c41
-rw-r--r--rpmio/rpmio_internal.h7
-rw-r--r--rpmio/rpmpgp.c2
3 files changed, 47 insertions, 3 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:
diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h
index 660ca1581..c2906e8ee 100644
--- a/rpmio/rpmio_internal.h
+++ b/rpmio/rpmio_internal.h
@@ -28,6 +28,11 @@
#include <rsa.h>
#include <rsapk.h>
#include <sha1.h>
+#if HAVE_BEECRYPT_API_H
+#include <sha256.h>
+#include <sha384.h>
+#include <sha512.h>
+#endif
/** \ingroup rpmio
* Values parsed from OpenPGP signature/pubkey packet(s).
@@ -74,10 +79,8 @@ struct pgpDig_s {
/*@only@*/ /*@null@*/
DIGEST_CTX md5ctx; /*!< (rsa) md5 hash context. */
-#ifdef NOTYET
/*@only@*/ /*@null@*/
DIGEST_CTX hdrmd5ctx; /*!< (rsa) header md5 hash context. */
-#endif
/*@only@*/ /*@null@*/
void * md5; /*!< (rsa) V3 signature hash. */
size_t md5len; /*!< (rsa) V3 signature hash length. */
diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c
index d5adb60e4..033127539 100644
--- a/rpmio/rpmpgp.c
+++ b/rpmio/rpmpgp.c
@@ -1382,7 +1382,7 @@ char * pgpArmorWrap(int atype, const unsigned char * s, size_t ns)
/*@-globs@*/
t = stpcpy( stpcpy(t, "-----\nVersion: rpm-"), VERSION);
/*@=globs@*/
- t = stpcpy(t, " (beecrypt-3.0.0)\n\n");
+ t = stpcpy(t, " (beecrypt-4.1.2)\n\n");
if ((enc = b64encode(s, ns)) != NULL) {
t = stpcpy(t, enc);