Skip to content
Snippets Groups Projects
  1. May 26, 2022
  2. May 11, 2022
  3. Apr 29, 2022
  4. Jun 29, 2021
  5. Mar 23, 2021
  6. Sep 18, 2020
  7. Sep 10, 2020
  8. Sep 09, 2020
  9. Sep 08, 2020
  10. Sep 03, 2020
    • Daniel P. Berrangé's avatar
      qapi: enable use of g_autoptr with QAPI types · 221db5da
      Daniel P. Berrangé authored
      
      Currently QAPI generates a type and function for free'ing it:
      
        typedef struct QCryptoBlockCreateOptions QCryptoBlockCreateOptions;
        void qapi_free_QCryptoBlockCreateOptions(QCryptoBlockCreateOptions *obj);
      
      This is used in the traditional manner:
      
        QCryptoBlockCreateOptions *opts = NULL;
      
        opts = g_new0(QCryptoBlockCreateOptions, 1);
      
        ....do stuff with opts...
      
        qapi_free_QCryptoBlockCreateOptions(opts);
      
      Since bumping the min glib to 2.48, QEMU has incrementally adopted the
      use of g_auto/g_autoptr. This allows the compiler to run a function to
      free a variable when it goes out of scope, the benefit being the
      compiler can guarantee it is freed in all possible code ptahs.
      
      This benefit is applicable to QAPI types too, and given the seriously
      long method names for some qapi_free_XXXX() functions, is much less
      typing. This change thus makes the code generator emit:
      
       G_DEFINE_AUTOPTR_CLEANUP_FUNC(QCryptoBlockCreateOptions,
                                    qapi_free_QCryptoBlockCreateOptions)
      
      The above code example now becomes
      
        g_autoptr(QCryptoBlockCreateOptions) opts = NULL;
      
        opts = g_new0(QCryptoBlockCreateOptions, 1);
      
        ....do stuff with opts...
      
      Note, if the local pointer needs to live beyond the scope holding the
      variable, then g_steal_pointer can be used. This is useful to return the
      pointer to the caller in the success codepath, while letting it be freed
      in all error codepaths.
      
        return g_steal_pointer(&opts);
      
      The crypto/block.h header needs updating to avoid symbol clash now that
      the g_autoptr support is a standard QAPI feature.
      
      Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Message-Id: <20200723153845.2934357-1-berrange@redhat.com>
      Reviewed-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Reviewed-by: default avatarEric Blake <eblake@redhat.com>
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      221db5da
  11. Jul 06, 2020
  12. Jul 03, 2020
    • Philippe Mathieu-Daudé's avatar
      crypto: Add tls-cipher-suites object · 993aec27
      Philippe Mathieu-Daudé authored
      
      On the host OS, various aspects of TLS operation are configurable.
      In particular it is possible for the sysadmin to control the TLS
      cipher/protocol algorithms that applications are permitted to use.
      
      * Any given crypto library has a built-in default priority list
        defined by the distro maintainer of the library package (or by
        upstream).
      
      * The "crypto-policies" RPM (or equivalent host OS package)
        provides a config file such as "/etc/crypto-policies/config",
        where the sysadmin can set a high level (library-independent)
        policy.
      
        The "update-crypto-policies --set" command (or equivalent) is
        used to translate the global policy to individual library
        representations, producing files such as
        "/etc/crypto-policies/back-ends/*.config". The generated files,
        if present, are loaded by the various crypto libraries to
        override their own built-in defaults.
      
        For example, the GNUTLS library may read
        "/etc/crypto-policies/back-ends/gnutls.config".
      
      * A management application (or the QEMU user) may overide the
        system-wide crypto-policies config via their own config, if
        they need to diverge from the former.
      
      Thus the priority order is "QEMU user config" > "crypto-policies
      system config" > "library built-in config".
      
      Introduce the "tls-cipher-suites" object for exposing the ordered
      list of permitted TLS cipher suites from the host side to the
      guest firmware, via fw_cfg. The list is represented as an array
      of bytes.
      
      The priority at which the host-side policy is retrieved is given
      by the "priority" property of the new object type. For example,
      "priority=@SYSTEM" may be used to refer to
      "/etc/crypto-policies/back-ends/gnutls.config" (given that QEMU
      uses GNUTLS).
      
      The firmware uses the IANA_TLS_CIPHER array for configuring
      guest-side TLS, for example in UEFI HTTPS Boot.
      
      [Description from Daniel P. Berrangé, edited by Laszlo Ersek.]
      
      Signed-off-by: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
      Reviewed-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      Acked-by: default avatarLaszlo Ersek <lersek@redhat.com>
      Message-Id: <20200623172726.21040-2-philmd@redhat.com>
      993aec27
  13. Jun 15, 2020
  14. Mar 11, 2020
  15. Dec 18, 2019
  16. Aug 22, 2019
  17. Jul 19, 2019
  18. Jun 12, 2019
    • Markus Armbruster's avatar
      Include qemu-common.h exactly where needed · a8d25326
      Markus Armbruster authored
      
      No header includes qemu-common.h after this commit, as prescribed by
      qemu-common.h's file comment.
      
      Signed-off-by: default avatarMarkus Armbruster <armbru@redhat.com>
      Message-Id: <20190523143508.25387-5-armbru@redhat.com>
      [Rebased with conflicts resolved automatically, except for
      include/hw/arm/xlnx-zynqmp.h hw/arm/nrf51_soc.c hw/arm/msf2-soc.c
      block/qcow2-refcount.c block/qcow2-cluster.c block/qcow2-cache.c
      target/arm/cpu.h target/lm32/cpu.h target/m68k/cpu.h target/mips/cpu.h
      target/moxie/cpu.h target/nios2/cpu.h target/openrisc/cpu.h
      target/riscv/cpu.h target/tilegx/cpu.h target/tricore/cpu.h
      target/unicore32/cpu.h target/xtensa/cpu.h; bsd-user/main.c and
      net/tap-bsd.c fixed up]
      a8d25326
  19. May 22, 2019
  20. Jan 30, 2019
  21. Dec 12, 2018
  22. Jul 24, 2018
  23. Jul 03, 2018
    • Richard W.M. Jones's avatar
      crypto: Implement TLS Pre-Shared Keys (PSK). · e1a6dc91
      Richard W.M. Jones authored
      
      Pre-Shared Keys (PSK) is a simpler mechanism for enabling TLS
      connections than using certificates.  It requires only a simple secret
      key:
      
        $ mkdir -m 0700 /tmp/keys
        $ psktool -u rjones -p /tmp/keys/keys.psk
        $ cat /tmp/keys/keys.psk
        rjones:d543770c15ad93d76443fb56f501a31969235f47e999720ae8d2336f6a13fcbc
      
      The key can be secretly shared between clients and servers.  Clients
      must specify the directory containing the "keys.psk" file and a
      username (defaults to "qemu").  Servers must specify only the
      directory.
      
      Example NBD client:
      
        $ qemu-img info \
          --object tls-creds-psk,id=tls0,dir=/tmp/keys,username=rjones,endpoint=client \
          --image-opts \
          file.driver=nbd,file.host=localhost,file.port=10809,file.tls-creds=tls0,file.export=/
      
      Example NBD server using qemu-nbd:
      
        $ qemu-nbd -t -x / \
          --object tls-creds-psk,id=tls0,endpoint=server,dir=/tmp/keys \
          --tls-creds tls0 \
          image.qcow2
      
      Example NBD server using nbdkit:
      
        $ nbdkit -n -e / -fv \
          --tls=on --tls-psk=/tmp/keys/keys.psk \
          file file=disk.img
      
      Signed-off-by: default avatarRichard W.M. Jones <rjones@redhat.com>
      Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
      e1a6dc91
  24. Mar 02, 2018
  25. Feb 09, 2018
  26. Oct 06, 2017
  27. Jul 19, 2017
  28. Jul 11, 2017
Loading