solo1/crypto.h

42 wiersze
1.2 KiB
C
Czysty Zwykły widok Historia

2018-05-06 18:53:43 +00:00
#ifndef _CRYPTO_H
#define _CRYPTO_H
#define USE_SOFTWARE_IMPLEMENTATION
void crypto_sha256_init();
void crypto_sha256_update(uint8_t * data, size_t len);
void crypto_sha256_update_secret();
2018-05-06 18:53:43 +00:00
void crypto_sha256_final(uint8_t * hash);
2018-05-18 16:20:22 +00:00
void crypto_sha256_hmac(uint8_t * key, uint32_t klen, uint8_t * data, uint32_t datalen, uint8_t * hmac);
2018-05-07 00:15:18 +00:00
void crypto_ecc256_init();
void crypto_ecc256_derive_public_key(uint8_t * data, int len, uint8_t * x, uint8_t * y);
2018-05-07 00:15:18 +00:00
void crypto_ecc256_load_key(uint8_t * data, int len);
2018-05-07 00:15:18 +00:00
void crypto_ecc256_load_attestation_key();
void crypto_ecc256_sign(uint8_t * data, int len, uint8_t * sig);
void generate_private_key(uint8_t * data, int len, uint8_t * data2, int len2, uint8_t * privkey);
2018-05-17 02:44:31 +00:00
void crypto_ecc256_make_key_pair(uint8_t * pubkey, uint8_t * privkey);
2018-05-18 03:11:00 +00:00
void crypto_ecc256_shared_secret(const uint8_t * pubkey, const uint8_t * privkey, uint8_t * shared_secret);
// Key must be 32 bytes
void crypto_aes256_init(uint8_t * key);
void crypto_aes256_reset_iv();
// buf length must be multiple of 16 bytes
void crypto_aes256_decrypt(uint8_t * buf, int lenth);
void crypto_aes256_encrypt(uint8_t * buf, int lenth);
2018-05-07 00:15:18 +00:00
extern const uint8_t attestation_cert_der[];
extern const uint16_t attestation_cert_der_size;
2018-05-06 18:53:43 +00:00
#endif