Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/openssl/src/crypto/cms/cms_att.c |
Source code | Switch to Preprocessed file |
Line | Source | Count | ||||||
---|---|---|---|---|---|---|---|---|
1 | /* | - | ||||||
2 | * Copyright 2008-2016 The OpenSSL Project Authors. All Rights Reserved. | - | ||||||
3 | * | - | ||||||
4 | * Licensed under the OpenSSL license (the "License"). You may not use | - | ||||||
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 | - | ||||||
8 | */ | - | ||||||
9 | - | |||||||
10 | #include <openssl/asn1t.h> | - | ||||||
11 | #include <openssl/pem.h> | - | ||||||
12 | #include <openssl/x509v3.h> | - | ||||||
13 | #include <openssl/err.h> | - | ||||||
14 | #include <openssl/cms.h> | - | ||||||
15 | #include "cms_lcl.h" | - | ||||||
16 | - | |||||||
17 | /* CMS SignedData Attribute utilities */ | - | ||||||
18 | - | |||||||
19 | int CMS_signed_get_attr_count(const CMS_SignerInfo *si) | - | ||||||
20 | { | - | ||||||
21 | return X509at_get_attr_count(si->signedAttrs); executed 187 times by 1 test: return X509at_get_attr_count(si->signedAttrs); Executed by:
| 187 | ||||||
22 | } | - | ||||||
23 | - | |||||||
24 | int CMS_signed_get_attr_by_NID(const CMS_SignerInfo *si, int nid, int lastpos) | - | ||||||
25 | { | - | ||||||
26 | return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos); executed 52 times by 1 test: return X509at_get_attr_by_NID(si->signedAttrs, nid, lastpos); Executed by:
| 52 | ||||||
27 | } | - | ||||||
28 | - | |||||||
29 | int CMS_signed_get_attr_by_OBJ(const CMS_SignerInfo *si, const ASN1_OBJECT *obj, | - | ||||||
30 | int lastpos) | - | ||||||
31 | { | - | ||||||
32 | return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos); never executed: return X509at_get_attr_by_OBJ(si->signedAttrs, obj, lastpos); | 0 | ||||||
33 | } | - | ||||||
34 | - | |||||||
35 | X509_ATTRIBUTE *CMS_signed_get_attr(const CMS_SignerInfo *si, int loc) | - | ||||||
36 | { | - | ||||||
37 | return X509at_get_attr(si->signedAttrs, loc); never executed: return X509at_get_attr(si->signedAttrs, loc); | 0 | ||||||
38 | } | - | ||||||
39 | - | |||||||
40 | X509_ATTRIBUTE *CMS_signed_delete_attr(CMS_SignerInfo *si, int loc) | - | ||||||
41 | { | - | ||||||
42 | return X509at_delete_attr(si->signedAttrs, loc); never executed: return X509at_delete_attr(si->signedAttrs, loc); | 0 | ||||||
43 | } | - | ||||||
44 | - | |||||||
45 | int CMS_signed_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) | - | ||||||
46 | { | - | ||||||
47 | if (X509at_add1_attr(&si->signedAttrs, attr))
| 0 | ||||||
48 | return 1; never executed: return 1; | 0 | ||||||
49 | return 0; never executed: return 0; | 0 | ||||||
50 | } | - | ||||||
51 | - | |||||||
52 | int CMS_signed_add1_attr_by_OBJ(CMS_SignerInfo *si, | - | ||||||
53 | const ASN1_OBJECT *obj, int type, | - | ||||||
54 | const void *bytes, int len) | - | ||||||
55 | { | - | ||||||
56 | if (X509at_add1_attr_by_OBJ(&si->signedAttrs, obj, type, bytes, len))
| 0 | ||||||
57 | return 1; never executed: return 1; | 0 | ||||||
58 | return 0; never executed: return 0; | 0 | ||||||
59 | } | - | ||||||
60 | - | |||||||
61 | int CMS_signed_add1_attr_by_NID(CMS_SignerInfo *si, | - | ||||||
62 | int nid, int type, const void *bytes, int len) | - | ||||||
63 | { | - | ||||||
64 | if (X509at_add1_attr_by_NID(&si->signedAttrs, nid, type, bytes, len))
| 0-208 | ||||||
65 | return 1; executed 208 times by 1 test: return 1; Executed by:
| 208 | ||||||
66 | return 0; never executed: return 0; | 0 | ||||||
67 | } | - | ||||||
68 | - | |||||||
69 | int CMS_signed_add1_attr_by_txt(CMS_SignerInfo *si, | - | ||||||
70 | const char *attrname, int type, | - | ||||||
71 | const void *bytes, int len) | - | ||||||
72 | { | - | ||||||
73 | if (X509at_add1_attr_by_txt(&si->signedAttrs, attrname, type, bytes, len))
| 0 | ||||||
74 | return 1; never executed: return 1; | 0 | ||||||
75 | return 0; never executed: return 0; | 0 | ||||||
76 | } | - | ||||||
77 | - | |||||||
78 | void *CMS_signed_get0_data_by_OBJ(CMS_SignerInfo *si, const ASN1_OBJECT *oid, | - | ||||||
79 | int lastpos, int type) | - | ||||||
80 | { | - | ||||||
81 | return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type); executed 61 times by 1 test: return X509at_get0_data_by_OBJ(si->signedAttrs, oid, lastpos, type); Executed by:
| 61 | ||||||
82 | } | - | ||||||
83 | - | |||||||
84 | int CMS_unsigned_get_attr_count(const CMS_SignerInfo *si) | - | ||||||
85 | { | - | ||||||
86 | return X509at_get_attr_count(si->unsignedAttrs); never executed: return X509at_get_attr_count(si->unsignedAttrs); | 0 | ||||||
87 | } | - | ||||||
88 | - | |||||||
89 | int CMS_unsigned_get_attr_by_NID(const CMS_SignerInfo *si, int nid, | - | ||||||
90 | int lastpos) | - | ||||||
91 | { | - | ||||||
92 | return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos); never executed: return X509at_get_attr_by_NID(si->unsignedAttrs, nid, lastpos); | 0 | ||||||
93 | } | - | ||||||
94 | - | |||||||
95 | int CMS_unsigned_get_attr_by_OBJ(const CMS_SignerInfo *si, | - | ||||||
96 | const ASN1_OBJECT *obj, int lastpos) | - | ||||||
97 | { | - | ||||||
98 | return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos); never executed: return X509at_get_attr_by_OBJ(si->unsignedAttrs, obj, lastpos); | 0 | ||||||
99 | } | - | ||||||
100 | - | |||||||
101 | X509_ATTRIBUTE *CMS_unsigned_get_attr(const CMS_SignerInfo *si, int loc) | - | ||||||
102 | { | - | ||||||
103 | return X509at_get_attr(si->unsignedAttrs, loc); never executed: return X509at_get_attr(si->unsignedAttrs, loc); | 0 | ||||||
104 | } | - | ||||||
105 | - | |||||||
106 | X509_ATTRIBUTE *CMS_unsigned_delete_attr(CMS_SignerInfo *si, int loc) | - | ||||||
107 | { | - | ||||||
108 | return X509at_delete_attr(si->unsignedAttrs, loc); never executed: return X509at_delete_attr(si->unsignedAttrs, loc); | 0 | ||||||
109 | } | - | ||||||
110 | - | |||||||
111 | int CMS_unsigned_add1_attr(CMS_SignerInfo *si, X509_ATTRIBUTE *attr) | - | ||||||
112 | { | - | ||||||
113 | if (X509at_add1_attr(&si->unsignedAttrs, attr))
| 0 | ||||||
114 | return 1; never executed: return 1; | 0 | ||||||
115 | return 0; never executed: return 0; | 0 | ||||||
116 | } | - | ||||||
117 | - | |||||||
118 | int CMS_unsigned_add1_attr_by_OBJ(CMS_SignerInfo *si, | - | ||||||
119 | const ASN1_OBJECT *obj, int type, | - | ||||||
120 | const void *bytes, int len) | - | ||||||
121 | { | - | ||||||
122 | if (X509at_add1_attr_by_OBJ(&si->unsignedAttrs, obj, type, bytes, len))
| 0 | ||||||
123 | return 1; never executed: return 1; | 0 | ||||||
124 | return 0; never executed: return 0; | 0 | ||||||
125 | } | - | ||||||
126 | - | |||||||
127 | int CMS_unsigned_add1_attr_by_NID(CMS_SignerInfo *si, | - | ||||||
128 | int nid, int type, | - | ||||||
129 | const void *bytes, int len) | - | ||||||
130 | { | - | ||||||
131 | if (X509at_add1_attr_by_NID(&si->unsignedAttrs, nid, type, bytes, len))
| 0 | ||||||
132 | return 1; never executed: return 1; | 0 | ||||||
133 | return 0; never executed: return 0; | 0 | ||||||
134 | } | - | ||||||
135 | - | |||||||
136 | int CMS_unsigned_add1_attr_by_txt(CMS_SignerInfo *si, | - | ||||||
137 | const char *attrname, int type, | - | ||||||
138 | const void *bytes, int len) | - | ||||||
139 | { | - | ||||||
140 | if (X509at_add1_attr_by_txt(&si->unsignedAttrs, attrname,
| 0 | ||||||
141 | type, bytes, len))
| 0 | ||||||
142 | return 1; never executed: return 1; | 0 | ||||||
143 | return 0; never executed: return 0; | 0 | ||||||
144 | } | - | ||||||
145 | - | |||||||
146 | void *CMS_unsigned_get0_data_by_OBJ(CMS_SignerInfo *si, ASN1_OBJECT *oid, | - | ||||||
147 | int lastpos, int type) | - | ||||||
148 | { | - | ||||||
149 | return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type); never executed: return X509at_get0_data_by_OBJ(si->unsignedAttrs, oid, lastpos, type); | 0 | ||||||
150 | } | - | ||||||
151 | - | |||||||
152 | /* Specific attribute cases */ | - | ||||||
Source code | Switch to Preprocessed file |