GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: lib/libcrypto/x509v3/v3_pcia.c Lines: 0 8 0.0 %
Date: 2017-11-13 Branches: 0 0 0.0 %

Line Branch Exec Source
1
/* $OpenBSD: v3_pcia.c,v 1.6 2015/07/25 16:00:14 jsing Exp $ */
2
/* Contributed to the OpenSSL Project 2004
3
 * by Richard Levitte (richard@levitte.org)
4
 */
5
/* Copyright (c) 2004 Kungliga Tekniska Högskolan
6
 * (Royal Institute of Technology, Stockholm, Sweden).
7
 * All rights reserved.
8
 *
9
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions
11
 * are met:
12
 *
13
 * 1. Redistributions of source code must retain the above copyright
14
 *    notice, this list of conditions and the following disclaimer.
15
 *
16
 * 2. Redistributions in binary form must reproduce the above copyright
17
 *    notice, this list of conditions and the following disclaimer in the
18
 *    documentation and/or other materials provided with the distribution.
19
 *
20
 * 3. Neither the name of the Institute nor the names of its contributors
21
 *    may be used to endorse or promote products derived from this software
22
 *    without specific prior written permission.
23
 *
24
 * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
25
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
28
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34
 * SUCH DAMAGE.
35
 */
36
37
#include <openssl/asn1.h>
38
#include <openssl/asn1t.h>
39
#include <openssl/x509v3.h>
40
41
static const ASN1_TEMPLATE PROXY_POLICY_seq_tt[] = {
42
	{
43
		.flags = 0,
44
		.tag = 0,
45
		.offset = offsetof(PROXY_POLICY, policyLanguage),
46
		.field_name = "policyLanguage",
47
		.item = &ASN1_OBJECT_it,
48
	},
49
	{
50
		.flags = ASN1_TFLG_OPTIONAL,
51
		.tag = 0,
52
		.offset = offsetof(PROXY_POLICY, policy),
53
		.field_name = "policy",
54
		.item = &ASN1_OCTET_STRING_it,
55
	},
56
};
57
58
const ASN1_ITEM PROXY_POLICY_it = {
59
	.itype = ASN1_ITYPE_SEQUENCE,
60
	.utype = V_ASN1_SEQUENCE,
61
	.templates = PROXY_POLICY_seq_tt,
62
	.tcount = sizeof(PROXY_POLICY_seq_tt) / sizeof(ASN1_TEMPLATE),
63
	.funcs = NULL,
64
	.size = sizeof(PROXY_POLICY),
65
	.sname = "PROXY_POLICY",
66
};
67
68
69
PROXY_POLICY *
70
d2i_PROXY_POLICY(PROXY_POLICY **a, const unsigned char **in, long len)
71
{
72
	return (PROXY_POLICY *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
73
	    &PROXY_POLICY_it);
74
}
75
76
int
77
i2d_PROXY_POLICY(PROXY_POLICY *a, unsigned char **out)
78
{
79
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &PROXY_POLICY_it);
80
}
81
82
PROXY_POLICY *
83
PROXY_POLICY_new(void)
84
{
85
	return (PROXY_POLICY *)ASN1_item_new(&PROXY_POLICY_it);
86
}
87
88
void
89
PROXY_POLICY_free(PROXY_POLICY *a)
90
{
91
	ASN1_item_free((ASN1_VALUE *)a, &PROXY_POLICY_it);
92
}
93
94
static const ASN1_TEMPLATE PROXY_CERT_INFO_EXTENSION_seq_tt[] = {
95
	{
96
		.flags = ASN1_TFLG_OPTIONAL,
97
		.tag = 0,
98
		.offset = offsetof(PROXY_CERT_INFO_EXTENSION, pcPathLengthConstraint),
99
		.field_name = "pcPathLengthConstraint",
100
		.item = &ASN1_INTEGER_it,
101
	},
102
	{
103
		.flags = 0,
104
		.tag = 0,
105
		.offset = offsetof(PROXY_CERT_INFO_EXTENSION, proxyPolicy),
106
		.field_name = "proxyPolicy",
107
		.item = &PROXY_POLICY_it,
108
	},
109
};
110
111
const ASN1_ITEM PROXY_CERT_INFO_EXTENSION_it = {
112
	.itype = ASN1_ITYPE_SEQUENCE,
113
	.utype = V_ASN1_SEQUENCE,
114
	.templates = PROXY_CERT_INFO_EXTENSION_seq_tt,
115
	.tcount = sizeof(PROXY_CERT_INFO_EXTENSION_seq_tt) / sizeof(ASN1_TEMPLATE),
116
	.funcs = NULL,
117
	.size = sizeof(PROXY_CERT_INFO_EXTENSION),
118
	.sname = "PROXY_CERT_INFO_EXTENSION",
119
};
120
121
122
PROXY_CERT_INFO_EXTENSION *
123
d2i_PROXY_CERT_INFO_EXTENSION(PROXY_CERT_INFO_EXTENSION **a, const unsigned char **in, long len)
124
{
125
	return (PROXY_CERT_INFO_EXTENSION *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
126
	    &PROXY_CERT_INFO_EXTENSION_it);
127
}
128
129
int
130
i2d_PROXY_CERT_INFO_EXTENSION(PROXY_CERT_INFO_EXTENSION *a, unsigned char **out)
131
{
132
	return ASN1_item_i2d((ASN1_VALUE *)a, out, &PROXY_CERT_INFO_EXTENSION_it);
133
}
134
135
PROXY_CERT_INFO_EXTENSION *
136
PROXY_CERT_INFO_EXTENSION_new(void)
137
{
138
	return (PROXY_CERT_INFO_EXTENSION *)ASN1_item_new(&PROXY_CERT_INFO_EXTENSION_it);
139
}
140
141
void
142
PROXY_CERT_INFO_EXTENSION_free(PROXY_CERT_INFO_EXTENSION *a)
143
{
144
	ASN1_item_free((ASN1_VALUE *)a, &PROXY_CERT_INFO_EXTENSION_it);
145
}