Hi,

I'm trying to get into the ASN1 stuff of Openssl. I'm having problems
using the X509_ALGOR structure, could anyone please be so kind help me
with this?

I have to set something like
=== CODE ===
typedef struct xxx_mysequence_st
{
        ASN1_INTEGER    *element_one;
        ASN1_INTEGER    *element_two;
} XXX_MYSEQUENCE;
DECLARE_ASN1_FUNCTIONS(XXX_MYSEQUENCE)
=== /CODE ===
as the parameter in the X509_ALGOR structure.

Using the line
=== CODE ===
X509_ALGOR_set0( algor, OBJ_txt2obj("1.2.3.4.5", 1), V_ASN1_SEQUENCE, myseq);
=== /CODE ===
to set it works fine, but when I'm doing i2d_X509_ALGOR on this I
encounter a segfault.

I traced the place where this happens down to be the memcpy at the end
of the function asn1_ex_i2c() in tasn_enc.c. In the line "len =
strtmp->length;" just before that "len" is set to $(some uninitialized
value or something). I'm not sure why this happens, but (if I'm not
just using this wrong but I couldn't find any code *not* setting
V_ASN1_NULL) I guess something is wrong in X509_ALGOR_set0().

Attached is some simple sample code producing this segfault.

Best regards,
Martin

Attachment: x509_algor_err.c.gz
Description: GNU Zip compressed data

Reply via email to