Fix compilation fail on no libsodium
This commit is contained in:
parent
75f54119bf
commit
e01a1ccd94
2 changed files with 7 additions and 1 deletions
|
@ -35,7 +35,9 @@
|
|||
#include "TSLQueue.hpp"
|
||||
#include "UDPC.h"
|
||||
|
||||
#ifdef UDPC_LIBSODIUM_ENABLED
|
||||
# include <sodium.h>
|
||||
#endif
|
||||
|
||||
#define UDPC_MIN_HEADER_SIZE 20
|
||||
#define UDPC_CON_HEADER_SIZE (UDPC_MIN_HEADER_SIZE+4)
|
||||
|
|
|
@ -2349,11 +2349,15 @@ int UDPC_set_libsodium_keys(UDPC_HContext ctx, const unsigned char *sk, const un
|
|||
}
|
||||
|
||||
int UDPC_set_libsodium_key_easy(UDPC_HContext ctx, const unsigned char *sk) {
|
||||
#ifndef UDPC_LIBSODIUM_ENABLED
|
||||
return 0;
|
||||
#else
|
||||
unsigned char pk[crypto_sign_PUBLICKEYBYTES];
|
||||
if(crypto_sign_ed25519_sk_to_pk(pk, sk) != 0) {
|
||||
return 0;
|
||||
}
|
||||
return UDPC_set_libsodium_keys(ctx, sk, pk);
|
||||
#endif
|
||||
}
|
||||
|
||||
int UDPC_unset_libsodium_keys(UDPC_HContext ctx) {
|
||||
|
|
Loading…
Reference in a new issue