- 24 Aug, 2016 2 commits
-
-
Jon Griffiths authored
Running 'tools/ccan_depends --compile ccan/crypto' without this patch will demonstrate the crash. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
- 23 Aug, 2016 3 commits
-
-
Rusty Russell authored
Closes: 47
-
Rusty Russell authored
Closes: 46
-
Rusty Russell authored
Closes: 45
-
- 22 Aug, 2016 12 commits
-
-
Jon Griffiths authored
The header macro RIPEMD160_INIT is intended to be used instead I believe. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
The resulting code is just as clear to read, so lets not require a C99 compiler to compile this. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
The documentation for hex_encode indicates that it returns simply true or false. The old implementation was returning the written length on success, cast to boolean. This will elicit a warning under MSVC. On further examination, there is no need to check/modify the length inside the loop, since we can check it once before starting. As a result the code can be simplified a bit. A side affect of this change is that nothing will be written at all if the length is incorrect, vs the previous code writing characters until the length available is exhausted. I prefer the new semantics but YMMV. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Show the derivation of the constants to match the comment above them. The compiler doesn't care, but it helps the code read better. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
The code already assigns to/from bytes as a size_t, so make it official (and better on platforms with a 32 bit size_t). Moving bytes makes it act as a canary in the event that there is a rogue write/off by one somewhere - since it ends up in the hash we are more likely to detect this should we corrupt it. This also makes the working buffer better aligned which can't hurt. Also, initialise the buffer to zero while we are changing the initialisation macro anyway. It costs little compared to the hashing overhead, should be optimised away if redundant in most cases, and it removes a warning from both gcc and clang about unititialised struct members. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
This reads better. Also remove duplicated comments for the members. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
These are just aliases to a buffer: its customary for these to have the same size, and makes sizeof() consistent in case anyone decides to use the members instead of the containing union. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Prevents warnings from gcc at higher warning levels. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Prevents warnings from gcc at higher warning levels. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
Jon Griffiths authored
Prevents warnings from gcc at higher warning levels. Signed-off-by: Jon Griffiths <jon_p_griffiths@yahoo.com>
-
- 28 Jun, 2016 1 commit
-
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 16 Jun, 2016 5 commits
-
-
David Gibson authored
altstack/test/run.c uses some hairy macros to intercept the standard library functions that altstack uses. This has two purposes: 1) to conditionally cause those functions to fail, and thereby test altstack's error paths, and 2) log which of the library functions was called in each testcase. The second function isn't actually useful - for the purposes of testing the module, we want to check the actual behaviour, not what calls it made in what order to accomplish it. Explicitly checking the calls makes it much harder to change altstack's implementation without breaking the tests. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
In a number of places the altstack module uses a literal '0' for pointer values. That's correct C, but doesn't make it obvious on a quick read whether values are integers or pointers. This patch changes those cases to use the NULL define instead. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Functions invoked with altstack take a void * parameter. However, the test program wants to pass an integer, and so uses the trick of casting the integer values to (void *) and back again. The ptrint() module handles exactly this case in a more portable and (somewhat) typesafe way, so use that instead. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
altstack relies on catching a SIGSEGV caused when overrunning the stack. This means that the SEGV handler itself can't use the already overflowed stack, and so we use sigaltstack() to assign the signal handler a different stack. On completion, altstack() clears the alternate signal stack. However, it's possible that the calling program could be using sigaltstack() for its own reasons, so it's more correct to restore the sigaltstack() state to that from the beginning of the altstack() call. This patch implements this behaviour. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
altstack uses a number of __thread variables to track internal state. This allows altstack to be thread-safe, although it's still not re-entrant. This patch gathers all these variables into a single per-thread state structure. This makes it easy to see at a glance what the whole of the required state is, and thereby easier to reason about correctness of changes to the implementation. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
- 06 Jun, 2016 3 commits
-
-
Rusty Russell authored
Common case is mapping ints to structures. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 05 Jun, 2016 2 commits
-
-
Cody P Schafer authored
Useful for unwinding actions taken while iterating over a htable. Signed-off-by: Cody P Schafer <dev@codyps.com>
-
David Gibson authored
An odd omission from the tlist module is basic tlist_next() and tlist_prev() macros matching list_next() and list_prev() in the basic list module. This adds them. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 03 Jun, 2016 1 commit
-
-
David Gibson authored
Sometimes it's not convenient to initialize an agar graph at runtime with agar_init_graph(). This adds an AGAR_INIT_GRAPH() macro to do the same thing as a static initializer. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
- 02 Jun, 2016 6 commits
-
-
David Gibson authored
These were left over from a previous approach which didn't pan out. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
Cody P Schafer authored
Signed-off-by: Cody P Schafer <dev@codyps.com>
-
Cody P Schafer authored
I did not see any failures of other modules with this change, but I'm not completely certain there are no cases that it breaks. Signed-off-by: Cody P Schafer <dev@codyps.com>
-
Cody P Schafer authored
When other macros are emitting LIST_INIT expansions, `name` can get a bit complicated. Signed-off-by: Cody P Schafer <dev@codyps.com>
-
- 31 May, 2016 3 commits
-
-
Cody P Schafer authored
Without this, one had to either use a function or a macro with casts to get the expected behavior. Signed-off-by: Cody P Schafer <dev@codyps.com>
-
Cody P Schafer authored
Signed-off-by: Cody P Schafer <dev@codyps.com>
-
Rusty Russell authored
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
-
- 09 May, 2016 2 commits
-
-
David Gibson authored
All modules have a _info file (a C file, despite the lack of extension) giving metadata for the module. The Makefiles have a rule to build these.. but it's broken (missing an include directive). This patch fixes the rule, and builds the info binaries for all modules by default. This is a useful check and also useful for manually inspecting a module's metadata. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-
David Gibson authored
Currently, build of ccan is controlled by two Make variables: MODS_WITH_SRC and MODS_NO_SRC which list modules containing .c files, and modules with only .h files respectively. When adding new modules this is fiddly to get right, and there are a number of modules already listed in the wrong variable. There's also some redundant logic in the DIRS variable to again filter out modules without source. This simplifies things by having a single manually updated MODS variable listing every module, and determining MODS_WITH_SOURCE programmatically. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
-