mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
sm: Improve pkcs#12 debug output.
* sm/minip12.c (parse_shrouded_key_bag): Fix offset diagnostic. (parse_cert_bag): Ditto. (parse_bag_data): Remove debug output. Pass startoffset. Fix offset diagnostic.
This commit is contained in:
parent
a4e04375e8
commit
52f9e13c0c
16
sm/minip12.c
16
sm/minip12.c
@ -1607,8 +1607,8 @@ parse_shrouded_key_bag (struct p12_parse_ctx_s *ctx,
|
|||||||
|
|
||||||
bailout:
|
bailout:
|
||||||
gcry_free (plain);
|
gcry_free (plain);
|
||||||
log_error ("data error at \"%s\", offset %u\n",
|
log_error ("data error at \"%s\", offset %zu\n",
|
||||||
where, (unsigned int)((p - buffer) + startoffset));
|
where, (size_t)((p - p_start) + startoffset));
|
||||||
if (!err)
|
if (!err)
|
||||||
err = gpg_error (GPG_ERR_GENERAL);
|
err = gpg_error (GPG_ERR_GENERAL);
|
||||||
|
|
||||||
@ -1629,6 +1629,7 @@ parse_cert_bag (struct p12_parse_ctx_s *ctx,
|
|||||||
gpg_error_t err = 0;
|
gpg_error_t err = 0;
|
||||||
struct tag_info ti;
|
struct tag_info ti;
|
||||||
const unsigned char *p = buffer;
|
const unsigned char *p = buffer;
|
||||||
|
const unsigned char *p_start = buffer;
|
||||||
size_t n = length;
|
size_t n = length;
|
||||||
const char *where;
|
const char *where;
|
||||||
size_t consumed = 0; /* Number of bytes consumed from the original buffer. */
|
size_t consumed = 0; /* Number of bytes consumed from the original buffer. */
|
||||||
@ -1703,7 +1704,7 @@ parse_cert_bag (struct p12_parse_ctx_s *ctx,
|
|||||||
|
|
||||||
bailout:
|
bailout:
|
||||||
log_error ( "data error at \"%s\", offset %u\n",
|
log_error ( "data error at \"%s\", offset %u\n",
|
||||||
where, (unsigned int)((p - buffer) + startoffset));
|
where, (unsigned int)((p - p_start) + startoffset));
|
||||||
err = gpg_error (GPG_ERR_GENERAL);
|
err = gpg_error (GPG_ERR_GENERAL);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
@ -1780,7 +1781,6 @@ parse_bag_data (struct p12_parse_ctx_s *ctx,
|
|||||||
if (ti.class || ti.tag != TAG_OBJECT_ID)
|
if (ti.class || ti.tag != TAG_OBJECT_ID)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
log_printhex (p, ti.length, "oid");
|
|
||||||
/* Now divert to the actual parser. */
|
/* Now divert to the actual parser. */
|
||||||
if (ti.length == DIM(oid_pkcs_12_pkcs_8ShroudedKeyBag)
|
if (ti.length == DIM(oid_pkcs_12_pkcs_8ShroudedKeyBag)
|
||||||
&& !memcmp (p, oid_pkcs_12_pkcs_8ShroudedKeyBag,
|
&& !memcmp (p, oid_pkcs_12_pkcs_8ShroudedKeyBag,
|
||||||
@ -1789,7 +1789,8 @@ parse_bag_data (struct p12_parse_ctx_s *ctx,
|
|||||||
p += DIM(oid_pkcs_12_pkcs_8ShroudedKeyBag);
|
p += DIM(oid_pkcs_12_pkcs_8ShroudedKeyBag);
|
||||||
n -= DIM(oid_pkcs_12_pkcs_8ShroudedKeyBag);
|
n -= DIM(oid_pkcs_12_pkcs_8ShroudedKeyBag);
|
||||||
|
|
||||||
if (parse_shrouded_key_bag (ctx, p, n, 0, r_consumed))
|
if (parse_shrouded_key_bag (ctx, p, n,
|
||||||
|
startoffset + (p - p_start), r_consumed))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
else if ( ti.length == DIM(oid_pkcs_12_CertBag)
|
else if ( ti.length == DIM(oid_pkcs_12_CertBag)
|
||||||
@ -1798,7 +1799,8 @@ parse_bag_data (struct p12_parse_ctx_s *ctx,
|
|||||||
p += DIM(oid_pkcs_12_CertBag);
|
p += DIM(oid_pkcs_12_CertBag);
|
||||||
n -= DIM(oid_pkcs_12_CertBag);
|
n -= DIM(oid_pkcs_12_CertBag);
|
||||||
|
|
||||||
if (parse_cert_bag (ctx, p, n, 0, r_consumed))
|
if (parse_cert_bag (ctx, p, n,
|
||||||
|
startoffset + (p - p_start), r_consumed))
|
||||||
goto bailout;
|
goto bailout;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1808,7 +1810,7 @@ parse_bag_data (struct p12_parse_ctx_s *ctx,
|
|||||||
|
|
||||||
bailout:
|
bailout:
|
||||||
log_error ( "data error at \"%s\", offset %u\n",
|
log_error ( "data error at \"%s\", offset %u\n",
|
||||||
where, (unsigned int)((p - buffer) + startoffset));
|
where, (unsigned int)((p - p_start) + startoffset));
|
||||||
err = gpg_error (GPG_ERR_GENERAL);
|
err = gpg_error (GPG_ERR_GENERAL);
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user