Lines Matching refs:cert
20 struct x509_certificate *cert; /* Certificate being constructed */ member
44 void x509_free_certificate(struct x509_certificate *cert) in x509_free_certificate() argument
46 if (cert) { in x509_free_certificate()
47 public_key_free(cert->pub); in x509_free_certificate()
48 public_key_signature_free(cert->sig); in x509_free_certificate()
49 kfree(cert->issuer); in x509_free_certificate()
50 kfree(cert->subject); in x509_free_certificate()
51 kfree(cert->id); in x509_free_certificate()
52 kfree(cert->skid); in x509_free_certificate()
53 kfree(cert); in x509_free_certificate()
63 struct x509_certificate *cert __free(x509_free_certificate); in x509_cert_parse()
68 cert = kzalloc(sizeof(struct x509_certificate), GFP_KERNEL); in x509_cert_parse()
69 if (!cert) in x509_cert_parse()
71 cert->pub = kzalloc(sizeof(struct public_key), GFP_KERNEL); in x509_cert_parse()
72 if (!cert->pub) in x509_cert_parse()
74 cert->sig = kzalloc(sizeof(struct public_key_signature), GFP_KERNEL); in x509_cert_parse()
75 if (!cert->sig) in x509_cert_parse()
81 ctx->cert = cert; in x509_cert_parse()
101 cert->pub->key = kmemdup(ctx->key, ctx->key_size, GFP_KERNEL); in x509_cert_parse()
102 if (!cert->pub->key) in x509_cert_parse()
105 cert->pub->keylen = ctx->key_size; in x509_cert_parse()
107 cert->pub->params = kmemdup(ctx->params, ctx->params_size, GFP_KERNEL); in x509_cert_parse()
108 if (!cert->pub->params) in x509_cert_parse()
111 cert->pub->paramlen = ctx->params_size; in x509_cert_parse()
112 cert->pub->algo = ctx->key_algo; in x509_cert_parse()
115 ret = x509_get_sig_params(cert); in x509_cert_parse()
120 kid = asymmetric_key_generate_id(cert->raw_serial, in x509_cert_parse()
121 cert->raw_serial_size, in x509_cert_parse()
122 cert->raw_issuer, in x509_cert_parse()
123 cert->raw_issuer_size); in x509_cert_parse()
126 cert->id = kid; in x509_cert_parse()
129 ret = x509_check_for_self_signed(cert); in x509_cert_parse()
133 return_ptr(cert); in x509_cert_parse()
170 ctx->cert->tbs = value - hdrlen; in x509_note_tbs_certificate()
171 ctx->cert->tbs_size = vlen + hdrlen; in x509_note_tbs_certificate()
190 ctx->cert->sig->hash_algo = "sha1"; in x509_note_sig_algo()
194 ctx->cert->sig->hash_algo = "sha256"; in x509_note_sig_algo()
198 ctx->cert->sig->hash_algo = "sha384"; in x509_note_sig_algo()
202 ctx->cert->sig->hash_algo = "sha512"; in x509_note_sig_algo()
206 ctx->cert->sig->hash_algo = "sha224"; in x509_note_sig_algo()
210 ctx->cert->sig->hash_algo = "sha1"; in x509_note_sig_algo()
214 ctx->cert->sig->hash_algo = "sha3-256"; in x509_note_sig_algo()
218 ctx->cert->sig->hash_algo = "sha3-384"; in x509_note_sig_algo()
222 ctx->cert->sig->hash_algo = "sha3-512"; in x509_note_sig_algo()
226 ctx->cert->sig->hash_algo = "sha224"; in x509_note_sig_algo()
230 ctx->cert->sig->hash_algo = "sha256"; in x509_note_sig_algo()
234 ctx->cert->sig->hash_algo = "sha384"; in x509_note_sig_algo()
238 ctx->cert->sig->hash_algo = "sha512"; in x509_note_sig_algo()
242 ctx->cert->sig->hash_algo = "sha3-256"; in x509_note_sig_algo()
246 ctx->cert->sig->hash_algo = "sha3-384"; in x509_note_sig_algo()
250 ctx->cert->sig->hash_algo = "sha3-512"; in x509_note_sig_algo()
254 ctx->cert->sig->hash_algo = "streebog256"; in x509_note_sig_algo()
258 ctx->cert->sig->hash_algo = "streebog512"; in x509_note_sig_algo()
263 ctx->cert->sig->pkey_algo = "rsa"; in x509_note_sig_algo()
264 ctx->cert->sig->encoding = "pkcs1"; in x509_note_sig_algo()
268 ctx->cert->sig->pkey_algo = "ecrdsa"; in x509_note_sig_algo()
269 ctx->cert->sig->encoding = "raw"; in x509_note_sig_algo()
273 ctx->cert->sig->pkey_algo = "ecdsa"; in x509_note_sig_algo()
274 ctx->cert->sig->encoding = "x962"; in x509_note_sig_algo()
301 if (strcmp(ctx->cert->sig->pkey_algo, "rsa") == 0 || in x509_note_signature()
302 strcmp(ctx->cert->sig->pkey_algo, "ecrdsa") == 0 || in x509_note_signature()
303 strcmp(ctx->cert->sig->pkey_algo, "ecdsa") == 0) { in x509_note_signature()
312 ctx->cert->raw_sig = value; in x509_note_signature()
313 ctx->cert->raw_sig_size = vlen; in x509_note_signature()
325 ctx->cert->raw_serial = value; in x509_note_serial()
326 ctx->cert->raw_serial_size = vlen; in x509_note_serial()
444 ctx->cert->raw_issuer = value; in x509_note_issuer()
445 ctx->cert->raw_issuer_size = vlen; in x509_note_issuer()
447 if (!ctx->cert->sig->auth_ids[2]) { in x509_note_issuer()
451 ctx->cert->sig->auth_ids[2] = kid; in x509_note_issuer()
454 return x509_fabricate_name(ctx, hdrlen, tag, &ctx->cert->issuer, vlen); in x509_note_issuer()
462 ctx->cert->raw_subject = value; in x509_note_subject()
463 ctx->cert->raw_subject_size = vlen; in x509_note_subject()
464 return x509_fabricate_name(ctx, hdrlen, tag, &ctx->cert->subject, vlen); in x509_note_subject()
481 if (!ctx->cert->raw_subject || ctx->key) in x509_note_params()
501 ctx->cert->pub->pkey_algo = "rsa"; in x509_extract_key_data()
505 ctx->cert->pub->pkey_algo = "ecrdsa"; in x509_extract_key_data()
513 ctx->cert->pub->pkey_algo = "ecdsa-nist-p192"; in x509_extract_key_data()
516 ctx->cert->pub->pkey_algo = "ecdsa-nist-p256"; in x509_extract_key_data()
519 ctx->cert->pub->pkey_algo = "ecdsa-nist-p384"; in x509_extract_key_data()
522 ctx->cert->pub->pkey_algo = "ecdsa-nist-p521"; in x509_extract_key_data()
558 if (ctx->cert->skid || vlen < 3) in x509_process_extension()
565 ctx->cert->raw_skid_size = vlen; in x509_process_extension()
566 ctx->cert->raw_skid = v; in x509_process_extension()
570 ctx->cert->skid = kid; in x509_process_extension()
595 ctx->cert->pub->key_eflags |= 1 << KEY_EFLAG_DIGITALSIG; in x509_process_extension()
597 ctx->cert->pub->key_eflags |= 1 << KEY_EFLAG_KEYCERTSIGN; in x509_process_extension()
599 ctx->cert->pub->key_eflags |= 1 << KEY_EFLAG_KEYCERTSIGN; in x509_process_extension()
628 ctx->cert->pub->key_eflags |= 1 << KEY_EFLAG_CA; in x509_process_extension()
735 return x509_decode_time(&ctx->cert->valid_from, hdrlen, tag, value, vlen); in x509_note_not_before()
743 return x509_decode_time(&ctx->cert->valid_to, hdrlen, tag, value, vlen); in x509_note_not_after()
758 if (ctx->cert->sig->auth_ids[1]) in x509_akid_note_kid()
765 ctx->cert->sig->auth_ids[1] = kid; in x509_akid_note_kid()
797 if (!ctx->akid_raw_issuer || ctx->cert->sig->auth_ids[0]) in x509_akid_note_serial()
808 ctx->cert->sig->auth_ids[0] = kid; in x509_akid_note_serial()