1 #include <common/crypto_state.h>
2 #include <wire/wire.h>
3 
towire_crypto_state(u8 ** ptr,const struct crypto_state * cs)4 void towire_crypto_state(u8 **ptr, const struct crypto_state *cs)
5 {
6 	towire_u64(ptr, cs->rn);
7 	towire_u64(ptr, cs->sn);
8 	towire_secret(ptr, &cs->sk);
9 	towire_secret(ptr, &cs->rk);
10 	towire_secret(ptr, &cs->s_ck);
11 	towire_secret(ptr, &cs->r_ck);
12 }
13 
fromwire_crypto_state(const u8 ** ptr,size_t * max,struct crypto_state * cs)14 void fromwire_crypto_state(const u8 **ptr, size_t *max, struct crypto_state *cs)
15 {
16 	cs->rn = fromwire_u64(ptr, max);
17 	cs->sn = fromwire_u64(ptr, max);
18 	fromwire_secret(ptr, max, &cs->sk);
19 	fromwire_secret(ptr, max, &cs->rk);
20 	fromwire_secret(ptr, max, &cs->s_ck);
21 	fromwire_secret(ptr, max, &cs->r_ck);
22 }
23