1*b077aed3SPierre Pronchery /* 2*b077aed3SPierre Pronchery * WARNING: do not edit! 3*b077aed3SPierre Pronchery * Generated by Makefile from providers/common/include/prov/der_rsa.h.in 4*b077aed3SPierre Pronchery * 5*b077aed3SPierre Pronchery * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved. 6*b077aed3SPierre Pronchery * 7*b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use 8*b077aed3SPierre Pronchery * this file except in compliance with the License. You can obtain a copy 9*b077aed3SPierre Pronchery * in the file LICENSE in the source distribution or at 10*b077aed3SPierre Pronchery * https://www.openssl.org/source/license.html 11*b077aed3SPierre Pronchery */ 12*b077aed3SPierre Pronchery 13*b077aed3SPierre Pronchery #include "crypto/rsa.h" 14*b077aed3SPierre Pronchery #include "internal/der.h" 15*b077aed3SPierre Pronchery 16*b077aed3SPierre Pronchery /* Well known OIDs precompiled */ 17*b077aed3SPierre Pronchery 18*b077aed3SPierre Pronchery /* 19*b077aed3SPierre Pronchery * hashAlgs OBJECT IDENTIFIER ::= { nistAlgorithms 2 } 20*b077aed3SPierre Pronchery */ 21*b077aed3SPierre Pronchery #define DER_OID_V_hashAlgs DER_P_OBJECT, 8, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x02 22*b077aed3SPierre Pronchery #define DER_OID_SZ_hashAlgs 10 23*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_hashAlgs[DER_OID_SZ_hashAlgs]; 24*b077aed3SPierre Pronchery 25*b077aed3SPierre Pronchery /* 26*b077aed3SPierre Pronchery * rsaEncryption OBJECT IDENTIFIER ::= { pkcs-1 1 } 27*b077aed3SPierre Pronchery */ 28*b077aed3SPierre Pronchery #define DER_OID_V_rsaEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01 29*b077aed3SPierre Pronchery #define DER_OID_SZ_rsaEncryption 11 30*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_rsaEncryption[DER_OID_SZ_rsaEncryption]; 31*b077aed3SPierre Pronchery 32*b077aed3SPierre Pronchery /* 33*b077aed3SPierre Pronchery * id-RSAES-OAEP OBJECT IDENTIFIER ::= { pkcs-1 7 } 34*b077aed3SPierre Pronchery */ 35*b077aed3SPierre Pronchery #define DER_OID_V_id_RSAES_OAEP DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x07 36*b077aed3SPierre Pronchery #define DER_OID_SZ_id_RSAES_OAEP 11 37*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_RSAES_OAEP[DER_OID_SZ_id_RSAES_OAEP]; 38*b077aed3SPierre Pronchery 39*b077aed3SPierre Pronchery /* 40*b077aed3SPierre Pronchery * id-pSpecified OBJECT IDENTIFIER ::= { pkcs-1 9 } 41*b077aed3SPierre Pronchery */ 42*b077aed3SPierre Pronchery #define DER_OID_V_id_pSpecified DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x09 43*b077aed3SPierre Pronchery #define DER_OID_SZ_id_pSpecified 11 44*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_pSpecified[DER_OID_SZ_id_pSpecified]; 45*b077aed3SPierre Pronchery 46*b077aed3SPierre Pronchery /* 47*b077aed3SPierre Pronchery * id-RSASSA-PSS OBJECT IDENTIFIER ::= { pkcs-1 10 } 48*b077aed3SPierre Pronchery */ 49*b077aed3SPierre Pronchery #define DER_OID_V_id_RSASSA_PSS DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0A 50*b077aed3SPierre Pronchery #define DER_OID_SZ_id_RSASSA_PSS 11 51*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_RSASSA_PSS[DER_OID_SZ_id_RSASSA_PSS]; 52*b077aed3SPierre Pronchery 53*b077aed3SPierre Pronchery /* 54*b077aed3SPierre Pronchery * md2WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 2 } 55*b077aed3SPierre Pronchery */ 56*b077aed3SPierre Pronchery #define DER_OID_V_md2WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x02 57*b077aed3SPierre Pronchery #define DER_OID_SZ_md2WithRSAEncryption 11 58*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_md2WithRSAEncryption[DER_OID_SZ_md2WithRSAEncryption]; 59*b077aed3SPierre Pronchery 60*b077aed3SPierre Pronchery /* 61*b077aed3SPierre Pronchery * md5WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 4 } 62*b077aed3SPierre Pronchery */ 63*b077aed3SPierre Pronchery #define DER_OID_V_md5WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04 64*b077aed3SPierre Pronchery #define DER_OID_SZ_md5WithRSAEncryption 11 65*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_md5WithRSAEncryption[DER_OID_SZ_md5WithRSAEncryption]; 66*b077aed3SPierre Pronchery 67*b077aed3SPierre Pronchery /* 68*b077aed3SPierre Pronchery * sha1WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 5 } 69*b077aed3SPierre Pronchery */ 70*b077aed3SPierre Pronchery #define DER_OID_V_sha1WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x05 71*b077aed3SPierre Pronchery #define DER_OID_SZ_sha1WithRSAEncryption 11 72*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha1WithRSAEncryption[DER_OID_SZ_sha1WithRSAEncryption]; 73*b077aed3SPierre Pronchery 74*b077aed3SPierre Pronchery /* 75*b077aed3SPierre Pronchery * sha224WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 14 } 76*b077aed3SPierre Pronchery */ 77*b077aed3SPierre Pronchery #define DER_OID_V_sha224WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0E 78*b077aed3SPierre Pronchery #define DER_OID_SZ_sha224WithRSAEncryption 11 79*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha224WithRSAEncryption[DER_OID_SZ_sha224WithRSAEncryption]; 80*b077aed3SPierre Pronchery 81*b077aed3SPierre Pronchery /* 82*b077aed3SPierre Pronchery * sha256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 11 } 83*b077aed3SPierre Pronchery */ 84*b077aed3SPierre Pronchery #define DER_OID_V_sha256WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0B 85*b077aed3SPierre Pronchery #define DER_OID_SZ_sha256WithRSAEncryption 11 86*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha256WithRSAEncryption[DER_OID_SZ_sha256WithRSAEncryption]; 87*b077aed3SPierre Pronchery 88*b077aed3SPierre Pronchery /* 89*b077aed3SPierre Pronchery * sha384WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 12 } 90*b077aed3SPierre Pronchery */ 91*b077aed3SPierre Pronchery #define DER_OID_V_sha384WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0C 92*b077aed3SPierre Pronchery #define DER_OID_SZ_sha384WithRSAEncryption 11 93*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha384WithRSAEncryption[DER_OID_SZ_sha384WithRSAEncryption]; 94*b077aed3SPierre Pronchery 95*b077aed3SPierre Pronchery /* 96*b077aed3SPierre Pronchery * sha512WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 13 } 97*b077aed3SPierre Pronchery */ 98*b077aed3SPierre Pronchery #define DER_OID_V_sha512WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0D 99*b077aed3SPierre Pronchery #define DER_OID_SZ_sha512WithRSAEncryption 11 100*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha512WithRSAEncryption[DER_OID_SZ_sha512WithRSAEncryption]; 101*b077aed3SPierre Pronchery 102*b077aed3SPierre Pronchery /* 103*b077aed3SPierre Pronchery * sha512-224WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 15 } 104*b077aed3SPierre Pronchery */ 105*b077aed3SPierre Pronchery #define DER_OID_V_sha512_224WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0F 106*b077aed3SPierre Pronchery #define DER_OID_SZ_sha512_224WithRSAEncryption 11 107*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha512_224WithRSAEncryption[DER_OID_SZ_sha512_224WithRSAEncryption]; 108*b077aed3SPierre Pronchery 109*b077aed3SPierre Pronchery /* 110*b077aed3SPierre Pronchery * sha512-256WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 16 } 111*b077aed3SPierre Pronchery */ 112*b077aed3SPierre Pronchery #define DER_OID_V_sha512_256WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x10 113*b077aed3SPierre Pronchery #define DER_OID_SZ_sha512_256WithRSAEncryption 11 114*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_sha512_256WithRSAEncryption[DER_OID_SZ_sha512_256WithRSAEncryption]; 115*b077aed3SPierre Pronchery 116*b077aed3SPierre Pronchery /* 117*b077aed3SPierre Pronchery * id-mgf1 OBJECT IDENTIFIER ::= { pkcs-1 8 } 118*b077aed3SPierre Pronchery */ 119*b077aed3SPierre Pronchery #define DER_OID_V_id_mgf1 DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x08 120*b077aed3SPierre Pronchery #define DER_OID_SZ_id_mgf1 11 121*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_mgf1[DER_OID_SZ_id_mgf1]; 122*b077aed3SPierre Pronchery 123*b077aed3SPierre Pronchery /* 124*b077aed3SPierre Pronchery * id-rsassa-pkcs1-v1_5-with-sha3-224 OBJECT IDENTIFIER ::= { sigAlgs 13 } 125*b077aed3SPierre Pronchery */ 126*b077aed3SPierre Pronchery #define DER_OID_V_id_rsassa_pkcs1_v1_5_with_sha3_224 DER_P_OBJECT, 9, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0D 127*b077aed3SPierre Pronchery #define DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_224 11 128*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_224[DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_224]; 129*b077aed3SPierre Pronchery 130*b077aed3SPierre Pronchery /* 131*b077aed3SPierre Pronchery * id-rsassa-pkcs1-v1_5-with-sha3-256 OBJECT IDENTIFIER ::= { sigAlgs 14 } 132*b077aed3SPierre Pronchery */ 133*b077aed3SPierre Pronchery #define DER_OID_V_id_rsassa_pkcs1_v1_5_with_sha3_256 DER_P_OBJECT, 9, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0E 134*b077aed3SPierre Pronchery #define DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_256 11 135*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_256[DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_256]; 136*b077aed3SPierre Pronchery 137*b077aed3SPierre Pronchery /* 138*b077aed3SPierre Pronchery * id-rsassa-pkcs1-v1_5-with-sha3-384 OBJECT IDENTIFIER ::= { sigAlgs 15 } 139*b077aed3SPierre Pronchery */ 140*b077aed3SPierre Pronchery #define DER_OID_V_id_rsassa_pkcs1_v1_5_with_sha3_384 DER_P_OBJECT, 9, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x0F 141*b077aed3SPierre Pronchery #define DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_384 11 142*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_384[DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_384]; 143*b077aed3SPierre Pronchery 144*b077aed3SPierre Pronchery /* 145*b077aed3SPierre Pronchery * id-rsassa-pkcs1-v1_5-with-sha3-512 OBJECT IDENTIFIER ::= { sigAlgs 16 } 146*b077aed3SPierre Pronchery */ 147*b077aed3SPierre Pronchery #define DER_OID_V_id_rsassa_pkcs1_v1_5_with_sha3_512 DER_P_OBJECT, 9, 0x60, 0x86, 0x48, 0x01, 0x65, 0x03, 0x04, 0x03, 0x10 148*b077aed3SPierre Pronchery #define DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_512 11 149*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_id_rsassa_pkcs1_v1_5_with_sha3_512[DER_OID_SZ_id_rsassa_pkcs1_v1_5_with_sha3_512]; 150*b077aed3SPierre Pronchery 151*b077aed3SPierre Pronchery /* 152*b077aed3SPierre Pronchery * md4WithRSAEncryption OBJECT IDENTIFIER ::= { pkcs-1 3 } 153*b077aed3SPierre Pronchery */ 154*b077aed3SPierre Pronchery #define DER_OID_V_md4WithRSAEncryption DER_P_OBJECT, 9, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x03 155*b077aed3SPierre Pronchery #define DER_OID_SZ_md4WithRSAEncryption 11 156*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_md4WithRSAEncryption[DER_OID_SZ_md4WithRSAEncryption]; 157*b077aed3SPierre Pronchery 158*b077aed3SPierre Pronchery /* 159*b077aed3SPierre Pronchery * ripemd160WithRSAEncryption OBJECT IDENTIFIER ::= { 160*b077aed3SPierre Pronchery * iso(1) identified-organization(3) teletrust(36) algorithm(3) signatureAlgorithm(3) rsaSignature(1) 2 161*b077aed3SPierre Pronchery * } 162*b077aed3SPierre Pronchery */ 163*b077aed3SPierre Pronchery #define DER_OID_V_ripemd160WithRSAEncryption DER_P_OBJECT, 6, 0x2B, 0x24, 0x03, 0x03, 0x01, 0x02 164*b077aed3SPierre Pronchery #define DER_OID_SZ_ripemd160WithRSAEncryption 8 165*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_ripemd160WithRSAEncryption[DER_OID_SZ_ripemd160WithRSAEncryption]; 166*b077aed3SPierre Pronchery 167*b077aed3SPierre Pronchery /* 168*b077aed3SPierre Pronchery * mdc2WithRSASignature OBJECT IDENTIFIER ::= { 169*b077aed3SPierre Pronchery * iso(1) identified-organization(3) oiw(14) secsig(3) algorithms(2) mdc2WithRSASignature(14) 170*b077aed3SPierre Pronchery * } 171*b077aed3SPierre Pronchery */ 172*b077aed3SPierre Pronchery #define DER_OID_V_mdc2WithRSASignature DER_P_OBJECT, 5, 0x2B, 0x0E, 0x03, 0x02, 0x0E 173*b077aed3SPierre Pronchery #define DER_OID_SZ_mdc2WithRSASignature 7 174*b077aed3SPierre Pronchery extern const unsigned char ossl_der_oid_mdc2WithRSASignature[DER_OID_SZ_mdc2WithRSASignature]; 175*b077aed3SPierre Pronchery 176*b077aed3SPierre Pronchery 177*b077aed3SPierre Pronchery /* PSS parameters */ 178*b077aed3SPierre Pronchery int ossl_DER_w_RSASSA_PSS_params(WPACKET *pkt, int tag, 179*b077aed3SPierre Pronchery const RSA_PSS_PARAMS_30 *pss); 180*b077aed3SPierre Pronchery /* Subject Public Key Info */ 181*b077aed3SPierre Pronchery int ossl_DER_w_algorithmIdentifier_RSA(WPACKET *pkt, int tag, RSA *rsa); 182*b077aed3SPierre Pronchery int ossl_DER_w_algorithmIdentifier_RSA_PSS(WPACKET *pkt, int tag, 183*b077aed3SPierre Pronchery int rsa_type, 184*b077aed3SPierre Pronchery const RSA_PSS_PARAMS_30 *pss); 185*b077aed3SPierre Pronchery /* Signature */ 186*b077aed3SPierre Pronchery int ossl_DER_w_algorithmIdentifier_MDWithRSAEncryption(WPACKET *pkt, int tag, 187*b077aed3SPierre Pronchery int mdnid); 188