Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hmac sha384/sha512 fails test vectors #50722

Closed
iwade mannequin opened this issue Jul 13, 2009 · 4 comments
Closed

hmac sha384/sha512 fails test vectors #50722

iwade mannequin opened this issue Jul 13, 2009 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@iwade
Copy link
Mannequin

iwade mannequin commented Jul 13, 2009

BPO 6473
Nosy @amauryfa
Files
  • test_vectors.py: codification of test vectors from draft rfc.
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2009-07-17.07:11:59.603>
    created_at = <Date 2009-07-13.03:56:49.127>
    labels = ['type-bug', 'library']
    title = 'hmac sha384/sha512 fails test vectors'
    updated_at = <Date 2009-07-17.07:11:59.601>
    user = 'https://bugs.python.org/iwade'

    bugs.python.org fields:

    activity = <Date 2009-07-17.07:11:59.601>
    actor = 'iwade'
    assignee = 'none'
    closed = True
    closed_date = <Date 2009-07-17.07:11:59.603>
    closer = 'iwade'
    components = ['Library (Lib)']
    creation = <Date 2009-07-13.03:56:49.127>
    creator = 'iwade'
    dependencies = []
    files = ['14492']
    hgrepos = []
    issue_num = 6473
    keywords = []
    message_count = 4.0
    messages = ['90467', '90579', '90592', '90607']
    nosy_count = 3.0
    nosy_names = ['amaury.forgeotdarc', 'hagen', 'iwade']
    pr_nums = []
    priority = 'critical'
    resolution = None
    stage = 'needs patch'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue6473'
    versions = ['Python 2.6', 'Python 3.1', 'Python 2.7', 'Python 3.2']

    @iwade
    Copy link
    Mannequin Author

    iwade mannequin commented Jul 13, 2009

    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.

    @iwade iwade mannequin added stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error labels Jul 13, 2009
    @hagen
    Copy link
    Mannequin

    hagen mannequin commented Jul 16, 2009

    Seems like this has already been fixed as bpo-1385.

    @amauryfa
    Copy link
    Member

    Indeed, the provided test file passes on all python versions I have.
    Iain, does this script fail on some version?

    @iwade
    Copy link
    Mannequin Author

    iwade mannequin commented Jul 17, 2009

    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.

    @iwade iwade mannequin closed this as completed Jul 17, 2009
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant