stdmem: free: only call _gcry_secmem_free if needed

Authored by jukivili on Nov 5 2018, 7:42 PM.

Description

stdmem: free: only call _gcry_secmem_free if needed

* src/stdmem.c (_gcry_private_free): Check if memory is secure before
calling _gcry_secmem_free to avoid unnecessarily taking secmem lock.

Unnecessarily taking secmem lock on non-secure memory can result poor
performance on multi-threaded workloads:

https://lists.gnupg.org/pipermail/gcrypt-devel/2018-August/004535.html
  • Reported-by: Christian Grothoff <grothoff@gnunet.org>
  • Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>

Details

Committed
jukiviliNov 5 2018, 7:42 PM
Parents
rCd6c6680ca31c: secmem: fix potential memory visibility issue
Branches
Unknown
Tags
Unknown