2015-06-26 11:54:07 +09:30
|
|
|
#ifndef LIGHTNING_BITCOIN_PRIVKEY_H
|
|
|
|
#define LIGHTNING_BITCOIN_PRIVKEY_H
|
2016-01-22 06:38:08 +10:30
|
|
|
#include "config.h"
|
2015-06-26 11:54:07 +09:30
|
|
|
#include <ccan/short_types/short_types.h>
|
2018-07-04 15:00:02 +09:30
|
|
|
#include <ccan/structeq/structeq.h>
|
2015-06-26 11:54:07 +09:30
|
|
|
|
2019-07-26 18:30:08 +02:00
|
|
|
#define PRIVKEY_LEN 32
|
|
|
|
|
2017-05-06 11:49:44 +09:30
|
|
|
/* General 256-bit secret, which must be private. Used in various places. */
|
|
|
|
struct secret {
|
|
|
|
u8 data[32];
|
|
|
|
};
|
2018-08-17 13:46:34 +09:30
|
|
|
|
|
|
|
/* You probably shouldn't compare secrets in non-const time! */
|
|
|
|
bool secret_eq_consttime(const struct secret *a, const struct secret *b);
|
2017-05-06 11:49:44 +09:30
|
|
|
|
2015-06-26 11:54:07 +09:30
|
|
|
/* This is a private key. Keep it secret. */
|
|
|
|
struct privkey {
|
2017-05-06 11:49:44 +09:30
|
|
|
struct secret secret;
|
2015-06-26 11:54:07 +09:30
|
|
|
};
|
2020-05-16 10:59:05 +09:30
|
|
|
|
|
|
|
/* marshal/unmarshal functions */
|
|
|
|
void fromwire_secret(const u8 **cursor, size_t *max, struct secret *secret);
|
|
|
|
void fromwire_privkey(const u8 **cursor, size_t *max, struct privkey *privkey);
|
|
|
|
void towire_privkey(u8 **pptr, const struct privkey *privkey);
|
|
|
|
void towire_secret(u8 **pptr, const struct secret *secret);
|
|
|
|
|
2015-06-26 11:54:07 +09:30
|
|
|
#endif /* LIGHTNING_BITCOIN_PRIVKEY_H */
|