|
@@ -52,6 +52,27 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
52
|
52
|
__einfo_error ( EINFO_EACCES_WRONG_NAME )
|
53
|
53
|
#define EINFO_EACCES_WRONG_NAME \
|
54
|
54
|
__einfo_uniqify ( EINFO_EACCES, 0x04, "Incorrect certificate name" )
|
|
55
|
+#define EINVAL_DIGEST \
|
|
56
|
+ __einfo_error ( EINFO_EINVAL_DIGEST )
|
|
57
|
+#define EINFO_EINVAL_DIGEST \
|
|
58
|
+ __einfo_uniqify ( EINFO_EINVAL, 0x01, "Not a digest algorithm" )
|
|
59
|
+#define EINVAL_PUBKEY \
|
|
60
|
+ __einfo_error ( EINFO_EINVAL_PUBKEY )
|
|
61
|
+#define EINFO_EINVAL_PUBKEY \
|
|
62
|
+ __einfo_uniqify ( EINFO_EINVAL, 0x02, "Not a public-key algorithm" )
|
|
63
|
+#define ENOTSUP_SIGNEDDATA \
|
|
64
|
+ __einfo_error ( EINFO_ENOTSUP_SIGNEDDATA )
|
|
65
|
+#define EINFO_ENOTSUP_SIGNEDDATA \
|
|
66
|
+ __einfo_uniqify ( EINFO_ENOTSUP, 0x01, "Not a digital signature" )
|
|
67
|
+#define ENOTSUP_DIGEST \
|
|
68
|
+ __einfo_error ( EINFO_ENOTSUP_DIGEST )
|
|
69
|
+#define EINFO_ENOTSUP_DIGEST \
|
|
70
|
+ __einfo_uniqify ( EINFO_ENOTSUP, 0x02, "Unsupported digest algorithm" )
|
|
71
|
+#define ENOTSUP_PUBKEY \
|
|
72
|
+ __einfo_error ( EINFO_ENOTSUP_PUBKEY )
|
|
73
|
+#define EINFO_ENOTSUP_PUBKEY \
|
|
74
|
+ __einfo_uniqify ( EINFO_ENOTSUP, 0x03, \
|
|
75
|
+ "Unsupported public-key algorithm" )
|
55
|
76
|
|
56
|
77
|
/** "pkcs7-signedData" object identifier */
|
57
|
78
|
static uint8_t oid_signeddata[] = { ASN1_OID_SIGNEDDATA };
|
|
@@ -79,7 +100,7 @@ static int cms_parse_content_type ( struct cms_signature *sig,
|
79
|
100
|
if ( asn1_compare ( &cursor, &oid_signeddata_cursor ) != 0 ) {
|
80
|
101
|
DBGC ( sig, "CMS %p does not contain signedData:\n", sig );
|
81
|
102
|
DBGC_HDA ( sig, 0, raw->data, raw->len );
|
82
|
|
- return -ENOTSUP;
|
|
103
|
+ return -ENOTSUP_SIGNEDDATA;
|
83
|
104
|
}
|
84
|
105
|
|
85
|
106
|
DBGC ( sig, "CMS %p contains signedData\n", sig );
|
|
@@ -149,14 +170,14 @@ static int cms_parse_digest_algorithm ( struct cms_signature *sig,
|
149
|
170
|
DBGC ( sig, "CMS %p/%p could not identify digest algorithm:\n",
|
150
|
171
|
sig, info );
|
151
|
172
|
DBGC_HDA ( sig, 0, raw->data, raw->len );
|
152
|
|
- return -ENOTSUP;
|
|
173
|
+ return -ENOTSUP_DIGEST;
|
153
|
174
|
}
|
154
|
175
|
|
155
|
176
|
/* Check algorithm is a digest algorithm */
|
156
|
177
|
if ( ! algorithm->digest ) {
|
157
|
178
|
DBGC ( sig, "CMS %p/%p algorithm %s is not a digest "
|
158
|
179
|
"algorithm\n", sig, info, algorithm->name );
|
159
|
|
- return -EINVAL;
|
|
180
|
+ return -EINVAL_DIGEST;
|
160
|
181
|
}
|
161
|
182
|
|
162
|
183
|
/* Record digest algorithm */
|
|
@@ -186,14 +207,14 @@ static int cms_parse_signature_algorithm ( struct cms_signature *sig,
|
186
|
207
|
DBGC ( sig, "CMS %p/%p could not identify public-key "
|
187
|
208
|
"algorithm:\n", sig, info );
|
188
|
209
|
DBGC_HDA ( sig, 0, raw->data, raw->len );
|
189
|
|
- return -ENOTSUP;
|
|
210
|
+ return -ENOTSUP_PUBKEY;
|
190
|
211
|
}
|
191
|
212
|
|
192
|
213
|
/* Check algorithm is a signature algorithm */
|
193
|
214
|
if ( ! algorithm->pubkey ) {
|
194
|
215
|
DBGC ( sig, "CMS %p/%p algorithm %s is not a public-key "
|
195
|
216
|
"algorithm\n", sig, info, algorithm->name );
|
196
|
|
- return -EINVAL;
|
|
217
|
+ return -EINVAL_PUBKEY;
|
197
|
218
|
}
|
198
|
219
|
|
199
|
220
|
/* Record signature algorithm */
|