summaryrefslogtreecommitdiff
path: root/egg/egg-asn1x.c
diff options
context:
space:
mode:
authorStef Walter <stefw@collabora.co.uk>2011-11-18 13:22:40 +0100
committerStef Walter <stefw@collabora.co.uk>2011-11-23 09:10:52 +0100
commitc2c73dfc3ff6c94aa5615c1c8047ed8b862f7b6f (patch)
tree93459284592c45f2ebd1a665ccc903df27893ef7 /egg/egg-asn1x.c
parent07ac51b4f1c7268d807370cf63ab7de9c02d8ac1 (diff)
downloadgcr-c2c73dfc3ff6c94aa5615c1c8047ed8b862f7b6f.tar.gz
gcr: Implement functions for loading and using SubjectPublicKeyInfo
* Move key calculation routines into gcr-subject-public-key.c * Move creation of SPK from gcr-fingerprint.c into here * Implement loading of SPK from PKCS#11 certificates, public keys, private keys * Add support for parsing SubjectPublicKeyInfo to parser. Generates attributes for a CKO_PUBLIC_KEY * Fix bugs in DER encoding related to this. * More tweaks on testing infrastructure
Diffstat (limited to 'egg/egg-asn1x.c')
-rw-r--r--egg/egg-asn1x.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/egg/egg-asn1x.c b/egg/egg-asn1x.c
index b7890e8..fc80d8f 100644
--- a/egg/egg-asn1x.c
+++ b/egg/egg-asn1x.c
@@ -1703,6 +1703,8 @@ anode_encoder_bit_string (gpointer user_data,
static gboolean
anode_encode_prepare_simple (GNode *node, gboolean want)
{
+ EggBytes *backing;
+ EggBytes *bytes;
Aenc *enc;
Atlv *tlv;
@@ -1713,8 +1715,13 @@ anode_encode_prepare_simple (GNode *node, gboolean want)
/* Transfer the tlv data over to enc */
enc = anode_get_enc_data (node);
if (enc == NULL) {
- anode_set_enc_data (node, anode_encoder_data,
- (guchar *)tlv->buf + tlv->off, NULL);
+ backing = anode_get_backing (node);
+ if (backing == NULL)
+ return FALSE;
+
+ bytes = egg_bytes_new_with_free_func ((guchar *)tlv->buf + tlv->off, tlv->len,
+ egg_bytes_unref, egg_bytes_ref (backing));
+ anode_set_enc_data (node, anode_encoder_bytes, bytes, egg_bytes_unref);
}
tlv->buf = tlv->end = NULL;