From 56172ce393437be1434d5af11f775c85ed72c1b0 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 18 Dec 2001 17:37:48 +0000 Subject: Changes to be used with the new libksba interface. libgcrypt-1.1.5 is required (cvs or tarball) --- kbx/keybox-blob.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'kbx/keybox-blob.c') diff --git a/kbx/keybox-blob.c b/kbx/keybox-blob.c index 44d53d3d0..f3bc859b3 100644 --- a/kbx/keybox-blob.c +++ b/kbx/keybox-blob.c @@ -172,7 +172,8 @@ struct keyboxblob { size_t bloblen; /* stuff used only by keybox_create_blob */ - unsigned char *serial; + unsigned char *serialbuf; + const unsigned char *serial; size_t seriallen; int nkeys; struct keyboxblob_key *keys; @@ -820,7 +821,14 @@ _keybox_create_x509_blob (KEYBOXBLOB *r_blob, KsbaCert cert, p = ksba_cert_get_serial (cert); if (p) { - size_t n = (p[0] << 24) | (p[1] << 16) | (p[2] <<8) | p[3]; + size_t n; + n = gcry_sexp_canon_len (p, 0, NULL, NULL); + if (!n) + return KEYBOX_General_Error; + blob->serialbuf = p; + for (; n && *p != ':'; n--, p++) + ; + p++; blob->seriallen = n; blob->serial = p; } @@ -960,7 +968,7 @@ _keybox_release_blob (KEYBOXBLOB blob) return; /* hmmm: release membuf here?*/ xfree (blob->keys ); - xfree (blob->serial); + xfree (blob->serialbuf); for (i=0; i < blob->nuids; i++) xfree (blob->uids[i].name); xfree (blob->uids ); -- cgit v1.2.3