Lines Matching refs:cert

23 int x509_get_sig_params(struct x509_certificate *cert)
25 struct public_key_signature *sig = cert->sig;
33 sig->data = cert->tbs;
34 sig->data_size = cert->tbs_size;
36 if (!cert->pub->pkey_algo)
37 cert->unsupported_key = true;
40 cert->unsupported_sig = true;
44 cert->unsupported_sig = true;
48 sig->s = kmemdup(cert->raw_sig, cert->raw_sig_size, GFP_KERNEL);
52 sig->s_size = cert->raw_sig_size;
60 cert->unsupported_sig = true;
80 ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest);
88 cert->blacklisted = true;
101 * Check for self-signedness in an X.509 cert and if found, check the signature
104 int x509_check_for_self_signed(struct x509_certificate *cert)
110 if (cert->raw_subject_size != cert->raw_issuer_size ||
111 memcmp(cert->raw_subject, cert->raw_issuer,
112 cert->raw_issuer_size) != 0)
115 if (cert->sig->auth_ids[0] || cert->sig->auth_ids[1]) {
119 bool a = asymmetric_key_id_same(cert->skid, cert->sig->auth_ids[1]);
120 bool b = asymmetric_key_id_same(cert->id, cert->sig->auth_ids[0]);
127 cert->sig->auth_ids[0] && cert->sig->auth_ids[1])
131 if (cert->unsupported_sig) {
136 ret = public_key_verify_signature(cert->pub, cert->sig);
139 cert->unsupported_sig = true;
146 cert->self_signed = true;
163 struct x509_certificate *cert;
169 cert = x509_cert_parse(prep->data, prep->datalen);
170 if (IS_ERR(cert))
171 return PTR_ERR(cert);
173 pr_devel("Cert Issuer: %s\n", cert->issuer);
174 pr_devel("Cert Subject: %s\n", cert->subject);
176 if (cert->unsupported_key) {
181 pr_devel("Cert Key Algo: %s\n", cert->pub->pkey_algo);
182 pr_devel("Cert Valid period: %lld-%lld\n", cert->valid_from, cert->valid_to);
184 cert->pub->id_type = "X509";
186 if (cert->unsupported_sig) {
187 public_key_signature_free(cert->sig);
188 cert->sig = NULL;
191 cert->sig->pkey_algo, cert->sig->hash_algo);
196 if (cert->blacklisted)
200 sulen = strlen(cert->subject);
201 if (cert->raw_skid) {
202 srlen = cert->raw_skid_size;
203 q = cert->raw_skid;
205 srlen = cert->raw_serial_size;
206 q = cert->raw_serial;
213 p = memcpy(desc, cert->subject, sulen);
223 kids->id[0] = cert->id;
224 kids->id[1] = cert->skid;
230 prep->payload.data[asym_crypto] = cert->pub;
231 prep->payload.data[asym_auth] = cert->sig;
236 cert->pub = NULL;
237 cert->id = NULL;
238 cert->skid = NULL;
239 cert->sig = NULL;
246 x509_free_certificate(cert);