All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Zhuoying Cai <zycai@linux.ibm.com>
Cc: qemu-s390x@nongnu.org, qemu-devel@nongnu.org,
	jrossi@linux.ibm.com, cohuck@redhat.com,
	richard.henderson@linaro.org, pierrick.bouvier@linaro.org,
	david@kernel.org, walling@linux.ibm.com, jjherne@linux.ibm.com,
	pasic@linux.ibm.com, borntraeger@linux.ibm.com,
	farman@linux.ibm.com, mjrosato@linux.ibm.com, iii@linux.ibm.com,
	eblake@redhat.com, armbru@redhat.com, alifm@linux.ibm.com,
	brueckner@linux.ibm.com, jdaley@linux.ibm.com
Subject: Re: [PATCH v10 08/30] crypto/x509-utils: Add helper functions for DIAG 320 subcode 2
Date: Tue, 7 Apr 2026 17:06:58 +0100	[thread overview]
Message-ID: <adUrok15nPtpedu5@redhat.com> (raw)
In-Reply-To: <20260402221453.1602899-9-zycai@linux.ibm.com>

On Thu, Apr 02, 2026 at 06:14:30PM -0400, Zhuoying Cai wrote:
> Introduce new helper functions to extract certificate metadata:
> 
> qcrypto_x509_check_cert_times() - validates the certificate's validity period against the current time
> qcrypto_x509_get_pk_algorithm() - returns the public key algorithm used in the certificate

This is no longer exported, so drop that mention.

> qcrypto_x509_get_cert_key_id() - extracts the key ID from the certificate
> qcrypto_x509_check_ecc_curve_p521() - determines the ECC public key algorithm uses P-521 curve
> 
> These functions provide support for metadata extraction and validity checking
> for X.509 certificates.
> 
> Signed-off-by: Zhuoying Cai <zycai@linux.ibm.com>
> Reviewed-by: Farhan Ali<alifm@linux.ibm.com>
> ---
>  crypto/x509-utils.c         | 236 ++++++++++++++++++++++++++++++++++++
>  include/crypto/x509-utils.h |  51 ++++++++
>  2 files changed, 287 insertions(+)
> 
> diff --git a/crypto/x509-utils.c b/crypto/x509-utils.c
> index 2696d48155..906d5e5e87 100644
> --- a/crypto/x509-utils.c
> +++ b/crypto/x509-utils.c
> +static int qcrypto_x509_get_ecc_curve(uint8_t *cert, size_t size, Error **errp)
> +{
> +    int rc;
> +    int ret = -1;
> +    gnutls_x509_crt_t crt;
> +    gnutls_datum_t datum = {.data = cert, .size = size};
> +    gnutls_ecc_curve_t curve_id;
> +    gnutls_datum_t x = {.data = NULL, .size = 0};
> +    gnutls_datum_t y = {.data = NULL, .size = 0};
> +
> +    rc = gnutls_x509_crt_init(&crt);
> +    if (rc < 0) {
> +        error_setg(errp, "Failed to initialize certificate: %s", gnutls_strerror(rc));
> +        return ret;
> +    }
> +
> +    rc = gnutls_x509_crt_import(crt, &datum, GNUTLS_X509_FMT_PEM);
> +    if (rc != 0) {
> +        error_setg(errp, "Failed to import certificate: %s", gnutls_strerror(rc));
> +        goto cleanup;
> +    }
> +
> +    rc = gnutls_x509_crt_get_pk_ecc_raw(crt, &curve_id, &x, &y);
> +    if (rc != 0) {
> +        error_setg(errp, "Failed to get ECC public key curve: %s", gnutls_strerror(rc));
> +        goto cleanup;
> +    }
> +
> +    ret = curve_id;
> +
> +cleanup:
> +    gnutls_x509_crt_deinit(crt);
> +    gnutls_free(x.data);
> +    gnutls_free(y.data);

Use g_free here instead of gnutls_free

> +    return ret;
> +}

With those two changes made

  Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
  Acked-by: Daniel P. Berrangé <berrange@redhat.com>
  

With regards,
Daniel
-- 
|: https://berrange.com       ~~        https://hachyderm.io/@berrange :|
|: https://libvirt.org          ~~          https://entangle-photo.org :|
|: https://pixelfed.art/berrange   ~~    https://fstop138.berrange.com :|



  reply	other threads:[~2026-04-07 19:36 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-02 22:14 [PATCH v10 00/30] Secure IPL Support for SCSI Scheme of virtio-blk/virtio-scsi Devices Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 01/30] Add boot-certs to s390-ccw-virtio machine type option Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 02/30] crypto/x509-utils: Refactor with GNUTLS fallback Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 03/30] crypto/x509-utils: Add helper functions for certificate store Zhuoying Cai
