protection improvements (2): Use ECB for DEK encryption, use IV, etc.

This commit is contained in:
NIIBE Yutaka
2012-06-15 08:56:57 +09:00
parent 94a65f0d99
commit 2d5246e7fa
7 changed files with 122 additions and 67 deletions

View File

@@ -1,7 +1,7 @@
/*
* random.c -- get random bytes
*
* Copyright (C) 2010, 2011 Free Software Initiative of Japan
* Copyright (C) 2010, 2011, 2012 Free Software Initiative of Japan
* Author: NIIBE Yutaka <gniibe@fsij.org>
*
* This file is a part of Gnuk, a GnuPG USB Token implementation.
@@ -26,7 +26,7 @@
#include "gnuk.h"
#include "neug.h"
#define RANDOM_BYTES_LENGTH 16
#define RANDOM_BYTES_LENGTH 32
static uint32_t random_word[RANDOM_BYTES_LENGTH/sizeof (uint32_t)];
void
@@ -43,7 +43,7 @@ random_init (void)
}
/*
* Return pointer to random 16-byte
* Return pointer to random 32-byte
*/
const uint8_t *
random_bytes_get (void)
@@ -53,7 +53,7 @@ random_bytes_get (void)
}
/*
* Free pointer to random 16-byte
* Free pointer to random 32-byte
*/
void
random_bytes_free (const uint8_t *p)