ECC Key export incorrectly produces 0-sized output for secret part of key.

Kyle Butt kylebutt at gmail.com
Fri Aug 29 01:23:31 CEST 2014


As far as I can tell, the agent produces s-expressions where the public and
private key values are opaque, and then gcry_mpi_aprint prints an empty
value inside of apply_protection in agent/cvt-openpgp.c (There's a complete
backtrace at the end.)

I'd go further, but I'm unsure which is wrong, the opaqueness, or the
conversion routine.

Thanks,
Kyle.

#0  _gcry_mpi_print (format=format at entry=GCRYMPI_FMT_USG, buffer=0xb6201748
"@", buflen=32,
    nwritten=nwritten at entry=0xb60ff04c, a=a at entry=0xb6201730) at
mpicoder.c:693
#1  0xb76e170b in _gcry_mpi_aprint (format=format at entry=GCRYMPI_FMT_USG,
buffer=buffer at entry=0xb60ff1a0,
    nwritten=nwritten at entry=0xb60ff150, a=a at entry=0xb6201730) at
mpicoder.c:854
#2  0xb7679db3 in gcry_mpi_aprint (format=format at entry=GCRYMPI_FMT_USG,
buffer=buffer at entry=0xb60ff1a0,
    nwritten=nwritten at entry=0xb60ff150, a=0xb6201730) at visibility.c:374
#3  0x0806c077 in apply_protection (protect_algo=7, protect_ivlen=16,
s2k_mode=3, s2k_algo=2, s2k_count=190,
    s2k_salt=0xb60ff100 "\036\323\v\361\324\330\062\301",
protect_iv=0xb60ff118,
    passphrase=0xb76557c8 "Test Key 1", nskey=2, npkey=1, array=0xb60ff128)
at cvt-openpgp.c:1067
#4  convert_to_openpgp (ctrl=ctrl at entry=0x833dc68, s_key=0xb76557f0,
    passphrase=passphrase at entry=0xb76557c8 "Test Key 1",
r_transferkey=r_transferkey at entry=0xb60ff238,
    r_transferkeylen=r_transferkeylen at entry=0xb60ff23c) at
cvt-openpgp.c:1261
#5  0x08052fee in cmd_export_key (ctx=0xb62004b0, line=<optimized out>) at
command.c:2192
#6  0xb7663608 in dispatch_command (ctx=ctx at entry=0xb62004b0,
line=<optimized out>, line at entry=0xb620056c "END",
    linelen=<optimized out>) at assuan-handler.c:675
#7  0xb7664557 in process_request (ctx=0xb62004b0) at assuan-handler.c:871
#8  assuan_process (ctx=0xb62004b0) at assuan-handler.c:894
#9  0x08055e97 in start_command_handler (ctrl=ctrl at entry=0x833dc68,
listen_fd=listen_fd at entry=-1, fd=4)
    at command.c:3058
#10 0x08050167 in start_connection_thread (arg=0x833dc68) at
gpg-agent.c:2073
#11 start_connection_thread (arg=0x833dc68) at gpg-agent.c:2057
#12 0xb7648526 in thread_start () from /lib/libnpth.so.0
#13 0x4b7e3aff in start_thread () from /lib/libpthread.so.0
#14 0x4b7130ee in clone () from /lib/libc.so.6
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20140828/318ea248/attachment.html>


More information about the Gnupg-devel mailing list