summaryrefslogtreecommitdiffstats
path: root/src/crypto/cipher/blowfish_ctr
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2013-11-18 03:53:37 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2013-11-18 03:53:37 +0100
commit7476dc0e9ae620afa4a5a5fba90997a0af18fadc (patch)
tree0a9c476249a4b9918a993606e844c72a467c2b43 /src/crypto/cipher/blowfish_ctr
parent3e8e646b91b7256ab46eb767951d2028f0dda0eb (diff)
downloadfastd-7476dc0e9ae620afa4a5a5fba90997a0af18fadc.tar
fastd-7476dc0e9ae620afa4a5a5fba90997a0af18fadc.zip
secure_memzero all cipher and MAC states
Diffstat (limited to 'src/crypto/cipher/blowfish_ctr')
-rw-r--r--src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c5
-rw-r--r--src/crypto/cipher/blowfish_ctr/openssl/blowfish_ctr.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
index bc5b85c..fb95359 100644
--- a/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
+++ b/src/crypto/cipher/blowfish_ctr/builtin/blowfish_ctr.c
@@ -316,7 +316,10 @@ static bool blowfish_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_s
}
static void blowfish_ctr_free_state(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) {
- free(state);
+ if (state) {
+ secure_memzero(state, sizeof(*state));
+ free(state);
+ }
}
static void blowfish_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *cctx UNUSED) {
diff --git a/src/crypto/cipher/blowfish_ctr/openssl/blowfish_ctr.c b/src/crypto/cipher/blowfish_ctr/openssl/blowfish_ctr.c
index 1eafb97..67dec0d 100644
--- a/src/crypto/cipher/blowfish_ctr/openssl/blowfish_ctr.c
+++ b/src/crypto/cipher/blowfish_ctr/openssl/blowfish_ctr.c
@@ -91,7 +91,10 @@ static bool blowfish_ctr_crypt(fastd_context_t *ctx UNUSED, const fastd_cipher_s
}
static void blowfish_ctr_free_state(fastd_context_t *ctx UNUSED, fastd_cipher_state_t *state) {
- free(state);
+ if (state) {
+ secure_memzero(state, sizeof(*state));
+ free(state);
+ }
}
static void blowfish_ctr_free(fastd_context_t *ctx UNUSED, fastd_cipher_context_t *cctx UNUSED) {