Skip to content

bug: DTLS 1.2 signature hash mismatch for P-384 keys #96

@tyhik

Description

@tyhik

The bug manifests only on 1.2 and only on the server side. It is exposed when providing to dimpl an ECDSA P-384 cert/key . Here's what happens:

  1. Server has a P-384 key
  2. select_ske_signature_algorithm() negotiates SHA-256 + ECDSA
  3. Server writes {hash: SHA256, sig: ECDSA} into the signed header of the ServerKeyExchange message
  4. Server calls sign(data) on its P-384 key using SHA-384 instead of the negotiated SHA-256 [BUG]
  5. Client reads the header, sees "SHA-256 + ECDSA", so it computes SHA-256(data), but verification of course fails.

Looks like there are two possible solutions: either sign with the negotiated SHA-256 in step 4 or negotiate the hash based on the provided cert, SHA-384 as per P-384, steps 2,3. The related PR implements the latter.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions