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