Commit Graph

52 Commits

Author SHA1 Message Date
Luke Dashjr
cca7f63c6c Merge pull request #3 from luke-jr/dyn_intsize
Refactor b58tobin to be more easily reconfigured for using different integer sizes
2018-03-18 19:41:28 +00:00
Luke Dashjr
6b23367527 Merge pull request #5 from randolf/patch-1
Added dependency information in INSTALL about "xxd"
2018-03-18 19:40:57 +00:00
Randolf Richardson
48fdd386d2 Added dependency information about "xxd" 2018-03-18 09:10:25 -07:00
e271828-
1cb26b5bff Add INSTALL, fix README typo. 2017-04-06 11:52:25 -07:00
Jon Griffiths
bee00a6e88 Test case 2016-04-10 14:14:46 +12:00
Jon Griffiths
a861d3c57f Revert variable signedness changes.
In the line:

    for (carry = bin[i], j = size - 1; (j > high) || carry; --j)

my analysis missed that the compare (j > high) is always true when
high is 0 and j wraps around. So although the loop does not store
through a negative 'j' offset, it does require j to become negative
in order to terminate the loop in that case. My apologies.
2016-04-10 02:22:01 +12:00
Jon Griffiths
5df7d3b19a b58enc: Make loop variables unsigned
size can only be positive (and non-zero) as it is set to a positive expr + 1.
high is initialised with size-1 which is never negative, and then set to j at
the end of each loop iteration. It therefore can only be negative if j can.
The heart of the loop assigns to buf[j] which is on the stack. If j can become
negative during the loop then this is clearly undefined behaviour.

