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:
parent
057558d04b
commit
4896f5f47c
15 changed files with 166 additions and 69 deletions
|
@ -1,3 +1,10 @@
|
|||
2008-04-18 Werner Koch <wk@g10code.com>
|
||||
|
||||
* misc.c (map_cipher_openpgp_to_gcry, map_cipher_gcry_to_openpgp)
|
||||
(openpgp_cipher_test_algo): Add camellia-192.
|
||||
(openpgp_cipher_blocklen): New.
|
||||
* parse-packet.c (parse_key): Use new function here.
|
||||
|
||||
2008-04-15 David Shaw <dshaw@jabberwocky.com>
|
||||
|
||||
* getkey.c (merge_selfsigs_subkey): If there are multiple 0x19
|
||||
|
|
|
@ -82,6 +82,7 @@ u16 checksum( byte *p, unsigned n );
|
|||
u16 checksum_mpi( gcry_mpi_t a );
|
||||
u32 buffer_to_u32( const byte *buffer );
|
||||
const byte *get_session_marker( size_t *rlen );
|
||||
int openpgp_cipher_blocklen (int algo);
|
||||
int openpgp_cipher_test_algo( int algo );
|
||||
const char *openpgp_cipher_algo_name (int algo);
|
||||
int openpgp_pk_test_algo( int algo );
|
||||
|
|
35
g10/misc.c
35
g10/misc.c
|
@ -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 )
|
||||
{
|
||||
|
|
|
@ -1901,19 +1901,13 @@ parse_key( IOBUF inp, int pkttype, unsigned long pktlen,
|
|||
* of the IV here in cases we are not aware of the algorithm.
|
||||
* so a
|
||||
* sk->protect.ivlen = cipher_get_blocksize(sk->protect.algo);
|
||||
* won't work. The only solution I see is to hardwire it here.
|
||||
* won't work. The only solution I see is to hardwire it.
|
||||
* NOTE: if you change the ivlen above 16, don't forget to
|
||||
* enlarge temp.
|
||||
*/
|
||||
switch( sk->protect.algo ) {
|
||||
case 7: case 8: case 9: /* AES */
|
||||
case 10: /* Twofish */
|
||||
case 11: case 12: /* Camellia */
|
||||
sk->protect.ivlen = 16;
|
||||
break;
|
||||
default:
|
||||
sk->protect.ivlen = 8;
|
||||
}
|
||||
sk->protect.ivlen = openpgp_cipher_blocklen (sk->protect.algo);
|
||||
assert (sk->protect.ivlen <= sizeof (temp));
|
||||
|
||||
if( sk->protect.s2k.mode == 1001 )
|
||||
sk->protect.ivlen = 0;
|
||||
else if( sk->protect.s2k.mode == 1002 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue