1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-02 22:46:30 +02:00

Adjust for the changed Camellia draft.

W32 gettext changes.
Comment and typo fixes.
This commit is contained in:
Werner Koch 2008-04-18 09:20:25 +00:00
parent 057558d04b
commit 4896f5f47c
15 changed files with 166 additions and 69 deletions

View file

@ -1,6 +1,6 @@
/* misc.c - miscellaneous functions
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
* 2005, 2006, 2007 Free Software Foundation, Inc.
* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004,
* 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
*
* This file is part of GnuPG.
*
@ -338,6 +338,7 @@ map_cipher_openpgp_to_gcry (int algo)
switch (algo)
{
case CIPHER_ALGO_CAMELLIA128: return 310;
case CIPHER_ALGO_CAMELLIA192: return 311;
case CIPHER_ALGO_CAMELLIA256: return 312;
default: return algo;
}
@ -350,11 +351,36 @@ map_cipher_gcry_to_openpgp (int algo)
switch (algo)
{
case 310: return CIPHER_ALGO_CAMELLIA128;
case 311: return CIPHER_ALGO_CAMELLIA192;
case 312: return CIPHER_ALGO_CAMELLIA256;
default: return algo;
}
}
/* Return the block length of an OpenPGP cipher algorithm. */
int
openpgp_cipher_blocklen (int algo)
{
/* We use the numbers from OpenPGP to be sure that we get the right
block length. This is so that the packet parsing code works even
for unknown algorithms (for which we assume 8 due to tradition).
NOTE: If you change the the returned blocklen above 16, check
the callers because they may use a fixed size buffer of that
size. */
switch (algo)
{
case 7: case 8: case 9: /* AES */
case 10: /* Twofish */
case 11: case 12: case 13: /* Camellia */
return 16;
default:
return 8;
}
}
/****************
* Wrapper around the libgcrypt function with additonal checks on
* the OpenPGP contraints for the algo ID.
@ -370,7 +396,8 @@ openpgp_cipher_test_algo( int algo )
requested. */
#ifndef USE_CAMELLIA
if (algo == CIPHER_ALGO_CAMELLIA128
|| algo == CIPHER_ALGO_CAMELLIA256)
|| algo == CIPHER_ALGO_CAMELLIA192
|| algo == CIPHER_ALGO_CAMELLIA256)
return gpg_error (GPG_ERR_CIPHER_ALGO);
#endif
@ -386,8 +413,6 @@ openpgp_cipher_algo_name (int algo)
return gcry_cipher_algo_name (map_cipher_openpgp_to_gcry (algo));
}
int
openpgp_pk_test_algo( int algo )
{