Lines Matching refs:cert
25 int x509_get_sig_params(struct x509_certificate *cert) in x509_get_sig_params() argument
27 struct public_key_signature *sig = cert->sig; in x509_get_sig_params()
35 sig->s = kmemdup(cert->raw_sig, cert->raw_sig_size, GFP_KERNEL); in x509_get_sig_params()
39 sig->s_size = cert->raw_sig_size; in x509_get_sig_params()
47 cert->unsupported_sig = true; in x509_get_sig_params()
67 if (strcmp(cert->pub->pkey_algo, "sm2") == 0) { in x509_get_sig_params()
70 sm2_compute_z_digest(desc, cert->pub->key, in x509_get_sig_params()
71 cert->pub->keylen, sig->digest) ?: in x509_get_sig_params()
75 crypto_shash_finup(desc, cert->tbs, cert->tbs_size, in x509_get_sig_params()
78 ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, in x509_get_sig_params()
90 cert->blacklisted = true; in x509_get_sig_params()
106 int x509_check_for_self_signed(struct x509_certificate *cert) in x509_check_for_self_signed() argument
112 if (cert->raw_subject_size != cert->raw_issuer_size || in x509_check_for_self_signed()
113 memcmp(cert->raw_subject, cert->raw_issuer, in x509_check_for_self_signed()
114 cert->raw_issuer_size) != 0) in x509_check_for_self_signed()
117 if (cert->sig->auth_ids[0] || cert->sig->auth_ids[1]) { in x509_check_for_self_signed()
121 bool a = asymmetric_key_id_same(cert->skid, cert->sig->auth_ids[1]); in x509_check_for_self_signed()
122 bool b = asymmetric_key_id_same(cert->id, cert->sig->auth_ids[0]); in x509_check_for_self_signed()
129 cert->sig->auth_ids[0] && cert->sig->auth_ids[1]) in x509_check_for_self_signed()
133 if (cert->unsupported_sig) { in x509_check_for_self_signed()
138 ret = public_key_verify_signature(cert->pub, cert->sig); in x509_check_for_self_signed()
141 cert->unsupported_sig = true; in x509_check_for_self_signed()
148 cert->self_signed = true; in x509_check_for_self_signed()
165 struct x509_certificate *cert; in x509_key_preparse() local
171 cert = x509_cert_parse(prep->data, prep->datalen); in x509_key_preparse()
172 if (IS_ERR(cert)) in x509_key_preparse()
173 return PTR_ERR(cert); in x509_key_preparse()
175 pr_devel("Cert Issuer: %s\n", cert->issuer); in x509_key_preparse()
176 pr_devel("Cert Subject: %s\n", cert->subject); in x509_key_preparse()
177 pr_devel("Cert Key Algo: %s\n", cert->pub->pkey_algo); in x509_key_preparse()
178 pr_devel("Cert Valid period: %lld-%lld\n", cert->valid_from, cert->valid_to); in x509_key_preparse()
180 cert->pub->id_type = "X509"; in x509_key_preparse()
182 if (cert->unsupported_sig) { in x509_key_preparse()
183 public_key_signature_free(cert->sig); in x509_key_preparse()
184 cert->sig = NULL; in x509_key_preparse()
187 cert->sig->pkey_algo, cert->sig->hash_algo); in x509_key_preparse()
192 if (cert->blacklisted) in x509_key_preparse()
196 sulen = strlen(cert->subject); in x509_key_preparse()
197 if (cert->raw_skid) { in x509_key_preparse()
198 srlen = cert->raw_skid_size; in x509_key_preparse()
199 q = cert->raw_skid; in x509_key_preparse()
201 srlen = cert->raw_serial_size; in x509_key_preparse()
202 q = cert->raw_serial; in x509_key_preparse()
209 p = memcpy(desc, cert->subject, sulen); in x509_key_preparse()
219 kids->id[0] = cert->id; in x509_key_preparse()
220 kids->id[1] = cert->skid; in x509_key_preparse()
221 kids->id[2] = asymmetric_key_generate_id(cert->raw_subject, in x509_key_preparse()
222 cert->raw_subject_size, in x509_key_preparse()
233 prep->payload.data[asym_crypto] = cert->pub; in x509_key_preparse()
234 prep->payload.data[asym_auth] = cert->sig; in x509_key_preparse()
239 cert->pub = NULL; in x509_key_preparse()
240 cert->id = NULL; in x509_key_preparse()
241 cert->skid = NULL; in x509_key_preparse()
242 cert->sig = NULL; in x509_key_preparse()
252 x509_free_certificate(cert); in x509_key_preparse()