CDC Badge OS
Firmware for the CDC Badge v1.0 hardware security key
Loading...
Searching...
No Matches
ecdh.h
Go to the documentation of this file.
1
11
12#ifndef OPENPGP_ECDH_H
13#define OPENPGP_ECDH_H
14
15#include <stdint.h>
16#include <stdbool.h>
17#include <stddef.h>
18
19#ifdef __cplusplus
20extern "C" {
21#endif
22
35 uint8_t* privkey, // 32 bytes, WILL BE CLEARED
36 const uint8_t* peer_pubkey, // 65 bytes (04||X||Y)
37 uint8_t* shared_out // 32 bytes
38);
39
48 uint8_t* privkey_out, // 32 bytes
49 uint8_t* pubkey_out // 65 bytes
50);
51
60 const uint8_t* privkey, // 32 bytes
61 uint8_t* pubkey_out // 65 bytes
62);
63
71void ecdh_secure_clear(void* ptr, size_t size);
72
73#ifdef __cplusplus
74}
75#endif
76
77#endif // OPENPGP_ECDH_H
bool ecdh_p256_generate_keypair(uint8_t *privkey_out, uint8_t *pubkey_out)
Definition ecdh.cpp:153
bool ecdh_p256_compute_shared_secret(uint8_t *privkey, const uint8_t *peer_pubkey, uint8_t *shared_out)
Computes ECDH shared secret on P-256 using local private key and peer public key.
Definition ecdh.cpp:63
void ecdh_secure_clear(void *ptr, size_t size)
Securely clears sensitive memory using platform zeroize.
Definition ecdh.cpp:52
bool ecdh_p256_derive_pubkey(const uint8_t *privkey, uint8_t *pubkey_out)
Definition ecdh.cpp:214