mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-12-27 09:04:40 +01:00
4ffda340d3
And turn "" includes into full-path (which makes it easier to put config.h first, and finds some cases check-includes.sh missed previously). config.h sets _GNU_SOURCE which really needs to be done before any '#includes': we mainly got away with it with glibc, but other platforms like Alpine may have stricter requirements. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
30 lines
805 B
C
30 lines
805 B
C
#include "config.h"
|
|
#include <bitcoin/shadouble.h>
|
|
#include <ccan/mem/mem.h>
|
|
#include <common/type_to_string.h>
|
|
#include <wire/wire.h>
|
|
|
|
void sha256_double(struct sha256_double *shadouble, const void *p, size_t len)
|
|
{
|
|
sha256(&shadouble->sha, memcheck(p, len), len);
|
|
sha256(&shadouble->sha, &shadouble->sha, sizeof(shadouble->sha));
|
|
}
|
|
|
|
void sha256_double_done(struct sha256_ctx *shactx, struct sha256_double *res)
|
|
{
|
|
sha256_done(shactx, &res->sha);
|
|
sha256(&res->sha, &res->sha, sizeof(res->sha));
|
|
}
|
|
REGISTER_TYPE_TO_HEXSTR(sha256_double);
|
|
|
|
void towire_sha256_double(u8 **pptr, const struct sha256_double *sha256d)
|
|
{
|
|
towire_sha256(pptr, &sha256d->sha);
|
|
}
|
|
|
|
void fromwire_sha256_double(const u8 **cursor, size_t *max,
|
|
struct sha256_double *sha256d)
|
|
{
|
|
fromwire_sha256(cursor, max, &sha256d->sha);
|
|
}
|