lokinet/include/llarp/crypto_async.h

63 lines
2.0 KiB
C
Raw Normal View History

2018-01-31 19:59:26 +00:00
#ifndef LLARP_CRYPTO_ASYNC_H_
#define LLARP_CRYPTO_ASYNC_H_
#include <llarp/crypto.h>
#include <llarp/ev.h>
#include <llarp/threadpool.h>
#ifdef __cplusplus
extern "C" {
#endif
2018-02-01 13:21:00 +00:00
struct llarp_async_dh;
2018-02-01 22:34:04 +00:00
struct llarp_async_dh *llarp_async_dh_new(llarp_seckey_t ourkey,
struct llarp_crypto *crypto,
struct llarp_ev_loop *ev,
struct llarp_threadpool *tp);
2018-02-01 13:21:00 +00:00
void llarp_async_dh_free(struct llarp_async_dh **dh);
struct llarp_dh_result;
typedef void (*llarp_dh_complete_hook)(struct llarp_dh_result *);
struct llarp_dh_result {
2018-02-01 22:04:58 +00:00
llarp_sharedkey_t sharedkey;
2018-02-01 13:21:00 +00:00
void *user;
llarp_dh_complete_hook hook;
};
2018-02-01 22:34:04 +00:00
void llarp_async_client_dh(struct llarp_async_dh *dh, llarp_pubkey_t theirkey,
2018-02-01 13:21:00 +00:00
llarp_tunnel_nounce_t nounce,
llarp_dh_complete_hook result, void *user);
2018-02-01 22:34:04 +00:00
void llarp_async_server_dh(struct llarp_async_dh *dh, llarp_pubkey_t theirkey,
2018-02-01 13:21:00 +00:00
llarp_tunnel_nounce_t nounce,
llarp_dh_complete_hook result, void *user);
2018-01-31 19:59:26 +00:00
2018-02-01 22:34:04 +00:00
struct llarp_async_cipher;
struct llarp_cipher_result;
typedef void (*llarp_cipher_complete_hook)(struct llarp_cipher_result *);
struct llarp_cipher_result {
llarp_buffer_t buff;
void *user;
llarp_cipher_complete_hook hook;
};
2018-02-01 22:04:58 +00:00
2018-02-01 22:34:04 +00:00
struct llarp_async_cipher *llarp_async_cipher_new(llarp_sharedkey_t key,
struct llarp_crypto *crypto,
struct llarp_ev_loop *ev,
struct llarp_threadpool *tp);
2018-02-01 22:04:58 +00:00
2018-02-01 22:34:04 +00:00
void llarp_async_cipher_free(struct llarp_async_cipher **c);
2018-02-01 22:04:58 +00:00
2018-02-01 22:34:04 +00:00
void llarp_async_cipher_queue_op(struct llarp_async_cipher *c,
llarp_buffer_t *buff, llarp_nounce_t n,
llarp_cipher_complete_hook h, void *user);
2018-02-01 22:04:58 +00:00
2018-01-31 19:59:26 +00:00
#ifdef __cplusplus
}
#endif
#endif