[457] | 1 | /* x509v3.h
|
---|
| 2 | *
|
---|
| 3 | * Copyright (C) 2006-2020 wolfSSL Inc.
|
---|
| 4 | *
|
---|
| 5 | * This file is part of wolfSSL.
|
---|
| 6 | *
|
---|
| 7 | * wolfSSL is free software; you can redistribute it and/or modify
|
---|
| 8 | * it under the terms of the GNU General Public License as published by
|
---|
| 9 | * the Free Software Foundation; either version 2 of the License, or
|
---|
| 10 | * (at your option) any later version.
|
---|
| 11 | *
|
---|
| 12 | * wolfSSL is distributed in the hope that it will be useful,
|
---|
| 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 15 | * GNU General Public License for more details.
|
---|
| 16 | *
|
---|
| 17 | * You should have received a copy of the GNU General Public License
|
---|
| 18 | * along with this program; if not, write to the Free Software
|
---|
| 19 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
|
---|
| 20 | */
|
---|
| 21 |
|
---|
| 22 | /* x509v3.h for openSSL */
|
---|
| 23 |
|
---|
| 24 | #ifndef WOLFSSL_x509v3_H
|
---|
| 25 | #define WOLFSSL_x509v3_H
|
---|
| 26 |
|
---|
| 27 | #include <wolfssl/openssl/conf.h>
|
---|
| 28 | #include <wolfssl/openssl/bio.h>
|
---|
| 29 |
|
---|
| 30 | #ifdef __cplusplus
|
---|
| 31 | extern "C" {
|
---|
| 32 | #endif
|
---|
| 33 |
|
---|
| 34 | #define X509_PURPOSE_SSL_CLIENT 0
|
---|
| 35 | #define X509_PURPOSE_SSL_SERVER 1
|
---|
| 36 |
|
---|
| 37 | #define NS_SSL_CLIENT 0
|
---|
| 38 | #define NS_SSL_SERVER 1
|
---|
| 39 |
|
---|
| 40 | /* Forward reference */
|
---|
| 41 |
|
---|
| 42 | typedef void *(*X509V3_EXT_D2I)(void *, const unsigned char **, long);
|
---|
| 43 | typedef STACK_OF(CONF_VALUE) *(*X509V3_EXT_I2V) (
|
---|
| 44 | struct WOLFSSL_v3_ext_method *method,
|
---|
| 45 | void *ext, STACK_OF(CONF_VALUE) *extlist);
|
---|
| 46 | typedef char *(*X509V3_EXT_I2S)(struct WOLFSSL_v3_ext_method *method, void *ext);
|
---|
| 47 | typedef int (*X509V3_EXT_I2R) (struct WOLFSSL_v3_ext_method *method,
|
---|
| 48 | void *ext, BIO *out, int indent);
|
---|
| 49 | typedef struct WOLFSSL_v3_ext_method X509V3_EXT_METHOD;
|
---|
| 50 |
|
---|
| 51 | struct WOLFSSL_v3_ext_method {
|
---|
| 52 | int ext_nid;
|
---|
| 53 | int ext_flags;
|
---|
| 54 | void *usr_data;
|
---|
| 55 | X509V3_EXT_D2I d2i;
|
---|
| 56 | X509V3_EXT_I2V i2v;
|
---|
| 57 | X509V3_EXT_I2S i2s;
|
---|
| 58 | X509V3_EXT_I2R i2r;
|
---|
| 59 | };
|
---|
| 60 |
|
---|
| 61 | struct WOLFSSL_X509_EXTENSION {
|
---|
| 62 | WOLFSSL_ASN1_OBJECT *obj;
|
---|
| 63 | WOLFSSL_ASN1_BOOLEAN crit;
|
---|
| 64 | WOLFSSL_ASN1_STRING value;
|
---|
| 65 | WOLFSSL_v3_ext_method ext_method;
|
---|
| 66 | WOLFSSL_STACK* ext_sk; /* For extension specific data */
|
---|
| 67 | };
|
---|
| 68 |
|
---|
| 69 | #define WOLFSSL_ASN1_BOOLEAN int
|
---|
| 70 | #define GEN_OTHERNAME 0
|
---|
| 71 | #define GEN_EMAIL 1
|
---|
| 72 | #define GEN_DNS 2
|
---|
| 73 | #define GEN_X400 3
|
---|
| 74 | #define GEN_DIRNAME 4
|
---|
| 75 | #define GEN_EDIPARTY 5
|
---|
| 76 | #define GEN_URI 6
|
---|
| 77 | #define GEN_IPADD 7
|
---|
| 78 | #define GEN_RID 8
|
---|
| 79 |
|
---|
| 80 | #define GENERAL_NAME WOLFSSL_GENERAL_NAME
|
---|
| 81 |
|
---|
| 82 | #define X509V3_CTX WOLFSSL_X509V3_CTX
|
---|
| 83 |
|
---|
| 84 | typedef struct WOLFSSL_AUTHORITY_KEYID AUTHORITY_KEYID;
|
---|
| 85 | typedef struct WOLFSSL_BASIC_CONSTRAINTS BASIC_CONSTRAINTS;
|
---|
| 86 | typedef struct WOLFSSL_ACCESS_DESCRIPTION ACCESS_DESCRIPTION;
|
---|
| 87 | typedef WOLF_STACK_OF(WOLFSSL_ACCESS_DESCRIPTION) WOLFSSL_AUTHORITY_INFO_ACCESS;
|
---|
| 88 |
|
---|
| 89 | WOLFSSL_API void wolfSSL_BASIC_CONSTRAINTS_free(WOLFSSL_BASIC_CONSTRAINTS *bc);
|
---|
| 90 | WOLFSSL_API void wolfSSL_AUTHORITY_KEYID_free(WOLFSSL_AUTHORITY_KEYID *id);
|
---|
| 91 | WOLFSSL_API const WOLFSSL_v3_ext_method* wolfSSL_X509V3_EXT_get(
|
---|
| 92 | WOLFSSL_X509_EXTENSION* ex);
|
---|
| 93 | WOLFSSL_API void* wolfSSL_X509V3_EXT_d2i(WOLFSSL_X509_EXTENSION* ex);
|
---|
| 94 | WOLFSSL_API char* wolfSSL_i2s_ASN1_STRING(WOLFSSL_v3_ext_method *method,
|
---|
| 95 | const WOLFSSL_ASN1_STRING *s);
|
---|
| 96 | WOLFSSL_API int wolfSSL_X509V3_EXT_print(WOLFSSL_BIO *out,
|
---|
| 97 | WOLFSSL_X509_EXTENSION *ext, unsigned long flag, int indent);
|
---|
| 98 |
|
---|
| 99 | #define BASIC_CONSTRAINTS_free wolfSSL_BASIC_CONSTRAINTS_free
|
---|
| 100 | #define AUTHORITY_KEYID_free wolfSSL_AUTHORITY_KEYID_free
|
---|
| 101 | #define SSL_CTX_get_cert_store(x) wolfSSL_CTX_get_cert_store ((WOLFSSL_CTX*) (x))
|
---|
| 102 | #define ASN1_INTEGER WOLFSSL_ASN1_INTEGER
|
---|
| 103 | #define ASN1_OCTET_STRING WOLFSSL_ASN1_STRING
|
---|
| 104 | #define X509V3_EXT_get wolfSSL_X509V3_EXT_get
|
---|
| 105 | #define X509V3_EXT_d2i wolfSSL_X509V3_EXT_d2i
|
---|
| 106 | #define i2s_ASN1_OCTET_STRING wolfSSL_i2s_ASN1_STRING
|
---|
| 107 | #define X509V3_EXT_print wolfSSL_X509V3_EXT_print
|
---|
| 108 | #define X509V3_EXT_conf_nid wolfSSL_X509V3_EXT_conf_nid
|
---|
| 109 | #define X509V3_set_ctx wolfSSL_X509V3_set_ctx
|
---|
| 110 | #define X509V3_set_ctx_nodb wolfSSL_X509V3_set_ctx_nodb
|
---|
| 111 |
|
---|
| 112 | #ifdef __cplusplus
|
---|
| 113 | }
|
---|
| 114 | #endif
|
---|
| 115 |
|
---|
| 116 | #endif
|
---|