diff options
author | Werner Koch <wk@gnupg.org> | 2011-02-03 16:31:42 +0100 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2011-02-03 16:35:33 +0100 |
commit | 0b5bcb40cf17a0e1032c113af6024c08b47d7a5c (patch) | |
tree | 6196c497d9734a6a022dd713df373416d2f9f067 /common | |
parent | Compute the fingerprint for ECDH only on demand. (diff) | |
download | gnupg2-0b5bcb40cf17a0e1032c113af6024c08b47d7a5c.tar.xz gnupg2-0b5bcb40cf17a0e1032c113af6024c08b47d7a5c.zip |
Finished ECC integration.
Wrote the ChangeLog 2011-01-13 entry for Andrey's orginal work modulo
the cleanups I did in the last week. Adjusted my own ChangeLog
entries to be consistent with that entry.
Nuked quite some trailing spaces; again sorry for that, I will better
take care of not saving them in the future. "git diff -b" is useful
to read the actual changes ;-).
The ECC-INTEGRATION-2-1 branch can be closed now.
Diffstat (limited to 'common')
-rw-r--r-- | common/ChangeLog | 2 | ||||
-rw-r--r-- | common/convert.c | 15 |
2 files changed, 7 insertions, 10 deletions
diff --git a/common/ChangeLog b/common/ChangeLog index 0214583b7..f5a707b62 100644 --- a/common/ChangeLog +++ b/common/ChangeLog @@ -3,8 +3,6 @@ * openpgp-oid.c: New. * t-openpgp-oid.c: New. - * convert.c (mpi2hex): Remove. - 2011-01-20 Werner Koch <wk@g10code.com> Fix bug#1313. diff --git a/common/convert.c b/common/convert.c index c314ec9a6..78a16c957 100644 --- a/common/convert.c +++ b/common/convert.c @@ -23,7 +23,6 @@ #include <ctype.h> #include "util.h" -#include "gcrypt.h" /* FIXME: really needed? */ #define tohex(n) ((n) < 10 ? ((n) + '0') : (((n) - 10) + 'A')) @@ -107,14 +106,14 @@ do_bin2hex (const void *buffer, size_t length, char *stringbuf, int with_colon) { const unsigned char *s; char *p; - + if (!stringbuf) { /* Not really correct for with_colon but we don't care about the one wasted byte. */ - size_t n = with_colon? 3:2; - size_t nbytes = n * length + 1; - if (length && (nbytes-1) / n != length) + size_t n = with_colon? 3:2; + size_t nbytes = n * length + 1; + if (length && (nbytes-1) / n != length) { gpg_err_set_errno (ENOMEM); return NULL; @@ -123,7 +122,7 @@ do_bin2hex (const void *buffer, size_t length, char *stringbuf, int with_colon) if (!stringbuf) return NULL; } - + for (s = buffer, p = stringbuf; length; length--, s++) { if (with_colon && s != buffer) @@ -172,7 +171,7 @@ bin2hexcolon (const void *buffer, size_t length, char *stringbuf) buffer, the function returns NULL and won't change the existing conent of buffer. In-place conversion is possible as long as BUFFER points to HEXSTRING. - + If BUFFER is NULL and bufsize is 0 the function scans HEXSTRING but does not store anything. This may be used to find the end of hexstring. @@ -205,7 +204,7 @@ hex2str (const char *hexstring, char *buffer, size_t bufsize, size_t *buflen) { if (count > bufsize) return NULL; /* Too long. */ - + for (s=hexstring, idx=0; hexdigitp (s) && hexdigitp (s+1); s += 2) ((unsigned char*)buffer)[idx++] = xtoi_2 (s); if (need_nul) |