mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-22 14:57:02 +01:00
indent: Re-indent parts of build-packet.c
--
This commit is contained in:
parent
b20780658e
commit
5b3523d3e0
@ -85,8 +85,9 @@ ctb_pkttype (int ctb)
|
||||
int
|
||||
build_packet( IOBUF out, PACKET *pkt )
|
||||
{
|
||||
int new_ctb=0, rc=0, ctb;
|
||||
int pkttype;
|
||||
int rc = 0;
|
||||
int new_ctb = 0;
|
||||
int ctb, pkttype;
|
||||
|
||||
if (DBG_PACKET)
|
||||
log_debug ("build_packet() type=%d\n", pkt->pkttype);
|
||||
@ -102,21 +103,28 @@ build_packet( IOBUF out, PACKET *pkt )
|
||||
if (pkt->pkt.public_key->seckey_info)
|
||||
pkttype = PKT_SECRET_SUBKEY;
|
||||
break;
|
||||
case PKT_PLAINTEXT: new_ctb = pkt->pkt.plaintext->new_ctb; break;
|
||||
case PKT_PLAINTEXT:
|
||||
new_ctb = pkt->pkt.plaintext->new_ctb;
|
||||
break;
|
||||
case PKT_ENCRYPTED:
|
||||
case PKT_ENCRYPTED_MDC: new_ctb = pkt->pkt.encrypted->new_ctb; break;
|
||||
case PKT_COMPRESSED:new_ctb = pkt->pkt.compressed->new_ctb; break;
|
||||
case PKT_ENCRYPTED_MDC:
|
||||
new_ctb = pkt->pkt.encrypted->new_ctb;
|
||||
break;
|
||||
case PKT_COMPRESSED:
|
||||
new_ctb = pkt->pkt.compressed->new_ctb;
|
||||
break;
|
||||
case PKT_USER_ID:
|
||||
if (pkt->pkt.user_id->attrib_data)
|
||||
pkttype = PKT_ATTRIBUTE;
|
||||
break;
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (new_ctb || pkttype > 15) /* new format */
|
||||
ctb = 0xc0 | (pkttype & 0x3f);
|
||||
ctb = (0xc0 | (pkttype & 0x3f));
|
||||
else
|
||||
ctb = 0x80 | ((pkttype & 15)<<2);
|
||||
ctb = (0x80 | ((pkttype & 15)<<2));
|
||||
switch (pkttype)
|
||||
{
|
||||
case PKT_ATTRIBUTE:
|
||||
@ -125,13 +133,11 @@ build_packet( IOBUF out, PACKET *pkt )
|
||||
break;
|
||||
case PKT_OLD_COMMENT:
|
||||
case PKT_COMMENT:
|
||||
/*
|
||||
Ignore these. Theoretically, this will never be called as
|
||||
we have no way to output comment packets any longer, but
|
||||
just in case there is some code path that would end up
|
||||
outputting a comment that was written before comments were
|
||||
dropped (in the public key?) this is a no-op.
|
||||
*/
|
||||
/* Ignore these. Theoretically, this will never be called as we
|
||||
* have no way to output comment packets any longer, but just in
|
||||
* case there is some code path that would end up outputting a
|
||||
* comment that was written before comments were dropped (in the
|
||||
* public key?) this is a no-op. */
|
||||
break;
|
||||
case PKT_PUBLIC_SUBKEY:
|
||||
case PKT_PUBLIC_KEY:
|
||||
@ -164,8 +170,10 @@ build_packet( IOBUF out, PACKET *pkt )
|
||||
rc = do_onepass_sig (out, ctb, pkt->pkt.onepass_sig);
|
||||
break;
|
||||
case PKT_RING_TRUST:
|
||||
break; /* ignore it (keyring.c does write it directly)*/
|
||||
case PKT_MDC: /* we write it directly, so we should never see it here. */
|
||||
/* Ignore it (keyring.c does write it directly) */
|
||||
break;
|
||||
case PKT_MDC:
|
||||
/* We write it directly, so we should never see it here. */
|
||||
default:
|
||||
log_bug ("invalid packet type in build_packet()\n");
|
||||
break;
|
||||
@ -266,7 +274,8 @@ calc_packet_length( PACKET *pkt )
|
||||
int new_ctb = 0;
|
||||
|
||||
log_assert (pkt->pkt.generic);
|
||||
switch( pkt->pkttype ) {
|
||||
switch (pkt->pkttype)
|
||||
{
|
||||
case PKT_PLAINTEXT:
|
||||
n = calc_plaintext (pkt->pkt.plaintext);
|
||||
new_ctb = pkt->pkt.plaintext->new_ctb;
|
||||
@ -312,10 +321,10 @@ write_fake_data (IOBUF out, gcry_mpi_t a)
|
||||
|
||||
|
||||
/* Serialize the user id (RFC 4880, Section 5.11) or the user
|
||||
attribute UID (Section 5.12) and write it to OUT.
|
||||
|
||||
CTB is the serialization's CTB. It specifies the header format and
|
||||
the packet's type. The header length must not be set. */
|
||||
* attribute UID (Section 5.12) and write it to OUT.
|
||||
*
|
||||
* CTB is the serialization's CTB. It specifies the header format and
|
||||
* the packet's type. The header length must not be set. */
|
||||
static int
|
||||
do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
|
||||
{
|
||||
@ -339,17 +348,17 @@ do_user_id( IOBUF out, int ctb, PKT_user_id *uid )
|
||||
|
||||
|
||||
/* Serialize the key (RFC 4880, Section 5.5) described by PK and write
|
||||
it to OUT.
|
||||
|
||||
This function serializes both primary keys and subkeys with or
|
||||
without a secret part.
|
||||
|
||||
CTB is the serialization's CTB. It specifies the header format and
|
||||
the packet's type. The header length must not be set.
|
||||
|
||||
PK->VERSION specifies the serialization format. A value of 0 means
|
||||
to use the default version. Currently, only version 4 packets are
|
||||
supported.
|
||||
* it to OUT.
|
||||
*
|
||||
* This function serializes both primary keys and subkeys with or
|
||||
* without a secret part.
|
||||
*
|
||||
* CTB is the serialization's CTB. It specifies the header format and
|
||||
* the packet's type. The header length must not be set.
|
||||
*
|
||||
* PK->VERSION specifies the serialization format. A value of 0 means
|
||||
* to use the default version. Currently, only version 4 packets are
|
||||
* supported.
|
||||
*/
|
||||
static int
|
||||
do_key (iobuf_t out, int ctb, PKT_public_key *pk)
|
||||
@ -496,11 +505,12 @@ do_key (iobuf_t out, int ctb, PKT_public_key *pk)
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Serialize the symmetric-key encrypted session key packet (RFC 4880,
|
||||
5.3) described by ENC and write it to OUT.
|
||||
|
||||
CTB is the serialization's CTB. It specifies the header format and
|
||||
the packet's type. The header length must not be set. */
|
||||
/* Serialize the symmetric-key encrypted session key packet (RFC 4880,
|
||||
* 5.3) described by ENC and write it to OUT.
|
||||
*
|
||||
* CTB is the serialization's CTB. It specifies the header format and
|
||||
* the packet's type. The header length must not be set. */
|
||||
static int
|
||||
do_symkey_enc( IOBUF out, int ctb, PKT_symkey_enc *enc )
|
||||
{
|
||||
@ -515,14 +525,10 @@ do_symkey_enc( IOBUF out, int ctb, PKT_symkey_enc *enc )
|
||||
/* RFC 4880, Section 3.7. */
|
||||
switch (enc->s2k.mode)
|
||||
{
|
||||
/* Simple S2K. */
|
||||
case 0:
|
||||
/* Salted S2K. */
|
||||
case 1:
|
||||
/* Iterated and salted S2K. */
|
||||
case 3:
|
||||
/* Reasonable values. */
|
||||
break;
|
||||
case 0: /* Simple S2K. */
|
||||
case 1: /* Salted S2K. */
|
||||
case 3: /* Iterated and salted S2K. */
|
||||
break; /* Reasonable values. */
|
||||
|
||||
default:
|
||||
log_bug ("do_symkey_enc: s2k=%d\n", enc->s2k.mode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user