mirror of
git://git.gnupg.org/gnupg.git
synced 2025-07-03 22:56:33 +02:00
* cardglue.c (send_status_info): Make CTRL optional.
(agent_scd_writekey, inq_writekey_parms): New. (agent_openpgp_storekey): Removed. * cardglue.h: Add a few more error code mappings. * keygen.c (copy_mpi): Removed. (save_unprotected_key_to_card): Changed to use agent_scd_writekey. * app-common.h, app-openpgp.c, tlv.c, tlv.h: Updated from newer version in gnupg 1.9 CVS.
This commit is contained in:
parent
bd644c8d45
commit
be2aa37dbf
18 changed files with 724 additions and 209 deletions
|
@ -1,3 +1,12 @@
|
|||
2005-05-06 Werner Koch <wk@g10code.com>
|
||||
|
||||
* mpi-scan.c (mpi_putbyte, mpi_getbyte): Removed. Not used.
|
||||
|
||||
2005-04-21 Werner Koch <wk@g10code.com>
|
||||
|
||||
* mpicoder.c (mpi_read): Changed error detection to always return
|
||||
an error while maintaining the actual number of bytes read.
|
||||
|
||||
2005-03-11 Werner Koch <wk@g10code.com>
|
||||
|
||||
* Makefile.am (ASFLAGS): Renamed to AM_CCASFLAGS and added the
|
||||
|
|
|
@ -18,8 +18,8 @@
|
|||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <config.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "mpi-internal.h"
|
||||
#include "longlong.h"
|
||||
|
@ -31,6 +31,7 @@
|
|||
*
|
||||
* FIXME: This code is VERY ugly!
|
||||
*/
|
||||
#if 0 /* Code is not used */
|
||||
int
|
||||
mpi_getbyte( MPI a, unsigned idx )
|
||||
{
|
||||
|
@ -48,14 +49,19 @@ mpi_getbyte( MPI a, unsigned idx )
|
|||
}
|
||||
return -1;
|
||||
}
|
||||
#endif /* Code is not used */
|
||||
|
||||
|
||||
/****************
|
||||
* Put a value at position IDX into A. idx counts from lsb to msb
|
||||
*/
|
||||
/* FIXME: There is a problem with the long constants which should have
|
||||
a LL prefix or better the macros we use at other places. */
|
||||
#if 0 /* Code is not used */
|
||||
void
|
||||
mpi_putbyte( MPI a, unsigned idx, int xc )
|
||||
{
|
||||
|
||||
int i, j;
|
||||
unsigned n;
|
||||
mpi_ptr_t ap;
|
||||
|
@ -104,12 +110,13 @@ mpi_putbyte( MPI a, unsigned idx, int xc )
|
|||
}
|
||||
abort(); /* index out of range */
|
||||
}
|
||||
#endif /* Code is not used */
|
||||
|
||||
|
||||
/****************
|
||||
* Count the number of zerobits at the low end of A
|
||||
*/
|
||||
unsigned
|
||||
unsigned int
|
||||
mpi_trailing_zeros( MPI a )
|
||||
{
|
||||
unsigned n, count = 0;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* mpicoder.c - Coder for the external representation of MPIs
|
||||
* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
* Copyright (C) 1998, 1999, 2005 Free Software Foundation, Inc.
|
||||
*
|
||||
* This file is part of GnuPG.
|
||||
*
|
||||
|
@ -74,20 +74,23 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
|
|||
#endif
|
||||
{
|
||||
int c, i, j;
|
||||
unsigned int nmax = *ret_nread;
|
||||
unsigned nbits, nbytes, nlimbs, nread=0;
|
||||
mpi_limb_t a;
|
||||
MPI val = MPI_NULL;
|
||||
|
||||
if( (c = iobuf_get(inp)) == -1 )
|
||||
goto leave;
|
||||
nread++;
|
||||
if (++nread >= nmax)
|
||||
goto overflow;
|
||||
nbits = c << 8;
|
||||
if( (c = iobuf_get(inp)) == -1 )
|
||||
goto leave;
|
||||
nread++;
|
||||
if (++nread >= nmax)
|
||||
goto overflow;
|
||||
nbits |= c;
|
||||
if( nbits > MAX_EXTERN_MPI_BITS ) {
|
||||
log_error("mpi too large (%u bits)\n", nbits);
|
||||
log_error("mpi too large for this implementation (%u bits)\n", nbits);
|
||||
goto leave;
|
||||
}
|
||||
|
||||
|
@ -108,6 +111,15 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
|
|||
for( ; j > 0; j-- ) {
|
||||
a = 0;
|
||||
for(; i < BYTES_PER_MPI_LIMB; i++ ) {
|
||||
if (nread >= nmax) {
|
||||
#ifdef M_DEBUG
|
||||
mpi_debug_free (val);
|
||||
#else
|
||||
mpi_free (val);
|
||||
#endif
|
||||
val = NULL;
|
||||
goto overflow;
|
||||
}
|
||||
a <<= 8;
|
||||
a |= iobuf_get(inp) & 0xff; nread++;
|
||||
}
|
||||
|
@ -116,10 +128,11 @@ mpi_read(IOBUF inp, unsigned *ret_nread, int secure)
|
|||
}
|
||||
|
||||
leave:
|
||||
if( nread > *ret_nread )
|
||||
log_bug("mpi crosses packet border\n");
|
||||
else
|
||||
*ret_nread = nread;
|
||||
*ret_nread = nread;
|
||||
return val;
|
||||
overflow:
|
||||
log_error ("mpi larger than indicated length (%u bytes)\n", nmax);
|
||||
*ret_nread = nread;
|
||||
return val;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue