Skip to content

Fix switch case handling in TLSX_IsGroupSupported function#9777

Merged
dgarske merged 1 commit intowolfSSL:masterfrom
Pushyanth-Infineon:fix_TLSX_IsGroupSupported_switch_case_handling
Feb 16, 2026
Merged

Fix switch case handling in TLSX_IsGroupSupported function#9777
dgarske merged 1 commit intowolfSSL:masterfrom
Pushyanth-Infineon:fix_TLSX_IsGroupSupported_switch_case_handling

Conversation

@Pushyanth-Infineon
Copy link
Contributor

Fix missing break statements in ML-KEM group switch cases causing TLSX_IsGroupSupported() function to return failure even if the group is supported.

Description

In src/tls.c, the function TLSX_IsGroupSupported will return 0 (failure) when:

  1. Parameter namedGroup is WOLFSSL_ML_KEM_512 or WOLFSSL_ML_KEM_768 or their hybrid variants.
  2. WOLFSSL_NO_ML_KEM_512 and/or WOLFSSL_NO_ML_KEM_768 are not defined and WOLFSSL_NO_ML_KEM_1024 is defined.

In this case the execution will not reach break since it is present inside !WOLFSSL_NO_ML_KEM_1024 code block.

To fix this, add break; at the end of !WOLFSSL_NO_ML_KEM_512 and !WOLFSSL_NO_ML_KEM_768 blocks to handle the flow individually.

Testing

  1. Added ML_KEM (ML_KEM768) support in user_settings.h
    #define WOLFSSL_HAVE_MLKEM
    #define WOLFSSL_WC_MLKEM

    #define WOLFSSL_NO_ML_KEM_512
    // #define WOLFSSL_NO_ML_KEM_768
    #define WOLFSSL_NO_ML_KEM_1024
  1. Integrated wolfSSL layer into PSoC6 build system and built for TARGET CY8CPROTO-062-4343W board on ModusToolbox™ IDE.
  2. TLS1.3 is failing for this configuration, but succeeding if WOLFSSL_NO_ML_KEM_1024 is not defined.
  3. Adding break statements individually for each block resolved the issue.

Checklist

  • added tests
  • updated/added doxygen
  • updated appropriate READMEs
  • Updated manual and documentation

@wolfSSL-Bot
Copy link

Can one of the admins verify this patch?

@dgarske
Copy link
Contributor

dgarske commented Feb 16, 2026

Okay to test. Contributor agreement on file.

Copy link
Contributor

@Frauschi Frauschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for the fix!

@Frauschi Frauschi removed their assignment Feb 16, 2026
@dgarske dgarske merged commit db82c3e into wolfSSL:master Feb 16, 2026
569 of 570 checks passed
@dgarske
Copy link
Contributor

dgarske commented Feb 16, 2026

@Pushyanth-Infineon thank you for this fix. Our CI should have caught this, so we are looking into how to better test this edge case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants