diff options
Diffstat (limited to 'libcmix-crypto')
| -rw-r--r-- | libcmix-crypto/CMakeLists.txt | 13 | ||||
| -rw-r--r-- | libcmix-crypto/curve25519.h | 16 | ||||
| -rw-r--r-- | libcmix-crypto/keymanagement.c | 1 | ||||
| -rw-r--r-- | libcmix-crypto/keymanagement.h | 28 | ||||
| -rw-r--r-- | libcmix-crypto/libsodium_curve25519.c | 8 |
5 files changed, 64 insertions, 2 deletions
diff --git a/libcmix-crypto/CMakeLists.txt b/libcmix-crypto/CMakeLists.txt index 3bbbae6..1be60dc 100644 --- a/libcmix-crypto/CMakeLists.txt +++ b/libcmix-crypto/CMakeLists.txt @@ -1,6 +1,7 @@ add_library(cmix-crypto message.h message.c + keymanagement.h keymanagement.c ) target_include_directories(cmix-crypto @@ -8,5 +9,13 @@ target_include_directories(cmix-crypto ) target_compile_options(cmix-crypto - PUBLIC "-std=c99" -)
\ No newline at end of file + PRIVATE "-std=c99" +) + +add_library(libsodium_curve25519 + libsodium_curve25519.c +) + +target_link_libraries(cmix-crypto + PUBLIC libsodium_curve25519 +) diff --git a/libcmix-crypto/curve25519.h b/libcmix-crypto/curve25519.h new file mode 100644 index 0000000..2c8b1e3 --- /dev/null +++ b/libcmix-crypto/curve25519.h @@ -0,0 +1,16 @@ +#pragma once + +#ifdef __cplusplus +extern "C" { +#endif + +struct KeyPair { + char* sec; + char* pub; +}; + +extern struct KeyPair curve25519_create_keypair(); + +#ifdef __cplusplus +} +#endif diff --git a/libcmix-crypto/keymanagement.c b/libcmix-crypto/keymanagement.c new file mode 100644 index 0000000..49e8316 --- /dev/null +++ b/libcmix-crypto/keymanagement.c @@ -0,0 +1 @@ +#include "keymanagement.h" diff --git a/libcmix-crypto/keymanagement.h b/libcmix-crypto/keymanagement.h new file mode 100644 index 0000000..1db0ce6 --- /dev/null +++ b/libcmix-crypto/keymanagement.h @@ -0,0 +1,28 @@ +#pragma once + +#include "curve25519.h" + +#include <stddef.h> + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct KeyPair(*CmixKeyPairCreator)(); +typedef struct KeyPair(*CmixKeyPairLoader)(char*, char*); + +struct CmixKeyManagementImpl { + CmixKeyPairCreator create_new_keypair; + CmixKeyPairLoader load_keypair; +}; + +struct CmixKeyManagementImpl get_curve25519_key_management_implementation() { + return (struct CmixKeyManagementImpl) {\ + &curve25519_create_keypair, + NULL + };\ +} + +#ifdef __cplusplus +} // extern "C" +#endif diff --git a/libcmix-crypto/libsodium_curve25519.c b/libcmix-crypto/libsodium_curve25519.c new file mode 100644 index 0000000..d010d2f --- /dev/null +++ b/libcmix-crypto/libsodium_curve25519.c @@ -0,0 +1,8 @@ + +#include "curve25519.h" + +#include <stddef.h> + +struct KeyPair curve25519_create_keypair() { + return (struct KeyPair){NULL, NULL}; +} |
