upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/components/negentropy_lib
diff options
context:
space:
mode:
Diffstat (limited to 'components/negentropy_lib')
-rw-r--r--components/negentropy_lib/CMakeLists.txt20
-rw-r--r--components/negentropy_lib/compat/openssl/sha.h16
2 files changed, 36 insertions, 0 deletions
diff --git a/components/negentropy_lib/CMakeLists.txt b/components/negentropy_lib/CMakeLists.txt
new file mode 100644
index 0000000..32bab60
--- /dev/null
+++ b/components/negentropy_lib/CMakeLists.txt
@@ -0,0 +1,20 @@
1set(NEGENTROPY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../negentropy)
2
3idf_component_register(
4 SRCS "${NEGENTROPY_DIR}/c/negentropy_wrapper.cpp"
5 INCLUDE_DIRS
6 "${NEGENTROPY_DIR}/c"
7 "${NEGENTROPY_DIR}/cpp"
8 "compat"
9 REQUIRES mbedtls
10)
11
12target_compile_options(${COMPONENT_LIB} PRIVATE
13 -fexceptions
14 -frtti
15 -Wno-error
16 -Wno-delete-non-virtual-dtor
17 -Wno-unused-variable
18 -Wno-unused-function
19 -Wno-catch-value
20)
diff --git a/components/negentropy_lib/compat/openssl/sha.h b/components/negentropy_lib/compat/openssl/sha.h
new file mode 100644
index 0000000..b0881c1
--- /dev/null
+++ b/components/negentropy_lib/compat/openssl/sha.h
@@ -0,0 +1,16 @@
1#ifndef OPENSSL_SHA_COMPAT_H
2#define OPENSSL_SHA_COMPAT_H
3
4#include "mbedtls/sha256.h"
5#include <stddef.h>
6
7#define SHA256_DIGEST_LENGTH 32
8
9static inline int SHA256_compat(const unsigned char *d, size_t n, unsigned char *md)
10{
11 return mbedtls_sha256(d, n, md, 0);
12}
13
14#define SHA256 SHA256_compat
15
16#endif