diff options
author | Werner Koch <wk@gnupg.org> | 2001-05-28 21:12:27 +0000 |
---|---|---|
committer | Werner Koch <wk@gnupg.org> | 2001-05-28 21:12:27 +0000 |
commit | 08e3fbb986bed2f39cc5dca806faca9654c3a6df (patch) | |
tree | 8ff245903939d951c51b2c49b312074b91e94536 /mpi/mpicoder.c | |
parent | 7e68abda362fce76e91631973d062fd7c8ff5e4e (diff) | |
download | libgcrypt-08e3fbb986bed2f39cc5dca806faca9654c3a6df.tar.gz |
Merged back some changes fron gnupg. Fixed doc building.
Diffstat (limited to 'mpi/mpicoder.c')
-rw-r--r-- | mpi/mpicoder.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/mpi/mpicoder.c b/mpi/mpicoder.c index 4c169875..aea641bb 100644 --- a/mpi/mpicoder.c +++ b/mpi/mpicoder.c @@ -75,12 +75,12 @@ mpi_read_from_buffer(byte *buffer, unsigned *ret_nread, int secure) /**************** - * Make an mpi from a character string. + * Make an mpi from a hex character string. */ -int +static int mpi_fromstr(MPI val, const char *str) { - int hexmode=0, sign=0, prepend_zero=0, i, j, c, c1, c2; + int sign=0, prepend_zero=0, i, j, c, c1, c2; unsigned nbits, nbytes, nlimbs; mpi_limb_t a; @@ -88,11 +88,11 @@ mpi_fromstr(MPI val, const char *str) sign = 1; str++; } - if( *str == '0' && str[1] == 'x' ) - hexmode = 1; - else - return 1; /* other bases are not yet supported */ - str += 2; + + /* skip optional hex prefix */ + if ( *str == '0' && str[1] == 'x' ) { + str += 2; + } nbits = strlen(str)*4; if( nbits % 8 ) |