summaryrefslogtreecommitdiff
path: root/lib/opencdk/read-packet.c
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2008-09-16 17:24:55 +0200
committerSimon Josefsson <simon@josefsson.org>2008-09-16 17:24:55 +0200
commit0e7fdf91bd810f400bdd9faa73d47c0c5797a213 (patch)
treedb0ea92eeb0e9649c231ac7bc7662f65476e6416 /lib/opencdk/read-packet.c
parent5cff6d578d0c38c56f2c8dfafa7d6dfc3ecbc4db (diff)
downloadgnutls-0e7fdf91bd810f400bdd9faa73d47c0c5797a213.tar.gz
Indent.
Diffstat (limited to 'lib/opencdk/read-packet.c')
-rw-r--r--lib/opencdk/read-packet.c65
1 files changed, 34 insertions, 31 deletions
diff --git a/lib/opencdk/read-packet.c b/lib/opencdk/read-packet.c
index 5b423945fa..cc3c40f2ba 100644
--- a/lib/opencdk/read-packet.c
+++ b/lib/opencdk/read-packet.c
@@ -86,15 +86,15 @@ read_s2k (cdk_stream_t inp, cdk_s2k_t s2k)
s2k->mode = cdk_stream_getc (inp);
s2k->hash_algo = cdk_stream_getc (inp);
- if (s2k->mode == CDK_S2K_SIMPLE)
- return 0;
+ if (s2k->mode == CDK_S2K_SIMPLE)
+ return 0;
else if (s2k->mode == CDK_S2K_SALTED || s2k->mode == CDK_S2K_ITERSALTED)
{
if (stream_read (inp, s2k->salt, DIM (s2k->salt), &nread))
return CDK_Inv_Packet;
if (nread != DIM (s2k->salt))
return CDK_Inv_Packet;
-
+
if (s2k->mode == CDK_S2K_ITERSALTED)
s2k->count = cdk_stream_getc (inp);
}
@@ -355,19 +355,21 @@ read_secret_key (cdk_stream_t inp, size_t pktlen, cdk_pkt_seckey_t sk)
rc = read_s2k (inp, sk->protect.s2k);
if (rc)
return rc;
- /* refer to --export-secret-subkeys in gpg(1) */
- if (sk->protect.s2k->mode == CDK_S2K_GNU_EXT)
- sk->protect.ivlen = 0;
- else {
- sk->protect.ivlen = _gnutls_cipher_get_block_size ( sk->protect.algo);
- if (!sk->protect.ivlen)
- return CDK_Inv_Packet;
- rc = stream_read (inp, sk->protect.iv, sk->protect.ivlen, &nread);
- if (rc)
- return rc;
- if (nread != sk->protect.ivlen)
- return CDK_Inv_Packet;
- }
+ /* refer to --export-secret-subkeys in gpg(1) */
+ if (sk->protect.s2k->mode == CDK_S2K_GNU_EXT)
+ sk->protect.ivlen = 0;
+ else
+ {
+ sk->protect.ivlen =
+ _gnutls_cipher_get_block_size (sk->protect.algo);
+ if (!sk->protect.ivlen)
+ return CDK_Inv_Packet;
+ rc = stream_read (inp, sk->protect.iv, sk->protect.ivlen, &nread);
+ if (rc)
+ return rc;
+ if (nread != sk->protect.ivlen)
+ return CDK_Inv_Packet;
+ }
}
else
sk->protect.algo = _pgp_cipher_to_gnutls (sk->s2k_usage);
@@ -422,21 +424,22 @@ read_secret_key (cdk_stream_t inp, size_t pktlen, cdk_pkt_seckey_t sk)
if (stream_read (inp, sk->encdata, sk->enclen, &nread))
return CDK_Inv_Packet;
/* Handle the GNU S2K extensions we know (just gnu-dummy right now): */
- if (sk->protect.s2k->mode == CDK_S2K_GNU_EXT) {
- unsigned char gnumode;
- if ((sk->enclen < strlen("GNU") + 1) ||
- (0 != memcmp("GNU", sk->encdata, strlen("GNU"))))
- return CDK_Inv_Packet;
- gnumode = sk->encdata[strlen("GNU")];
- /* we only handle gnu-dummy (mode 1).
- mode 2 should refer to external smart cards.
- */
- if (gnumode != 1)
- return CDK_Inv_Packet;
- /* gnu-dummy should have no more data */
- if (sk->enclen != strlen("GNU") + 1)
- return CDK_Inv_Packet;
- }
+ if (sk->protect.s2k->mode == CDK_S2K_GNU_EXT)
+ {
+ unsigned char gnumode;
+ if ((sk->enclen < strlen ("GNU") + 1) ||
+ (0 != memcmp ("GNU", sk->encdata, strlen ("GNU"))))
+ return CDK_Inv_Packet;
+ gnumode = sk->encdata[strlen ("GNU")];
+ /* we only handle gnu-dummy (mode 1).
+ mode 2 should refer to external smart cards.
+ */
+ if (gnumode != 1)
+ return CDK_Inv_Packet;
+ /* gnu-dummy should have no more data */
+ if (sk->enclen != strlen ("GNU") + 1)
+ return CDK_Inv_Packet;
+ }
nskey = cdk_pk_get_nskey (sk->pk->pubkey_algo);
if (!nskey)
{