supercop.c (1141B)
1 #define export __attribute__((visibility("default"))) 2 3 #ifndef __has_builtin // Optional of course. 4 #define __has_builtin(x) 0 // Compatibility with non-clang compilers. 5 #endif 6 7 #include <stdlib.h> 8 9 #include "orlp/ed25519.h" 10 11 export void create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed){ 12 ed25519_create_keypair(public_key, private_key, seed); 13 } 14 15 export void sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key){ 16 ed25519_sign(signature, message, message_len, public_key, private_key); 17 } 18 19 export int verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key){ 20 return ed25519_verify(signature, message, message_len, public_key); 21 } 22 23 export void key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key) { 24 ed25519_key_exchange(shared_secret, public_key, private_key); 25 } 26 27 export void *_malloc(size_t n) { 28 return malloc(n); 29 } 30 31 export void _free(void *p) { 32 free(p); 33 }