Skip to content

Wycheproof nit: WolfCryptException not caught as GeneralSecurityException in ECDH/DH invalid-key paths #220

Description

@MarkAtwood

Found by the wychcheck-jce Wycheproof runner.

Failing tests

  • EcdhTest.testInvalidPublicParamsSecp256r1
  • EcdhTest.testInvalidPublicParamsSecp384r1
  • EcdhTest.testInvalidPublicParamsSecp521r1
  • EcdhTest.testModifiedPublicEcdh
  • EcdhTest.testModifiedPublicEcdhSpec
  • EcdhTest.testWrongOrderEcdhSecp256r1
  • DhTest.testDHDistinctParameters

Root cause

WolfCryptException extends RuntimeException, not GeneralSecurityException. The Wycheproof tests catch GeneralSecurityException on adversarial/invalid key inputs and expect that to succeed. Instead WolfCryptException propagates uncaught, causing the test to fail with a runtime exception rather than a handled exception.

JCE callers that wrap KeyAgreement.doPhase() or generateSecret() in a catch (GeneralSecurityException) block will see uncaught WolfCryptException if an adversarial/invalid public key is passed in.

Priority

Low — affects adversarial/edge-case code paths not exercised by normal application code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions