|
From: vesajaaskelainen <no...@gi...> - 2026-05-18 11:37:48
|
Branch: refs/heads/master Home: https://github.com/OpenSC/OpenSC Commit: 2a31d3c0f21e590909d630d46647e8eb92f53daa https://github.com/OpenSC/OpenSC/commit/2a31d3c0f21e590909d630d46647e8eb92f53daa Author: Vesa Jääskeläinen <ves...@va...> Date: 2026-05-18 (Mon, 18 May 2026) Changed paths: M src/libopensc/pkcs15.c Log Message: ----------- pkcs15: mark AlgorithmInfo parameters CHOICE as optional The PKCS#15 v1.1 AlgorithmInfo.parameters field is an Information Object Class (IOC) field whose presence depends on whether the referenced algorithm's class object defines &Parameters. AES algorithms are not part of the PKCS#15 v1.1 AlgorithmSet; cards encode them using NIST OIDs (2.16.840.1.101.3.4.1.*) as a de-facto extension, and no &Parameters is defined for those OIDs, so the field is correctly absent from AES entries. Mark the parameters CHOICE as SC_ASN1_OPTIONAL so that cards whose EF(TokenInfo) contains only AES AlgorithmInfo entries do not fail with "Required ASN.1 object not found" during PKCS#15 binding. Add a clang-format guard around c_asn1_algorithm_info to preserve its tab-column layout, consistent with similar guards elsewhere in the tree. Signed-off-by: Vesa Jääskeläinen <ves...@va...> Commit: 0d967c303f0f0b3c11d89ccb7126b82294bee616 https://github.com/OpenSC/OpenSC/commit/0d967c303f0f0b3c11d89ccb7126b82294bee616 Author: Vesa Jääskeläinen <ves...@va...> Date: 2026-05-18 (Mon, 18 May 2026) Changed paths: M src/libopensc/asn1.c Log Message: ----------- asn1: honour SC_ASN1_OPTIONAL for CHOICE entries asn1_decode() has a fast path for SC_ASN1_CHOICE entries (which carry no tag of their own) that returns the inner decoder's error directly, without ever inspecting the entry's SC_ASN1_OPTIONAL flag. The general optional-skip logic that follows the fast path is therefore never reached for CHOICE entries. When the inner call fails it returns before writing back to *newp and *len_left, so the caller's p/left are unchanged. Swallowing the error for an optional CHOICE is therefore safe: the next field will be attempted at the same position. Signed-off-by: Vesa Jääskeläinen <ves...@va...> Commit: e794eddab10b25d014d52dfd199e6730b8685832 https://github.com/OpenSC/OpenSC/commit/e794eddab10b25d014d52dfd199e6730b8685832 Author: Vesa Jääskeläinen <ves...@va...> Date: 2026-05-18 (Mon, 18 May 2026) Changed paths: M src/tests/unittests/asn1.c Log Message: ----------- tests/unittests: add tests for optional CHOICE in asn1_decode Add five cmocka unit tests covering asn1_decode() behaviour for SC_ASN1_CHOICE entries marked SC_ASN1_OPTIONAL: - torture_asn1_decode_optional_choice_absent: optional CHOICE absent from the byte stream -> SC_SUCCESS, surrounding fields decoded - torture_asn1_decode_optional_choice_present: optional CHOICE present -> SC_SUCCESS, alternative consumed normally - torture_asn1_decode_mandatory_choice_absent: mandatory CHOICE absent -> SC_ERROR_ASN1_OBJECT_NOT_FOUND - torture_asn1_decode_optional_choice_malformed: tag matches a CHOICE alternative but content is malformed; a real storage pointer is needed so content is actually validated -> error swallowed by the optional CHOICE with position unchanged, next mandatory field fails - torture_asn1_decode_optional_choice_end_of_stream: optional CHOICE at end of stream -> SC_SUCCESS Add clang-format guards around the struct array initializers and the main() test registration block to preserve tab-column layout. Signed-off-by: Vesa Jääskeläinen <ves...@va...> Compare: https://github.com/OpenSC/OpenSC/compare/814f745b3b6d...e794eddab10b To unsubscribe from these emails, change your notification settings at https://github.com/OpenSC/OpenSC/settings/notifications |