mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-22 06:41:44 +01:00
To be safe, we should never memcmp secrets. We don't do this currently outside tests, but we're about to. The tests to prove this as constant time are the tricky bit. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
19 lines
552 B
C
19 lines
552 B
C
#ifndef LIGHTNING_BITCOIN_PRIVKEY_H
|
|
#define LIGHTNING_BITCOIN_PRIVKEY_H
|
|
#include "config.h"
|
|
#include <ccan/short_types/short_types.h>
|
|
#include <ccan/structeq/structeq.h>
|
|
|
|
/* General 256-bit secret, which must be private. Used in various places. */
|
|
struct secret {
|
|
u8 data[32];
|
|
};
|
|
|
|
/* You probably shouldn't compare secrets in non-const time! */
|
|
bool secret_eq_consttime(const struct secret *a, const struct secret *b);
|
|
|
|
/* This is a private key. Keep it secret. */
|
|
struct privkey {
|
|
struct secret secret;
|
|
};
|
|
#endif /* LIGHTNING_BITCOIN_PRIVKEY_H */
|