Home GnuPG

Give the secmem allocators a hint when a xmalloc calls them.
b7df907dca4dUnpublished

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.

Description

Give the secmem allocators a hint when a xmalloc calls them.

* src/secmem.c (_gcry_secmem_malloc): New not yet used arg XHINT.
(_gcry_secmem_realloc): Ditto.
* src/stdmem.c (_gcry_private_malloc_secure): New arg XHINT to be
passed to the secmem functions.
(_gcry_private_realloc): Ditto.
* src/g10lib.h (GCRY_ALLOC_FLAG_XHINT): New.
* src/global.c (do_malloc): Pass this flag as XHINT to the private
allocator.
(_gcry_malloc_secure): Factor code out to ...
(_gcry_malloc_secure_core): this.  Add arg XHINT.
(_gcry_realloc): Factor code out to ...
(_gcry_realloc_core): here.  Add arg XHINT.
(_gcry_strdup): Factor code out to ...
(_gcry_strdup_core): here.  Add arg XHINT.
(_gcry_xrealloc): Use the core function and pass true for XHINT.
(_gcry_xmalloc_secure): Ditto.
(_gcry_xstrdup): Ditto.
  • Signed-off-by: Werner Koch <wk@gnupg.org>

Details

Provenance
wernerAuthored on Dec 7 2016, 10:37 AM
Parents
rCe366c19b3492: tests: New test t-secmem.
Branches
Unknown
Tags
Unknown

Event Timeline