diff options
author | akuchling <akuchling@rivest.dlitz.net> | 2002-05-24 18:47:11 -0700 |
---|---|---|
committer | akuchling <akuchling@rivest.dlitz.net> | 2002-05-24 18:47:11 -0700 |
commit | dd8d35181c7412af444290d0bad3d27ea57510e1 (patch) | |
tree | 48006c684713dbc9c5786f90fb1d5527e2b9352d /src/hash_template.c | |
parent | f0b9618f6b27c3b28b3dc4f53c7844d54b7f5cef (diff) | |
download | pycrypto-dd8d35181c7412af444290d0bad3d27ea57510e1.tar.gz |
[project @ akuchling-20020525014711-0542d6c0170548df]
[project @ 2002-05-24 18:47:11 by akuchling]
Overwriting the object is safe in Python 2.2, but not in Python 2.1
because _PyObject_Del() looks at the type pointer to see if the type is
GCed or not. Instead, just zap the hash and stream cipher states.
Diffstat (limited to 'src/hash_template.c')
-rw-r--r-- | src/hash_template.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/hash_template.c b/src/hash_template.c index f1a0c88..6662dd5 100644 --- a/src/hash_template.c +++ b/src/hash_template.c @@ -48,8 +48,10 @@ newALGobject(void) static void ALG_dealloc(PyObject *ptr) { + ALGobject *self = (ALGobject *)ptr; + /* Overwrite the contents of the object */ - memset((char *)ptr, 0, sizeof(ALGobject)); + memset((char*)&(self->st), 0, sizeof(hash_state)); PyObject_Del(ptr); } |