summaryrefslogtreecommitdiff
path: root/lib/algorithms
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@redhat.com>2014-11-05 14:07:46 +0100
committerNikos Mavrogiannopoulos <nmav@redhat.com>2014-11-05 14:07:46 +0100
commit7f38f708bc7bbfbc3ea82ebd7d855360d0af500f (patch)
treef8cfbe00ac63b811f5ca477f01748ca94017c63a /lib/algorithms
parentfc06699de672a82647d153f25c7d3176955c13a8 (diff)
downloadgnutls-7f38f708bc7bbfbc3ea82ebd7d855360d0af500f.tar.gz
modernized cipher table
Diffstat (limited to 'lib/algorithms')
-rw-r--r--lib/algorithms/ciphers.c175
1 files changed, 123 insertions, 52 deletions
diff --git a/lib/algorithms/ciphers.c b/lib/algorithms/ciphers.c
index df202f34aa..bbf93e5a6d 100644
--- a/lib/algorithms/ciphers.c
+++ b/lib/algorithms/ciphers.c
@@ -34,64 +34,135 @@
* Make sure to update MAX_CIPHER_BLOCK_SIZE and MAX_CIPHER_KEY_SIZE as well.
*/
static const cipher_entry_st algorithms[] = {
- {"AES-256-CBC", GNUTLS_CIPHER_AES_256_CBC, 16, 32, CIPHER_BLOCK,
- 0, 16, 16, 0},
- {"AES-192-CBC", GNUTLS_CIPHER_AES_192_CBC, 16, 24, CIPHER_BLOCK,
- 0, 16, 16, 0},
- {"AES-128-CBC", GNUTLS_CIPHER_AES_128_CBC, 16, 16, CIPHER_BLOCK,
- 0, 16, 16, 0},
- {"AES-128-GCM", GNUTLS_CIPHER_AES_128_GCM, 16, 16, CIPHER_AEAD,
- 4, 8, 12, 16},
- {"AES-256-GCM", GNUTLS_CIPHER_AES_256_GCM, 16, 32, CIPHER_AEAD,
- 4, 8, 12, 16},
- {"ARCFOUR-128", GNUTLS_CIPHER_ARCFOUR_128, 1, 16, CIPHER_STREAM,
+ { .name = "AES-256-CBC",
+ .id = GNUTLS_CIPHER_AES_256_CBC,
+ .blocksize = 16,
+ .keysize = 32,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 16,
+ .cipher_iv = 16},
+ { .name = "AES-192-CBC",
+ .id = GNUTLS_CIPHER_AES_192_CBC,
+ .blocksize = 16,
+ .keysize = 24,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 16,
+ .cipher_iv = 16},
+ { .name = "AES-128-CBC",
+ .id = GNUTLS_CIPHER_AES_128_CBC,
+ .blocksize = 16,
+ .keysize = 16,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 16,
+ .cipher_iv = 16},
+ { .name = "AES-128-GCM",
+ .id = GNUTLS_CIPHER_AES_128_GCM,
+ .blocksize = 16,
+ .keysize = 16,
+ .type = CIPHER_AEAD,
+ .implicit_iv = 4,
+ .explicit_iv = 8,
+ .cipher_iv = 12,
+ .tagsize = 16},
+ { .name = "AES-256-GCM",
+ .id = GNUTLS_CIPHER_AES_256_GCM,
+ .blocksize = 16,
+ .keysize = 32,
+ .type = CIPHER_AEAD,
+ .implicit_iv = 4,
+ .explicit_iv = 8,
+ .cipher_iv = 12,
+ .tagsize = 16},
+ { .name = "ARCFOUR-128",
+ .id = GNUTLS_CIPHER_ARCFOUR_128,
+ .blocksize = 1,
+ .keysize = 16,
+ .type = CIPHER_STREAM,
0, 0, 0, 0},
- {"ESTREAM-SALSA20-256", GNUTLS_CIPHER_ESTREAM_SALSA20_256, 64, 32,
- CIPHER_STREAM, 0, 0, 8, 0},
- {"SALSA20-256", GNUTLS_CIPHER_SALSA20_256, 64, 32, CIPHER_STREAM,
- 0, 0, 8, 0},
- {"CAMELLIA-256-CBC", GNUTLS_CIPHER_CAMELLIA_256_CBC, 16, 32,
- CIPHER_BLOCK, 0, 16, 16, 0},
- {"CAMELLIA-192-CBC", GNUTLS_CIPHER_CAMELLIA_192_CBC, 16, 24,
- CIPHER_BLOCK, 0, 16, 16, 0},
- {"CAMELLIA-128-CBC", GNUTLS_CIPHER_CAMELLIA_128_CBC, 16, 16,
- CIPHER_BLOCK, 0, 16, 16, 0},
- {"CAMELLIA-128-GCM", GNUTLS_CIPHER_CAMELLIA_128_GCM, 16, 16,
- CIPHER_AEAD, 4, 8, 12, 16},
- {"CAMELLIA-256-GCM", GNUTLS_CIPHER_CAMELLIA_256_GCM, 16, 32,
- CIPHER_AEAD, 4, 8, 12, 16},
- {"3DES-CBC", GNUTLS_CIPHER_3DES_CBC, 8, 24, CIPHER_BLOCK, 0, 8, 8, 0},
- {"DES-CBC", GNUTLS_CIPHER_DES_CBC, 8, 8, CIPHER_BLOCK, 0, 8, 8, 0},
- {"ARCFOUR-40", GNUTLS_CIPHER_ARCFOUR_40, 1, 5, CIPHER_STREAM, 0, 0, 0, 0},
- {"RC2-40", GNUTLS_CIPHER_RC2_40_CBC, 8, 5, CIPHER_BLOCK, 0, 8, 8, 0},
-
-#ifdef ENABLE_OPENPGP
- {"IDEA-PGP-CFB", GNUTLS_CIPHER_IDEA_PGP_CFB, 8, 16, CIPHER_BLOCK,
- 0, 8, 8, 0},
- {"3DES-PGP-CFB", GNUTLS_CIPHER_3DES_PGP_CFB, 8, 24, CIPHER_BLOCK,
- 0, 8, 8, 0},
- {"CAST5-PGP-CFB", GNUTLS_CIPHER_CAST5_PGP_CFB, 8, 16, CIPHER_BLOCK,
- 0, 8, 8, 0},
- {"BLOWFISH-PGP-CFB", GNUTLS_CIPHER_BLOWFISH_PGP_CFB, 8,
- 16 /*actually unlimited */ , CIPHER_BLOCK, 0, 8, 8, 0},
- {"SAFER-SK128-PGP-CFB", GNUTLS_CIPHER_SAFER_SK128_PGP_CFB, 8, 16,
- CIPHER_BLOCK, 0, 8, 8, 0},
- {"AES-128-PGP-CFB", GNUTLS_CIPHER_AES128_PGP_CFB, 16, 16,
- CIPHER_BLOCK, 0, 16, 16, 0},
- {"AES-192-PGP-CFB", GNUTLS_CIPHER_AES192_PGP_CFB, 16, 24,
- CIPHER_BLOCK, 0, 16, 16, 0},
- {"AES-256-PGP-CFB", GNUTLS_CIPHER_AES256_PGP_CFB, 16, 32,
- CIPHER_BLOCK, 0, 16, 16, 0},
- {"TWOFISH-PGP-CFB", GNUTLS_CIPHER_TWOFISH_PGP_CFB, 16, 16,
- CIPHER_BLOCK, 0, 16, 16, 0},
-#endif
-
+ { .name = "ESTREAM-SALSA20-256",
+ .id = GNUTLS_CIPHER_ESTREAM_SALSA20_256,
+ .blocksize = 64,
+ .keysize = 32,
+ .type = CIPHER_STREAM, 0, 0, 8, 0},
+ { .name = "SALSA20-256",
+ .id = GNUTLS_CIPHER_SALSA20_256,
+ .blocksize = 64,
+ .keysize = 32,
+ .type = CIPHER_STREAM,
+ .explicit_iv = 0,
+ .cipher_iv = 8},
+ { .name = "CAMELLIA-256-CBC",
+ .id = GNUTLS_CIPHER_CAMELLIA_256_CBC,
+ .blocksize = 16,
+ .keysize = 32,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 16,
+ .cipher_iv = 16},
+ { .name = "CAMELLIA-192-CBC",
+ .id = GNUTLS_CIPHER_CAMELLIA_192_CBC,
+ .blocksize = 16,
+ .keysize = 24,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 16,
+ .cipher_iv = 16},
+ { .name = "CAMELLIA-128-CBC",
+ .id = GNUTLS_CIPHER_CAMELLIA_128_CBC,
+ .blocksize = 16,
+ .keysize = 16,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 16,
+ .cipher_iv = 16},
+ { .name = "CAMELLIA-128-GCM",
+ .id = GNUTLS_CIPHER_CAMELLIA_128_GCM,
+ .blocksize = 16,
+ .keysize = 16,
+ .type = CIPHER_AEAD, 4, 8, 12, 16},
+ { .name = "CAMELLIA-256-GCM",
+ .id = GNUTLS_CIPHER_CAMELLIA_256_GCM,
+ .blocksize = 16,
+ .keysize = 32,
+ .type = CIPHER_AEAD,
+ .implicit_iv = 4,
+ .explicit_iv = 8,
+ .cipher_iv = 12,
+ .tagsize = 16},
+ { .name = "3DES-CBC",
+ .id = GNUTLS_CIPHER_3DES_CBC,
+ .blocksize = 8,
+ .keysize = 24,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 8,
+ .cipher_iv = 8},
+ { .name = "DES-CBC",
+ .id = GNUTLS_CIPHER_DES_CBC,
+ .blocksize = 8,
+ .keysize = 8,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 8,
+ .cipher_iv = 8},
+ { .name = "ARCFOUR-40",
+ .id = GNUTLS_CIPHER_ARCFOUR_40,
+ .blocksize = 1,
+ .keysize = 5,
+ .type = CIPHER_STREAM},
+ { .name = "RC2-40",
+ .id = GNUTLS_CIPHER_RC2_40_CBC,
+ .blocksize = 8,
+ .keysize = 5,
+ .type = CIPHER_BLOCK,
+ .explicit_iv = 8,
+ .cipher_iv = 8},
#ifndef ENABLE_FIPS140
/* All the other ciphers are disabled on the back-end library.
* This needs to be disabled here as it is merely a placeholder
* rather than an actual cipher.
*/
- {"NULL", GNUTLS_CIPHER_NULL, 1, 0, CIPHER_STREAM, 0, 0, 0},
+ { .name = "NULL",
+ .id = GNUTLS_CIPHER_NULL,
+ .blocksize = 1,
+ .keysize = 0,
+ .type = CIPHER_STREAM
+ }
#endif
{0, 0, 0, 0, 0, 0, 0}