Following the loop, high is unused and j is reset to 0 and only incremented.
Thus both variables can be declared unsigned, and sys/types.h removed since
there are no more ssize_t variables remaining. This removes the last two sign
compare warnings from this file.
2016-04-04 21:16:13 +12:00
Jon Griffiths
e77d2999fe b58enc: Make loop variables unsigned
zcount can only ever be positive as it starts from 0 and is incremented.
i can only be positive as it starts from zcount and is incremented. This
removes one of three sign compare warnings in this function.
2016-04-04 21:15:21 +12:00
Luke Dashjr
8a92496475 Refactor b58tobin to be more easily reconfigured for using different integer sizes 2016-03-23 09:12:05 +00:00
Luke Dashjr
ae5fe61864 Travis: Use sudo-less infrastructure, and add simple Win32/64 builds 2016-02-10 05:12:44 +00:00
Luke Dashjr
e28341c60e Travis: Build and run tests 2016-02-04 01:01:45 +00:00
Luke Dashjr
16c2527608 Bump version to 0.1.4 v0.1.4 2015-06-05 03:32:21 +00:00
Luke Dashjr
bca0d4bebd Merge remote-tracking branch 'origin-pull/1/head' into HEAD 2015-02-28 02:21:30 +00:00
Luke Dashjr
cdeed0709e tests: Check decode with high bits set fails
This doesn't catch out-of-bounds memory access, but it's a good test to have anyway.
2015-02-28 02:21:00 +00:00
Aaron Voisine
13dfa66514 fix for potential out-of-bounds memory access
if when counting leading zeros an invalid digit is encountered with it's high-bit set, the index into b58digits_map will be out-of-bounds
2015-02-27 12:21:24 -08:00
Luke Dashjr
b6adca8ebb Bugfix: Add missing <sys/types.h> include for ssize_t v0.1.3 2014-11-18 23:15:36 +00:00
Luke Dashjr
4317cf055e Bump version to 0.1.2 v0.1.2 2014-10-29 14:31:21 +00:00
Luke Dashjr
2c6b7916b6 Bugfix: Use signed types so that j can go negative without underflow
In some cases, j made it negative which made (j > high) true creating a segfault condition
2014-10-26 00:26:42 +00:00
Luke Dashjr
5d53799021 Adapt tests so they can run with the serial harness used in older automake versions 2014-09-16 07:28:10 +00:00
Luke Dashjr
fa132f17c4 Address most LLVM warnings 2014-09-16 07:27:55 +00:00
Luke Dashjr
6d2d2c5f0e b58tobin: Simplify zeromask calculation (fixes bug encountered when compiling with LLVM) 2014-09-16 02:39:55 +00:00
Luke Dashjr
06e594e37f Include COPYING in dist_doc_DATA v0.1.1 2014-08-31 20:50:45 +00:00
Luke Dashjr
3850beffa1 Merge branch 'master' of github.com:bitcoin/libbase58 2014-08-31 20:50:18 +00:00
Luke Dashjr
619e4e15e3 configure: Check for AM_PATH_LIBGCRYPT macro explicitly, so autogen is possible without libgcrypt 2014-08-29 01:32:17 +00:00
Luke Dashjr
2b70e26f47 AUTHORS: List of contributors 2014-08-29 01:22:33 +00:00
Luke Dashjr
a3f784e608 configure: Require only automake 1.11, since that is sufficient 2014-08-29 01:20:14 +00:00
Wladimir J. van der Laan
a978f5f734 Add COPYING file with MIT license 2014-08-28 16:08:44 +02:00
Luke Dashjr
45eb5d93a2 clitool: Missing copyright header v0.1.0 v0.1.0_rc1 2014-08-23 23:22:49 +00:00
Luke Dashjr
84dd3c2e2d clitool: Silence warnings 2014-08-23 18:58:34 +00:00
Luke Dashjr
d107e2bbda Include Cflags in .pc file 2014-08-22 19:06:29 +00:00
Luke Dashjr
3e3cfa849e tests: Check small decode/encode 2014-08-18 20:22:13 +00:00
Luke Dashjr
9f0f04769f Bugfix: b58tobin: Correct zeromask for multiple-of-four binary buffer sizes 2014-08-18 20:18:49 +00:00
Luke Dashjr
62645c5114 Avoid unsafe casting 2014-08-18 20:18:22 +00:00
Luke Dashjr
09d549e15d Rename base58.h to libbase58.h to decrease chance of conflicts 2014-08-18 15:53:56 +00:00
Luke Dashjr
201d210481 configure: AC_CONFIG_AUX_DIR is needed to embed in non-library projects 2014-08-18 15:51:04 +00:00
Luke Dashjr
2880b80cbd Modify b58tobin to return canonical size 2014-08-18 15:50:06 +00:00
Luke Dashjr
1e56deac4c README: Document strlen behaviour of b58tobin 2014-08-18 14:58:32 +00:00
Luke Dashjr
9dc2bf2f6a Include extern "C" wrapper in base58.h so it can be used from C++ code 2014-08-18 14:52:20 +00:00
Luke Dashjr
88761e9e2c b58check: Check binsz is long enough for checksum 2014-08-18 14:51:58 +00:00
Luke Dashjr
58d0e9a7ab Bugfix: Actually skip building the tool if disabled 2014-08-17 17:03:08 +00:00
Luke Dashjr
c0994385c3 Test suite using base58 CLI tool 2014-08-17 17:01:47 +00:00
Luke Dashjr
4e05a3d300 Command line tool "base58" 2014-08-17 16:43:27 +00:00
Luke Dashjr
79a608586d Bugfix: Avoid confusing digit-to-number and number-to-digit mappings 2014-08-17 16:25:35 +00:00
Luke Dashjr
b3034841db b58check_enc function and docs 2014-08-17 12:23:40 +00:00
Luke Dashjr
6a93c8339b README: Document b58enc function 2014-08-17 12:23:12 +00:00
Luke Dashjr
7ecd1102d0 b58enc: Allocate buf on the stack rather than heap 2014-08-17 12:04:10 +00:00
Luke Dashjr
a2853bb766 b58enc: Accept any kind of pointer for binary data 2014-08-17 12:03:54 +00:00
Huang Le
f55613ac56 b58enc function 2014-08-17 12:00:29 +00:00
Luke Dashjr
d761ab6401 Add README documentation 2014-08-17 11:52:36 +00:00
Luke Dashjr
696869093e Accept const data for b58check 2014-08-17 11:52:33 +00:00