aboutsummaryrefslogtreecommitdiffstats
path: root/g10/mainproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'g10/mainproc.c')
-rw-r--r--g10/mainproc.c62
1 files changed, 32 insertions, 30 deletions
diff --git a/g10/mainproc.c b/g10/mainproc.c
index f46895d54..3ffb049bc 100644
--- a/g10/mainproc.c
+++ b/g10/mainproc.c
@@ -72,7 +72,7 @@ struct mainproc_context
int trustletter; /* Temporary usage in list_node. */
ulong symkeys;
struct kidlist_item *pkenc_list; /* List of encryption packets. */
- struct
+ struct
{
int op;
int stop_now;
@@ -135,10 +135,10 @@ add_gpg_control( CTX c, PACKET *pkt )
/* New clear text signature.
* Process the last one and reset everything */
release_list(c);
- }
+ }
else if ( pkt->pkt.gpg_control->control == CTRLPKT_PIPEMODE ) {
/* Pipemode control packet */
- if ( pkt->pkt.gpg_control->datalen < 2 )
+ if ( pkt->pkt.gpg_control->datalen < 2 )
log_fatal ("invalid pipemode control packet length\n");
if (pkt->pkt.gpg_control->data[0] == 1) {
/* start the whole thing */
@@ -156,10 +156,10 @@ add_gpg_control( CTX c, PACKET *pkt )
/* and tell the outer loop to terminate */
c->pipemode.stop_now = 1;
}
- else
+ else
log_fatal ("invalid pipemode control packet code\n");
return 0; /* no need to store the packet */
- }
+ }
if( c->list ) /* add another packet */
add_kbnode( c->list, new_kbnode( pkt ));
@@ -264,14 +264,16 @@ symkey_decrypt_seskey( DEK *dek, byte *seskey, size_t slen )
resulted in a garbage algorithm byte, but it's close enough since
a bogus byte here will fail later. */
if(dek->algo==CIPHER_ALGO_IDEA)
- idea_cipher_warn(0);
+ {
+ idea_cipher_warn(0);
+ }
memcpy(dek->key, seskey + 1, dek->keylen);
/*log_hexdump( "thekey", dek->key, dek->keylen );*/
return 0;
-}
+}
static void
proc_symkey_enc( CTX c, PACKET *pkt )
@@ -403,7 +405,7 @@ proc_pubkey_enc( CTX c, PACKET *pkt )
}
else if( is_ELGAMAL(enc->pubkey_algo)
|| enc->pubkey_algo == PUBKEY_ALGO_DSA
- || is_RSA(enc->pubkey_algo)
+ || is_RSA(enc->pubkey_algo)
|| (RFC2440 && enc->pubkey_algo == PUBKEY_ALGO_ELGAMAL)) {
/* Note that we also allow type 20 Elgamal keys for decryption.
There are still a couple of those keys in active use as a
@@ -464,7 +466,7 @@ print_pkenc_list( struct kidlist_item *list, int failed )
for( ; list; list = list->next ) {
PKT_public_key *pk;
const char *algstr;
-
+
if ( failed && !list->reason )
continue;
if ( !failed && list->reason )
@@ -680,7 +682,7 @@ proc_plaintext( CTX c, PACKET *pkt )
/* check that we have at least the sigclass and one hash */
if ( datalen < 2 )
- log_fatal("invalid control packet CTRLPKT_CLEARSIGN_START\n");
+ log_fatal("invalid control packet CTRLPKT_CLEARSIGN_START\n");
/* Note that we don't set the clearsig flag for not-dash-escaped
* documents */
clearsig = (*data == 0x01);
@@ -764,7 +766,7 @@ proc_plaintext( CTX c, PACKET *pkt )
n = new_kbnode (create_gpg_control (CTRLPKT_PLAINTEXT_MARK, NULL, 0));
if (c->list)
add_kbnode (c->list, n);
- else
+ else
c->list = n;
}
@@ -849,7 +851,7 @@ do_check_sig( CTX c, KBNODE node, int *is_selfsig,
|| sig->sig_class == 0x1f
|| sig->sig_class == 0x20
|| sig->sig_class == 0x28
- || sig->sig_class == 0x30 ) {
+ || sig->sig_class == 0x30 ) {
if( c->list->pkt->pkttype == PKT_PUBLIC_KEY
|| c->list->pkt->pkttype == PKT_PUBLIC_SUBKEY ) {
return check_key_signature( c->list, node, is_selfsig );
@@ -1102,7 +1104,7 @@ list_node( CTX c, KBNODE node )
switch( (rc2=do_check_sig( c, node, &is_selfsig, NULL, NULL )) ) {
case 0: sigrc = '!'; break;
case G10ERR_BAD_SIGN: sigrc = '-'; break;
- case G10ERR_NO_PUBKEY:
+ case G10ERR_NO_PUBKEY:
case G10ERR_UNU_PUBKEY: sigrc = '?'; break;
default: sigrc = '%'; break;
}
@@ -1199,7 +1201,7 @@ proc_signature_packets( void *anchor, IOBUF a,
messages, send a NODATA status back and return an error code.
Using log_error is required because verify_files does not check
error codes for each file but we want to terminate the process
- with an error. */
+ with an error. */
if (!rc && !c->any_sig_seen)
{
write_status_text (STATUS_NODATA, "4");
@@ -1334,7 +1336,7 @@ do_proc_packets( CTX c, IOBUF a )
* packet and not to reuse the current one ... It works right
* when there is a compression packet inbetween which adds just
* an extra layer.
- * Hmmm: Rewrite this whole module here??
+ * Hmmm: Rewrite this whole module here??
*/
if( pkt->pkttype != PKT_SIGNATURE && pkt->pkttype != PKT_MDC )
c->have_data = pkt->pkttype == PKT_PLAINTEXT;
@@ -1348,8 +1350,8 @@ do_proc_packets( CTX c, IOBUF a )
else
free_packet(pkt);
if ( c->pipemode.stop_now ) {
- /* we won't get an EOF in pipemode, so we have to
- * break the loop here */
+ /* we won't get an EOF in pipemode, so we have to
+ * break the loop here */
rc = -1;
break;
}
@@ -1459,7 +1461,7 @@ check_sig_and_print( CTX c, KBNODE node )
O{1,n} P S{1,n} -- standard OpenPGP signature.
C P S{1,n} -- cleartext signature.
-
+
O = One-Pass Signature packet.
S = Signature packet.
P = OpenPGP Message packet (Encrypted | Compressed | Literal)
@@ -1471,7 +1473,7 @@ check_sig_and_print( CTX c, KBNODE node )
C = Marker packet for cleartext signatures.
We reject all other messages.
-
+
Actually we are calling this too often, i.e. for verification of
each message but better have some duplicate work than to silently
introduce a bug here.
@@ -1485,7 +1487,7 @@ check_sig_and_print( CTX c, KBNODE node )
n = c->list;
assert (n);
- if ( n->pkt->pkttype == PKT_SIGNATURE )
+ if ( n->pkt->pkttype == PKT_SIGNATURE )
{
/* This is either "S{1,n}" case (detached signature) or
"S{1,n} P" (old style PGP2 signature). */
@@ -1504,7 +1506,7 @@ check_sig_and_print( CTX c, KBNODE node )
else
goto ambiguous;
}
- else if (n->pkt->pkttype == PKT_ONEPASS_SIG)
+ else if (n->pkt->pkttype == PKT_ONEPASS_SIG)
{
/* This is the "O{1,n} P S{1,n}" case (standard signature). */
for (n_onepass=1, n = n->next;
@@ -1552,7 +1554,7 @@ check_sig_and_print( CTX c, KBNODE node )
if (n || !n_sig)
goto ambiguous;
}
- else
+ else
{
ambiguous:
log_error(_("can't handle this ambiguous signature data\n"));
@@ -1621,19 +1623,19 @@ check_sig_and_print( CTX c, KBNODE node )
/* If the preferred keyserver thing above didn't work, our second
try is to use the URI from a DNS PKA record. */
- if ( rc == G10ERR_NO_PUBKEY
+ if ( rc == G10ERR_NO_PUBKEY
&& opt.keyserver_options.options&KEYSERVER_AUTO_KEY_RETRIEVE
&& opt.keyserver_options.options&KEYSERVER_HONOR_PKA_RECORD)
{
const char *uri = pka_uri_from_sig (sig);
-
+
if (uri)
{
/* FIXME: We might want to locate the key using the
fingerprint instead of the keyid. */
int res;
struct keyserver_spec *spec;
-
+
spec = parse_keyserver_uri (uri, 1, NULL, 0);
if (spec)
{
@@ -1717,7 +1719,7 @@ check_sig_and_print( CTX c, KBNODE node )
keyid_str[17] = 0; /* cut off the "[uncertain]" part */
write_status_text_and_buffer (statno, keyid_str,
un->pkt->pkt.user_id->name,
- un->pkt->pkt.user_id->len,
+ un->pkt->pkt.user_id->len,
-1 );
p=utf8_to_native(un->pkt->pkt.user_id->name,
@@ -1762,7 +1764,7 @@ check_sig_and_print( CTX c, KBNODE node )
write_status_text_and_buffer (statno, keyid_str,
un? un->pkt->pkt.user_id->name:"[?]",
- un? un->pkt->pkt.user_id->len:3,
+ un? un->pkt->pkt.user_id->len:3,
-1 );
if(un)
@@ -1785,7 +1787,7 @@ check_sig_and_print( CTX c, KBNODE node )
fputs("\n", log_stream() );
}
- /* If we have a good signature and already printed
+ /* If we have a good signature and already printed
* the primary user ID, print all the other user IDs */
if ( count && !rc
&& !(opt.verify_options&VERIFY_SHOW_PRIMARY_UID_ONLY) ) {
@@ -1882,7 +1884,7 @@ check_sig_and_print( CTX c, KBNODE node )
bufp = bufp + strlen (bufp);
if (!vpk->is_primary) {
u32 akid[2];
-
+
akid[0] = vpk->main_keyid[0];
akid[1] = vpk->main_keyid[1];
free_public_key (vpk);
@@ -2030,7 +2032,7 @@ proc_tree( CTX c, KBNODE node )
log_error (_("not a detached signature\n") );
return;
}
-
+
for( n1 = node; (n1 = find_next_kbnode(n1, PKT_SIGNATURE )); )
check_sig_and_print( c, n1 );
}