mirror of git://git.gnupg.org/gnupg.git
gpg: Remove all assert.h and s/assert/log_assert/.
Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
9740dff9f4
commit
64bfeafa52
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
@ -137,7 +136,7 @@ release_armor_context (armor_filter_context_t *afx)
|
||||||
{
|
{
|
||||||
if (!afx)
|
if (!afx)
|
||||||
return;
|
return;
|
||||||
assert (afx->refcount);
|
log_assert (afx->refcount);
|
||||||
if ( --afx->refcount )
|
if ( --afx->refcount )
|
||||||
return;
|
return;
|
||||||
xfree (afx);
|
xfree (afx);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
@ -91,7 +90,7 @@ build_packet( IOBUF out, PACKET *pkt )
|
||||||
|
|
||||||
if( DBG_PACKET )
|
if( DBG_PACKET )
|
||||||
log_debug("build_packet() type=%d\n", pkt->pkttype );
|
log_debug("build_packet() type=%d\n", pkt->pkttype );
|
||||||
assert( pkt->pkt.generic );
|
log_assert( pkt->pkt.generic );
|
||||||
|
|
||||||
switch ((pkttype = pkt->pkttype))
|
switch ((pkttype = pkt->pkttype))
|
||||||
{
|
{
|
||||||
|
@ -266,7 +265,7 @@ calc_packet_length( PACKET *pkt )
|
||||||
u32 n=0;
|
u32 n=0;
|
||||||
int new_ctb = 0;
|
int new_ctb = 0;
|
||||||
|
|
||||||
assert( pkt->pkt.generic );
|
log_assert (pkt->pkt.generic);
|
||||||
switch( pkt->pkttype ) {
|
switch( pkt->pkttype ) {
|
||||||
case PKT_PLAINTEXT:
|
case PKT_PLAINTEXT:
|
||||||
n = calc_plaintext( pkt->pkt.plaintext );
|
n = calc_plaintext( pkt->pkt.plaintext );
|
||||||
|
@ -465,7 +464,7 @@ do_key (iobuf_t out, int ctb, PKT_public_key *pk)
|
||||||
byte *p;
|
byte *p;
|
||||||
unsigned int ndatabits;
|
unsigned int ndatabits;
|
||||||
|
|
||||||
assert (gcry_mpi_get_flag (pk->pkey[npkey], GCRYMPI_FLAG_OPAQUE));
|
log_assert (gcry_mpi_get_flag (pk->pkey[npkey], GCRYMPI_FLAG_OPAQUE));
|
||||||
p = gcry_mpi_get_opaque (pk->pkey[npkey], &ndatabits);
|
p = gcry_mpi_get_opaque (pk->pkey[npkey], &ndatabits);
|
||||||
if (p)
|
if (p)
|
||||||
iobuf_write (a, p, (ndatabits+7)/8 );
|
iobuf_write (a, p, (ndatabits+7)/8 );
|
||||||
|
@ -509,7 +508,7 @@ do_symkey_enc( IOBUF out, int ctb, PKT_symkey_enc *enc )
|
||||||
log_assert (ctb_pkttype (ctb) == PKT_SYMKEY_ENC);
|
log_assert (ctb_pkttype (ctb) == PKT_SYMKEY_ENC);
|
||||||
|
|
||||||
/* The only acceptable version. */
|
/* The only acceptable version. */
|
||||||
assert( enc->version == 4 );
|
log_assert( enc->version == 4 );
|
||||||
|
|
||||||
/* RFC 4880, Section 3.7. */
|
/* RFC 4880, Section 3.7. */
|
||||||
switch( enc->s2k.mode )
|
switch( enc->s2k.mode )
|
||||||
|
@ -798,7 +797,7 @@ delete_sig_subpkt (subpktarea_t *area, sigsubpkttype_t reqtype )
|
||||||
|
|
||||||
if (!okay)
|
if (!okay)
|
||||||
log_error ("delete_subpkt: buffer shorter than subpacket\n");
|
log_error ("delete_subpkt: buffer shorter than subpacket\n");
|
||||||
assert (unused <= area->len);
|
log_assert (unused <= area->len);
|
||||||
area->len -= unused;
|
area->len -= unused;
|
||||||
return !!unused;
|
return !!unused;
|
||||||
}
|
}
|
||||||
|
@ -1437,7 +1436,7 @@ do_signature( IOBUF out, int ctb, PKT_signature *sig )
|
||||||
static int
|
static int
|
||||||
do_onepass_sig( IOBUF out, int ctb, PKT_onepass_sig *ops )
|
do_onepass_sig( IOBUF out, int ctb, PKT_onepass_sig *ops )
|
||||||
{
|
{
|
||||||
log_assert (ctb_pkttype (ctb) == PKT_ONEPASS_SIG);
|
log_assert (ctb_pkttype (ctb) == PKT_ONEPASS_SIG);
|
||||||
|
|
||||||
write_header(out, ctb, 4 + 8 + 1);
|
write_header(out, ctb, 4 + 8 + 1);
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -712,7 +711,7 @@ learn_status_cb (void *opaque, const char *line)
|
||||||
&& strchr("1234", keyword[11]))
|
&& strchr("1234", keyword[11]))
|
||||||
{
|
{
|
||||||
int no = keyword[11] - '1';
|
int no = keyword[11] - '1';
|
||||||
assert (no >= 0 && no <= 3);
|
log_assert (no >= 0 && no <= 3);
|
||||||
xfree (parm->private_do[no]);
|
xfree (parm->private_do[no]);
|
||||||
parm->private_do[no] = unescape_status_string (line);
|
parm->private_do[no] = unescape_status_string (line);
|
||||||
}
|
}
|
||||||
|
@ -2133,7 +2132,7 @@ agent_pkdecrypt (ctrl_t ctrl, const char *keygrip, const char *desc,
|
||||||
buf = get_membuf (&data, &len);
|
buf = get_membuf (&data, &len);
|
||||||
if (!buf)
|
if (!buf)
|
||||||
return gpg_error_from_syserror ();
|
return gpg_error_from_syserror ();
|
||||||
assert (len); /* (we forced Nul termination.) */
|
log_assert (len); /* (we forced Nul termination.) */
|
||||||
|
|
||||||
if (*buf != '(')
|
if (*buf != '(')
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
# include <locale.h>
|
# include <locale.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -261,7 +260,7 @@ open_context (ctrl_t ctrl, assuan_context_t *r_ctx)
|
||||||
if (dml)
|
if (dml)
|
||||||
{
|
{
|
||||||
/* Found an inactive local session - return that. */
|
/* Found an inactive local session - return that. */
|
||||||
assert (!dml->is_active);
|
log_assert (!dml->is_active);
|
||||||
|
|
||||||
/* But first do the per session init if not yet done. */
|
/* But first do the per session init if not yet done. */
|
||||||
if (!dml->set_keyservers_done)
|
if (!dml->set_keyservers_done)
|
||||||
|
@ -804,7 +803,7 @@ record_output (estream_t output,
|
||||||
type_str = "sig";
|
type_str = "sig";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert (! "Unhandled type.");
|
log_assert (! "Unhandled type.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pub_key_length > 0)
|
if (pub_key_length > 0)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#ifdef HAVE_LIBREADLINE
|
#ifdef HAVE_LIBREADLINE
|
||||||
# define GNUPG_LIBREADLINE_H_INCLUDED
|
# define GNUPG_LIBREADLINE_H_INCLUDED
|
||||||
# include <readline/readline.h>
|
# include <readline/readline.h>
|
||||||
|
@ -901,7 +900,7 @@ change_private_do (const char *args, int nr)
|
||||||
int n;
|
int n;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
assert (nr >= 1 && nr <= 4);
|
log_assert (nr >= 1 && nr <= 4);
|
||||||
do_name[11] = '0' + nr;
|
do_name[11] = '0' + nr;
|
||||||
|
|
||||||
if (args && (args = strchr (args, '<'))) /* Read it from a file */
|
if (args && (args = strchr (args, '<'))) /* Read it from a file */
|
||||||
|
@ -1247,7 +1246,7 @@ show_card_key_info (struct agent_card_info_s *info)
|
||||||
static int
|
static int
|
||||||
replace_existing_key_p (struct agent_card_info_s *info, int keyno)
|
replace_existing_key_p (struct agent_card_info_s *info, int keyno)
|
||||||
{
|
{
|
||||||
assert (keyno >= 0 && keyno <= 3);
|
log_assert (keyno >= 0 && keyno <= 3);
|
||||||
|
|
||||||
if ((keyno == 1 && info->fpr1valid)
|
if ((keyno == 1 && info->fpr1valid)
|
||||||
|| (keyno == 2 && info->fpr2valid)
|
|| (keyno == 2 && info->fpr2valid)
|
||||||
|
@ -1538,8 +1537,8 @@ card_store_subkey (KBNODE node, int use)
|
||||||
int rc;
|
int rc;
|
||||||
gnupg_isotime_t timebuf;
|
gnupg_isotime_t timebuf;
|
||||||
|
|
||||||
assert (node->pkt->pkttype == PKT_PUBLIC_KEY
|
log_assert (node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
|
|
||||||
pk = node->pkt->pkt.public_key;
|
pk = node->pkt->pkt.public_key;
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
@ -123,7 +122,7 @@ cipher_filter( void *opaque, int control,
|
||||||
rc = -1; /* not yet used */
|
rc = -1; /* not yet used */
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_FLUSH ) { /* encrypt */
|
else if( control == IOBUFCTRL_FLUSH ) { /* encrypt */
|
||||||
assert(a);
|
log_assert(a);
|
||||||
if( !cfx->header ) {
|
if( !cfx->header ) {
|
||||||
write_header( cfx, a );
|
write_header( cfx, a );
|
||||||
}
|
}
|
||||||
|
@ -139,7 +138,7 @@ cipher_filter( void *opaque, int control,
|
||||||
(cfx->mdc_hash));
|
(cfx->mdc_hash));
|
||||||
byte temp[22];
|
byte temp[22];
|
||||||
|
|
||||||
assert( hashlen == 20 );
|
log_assert( hashlen == 20 );
|
||||||
/* We must hash the prefix of the MDC packet here. */
|
/* We must hash the prefix of the MDC packet here. */
|
||||||
temp[0] = 0xd3;
|
temp[0] = 0xd3;
|
||||||
temp[1] = 0x14;
|
temp[1] = 0x14;
|
||||||
|
|
|
@ -29,7 +29,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifdef HAVE_ZIP
|
#ifdef HAVE_ZIP
|
||||||
# include <zlib.h>
|
# include <zlib.h>
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -57,7 +56,7 @@ release_dfx_context (decode_filter_ctx_t dfx)
|
||||||
if (!dfx)
|
if (!dfx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert (dfx->refcount);
|
log_assert (dfx->refcount);
|
||||||
if ( !--dfx->refcount )
|
if ( !--dfx->refcount )
|
||||||
{
|
{
|
||||||
gcry_cipher_close (dfx->cipher_hd);
|
gcry_cipher_close (dfx->cipher_hd);
|
||||||
|
@ -273,8 +272,8 @@ decrypt_data (ctrl_t ctrl, void *procctx, PKT_encrypted *ed, DEK *dek)
|
||||||
bytes are appended. */
|
bytes are appended. */
|
||||||
int datalen = gcry_md_get_algo_dlen (ed->mdc_method);
|
int datalen = gcry_md_get_algo_dlen (ed->mdc_method);
|
||||||
|
|
||||||
assert (dfx->cipher_hd);
|
log_assert (dfx->cipher_hd);
|
||||||
assert (dfx->mdc_hash);
|
log_assert (dfx->mdc_hash);
|
||||||
gcry_cipher_decrypt (dfx->cipher_hd, dfx->defer, 22, NULL, 0);
|
gcry_cipher_decrypt (dfx->cipher_hd, dfx->defer, 22, NULL, 0);
|
||||||
gcry_md_write (dfx->mdc_hash, dfx->defer, 2);
|
gcry_md_write (dfx->mdc_hash, dfx->defer, 2);
|
||||||
gcry_md_final (dfx->mdc_hash);
|
gcry_md_final (dfx->mdc_hash);
|
||||||
|
@ -320,8 +319,8 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
|
||||||
}
|
}
|
||||||
else if( control == IOBUFCTRL_UNDERFLOW )
|
else if( control == IOBUFCTRL_UNDERFLOW )
|
||||||
{
|
{
|
||||||
assert (a);
|
log_assert (a);
|
||||||
assert (size > 44); /* Our code requires at least this size. */
|
log_assert (size > 44); /* Our code requires at least this size. */
|
||||||
|
|
||||||
/* Get at least 22 bytes and put it ahead in the buffer. */
|
/* Get at least 22 bytes and put it ahead in the buffer. */
|
||||||
if (dfx->partial)
|
if (dfx->partial)
|
||||||
|
@ -414,7 +413,7 @@ mdc_decode_filter (void *opaque, int control, IOBUF a,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert ( dfx->eof_seen );
|
log_assert ( dfx->eof_seen );
|
||||||
rc = -1; /* Return EOF. */
|
rc = -1; /* Return EOF. */
|
||||||
}
|
}
|
||||||
*ret_len = n;
|
*ret_len = n;
|
||||||
|
@ -447,7 +446,7 @@ decode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len)
|
||||||
}
|
}
|
||||||
else if ( control == IOBUFCTRL_UNDERFLOW )
|
else if ( control == IOBUFCTRL_UNDERFLOW )
|
||||||
{
|
{
|
||||||
assert(a);
|
log_assert (a);
|
||||||
|
|
||||||
if (fc->partial)
|
if (fc->partial)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
|
11
g10/ecdh.c
11
g10/ecdh.c
|
@ -22,7 +22,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -75,7 +74,7 @@ pk_ecdh_default_params (unsigned int qbits)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert (i < DIM (kek_params_table));
|
log_assert (i < DIM (kek_params_table));
|
||||||
if (DBG_CRYPTO)
|
if (DBG_CRYPTO)
|
||||||
log_printhex ("ECDH KEK params are", kek_params, sizeof(kek_params) );
|
log_printhex ("ECDH KEK params are", kek_params, sizeof(kek_params) );
|
||||||
|
|
||||||
|
@ -134,7 +133,7 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||||
}
|
}
|
||||||
|
|
||||||
secret_x_size = (nbits+7)/8;
|
secret_x_size = (nbits+7)/8;
|
||||||
assert (nbytes >= secret_x_size);
|
log_assert (nbytes >= secret_x_size);
|
||||||
if ((nbytes & 1))
|
if ((nbytes & 1))
|
||||||
/* Remove the "04" prefix of non-compressed format. */
|
/* Remove the "04" prefix of non-compressed format. */
|
||||||
memmove (secret_x, secret_x+1, secret_x_size);
|
memmove (secret_x, secret_x+1, secret_x_size);
|
||||||
|
@ -241,16 +240,16 @@ pk_ecdh_encrypt_with_shared_point (int is_encrypt, gcry_mpi_t shared_mpi,
|
||||||
|
|
||||||
gcry_md_final (h);
|
gcry_md_final (h);
|
||||||
|
|
||||||
assert( gcry_md_get_algo_dlen (kdf_hash_algo) >= 32 );
|
log_assert( gcry_md_get_algo_dlen (kdf_hash_algo) >= 32 );
|
||||||
|
|
||||||
memcpy (secret_x, gcry_md_read (h, kdf_hash_algo),
|
memcpy (secret_x, gcry_md_read (h, kdf_hash_algo),
|
||||||
gcry_md_get_algo_dlen (kdf_hash_algo));
|
gcry_md_get_algo_dlen (kdf_hash_algo));
|
||||||
gcry_md_close (h);
|
gcry_md_close (h);
|
||||||
|
|
||||||
old_size = secret_x_size;
|
old_size = secret_x_size;
|
||||||
assert( old_size >= gcry_cipher_get_algo_keylen( kdf_encr_algo ) );
|
log_assert( old_size >= gcry_cipher_get_algo_keylen( kdf_encr_algo ) );
|
||||||
secret_x_size = gcry_cipher_get_algo_keylen( kdf_encr_algo );
|
secret_x_size = gcry_cipher_get_algo_keylen( kdf_encr_algo );
|
||||||
assert( secret_x_size <= gcry_md_get_algo_dlen (kdf_hash_algo) );
|
log_assert( secret_x_size <= gcry_md_get_algo_dlen (kdf_hash_algo) );
|
||||||
|
|
||||||
/* We could have allocated more, so clean the tail before returning. */
|
/* We could have allocated more, so clean the tail before returning. */
|
||||||
memset (secret_x+secret_x_size, 0, old_size - secret_x_size);
|
memset (secret_x+secret_x_size, 0, old_size - secret_x_size);
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -80,7 +79,7 @@ encrypt_seskey (DEK *dek, DEK **seskey, byte *enckey)
|
||||||
gcry_cipher_hd_t hd;
|
gcry_cipher_hd_t hd;
|
||||||
byte buf[33];
|
byte buf[33];
|
||||||
|
|
||||||
assert ( dek->keylen <= 32 );
|
log_assert ( dek->keylen <= 32 );
|
||||||
if (!*seskey)
|
if (!*seskey)
|
||||||
{
|
{
|
||||||
*seskey=xmalloc_clear(sizeof(DEK));
|
*seskey=xmalloc_clear(sizeof(DEK));
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -781,10 +780,10 @@ transfer_format_to_openpgp (gcry_sexp_t s_pgp, PKT_public_key *pk)
|
||||||
ski->algo = protect_algo;
|
ski->algo = protect_algo;
|
||||||
ski->s2k.mode = s2k_mode;
|
ski->s2k.mode = s2k_mode;
|
||||||
ski->s2k.hash_algo = s2k_algo;
|
ski->s2k.hash_algo = s2k_algo;
|
||||||
assert (sizeof ski->s2k.salt == sizeof s2k_salt);
|
log_assert (sizeof ski->s2k.salt == sizeof s2k_salt);
|
||||||
memcpy (ski->s2k.salt, s2k_salt, sizeof s2k_salt);
|
memcpy (ski->s2k.salt, s2k_salt, sizeof s2k_salt);
|
||||||
ski->s2k.count = s2k_count;
|
ski->s2k.count = s2k_count;
|
||||||
assert (ivlen <= sizeof ski->iv);
|
log_assert (ivlen <= sizeof ski->iv);
|
||||||
memcpy (ski->iv, iv, ivlen);
|
memcpy (ski->iv, iv, ivlen);
|
||||||
ski->ivlen = ivlen;
|
ski->ivlen = ivlen;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -302,7 +301,7 @@ free_attributes(PKT_user_id *uid)
|
||||||
void
|
void
|
||||||
free_user_id (PKT_user_id *uid)
|
free_user_id (PKT_user_id *uid)
|
||||||
{
|
{
|
||||||
assert (uid->ref > 0);
|
log_assert (uid->ref > 0);
|
||||||
if (--uid->ref)
|
if (--uid->ref)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
39
g10/getkey.c
39
g10/getkey.c
|
@ -23,7 +23,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
@ -220,7 +219,7 @@ cache_public_key (PKT_public_key * pk)
|
||||||
pk_cache_entries--;
|
pk_cache_entries--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert (pk_cache_entries < MAX_PK_CACHE_ENTRIES);
|
log_assert (pk_cache_entries < MAX_PK_CACHE_ENTRIES);
|
||||||
}
|
}
|
||||||
pk_cache_entries++;
|
pk_cache_entries++;
|
||||||
ce = xmalloc (sizeof *ce);
|
ce = xmalloc (sizeof *ce);
|
||||||
|
@ -659,8 +658,8 @@ pk_from_block (GETKEY_CTX ctx, PKT_public_key * pk, KBNODE keyblock,
|
||||||
|
|
||||||
(void) ctx;
|
(void) ctx;
|
||||||
|
|
||||||
assert (a->pkt->pkttype == PKT_PUBLIC_KEY
|
log_assert (a->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| a->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| a->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
|
|
||||||
copy_public_key (pk, a->pkt->pkt.public_key);
|
copy_public_key (pk, a->pkt->pkt.public_key);
|
||||||
}
|
}
|
||||||
|
@ -779,7 +778,7 @@ get_pubkey_fast (PKT_public_key * pk, u32 * keyid)
|
||||||
KBNODE keyblock;
|
KBNODE keyblock;
|
||||||
u32 pkid[2];
|
u32 pkid[2];
|
||||||
|
|
||||||
assert (pk);
|
log_assert (pk);
|
||||||
#if MAX_PK_CACHE_ENTRIES
|
#if MAX_PK_CACHE_ENTRIES
|
||||||
{
|
{
|
||||||
/* Try to get it from the cache */
|
/* Try to get it from the cache */
|
||||||
|
@ -817,8 +816,8 @@ get_pubkey_fast (PKT_public_key * pk, u32 * keyid)
|
||||||
return GPG_ERR_NO_PUBKEY;
|
return GPG_ERR_NO_PUBKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (keyblock && keyblock->pkt
|
log_assert (keyblock && keyblock->pkt
|
||||||
&& keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
&& keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
/* We return the primary key. If KEYID matched a subkey, then we
|
/* We return the primary key. If KEYID matched a subkey, then we
|
||||||
return an error. */
|
return an error. */
|
||||||
|
@ -970,7 +969,7 @@ skip_unusable (void *dummy, u32 * keyid, int uid_no)
|
||||||
|
|
||||||
/* If UID_NO is non-zero, then the keyblock better have at least
|
/* If UID_NO is non-zero, then the keyblock better have at least
|
||||||
that many UIDs. */
|
that many UIDs. */
|
||||||
assert (uids_seen == uid_no);
|
log_assert (uids_seen == uid_no);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!unusable)
|
if (!unusable)
|
||||||
|
@ -1040,8 +1039,8 @@ key_byname (GETKEY_CTX *retctx, strlist_t namelist,
|
||||||
if (retctx)
|
if (retctx)
|
||||||
{
|
{
|
||||||
/* Reset the returned context in case of error. */
|
/* Reset the returned context in case of error. */
|
||||||
assert (!ret_kdbhd); /* Not allowed because the handle is stored
|
log_assert (!ret_kdbhd); /* Not allowed because the handle is stored
|
||||||
in the context. */
|
in the context. */
|
||||||
*retctx = NULL;
|
*retctx = NULL;
|
||||||
}
|
}
|
||||||
if (ret_kdbhd)
|
if (ret_kdbhd)
|
||||||
|
@ -1380,7 +1379,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
|
||||||
{
|
{
|
||||||
char fpr_string[MAX_FINGERPRINT_LEN * 2 + 1];
|
char fpr_string[MAX_FINGERPRINT_LEN * 2 + 1];
|
||||||
|
|
||||||
assert (fpr_len <= MAX_FINGERPRINT_LEN);
|
log_assert (fpr_len <= MAX_FINGERPRINT_LEN);
|
||||||
|
|
||||||
free_strlist (namelist);
|
free_strlist (namelist);
|
||||||
namelist = NULL;
|
namelist = NULL;
|
||||||
|
@ -1440,7 +1439,7 @@ get_pubkey_byname (ctrl_t ctrl, GETKEY_CTX * retctx, PKT_public_key * pk,
|
||||||
|
|
||||||
if (retctx && *retctx)
|
if (retctx && *retctx)
|
||||||
{
|
{
|
||||||
assert (!(*retctx)->extra_list);
|
log_assert (!(*retctx)->extra_list);
|
||||||
(*retctx)->extra_list = namelist;
|
(*retctx)->extra_list = namelist;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1564,8 +1563,8 @@ get_pubkey_byfprint_fast (PKT_public_key * pk,
|
||||||
return GPG_ERR_NO_PUBKEY;
|
return GPG_ERR_NO_PUBKEY;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY
|
log_assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| keyblock->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| keyblock->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
if (pk)
|
if (pk)
|
||||||
copy_public_key (pk, keyblock->pkt->pkt.public_key);
|
copy_public_key (pk, keyblock->pkt->pkt.public_key);
|
||||||
release_kbnode (keyblock);
|
release_kbnode (keyblock);
|
||||||
|
@ -3111,7 +3110,7 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
|
||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
|
|
||||||
|
|
||||||
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
if (ctx->exact)
|
if (ctx->exact)
|
||||||
/* Get the key or subkey that matched the low-level search
|
/* Get the key or subkey that matched the low-level search
|
||||||
|
@ -3121,8 +3120,8 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
|
||||||
{
|
{
|
||||||
if ((k->flag & 1))
|
if ((k->flag & 1))
|
||||||
{
|
{
|
||||||
assert (k->pkt->pkttype == PKT_PUBLIC_KEY
|
log_assert (k->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| k->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| k->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
foundk = k;
|
foundk = k;
|
||||||
pk = k->pkt->pkt.public_key;
|
pk = k->pkt->pkt.public_key;
|
||||||
pk->flags.exact = 1;
|
pk->flags.exact = 1;
|
||||||
|
@ -3136,7 +3135,7 @@ finish_lookup (GETKEY_CTX ctx, KBNODE keyblock)
|
||||||
{
|
{
|
||||||
if ((k->flag & 2))
|
if ((k->flag & 2))
|
||||||
{
|
{
|
||||||
assert (k->pkt->pkttype == PKT_USER_ID);
|
log_assert (k->pkt->pkttype == PKT_USER_ID);
|
||||||
foundu = k->pkt->pkt.user_id;
|
foundu = k->pkt->pkt.user_id;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3856,8 +3855,8 @@ have_secret_key_with_kid (u32 *keyid)
|
||||||
match a single key or subkey. */
|
match a single key or subkey. */
|
||||||
if ((node->flag & 1))
|
if ((node->flag & 1))
|
||||||
{
|
{
|
||||||
assert (node->pkt->pkttype == PKT_PUBLIC_KEY
|
log_assert (node->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| node->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
|
|
||||||
if (!agent_probe_secret_key (NULL, node->pkt->pkt.public_key))
|
if (!agent_probe_secret_key (NULL, node->pkt->pkt.public_key))
|
||||||
result = 1; /* Secret key available. */
|
result = 1; /* Secret key available. */
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#ifdef HAVE_STAT
|
#ifdef HAVE_STAT
|
||||||
#include <sys/stat.h> /* for stat() */
|
#include <sys/stat.h> /* for stat() */
|
||||||
#endif
|
#endif
|
||||||
|
@ -1389,7 +1388,7 @@ check_permissions (const char *path, int item)
|
||||||
if(opt.no_perm_warn)
|
if(opt.no_perm_warn)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
assert(item==0 || item==1 || item==2);
|
log_assert(item==0 || item==1 || item==2);
|
||||||
|
|
||||||
/* extensions may attach a path */
|
/* extensions may attach a path */
|
||||||
if(item==2 && path[0]!=DIRSEP_C)
|
if(item==2 && path[0]!=DIRSEP_C)
|
||||||
|
|
21
g10/import.c
21
g10/import.c
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -1835,9 +1834,9 @@ import_revoke_cert (const char *fname, kbnode_t node,
|
||||||
|
|
||||||
(void)fname;
|
(void)fname;
|
||||||
|
|
||||||
assert( !node->next );
|
log_assert (!node->next );
|
||||||
assert( node->pkt->pkttype == PKT_SIGNATURE );
|
log_assert (node->pkt->pkttype == PKT_SIGNATURE );
|
||||||
assert( node->pkt->pkt.signature->sig_class == 0x20 );
|
log_assert (node->pkt->pkt.signature->sig_class == 0x20 );
|
||||||
|
|
||||||
keyid[0] = node->pkt->pkt.signature->keyid[0];
|
keyid[0] = node->pkt->pkt.signature->keyid[0];
|
||||||
keyid[1] = node->pkt->pkt.signature->keyid[1];
|
keyid[1] = node->pkt->pkt.signature->keyid[1];
|
||||||
|
@ -2720,7 +2719,7 @@ append_uid (kbnode_t keyblock, kbnode_t node, int *n_sigs,
|
||||||
(void)fname;
|
(void)fname;
|
||||||
(void)keyid;
|
(void)keyid;
|
||||||
|
|
||||||
assert(node->pkt->pkttype == PKT_USER_ID );
|
log_assert (node->pkt->pkttype == PKT_USER_ID );
|
||||||
|
|
||||||
/* find the position */
|
/* find the position */
|
||||||
for (n = keyblock; n; n_where = n, n = n->next)
|
for (n = keyblock; n; n_where = n, n = n->next)
|
||||||
|
@ -2773,8 +2772,8 @@ merge_sigs (kbnode_t dst, kbnode_t src, int *n_sigs,
|
||||||
(void)fname;
|
(void)fname;
|
||||||
(void)keyid;
|
(void)keyid;
|
||||||
|
|
||||||
assert(dst->pkt->pkttype == PKT_USER_ID );
|
log_assert (dst->pkt->pkttype == PKT_USER_ID);
|
||||||
assert(src->pkt->pkttype == PKT_USER_ID );
|
log_assert (src->pkt->pkttype == PKT_USER_ID);
|
||||||
|
|
||||||
for (n=src->next; n && n->pkt->pkttype != PKT_USER_ID; n = n->next)
|
for (n=src->next; n && n->pkt->pkttype != PKT_USER_ID; n = n->next)
|
||||||
{
|
{
|
||||||
|
@ -2821,8 +2820,8 @@ merge_keysigs (kbnode_t dst, kbnode_t src, int *n_sigs,
|
||||||
(void)fname;
|
(void)fname;
|
||||||
(void)keyid;
|
(void)keyid;
|
||||||
|
|
||||||
assert (dst->pkt->pkttype == PKT_PUBLIC_SUBKEY
|
log_assert (dst->pkt->pkttype == PKT_PUBLIC_SUBKEY
|
||||||
|| dst->pkt->pkttype == PKT_SECRET_SUBKEY);
|
|| dst->pkt->pkttype == PKT_SECRET_SUBKEY);
|
||||||
|
|
||||||
for (n=src->next; n ; n = n->next)
|
for (n=src->next; n ; n = n->next)
|
||||||
{
|
{
|
||||||
|
@ -2882,8 +2881,8 @@ append_key (kbnode_t keyblock, kbnode_t node, int *n_sigs,
|
||||||
(void)fname;
|
(void)fname;
|
||||||
(void)keyid;
|
(void)keyid;
|
||||||
|
|
||||||
assert( node->pkt->pkttype == PKT_PUBLIC_SUBKEY
|
log_assert (node->pkt->pkttype == PKT_PUBLIC_SUBKEY
|
||||||
|| node->pkt->pkttype == PKT_SECRET_SUBKEY );
|
|| node->pkt->pkttype == PKT_SECRET_SUBKEY);
|
||||||
|
|
||||||
while (node)
|
while (node)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
11
g10/keydb.c
11
g10/keydb.c
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -861,7 +860,7 @@ keydb_new (void)
|
||||||
hd->saved_found = -1;
|
hd->saved_found = -1;
|
||||||
hd->is_reset = 1;
|
hd->is_reset = 1;
|
||||||
|
|
||||||
assert (used_resources <= MAX_KEYDB_RESOURCES);
|
log_assert (used_resources <= MAX_KEYDB_RESOURCES);
|
||||||
for (i=j=0; ! die && i < used_resources; i++)
|
for (i=j=0; ! die && i < used_resources; i++)
|
||||||
{
|
{
|
||||||
switch (all_resources[i].type)
|
switch (all_resources[i].type)
|
||||||
|
@ -919,7 +918,7 @@ keydb_release (KEYDB_HANDLE hd)
|
||||||
|
|
||||||
if (!hd)
|
if (!hd)
|
||||||
return;
|
return;
|
||||||
assert (active_handles > 0);
|
log_assert (active_handles > 0);
|
||||||
active_handles--;
|
active_handles--;
|
||||||
|
|
||||||
unlock_all (hd);
|
unlock_all (hd);
|
||||||
|
@ -1521,8 +1520,8 @@ keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb)
|
||||||
KEYDB_SEARCH_DESC desc;
|
KEYDB_SEARCH_DESC desc;
|
||||||
size_t len;
|
size_t len;
|
||||||
|
|
||||||
assert (kb);
|
log_assert (kb);
|
||||||
assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
pk = kb->pkt->pkt.public_key;
|
pk = kb->pkt->pkt.public_key;
|
||||||
|
|
||||||
if (!hd)
|
if (!hd)
|
||||||
|
@ -1549,7 +1548,7 @@ keydb_update_keyblock (KEYDB_HANDLE hd, kbnode_t kb)
|
||||||
err = keydb_search (hd, &desc, 1, NULL);
|
err = keydb_search (hd, &desc, 1, NULL);
|
||||||
if (err)
|
if (err)
|
||||||
return gpg_error (GPG_ERR_VALUE_NOT_FOUND);
|
return gpg_error (GPG_ERR_VALUE_NOT_FOUND);
|
||||||
assert (hd->found >= 0 && hd->found < hd->used);
|
log_assert (hd->found >= 0 && hd->found < hd->used);
|
||||||
|
|
||||||
switch (hd->active[hd->found].type)
|
switch (hd->active[hd->found].type)
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#ifdef HAVE_LIBREADLINE
|
#ifdef HAVE_LIBREADLINE
|
||||||
# define GNUPG_LIBREADLINE_H_INCLUDED
|
# define GNUPG_LIBREADLINE_H_INCLUDED
|
||||||
|
@ -339,8 +338,8 @@ sig_comparison (const void *av, const void *bv)
|
||||||
int ndatab;
|
int ndatab;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert (an->pkt->pkttype == PKT_SIGNATURE);
|
log_assert (an->pkt->pkttype == PKT_SIGNATURE);
|
||||||
assert (bn->pkt->pkttype == PKT_SIGNATURE);
|
log_assert (bn->pkt->pkttype == PKT_SIGNATURE);
|
||||||
|
|
||||||
a = an->pkt->pkt.signature;
|
a = an->pkt->pkt.signature;
|
||||||
b = bn->pkt->pkt.signature;
|
b = bn->pkt->pkt.signature;
|
||||||
|
@ -352,7 +351,7 @@ sig_comparison (const void *av, const void *bv)
|
||||||
|
|
||||||
ndataa = pubkey_get_nsig (a->pubkey_algo);
|
ndataa = pubkey_get_nsig (a->pubkey_algo);
|
||||||
ndatab = pubkey_get_nsig (a->pubkey_algo);
|
ndatab = pubkey_get_nsig (a->pubkey_algo);
|
||||||
assert (ndataa == ndatab);
|
log_assert (ndataa == ndatab);
|
||||||
|
|
||||||
for (i = 0; i < ndataa; i ++)
|
for (i = 0; i < ndataa; i ++)
|
||||||
{
|
{
|
||||||
|
@ -399,7 +398,7 @@ check_all_keysigs (KBNODE kb, int only_selected, int only_selfsigs)
|
||||||
int missing_selfsig = 0;
|
int missing_selfsig = 0;
|
||||||
int modified = 0;
|
int modified = 0;
|
||||||
|
|
||||||
assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
pk = kb->pkt->pkt.public_key;
|
pk = kb->pkt->pkt.public_key;
|
||||||
|
|
||||||
/* First we look for duplicates. */
|
/* First we look for duplicates. */
|
||||||
|
@ -431,17 +430,17 @@ check_all_keysigs (KBNODE kb, int only_selected, int only_selfsigs)
|
||||||
sigs[i] = n;
|
sigs[i] = n;
|
||||||
i ++;
|
i ++;
|
||||||
}
|
}
|
||||||
assert (i == nsigs);
|
log_assert (i == nsigs);
|
||||||
|
|
||||||
qsort (sigs, nsigs, sizeof (sigs[0]), sig_comparison);
|
qsort (sigs, nsigs, sizeof (sigs[0]), sig_comparison);
|
||||||
|
|
||||||
last_i = 0;
|
last_i = 0;
|
||||||
for (i = 1; i < nsigs; i ++)
|
for (i = 1; i < nsigs; i ++)
|
||||||
{
|
{
|
||||||
assert (sigs[last_i]);
|
log_assert (sigs[last_i]);
|
||||||
assert (sigs[last_i]->pkt->pkttype == PKT_SIGNATURE);
|
log_assert (sigs[last_i]->pkt->pkttype == PKT_SIGNATURE);
|
||||||
assert (sigs[i]);
|
log_assert (sigs[i]);
|
||||||
assert (sigs[i]->pkt->pkttype == PKT_SIGNATURE);
|
log_assert (sigs[i]->pkt->pkttype == PKT_SIGNATURE);
|
||||||
|
|
||||||
if (sig_comparison (&sigs[last_i], &sigs[i]) == 0)
|
if (sig_comparison (&sigs[last_i], &sigs[i]) == 0)
|
||||||
/* They are the same. Kill the latter. */
|
/* They are the same. Kill the latter. */
|
||||||
|
@ -519,7 +518,7 @@ check_all_keysigs (KBNODE kb, int only_selected, int only_selfsigs)
|
||||||
switch (p->pkttype)
|
switch (p->pkttype)
|
||||||
{
|
{
|
||||||
case PKT_PUBLIC_KEY:
|
case PKT_PUBLIC_KEY:
|
||||||
assert (p->pkt.public_key == pk);
|
log_assert (p->pkt.public_key == pk);
|
||||||
if (only_selected && ! (n->flag & NODFLG_SELKEY))
|
if (only_selected && ! (n->flag & NODFLG_SELKEY))
|
||||||
{
|
{
|
||||||
current_component = NULL;
|
current_component = NULL;
|
||||||
|
@ -658,9 +657,9 @@ check_all_keysigs (KBNODE kb, int only_selected, int only_selfsigs)
|
||||||
}
|
}
|
||||||
else if (n2)
|
else if (n2)
|
||||||
{
|
{
|
||||||
assert (n2->pkt->pkttype == PKT_USER_ID
|
log_assert (n2->pkt->pkttype == PKT_USER_ID
|
||||||
|| n2->pkt->pkttype == PKT_PUBLIC_KEY
|
|| n2->pkt->pkttype == PKT_PUBLIC_KEY
|
||||||
|| n2->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
|| n2->pkt->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
|
|
||||||
if (DBG_PACKET)
|
if (DBG_PACKET)
|
||||||
{
|
{
|
||||||
|
@ -681,7 +680,7 @@ check_all_keysigs (KBNODE kb, int only_selected, int only_selfsigs)
|
||||||
after n2. */
|
after n2. */
|
||||||
|
|
||||||
/* Unlink the signature. */
|
/* Unlink the signature. */
|
||||||
assert (n_prevp);
|
log_assert (n_prevp);
|
||||||
*n_prevp = n->next;
|
*n_prevp = n->next;
|
||||||
|
|
||||||
/* Insert the sig immediately after the component. */
|
/* Insert the sig immediately after the component. */
|
||||||
|
@ -1577,7 +1576,7 @@ sign_uids (ctrl_t ctrl, estream_t fp,
|
||||||
PKT_signature *sig;
|
PKT_signature *sig;
|
||||||
struct sign_attrib attrib;
|
struct sign_attrib attrib;
|
||||||
|
|
||||||
assert (primary_pk);
|
log_assert (primary_pk);
|
||||||
memset (&attrib, 0, sizeof attrib);
|
memset (&attrib, 0, sizeof attrib);
|
||||||
attrib.non_exportable = local;
|
attrib.non_exportable = local;
|
||||||
attrib.non_revocable = nonrevocable;
|
attrib.non_revocable = nonrevocable;
|
||||||
|
@ -2639,7 +2638,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
|
||||||
case cmdPREF:
|
case cmdPREF:
|
||||||
{
|
{
|
||||||
int count = count_selected_uids (keyblock);
|
int count = count_selected_uids (keyblock);
|
||||||
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
show_names (NULL, keyblock, keyblock->pkt->pkt.public_key,
|
show_names (NULL, keyblock, keyblock->pkt->pkt.public_key,
|
||||||
count ? NODFLG_SELUID : 0, 1);
|
count ? NODFLG_SELUID : 0, 1);
|
||||||
}
|
}
|
||||||
|
@ -2648,7 +2647,7 @@ keyedit_menu (ctrl_t ctrl, const char *username, strlist_t locusr,
|
||||||
case cmdSHOWPREF:
|
case cmdSHOWPREF:
|
||||||
{
|
{
|
||||||
int count = count_selected_uids (keyblock);
|
int count = count_selected_uids (keyblock);
|
||||||
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
show_names (NULL, keyblock, keyblock->pkt->pkt.public_key,
|
show_names (NULL, keyblock, keyblock->pkt->pkt.public_key,
|
||||||
count ? NODFLG_SELUID : 0, 2);
|
count ? NODFLG_SELUID : 0, 2);
|
||||||
}
|
}
|
||||||
|
@ -4052,7 +4051,7 @@ menu_adduid (kbnode_t pub_keyblock, int photo, const char *photo_name,
|
||||||
}
|
}
|
||||||
if (!node) /* No subkey. */
|
if (!node) /* No subkey. */
|
||||||
pub_where = NULL;
|
pub_where = NULL;
|
||||||
assert (pk);
|
log_assert (pk);
|
||||||
|
|
||||||
if (photo)
|
if (photo)
|
||||||
{
|
{
|
||||||
|
@ -4349,7 +4348,7 @@ menu_addrevoker (ctrl_t ctrl, kbnode_t pub_keyblock, int sensitive)
|
||||||
size_t fprlen;
|
size_t fprlen;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
assert (pub_keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (pub_keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
pk = pub_keyblock->pkt->pkt.public_key;
|
pk = pub_keyblock->pkt->pkt.public_key;
|
||||||
|
|
||||||
|
@ -4736,7 +4735,7 @@ menu_backsign (KBNODE pub_keyblock)
|
||||||
KBNODE node;
|
KBNODE node;
|
||||||
u32 timestamp;
|
u32 timestamp;
|
||||||
|
|
||||||
assert (pub_keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (pub_keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
merge_keys_and_selfsig (pub_keyblock);
|
merge_keys_and_selfsig (pub_keyblock);
|
||||||
main_pk = pub_keyblock->pkt->pkt.public_key;
|
main_pk = pub_keyblock->pkt->pkt.public_key;
|
||||||
|
@ -5485,7 +5484,7 @@ menu_select_uid_namehash (KBNODE keyblock, const char *namehash)
|
||||||
KBNODE node;
|
KBNODE node;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
assert (strlen (namehash) == NAMEHASH_LEN * 2);
|
log_assert (strlen (namehash) == NAMEHASH_LEN * 2);
|
||||||
|
|
||||||
for (i = 0; i < NAMEHASH_LEN; i++)
|
for (i = 0; i < NAMEHASH_LEN; i++)
|
||||||
hash[i] = hextobyte (&namehash[i * 2]);
|
hash[i] = hextobyte (&namehash[i * 2]);
|
||||||
|
@ -5819,7 +5818,7 @@ menu_revsig (KBNODE keyblock)
|
||||||
int rc, any, skip = 1, all = !count_selected_uids (keyblock);
|
int rc, any, skip = 1, all = !count_selected_uids (keyblock);
|
||||||
struct revocation_reason_info *reason = NULL;
|
struct revocation_reason_info *reason = NULL;
|
||||||
|
|
||||||
assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
/* First check whether we have any signatures at all. */
|
/* First check whether we have any signatures at all. */
|
||||||
any = 0;
|
any = 0;
|
||||||
|
@ -5960,7 +5959,7 @@ reloop: /* (must use this, because we are modifing the list) */
|
||||||
|| node->pkt->pkttype != PKT_SIGNATURE)
|
|| node->pkt->pkttype != PKT_SIGNATURE)
|
||||||
continue;
|
continue;
|
||||||
unode = find_prev_kbnode (keyblock, node, PKT_USER_ID);
|
unode = find_prev_kbnode (keyblock, node, PKT_USER_ID);
|
||||||
assert (unode); /* we already checked this */
|
log_assert (unode); /* we already checked this */
|
||||||
|
|
||||||
memset (&attrib, 0, sizeof attrib);
|
memset (&attrib, 0, sizeof attrib);
|
||||||
attrib.reason = reason;
|
attrib.reason = reason;
|
||||||
|
|
25
g10/keygen.c
25
g10/keygen.c
|
@ -24,7 +24,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
@ -1371,7 +1370,7 @@ gen_elg (int algo, unsigned int nbits, KBNODE pub_root,
|
||||||
char *keyparms;
|
char *keyparms;
|
||||||
char nbitsstr[35];
|
char nbitsstr[35];
|
||||||
|
|
||||||
assert (is_ELGAMAL (algo));
|
log_assert (is_ELGAMAL (algo));
|
||||||
|
|
||||||
if (nbits < 1024)
|
if (nbits < 1024)
|
||||||
{
|
{
|
||||||
|
@ -1513,9 +1512,9 @@ gen_ecc (int algo, const char *curve, kbnode_t pub_root,
|
||||||
gpg_error_t err;
|
gpg_error_t err;
|
||||||
char *keyparms;
|
char *keyparms;
|
||||||
|
|
||||||
assert (algo == PUBKEY_ALGO_ECDSA
|
log_assert (algo == PUBKEY_ALGO_ECDSA
|
||||||
|| algo == PUBKEY_ALGO_EDDSA
|
|| algo == PUBKEY_ALGO_EDDSA
|
||||||
|| algo == PUBKEY_ALGO_ECDH);
|
|| algo == PUBKEY_ALGO_ECDH);
|
||||||
|
|
||||||
if (!curve || !*curve)
|
if (!curve || !*curve)
|
||||||
return gpg_error (GPG_ERR_UNKNOWN_CURVE);
|
return gpg_error (GPG_ERR_UNKNOWN_CURVE);
|
||||||
|
@ -1571,7 +1570,7 @@ gen_rsa (int algo, unsigned int nbits, KBNODE pub_root,
|
||||||
char nbitsstr[35];
|
char nbitsstr[35];
|
||||||
const unsigned maxsize = (opt.flags.large_rsa ? 8192 : 4096);
|
const unsigned maxsize = (opt.flags.large_rsa ? 8192 : 4096);
|
||||||
|
|
||||||
assert (is_RSA(algo));
|
log_assert (is_RSA(algo));
|
||||||
|
|
||||||
if (!nbits)
|
if (!nbits)
|
||||||
nbits = DEFAULT_STD_KEYSIZE;
|
nbits = DEFAULT_STD_KEYSIZE;
|
||||||
|
@ -2794,7 +2793,7 @@ generate_user_id (KBNODE keyblock, const char *uidstr)
|
||||||
static void
|
static void
|
||||||
append_to_parameter (struct para_data_s *para, struct para_data_s *r)
|
append_to_parameter (struct para_data_s *para, struct para_data_s *r)
|
||||||
{
|
{
|
||||||
assert (para);
|
log_assert (para);
|
||||||
while (para->next)
|
while (para->next)
|
||||||
para = para->next;
|
para = para->next;
|
||||||
para->next = r;
|
para->next = r;
|
||||||
|
@ -4034,7 +4033,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
|
||||||
push_armor_filter (outctrl->pub.afx, outctrl->pub.stream);
|
push_armor_filter (outctrl->pub.afx, outctrl->pub.stream);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert( outctrl->pub.stream );
|
log_assert( outctrl->pub.stream );
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
log_info (_("writing public key to '%s'\n"), outctrl->pub.fname );
|
log_info (_("writing public key to '%s'\n"), outctrl->pub.fname );
|
||||||
}
|
}
|
||||||
|
@ -4079,7 +4078,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
|
||||||
if (!err)
|
if (!err)
|
||||||
{
|
{
|
||||||
pri_psk = pub_root->next->pkt->pkt.public_key;
|
pri_psk = pub_root->next->pkt->pkt.public_key;
|
||||||
assert (pri_psk);
|
log_assert (pri_psk);
|
||||||
|
|
||||||
/* Make sure a few fields are correctly set up before going
|
/* Make sure a few fields are correctly set up before going
|
||||||
further. */
|
further. */
|
||||||
|
@ -4141,7 +4140,7 @@ do_generate_keypair (ctrl_t ctrl, struct para_data_s *para,
|
||||||
for (node = pub_root; node; node = node->next)
|
for (node = pub_root; node; node = node->next)
|
||||||
if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
|
if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
|
||||||
sub_psk = node->pkt->pkt.public_key;
|
sub_psk = node->pkt->pkt.public_key;
|
||||||
assert (sub_psk);
|
log_assert (sub_psk);
|
||||||
|
|
||||||
if (s)
|
if (s)
|
||||||
err = card_store_key_with_backup (ctrl, sub_psk, opt.homedir);
|
err = card_store_key_with_backup (ctrl, sub_psk, opt.homedir);
|
||||||
|
@ -4327,7 +4326,7 @@ generate_subkeypair (ctrl_t ctrl, kbnode_t keyblock)
|
||||||
xfree (hexgrip);
|
xfree (hexgrip);
|
||||||
hexgrip = NULL;
|
hexgrip = NULL;
|
||||||
algo = ask_algo (ctrl, 1, NULL, &use, &hexgrip);
|
algo = ask_algo (ctrl, 1, NULL, &use, &hexgrip);
|
||||||
assert (algo);
|
log_assert (algo);
|
||||||
|
|
||||||
if (hexgrip)
|
if (hexgrip)
|
||||||
nbits = 0;
|
nbits = 0;
|
||||||
|
@ -4392,7 +4391,7 @@ generate_card_subkeypair (kbnode_t pub_keyblock,
|
||||||
u32 cur_time;
|
u32 cur_time;
|
||||||
struct para_data_s *para = NULL;
|
struct para_data_s *para = NULL;
|
||||||
|
|
||||||
assert (keyno >= 1 && keyno <= 3);
|
log_assert (keyno >= 1 && keyno <= 3);
|
||||||
|
|
||||||
para = xtrycalloc (1, sizeof *para + strlen (serialno) );
|
para = xtrycalloc (1, sizeof *para + strlen (serialno) );
|
||||||
if (!para)
|
if (!para)
|
||||||
|
@ -4462,7 +4461,7 @@ generate_card_subkeypair (kbnode_t pub_keyblock,
|
||||||
for (node = pub_keyblock; node; node = node->next)
|
for (node = pub_keyblock; node; node = node->next)
|
||||||
if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
|
if (node->pkt->pkttype == PKT_PUBLIC_SUBKEY)
|
||||||
sub_pk = node->pkt->pkt.public_key;
|
sub_pk = node->pkt->pkt.public_key;
|
||||||
assert (sub_pk);
|
log_assert (sub_pk);
|
||||||
err = write_keybinding (pub_keyblock, pri_pk, sub_pk,
|
err = write_keybinding (pub_keyblock, pri_pk, sub_pk,
|
||||||
use, cur_time, NULL);
|
use, cur_time, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -767,7 +766,7 @@ fingerprint_from_pk (PKT_public_key *pk, byte *array, size_t *ret_len)
|
||||||
md = do_fingerprint_md(pk);
|
md = do_fingerprint_md(pk);
|
||||||
dp = gcry_md_read( md, 0 );
|
dp = gcry_md_read( md, 0 );
|
||||||
len = gcry_md_get_algo_dlen (gcry_md_get_algo (md));
|
len = gcry_md_get_algo_dlen (gcry_md_get_algo (md));
|
||||||
assert( len <= MAX_FINGERPRINT_LEN );
|
log_assert( len <= MAX_FINGERPRINT_LEN );
|
||||||
if (!array)
|
if (!array)
|
||||||
array = xmalloc ( len );
|
array = xmalloc ( len );
|
||||||
memcpy (array, dp, len );
|
memcpy (array, dp, len );
|
||||||
|
@ -849,7 +848,7 @@ format_hexfingerprint (const char *fingerprint, char *buffer, size_t buflen)
|
||||||
buffer[j ++] = fingerprint[i];
|
buffer[j ++] = fingerprint[i];
|
||||||
}
|
}
|
||||||
buffer[j ++] = 0;
|
buffer[j ++] = 0;
|
||||||
assert (j == space);
|
log_assert (j == space);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -24,9 +24,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
#include <fcntl.h> /* for setmode() */
|
# include <fcntl.h> /* for setmode() */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
@ -799,7 +798,7 @@ print_subpackets_colon (PKT_signature * sig)
|
||||||
{
|
{
|
||||||
byte *i;
|
byte *i;
|
||||||
|
|
||||||
assert (opt.show_subpackets);
|
log_assert (opt.show_subpackets);
|
||||||
|
|
||||||
for (i = opt.show_subpackets; *i; i++)
|
for (i = opt.show_subpackets; *i; i++)
|
||||||
{
|
{
|
||||||
|
@ -1788,9 +1787,9 @@ do_reorder_keyblock (KBNODE keyblock, int attr)
|
||||||
if (node->pkt->pkttype == PKT_USER_ID)
|
if (node->pkt->pkttype == PKT_USER_ID)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
assert (node);
|
log_assert (node);
|
||||||
assert (last); /* The user ID is never the first packet. */
|
log_assert (last); /* The user ID is never the first packet. */
|
||||||
assert (primary0); /* Ditto (this is the node before primary). */
|
log_assert (primary0); /* Ditto (this is the node before primary). */
|
||||||
if (node == primary)
|
if (node == primary)
|
||||||
return; /* Already the first one. */
|
return; /* Already the first one. */
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -243,7 +242,7 @@ keyring_new (void *token)
|
||||||
KEYRING_HANDLE hd;
|
KEYRING_HANDLE hd;
|
||||||
KR_RESOURCE resource = token;
|
KR_RESOURCE resource = token;
|
||||||
|
|
||||||
assert (resource);
|
log_assert (resource);
|
||||||
|
|
||||||
hd = xtrycalloc (1, sizeof *hd);
|
hd = xtrycalloc (1, sizeof *hd);
|
||||||
if (!hd)
|
if (!hd)
|
||||||
|
@ -258,7 +257,7 @@ keyring_release (KEYRING_HANDLE hd)
|
||||||
{
|
{
|
||||||
if (!hd)
|
if (!hd)
|
||||||
return;
|
return;
|
||||||
assert (active_handles > 0);
|
log_assert (active_handles > 0);
|
||||||
active_handles--;
|
active_handles--;
|
||||||
xfree (hd->word_match.name);
|
xfree (hd->word_match.name);
|
||||||
xfree (hd->word_match.pattern);
|
xfree (hd->word_match.pattern);
|
||||||
|
@ -691,7 +690,7 @@ keyring_delete_keyblock (KEYRING_HANDLE hd)
|
||||||
int
|
int
|
||||||
keyring_search_reset (KEYRING_HANDLE hd)
|
keyring_search_reset (KEYRING_HANDLE hd)
|
||||||
{
|
{
|
||||||
assert (hd);
|
log_assert (hd);
|
||||||
|
|
||||||
hd->current.kr = NULL;
|
hd->current.kr = NULL;
|
||||||
iobuf_close (hd->current.iobuf);
|
iobuf_close (hd->current.iobuf);
|
||||||
|
@ -752,7 +751,7 @@ prepare_search (KEYRING_HANDLE hd)
|
||||||
hd->current.eof = 1;
|
hd->current.eof = 1;
|
||||||
return -1; /* keyring not available */
|
return -1; /* keyring not available */
|
||||||
}
|
}
|
||||||
assert (!hd->current.iobuf);
|
log_assert (!hd->current.iobuf);
|
||||||
}
|
}
|
||||||
else { /* EOF */
|
else { /* EOF */
|
||||||
if (DBG_LOOKUP)
|
if (DBG_LOOKUP)
|
||||||
|
@ -1084,7 +1083,7 @@ keyring_search (KEYRING_HANDLE hd, KEYDB_SEARCH_DESC *desc,
|
||||||
if (desc[n].mode == KEYDB_SEARCH_MODE_WORDS)
|
if (desc[n].mode == KEYDB_SEARCH_MODE_WORDS)
|
||||||
name = desc[n].u.name;
|
name = desc[n].u.name;
|
||||||
}
|
}
|
||||||
assert (name);
|
log_assert (name);
|
||||||
if ( !hd->word_match.name || strcmp (hd->word_match.name, name) )
|
if ( !hd->word_match.name || strcmp (hd->word_match.name, name) )
|
||||||
{
|
{
|
||||||
/* name changed */
|
/* name changed */
|
||||||
|
@ -1713,7 +1712,7 @@ do_copy (int mode, const char *fname, KBNODE root,
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
/* skip this keyblock */
|
/* skip this keyblock */
|
||||||
assert( n_packets );
|
log_assert( n_packets );
|
||||||
rc = skip_some_packets( fp, n_packets );
|
rc = skip_some_packets( fp, n_packets );
|
||||||
if( rc ) {
|
if( rc ) {
|
||||||
log_error("%s: skipping %u packets failed: %s\n",
|
log_error("%s: skipping %u packets failed: %s\n",
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
@ -243,7 +242,7 @@ parse_keyserver_uri (const char *string,int require_scheme)
|
||||||
int count;
|
int count;
|
||||||
char *uri,*options;
|
char *uri,*options;
|
||||||
|
|
||||||
assert(string!=NULL);
|
log_assert (string);
|
||||||
|
|
||||||
keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
|
keyserver=xmalloc_clear(sizeof(struct keyserver_spec));
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
@ -855,7 +854,7 @@ do_check_sig (CTX c, kbnode_t node, int *is_selfsig,
|
||||||
gcry_md_hd_t md_good = NULL;
|
gcry_md_hd_t md_good = NULL;
|
||||||
int algo, rc;
|
int algo, rc;
|
||||||
|
|
||||||
assert (node->pkt->pkttype == PKT_SIGNATURE);
|
log_assert (node->pkt->pkttype == PKT_SIGNATURE);
|
||||||
if (is_selfsig)
|
if (is_selfsig)
|
||||||
*is_selfsig = 0;
|
*is_selfsig = 0;
|
||||||
sig = node->pkt->pkt.signature;
|
sig = node->pkt->pkt.signature;
|
||||||
|
@ -1523,7 +1522,7 @@ pka_uri_from_sig (CTX c, PKT_signature *sig)
|
||||||
{
|
{
|
||||||
if (!sig->flags.pka_tried)
|
if (!sig->flags.pka_tried)
|
||||||
{
|
{
|
||||||
assert (!sig->pka_info);
|
log_assert (!sig->pka_info);
|
||||||
sig->flags.pka_tried = 1;
|
sig->flags.pka_tried = 1;
|
||||||
sig->pka_info = get_pka_address (sig);
|
sig->pka_info = get_pka_address (sig);
|
||||||
if (sig->pka_info)
|
if (sig->pka_info)
|
||||||
|
@ -1637,7 +1636,7 @@ check_sig_and_print (CTX c, kbnode_t node)
|
||||||
/* dump_kbnode (c->list); */
|
/* dump_kbnode (c->list); */
|
||||||
|
|
||||||
n = c->list;
|
n = c->list;
|
||||||
assert (n);
|
log_assert (n);
|
||||||
if ( n->pkt->pkttype == PKT_SIGNATURE )
|
if ( n->pkt->pkttype == PKT_SIGNATURE )
|
||||||
{
|
{
|
||||||
/* This is either "S{1,n}" case (detached signature) or
|
/* This is either "S{1,n}" case (detached signature) or
|
||||||
|
@ -1864,7 +1863,7 @@ check_sig_and_print (CTX c, kbnode_t node)
|
||||||
if (un->pkt->pkt.user_id->attrib_data)
|
if (un->pkt->pkt.user_id->attrib_data)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
assert (pk);
|
log_assert (pk);
|
||||||
|
|
||||||
/* Since this is just informational, don't actually ask the
|
/* Since this is just informational, don't actually ask the
|
||||||
user to update any trust information. (Note: we register
|
user to update any trust information. (Note: we register
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
|
@ -69,8 +69,6 @@
|
||||||
#include "i18n.h"
|
#include "i18n.h"
|
||||||
#include "zb32.h"
|
#include "zb32.h"
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef ENABLE_SELINUX_HACKS
|
#ifdef ENABLE_SELINUX_HACKS
|
||||||
/* A object and a global variable to keep track of files marked as
|
/* A object and a global variable to keep track of files marked as
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -487,7 +486,7 @@ parse (IOBUF inp, PACKET * pkt, int onlykeypkts, off_t * retpos,
|
||||||
off_t pos;
|
off_t pos;
|
||||||
|
|
||||||
*skip = 0;
|
*skip = 0;
|
||||||
assert (!pkt->pkt.generic);
|
log_assert (!pkt->pkt.generic);
|
||||||
if (retpos || list_mode)
|
if (retpos || list_mode)
|
||||||
{
|
{
|
||||||
pos = iobuf_tell (inp);
|
pos = iobuf_tell (inp);
|
||||||
|
@ -1114,7 +1113,7 @@ parse_symkeyenc (IOBUF inp, int pkttype, unsigned long pktlen,
|
||||||
log_info (_("WARNING: potentially insecure symmetrically"
|
log_info (_("WARNING: potentially insecure symmetrically"
|
||||||
" encrypted session key\n"));
|
" encrypted session key\n"));
|
||||||
}
|
}
|
||||||
assert (!pktlen);
|
log_assert (!pktlen);
|
||||||
|
|
||||||
if (list_mode)
|
if (list_mode)
|
||||||
{
|
{
|
||||||
|
@ -2421,7 +2420,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
|
||||||
* NOTE: if you change the ivlen above 16, don't forget to
|
* NOTE: if you change the ivlen above 16, don't forget to
|
||||||
* enlarge temp. */
|
* enlarge temp. */
|
||||||
ski->ivlen = openpgp_cipher_blocklen (ski->algo);
|
ski->ivlen = openpgp_cipher_blocklen (ski->algo);
|
||||||
assert (ski->ivlen <= sizeof (temp));
|
log_assert (ski->ivlen <= sizeof (temp));
|
||||||
|
|
||||||
if (ski->s2k.mode == 1001)
|
if (ski->s2k.mode == 1001)
|
||||||
ski->ivlen = 0;
|
ski->ivlen = 0;
|
||||||
|
@ -2660,7 +2659,7 @@ parse_user_id (IOBUF inp, int pkttype, unsigned long pktlen, PACKET * packet)
|
||||||
void
|
void
|
||||||
make_attribute_uidname (PKT_user_id * uid, size_t max_namelen)
|
make_attribute_uidname (PKT_user_id * uid, size_t max_namelen)
|
||||||
{
|
{
|
||||||
assert (max_namelen > 70);
|
log_assert (max_namelen > 70);
|
||||||
if (uid->numattribs <= 0)
|
if (uid->numattribs <= 0)
|
||||||
sprintf (uid->name, "[bad attribute packet of size %lu]",
|
sprintf (uid->name, "[bad attribute packet of size %lu]",
|
||||||
uid->attrib_len);
|
uid->attrib_len);
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#ifdef HAVE_LOCALE_H
|
#ifdef HAVE_LOCALE_H
|
||||||
#include <locale.h>
|
#include <locale.h>
|
||||||
|
@ -425,7 +424,7 @@ passphrase_to_dek_ext (u32 *keyid, int pubkey_algo,
|
||||||
|
|
||||||
if ( !s2k )
|
if ( !s2k )
|
||||||
{
|
{
|
||||||
assert (mode != 3 && mode != 4);
|
log_assert (mode != 3 && mode != 4);
|
||||||
/* This is used for the old rfc1991 mode
|
/* This is used for the old rfc1991 mode
|
||||||
* Note: This must match the code in encode.c with opt.rfc1991 set */
|
* Note: This must match the code in encode.c with opt.rfc1991 set */
|
||||||
s2k = &help_s2k;
|
s2k = &help_s2k;
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -40,9 +39,9 @@ get_mpi_from_sexp (gcry_sexp_t sexp, const char *item, int mpifmt)
|
||||||
gcry_mpi_t data;
|
gcry_mpi_t data;
|
||||||
|
|
||||||
list = gcry_sexp_find_token (sexp, item, 0);
|
list = gcry_sexp_find_token (sexp, item, 0);
|
||||||
assert (list);
|
log_assert (list);
|
||||||
data = gcry_sexp_nth_mpi (list, 1, mpifmt);
|
data = gcry_sexp_nth_mpi (list, 1, mpifmt);
|
||||||
assert (data);
|
log_assert (data);
|
||||||
gcry_sexp_release (list);
|
gcry_sexp_release (list);
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
#ifdef HAVE_DOSISH_SYSTEM
|
||||||
# include <fcntl.h> /* for setmode() */
|
# include <fcntl.h> /* for setmode() */
|
||||||
|
@ -636,7 +635,7 @@ ask_for_detached_datafile (gcry_md_hd_t md, gcry_md_hd_t md2,
|
||||||
if (opt.verbose)
|
if (opt.verbose)
|
||||||
log_info (_("reading stdin ...\n"));
|
log_info (_("reading stdin ...\n"));
|
||||||
fp = iobuf_open (NULL);
|
fp = iobuf_open (NULL);
|
||||||
assert (fp);
|
log_assert (fp);
|
||||||
}
|
}
|
||||||
do_hash (md, md2, fp, textmode);
|
do_hash (md, md2, fp, textmode);
|
||||||
iobuf_close (fp);
|
iobuf_close (fp);
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "iobuf.h"
|
#include "iobuf.h"
|
||||||
|
@ -64,7 +63,7 @@ release_progress_context (progress_filter_context_t *pfx)
|
||||||
{
|
{
|
||||||
if (!pfx)
|
if (!pfx)
|
||||||
return;
|
return;
|
||||||
assert (pfx->refcount);
|
log_assert (pfx->refcount);
|
||||||
if ( --pfx->refcount )
|
if ( --pfx->refcount )
|
||||||
return;
|
return;
|
||||||
xfree (pfx->what);
|
xfree (pfx->what);
|
||||||
|
@ -143,8 +142,8 @@ handle_progress (progress_filter_context_t *pfx, IOBUF inp, const char *name)
|
||||||
if (!pfx)
|
if (!pfx)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
assert (opt.enable_progress_filter);
|
log_assert (opt.enable_progress_filter);
|
||||||
assert (is_status_enabled ());
|
log_assert (is_status_enabled ());
|
||||||
|
|
||||||
if ( !iobuf_is_pipe_filename (name) && *name )
|
if ( !iobuf_is_pipe_filename (name) && *name )
|
||||||
filesize = iobuf_get_filelength (inp, NULL);
|
filesize = iobuf_get_filelength (inp, NULL);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -197,7 +196,7 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
|
||||||
if (sk->pubkey_algo == PUBKEY_ALGO_ECDH)
|
if (sk->pubkey_algo == PUBKEY_ALGO_ECDH)
|
||||||
{
|
{
|
||||||
fingerprint_from_pk (sk, fp, &fpn);
|
fingerprint_from_pk (sk, fp, &fpn);
|
||||||
assert (fpn == 20);
|
log_assert (fpn == 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Decrypt. */
|
/* Decrypt. */
|
||||||
|
@ -267,7 +266,7 @@ get_it (PKT_pubkey_enc *enc, DEK *dek, PKT_public_key *sk, u32 *keyid)
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
nframe -= frame[nframe-1]; /* Remove padding. */
|
nframe -= frame[nframe-1]; /* Remove padding. */
|
||||||
assert (!n); /* (used just below) */
|
log_assert (!n); /* (used just below) */
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
|
|
|
@ -24,7 +24,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
17
g10/seskey.c
17
g10/seskey.c
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -106,7 +105,7 @@ encode_session_key (int openpgp_pk_algo, DEK *dek, unsigned int nbits)
|
||||||
+ 7 ) & (~7));
|
+ 7 ) & (~7));
|
||||||
|
|
||||||
/* alg+key+csum fit and the size is congruent to 8. */
|
/* alg+key+csum fit and the size is congruent to 8. */
|
||||||
assert (!(nframe%8) && nframe > 1 + dek->keylen + 2 );
|
log_assert (!(nframe%8) && nframe > 1 + dek->keylen + 2 );
|
||||||
|
|
||||||
frame = xmalloc_secure (nframe);
|
frame = xmalloc_secure (nframe);
|
||||||
n = 0;
|
n = 0;
|
||||||
|
@ -117,7 +116,7 @@ encode_session_key (int openpgp_pk_algo, DEK *dek, unsigned int nbits)
|
||||||
frame[n++] = csum;
|
frame[n++] = csum;
|
||||||
i = nframe - n; /* Number of padded bytes. */
|
i = nframe - n; /* Number of padded bytes. */
|
||||||
memset (frame+n, i, i); /* Use it as the value of each padded byte. */
|
memset (frame+n, i, i); /* Use it as the value of each padded byte. */
|
||||||
assert (n+i == nframe);
|
log_assert (n+i == nframe);
|
||||||
|
|
||||||
if (DBG_CRYPTO)
|
if (DBG_CRYPTO)
|
||||||
log_debug ("encode_session_key: "
|
log_debug ("encode_session_key: "
|
||||||
|
@ -161,7 +160,7 @@ encode_session_key (int openpgp_pk_algo, DEK *dek, unsigned int nbits)
|
||||||
/* The number of random bytes are the number of otherwise unused
|
/* The number of random bytes are the number of otherwise unused
|
||||||
bytes. See diagram above. */
|
bytes. See diagram above. */
|
||||||
i = nframe - 6 - dek->keylen;
|
i = nframe - 6 - dek->keylen;
|
||||||
assert( i > 0 );
|
log_assert( i > 0 );
|
||||||
p = gcry_random_bytes_secure (i, GCRY_STRONG_RANDOM);
|
p = gcry_random_bytes_secure (i, GCRY_STRONG_RANDOM);
|
||||||
/* Replace zero bytes by new values. */
|
/* Replace zero bytes by new values. */
|
||||||
for (;;)
|
for (;;)
|
||||||
|
@ -195,7 +194,7 @@ encode_session_key (int openpgp_pk_algo, DEK *dek, unsigned int nbits)
|
||||||
n += dek->keylen;
|
n += dek->keylen;
|
||||||
frame[n++] = csum >>8;
|
frame[n++] = csum >>8;
|
||||||
frame[n++] = csum;
|
frame[n++] = csum;
|
||||||
assert (n == nframe);
|
log_assert (n == nframe);
|
||||||
if (gcry_mpi_scan( &a, GCRYMPI_FMT_USG, frame, n, &nframe))
|
if (gcry_mpi_scan( &a, GCRYMPI_FMT_USG, frame, n, &nframe))
|
||||||
BUG();
|
BUG();
|
||||||
xfree (frame);
|
xfree (frame);
|
||||||
|
@ -227,12 +226,12 @@ do_encode_md( gcry_md_hd_t md, int algo, size_t len, unsigned nbits,
|
||||||
frame[n++] = 0;
|
frame[n++] = 0;
|
||||||
frame[n++] = 1; /* block type */
|
frame[n++] = 1; /* block type */
|
||||||
i = nframe - len - asnlen -3 ;
|
i = nframe - len - asnlen -3 ;
|
||||||
assert( i > 1 );
|
log_assert( i > 1 );
|
||||||
memset( frame+n, 0xff, i ); n += i;
|
memset( frame+n, 0xff, i ); n += i;
|
||||||
frame[n++] = 0;
|
frame[n++] = 0;
|
||||||
memcpy( frame+n, asn, asnlen ); n += asnlen;
|
memcpy( frame+n, asn, asnlen ); n += asnlen;
|
||||||
memcpy( frame+n, gcry_md_read (md, algo), len ); n += len;
|
memcpy( frame+n, gcry_md_read (md, algo), len ); n += len;
|
||||||
assert( n == nframe );
|
log_assert( n == nframe );
|
||||||
|
|
||||||
if (gcry_mpi_scan( &a, GCRYMPI_FMT_USG, frame, n, &nframe ))
|
if (gcry_mpi_scan( &a, GCRYMPI_FMT_USG, frame, n, &nframe ))
|
||||||
BUG();
|
BUG();
|
||||||
|
@ -263,8 +262,8 @@ encode_md_value (PKT_public_key *pk, gcry_md_hd_t md, int hash_algo)
|
||||||
gcry_mpi_t frame;
|
gcry_mpi_t frame;
|
||||||
size_t mdlen;
|
size_t mdlen;
|
||||||
|
|
||||||
assert (hash_algo);
|
log_assert (hash_algo);
|
||||||
assert (pk);
|
log_assert (pk);
|
||||||
|
|
||||||
if (pk->pubkey_algo == PUBKEY_ALGO_EDDSA)
|
if (pk->pubkey_algo == PUBKEY_ALGO_EDDSA)
|
||||||
{
|
{
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -563,8 +562,8 @@ check_revocation_keys (PKT_public_key *pk, PKT_signature *sig)
|
||||||
int i;
|
int i;
|
||||||
int rc = GPG_ERR_GENERAL;
|
int rc = GPG_ERR_GENERAL;
|
||||||
|
|
||||||
assert(IS_KEY_REV(sig));
|
log_assert (IS_KEY_REV(sig));
|
||||||
assert((sig->keyid[0]!=pk->keyid[0]) || (sig->keyid[0]!=pk->keyid[1]));
|
log_assert ((sig->keyid[0]!=pk->keyid[0]) || (sig->keyid[0]!=pk->keyid[1]));
|
||||||
|
|
||||||
/* Avoid infinite recursion. Consider the following:
|
/* Avoid infinite recursion. Consider the following:
|
||||||
*
|
*
|
||||||
|
@ -857,14 +856,14 @@ check_signature_over_key_or_uid (PKT_public_key *signer,
|
||||||
/* Primary key revocation. */
|
/* Primary key revocation. */
|
||||||
|| sig->sig_class == 0x20)
|
|| sig->sig_class == 0x20)
|
||||||
{
|
{
|
||||||
assert (packet->pkttype == PKT_PUBLIC_KEY);
|
log_assert (packet->pkttype == PKT_PUBLIC_KEY);
|
||||||
hash_public_key (md, packet->pkt.public_key);
|
hash_public_key (md, packet->pkt.public_key);
|
||||||
rc = check_signature_end_simple (signer, sig, md);
|
rc = check_signature_end_simple (signer, sig, md);
|
||||||
}
|
}
|
||||||
else if (/* Primary key binding (made by a subkey). */
|
else if (/* Primary key binding (made by a subkey). */
|
||||||
sig->sig_class == 0x19)
|
sig->sig_class == 0x19)
|
||||||
{
|
{
|
||||||
assert (packet->pkttype == PKT_PUBLIC_KEY);
|
log_assert (packet->pkttype == PKT_PUBLIC_KEY);
|
||||||
hash_public_key (md, packet->pkt.public_key);
|
hash_public_key (md, packet->pkt.public_key);
|
||||||
hash_public_key (md, signer);
|
hash_public_key (md, signer);
|
||||||
rc = check_signature_end_simple (signer, sig, md);
|
rc = check_signature_end_simple (signer, sig, md);
|
||||||
|
@ -874,7 +873,7 @@ check_signature_over_key_or_uid (PKT_public_key *signer,
|
||||||
/* Subkey revocation. */
|
/* Subkey revocation. */
|
||||||
|| sig->sig_class == 0x28)
|
|| sig->sig_class == 0x28)
|
||||||
{
|
{
|
||||||
assert (packet->pkttype == PKT_PUBLIC_SUBKEY);
|
log_assert (packet->pkttype == PKT_PUBLIC_SUBKEY);
|
||||||
hash_public_key (md, pripk);
|
hash_public_key (md, pripk);
|
||||||
hash_public_key (md, packet->pkt.public_key);
|
hash_public_key (md, packet->pkt.public_key);
|
||||||
rc = check_signature_end_simple (signer, sig, md);
|
rc = check_signature_end_simple (signer, sig, md);
|
||||||
|
@ -887,7 +886,7 @@ check_signature_over_key_or_uid (PKT_public_key *signer,
|
||||||
/* Certification revocation. */
|
/* Certification revocation. */
|
||||||
|| sig->sig_class == 0x30)
|
|| sig->sig_class == 0x30)
|
||||||
{
|
{
|
||||||
assert (packet->pkttype == PKT_USER_ID);
|
log_assert (packet->pkttype == PKT_USER_ID);
|
||||||
hash_public_key (md, pripk);
|
hash_public_key (md, pripk);
|
||||||
hash_uid_packet (packet->pkt.user_id, md, sig);
|
hash_uid_packet (packet->pkt.user_id, md, sig);
|
||||||
rc = check_signature_end_simple (signer, sig, md);
|
rc = check_signature_end_simple (signer, sig, md);
|
||||||
|
@ -964,8 +963,8 @@ check_key_signature2 (kbnode_t root, kbnode_t node, PKT_public_key *check_pk,
|
||||||
*r_expiredate = 0;
|
*r_expiredate = 0;
|
||||||
if (r_expired)
|
if (r_expired)
|
||||||
*r_expired = 0;
|
*r_expired = 0;
|
||||||
assert (node->pkt->pkttype == PKT_SIGNATURE);
|
log_assert (node->pkt->pkttype == PKT_SIGNATURE);
|
||||||
assert (root->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (root->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
pk = root->pkt->pkt.public_key;
|
pk = root->pkt->pkt.public_key;
|
||||||
sig = node->pkt->pkt.signature;
|
sig = node->pkt->pkt.signature;
|
||||||
|
|
11
g10/sign.c
11
g10/sign.c
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
@ -66,7 +65,7 @@ mk_notation_policy_etc (PKT_signature *sig,
|
||||||
struct notation *nd=NULL;
|
struct notation *nd=NULL;
|
||||||
struct expando_args args;
|
struct expando_args args;
|
||||||
|
|
||||||
assert(sig->version>=4);
|
log_assert(sig->version>=4);
|
||||||
|
|
||||||
memset(&args,0,sizeof(args));
|
memset(&args,0,sizeof(args));
|
||||||
args.pk=pk;
|
args.pk=pk;
|
||||||
|
@ -1143,7 +1142,7 @@ clearsign_file (ctrl_t ctrl,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
assert(any);
|
log_assert(any);
|
||||||
iobuf_writestr(out, LF );
|
iobuf_writestr(out, LF );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1377,9 +1376,9 @@ make_keysig_packet (PKT_signature **ret_sig, PKT_public_key *pk,
|
||||||
int sigversion;
|
int sigversion;
|
||||||
gcry_md_hd_t md;
|
gcry_md_hd_t md;
|
||||||
|
|
||||||
assert( (sigclass >= 0x10 && sigclass <= 0x13) || sigclass == 0x1F
|
log_assert ((sigclass >= 0x10 && sigclass <= 0x13) || sigclass == 0x1F
|
||||||
|| sigclass == 0x20 || sigclass == 0x18 || sigclass == 0x19
|
|| sigclass == 0x20 || sigclass == 0x18 || sigclass == 0x19
|
||||||
|| sigclass == 0x30 || sigclass == 0x28 );
|
|| sigclass == 0x30 || sigclass == 0x28 );
|
||||||
|
|
||||||
sigversion = 4;
|
sigversion = 4;
|
||||||
if (sigversion < pksk->version)
|
if (sigversion < pksk->version)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
|
@ -21,7 +21,6 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
@ -88,7 +87,7 @@ sqlite3_stepx (sqlite3 *db,
|
||||||
stmt = *stmtp;
|
stmt = *stmtp;
|
||||||
|
|
||||||
/* Make sure this statement is associated with the supplied db. */
|
/* Make sure this statement is associated with the supplied db. */
|
||||||
assert (db == sqlite3_db_handle (stmt));
|
log_assert (db == sqlite3_db_handle (stmt));
|
||||||
|
|
||||||
#if DEBUG_TOFU_CACHE
|
#if DEBUG_TOFU_CACHE
|
||||||
prepares_saved ++;
|
prepares_saved ++;
|
||||||
|
@ -171,7 +170,7 @@ sqlite3_stepx (sqlite3 *db,
|
||||||
|
|
||||||
}
|
}
|
||||||
t = va_arg (va, enum sqlite_arg_type);
|
t = va_arg (va, enum sqlite_arg_type);
|
||||||
assert (t == SQLITE_ARG_END);
|
log_assert (t == SQLITE_ARG_END);
|
||||||
va_end (va);
|
va_end (va);
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
13
g10/tdbio.c
13
g10/tdbio.c
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -317,7 +316,7 @@ put_record_into_cache (ulong recno, const char *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now put into the cache. */
|
/* Now put into the cache. */
|
||||||
assert (unused);
|
log_assert (unused);
|
||||||
r = unused;
|
r = unused;
|
||||||
r->flags.used = 1;
|
r->flags.used = 1;
|
||||||
r->recno = recno;
|
r->recno = recno;
|
||||||
|
@ -383,7 +382,7 @@ put_record_into_cache (ulong recno, const char *data)
|
||||||
release_write_lock ();
|
release_write_lock ();
|
||||||
|
|
||||||
/* Now put into the cache. */
|
/* Now put into the cache. */
|
||||||
assert (unused);
|
log_assert (unused);
|
||||||
r = unused;
|
r = unused;
|
||||||
r->flags.used = 1;
|
r->flags.used = 1;
|
||||||
r->recno = recno;
|
r->recno = recno;
|
||||||
|
@ -666,7 +665,7 @@ tdbio_set_dbname (const char *new_dbname, int create, int *r_nofile)
|
||||||
p = pp;
|
p = pp;
|
||||||
}
|
}
|
||||||
#endif /*HAVE_W32_SYSTEM*/
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
assert (p);
|
log_assert (p);
|
||||||
save_slash = *p;
|
save_slash = *p;
|
||||||
*p = 0;
|
*p = 0;
|
||||||
if (access (fname, F_OK))
|
if (access (fname, F_OK))
|
||||||
|
@ -751,7 +750,7 @@ open_db ()
|
||||||
{
|
{
|
||||||
TRUSTREC rec;
|
TRUSTREC rec;
|
||||||
|
|
||||||
assert( db_fd == -1 );
|
log_assert( db_fd == -1 );
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
#ifdef HAVE_W32CE_SYSTEM
|
||||||
{
|
{
|
||||||
|
@ -811,7 +810,7 @@ create_hashtable( TRUSTREC *vr, int type )
|
||||||
if (offset == -1)
|
if (offset == -1)
|
||||||
log_fatal ("trustdb: lseek to end failed: %s\n", strerror(errno));
|
log_fatal ("trustdb: lseek to end failed: %s\n", strerror(errno));
|
||||||
recnum = offset / TRUST_RECORD_LEN;
|
recnum = offset / TRUST_RECORD_LEN;
|
||||||
assert (recnum); /* This is will never be the first record. */
|
log_assert (recnum); /* This is will never be the first record. */
|
||||||
|
|
||||||
if (!type)
|
if (!type)
|
||||||
vr->r.ver.trusthashtbl = recnum;
|
vr->r.ver.trusthashtbl = recnum;
|
||||||
|
@ -1770,7 +1769,7 @@ tdbio_new_recnum ()
|
||||||
if (offset == (off_t)(-1))
|
if (offset == (off_t)(-1))
|
||||||
log_fatal ("trustdb: lseek to end failed: %s\n", strerror (errno));
|
log_fatal ("trustdb: lseek to end failed: %s\n", strerror (errno));
|
||||||
recnum = offset / TRUST_RECORD_LEN;
|
recnum = offset / TRUST_RECORD_LEN;
|
||||||
assert (recnum); /* this is will never be the first record */
|
log_assert (recnum); /* this is will never be the first record */
|
||||||
/* We must write a record, so that the next call to this
|
/* We must write a record, so that the next call to this
|
||||||
* function returns another recnum. */
|
* function returns another recnum. */
|
||||||
memset (&rec, 0, sizeof rec);
|
memset (&rec, 0, sizeof rec);
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "status.h"
|
#include "status.h"
|
||||||
|
@ -70,7 +69,7 @@ standard( text_filter_context_t *tfx, IOBUF a,
|
||||||
size_t len = 0;
|
size_t len = 0;
|
||||||
unsigned maxlen;
|
unsigned maxlen;
|
||||||
|
|
||||||
assert( size > 10 );
|
log_assert( size > 10 );
|
||||||
size -= 2; /* reserve 2 bytes to append CR,LF */
|
size -= 2; /* reserve 2 bytes to append CR,LF */
|
||||||
while( !rc && len < size ) {
|
while( !rc && len < size ) {
|
||||||
int lf_seen;
|
int lf_seen;
|
||||||
|
|
121
g10/tofu.c
121
g10/tofu.c
|
@ -26,7 +26,6 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
#include <assert.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
@ -388,7 +387,7 @@ tofu_begin_batch_update (void)
|
||||||
void
|
void
|
||||||
tofu_end_batch_update (void)
|
tofu_end_batch_update (void)
|
||||||
{
|
{
|
||||||
assert (batch_update > 0);
|
log_assert (batch_update > 0);
|
||||||
batch_update --;
|
batch_update --;
|
||||||
|
|
||||||
if (batch_update == 0)
|
if (batch_update == 0)
|
||||||
|
@ -411,7 +410,7 @@ get_single_unsigned_long_cb (void *cookie, int argc, char **argv,
|
||||||
|
|
||||||
(void) azColName;
|
(void) azColName;
|
||||||
|
|
||||||
assert (argc == 1);
|
log_assert (argc == 1);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
*count = strtoul (argv[0], &tail, 0);
|
*count = strtoul (argv[0], &tail, 0);
|
||||||
|
@ -682,16 +681,16 @@ opendb (char *filename, enum db_type type)
|
||||||
|
|
||||||
if (opt.tofu_db_format == TOFU_DB_FLAT)
|
if (opt.tofu_db_format == TOFU_DB_FLAT)
|
||||||
{
|
{
|
||||||
assert (! filename);
|
log_assert (! filename);
|
||||||
assert (type == DB_COMBINED);
|
log_assert (type == DB_COMBINED);
|
||||||
|
|
||||||
filename = make_filename (opt.homedir, "tofu.db", NULL);
|
filename = make_filename (opt.homedir, "tofu.db", NULL);
|
||||||
filename_free = 1;
|
filename_free = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
assert (type == DB_EMAIL || type == DB_KEY);
|
log_assert (type == DB_EMAIL || type == DB_KEY);
|
||||||
|
|
||||||
assert (filename);
|
log_assert (filename);
|
||||||
|
|
||||||
rc = sqlite3_open (filename, &db);
|
rc = sqlite3_open (filename, &db);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
@ -762,9 +761,9 @@ getdb (struct dbs *dbs, const char *name, enum db_type type)
|
||||||
sqlite3 *sqlitedb = NULL;
|
sqlite3 *sqlitedb = NULL;
|
||||||
gpg_error_t rc;
|
gpg_error_t rc;
|
||||||
|
|
||||||
assert (dbs);
|
log_assert (dbs);
|
||||||
assert (name);
|
log_assert (name);
|
||||||
assert (type == DB_EMAIL || type == DB_KEY);
|
log_assert (type == DB_EMAIL || type == DB_KEY);
|
||||||
|
|
||||||
if (opt.tofu_db_format == TOFU_DB_FLAT)
|
if (opt.tofu_db_format == TOFU_DB_FLAT)
|
||||||
/* When using the flat format, we only have a single DB, the
|
/* When using the flat format, we only have a single DB, the
|
||||||
|
@ -772,8 +771,8 @@ getdb (struct dbs *dbs, const char *name, enum db_type type)
|
||||||
{
|
{
|
||||||
if (dbs->db)
|
if (dbs->db)
|
||||||
{
|
{
|
||||||
assert (dbs->db->type == DB_COMBINED);
|
log_assert (dbs->db->type == DB_COMBINED);
|
||||||
assert (! dbs->db->next);
|
log_assert (! dbs->db->next);
|
||||||
return dbs->db;
|
return dbs->db;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -814,7 +813,7 @@ getdb (struct dbs *dbs, const char *name, enum db_type type)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
assert (db_cache_count == count);
|
log_assert (db_cache_count == count);
|
||||||
|
|
||||||
if (type == DB_COMBINED)
|
if (type == DB_COMBINED)
|
||||||
filename = NULL;
|
filename = NULL;
|
||||||
|
@ -883,18 +882,18 @@ closedb (struct db *db)
|
||||||
if (opt.tofu_db_format == TOFU_DB_FLAT)
|
if (opt.tofu_db_format == TOFU_DB_FLAT)
|
||||||
/* If we are using the flat format, then there is only ever the
|
/* If we are using the flat format, then there is only ever the
|
||||||
combined DB. */
|
combined DB. */
|
||||||
assert (! db->next);
|
log_assert (! db->next);
|
||||||
|
|
||||||
if (db->type == DB_COMBINED)
|
if (db->type == DB_COMBINED)
|
||||||
{
|
{
|
||||||
assert (opt.tofu_db_format == TOFU_DB_FLAT);
|
log_assert (opt.tofu_db_format == TOFU_DB_FLAT);
|
||||||
assert (! db->name[0]);
|
log_assert (! db->name[0]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert (opt.tofu_db_format == TOFU_DB_SPLIT);
|
log_assert (opt.tofu_db_format == TOFU_DB_SPLIT);
|
||||||
assert (db->type != DB_COMBINED);
|
log_assert (db->type != DB_COMBINED);
|
||||||
assert (db->name[0]);
|
log_assert (db->name[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (db->batch_update)
|
if (db->batch_update)
|
||||||
|
@ -1002,10 +1001,10 @@ closedbs (struct dbs *dbs)
|
||||||
/* When we leave batch mode we leave batch mode on any
|
/* When we leave batch mode we leave batch mode on any
|
||||||
cached connections. */
|
cached connections. */
|
||||||
if (! batch_update)
|
if (! batch_update)
|
||||||
assert (! db->batch_update);
|
log_assert (! db->batch_update);
|
||||||
}
|
}
|
||||||
if (! batch_update)
|
if (! batch_update)
|
||||||
assert (! db->batch_update);
|
log_assert (! db->batch_update);
|
||||||
|
|
||||||
/* Join the two lists. */
|
/* Join the two lists. */
|
||||||
db->next = db_cache;
|
db->next = db_cache;
|
||||||
|
@ -1060,7 +1059,7 @@ get_single_long_cb (void *cookie, int argc, char **argv, char **azColName)
|
||||||
|
|
||||||
(void) azColName;
|
(void) azColName;
|
||||||
|
|
||||||
assert (argc == 1);
|
log_assert (argc == 1);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
*count = strtol (argv[0], &tail, 0);
|
*count = strtol (argv[0], &tail, 0);
|
||||||
|
@ -1203,7 +1202,7 @@ record_binding (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
if (db_key)
|
if (db_key)
|
||||||
/* We also need to update the key DB. */
|
/* We also need to update the key DB. */
|
||||||
{
|
{
|
||||||
assert (opt.tofu_db_format == TOFU_DB_SPLIT);
|
log_assert (opt.tofu_db_format == TOFU_DB_SPLIT);
|
||||||
|
|
||||||
rc = sqlite3_stepx
|
rc = sqlite3_stepx
|
||||||
(db_key->db, &db_key->s.record_binding_update2, NULL, NULL, &err,
|
(db_key->db, &db_key->s.record_binding_update2, NULL, NULL, &err,
|
||||||
|
@ -1228,7 +1227,7 @@ record_binding (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
assert (opt.tofu_db_format == TOFU_DB_FLAT);
|
log_assert (opt.tofu_db_format == TOFU_DB_FLAT);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (opt.tofu_db_format == TOFU_DB_SPLIT)
|
if (opt.tofu_db_format == TOFU_DB_SPLIT)
|
||||||
|
@ -1416,7 +1415,7 @@ signature_stats_collect_cb (void *cookie, int argc, char **argv,
|
||||||
}
|
}
|
||||||
i ++;
|
i ++;
|
||||||
|
|
||||||
assert (argc == i);
|
log_assert (argc == i);
|
||||||
|
|
||||||
signature_stats_prepend (statsp, argv[0], policy, time_ago, count);
|
signature_stats_prepend (statsp, argv[0], policy, time_ago, count);
|
||||||
|
|
||||||
|
@ -1531,13 +1530,13 @@ get_policy (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
assert (policy == _tofu_GET_POLICY_ERROR
|
log_assert (policy == _tofu_GET_POLICY_ERROR
|
||||||
|| policy == TOFU_POLICY_NONE
|
|| policy == TOFU_POLICY_NONE
|
||||||
|| policy == TOFU_POLICY_AUTO
|
|| policy == TOFU_POLICY_AUTO
|
||||||
|| policy == TOFU_POLICY_GOOD
|
|| policy == TOFU_POLICY_GOOD
|
||||||
|| policy == TOFU_POLICY_UNKNOWN
|
|| policy == TOFU_POLICY_UNKNOWN
|
||||||
|| policy == TOFU_POLICY_BAD
|
|| policy == TOFU_POLICY_BAD
|
||||||
|| policy == TOFU_POLICY_ASK);
|
|| policy == TOFU_POLICY_ASK);
|
||||||
|
|
||||||
free_strlist (strlist);
|
free_strlist (strlist);
|
||||||
|
|
||||||
|
@ -1576,13 +1575,13 @@ get_trust (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
|
|
||||||
/* Make sure _tofu_GET_TRUST_ERROR isn't equal to any of the trust
|
/* Make sure _tofu_GET_TRUST_ERROR isn't equal to any of the trust
|
||||||
levels. */
|
levels. */
|
||||||
assert (_tofu_GET_TRUST_ERROR != TRUST_UNKNOWN
|
log_assert (_tofu_GET_TRUST_ERROR != TRUST_UNKNOWN
|
||||||
&& _tofu_GET_TRUST_ERROR != TRUST_EXPIRED
|
&& _tofu_GET_TRUST_ERROR != TRUST_EXPIRED
|
||||||
&& _tofu_GET_TRUST_ERROR != TRUST_UNDEFINED
|
&& _tofu_GET_TRUST_ERROR != TRUST_UNDEFINED
|
||||||
&& _tofu_GET_TRUST_ERROR != TRUST_NEVER
|
&& _tofu_GET_TRUST_ERROR != TRUST_NEVER
|
||||||
&& _tofu_GET_TRUST_ERROR != TRUST_MARGINAL
|
&& _tofu_GET_TRUST_ERROR != TRUST_MARGINAL
|
||||||
&& _tofu_GET_TRUST_ERROR != TRUST_FULLY
|
&& _tofu_GET_TRUST_ERROR != TRUST_FULLY
|
||||||
&& _tofu_GET_TRUST_ERROR != TRUST_ULTIMATE);
|
&& _tofu_GET_TRUST_ERROR != TRUST_ULTIMATE);
|
||||||
|
|
||||||
db = getdb (dbs, email, DB_EMAIL);
|
db = getdb (dbs, email, DB_EMAIL);
|
||||||
if (! db)
|
if (! db)
|
||||||
|
@ -1740,7 +1739,7 @@ get_trust (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
{
|
{
|
||||||
/* If we've seen this binding, then we've seen this email and
|
/* If we've seen this binding, then we've seen this email and
|
||||||
policy couldn't possibly be TOFU_POLICY_NONE. */
|
policy couldn't possibly be TOFU_POLICY_NONE. */
|
||||||
assert (policy == TOFU_POLICY_NONE);
|
log_assert (policy == TOFU_POLICY_NONE);
|
||||||
|
|
||||||
if (DBG_TRUST)
|
if (DBG_TRUST)
|
||||||
log_debug ("TOFU: New binding <%s, %s>, no conflict.\n",
|
log_debug ("TOFU: New binding <%s, %s>, no conflict.\n",
|
||||||
|
@ -1772,7 +1771,7 @@ get_trust (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
there is a conflict. (If the policy was ask (cases #1 and #2)
|
there is a conflict. (If the policy was ask (cases #1 and #2)
|
||||||
and we weren't allowed to ask, we'd have already exited). */
|
and we weren't allowed to ask, we'd have already exited). */
|
||||||
{
|
{
|
||||||
assert (policy == TOFU_POLICY_NONE);
|
log_assert (policy == TOFU_POLICY_NONE);
|
||||||
|
|
||||||
if (record_binding (dbs, fingerprint, email, user_id,
|
if (record_binding (dbs, fingerprint, email, user_id,
|
||||||
TOFU_POLICY_ASK, 0) != 0)
|
TOFU_POLICY_ASK, 0) != 0)
|
||||||
|
@ -1893,7 +1892,7 @@ get_trust (struct dbs *dbs, const char *fingerprint, const char *email,
|
||||||
char *other_thing;
|
char *other_thing;
|
||||||
enum tofu_policy other_policy;
|
enum tofu_policy other_policy;
|
||||||
|
|
||||||
assert (strlist_iter->next);
|
log_assert (strlist_iter->next);
|
||||||
strlist_iter = strlist_iter->next;
|
strlist_iter = strlist_iter->next;
|
||||||
other_thing = strlist_iter->d;
|
other_thing = strlist_iter->d;
|
||||||
|
|
||||||
|
@ -2353,7 +2352,7 @@ show_statistics (struct dbs *dbs, const char *fingerprint,
|
||||||
signed long first_seen_ago;
|
signed long first_seen_ago;
|
||||||
signed long most_recent_seen_ago;
|
signed long most_recent_seen_ago;
|
||||||
|
|
||||||
assert (strlist_length (strlist) == 3);
|
log_assert (strlist_length (strlist) == 3);
|
||||||
|
|
||||||
errno = 0;
|
errno = 0;
|
||||||
messages = strtol (strlist->d, &tail, 0);
|
messages = strtol (strlist->d, &tail, 0);
|
||||||
|
@ -2656,7 +2655,7 @@ tofu_register (PKT_public_key *pk, const char *user_id,
|
||||||
log_debug ("TOFU: Saving signature <%s, %s, %s>\n",
|
log_debug ("TOFU: Saving signature <%s, %s, %s>\n",
|
||||||
fingerprint_pp, email, sig_digest);
|
fingerprint_pp, email, sig_digest);
|
||||||
|
|
||||||
assert (c == 0);
|
log_assert (c == 0);
|
||||||
|
|
||||||
rc = sqlite3_stepx
|
rc = sqlite3_stepx
|
||||||
(db->db, &db->s.register_insert, NULL, NULL, &err,
|
(db->db, &db->s.register_insert, NULL, NULL, &err,
|
||||||
|
@ -2720,20 +2719,20 @@ tofu_wot_trust_combine (int tofu_base, int wot_base)
|
||||||
int wot = wot_base & TRUST_MASK;
|
int wot = wot_base & TRUST_MASK;
|
||||||
int upper = (tofu_base & ~TRUST_MASK) | (wot_base & ~TRUST_MASK);
|
int upper = (tofu_base & ~TRUST_MASK) | (wot_base & ~TRUST_MASK);
|
||||||
|
|
||||||
assert (tofu == TRUST_UNKNOWN
|
log_assert (tofu == TRUST_UNKNOWN
|
||||||
|| tofu == TRUST_EXPIRED
|
|| tofu == TRUST_EXPIRED
|
||||||
|| tofu == TRUST_UNDEFINED
|
|| tofu == TRUST_UNDEFINED
|
||||||
|| tofu == TRUST_NEVER
|
|| tofu == TRUST_NEVER
|
||||||
|| tofu == TRUST_MARGINAL
|
|| tofu == TRUST_MARGINAL
|
||||||
|| tofu == TRUST_FULLY
|
|| tofu == TRUST_FULLY
|
||||||
|| tofu == TRUST_ULTIMATE);
|
|| tofu == TRUST_ULTIMATE);
|
||||||
assert (wot == TRUST_UNKNOWN
|
log_assert (wot == TRUST_UNKNOWN
|
||||||
|| wot == TRUST_EXPIRED
|
|| wot == TRUST_EXPIRED
|
||||||
|| wot == TRUST_UNDEFINED
|
|| wot == TRUST_UNDEFINED
|
||||||
|| wot == TRUST_NEVER
|
|| wot == TRUST_NEVER
|
||||||
|| wot == TRUST_MARGINAL
|
|| wot == TRUST_MARGINAL
|
||||||
|| wot == TRUST_FULLY
|
|| wot == TRUST_FULLY
|
||||||
|| wot == TRUST_ULTIMATE);
|
|| wot == TRUST_ULTIMATE);
|
||||||
|
|
||||||
/* We first consider negative trust policys. These trump positive
|
/* We first consider negative trust policys. These trump positive
|
||||||
trust policies. */
|
trust policies. */
|
||||||
|
@ -2826,7 +2825,7 @@ tofu_set_policy (kbnode_t kb, enum tofu_policy policy)
|
||||||
PKT_public_key *pk;
|
PKT_public_key *pk;
|
||||||
char *fingerprint = NULL;
|
char *fingerprint = NULL;
|
||||||
|
|
||||||
assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
|
log_assert (kb->pkt->pkttype == PKT_PUBLIC_KEY);
|
||||||
pk = kb->pkt->pkt.public_key;
|
pk = kb->pkt->pkt.public_key;
|
||||||
|
|
||||||
dbs = opendbs ();
|
dbs = opendbs ();
|
||||||
|
@ -2906,8 +2905,8 @@ tofu_get_policy (PKT_public_key *pk, PKT_user_id *user_id,
|
||||||
char *email;
|
char *email;
|
||||||
|
|
||||||
/* Make sure PK is a primary key. */
|
/* Make sure PK is a primary key. */
|
||||||
assert (pk->main_keyid[0] == pk->keyid[0]
|
log_assert (pk->main_keyid[0] == pk->keyid[0]
|
||||||
&& pk->main_keyid[1] == pk->keyid[1]);
|
&& pk->main_keyid[1] == pk->keyid[1]);
|
||||||
|
|
||||||
dbs = opendbs ();
|
dbs = opendbs ();
|
||||||
if (! dbs)
|
if (! dbs)
|
||||||
|
|
11
g10/trust.c
11
g10/trust.c
|
@ -23,7 +23,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "keydb.h"
|
#include "keydb.h"
|
||||||
|
@ -561,7 +560,7 @@ clean_sigs_from_uid (kbnode_t keyblock, kbnode_t uidnode,
|
||||||
kbnode_t node;
|
kbnode_t node;
|
||||||
u32 keyid[2];
|
u32 keyid[2];
|
||||||
|
|
||||||
assert (keyblock->pkt->pkttype==PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype==PKT_PUBLIC_KEY);
|
||||||
|
|
||||||
keyid_from_pk (keyblock->pkt->pkt.public_key, keyid);
|
keyid_from_pk (keyblock->pkt->pkt.public_key, keyid);
|
||||||
|
|
||||||
|
@ -654,8 +653,8 @@ clean_uid_from_key (kbnode_t keyblock, kbnode_t uidnode, int noisy)
|
||||||
PKT_user_id *uid = uidnode->pkt->pkt.user_id;
|
PKT_user_id *uid = uidnode->pkt->pkt.user_id;
|
||||||
int deleted = 0;
|
int deleted = 0;
|
||||||
|
|
||||||
assert (keyblock->pkt->pkttype==PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype==PKT_PUBLIC_KEY);
|
||||||
assert (uidnode->pkt->pkttype==PKT_USER_ID);
|
log_assert (uidnode->pkt->pkttype==PKT_USER_ID);
|
||||||
|
|
||||||
/* Skip valid user IDs, compacted user IDs, and non-self-signed user
|
/* Skip valid user IDs, compacted user IDs, and non-self-signed user
|
||||||
IDs if --allow-non-selfsigned-uid is set. */
|
IDs if --allow-non-selfsigned-uid is set. */
|
||||||
|
@ -706,8 +705,8 @@ clean_one_uid (kbnode_t keyblock, kbnode_t uidnode, int noisy, int self_only,
|
||||||
{
|
{
|
||||||
int dummy = 0;
|
int dummy = 0;
|
||||||
|
|
||||||
assert (keyblock->pkt->pkttype==PKT_PUBLIC_KEY);
|
log_assert (keyblock->pkt->pkttype==PKT_PUBLIC_KEY);
|
||||||
assert (uidnode->pkt->pkttype==PKT_USER_ID);
|
log_assert (uidnode->pkt->pkttype==PKT_USER_ID);
|
||||||
|
|
||||||
if (!uids_cleaned)
|
if (!uids_cleaned)
|
||||||
uids_cleaned = &dummy;
|
uids_cleaned = &dummy;
|
||||||
|
|
|
@ -22,7 +22,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#ifndef DISABLE_REGEX
|
#ifndef DISABLE_REGEX
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -1079,9 +1078,9 @@ tdb_get_validity_core (PKT_public_key *pk, PKT_user_id *uid,
|
||||||
tofu_validity = TRUST_NEVER;
|
tofu_validity = TRUST_NEVER;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
assert (tl == TRUST_MARGINAL
|
log_assert (tl == TRUST_MARGINAL
|
||||||
|| tl == TRUST_FULLY
|
|| tl == TRUST_FULLY
|
||||||
|| tl == TRUST_ULTIMATE);
|
|| tl == TRUST_ULTIMATE);
|
||||||
|
|
||||||
if (tl > tofu_validity)
|
if (tl > tofu_validity)
|
||||||
/* XXX: We we really want the max? */
|
/* XXX: We we really want the max? */
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include "gpg.h"
|
#include "gpg.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
|
|
Loading…
Reference in New Issue