From: Dr. Stephen Henson Date: Tue, 18 Apr 2006 23:36:07 +0000 (+0000) Subject: Add OID cross reference table. X-Git-Tag: OpenSSL_0_9_8k^2~1374 X-Git-Url: https://git.openssl.org/gitweb/?p=openssl.git;a=commitdiff_plain;h=d20270980852968fcd8279f9c22d095935eca580;hp=51ff0abb05d3e0e71b6666032b777c2c1f3fe5f1 Add OID cross reference table. Fix some typos in GOST OIDs. Update dependencies. --- diff --git a/CHANGES b/CHANGES index 9fe59f9acc..d87e1ebbdd 100644 --- a/CHANGES +++ b/CHANGES @@ -4,6 +4,12 @@ Changes between 0.9.8a and 0.9.9 [xx XXX xxxx] + *) Add an OID cross reference table and utility functions. Its purpose is to + translate between signature OIDs such as SHA1WithrsaEncryption and SHA1, + rsaEncryption. This will allow some of the algorithm specific hackery + needed to use the correct OID to be removed. + [Steve Henson] + *) Remove algorithm specific dependencies when setting PKCS7_SIGNER_INFO structures for PKCS7_sign(). They are now set up by the relevant public key ASN1 method. diff --git a/crypto/ec/Makefile b/crypto/ec/Makefile index bae5f6fff7..a5cd042030 100644 --- a/crypto/ec/Makefile +++ b/crypto/ec/Makefile @@ -173,6 +173,20 @@ ec_mult.o: ../../include/openssl/obj_mac.h ../../include/openssl/opensslconf.h ec_mult.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h ec_mult.o: ../../include/openssl/safestack.h ../../include/openssl/stack.h ec_mult.o: ../../include/openssl/symhacks.h ec_lcl.h ec_mult.c +ec_pmeth.o: ../../e_os.h ../../include/openssl/asn1.h +ec_pmeth.o: ../../include/openssl/asn1t.h ../../include/openssl/bio.h +ec_pmeth.o: ../../include/openssl/buffer.h ../../include/openssl/crypto.h +ec_pmeth.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h +ec_pmeth.o: ../../include/openssl/ecdh.h ../../include/openssl/ecdsa.h +ec_pmeth.o: ../../include/openssl/err.h ../../include/openssl/evp.h +ec_pmeth.o: ../../include/openssl/lhash.h ../../include/openssl/obj_mac.h +ec_pmeth.o: ../../include/openssl/objects.h ../../include/openssl/opensslconf.h +ec_pmeth.o: ../../include/openssl/opensslv.h ../../include/openssl/ossl_typ.h +ec_pmeth.o: ../../include/openssl/pkcs7.h ../../include/openssl/safestack.h +ec_pmeth.o: ../../include/openssl/sha.h ../../include/openssl/stack.h +ec_pmeth.o: ../../include/openssl/symhacks.h ../../include/openssl/x509.h +ec_pmeth.o: ../../include/openssl/x509_vfy.h ../cryptlib.h ../evp/evp_locl.h +ec_pmeth.o: ec_pmeth.c ec_print.o: ../../include/openssl/asn1.h ../../include/openssl/bio.h ec_print.o: ../../include/openssl/bn.h ../../include/openssl/crypto.h ec_print.o: ../../include/openssl/e_os2.h ../../include/openssl/ec.h diff --git a/crypto/objects/Makefile b/crypto/objects/Makefile index 08af092914..ce9f585fd0 100644 --- a/crypto/objects/Makefile +++ b/crypto/objects/Makefile @@ -18,20 +18,20 @@ TEST= APPS= LIB=$(TOP)/libcrypto.a -LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c -LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o +LIBSRC= o_names.c obj_dat.c obj_lib.c obj_err.c obj_xref.c +LIBOBJ= o_names.o obj_dat.o obj_lib.o obj_err.o obj_xref.o SRC= $(LIBSRC) EXHEADER= objects.h obj_mac.h -HEADER= $(EXHEADER) obj_dat.h +HEADER= $(EXHEADER) obj_dat.h obj_xref.h ALL= $(GENERAL) $(SRC) $(HEADER) top: (cd ../..; $(MAKE) DIRS=crypto SDIRS=$(DIR) sub_all) -all: obj_dat.h lib +all: obj_dat.h obj_xref.h lib lib: $(LIBOBJ) $(AR) $(LIB) $(LIBOBJ) @@ -46,6 +46,10 @@ obj_mac.h: objects.pl objects.txt obj_mac.num $(PERL) objects.pl objects.txt obj_mac.num obj_mac.h @sleep 1; touch obj_mac.h; sleep 1 +obj_xref.h: objxref.pl obj_xref.txt obj_mac.num + $(PERL) objxref.pl > obj_xref.h + @sleep 1; touch obj_xref.h; sleep 1 + files: $(PERL) $(TOP)/util/files.pl Makefile >> $(TOP)/MINFO diff --git a/crypto/objects/obj_dat.h b/crypto/objects/obj_dat.h index 5d6fe0bbc6..b10d85df4b 100644 --- a/crypto/objects/obj_dat.h +++ b/crypto/objects/obj_dat.h @@ -825,8 +825,8 @@ static unsigned char lvalues[5345]={ 0x2A,0x85,0x03,0x02,0x02,0x17, /* [5298] OBJ_id_GostR3411_94_prf */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x05,0x03, /* [5304] OBJ_id_GostR3410_94_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x05,0x04, /* [5312] OBJ_id_GostR3410_2001_cc */ -0x2A,0x85,0x03,0x02,0x09,0x01,0x03,0x03, /* [5320] OBJ_id_GostR3410_11_94_with_GostR3411_94_cc */ -0x2A,0x85,0x03,0x02,0x09,0x01,0x03,0x04, /* [5328] OBJ_id_GostR3410_2001_with_GostR3411_94_cc */ +0x2A,0x85,0x03,0x02,0x09,0x01,0x03,0x03, /* [5320] OBJ_id_GostR3411_94_with_GostR3410_94_cc */ +0x2A,0x85,0x03,0x02,0x09,0x01,0x03,0x04, /* [5328] OBJ_id_GostR3411_94_with_GostR3410_2001_cc */ 0x2A,0x85,0x03,0x02,0x09,0x01,0x08,0x01, /* [5336] OBJ_id_GostR3410_2001_ParamSet_cc */ }; @@ -2113,12 +2113,12 @@ static ASN1_OBJECT nid_objs[NUM_NID]={ &(lvalues[5304]),0}, {"gost2001cc","GOST 34.10-2001 Cryptocom",NID_id_GostR3410_2001_cc,8, &(lvalues[5312]),0}, -{"id-GostR3410-11-94-with-GostR3411-94-cc", - "GOST R 34.10 with GOST R 34.11-94 Cryptocom", - NID_id_GostR3410_11_94_with_GostR3411_94_cc,8,&(lvalues[5320]),0}, -{"id-GostR3410-2001-with-GostR3411-94-cc", - "GOST R 34.10-2001 with GOST R 34.10-94 Cryptocom", - NID_id_GostR3410_2001_with_GostR3411_94_cc,8,&(lvalues[5328]),0}, +{"id-GostR3411-94-with-GostR3410-94-cc", + "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom", + NID_id_GostR3411_94_with_GostR3410_94_cc,8,&(lvalues[5320]),0}, +{"id-GostR3411-94-with-GostR3410-2001-cc", + "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom", + NID_id_GostR3411_94_with_GostR3410_2001_cc,8,&(lvalues[5328]),0}, {"id-GostR3410-2001-ParamSet-cc", "GOST R 3410-2001 Parameter Set Cryptocom", NID_id_GostR3410_2001_ParamSet_cc,8,&(lvalues[5336]),0}, @@ -2393,7 +2393,6 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={ &(nid_objs[789]),/* "id-Gost28147-89-None-KeyMeshing" */ &(nid_objs[760]),/* "id-Gost28147-89-TestParamSet" */ &(nid_objs[794]),/* "id-Gost28147-89-cc" */ -&(nid_objs[799]),/* "id-GostR3410-11-94-with-GostR3411-94-cc" */ &(nid_objs[777]),/* "id-GostR3410-2001-CryptoPro-A-ParamSet" */ &(nid_objs[778]),/* "id-GostR3410-2001-CryptoPro-B-ParamSet" */ &(nid_objs[779]),/* "id-GostR3410-2001-CryptoPro-C-ParamSet" */ @@ -2401,7 +2400,6 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={ &(nid_objs[781]),/* "id-GostR3410-2001-CryptoPro-XchB-ParamSet" */ &(nid_objs[801]),/* "id-GostR3410-2001-ParamSet-cc" */ &(nid_objs[776]),/* "id-GostR3410-2001-TestParamSet" */ -&(nid_objs[800]),/* "id-GostR3410-2001-with-GostR3411-94-cc" */ &(nid_objs[786]),/* "id-GostR3410-2001DH" */ &(nid_objs[769]),/* "id-GostR3410-94-CryptoPro-A-ParamSet" */ &(nid_objs[770]),/* "id-GostR3410-94-CryptoPro-B-ParamSet" */ @@ -2419,7 +2417,9 @@ static ASN1_OBJECT *sn_objs[NUM_SN]={ &(nid_objs[759]),/* "id-GostR3411-94-CryptoProParamSet" */ &(nid_objs[758]),/* "id-GostR3411-94-TestParamSet" */ &(nid_objs[754]),/* "id-GostR3411-94-with-GostR3410-2001" */ +&(nid_objs[800]),/* "id-GostR3411-94-with-GostR3410-2001-cc" */ &(nid_objs[755]),/* "id-GostR3411-94-with-GostR3410-94" */ +&(nid_objs[799]),/* "id-GostR3411-94-with-GostR3410-94-cc" */ &(nid_objs[783]),/* "id-HMACGostR3411-94" */ &(nid_objs[266]),/* "id-aca" */ &(nid_objs[355]),/* "id-aca-accessIdentity" */ @@ -2947,16 +2947,16 @@ static ASN1_OBJECT *ln_objs[NUM_LN]={ &(nid_objs[785]),/* "GOST 28147-89 MAC" */ &(nid_objs[798]),/* "GOST 34.10-2001 Cryptocom" */ &(nid_objs[797]),/* "GOST 34.10-94 Cryptocom" */ -&(nid_objs[799]),/* "GOST R 34.10 with GOST R 34.11-94 Cryptocom" */ &(nid_objs[756]),/* "GOST R 34.10-2001" */ &(nid_objs[786]),/* "GOST R 34.10-2001 DH" */ -&(nid_objs[800]),/* "GOST R 34.10-2001 with GOST R 34.10-94 Cryptocom" */ &(nid_objs[757]),/* "GOST R 34.10-94" */ &(nid_objs[787]),/* "GOST R 34.10-94 DH" */ &(nid_objs[795]),/* "GOST R 34.11-94" */ &(nid_objs[796]),/* "GOST R 34.11-94 PRF" */ &(nid_objs[754]),/* "GOST R 34.11-94 with GOST R 34.10-2001" */ +&(nid_objs[800]),/* "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" */ &(nid_objs[755]),/* "GOST R 34.11-94 with GOST R 34.10-94" */ +&(nid_objs[799]),/* "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" */ &(nid_objs[801]),/* "GOST R 3410-2001 Parameter Set Cryptocom" */ &(nid_objs[783]),/* "HMAC GOST 34.11-94" */ &(nid_objs[432]),/* "Hold Instruction Call Issuer" */ @@ -4080,8 +4080,8 @@ static ASN1_OBJECT *obj_objs[NUM_OBJ]={ &(nid_objs[508]),/* OBJ_id_hex_multipart_message 1 3 6 1 7 1 1 2 */ &(nid_objs[57]),/* OBJ_netscape 2 16 840 1 113730 */ &(nid_objs[437]),/* OBJ_pilot 0 9 2342 19200300 100 */ -&(nid_objs[799]),/* OBJ_id_GostR3410_11_94_with_GostR3411_94_cc 1 2 643 2 9 1 3 3 */ -&(nid_objs[800]),/* OBJ_id_GostR3410_2001_with_GostR3411_94_cc 1 2 643 2 9 1 3 4 */ +&(nid_objs[799]),/* OBJ_id_GostR3411_94_with_GostR3410_94_cc 1 2 643 2 9 1 3 3 */ +&(nid_objs[800]),/* OBJ_id_GostR3411_94_with_GostR3410_2001_cc 1 2 643 2 9 1 3 4 */ &(nid_objs[797]),/* OBJ_id_GostR3410_94_cc 1 2 643 2 9 1 5 3 */ &(nid_objs[798]),/* OBJ_id_GostR3410_2001_cc 1 2 643 2 9 1 5 4 */ &(nid_objs[794]),/* OBJ_id_Gost28147_89_cc 1 2 643 2 9 1 6 1 */ diff --git a/crypto/objects/obj_mac.h b/crypto/objects/obj_mac.h index 7a64e944d8..44c2166a34 100644 --- a/crypto/objects/obj_mac.h +++ b/crypto/objects/obj_mac.h @@ -3510,15 +3510,15 @@ #define NID_id_GostR3410_2001_cc 798 #define OBJ_id_GostR3410_2001_cc OBJ_cryptocom,1L,5L,4L -#define SN_id_GostR3410_11_94_with_GostR3411_94_cc "id-GostR3410-11-94-with-GostR3411-94-cc" -#define LN_id_GostR3410_11_94_with_GostR3411_94_cc "GOST R 34.10 with GOST R 34.11-94 Cryptocom" -#define NID_id_GostR3410_11_94_with_GostR3411_94_cc 799 -#define OBJ_id_GostR3410_11_94_with_GostR3411_94_cc OBJ_cryptocom,1L,3L,3L - -#define SN_id_GostR3410_2001_with_GostR3411_94_cc "id-GostR3410-2001-with-GostR3411-94-cc" -#define LN_id_GostR3410_2001_with_GostR3411_94_cc "GOST R 34.10-2001 with GOST R 34.10-94 Cryptocom" -#define NID_id_GostR3410_2001_with_GostR3411_94_cc 800 -#define OBJ_id_GostR3410_2001_with_GostR3411_94_cc OBJ_cryptocom,1L,3L,4L +#define SN_id_GostR3411_94_with_GostR3410_94_cc "id-GostR3411-94-with-GostR3410-94-cc" +#define LN_id_GostR3411_94_with_GostR3410_94_cc "GOST R 34.11-94 with GOST R 34.10-94 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_94_cc 799 +#define OBJ_id_GostR3411_94_with_GostR3410_94_cc OBJ_cryptocom,1L,3L,3L + +#define SN_id_GostR3411_94_with_GostR3410_2001_cc "id-GostR3411-94-with-GostR3410-2001-cc" +#define LN_id_GostR3411_94_with_GostR3410_2001_cc "GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom" +#define NID_id_GostR3411_94_with_GostR3410_2001_cc 800 +#define OBJ_id_GostR3411_94_with_GostR3410_2001_cc OBJ_cryptocom,1L,3L,4L #define SN_id_GostR3410_2001_ParamSet_cc "id-GostR3410-2001-ParamSet-cc" #define LN_id_GostR3410_2001_ParamSet_cc "GOST R 3410-2001 Parameter Set Cryptocom" diff --git a/crypto/objects/obj_mac.num b/crypto/objects/obj_mac.num index 550d6ee9ea..e9e79fffc0 100644 --- a/crypto/objects/obj_mac.num +++ b/crypto/objects/obj_mac.num @@ -796,6 +796,6 @@ id_GostR3411_94 795 id_GostR3411_94_prf 796 id_GostR3410_94_cc 797 id_GostR3410_2001_cc 798 -id_GostR3410_11_94_with_GostR3411_94_cc 799 -id_GostR3410_2001_with_GostR3411_94_cc 800 +id_GostR3411_94_with_GostR3410_94_cc 799 +id_GostR3411_94_with_GostR3410_2001_cc 800 id_GostR3410_2001_ParamSet_cc 801 diff --git a/crypto/objects/obj_xref.c b/crypto/objects/obj_xref.c new file mode 100644 index 0000000000..d26394fe31 --- /dev/null +++ b/crypto/objects/obj_xref.c @@ -0,0 +1,132 @@ +/* crypto/objects/obj_xref.c */ +/* Written by Dr Stephen N Henson (shenson@bigfoot.com) for the OpenSSL + * project 2006. + */ +/* ==================================================================== + * Copyright (c) 2006 The OpenSSL Project. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * + * 3. All advertising materials mentioning features or use of this + * software must display the following acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)" + * + * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * licensing@OpenSSL.org. + * + * 5. Products derived from this software may not be called "OpenSSL" + * nor may "OpenSSL" appear in their names without prior written + * permission of the OpenSSL Project. + * + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: + * "This product includes software developed by the OpenSSL Project + * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)" + * + * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. + * ==================================================================== + * + * This product includes cryptographic software written by Eric Young + * (eay@cryptsoft.com). This product includes software written by Tim + * Hudson (tjh@cryptsoft.com). + * + */ + +#include +#include "obj_xref.h" + +static int cmp_sig(const nid_triple *a, const nid_triple *b) + { + return **a - **b; + } + +static int cmp_sigx(const nid_triple **a, const nid_triple **b) + { + int ret; + ret = (**a)[1] - (**b)[1]; + if (ret) + return ret; + return (**a)[2] - (**b)[2]; + } + + +int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid) + { + nid_triple tmp, *rv; + tmp[0] = signid; + + rv = (nid_triple *)OBJ_bsearch((char *)&tmp, + (char *)sigoid_srt, + sizeof(sigoid_srt) / sizeof(nid_triple), + sizeof(nid_triple), + (int (*)(const void *, const void *))cmp_sig); + if (rv == NULL) + return 0; + *pdig_nid = (*rv)[1]; + *ppkey_nid = (*rv)[2]; + return 1; + } + +int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid) + { + nid_triple tmp, *t=&tmp, **rv; + tmp[1] = dig_nid; + tmp[2] = pkey_nid; + + rv = (nid_triple **)OBJ_bsearch((char *)&t, + (char *)sigoid_srt_xref, + sizeof(sigoid_srt_xref) / sizeof(nid_triple *), + sizeof(nid_triple *), + (int (*)(const void *, const void *))cmp_sigx); + if (rv == NULL) + return 0; + *psignid = (**rv)[0]; + return 1; + } + +#ifdef OBJ_XREF_TEST + +main() + { + int n1, n2, n3; + + int i, rv; + + for (i = 0; i < sizeof(sigoid_srt) / sizeof(nid_triple); i++) + { + n1 = sigoid_srt[i][0]; + rv = OBJ_find_sigid_algs(n1, &n2, &n3); + printf("Forward: %d, %s %s %s\n", rv, + OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3)); + n1=0; + rv = OBJ_find_sigid_by_algs(&n1, n2, n3); + printf("Reverse: %d, %s %s %s\n", rv, + OBJ_nid2ln(n1), OBJ_nid2ln(n2), OBJ_nid2ln(n3)); + } + } + +#endif diff --git a/crypto/objects/obj_xref.h b/crypto/objects/obj_xref.h new file mode 100644 index 0000000000..b9efad79b5 --- /dev/null +++ b/crypto/objects/obj_xref.h @@ -0,0 +1,53 @@ + +typedef int nid_triple[3]; + +static const nid_triple sigoid_srt[] = + { + {NID_md2WithRSAEncryption, NID_md2, NID_rsaEncryption}, + {NID_md5WithRSAEncryption, NID_md5, NID_rsaEncryption}, + {NID_shaWithRSAEncryption, NID_sha, NID_rsaEncryption}, + {NID_sha1WithRSAEncryption, NID_sha1, NID_rsaEncryption}, + {NID_dsaWithSHA, NID_sha, NID_dsa}, + {NID_dsaWithSHA1_2, NID_sha1, NID_dsa_2}, + {NID_mdc2WithRSA, NID_mdc2, NID_rsaEncryption}, + {NID_md5WithRSA, NID_md5, NID_rsa}, + {NID_dsaWithSHA1, NID_sha1, NID_dsa}, + {NID_sha1WithRSA, NID_sha1, NID_rsa}, + {NID_ripemd160WithRSA, NID_ripemd160, NID_rsaEncryption}, + {NID_md4WithRSAEncryption, NID_md4, NID_rsaEncryption}, + {NID_ecdsa_with_SHA1, NID_sha1, NID_X9_62_id_ecPublicKey}, + {NID_sha256WithRSAEncryption, NID_sha256, NID_rsaEncryption}, + {NID_sha384WithRSAEncryption, NID_sha384, NID_rsaEncryption}, + {NID_sha512WithRSAEncryption, NID_sha512, NID_rsaEncryption}, + {NID_sha224WithRSAEncryption, NID_sha224, NID_rsaEncryption}, + {NID_id_GostR3411_94_with_GostR3410_2001, NID_id_GostR3411_94, NID_id_GostR3410_2001}, + {NID_id_GostR3411_94_with_GostR3410_94, NID_id_GostR3411_94, NID_id_GostR3410_94}, + {NID_id_GostR3411_94_with_GostR3410_94_cc, NID_id_GostR3411_94, NID_id_GostR3410_94_cc}, + {NID_id_GostR3411_94_with_GostR3410_2001_cc, NID_id_GostR3411_94, NID_id_GostR3410_2001_cc}, + }; + +static const nid_triple * const sigoid_srt_xref[] = + { + &sigoid_srt[0], + &sigoid_srt[1], + &sigoid_srt[7], + &sigoid_srt[2], + &sigoid_srt[4], + &sigoid_srt[3], + &sigoid_srt[9], + &sigoid_srt[5], + &sigoid_srt[8], + &sigoid_srt[12], + &sigoid_srt[6], + &sigoid_srt[10], + &sigoid_srt[11], + &sigoid_srt[13], + &sigoid_srt[14], + &sigoid_srt[15], + &sigoid_srt[16], + &sigoid_srt[17], + &sigoid_srt[18], + &sigoid_srt[19], + &sigoid_srt[20], + }; + diff --git a/crypto/objects/obj_xref.txt b/crypto/objects/obj_xref.txt new file mode 100644 index 0000000000..a90e0c51c8 --- /dev/null +++ b/crypto/objects/obj_xref.txt @@ -0,0 +1,33 @@ +# OID cross reference table. +# Links signatures OIDs to their corresponding public key algorithms +# and digests. + +md2WithRSAEncryption md2 rsaEncryption +md5WithRSAEncryption md5 rsaEncryption +shaWithRSAEncryption sha rsaEncryption +sha1WithRSAEncryption sha1 rsaEncryption +md4WithRSAEncryption md4 rsaEncryption +sha256WithRSAEncryption sha256 rsaEncryption +sha384WithRSAEncryption sha384 rsaEncryption +sha512WithRSAEncryption sha512 rsaEncryption +sha224WithRSAEncryption sha224 rsaEncryption +mdc2WithRSA mdc2 rsaEncryption +ripemd160WithRSA ripemd160 rsaEncryption + +# Alternative deprecated OIDs. By using the older "rsa" OID this +# type will be recognized by not normally used. + +md5WithRSA md5 rsa +sha1WithRSA sha1 rsa + +dsaWithSHA sha dsa +dsaWithSHA1 sha1 dsa + +dsaWithSHA1_2 sha1 dsa_2 + +ecdsa_with_SHA1 sha1 X9_62_id_ecPublicKey + +id_GostR3411_94_with_GostR3410_2001 id_GostR3411_94 id_GostR3410_2001 +id_GostR3411_94_with_GostR3410_94 id_GostR3411_94 id_GostR3410_94 +id_GostR3411_94_with_GostR3410_94_cc id_GostR3411_94 id_GostR3410_94_cc +id_GostR3411_94_with_GostR3410_2001_cc id_GostR3411_94 id_GostR3410_2001_cc diff --git a/crypto/objects/objects.h b/crypto/objects/objects.h index 7242f76fb0..97b110758e 100644 --- a/crypto/objects/objects.h +++ b/crypto/objects/objects.h @@ -1022,6 +1022,9 @@ int OBJ_create(const char *oid,const char *sn,const char *ln); void OBJ_cleanup(void ); int OBJ_create_objects(BIO *in); +int OBJ_find_sigid_algs(int signid, int *pdig_nid, int *ppkey_nid); +int OBJ_find_sigid_by_algs(int *psignid, int dig_nid, int pkey_nid); + /* BEGIN ERROR CODES */ /* The following lines are auto generated by the script mkerr.pl. Any changes * made after this point may be overwritten when the script is next run. diff --git a/crypto/objects/objects.txt b/crypto/objects/objects.txt index 972c6e111f..62c5bbe4ac 100644 --- a/crypto/objects/objects.txt +++ b/crypto/objects/objects.txt @@ -1122,7 +1122,7 @@ cryptocom 1 5 3 : gost94cc : GOST 34.10-94 Cryptocom !Cname id-GostR3410-2001-cc cryptocom 1 5 4 : gost2001cc : GOST 34.10-2001 Cryptocom -cryptocom 1 3 3 : id-GostR3410-11-94-with-GostR3411-94-cc : GOST R 34.10 with GOST R 34.11-94 Cryptocom -cryptocom 1 3 4 : id-GostR3410-2001-with-GostR3411-94-cc : GOST R 34.10-2001 with GOST R 34.10-94 Cryptocom +cryptocom 1 3 3 : id-GostR3411-94-with-GostR3410-94-cc : GOST R 34.11-94 with GOST R 34.10-94 Cryptocom +cryptocom 1 3 4 : id-GostR3411-94-with-GostR3410-2001-cc : GOST R 34.11-94 with GOST R 34.10-2001 Cryptocom cryptocom 1 8 1 : id-GostR3410-2001-ParamSet-cc : GOST R 3410-2001 Parameter Set Cryptocom diff --git a/crypto/objects/objxref.pl b/crypto/objects/objxref.pl new file mode 100644 index 0000000000..0dd360b5b0 --- /dev/null +++ b/crypto/objects/objxref.pl @@ -0,0 +1,91 @@ +#!/usr/local/bin/perl + +open IN, "obj_mac.num"; + +# Read in OID nid values for a lookup table. + +while () + { + chomp; + my ($name, $num) = /^(\S+)\s+(\S+)$/; + $oid_tbl{$name} = $num; + } +close IN; + +open IN, "obj_xref.txt"; + +my $ln = 1; + +while () + { + chomp; + s/#.*$//; + next if (/^\S*$/); + my ($xr, $p1, $p2) = /^(\S+)\s+(\S+)\s+(\S+)/; + check_oid($xr); + check_oid($p1); + check_oid($p2); + $xref_tbl{$xr} = [$p1, $p2, $ln]; + } + +my @xrkeys = keys %xref_tbl; + +my @srt1 = sort { $oid_tbl{$a} <=> $oid_tbl{$b}} @xrkeys; + +for(my $i = 0; $i <= $#srt1; $i++) + { + $xref_tbl{$srt1[$i]}[2] = $i; + } + +my @srt2 = sort + { + my$ap1 = $oid_tbl{$xref_tbl{$a}[0]}; + my$bp1 = $oid_tbl{$xref_tbl{$b}[0]}; + return $ap1 - $bp1 if ($ap1 != $bp1); + my$ap2 = $oid_tbl{$xref_tbl{$a}[1]}; + my$bp2 = $oid_tbl{$xref_tbl{$b}[1]}; + + return $ap2 - $bp2; + } @xrkeys; + + +print <