diff options
author | Sebastian Ramacher <sebastian+dev@ramacher.at> | 2013-10-28 02:47:48 +0100 |
---|---|---|
committer | Sebastian Ramacher <sebastian+dev@ramacher.at> | 2013-10-28 17:24:20 +0100 |
commit | 8cde8b9893819e9586bde2ce9be84f24689ff0d9 (patch) | |
tree | b0ad65ded19ca599e66f5f80fc220eb7e8980e34 | |
parent | 4b2a15fef3e9f0ca3809a54ae2a18109dae4ae01 (diff) | |
download | pycrypto-8cde8b9893819e9586bde2ce9be84f24689ff0d9.tar.gz |
Add block_finalize to clean up block_state from ALGdealloc
This is the counterpart to block_init which is called from ALGnew.
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
-rw-r--r-- | src/AES.c | 4 | ||||
-rw-r--r-- | src/AESNI.c | 4 | ||||
-rw-r--r-- | src/ARC2.c | 4 | ||||
-rw-r--r-- | src/Blowfish.c | 4 | ||||
-rw-r--r-- | src/CAST.c | 5 | ||||
-rw-r--r-- | src/DES.c | 4 | ||||
-rw-r--r-- | src/block_template.c | 1 |
7 files changed, 26 insertions, 0 deletions
@@ -1446,6 +1446,10 @@ static void block_init(block_state *state, unsigned char *key, rijndaelKeySetupDec(state->dk, key, keylen*8); } +static void block_finalize(block_state* self) +{ +} + static void block_encrypt(block_state *self, u8 *in, u8 *out) { rijndaelEncrypt(self->ek, self->rounds, in, out); diff --git a/src/AESNI.c b/src/AESNI.c index 5b388ef..81c6e9c 100644 --- a/src/AESNI.c +++ b/src/AESNI.c @@ -166,6 +166,10 @@ static void block_init(block_state* self, unsigned char* key, int keylen) aes_key_setup_dec(self->dk, self->ek, nr); } +static void block_finalize(block_state* self) +{ +} + static void block_encrypt(block_state* self, const u8* in, u8* out) { __m128i m = _mm_loadu_si128((const __m128i*) in); @@ -216,5 +216,9 @@ block_init(block_state *self, U8 *key, int keylength) } while (i--); } +static void +block_finalize(block_state* self) +{ +} #include "block_template.c" diff --git a/src/Blowfish.c b/src/Blowfish.c index 96f8628..f1ab55a 100644 --- a/src/Blowfish.c +++ b/src/Blowfish.c @@ -231,6 +231,10 @@ static void Blowfish_init(Blowfish_state *self, const unsigned char *key, int ke #define block_encrypt Blowfish_encrypt #define block_decrypt Blowfish_decrypt +static void block_finalize(block_state *self) +{ +} + #include "block_template.c" /* vim:set ts=4 sw=4 sts=4 expandtab: */ @@ -435,6 +435,11 @@ block_init(block_state *self, unsigned char *key, int keylength) } static void +block_finalize(block_state* self) +{ +} + +static void block_encrypt(block_state *self, unsigned char *in, unsigned char *out) { @@ -76,6 +76,10 @@ static void block_init(block_state *self, unsigned char *key, int keylen) } } +static void block_finalize(block_state *self) +{ +} + static void block_encrypt(block_state *self, unsigned char *in, unsigned char *out) { int rc; diff --git a/src/block_template.c b/src/block_template.c index f940e0e..eec03d3 100644 --- a/src/block_template.c +++ b/src/block_template.c @@ -84,6 +84,7 @@ static void ALGdealloc(PyObject *ptr) { ALGobject *self = (ALGobject *)ptr; + block_finalize(&self->st); /* Overwrite the contents of the object */ Py_XDECREF(self->counter); |