Otherwise libgcrypt does it automatically, but only after we drop
privileges. This requires calling mlock(), which kills the sandboxed
process on OpenBSD.
If this is not enough, libgcrypt will resize the pool without calling
mlock().
--- /dev/null
+#include "../system.h"
+
+#include <gcrypt.h>
+
+#include "../crypto.h"
+
+void crypto_init(void) {
+ gcry_control(GCRYCTL_INIT_SECMEM, 32 * 1024, 0);
+ gcry_control(GCRYCTL_INITIALIZATION_FINISHED, 0);
+}
src_lib_crypto = files(
'cipher.c',
+ 'crypto.c',
'digest.c',
'pem.c',
'prf.c',
subdir(opt_crypto)
-if opt_crypto != 'openssl'
- src_lib_crypto += 'crypto.c'
-endif
-
if opt_crypto != 'nolegacy'
src_lib_crypto += ['cipher.c', 'digest.c']
endif
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#include "crypto.h"
+#include "../crypto.h"
// No-op for those cryptographic libraries that
// do not require any additional initialization.
-src_lib_crypto = files('prf.c')
+src_lib_crypto = files(
+ 'crypto.c',
+ 'prf.c',
+)
dep_crypto = dependency('', required: false)