Home GnuPG
Diffusion GnuPG 7c91b48f0e80

common: Fix -Wswitch warning.

Description

common: Fix -Wswitch warning.

* common/compliance.c (gnupg_digest_is_allowed): Don't include
GCRY_MD_WHIRLPOOL because it is not a digest_algo_t.

Note that Whirlpool is not used anywhere in gpg or gpgsm.

  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Jun 13 2017, 9:01 AM
Parents
rG7aeac20f12ed: gpg: Send gpgcompose --help output to stdout, not stderr.
Branches
Unknown
Tags
Unknown

Event Timeline

% sm/gpgsm --help|grep WHIRL
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224, WHIRLPOOL

Oh, that merely lists all has algorithms Libgcrypt supports (iirc, within some sensible range). So yes, gpgsm would support that but I have never encountered one and I guess only gpgsm would be able to create such a CMS message.

I have see that you used all kind of precautions to avoid problems with the different types (enums/defines). However in --enable-maintainer-mode -Wswitch is enabled for a reasons ;-)

Oh, that merely lists all has algorithms Libgcrypt supports (iirc, within some sensible range). So yes, gpgsm would support that but I have never encountered one and I guess only gpgsm would be able to create such a CMS message.

No, that is a list of algorithms that gpgsm chooses to allow:

static int
our_md_test_algo (int algo)
{
  switch (algo)
    {
    case GCRY_MD_MD5:
    case GCRY_MD_SHA1:
    case GCRY_MD_RMD160:
    case GCRY_MD_SHA224:
    case GCRY_MD_SHA256:
    case GCRY_MD_SHA384:
    case GCRY_MD_SHA512:
    case GCRY_MD_WHIRLPOOL:
      return gcry_md_test_algo (algo);
    default:
      return 1;
    }
}
...
        digests = build_list("Hash: ", gcry_md_algo_name, our_md_test_algo );

I have see that you used all kind of precautions to avoid problems with the different types (enums/defines). However in --enable-maintainer-mode -Wswitch is enabled for a reasons ;-)

Then I propose to change the signature of these functions so that we use a plain int for the algorithms. I implemented the policy described in "that document" and it explicitly allows the use of Whirlpool for some uses.