From: Christian Grothoff Date: Wed, 25 Mar 2020 11:17:04 +0000 (+0100) Subject: error handling X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=0eaaeeeccd18fcfdef4c37ea56fc40daf097706a;p=oweals%2Fgnunet.git error handling --- diff --git a/src/transport/gnunet-communicator-udp.c b/src/transport/gnunet-communicator-udp.c index e931bd2e7..d767689b9 100644 --- a/src/transport/gnunet-communicator-udp.c +++ b/src/transport/gnunet-communicator-udp.c @@ -1133,14 +1133,18 @@ setup_cipher (const struct GNUNET_HashCode *msec, { char key[AES_KEY_SIZE]; char iv[AES_IV_SIZE]; + int rc; - gcry_cipher_open (cipher, - GCRY_CIPHER_AES256 /* low level: go for speed */, - GCRY_CIPHER_MODE_GCM, - 0 /* flags */); + GNUNET_assert (0 == + gcry_cipher_open (cipher, + GCRY_CIPHER_AES256 /* low level: go for speed */, + GCRY_CIPHER_MODE_GCM, + 0 /* flags */)); get_iv_key (msec, serial, key, iv); - gcry_cipher_setkey (*cipher, key, sizeof(key)); - gcry_cipher_setiv (*cipher, iv, sizeof(iv)); + rc = gcry_cipher_setkey (*cipher, key, sizeof(key)); + GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); + rc = gcry_cipher_setiv (*cipher, iv, sizeof(iv)); + GNUNET_assert ((0 == rc) || ((char) rc == GPG_ERR_WEAK_KEY)); }