Skip to content

digest_list[] interior NULLs truncate name/OID lookup for MD5 and post-shake digests #30

Description

@MarkAtwood

Summary

digest_list[] in cipher/md.c is a NULL-terminated array walked by
spec_from_name() / spec_from_oid(). Under HAVE_WOLFSSL the SHA-3 block
substitutes four interior NULL placeholders for the unavailable shake specs:

#if !defined(HAVE_WOLFSSL)
     &_gcry_digest_spec_shake128, ...
#else
    NULL, NULL, NULL, NULL,
#endif

An interior NULL terminates the for (idx=0; (spec=digest_list[idx]); idx++)
scan early, so every digest listed after it — md5, md2, md4, rmd160,
tiger, whirlpool… — becomes unresolvable by name/OID. gcry_md_map_name("MD5")
returns 0.

Impact

Consumers that reference digests by name break. GnuPG registers MD5 as a
default weak digest at startup (additional_weak_digest("md5")); the failed
lookup makes gpg abort, so all gpg operations and apt repository signature
verification fail
. (The ENABLED_WOLFSSL_FIPS-gated
_gcry_md_map_name_wolfssl table compensates, but it's compiled out in
non-FIPS builds.)

Fix

Remove the interior NULLs so the scan array has no interior terminator; under
HAVE_WOLFSSL the shake entries are simply absent. Restores name/OID
resolution for MD5 and all post-shake digests. Does NOT re-enable MD5
computation (NO_MD5 still refuses it) — only name/OID lookup. PR to follow.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions