sc_supported_algo_info - Put ECDSA OID as inline

Mismatch of ASN1 parsing of tokeninfo.supported_algos[n].paramters
    in one place parameter was treated as a pointer to sc_object_id
    and in another as inline structure. This caused segfaults
    in pkcs15-tool when it tried to print the OID.

 Changes to be committed:
	modified:   src/libopensc/opensc.h
	modified:   src/libopensc/pkcs15.c
This commit is contained in:
Doug Engert 2020-04-17 12:26:14 -05:00 committed by Frank Morgner
parent 3f21dc57b7
commit c03efeee40
2 changed files with 2 additions and 2 deletions

View File

@ -223,7 +223,7 @@ extern "C" {
struct sc_supported_algo_info {
unsigned int reference;
unsigned int mechanism;
struct sc_object_id *parameters; /* OID for ECC, NULL for RSA */
struct sc_object_id parameters; /* OID for ECC */
unsigned int operations;
struct sc_object_id algo_id;
unsigned int algo_ref;

View File

@ -318,7 +318,7 @@ sc_pkcs15_encode_tokeninfo(sc_context_t *ctx, sc_pkcs15_tokeninfo_t *ti,
sc_format_asn1_entry(asn1_algo_infos[ii] + 1, &ti->supported_algos[ii].mechanism, &mechanism_len, 1);
sc_format_asn1_entry(asn1_algo_infos[ii] + 2,
asn1_algo_infos_parameters[ii], NULL, 1);
if (!ti->supported_algos[ii].parameters) {
if (!sc_valid_oid(&ti->supported_algos[ii].parameters)) {
sc_format_asn1_entry(asn1_algo_infos_parameters[ii] + 0,
NULL, NULL, 1);
}