xref: /freebsd/crypto/openssl/crypto/x509/v3_ind_iss.c (revision e7be843b4a162e68651d3911f0357ed464915629)
1*e7be843bSPierre Pronchery /*
2*e7be843bSPierre Pronchery  * Copyright 2023 The OpenSSL Project Authors. All Rights Reserved.
3*e7be843bSPierre Pronchery  *
4*e7be843bSPierre Pronchery  * Licensed under the Apache License 2.0 (the "License").  You may not use
5*e7be843bSPierre Pronchery  * this file except in compliance with the License.  You can obtain a copy
6*e7be843bSPierre Pronchery  * in the file LICENSE in the source distribution or at
7*e7be843bSPierre Pronchery  * https://www.openssl.org/source/license.html
8*e7be843bSPierre Pronchery  */
9*e7be843bSPierre Pronchery 
10*e7be843bSPierre Pronchery #include <stdio.h>
11*e7be843bSPierre Pronchery #include "internal/cryptlib.h"
12*e7be843bSPierre Pronchery #include <openssl/asn1.h>
13*e7be843bSPierre Pronchery #include <openssl/asn1t.h>
14*e7be843bSPierre Pronchery #include <openssl/x509v3.h>
15*e7be843bSPierre Pronchery #include "ext_dat.h"
16*e7be843bSPierre Pronchery 
i2r_INDIRECT_ISSUER(X509V3_EXT_METHOD * method,void * su,BIO * out,int indent)17*e7be843bSPierre Pronchery static int i2r_INDIRECT_ISSUER(X509V3_EXT_METHOD *method,
18*e7be843bSPierre Pronchery                         void *su, BIO *out,
19*e7be843bSPierre Pronchery                         int indent)
20*e7be843bSPierre Pronchery {
21*e7be843bSPierre Pronchery     return 1;
22*e7be843bSPierre Pronchery }
23*e7be843bSPierre Pronchery 
r2i_INDIRECT_ISSUER(X509V3_EXT_METHOD * method,X509V3_CTX * ctx,const char * value)24*e7be843bSPierre Pronchery static void *r2i_INDIRECT_ISSUER(X509V3_EXT_METHOD *method,
25*e7be843bSPierre Pronchery                           X509V3_CTX *ctx, const char *value)
26*e7be843bSPierre Pronchery {
27*e7be843bSPierre Pronchery     return ASN1_NULL_new();
28*e7be843bSPierre Pronchery }
29*e7be843bSPierre Pronchery 
i2s_INDIRECT_ISSUER(const X509V3_EXT_METHOD * method,void * val)30*e7be843bSPierre Pronchery static char *i2s_INDIRECT_ISSUER(const X509V3_EXT_METHOD *method, void *val)
31*e7be843bSPierre Pronchery {
32*e7be843bSPierre Pronchery     return OPENSSL_strdup("NULL");
33*e7be843bSPierre Pronchery }
34*e7be843bSPierre Pronchery 
s2i_INDIRECT_ISSUER(const X509V3_EXT_METHOD * method,X509V3_CTX * ctx,const char * str)35*e7be843bSPierre Pronchery static void *s2i_INDIRECT_ISSUER(const X509V3_EXT_METHOD *method, X509V3_CTX *ctx, const char *str)
36*e7be843bSPierre Pronchery {
37*e7be843bSPierre Pronchery     return ASN1_NULL_new();
38*e7be843bSPierre Pronchery }
39*e7be843bSPierre Pronchery 
40*e7be843bSPierre Pronchery /*
41*e7be843bSPierre Pronchery  * The indirectIssuer X.509v3 extension is defined in ITU Recommendation X.509
42*e7be843bSPierre Pronchery  * (2019), Section 17.5.2.5. See: https://www.itu.int/rec/T-REC-X.509-201910-I/en.
43*e7be843bSPierre Pronchery  */
44*e7be843bSPierre Pronchery const X509V3_EXT_METHOD ossl_v3_indirect_issuer = {
45*e7be843bSPierre Pronchery     NID_indirect_issuer, 0, ASN1_ITEM_ref(ASN1_NULL),
46*e7be843bSPierre Pronchery     0, 0, 0, 0,
47*e7be843bSPierre Pronchery     (X509V3_EXT_I2S)i2s_INDIRECT_ISSUER,
48*e7be843bSPierre Pronchery     (X509V3_EXT_S2I)s2i_INDIRECT_ISSUER,
49*e7be843bSPierre Pronchery     0, 0,
50*e7be843bSPierre Pronchery     (X509V3_EXT_I2R)i2r_INDIRECT_ISSUER,
51*e7be843bSPierre Pronchery     (X509V3_EXT_R2I)r2i_INDIRECT_ISSUER,
52*e7be843bSPierre Pronchery     NULL
53*e7be843bSPierre Pronchery };
54