Skip to content

liboqs integration: normalize return codes to OQS_STATUS #1802

Description

@mkannwischer

Follow-up to liboqs open-quantum-safe/liboqs#2469 / #2437.

Our ML-KEM-*_META.yml points liboqs directly at the namespaced mlk_kem_* functions, which can return MLK_ERR_OUT_OF_MEMORY (-2) / MLK_ERR_RNG_FAIL (-3). liboqs's OQS_STATUS is a closed enum (OQS_SUCCESS = 0, OQS_ERROR = -1) and the generated dispatcher casts our result straight through, so those out-of-contract values would reach consumers unchanged. It's latent today (the liboqs RNG shim can't fail and the default stack allocator can't return NULL), but -2 becomes reachable with a custom allocator, and callers testing if (ret == OQS_ERROR) would miss it.

We should normalize at the integration/liboqs/ boundary (map nonzero -> OQS_ERROR) via a small glue shim, analogous to mldsa-native's sig_glue.c.

Sibling issue: pq-code-package/mldsa-native#1296.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions