mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-01-19 14:44:16 +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>
24 lines
629 B
C
24 lines
629 B
C
#include "config.h"
|
|
#include <common/crypto_state.h>
|
|
#include <wire/wire.h>
|
|
|
|
void towire_crypto_state(u8 **ptr, const struct crypto_state *cs)
|
|
{
|
|
towire_u64(ptr, cs->rn);
|
|
towire_u64(ptr, cs->sn);
|
|
towire_secret(ptr, &cs->sk);
|
|
towire_secret(ptr, &cs->rk);
|
|
towire_secret(ptr, &cs->s_ck);
|
|
towire_secret(ptr, &cs->r_ck);
|
|
}
|
|
|
|
void fromwire_crypto_state(const u8 **ptr, size_t *max, struct crypto_state *cs)
|
|
{
|
|
cs->rn = fromwire_u64(ptr, max);
|
|
cs->sn = fromwire_u64(ptr, max);
|
|
fromwire_secret(ptr, max, &cs->sk);
|
|
fromwire_secret(ptr, max, &cs->rk);
|
|
fromwire_secret(ptr, max, &cs->s_ck);
|
|
fromwire_secret(ptr, max, &cs->r_ck);
|
|
}
|