mirror of
git://git.gnupg.org/gnupg.git
synced 2025-02-01 16:33:02 +01:00
* decrypt.c (prepare_decryption): Hack to detected already
unpkcsedone keys.
This commit is contained in:
parent
beb0fef1ee
commit
dc8f3ee42c
@ -1,5 +1,8 @@
|
|||||||
2002-08-09 Werner Koch <wk@gnupg.org>
|
2002-08-09 Werner Koch <wk@gnupg.org>
|
||||||
|
|
||||||
|
* decrypt.c (prepare_decryption): Hack to detected already
|
||||||
|
unpkcsedone keys.
|
||||||
|
|
||||||
* gpgsm.c (emergency_cleanup): New.
|
* gpgsm.c (emergency_cleanup): New.
|
||||||
(main): Initialize the signal handler.
|
(main): Initialize the signal handler.
|
||||||
|
|
||||||
|
54
sm/decrypt.c
54
sm/decrypt.c
@ -73,33 +73,41 @@ prepare_decryption (const char *hexkeygrip, KsbaConstSexp enc_val,
|
|||||||
log_printhex ("pkcs1 encoded session key:", seskey, seskeylen);
|
log_printhex ("pkcs1 encoded session key:", seskey, seskeylen);
|
||||||
|
|
||||||
n=0;
|
n=0;
|
||||||
if (n + 7 > seskeylen )
|
if (seskeylen == 24)
|
||||||
{
|
{
|
||||||
rc = seterr (Invalid_Session_Key);
|
/* Smells like a 3-des key. This might happen because a SC has
|
||||||
goto leave;
|
already done the unpacking. fixme! */
|
||||||
}
|
}
|
||||||
|
else
|
||||||
/* FIXME: Actually the leading zero is required but due to the way
|
|
||||||
we encode the output in libgcrypt as an MPI we are not able to
|
|
||||||
encode that leading zero. However, when using a Smartcard we are
|
|
||||||
doing it the rightway and therefore we have to skip the zero. This
|
|
||||||
should be fixed in gpg-agent of course. */
|
|
||||||
if (!seskey[n])
|
|
||||||
n++;
|
|
||||||
|
|
||||||
if (seskey[n] != 2 ) /* wrong block type version */
|
|
||||||
{
|
{
|
||||||
rc = seterr (Invalid_Session_Key);
|
if (n + 7 > seskeylen )
|
||||||
goto leave;
|
{
|
||||||
}
|
rc = seterr (Invalid_Session_Key);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
for (n++; n < seskeylen && seskey[n]; n++) /* skip the random bytes */
|
/* FIXME: Actually the leading zero is required but due to the way
|
||||||
;
|
we encode the output in libgcrypt as an MPI we are not able to
|
||||||
n++; /* and the zero byte */
|
encode that leading zero. However, when using a Smartcard we are
|
||||||
if (n >= seskeylen )
|
doing it the rightway and therefore we have to skip the zero. This
|
||||||
{
|
should be fixed in gpg-agent of course. */
|
||||||
rc = seterr (Invalid_Session_Key);
|
if (!seskey[n])
|
||||||
goto leave;
|
n++;
|
||||||
|
|
||||||
|
if (seskey[n] != 2 ) /* wrong block type version */
|
||||||
|
{
|
||||||
|
rc = seterr (Invalid_Session_Key);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (n++; n < seskeylen && seskey[n]; n++) /* skip the random bytes */
|
||||||
|
;
|
||||||
|
n++; /* and the zero byte */
|
||||||
|
if (n >= seskeylen )
|
||||||
|
{
|
||||||
|
rc = seterr (Invalid_Session_Key);
|
||||||
|
goto leave;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DBG_CRYPTO)
|
if (DBG_CRYPTO)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user