Skip to content
Snippets Groups Projects
  • Richard W.M. Jones's avatar
    d6cca8e1
    crypto: Remove use of GCRYPT_VERSION macro. · d6cca8e1
    Richard W.M. Jones authored
    According to the gcrypt documentation it's intended that
    gcry_check_version() is called with the minimum version of gcrypt
    needed by the program, not the version from the <gcrypt.h> header file
    that happened to be installed when qemu was compiled.  Indeed the
    gcrypt.h header says that you shouldn't use the GCRYPT_VERSION macro.
    
    This causes the following failure:
    
      qemu-img: Unable to initialize gcrypt
    
    if a slightly older version of libgcrypt is installed with a newer
    qemu, even though the slightly older version works fine.  This can
    happen with RPM packaging which uses symbol versioning to determine
    automatically which libgcrypt is required by qemu, which caused the
    following bug in RHEL 8:
    
      https://bugzilla.redhat.com/show_bug.cgi?id=1840485
    
    
    
    qemu actually requires libgcrypt >= 1.5.0, so we might put the string
    "1.5.0" here.  However since 1.5.0 was released in 2011, it hardly
    seems we need to check that.  So I replaced GCRYPT_VERSION with NULL.
    Perhaps in future if we move to requiring a newer version of gcrypt we
    could put a literal string here.
    
    Signed-off-by: default avatarRichard W.M. Jones <rjones@redhat.com>
    Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>
    d6cca8e1
    History
    crypto: Remove use of GCRYPT_VERSION macro.
    Richard W.M. Jones authored
    According to the gcrypt documentation it's intended that
    gcry_check_version() is called with the minimum version of gcrypt
    needed by the program, not the version from the <gcrypt.h> header file
    that happened to be installed when qemu was compiled.  Indeed the
    gcrypt.h header says that you shouldn't use the GCRYPT_VERSION macro.
    
    This causes the following failure:
    
      qemu-img: Unable to initialize gcrypt
    
    if a slightly older version of libgcrypt is installed with a newer
    qemu, even though the slightly older version works fine.  This can
    happen with RPM packaging which uses symbol versioning to determine
    automatically which libgcrypt is required by qemu, which caused the
    following bug in RHEL 8:
    
      https://bugzilla.redhat.com/show_bug.cgi?id=1840485
    
    
    
    qemu actually requires libgcrypt >= 1.5.0, so we might put the string
    "1.5.0" here.  However since 1.5.0 was released in 2011, it hardly
    seems we need to check that.  So I replaced GCRYPT_VERSION with NULL.
    Perhaps in future if we move to requiring a newer version of gcrypt we
    could put a literal string here.
    
    Signed-off-by: default avatarRichard W.M. Jones <rjones@redhat.com>
    Signed-off-by: default avatarDaniel P. Berrangé <berrange@redhat.com>