Lines Matching refs:cert
23 int x509_get_sig_params(struct x509_certificate *cert) in x509_get_sig_params() argument
25 struct public_key_signature *sig = cert->sig; in x509_get_sig_params()
33 sig->data = cert->tbs; in x509_get_sig_params()
34 sig->data_size = cert->tbs_size; in x509_get_sig_params()
36 if (!cert->pub->pkey_algo) in x509_get_sig_params()
37 cert->unsupported_key = true; in x509_get_sig_params()
40 cert->unsupported_sig = true; in x509_get_sig_params()
44 cert->unsupported_sig = true; in x509_get_sig_params()
48 sig->s = kmemdup(cert->raw_sig, cert->raw_sig_size, GFP_KERNEL); in x509_get_sig_params()
52 sig->s_size = cert->raw_sig_size; in x509_get_sig_params()
60 cert->unsupported_sig = true; in x509_get_sig_params()
80 ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, sig->digest); in x509_get_sig_params()
88 cert->blacklisted = true; in x509_get_sig_params()
104 int x509_check_for_self_signed(struct x509_certificate *cert) in x509_check_for_self_signed() argument
110 if (cert->raw_subject_size != cert->raw_issuer_size || in x509_check_for_self_signed()
111 memcmp(cert->raw_subject, cert->raw_issuer, in x509_check_for_self_signed()
112 cert->raw_issuer_size) != 0) in x509_check_for_self_signed()
115 if (cert->sig->auth_ids[0] || cert->sig->auth_ids[1]) { in x509_check_for_self_signed()
119 bool a = asymmetric_key_id_same(cert->skid, cert->sig->auth_ids[1]); in x509_check_for_self_signed()
120 bool b = asymmetric_key_id_same(cert->id, cert->sig->auth_ids[0]); in x509_check_for_self_signed()
127 cert->sig->auth_ids[0] && cert->sig->auth_ids[1]) in x509_check_for_self_signed()
132 if (strcmp(cert->pub->pkey_algo, cert->sig->pkey_algo) != 0) in x509_check_for_self_signed()
135 ret = public_key_verify_signature(cert->pub, cert->sig); in x509_check_for_self_signed()
138 cert->unsupported_sig = true; in x509_check_for_self_signed()
145 cert->self_signed = true; in x509_check_for_self_signed()
162 struct x509_certificate *cert; in x509_key_preparse() local
168 cert = x509_cert_parse(prep->data, prep->datalen); in x509_key_preparse()
169 if (IS_ERR(cert)) in x509_key_preparse()
170 return PTR_ERR(cert); in x509_key_preparse()
172 pr_devel("Cert Issuer: %s\n", cert->issuer); in x509_key_preparse()
173 pr_devel("Cert Subject: %s\n", cert->subject); in x509_key_preparse()
175 if (cert->unsupported_key) { in x509_key_preparse()
180 pr_devel("Cert Key Algo: %s\n", cert->pub->pkey_algo); in x509_key_preparse()
181 pr_devel("Cert Valid period: %lld-%lld\n", cert->valid_from, cert->valid_to); in x509_key_preparse()
183 cert->pub->id_type = "X509"; in x509_key_preparse()
185 if (cert->unsupported_sig) { in x509_key_preparse()
186 public_key_signature_free(cert->sig); in x509_key_preparse()
187 cert->sig = NULL; in x509_key_preparse()
190 cert->sig->pkey_algo, cert->sig->hash_algo); in x509_key_preparse()
195 if (cert->blacklisted) in x509_key_preparse()
199 sulen = strlen(cert->subject); in x509_key_preparse()
200 if (cert->raw_skid) { in x509_key_preparse()
201 srlen = cert->raw_skid_size; in x509_key_preparse()
202 q = cert->raw_skid; in x509_key_preparse()
204 srlen = cert->raw_serial_size; in x509_key_preparse()
205 q = cert->raw_serial; in x509_key_preparse()
212 p = memcpy(desc, cert->subject, sulen); in x509_key_preparse()
222 kids->id[0] = cert->id; in x509_key_preparse()
223 kids->id[1] = cert->skid; in x509_key_preparse()
229 prep->payload.data[asym_crypto] = cert->pub; in x509_key_preparse()
230 prep->payload.data[asym_auth] = cert->sig; in x509_key_preparse()
235 cert->pub = NULL; in x509_key_preparse()
236 cert->id = NULL; in x509_key_preparse()
237 cert->skid = NULL; in x509_key_preparse()
238 cert->sig = NULL; in x509_key_preparse()
245 x509_free_certificate(cert); in x509_key_preparse()