Export memory safe functions.

Make crypt_safe_alloc/realloc/free and memzero part of API.
This commit is contained in:
Milan Broz
2019-11-08 16:19:24 +01:00
parent e08401a2ec
commit b03cb3f3d8
18 changed files with 196 additions and 132 deletions

View File

@@ -25,15 +25,14 @@
#include <unistd.h>
#include <sys/syscall.h>
#include "libcryptsetup.h"
#include "utils_keyring.h"
#ifndef HAVE_KEY_SERIAL_T
#define HAVE_KEY_SERIAL_T
#include <stdint.h>
typedef int32_t key_serial_t;
#endif
#include "utils_crypt.h"
#include "utils_keyring.h"
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
@@ -178,7 +177,7 @@ int keyring_get_passphrase(const char *key_desc,
if (ret < 0) {
err = errno;
if (buf)
crypt_memzero(buf, len);
crypt_safe_memzero(buf, len);
free(buf);
return -err;
}