2026-04-07 15:56   ` Daniel P. Berrangé
2026-04-15 18:34     ` Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 04/30] hw/s390x/ipl: Create " Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 05/30] s390x/diag: Introduce DIAG 320 for Certificate Store Facility Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 06/30] s390x/diag: Refactor address validation check from diag308_parm_check Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 07/30] s390x/diag: Implement DIAG 320 subcode 1 Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 08/30] crypto/x509-utils: Add helper functions for DIAG 320 subcode 2 Zhuoying Cai
2026-04-07 16:06   ` Daniel P. Berrangé [this message]
2026-04-02 22:14 ` [PATCH v10 09/30] s390x/diag: Implement " Zhuoying Cai
2026-04-09 19:08   ` Collin Walling
2026-04-02 22:14 ` [PATCH v10 10/30] s390x/diag: Introduce DIAG 508 for secure IPL operations Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 11/30] crypto/x509-utils: Add helper functions for DIAG 508 subcode 1 Zhuoying Cai
2026-04-07 16:37   ` Daniel P. Berrangé
2026-04-02 22:14 ` [PATCH v10 12/30] s390x/diag: Implement DIAG 508 subcode 1 for signature verification Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 13/30] s390x/ipl: Introduce IPL Information Report Block (IIRB) Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 14/30] pc-bios/s390-ccw: Define memory for IPLB and convert IPLB to pointers Zhuoying Cai
2026-04-10 18:40   ` Farhan Ali
2026-04-02 22:14 ` [PATCH v10 15/30] hw/s390x/ipl: Add IPIB flags to IPL Parameter Block Zhuoying Cai
2026-04-09 19:43   ` Collin Walling
2026-04-10 19:16   ` Jared Rossi
2026-04-15 18:38     ` Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 16/30] s390x: Guest support for Secure-IPL Facility Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 17/30] pc-bios/s390-ccw: Refactor zipl_run() Zhuoying Cai
2026-04-10 19:24   ` Jared Rossi
2026-04-02 22:14 ` [PATCH v10 18/30] pc-bios/s390-ccw: Rework zipl_load_segment function Zhuoying Cai
2026-04-14 13:25   ` Jared Rossi
2026-04-02 22:14 ` [PATCH v10 19/30] pc-bios/s390-ccw: Add signature verification for secure IPL in audit mode Zhuoying Cai
2026-04-10 19:37   ` Collin Walling
2026-04-20 18:22     ` Zhuoying Cai
2026-04-13 19:59   ` Jared Rossi
2026-04-13 22:05     ` Joshua Daley
2026-04-13 23:07   ` Joshua Daley
2026-04-02 22:14 ` [PATCH v10 20/30] pc-bios/s390-ccw: Add signed component address overlap checks Zhuoying Cai
2026-04-10 19:54   ` Collin Walling
2026-04-28 18:41     ` Zhuoying Cai
2026-04-15 16:36   ` Jared Rossi
2026-04-28 18:42     ` Zhuoying Cai
2026-04-29 14:16       ` Jared Rossi
2026-04-02 22:14 ` [PATCH v10 21/30] s390x: Guest support for Secure-IPL Code Loading Attributes Facility (SCLAF) Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 22/30] pc-bios/s390-ccw: Add additional security checks for secure boot Zhuoying Cai
2026-04-10 20:51   ` Collin Walling
2026-04-10 20:58     ` Collin Walling
2026-04-15 19:09   ` Jared Rossi
2026-04-02 22:14 ` [PATCH v10 23/30] Add secure-boot to s390-ccw-virtio machine type option Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 24/30] hw/s390x/ipl: Set IPIB flags for secure IPL Zhuoying Cai
2026-04-10 20:13   ` Collin Walling
2026-04-02 22:14 ` [PATCH v10 25/30] pc-bios/s390-ccw: Handle true secure IPL mode Zhuoying Cai
2026-04-10 20:11   ` Collin Walling
2026-04-30 21:17     ` Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 26/30] hw/s390x/ipl: Handle secure boot with multiple boot devices Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 27/30] hw/s390x/ipl: Handle secure boot without specifying a boot device Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 28/30] tests/functional/s390x: Add secure IPL functional test Zhuoying Cai
2026-04-02 22:14 ` [PATCH v10 29/30] docs/specs: Add secure IPL documentation Zhuoying Cai
2026-04-13 22:53   ` Joshua Daley
2026-04-02 22:14 ` [PATCH v10 30/30] docs/system/s390x: " Zhuoying Cai
2026-04-13 23:03   ` Joshua Daley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=adUrok15nPtpedu5@redhat.com \
    --to=berrange@redhat.com \
    --cc=alifm@linux.ibm.com \
    --cc=armbru@redhat.com \
    --cc=borntraeger@linux.ibm.com \
    --cc=brueckner@linux.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=david@kernel.org \
    --cc=eblake@redhat.com \
    --cc=farman@linux.ibm.com \
    --cc=iii@linux.ibm.com \
    --cc=jdaley@linux.ibm.com \
    --cc=jjherne@linux.ibm.com \
    --cc=jrossi@linux.ibm.com \
    --cc=mjrosato@linux.ibm.com \
    --cc=pasic@linux.ibm.com \
    --cc=pierrick.bouvier@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-s390x@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=walling@linux.ibm.com \
    --cc=zycai@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.