Remember hash algorithm in digest context
authorPanu Matilainen <pmatilai@redhat.com>
Wed, 11 Mar 2009 16:07:22 +0000 (18:07 +0200)
committerPanu Matilainen <pmatilai@redhat.com>
Wed, 11 Mar 2009 16:07:22 +0000 (18:07 +0200)
- alternatively we could reverse map NSS hash types (HASHContext
  knows its type) but shrug...

rpmio/digest.c

index d13d775..a779330 100644 (file)
@@ -21,6 +21,7 @@
 struct DIGEST_CTX_s {
     rpmDigestFlags flags;      /*!< Bit(s) to control digest operation. */
     HASHContext *hashctx;      /*!< Internal NSS hash context. */
+    pgpHashAlgo algo;          /*!< Used hash algorithm */
 };
 
 DIGEST_CTX
@@ -89,6 +90,7 @@ rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
     if ((hashctx = HASH_Create(type)) != NULL) {
        ctx = xcalloc(1, sizeof(*ctx));
        ctx->flags = flags;
+       ctx->algo = hashalgo;
        ctx->hashctx = hashctx;
        HASH_Begin(ctx->hashctx);
     }