[svn] GnuPG - r5455 - trunk/g10
svn author wk
cvs at cvs.gnupg.org
Mon Oct 18 15:54:43 CEST 2010
Author: wk
Date: 2010-10-18 15:54:42 +0200 (Mon, 18 Oct 2010)
New Revision: 5455
Modified:
trunk/g10/ChangeLog
trunk/g10/call-agent.c
Log:
replace some sprintf by bin2hex.
Modified: trunk/g10/ChangeLog
===================================================================
--- trunk/g10/ChangeLog 2010-10-18 13:40:06 UTC (rev 5454)
+++ trunk/g10/ChangeLog 2010-10-18 13:54:42 UTC (rev 5455)
@@ -1,5 +1,8 @@
2010-10-18 Werner Koch <wk at g10code.com>
+ * call-agent.c (agent_scd_pksign): Replace sprintf by bin2hex.
+ (agent_scd_pkdecrypt, agent_pksign): Ditto.
+
* sign.c (do_sign): Remove warning and commented old code.
2010-10-14 Werner Koch <wk at g10code.com>
Modified: trunk/g10/call-agent.c
===================================================================
--- trunk/g10/call-agent.c 2010-10-18 13:40:06 UTC (rev 5454)
+++ trunk/g10/call-agent.c 2010-10-18 13:54:42 UTC (rev 5455)
@@ -935,8 +935,8 @@
const unsigned char *indata, size_t indatalen,
unsigned char **r_buf, size_t *r_buflen)
{
- int rc, i;
- char *p, line[ASSUAN_LINELENGTH];
+ int rc;
+ char line[ASSUAN_LINELENGTH];
membuf_t data;
size_t len;
@@ -959,10 +959,9 @@
if (rc)
return rc;
- sprintf (line, "SCD SETDATA ");
- p = line + strlen (line);
- for (i=0; i < indatalen ; i++, p += 2 )
- sprintf (p, "%02X", indata[i]);
+ strcpy (line, "SCD SETDATA ");
+ bin2hex (indata, indatalen, line + strlen (line));
+
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
return rc;
@@ -999,8 +998,8 @@
const unsigned char *indata, size_t indatalen,
unsigned char **r_buf, size_t *r_buflen)
{
- int rc, i;
- char *p, line[ASSUAN_LINELENGTH];
+ int rc;
+ char line[ASSUAN_LINELENGTH];
membuf_t data;
size_t len;
@@ -1020,10 +1019,9 @@
if (rc)
return rc;
- sprintf (line, "SCD SETDATA ");
- p = line + strlen (line);
- for (i=0; i < indatalen ; i++, p += 2 )
- sprintf (p, "%02X", indata[i]);
+ strcpy (line, "SCD SETDATA ");
+ bin2hex (indata, indatalen, line + strlen (line));
+
rc = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
if (rc)
return rc;
@@ -1635,8 +1633,7 @@
gcry_sexp_t *r_sigval)
{
gpg_error_t err;
- int i;
- char *p, line[ASSUAN_LINELENGTH];
+ char line[ASSUAN_LINELENGTH];
membuf_t data;
*r_sigval = NULL;
@@ -1669,9 +1666,7 @@
}
snprintf (line, sizeof line, "SETHASH %d ", digestalgo);
- p = line + strlen (line);
- for (i=0; i < digestlen ; i++, p += 2 )
- sprintf (p, "%02X", digest[i]);
+ bin2hex (digest, digestlen, line + strlen (line));
err = assuan_transact (agent_ctx, line, NULL, NULL, NULL, NULL, NULL, NULL);
if (err)
return err;
More information about the Gnupg-commits
mailing list