Hi,
Either I've got something wrong or there's a big problem here.
I create new objects with OBJ_create, giving their OID as an argument
and getting back an NID.
Then I convert some data that is the DER encoding of an OID to an
ASN1_OBJECT.
I then call OBJ_obj2nid, expecting to get back the correct NID, if the
OID of the object happens to be the one of the new object I created.
Unfortunately I always get 0.
I tried to understand why this happens.
obj-dat.c : line 350+
OBJ_obj2nid searches the object with the call lh_retrieve(added,&ad)
where ad.obj is the pointer to my ASN1_OBJECT.
As lh_retrieve considers ad as a void * pointer, it indexes on the
content of the structures ad, not on what the pointer ad.obj inside this
structure points to.
This mean I have a chance to find my data back only if the value of the
pointer ad.obj is the same as the one was used when OBJ_add_object was
called to add this OID in the hash table.
In this case, OBJ_add_object was called inside OBJ_create, and the
pointer used was allocated during the call and freed just thereafter. So
I don't stand a single chance the value is the same.
Am I doing it wrong ? Should I call another function ? Do you consider
this kind of behaviour as normal ? How much costs a pint of beer in
australia ? ;-)
Is the only way to get this right to create an ASN1_OBJECT from my OID
string, instead of using OBJ_create and then do an obj_cmp between
ASN1_OBJECT until I find the right one ?
______________________________________________________________________
OpenSSL Project http://www.openssl.org
Development Mailing List [EMAIL PROTECTED]
Automated List Manager [EMAIL PROTECTED]