segfault: setteing openpgp credentials via abstract functions

Joke de Buhr joke at seiken.de
Tue Sep 18 17:23:32 CEST 2012


hi,

i have discovered an problem regarding the openpgp functions.

if i try to set openpgp credentials by using the abstract functions gnutls 
segfaults.

gnutls_pcert_st pcert;
gnutls_privkey_t pkey;
gnutls_privkey_init(&pkey);
r = gnutls_pcert_import_openpgp_raw(&pcert, &pub_data,
	GNUTLS_OPENPGP_FMT_RAW, keyid, 0);
r = gnutls_privkey_import_openpgp_raw(pkey, &priv_data,
	GNUTLS_OPENPGP_FMT_RAW, keyid, nullptr);
r = gnutls_certificate_set_key(cre, nullptr, 1, &pcert, 1, pkey);

the last function will cause a segfault in cdk_kbnode_walk(). the keyid is 
specified correctly. the import functions return success. then pgp-key contains 
a master key and one single subkey.

#0 cdk_kbnode_walk() at lib/opencdk/kbnode.c:268
#1 _gnutls_openpgp_find_subkey_idx() at lib/openpgp/pgp.c:763
#2 gnutls_openpgp_privkey_get_subkey_idx() at lib/openpgp/privkey.c:583
#3 gnutls_openpgp_privkey_get_pk_algorithm() at lib/openpgp/privkey.c:269
#4 gnutls_openpgp_privkey_get_pk_algorithm() at lib/openpgp/privkey.c:251
#5 gnutls_privkey_get_pk_algorithm() at lib/gnutls_privkey.c:74
#6 _gnutls_check_key_cert_match() at lib/gnutls_cert.c:831
#7 gnutls_certificate_set_key() at lib/gnutls_x509.c:1102


regards
Joke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 729 bytes
Desc: This is a digitally signed message part.
URL: </pipermail/attachments/20120918/a615bc40/attachment.pgp>


More information about the Gnutls-help mailing list