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.
Follow-up to liboqs open-quantum-safe/liboqs#2469 / #2437.
Our
ML-KEM-*_META.ymlpoints liboqs directly at the namespacedmlk_kem_*functions, which can returnMLK_ERR_OUT_OF_MEMORY (-2)/MLK_ERR_RNG_FAIL (-3). liboqs'sOQS_STATUSis 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 returnNULL), but-2becomes reachable with a custom allocator, and callers testingif (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'ssig_glue.c.Sibling issue: pq-code-package/mldsa-native#1296.