Consider 80 bits as the absolute minimum for a secure symmetric key. If
a loaded key is shorter, send a warning to the system log to encourage
the admin to replace it with a longer key.
#include "local.h"
#include "logging.h"
+/* Consider 80 bits as the absolute minimum for a secure key */
+#define MIN_SECURE_KEY_LENGTH 10
typedef struct {
uint32_t id;
continue;
}
+ if (key.len < MIN_SECURE_KEY_LENGTH)
+ LOG(LOGS_WARN, LOGF_Keys, "Key %"PRIu32" is too short", key_id);
+
key.id = key_id;
key.val = MallocArray(char, key.len);
memcpy(key.val, keyval, key.len);