From: Andre Noll Date: Sun, 31 Dec 2017 14:04:16 +0000 (+0100) Subject: Merge branch 'maint' X-Git-Tag: v0.6.2~48 X-Git-Url: http://git.tue.mpg.de/?a=commitdiff_plain;h=767a4a54c967bc4b80bd14d02e89fe91acd848dd;p=paraslash.git Merge branch 'maint' A conflict in init_random_seed_or_die() of gcrypt.c. The fix added in the maint branch conflicted against the master branch which also modified the function to bump the required libgcrypt version. * maint: resample filter: Don't discard const. gcrypt: Seed PRNG in init_random_seed_or_die(). bash_completion: Get rid of weird retry logic. --- 767a4a54c967bc4b80bd14d02e89fe91acd848dd diff --cc gcrypt.c index d5cb49a4,f30e8166..052546dd --- a/gcrypt.c +++ b/gcrypt.c @@@ -52,21 -59,33 +52,22 @@@ void get_random_bytes_or_die(unsigned c } /* - * This is called at the beginning of every program that uses libgcrypt. We - * don't have to initialize any random seed here, but we must initialize the - * gcrypt library. This task is performed by gcry_check_version() which can - * also check that the gcrypt library version is at least the minimal required - * version. + * This is called at the beginning of every program that uses libgcrypt. The + * call to gcry_check_version() initializes the gcrypt library and checks that - * we have at least the minimal required version. This function also tells us - * whether we have to use our own OAEP padding code. ++ * we have at least the minimal required version. */ void init_random_seed_or_die(void) { - const char *ver, *req_ver; + const char *req_ver = "1.5.0"; + int seed; - if (gcry_check_version(req_ver)) - return; - PARA_EMERG_LOG("fatal: need at least libgcrypt-%s, have: %s\n", - req_ver, gcry_check_version(NULL)); - exit(EXIT_FAILURE); - ver = gcry_check_version(NULL); - req_ver = "1.4.0"; + if (!gcry_check_version(req_ver)) { + PARA_EMERG_LOG("fatal: need at least libgcrypt-%s, have: %s\n", - req_ver, ver); ++ req_ver, gcry_check_version(NULL)); + exit(EXIT_FAILURE); + } - req_ver = "1.5.0"; - if (gcry_check_version(req_ver)) { - libgcrypt_has_oaep = true; - rsa_decrypt_sexp = "(enc-val(flags oaep)(rsa(a %m)))"; - } else { - libgcrypt_has_oaep = false; - rsa_decrypt_sexp = "(enc-val(rsa(a %m)))"; - } + get_random_bytes_or_die((unsigned char *)&seed, sizeof(seed)); + srandom(seed); } /** S-expression for the public part of an RSA key. */