- if (number_of_runs % 1000 == 0)
- fprintf (stderr, ".");
- /*printf("Got to run number %d.\n", number_of_runs); */
- GNUNET_CRYPTO_aes_create_session_key (&sessionkey);
-
- rc =
- gcry_cipher_open (&handle, GCRY_CIPHER_AES256, GCRY_CIPHER_MODE_CFB,
- 0);
-
- if (rc)
- {
- printf ("testweakkey: gcry_cipher_open failed on trial %d. %s\n",
- number_of_runs, gcry_strerror (rc));
- continue;
- }
-
- rc =
- gcry_cipher_setkey (handle, &sessionkey,
- GNUNET_CRYPTO_AES_KEY_LENGTH);
-
- if ((char) rc == GPG_ERR_WEAK_KEY)
- {
- printf ("\nWeak key (in hex): ");
- printWeakKey (&sessionkey);
- printf ("\n");
- number_of_weak_keys++;
- }
- else if (rc)
- {
- printf ("\nUnexpected error generating keys. Error is %s\n",
- gcry_strerror (rc));
- }
-
- gcry_cipher_close (handle);