This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: hmac sha384/sha512 fails test vectors
Type: behavior Stage: needs patch
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7, Python 2.6
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, hagen, iwade
Priority: critical Keywords:

Created on 2009-07-13 03:56 by iwade, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_vectors.py iwade, 2009-07-13 03:56 codification of test vectors from draft rfc.
Messages (4)
msg90467 - (view) Author: Iain Wade (iwade) Date: 2009-07-13 03:56
Test vectors are in the following draft rfc:
http://tools.ietf.org/html/draft-nystrom-smime-hmac-sha

The problem is that hmac.py has a hard-coded block size of 64, while 
SHA-384 and SHA-512 have a 128-byte block size.

Suggested fix is either:

a/ have the various hashlib libraries export block size (like they 
currently do for digest_size).

b/ parameterize blocksize to the constructor so that users can override.

c/ I have no third suggestion.

I have made available a codified version of the test vectors for your 
convenience.
msg90579 - (view) Author: Hagen Fürstenau (hagen) Date: 2009-07-16 19:48
Seems like this has already been fixed as issue 1385.
msg90592 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2009-07-16 22:14
Indeed, the provided test file passes on all python versions I have.
Iain, does this script fail on some version?
msg90607 - (view) Author: Iain Wade (iwade) Date: 2009-07-17 07:11
d'oh, I should have checked HEAD before submitting the bug.

I am running 2.5.1 on OSX, the fix seems to be in 2.5.2 and above.

Thanks, and sorry for wasting your time.
History
Date User Action Args
2022-04-11 14:56:50adminsetgithub: 50722
2009-07-17 07:11:59iwadesetstatus: open -> closed

messages: + msg90607
2009-07-16 22:14:25amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg90592
2009-07-16 19:48:32hagensetnosy: + hagen
messages: + msg90579
2009-07-13 10:21:42pitrousetpriority: critical
stage: needs patch
versions: + Python 2.6, Python 3.1, Python 2.7, Python 3.2, - Python 2.5
2009-07-13 03:56:49iwadecreate