Commit graph

322 commits

Author SHA1 Message Date
Dag-Erling Smørgrav
856571a06d Implement a soft assert for unit tests.
Unlike assert(3), which uses abort(3), this has no other side effects (before raising SIGABRT) than an fprintf() call.  The test framework will catch the SIGABRT, report that the test case failed, and proceed with the next case.
2016-11-14 13:00:16 +01:00
Dag-Erling Smørgrav
c6158a8dbf Don't confuse 2 ^ n with 1 << n in debugging output. 2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
2ba5067496 Do not attempt to catch SIGABRT emanating from a test case.
It is reasonable to assume that a SIGABRT originates from a call to abort(3), either directly or via assert(3).  Both the C standard and POSIX give the implementation great latitude with regard to abort(3)'s behavior, and both explicitly mention that it may close all streams before raising SIGABRT.  This means that we cannot safely proceed after a call to abort(3).  One could argue that we can't safely proceed after a SIGBUS or SIGSEGV either, but in practice, the damage is usually quite limited.
2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
183f023ab6 Alphabetize. 2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
f612ea1b14 Add dependencies on libcryb-core to all other libraries, as already enforced in the configure script. 2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
99691252ca Ignore editor droppings. 2016-11-14 12:59:13 +01:00
Dag-Erling Smørgrav
c4798b486c Constify t_compare_ptr(). 2016-10-03 16:55:27 +02:00
Dag-Erling Smørgrav
94c83d5407 Remove tautological condition. 2016-10-03 16:43:05 +02:00
Dag-Erling Smørgrav
86cbac767a Bump version. 2016-10-03 12:32:02 +02:00
Dag-Erling Smørgrav
b77cb1aeb4 Tidy up the headers a bit and make them C++-safe. 2016-10-03 12:31:16 +02:00
Dag-Erling Smørgrav
be954631db Finish and hook up half-written name-to-enum / enum-to-name conversion for OATH modes. 2016-10-03 12:26:30 +02:00
Dag-Erling Smørgrav
a36ae775dd Disable unused-result warnings.
It does not seem that gcc accepts casting to void as an alternative to actually checking the result.  The only recourse we have is to disable the warning.
2016-09-18 23:32:53 +02:00
Dag-Erling Smørgrav
d8e26bc5bb Solve further asprintf() issues by sweeping them under the rug.
All further instances of asprintf() or vasprintf() in our codebase are either in libcryb-test or in individual unit tests, and in all cases, the only consequence of a failed call is that the result will say "no description" instead of either a description of the test or an explanation of how it failed.  Therefore, we can simply ignore the problem and cast the call to void to satisfy gcc.
2016-09-18 22:40:48 +02:00
Dag-Erling Smørgrav
eab216c06a Check the return value from asprintf().
This is actually redundant, because we already check the pointer, which is NULL if and only if asprintf() fails and returns < 0, but the version of gcc used by Travis CI insists.  I have not been able to reproduce the issue on any other platform available to me.
2016-09-18 22:18:02 +02:00
Dag-Erling Smørgrav
7a2defcf42 Correct YAML. 2016-09-18 21:37:52 +02:00
Dag-Erling Smørgrav
ffe1d02acd Clean up and re-add gcc. 2016-09-18 21:24:39 +02:00
Dag-Erling Smørgrav
3e50b04edd Bump version. 2016-09-18 21:22:58 +02:00
Dag-Erling Smørgrav
21cd8118fa Don't call string_expand() unless we know that we need to. 2016-09-17 23:42:09 +02:00
Dag-Erling Smørgrav
d0236914f7 Add test cases for the new string functions. 2016-09-17 23:32:11 +02:00
Dag-Erling Smørgrav
dc43296a47 Centralize most of .gitignore. 2016-09-17 21:38:54 +02:00
Dag-Erling Smørgrav
8396c4193b Add string_buf(), string_compare_cs(), string_equal_cs(). 2016-09-17 21:37:18 +02:00
Dag-Erling Smørgrav
cb6743bace Add wide-character versions of strlcat(), strlcmp(), strlcpy(). 2016-09-17 21:35:42 +02:00
Dag-Erling Smørgrav
66c3bf8c32 Document all the hash and checksum functions. 2016-09-17 17:30:13 +02:00
Dag-Erling Smørgrav
29f404d52c The Adler-32 checksum is described in RFC 1950, not RFC 1905. 2016-09-17 17:22:38 +02:00
Dag-Erling Smørgrav
aafc7e1ab0 Clean up the cryb_strl*(3) man pages. 2016-09-17 16:50:37 +02:00
Dag-Erling Smørgrav
09cb4bacf6 Clean up the cryb_sha1(3) man page and add man pages for the SHA-2 functions. 2016-09-17 16:50:12 +02:00
Dag-Erling Smørgrav
9c1988fa17 Add missing third clause to new files. 2016-09-17 16:22:19 +02:00
Dag-Erling Smørgrav
a36c6ba31c Add tests for each library's cryb_foo_version() function.
This may seem stupid, but I've found bugs in the past which would have been caught by unit tests which I didn't write because they seemed stupid.
2016-09-17 16:14:00 +02:00
Dag-Erling Smørgrav
e78c0f811b Remove unneeded #includes. 2016-09-17 16:05:31 +02:00
Dag-Erling Smørgrav
d9b6740247 Implement the full range of BSD endianness conversion functions. 2016-09-15 11:18:01 +02:00
Dag-Erling Smørgrav
1ce9c07b8b Add support for __builtin_bswap16. 2016-09-15 11:09:34 +02:00
Dag-Erling Smørgrav
acb4f9f1bc Import AX_GCC_BUILTIN from the GNU Autoconf Archive. 2016-09-15 11:09:16 +02:00
Dag-Erling Smørgrav
e276f2b407 Ensure that we always have off_t and ssize_t in scope.
POSIX requires <stdio.h> and <unistd.h> to define off_t and ssize_t like <sys/types.h> does, but not all platforms respect that.  Play it safe by always including <sys/types.h>.
2016-09-15 10:15:00 +02:00
Dag-Erling Smørgrav
8d7b6439ae Fix signed / unsigned mismatch. 2016-09-05 15:46:29 +02:00
Dag-Erling Smørgrav
85f75bba42 Rename a few more files. 2016-09-04 16:34:30 +02:00
Dag-Erling Smørgrav
f76b9958f7 Only run Coverity Scan on the "scan" branch. 2016-09-04 16:32:17 +02:00
Dag-Erling Smørgrav
04d737a258 Include <unistd.h> for ssize_t, which is used by the string library. 2016-09-04 16:20:24 +02:00
Dag-Erling Smørgrav
a6eb5d4f68 Respect user's CC 2016-09-04 16:18:13 +02:00
Dag-Erling Smørgrav
d9fbbe245f Bump version 2016-09-04 15:04:26 +02:00
Dag-Erling Smørgrav
06a757e878 Big reorganization and cleanup 2016-09-04 14:56:39 +02:00
Dag-Erling Smørgrav
c030e63ef2 Bump version 2016-03-21 12:35:42 +01:00
Dag-Erling Smørgrav
401465d8ea Move main() from libcryb-test to the test program.
Instead of having libcryb-test provide main() and assume that the test program defines t_prepare() and t_cleanup(), have libcryb-test provide a t_main() function which the test program calls with pointers to its prepare and cleanup functions.
2016-03-15 14:29:44 +01:00
Dag-Erling Smørgrav
c68fd1098d We need <cryb/attributes.h> here for the CRYB_PRINTF() macro. 2016-03-15 14:28:47 +01:00
Dag-Erling Smørgrav
34fe861a36 <cryb/coverage.h> needs to be installed along with libcryb-test. 2016-03-15 14:27:02 +01:00
Dag-Erling Smørgrav
61a83a1fae Cosmetic: use angle brackets instead of double quotes 2016-03-15 14:26:32 +01:00
Dag-Erling Smørgrav
4d1703c77a Don't try to memset NULL if allocation fails.
Always emit UTRACE records, even for failed allocations.
When allocating more than was requested, fill the slop with garbage.
2016-02-19 12:23:17 +01:00
Dag-Erling Smørgrav
1d0f2a4ff3 Reserve room in the label buffer for the terminating NUL. 2016-02-19 12:20:25 +01:00
Dag-Erling Smørgrav
3fbaf4e647 Enable Coverity Scan addon. 2016-02-19 11:41:39 +01:00
Dag-Erling Smørgrav
0917eee32e Move configure to before_script. 2016-02-19 11:15:13 +01:00
Dag-Erling Smørgrav
c044f2580b Fix buffer over-read in percent_decode().
When decoding a trigram, percent_decode() would correctly increment the input pointer by an extra two characters (three total) but would not decrement the input length by the same amount.  This would result in a buffer over-read when decoding unterminated strings.
2016-01-10 23:29:03 +01:00