Home GnuPG

cipher: Use offsetof for allocation of gcry_md_context.

Description

cipher: Use offsetof for allocation of gcry_md_context.

* cipher/md.c (md_open): Allocate exact space for the allocation and
use offsetof for the calculation.

Also, use hd->buf to get the pointer for CTX, so that compiler can
detect it's flexible array (for GCC 11).

  • GnuPG-bug-id: T5556
  • Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>

Details