1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-01-30 16:17:02 +01:00

* keybox-blob.c (_keybox_create_x509_blob): Skip the leading

parenthesis of the serial number's S-exp.
(_keybox_create_x509_blob): And fixed length calculation.
(create_blob_header): Don't add an offset when writing the serial.
This commit is contained in:
Werner Koch 2001-12-20 16:50:13 +00:00
parent ee1b7e428b
commit b65e1cf90a
2 changed files with 15 additions and 7 deletions

View File

@ -2,6 +2,8 @@
* keybox-blob.c (_keybox_create_x509_blob): Skip the leading
parenthesis of the serial number's S-exp.
(_keybox_create_x509_blob): And fixed length calculation.
(create_blob_header): Don't add an offset when writing the serial.
2001-12-18 Werner Koch <wk@gnupg.org>

View File

@ -555,7 +555,7 @@ create_blob_header (KEYBOXBLOB blob, int blobtype)
put16 (a, blob->seriallen); /*fixme: check that it fits into 16 bits*/
if (blob->serial)
put_membuf (a, blob->serial+4, blob->seriallen);
put_membuf (a, blob->serial, blob->seriallen);
put16 ( a, blob->nuids );
put16 ( a, 4 + 4 + 2 + 1 + 1 ); /* size of uid info */
@ -821,20 +821,26 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, KsbaCert cert,
p = ksba_cert_get_serial (cert);
if (p)
{
size_t n;
size_t n, len;
n = gcry_sexp_canon_len (p, 0, NULL, NULL);
if (!n)
if (n < 2)
{
xfree (p);
return KEYBOX_General_Error;
}
blob->serialbuf = p;
p++; n--; /* skip '(' */
for (len=0; n && *p && *p != ':' && digitp (p); n--, p++)
len = len*10 + atoi_1 (p);
if (*p != ':')
{
xfree (blob->serialbuf);
blob->serialbuf = NULL;
return KEYBOX_General_Error;
}
p++;
for (; n && *p != ':'; n--, p++)
;
p++;
blob->seriallen = n;
blob->serial = p;
blob->seriallen = len;
}
blob->nkeys = 1;