[openssl-users] OpenSSL 1.1.0 providing new OIDs to source code

Richard Levitte levitte at openssl.org
Mon Jul 10 04:13:30 UTC 2017

In message <AM5P195MB018008B87ACD89D37B629CF3FBAB0 at AM5P195MB0180.EURP195.PROD.OUTLOOK.COM> on Sat, 8 Jul 2017 23:31:00 +0000, Matthias Ballreich <matthias.ballreich at outlook.de> said:

matthias.ballreich> Hi there,
matthias.ballreich> i want to contribute some more OIDs. Therefore i added the OIDs inside
matthias.ballreich> the „Objects.txt“ inside /crypto/objects
matthias.ballreich> Then i run these commands:
matthias.ballreich> perl objects.pl objects.txt obj_mac.num .
matthias.ballreich> ./../include/openssl/obj_mac.h
matthias.ballreich> perl obj_dat.pl ../../include/openssl/obj_mac.h obj_dat.h
matthias.ballreich> perl objxref.pl obj_mac.num obj_xref.txt > obj_xref.h

Sure, that looks fine to me

matthias.ballreich> The files are generated / updated. Then i build the source which
matthias.ballreich> builds fine without any exceptions. Then i tried to use the generated
matthias.ballreich> NIDs in my Code. For test purposes i tried to print out the short and
matthias.ballreich> Long Name of my new oid with OBJ_nid2sn(MY_NID) and OBJ_nid2(MY_NID).
matthias.ballreich> But here it prints out an empty string.
matthias.ballreich> When o try to use my NID with X509_get_ext_by_NID(cert, MY_NID, -1)
matthias.ballreich> the Output is -2.
matthias.ballreich> So where is the Problem or what i’m doing wrong here? Thanks!

If you've come that far, MY_NID (which I assume is really
NID_whatever) obviously exists, or your code wouldn't even have
compiled.  One possibility remains, that for some reason, libcrypto
hasn't been initialised like it should.  This can happen if you only
call a very select set of OpenSSL functions.  What happens if you add
this at the start of your main()?

    OPENSSL_init_crypto(0, NULL);

(note, that should be seen as a temporary measure, as this is called
internally in quite a number of spots, so for larger uses of OpenSSL
functionality, you shouldn't need that)


Richard Levitte         levitte at openssl.org
OpenSSL Project         http://www.openssl.org/~levitte/

More information about the openssl-users mailing list