On Tue, Apr 03, 2012, Naveen Nathan wrote: > On Wed, Apr 04, 2012 at 03:12:26AM +0200, Dr. Stephen Henson wrote: > > On Tue, Apr 03, 2012, Naveen Nathan wrote: > > > > > > > > That's because the ASN1_OBJECT is a little different. Some standard > > > > > > OIDs are > > > > > > set to a fixed value to avoid the need to keep allocating them. > > > > > > What that > > > > > > means in practice is you do something like: > > > > > > > > > > > > foo->usage = OBJ_something(somearg); > > > > > > > > > > > > This wont result in a memory leak because the OID isn't dynamically > > > > > > allocated. > > > > > > > > > > I would also be using custom OIDs. Would I need to first register the > > > > > OIDs > > > > > using OBJ_create? Normally we don't use any name identifier. Or is > > > > > there > > > > > a way to duplicate an ASN1_OBJECT? > > > > > > > > > > Otherwise I can probably write an auxillary function to handle this in > > > > > a similar vein to OBJ_dup(ASN1_OBJECT *). > > > > > > > > > > > > > You can use OBJ_txt2obj to created an ASN1_OBJECT from the numerical > > > > form if > > > > you wish. OBJ_dup will duplicate an ASN1_OBJECT just fine. > > > > > > Thanks, but perhaps I am a little unclear about the issue I'm having. > > > > > > I have written the following code to demonstrate the issue I'm having, > > > specifically with ASN1_OBJECT in a custom ASN1 struct containing only > > > one ASN1_OBJECT type. > > > > > > I just have a basic ASN1 sequence containing an ASN1_OBJECT. I want > > > to assign the custom OID "1.2.3.4" to obj. When I try to do this with > > > OBJ_txt2obj(), this becomes the cause for a segfault on i2d_basic(). > > > > > > I'm unsure why this segfault occurs. My guess is obj is already > > > allocated by simple_asn_new(); therefore reassigning it with > > > a newly created object from OBJ_txt2obj() causes a segfault. > > > But I'm not too familiar with the internals of the i2d_* routine > > > to see how this is possible. > > > > > > > What OS are you running this on? > > This is on Mac OSX 10.7.2 running OpenSSL 0.9.8r. > > I also have the same issue on FreeBSD 8.2 running OpenSSL 0.9.8q.
That's weird. I don't get crashes with 0.9.8 trees or 1.0.0, your program works as expected. Steve. -- Dr Stephen N. Henson. OpenSSL project core developer. Commercial tech support now available see: http://www.openssl.org ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List openssl-users@openssl.org Automated List Manager majord...@openssl.org