Lines Matching refs:cert

24 int x509_get_sig_params(struct x509_certificate *cert)  in x509_get_sig_params()  argument
26 struct public_key_signature *sig = cert->sig; in x509_get_sig_params()
34 sig->s = kmemdup(cert->raw_sig, cert->raw_sig_size, GFP_KERNEL); in x509_get_sig_params()
38 sig->s_size = cert->raw_sig_size; in x509_get_sig_params()
46 cert->unsupported_sig = true; in x509_get_sig_params()
66 ret = crypto_shash_digest(desc, cert->tbs, cert->tbs_size, in x509_get_sig_params()
77 cert->blacklisted = true; in x509_get_sig_params()
93 int x509_check_for_self_signed(struct x509_certificate *cert) in x509_check_for_self_signed() argument
99 if (cert->raw_subject_size != cert->raw_issuer_size || in x509_check_for_self_signed()
100 memcmp(cert->raw_subject, cert->raw_issuer, in x509_check_for_self_signed()
101 cert->raw_issuer_size) != 0) in x509_check_for_self_signed()
104 if (cert->sig->auth_ids[0] || cert->sig->auth_ids[1]) { in x509_check_for_self_signed()
108 bool a = asymmetric_key_id_same(cert->skid, cert->sig->auth_ids[1]); in x509_check_for_self_signed()
109 bool b = asymmetric_key_id_same(cert->id, cert->sig->auth_ids[0]); in x509_check_for_self_signed()
116 cert->sig->auth_ids[0] && cert->sig->auth_ids[1]) in x509_check_for_self_signed()
120 if (cert->unsupported_sig) { in x509_check_for_self_signed()
125 ret = public_key_verify_signature(cert->pub, cert->sig); in x509_check_for_self_signed()
128 cert->unsupported_sig = true; in x509_check_for_self_signed()
135 cert->self_signed = true; in x509_check_for_self_signed()
151 struct x509_certificate *cert __free(x509_free_certificate); in x509_key_preparse()
157 cert = x509_cert_parse(prep->data, prep->datalen); in x509_key_preparse()
158 if (IS_ERR(cert)) in x509_key_preparse()
159 return PTR_ERR(cert); in x509_key_preparse()
161 pr_devel("Cert Issuer: %s\n", cert->issuer); in x509_key_preparse()
162 pr_devel("Cert Subject: %s\n", cert->subject); in x509_key_preparse()
163 pr_devel("Cert Key Algo: %s\n", cert->pub->pkey_algo); in x509_key_preparse()
164 pr_devel("Cert Valid period: %lld-%lld\n", cert->valid_from, cert->valid_to); in x509_key_preparse()
166 cert->pub->id_type = "X509"; in x509_key_preparse()
168 if (cert->unsupported_sig) { in x509_key_preparse()
169 public_key_signature_free(cert->sig); in x509_key_preparse()
170 cert->sig = NULL; in x509_key_preparse()
173 cert->sig->pkey_algo, cert->sig->hash_algo); in x509_key_preparse()
177 if (cert->blacklisted) in x509_key_preparse()
181 sulen = strlen(cert->subject); in x509_key_preparse()
182 if (cert->raw_skid) { in x509_key_preparse()
183 srlen = cert->raw_skid_size; in x509_key_preparse()
184 q = cert->raw_skid; in x509_key_preparse()
186 srlen = cert->raw_serial_size; in x509_key_preparse()
187 q = cert->raw_serial; in x509_key_preparse()
193 p = memcpy(desc, cert->subject, sulen); in x509_key_preparse()
203 kids->id[0] = cert->id; in x509_key_preparse()
204 kids->id[1] = cert->skid; in x509_key_preparse()
205 kids->id[2] = asymmetric_key_generate_id(cert->raw_subject, in x509_key_preparse()
206 cert->raw_subject_size, in x509_key_preparse()
215 prep->payload.data[asym_crypto] = cert->pub; in x509_key_preparse()
216 prep->payload.data[asym_auth] = cert->sig; in x509_key_preparse()
221 cert->pub = NULL; in x509_key_preparse()
222 cert->id = NULL; in x509_key_preparse()
223 cert->skid = NULL; in x509_key_preparse()
224 cert->sig = NULL; in x509_key_preparse()