diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-09-26 23:20:32 +0200 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2013-10-01 14:01:01 +0200 |
commit | 738177ec0eae05069ec61bc4f724a69d4e052e42 (patch) | |
tree | 16f6a06b43976904bf02c913210182f537f940af /cipher | |
parent | 1d85452412b65e7976bc94969fc513ff6b880ed8 (diff) | |
download | libgcrypt-738177ec0eae05069ec61bc4f724a69d4e052e42.tar.gz |
cipher: Add support for 128-bit keys in RC2
* cipher/rfc2268.c (oids_rfc2268_128): New
(_gcry_cipher_spec_rfc2268_128): New.
* cipher/cipher.c (cipher_table_entry): Add GCRY_CIPHER_RFC2268_128.
--
This patch adds support for decrypting (and encrypting) using 128-bit
keys using the RC2 algorithm.
Signed-off-by: Peter Wu <lekensteyn@gmail.com>
Actually this is merely enabling that extra ID for 128 bit RFC2268.
We should have used one id for that algorithm only, because a second
identifier merely for having the OID in the code is a bad idea. My
initial fault and thus I better apply this patch to make the id not
entirely useless. -wk
Diffstat (limited to 'cipher')
-rw-r--r-- | cipher/cipher.c | 2 | ||||
-rw-r--r-- | cipher/rfc2268.c | 13 |
2 files changed, 15 insertions, 0 deletions
diff --git a/cipher/cipher.c b/cipher/cipher.c index a17ca9b2..23cb99c2 100644 --- a/cipher/cipher.c +++ b/cipher/cipher.c @@ -87,6 +87,8 @@ static struct cipher_table_entry #if USE_RFC2268 { &_gcry_cipher_spec_rfc2268_40, &dummy_extra_spec, GCRY_CIPHER_RFC2268_40 }, + { &_gcry_cipher_spec_rfc2268_128, + &dummy_extra_spec, GCRY_CIPHER_RFC2268_128 }, #endif #if USE_SEED { &_gcry_cipher_spec_seed, diff --git a/cipher/rfc2268.c b/cipher/rfc2268.c index 130be9b7..da0b9f40 100644 --- a/cipher/rfc2268.c +++ b/cipher/rfc2268.c @@ -351,8 +351,21 @@ static gcry_cipher_oid_spec_t oids_rfc2268_40[] = { NULL } }; +static gcry_cipher_oid_spec_t oids_rfc2268_128[] = + { + /* pbeWithSHAAnd128BitRC2_CBC */ + { "1.2.840.113549.1.12.1.5", GCRY_CIPHER_MODE_CBC }, + { NULL } + }; + gcry_cipher_spec_t _gcry_cipher_spec_rfc2268_40 = { "RFC2268_40", NULL, oids_rfc2268_40, RFC2268_BLOCKSIZE, 40, sizeof(RFC2268_context), do_setkey, encrypt_block, decrypt_block }; + +gcry_cipher_spec_t _gcry_cipher_spec_rfc2268_128 = { + "RFC2268_128", NULL, oids_rfc2268_128, + RFC2268_BLOCKSIZE, 128, sizeof(RFC2268_context), + do_setkey, encrypt_block, decrypt_block +}; |