]> git.ipfire.org Git - thirdparty/openssl.git/blame - crypto/x509/x509_ext.c
Raise an error on syscall failure in tls_retry_write_records
[thirdparty/openssl.git] / crypto / x509 / x509_ext.c
CommitLineData
b1322259 1/*
1f5e0f92 2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
d02b48c6 3 *
3e4b43b9 4 * Licensed under the Apache License 2.0 (the "License"). You may not use
b1322259
RS
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
d02b48c6
RE
8 */
9
10#include <stdio.h>
b39fc560 11#include "internal/cryptlib.h"
ec577822
BM
12#include <openssl/asn1.h>
13#include <openssl/objects.h>
14#include <openssl/evp.h>
15#include <openssl/x509.h>
25f2138b 16#include "crypto/x509.h"
ff8a4c47
DSH
17#include <openssl/x509v3.h>
18
7569362e 19int X509_CRL_get_ext_count(const X509_CRL *x)
0f113f3e 20{
26a7d938 21 return X509v3_get_ext_count(x->crl.extensions);
0f113f3e 22}
d02b48c6 23
7569362e 24int X509_CRL_get_ext_by_NID(const X509_CRL *x, int nid, int lastpos)
0f113f3e 25{
26a7d938 26 return X509v3_get_ext_by_NID(x->crl.extensions, nid, lastpos);
0f113f3e 27}
d02b48c6 28
c47ba4e9
F
29int X509_CRL_get_ext_by_OBJ(const X509_CRL *x, const ASN1_OBJECT *obj,
30 int lastpos)
0f113f3e 31{
26a7d938 32 return X509v3_get_ext_by_OBJ(x->crl.extensions, obj, lastpos);
0f113f3e 33}
d02b48c6 34
7569362e 35int X509_CRL_get_ext_by_critical(const X509_CRL *x, int crit, int lastpos)
0f113f3e 36{
26a7d938 37 return X509v3_get_ext_by_critical(x->crl.extensions, crit, lastpos);
0f113f3e 38}
d02b48c6 39
c7d13c13 40X509_EXTENSION *X509_CRL_get_ext(const X509_CRL *x, int loc)
0f113f3e 41{
26a7d938 42 return X509v3_get_ext(x->crl.extensions, loc);
0f113f3e 43}
d02b48c6 44
6b691a5c 45X509_EXTENSION *X509_CRL_delete_ext(X509_CRL *x, int loc)
0f113f3e 46{
26a7d938 47 return X509v3_delete_ext(x->crl.extensions, loc);
0f113f3e 48}
d02b48c6 49
84de54b9 50void *X509_CRL_get_ext_d2i(const X509_CRL *x, int nid, int *crit, int *idx)
ff8a4c47 51{
7aef39a7 52 return X509V3_get_d2i(x->crl.extensions, nid, crit, idx);
ff8a4c47
DSH
53}
54
57d2f217 55int X509_CRL_add1_ext_i2d(X509_CRL *x, int nid, void *value, int crit,
0f113f3e 56 unsigned long flags)
57d2f217 57{
7aef39a7 58 return X509V3_add1_i2d(&x->crl.extensions, nid, value, crit, flags);
57d2f217
DSH
59}
60
6b691a5c 61int X509_CRL_add_ext(X509_CRL *x, X509_EXTENSION *ex, int loc)
0f113f3e 62{
7aef39a7 63 return (X509v3_add_ext(&(x->crl.extensions), ex, loc) != NULL);
0f113f3e 64}
d02b48c6 65
7569362e 66int X509_get_ext_count(const X509 *x)
0f113f3e 67{
26a7d938 68 return X509v3_get_ext_count(x->cert_info.extensions);
0f113f3e 69}
d02b48c6 70
7569362e 71int X509_get_ext_by_NID(const X509 *x, int nid, int lastpos)
0f113f3e 72{
26a7d938 73 return X509v3_get_ext_by_NID(x->cert_info.extensions, nid, lastpos);
0f113f3e 74}
d02b48c6 75
c47ba4e9 76int X509_get_ext_by_OBJ(const X509 *x, const ASN1_OBJECT *obj, int lastpos)
0f113f3e 77{
26a7d938 78 return X509v3_get_ext_by_OBJ(x->cert_info.extensions, obj, lastpos);
0f113f3e 79}
d02b48c6 80
7569362e 81int X509_get_ext_by_critical(const X509 *x, int crit, int lastpos)
0f113f3e
MC
82{
83 return (X509v3_get_ext_by_critical
5cf6abd8 84 (x->cert_info.extensions, crit, lastpos));
0f113f3e 85}
d02b48c6 86
c7d13c13 87X509_EXTENSION *X509_get_ext(const X509 *x, int loc)
0f113f3e 88{
26a7d938 89 return X509v3_get_ext(x->cert_info.extensions, loc);
0f113f3e 90}
d02b48c6 91
6b691a5c 92X509_EXTENSION *X509_delete_ext(X509 *x, int loc)
0f113f3e 93{
26a7d938 94 return X509v3_delete_ext(x->cert_info.extensions, loc);
0f113f3e 95}
d02b48c6 96
6b691a5c 97int X509_add_ext(X509 *x, X509_EXTENSION *ex, int loc)
0f113f3e 98{
5cf6abd8 99 return (X509v3_add_ext(&(x->cert_info.extensions), ex, loc) != NULL);
0f113f3e 100}
d02b48c6 101
84de54b9 102void *X509_get_ext_d2i(const X509 *x, int nid, int *crit, int *idx)
ff8a4c47 103{
5cf6abd8 104 return X509V3_get_d2i(x->cert_info.extensions, nid, crit, idx);
ff8a4c47
DSH
105}
106
57d2f217 107int X509_add1_ext_i2d(X509 *x, int nid, void *value, int crit,
0f113f3e 108 unsigned long flags)
57d2f217 109{
5cf6abd8 110 return X509V3_add1_i2d(&x->cert_info.extensions, nid, value, crit,
0f113f3e 111 flags);
57d2f217
DSH
112}
113
7569362e 114int X509_REVOKED_get_ext_count(const X509_REVOKED *x)
0f113f3e 115{
26a7d938 116 return X509v3_get_ext_count(x->extensions);
0f113f3e 117}
d02b48c6 118
7569362e 119int X509_REVOKED_get_ext_by_NID(const X509_REVOKED *x, int nid, int lastpos)
0f113f3e 120{
26a7d938 121 return X509v3_get_ext_by_NID(x->extensions, nid, lastpos);
0f113f3e 122}
d02b48c6 123
c47ba4e9 124int X509_REVOKED_get_ext_by_OBJ(const X509_REVOKED *x, const ASN1_OBJECT *obj,
0f113f3e
MC
125 int lastpos)
126{
26a7d938 127 return X509v3_get_ext_by_OBJ(x->extensions, obj, lastpos);
0f113f3e 128}
d02b48c6 129
7569362e 130int X509_REVOKED_get_ext_by_critical(const X509_REVOKED *x, int crit, int lastpos)
0f113f3e 131{
26a7d938 132 return X509v3_get_ext_by_critical(x->extensions, crit, lastpos);
0f113f3e 133}
d02b48c6 134
c7d13c13 135X509_EXTENSION *X509_REVOKED_get_ext(const X509_REVOKED *x, int loc)
0f113f3e 136{
26a7d938 137 return X509v3_get_ext(x->extensions, loc);
0f113f3e 138}
d02b48c6 139
6b691a5c 140X509_EXTENSION *X509_REVOKED_delete_ext(X509_REVOKED *x, int loc)
0f113f3e 141{
26a7d938 142 return X509v3_delete_ext(x->extensions, loc);
0f113f3e 143}
d02b48c6 144
6b691a5c 145int X509_REVOKED_add_ext(X509_REVOKED *x, X509_EXTENSION *ex, int loc)
0f113f3e
MC
146{
147 return (X509v3_add_ext(&(x->extensions), ex, loc) != NULL);
148}
d02b48c6 149
84de54b9 150void *X509_REVOKED_get_ext_d2i(const X509_REVOKED *x, int nid, int *crit, int *idx)
ff8a4c47 151{
0f113f3e 152 return X509V3_get_d2i(x->extensions, nid, crit, idx);
ff8a4c47
DSH
153}
154
57d2f217 155int X509_REVOKED_add1_ext_i2d(X509_REVOKED *x, int nid, void *value, int crit,
0f113f3e 156 unsigned long flags)
57d2f217 157{
0f113f3e 158 return X509V3_add1_i2d(&x->extensions, nid, value, crit, flags);
57d2f217 159}