Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: GnuPG: devel

missing hexstrint->plaintext conversion

 

 

GnuPG devel RSS feed   Index | Next | Previous | View Threaded


kissg at ssg

Aug 26, 2008, 8:48 AM

Post #1 of 4 (185 views)
Permalink
missing hexstrint->plaintext conversion

Dear Werner et al.,

At 2006-07-29 (svn revision 4209) gpg-preset-passphrases was changed
in order to send passphrases as hexstring.
Unfortunately the receiver side did not follow this change well.
Received hexstring is cached without converting back to plaintext.

This patch below fixes the problem.

Regards

Gabor

--- command.c-orig 2008-08-26 14:43:16.037456000 +0200
+++ command.c 2008-08-26 17:44:36.935945453 +0200
@@ -263,6 +263,28 @@
return 0;
}

+/* Convert (in place) an already parsed hexstring of
+ * 'len' digits to native bytes. */
+#define fromhex(h) ( (h)<='9' ? (h)-'0' : ((h)|0x20)-'a'+10 )
+static char *
+decode_hexstring (char *string, int len)
+{
+ unsigned char *from, *to;
+
+ for (from=to=(unsigned char*)string; len>0; to++)
+ {
+ unsigned char value;
+ value = fromhex(*from);
+ from++;
+ value <<= 4;
+ value |= fromhex(*from);
+ from++;
+ *to = value;
+ len -= 2;
+ }
+ return string;
+}
+
/* Parse the keygrip in STRING into the provided buffer BUF. BUF must
provide space for 20 bytes. BUF is not changed if the function
returns an error. */
@@ -1135,7 +1157,10 @@
/* If there is a passphrase, use it. Currently, a passphrase is
required. */
if (*line)
- passphrase = line;
+ {
+ passphrase = decode_hexstring(line, len);
+ passphrase[len/2] = '\0';
+ }
else
return gpg_error (GPG_ERR_NOT_IMPLEMENTED);


_______________________________________________
Gnupg-devel mailing list
Gnupg-devel[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel


wk at gnupg

Aug 27, 2008, 9:41 AM

Post #2 of 4 (166 views)
Permalink
Re: missing hexstrint->plaintext conversion [In reply to]

On Tue, 26 Aug 2008 17:48, kissg[at]ssg.ki.iif.hu said:

> At 2006-07-29 (svn revision 4209) gpg-preset-passphrases was changed
> in order to send passphrases as hexstring.
> Unfortunately the receiver side did not follow this change well.
> Received hexstring is cached without converting back to plaintext.

You mean, it does not work at all?


Salam-Shalom,

Werner

--
Linux-Kongress 2008 + Hamburg + October 7-10 + www.linux-kongress.org

Die Gedanken sind frei. Auschnahme regelt ein Bundeschgesetz.


_______________________________________________
Gnupg-devel mailing list
Gnupg-devel[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel


kissg at ssg

Aug 27, 2008, 10:17 AM

Post #3 of 4 (170 views)
Permalink
Re: missing hexstring->plaintext conversion [In reply to]

> > At 2006-07-29 (svn revision 4209) gpg-preset-passphrases was changed
> > in order to send passphrases as hexstring.
> > Unfortunately the receiver side did not follow this change well.
> > Received hexstring is cached without converting back to plaintext.
>
> You mean, it does not work at all?

Yes, it DID not work at all.
Until I decoded the hex string.
Now it is like a dream. :-)

Regards

Gabor

_______________________________________________
Gnupg-devel mailing list
Gnupg-devel[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel


wk at gnupg

Sep 3, 2008, 1:58 AM

Post #4 of 4 (163 views)
Permalink
Re: missing hexstrint->plaintext conversion [In reply to]

On Tue, 26 Aug 2008 17:48, kissg[at]ssg.ki.iif.hu said:

> This patch below fixes the problem.

I fixed it using a new hex2str function. Available as svn revision
4822.


Thanks,

Werner

--
Linux-Kongress 2008 + Hamburg + October 7-10 + www.linux-kongress.org

Die Gedanken sind frei. Auschnahme regelt ein Bundeschgesetz.


_______________________________________________
Gnupg-devel mailing list
Gnupg-devel[at]gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-devel

GnuPG devel RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.