aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-10-14 22:16:27 +0200
committerChristian Heimes <christian@cheimes.de>2012-10-14 22:16:27 +0200
commit7707f6fd328ebdad65671323aaed294d5a0fe1db (patch)
tree03faa9eef235eb30d344c3f04cced065ecf6aaf2 /Modules/_sha3
parentIssue #15721: make _tkinter module pep384 compatible. (diff)
downloadcpython-7707f6fd328ebdad65671323aaed294d5a0fe1db.tar.gz
cpython-7707f6fd328ebdad65671323aaed294d5a0fe1db.tar.bz2
cpython-7707f6fd328ebdad65671323aaed294d5a0fe1db.zip
Issue #16234: Modify sha3's block_size method to return NotImplemented.
This makes the sha3 types unusable from the hmac module. HMAC-SHA3 hasn't been specified yet.
Diffstat (limited to 'Modules/_sha3')
-rw-r--r--Modules/_sha3/sha3module.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index bde474f8f83..08f683934b1 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -140,7 +140,7 @@
#include "keccak/KeccakF-1600-opt32.c"
#endif
-#define SHA3_BLOCKSIZE 200 /* 1600 bits */
+/* #define SHA3_BLOCKSIZE 200 // 1600 bits */
#define SHA3_MAX_DIGESTSIZE 64 /* 512 bits */
#define SHA3_state hashState
#define SHA3_init Init
@@ -367,7 +367,11 @@ static PyMethodDef SHA3_methods[] = {
static PyObject *
SHA3_get_block_size(SHA3object *self, void *closure)
{
- return PyLong_FromLong(SHA3_BLOCKSIZE);
+ /* HMAC-SHA3 hasn't been specified yet and no official test vectors are
+ * available. Thus block_size returns NotImplemented to prevent people
+ * from using SHA3 with the hmac module.
+ */
+ Py_RETURN_NOTIMPLEMENTED;
}
static PyObject *