Macros | Functions | Variables
v3_purp.c File Reference
#include <stdio.h>
#include <string.h>
#include <openssl/err.h>
#include <openssl/digest.h>
#include <openssl/mem.h>
#include <openssl/obj.h>
#include <openssl/thread.h>
#include <openssl/x509v3.h>
#include "../internal.h"
#include "../x509/internal.h"
#include "internal.h"
Include dependency graph for v3_purp.c:

Go to the source code of this file.

Macros

#define ku_reject(x, usage)   (((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))
 
#define KU_TLS   (KU_DIGITAL_SIGNATURE|KU_KEY_ENCIPHERMENT|KU_KEY_AGREEMENT)
 
#define ns_reject(x, usage)   (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage)))
 
#define V1_ROOT   (EXFLAG_V1|EXFLAG_SS)
 
#define X509_PURPOSE_COUNT   (sizeof(xstandard)/sizeof(X509_PURPOSE))
 
#define xku_reject(x, usage)   (((x)->ex_flags & EXFLAG_XKUSAGE) && !((x)->ex_xkusage & (usage)))
 

Functions

static int check_ca (const X509 *x)
 
static int check_purpose_crl_sign (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int check_purpose_ns_ssl_server (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int check_purpose_smime_encrypt (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int check_purpose_smime_sign (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int check_purpose_ssl_client (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int check_purpose_ssl_server (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int check_purpose_timestamp_sign (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int nid_cmp (const void *void_a, const void *void_b)
 
static int no_check (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int ocsp_helper (const X509_PURPOSE *xp, const X509 *x, int ca)
 
static int purpose_smime (const X509 *x, int ca)
 
static int setup_crldp (X509 *x)
 
static int setup_dp (X509 *x, DIST_POINT *dp)
 
static STACK_OF (X509_PURPOSE)
 
int X509_check_akid (X509 *issuer, AUTHORITY_KEYID *akid)
 
int X509_check_ca (X509 *x)
 
int X509_check_issued (X509 *issuer, X509 *subject)
 
int X509_check_purpose (X509 *x, int id, int ca)
 
const GENERAL_NAMES * X509_get0_authority_issuer (X509 *x509)
 
const ASN1_OCTET_STRINGX509_get0_authority_key_id (X509 *x509)
 
const ASN1_INTEGERX509_get0_authority_serial (X509 *x509)
 
const ASN1_OCTET_STRINGX509_get0_subject_key_id (X509 *x509)
 
uint32_t X509_get_extended_key_usage (X509 *x)
 
uint32_t X509_get_extension_flags (X509 *x)
 
uint32_t X509_get_key_usage (X509 *x)
 
long X509_get_pathlen (X509 *x509)
 
int X509_PURPOSE_add (int id, int trust, int flags, int(*ck)(const X509_PURPOSE *, const X509 *, int), char *name, char *sname, void *arg)
 
void X509_PURPOSE_cleanup (void)
 
X509_PURPOSEX509_PURPOSE_get0 (int idx)
 
char * X509_PURPOSE_get0_name (const X509_PURPOSE *xp)
 
char * X509_PURPOSE_get0_sname (const X509_PURPOSE *xp)
 
int X509_PURPOSE_get_by_id (int purpose)
 
int X509_PURPOSE_get_by_sname (char *sname)
 
int X509_PURPOSE_get_count (void)
 
int X509_PURPOSE_get_id (const X509_PURPOSE *xp)
 
int X509_PURPOSE_get_trust (const X509_PURPOSE *xp)
 
int X509_PURPOSE_set (int *p, int purpose)
 
int X509_supported_extension (X509_EXTENSION *ex)
 
int x509v3_cache_extensions (X509 *x)
 
static int xp_cmp (const X509_PURPOSE **a, const X509_PURPOSE **b)
 
static void xptable_free (X509_PURPOSE *p)
 

Variables

static X509_PURPOSE xstandard []
 

Macro Definition Documentation

◆ ku_reject

#define ku_reject (   x,
  usage 
)    (((x)->ex_flags & EXFLAG_KUSAGE) && !((x)->ex_kusage & (usage)))

Definition at line 74 of file v3_purp.c.

◆ KU_TLS

Definition at line 647 of file v3_purp.c.

◆ ns_reject

#define ns_reject (   x,
  usage 
)    (((x)->ex_flags & EXFLAG_NSCERT) && !((x)->ex_nscert & (usage)))

Definition at line 78 of file v3_purp.c.

◆ V1_ROOT

#define V1_ROOT   (EXFLAG_V1|EXFLAG_SS)

Definition at line 73 of file v3_purp.c.

◆ X509_PURPOSE_COUNT

#define X509_PURPOSE_COUNT   (sizeof(xstandard)/sizeof(X509_PURPOSE))

Definition at line 128 of file v3_purp.c.

◆ xku_reject

#define xku_reject (   x,
  usage 
)    (((x)->ex_flags & EXFLAG_XKUSAGE) && !((x)->ex_xkusage & (usage)))

Definition at line 76 of file v3_purp.c.

Function Documentation

◆ check_ca()

static int check_ca ( const X509 x)
static

Definition at line 604 of file v3_purp.c.

◆ check_purpose_crl_sign()

static int check_purpose_crl_sign ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 725 of file v3_purp.c.

◆ check_purpose_ns_ssl_server()

static int check_purpose_ns_ssl_server ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 667 of file v3_purp.c.

◆ check_purpose_smime_encrypt()

static int check_purpose_smime_encrypt ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 713 of file v3_purp.c.

◆ check_purpose_smime_sign()

static int check_purpose_smime_sign ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 701 of file v3_purp.c.

◆ check_purpose_ssl_client()

static int check_purpose_ssl_client ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 626 of file v3_purp.c.

◆ check_purpose_ssl_server()

static int check_purpose_ssl_server ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 650 of file v3_purp.c.

◆ check_purpose_timestamp_sign()

static int check_purpose_timestamp_sign ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 749 of file v3_purp.c.

◆ nid_cmp()

static int nid_cmp ( const void *  void_a,
const void *  void_b 
)
static

Definition at line 330 of file v3_purp.c.

◆ no_check()

static int no_check ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 784 of file v3_purp.c.

◆ ocsp_helper()

static int ocsp_helper ( const X509_PURPOSE xp,
const X509 x,
int  ca 
)
static

Definition at line 741 of file v3_purp.c.

◆ purpose_smime()

static int purpose_smime ( const X509 x,
int  ca 
)
static

Definition at line 682 of file v3_purp.c.

◆ setup_crldp()

static int setup_crldp ( X509 x)
static

Definition at line 400 of file v3_purp.c.

◆ setup_dp()

static int setup_dp ( X509 x,
DIST_POINT dp 
)
static

Definition at line 373 of file v3_purp.c.

◆ STACK_OF()

static STACK_OF ( X509_PURPOSE  )
static

Definition at line 130 of file v3_purp.c.

◆ X509_check_akid()

int X509_check_akid ( X509 issuer,
AUTHORITY_KEYID akid 
)

Definition at line 823 of file v3_purp.c.

◆ X509_check_ca()

int X509_check_ca ( X509 x)

Definition at line 618 of file v3_purp.c.

◆ X509_check_issued()

int X509_check_issued ( X509 issuer,
X509 subject 
)

Definition at line 799 of file v3_purp.c.

◆ X509_check_purpose()

int X509_check_purpose ( X509 x,
int  id,
int  ca 
)

Definition at line 142 of file v3_purp.c.

◆ X509_get0_authority_issuer()

const GENERAL_NAMES* X509_get0_authority_issuer ( X509 x509)

Definition at line 906 of file v3_purp.c.

◆ X509_get0_authority_key_id()

const ASN1_OCTET_STRING* X509_get0_authority_key_id ( X509 x509)

Definition at line 898 of file v3_purp.c.

◆ X509_get0_authority_serial()

const ASN1_INTEGER* X509_get0_authority_serial ( X509 x509)

Definition at line 914 of file v3_purp.c.

◆ X509_get0_subject_key_id()

const ASN1_OCTET_STRING* X509_get0_subject_key_id ( X509 x509)

Definition at line 890 of file v3_purp.c.

◆ X509_get_extended_key_usage()

uint32_t X509_get_extended_key_usage ( X509 x)

Definition at line 880 of file v3_purp.c.

◆ X509_get_extension_flags()

uint32_t X509_get_extension_flags ( X509 x)

Definition at line 862 of file v3_purp.c.

◆ X509_get_key_usage()

uint32_t X509_get_key_usage ( X509 x)

Definition at line 870 of file v3_purp.c.

◆ X509_get_pathlen()

long X509_get_pathlen ( X509 x509)

Definition at line 922 of file v3_purp.c.

◆ X509_PURPOSE_add()

int X509_PURPOSE_add ( int  id,
int  trust,
int  flags,
int(*)(const X509_PURPOSE *, const X509 *, int ck,
char *  name,
char *  sname,
void *  arg 
)

Definition at line 214 of file v3_purp.c.

◆ X509_PURPOSE_cleanup()

void X509_PURPOSE_cleanup ( void  )

Definition at line 301 of file v3_purp.c.

◆ X509_PURPOSE_get0()

X509_PURPOSE* X509_PURPOSE_get0 ( int  idx)

Definition at line 176 of file v3_purp.c.

◆ X509_PURPOSE_get0_name()

char* X509_PURPOSE_get0_name ( const X509_PURPOSE xp)

Definition at line 315 of file v3_purp.c.

◆ X509_PURPOSE_get0_sname()

char* X509_PURPOSE_get0_sname ( const X509_PURPOSE xp)

Definition at line 320 of file v3_purp.c.

◆ X509_PURPOSE_get_by_id()

int X509_PURPOSE_get_by_id ( int  purpose)

Definition at line 197 of file v3_purp.c.

◆ X509_PURPOSE_get_by_sname()

int X509_PURPOSE_get_by_sname ( char *  sname)

Definition at line 185 of file v3_purp.c.

◆ X509_PURPOSE_get_count()

int X509_PURPOSE_get_count ( void  )

Definition at line 169 of file v3_purp.c.

◆ X509_PURPOSE_get_id()

int X509_PURPOSE_get_id ( const X509_PURPOSE xp)

Definition at line 310 of file v3_purp.c.

◆ X509_PURPOSE_get_trust()

int X509_PURPOSE_get_trust ( const X509_PURPOSE xp)

Definition at line 325 of file v3_purp.c.

◆ X509_PURPOSE_set()

int X509_PURPOSE_set ( int p,
int  purpose 
)

Definition at line 159 of file v3_purp.c.

◆ X509_supported_extension()

int X509_supported_extension ( X509_EXTENSION ex)

Definition at line 337 of file v3_purp.c.

◆ x509v3_cache_extensions()

int x509v3_cache_extensions ( X509 x)

Definition at line 415 of file v3_purp.c.

◆ xp_cmp()

static int xp_cmp ( const X509_PURPOSE **  a,
const X509_PURPOSE **  b 
)
static

◆ xptable_free()

static void xptable_free ( X509_PURPOSE p)
static

Definition at line 288 of file v3_purp.c.

Variable Documentation

◆ xstandard

X509_PURPOSE xstandard[]
static
Initial value:
= {
check_purpose_ssl_client, (char *)"SSL client", (char *)"sslclient",
NULL},
check_purpose_ssl_server, (char *)"SSL server", (char *)"sslserver",
NULL},
check_purpose_ns_ssl_server, (char *)"Netscape SSL server",
(char *)"nssslserver", NULL},
(char *)"S/MIME signing", (char *)"smimesign", NULL},
check_purpose_smime_encrypt, (char *)"S/MIME encryption",
(char *)"smimeencrypt", NULL},
(char *)"CRL signing", (char *)"crlsign", NULL},
{X509_PURPOSE_ANY, X509_TRUST_DEFAULT, 0, no_check, (char *)"Any Purpose",
(char *)"any", NULL},
(char *)"OCSP helper", (char *)"ocsphelper", NULL},
check_purpose_timestamp_sign, (char *)"Time Stamp signing",
(char *)"timestampsign", NULL},
}

