Skip to content
  • Daniel P. Berrangé's avatar
    37316663
    crypto: fix initialization of gcrypt threading · 37316663
    Daniel P. Berrangé authored
    
    
    The gcrypt threads implementation must be set before calling
    any other gcrypt APIs, especially gcry_check_version(),
    since that triggers initialization of the random pool. After
    that is initialized, changes to the threads impl won't be
    honoured by the random pool code. This means that gcrypt
    will think thread locking is needed and so try to acquire
    the random pool mutex, but this is NULL as no threads impl
    was set originally. This results in a crash in the random
    pool code.
    
    For the same reasons, we must set the gcrypt threads impl
    before calling gnutls_init, since that will also trigger
    gcry_check_version
    
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
    37316663
    crypto: fix initialization of gcrypt threading
    Daniel P. Berrangé authored
    
    
    The gcrypt threads implementation must be set before calling
    any other gcrypt APIs, especially gcry_check_version(),
    since that triggers initialization of the random pool. After
    that is initialized, changes to the threads impl won't be
    honoured by the random pool code. This means that gcrypt
    will think thread locking is needed and so try to acquire
    the random pool mutex, but this is NULL as no threads impl
    was set originally. This results in a crash in the random
    pool code.
    
    For the same reasons, we must set the gcrypt threads impl
    before calling gnutls_init, since that will also trigger
    gcry_check_version
    
    Reviewed-by: default avatarEric Blake <eblake@redhat.com>
    Signed-off-by: default avatarDaniel P. Berrange <berrange@redhat.com>
Loading