Definition at line 102 of file v3_purp.c.

X509_PURPOSE_SSL_CLIENT
#define X509_PURPOSE_SSL_CLIENT
Definition: x509v3.h:448
check_purpose_smime_sign
static int check_purpose_smime_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:701
X509_TRUST_SSL_SERVER
#define X509_TRUST_SSL_SERVER
Definition: x509.h:163
X509_PURPOSE_SMIME_SIGN
#define X509_PURPOSE_SMIME_SIGN
Definition: x509v3.h:451
X509_TRUST_DEFAULT
#define X509_TRUST_DEFAULT
Definition: x509.h:159
X509_TRUST_TSA
#define X509_TRUST_TSA
Definition: x509.h:168
check_purpose_smime_encrypt
static int check_purpose_smime_encrypt(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:713
X509_PURPOSE_ANY
#define X509_PURPOSE_ANY
Definition: x509v3.h:454
check_purpose_crl_sign
static int check_purpose_crl_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:725
check_purpose_ssl_client
static int check_purpose_ssl_client(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:626
X509_PURPOSE_NS_SSL_SERVER
#define X509_PURPOSE_NS_SSL_SERVER
Definition: x509v3.h:450
X509_PURPOSE_SSL_SERVER
#define X509_PURPOSE_SSL_SERVER
Definition: x509v3.h:449
no_check
static int no_check(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:784
check_purpose_ssl_server
static int check_purpose_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:650
ocsp_helper
static int ocsp_helper(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:741
X509_PURPOSE_OCSP_HELPER
#define X509_PURPOSE_OCSP_HELPER
Definition: x509v3.h:455
X509_PURPOSE_CRL_SIGN
#define X509_PURPOSE_CRL_SIGN
Definition: x509v3.h:453
check_purpose_ns_ssl_server
static int check_purpose_ns_ssl_server(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:667
check_purpose_timestamp_sign
static int check_purpose_timestamp_sign(const X509_PURPOSE *xp, const X509 *x, int ca)
Definition: v3_purp.c:749
X509_TRUST_EMAIL
#define X509_TRUST_EMAIL
Definition: x509.h:164
X509_PURPOSE_TIMESTAMP_SIGN
#define X509_PURPOSE_TIMESTAMP_SIGN
Definition: x509v3.h:456
X509_PURPOSE_SMIME_ENCRYPT
#define X509_PURPOSE_SMIME_ENCRYPT
Definition: x509v3.h:452
X509_TRUST_COMPAT
#define X509_TRUST_COMPAT
Definition: x509.h:161
X509_TRUST_SSL_CLIENT
#define X509_TRUST_SSL_CLIENT
Definition: x509.h:162


grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:37