Cifra: Initial import of package
This commit is contained in:
parent
647b0cdd29
commit
4100a1ee80
11
pkg/cifra/Makefile
Normal file
11
pkg/cifra/Makefile
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
PKG_NAME=cifra
|
||||||
|
PKG_URL=https://github.com/ctz/cifra
|
||||||
|
PKG_VERSION=cfa6df9ca0007abe3c70409d02b3779ac1742297
|
||||||
|
PKG_LICENSE=CC-0
|
||||||
|
|
||||||
|
.PHONY: all
|
||||||
|
|
||||||
|
all:
|
||||||
|
"$(MAKE)" -C $(PKG_BUILDDIR)/src -f $(CURDIR)/Makefile.cifra
|
||||||
|
|
||||||
|
include $(RIOTBASE)/pkg/pkg.mk
|
||||||
30
pkg/cifra/Makefile.cifra
Normal file
30
pkg/cifra/Makefile.cifra
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
MODULE := cifra
|
||||||
|
|
||||||
|
CFLAGS += -Wno-pedantic
|
||||||
|
|
||||||
|
SRC += aes.c
|
||||||
|
SRC += sha256.c
|
||||||
|
SRC += sha512.c
|
||||||
|
SRC += chash.c
|
||||||
|
SRC += hmac.c
|
||||||
|
SRC += pbkdf2.c
|
||||||
|
SRC += modes.c
|
||||||
|
SRC += eax.c
|
||||||
|
SRC += gf128.c
|
||||||
|
SRC += blockwise.c
|
||||||
|
SRC += cmac.c
|
||||||
|
SRC += salsa20.c
|
||||||
|
SRC += chacha20.c
|
||||||
|
SRC += curve25519.c
|
||||||
|
SRC += gcm.c
|
||||||
|
SRC += cbcmac.c
|
||||||
|
SRC += ccm.c
|
||||||
|
SRC += sha3.c
|
||||||
|
SRC += sha1.c
|
||||||
|
SRC += poly1305.c
|
||||||
|
SRC += norx.c
|
||||||
|
SRC += chacha20poly1305.c
|
||||||
|
SRC += drbg.c
|
||||||
|
SRC += ocb.c
|
||||||
|
|
||||||
|
include $(RIOTBASE)/Makefile.base
|
||||||
2
pkg/cifra/Makefile.include
Normal file
2
pkg/cifra/Makefile.include
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
INCLUDES += -I$(PKGDIRBASE)/cifra/src
|
||||||
|
INCLUDES += -I$(PKGDIRBASE)/cifra/src/ext
|
||||||
26
pkg/cifra/doc.txt
Normal file
26
pkg/cifra/doc.txt
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
/**
|
||||||
|
* @defgroup pkg_cifra Cifra cryptographic library
|
||||||
|
* @ingroup pkg
|
||||||
|
* @brief Provides the Cifra cryptographic library.
|
||||||
|
*
|
||||||
|
* # Cifra RIOT package
|
||||||
|
*
|
||||||
|
* Cifra is a collection of cryptographic primitives targeted at embedded use.
|
||||||
|
*
|
||||||
|
* You can find the API and more information
|
||||||
|
* [here](https://cifra.readthedocs.org/en/latest/)
|
||||||
|
*
|
||||||
|
* ## Requirements
|
||||||
|
*
|
||||||
|
* @note Cifra only supports 32bit platforms.
|
||||||
|
*
|
||||||
|
* ## Usage
|
||||||
|
*
|
||||||
|
* Just add it as a package in your application:
|
||||||
|
*
|
||||||
|
* ```makefile
|
||||||
|
* USEPKG += cifra
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @see https://github.com/ctz/cifra
|
||||||
|
*/
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
From 16a6d98096f5cc15a5716b665341fd22d04ec426 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Koen Zandberg <koen@bergzand.net>
|
||||||
|
Date: Thu, 5 Sep 2019 09:45:50 +0200
|
||||||
|
Subject: [PATCH 1/2] Replace typeof with __typeof__ for compatibility
|
||||||
|
|
||||||
|
---
|
||||||
|
src/ext/handy.h | 12 ++++++------
|
||||||
|
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/src/ext/handy.h b/src/ext/handy.h
|
||||||
|
index a9b2d9d..d7d9dd4 100644
|
||||||
|
--- a/src/ext/handy.h
|
||||||
|
+++ b/src/ext/handy.h
|
||||||
|
@@ -15,14 +15,14 @@
|
||||||
|
/* Normal MIN/MAX macros. Evaluate argument expressions only once. */
|
||||||
|
#ifndef MIN
|
||||||
|
#define MIN(x, y) \
|
||||||
|
- ({ typeof (x) __x = (x); \
|
||||||
|
- typeof (y) __y = (y); \
|
||||||
|
+ ({ __typeof__ (x) __x = (x); \
|
||||||
|
+ __typeof__ (y) __y = (y); \
|
||||||
|
__x < __y ? __x : __y; })
|
||||||
|
#endif
|
||||||
|
#ifndef MAX
|
||||||
|
#define MAX(x, y) \
|
||||||
|
- ({ typeof (x) __x = (x); \
|
||||||
|
- typeof (y) __y = (y); \
|
||||||
|
+ ({ __typeof__ (x) __x = (x); \
|
||||||
|
+ __typeof__ (y) __y = (y); \
|
||||||
|
__x > __y ? __x : __y; })
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@@ -30,7 +30,7 @@
|
||||||
|
#ifndef SWAP
|
||||||
|
#define SWAP(x, y) \
|
||||||
|
do { \
|
||||||
|
- typeof (x) __tmp = (x); \
|
||||||
|
+ __typeof__ (x) __tmp = (x); \
|
||||||
|
(x) = (y); \
|
||||||
|
(y) = __tmp; \
|
||||||
|
} while (0)
|
||||||
|
@@ -48,7 +48,7 @@
|
||||||
|
/** Error: return.
|
||||||
|
*
|
||||||
|
* If the expression fails, return the error from this function. */
|
||||||
|
-#define ER(expr) do { typeof (expr) err_ = (expr); if (err_) return err_; } while (0)
|
||||||
|
+#define ER(expr) do { __typeof__ (expr) err_ = (expr); if (err_) return err_; } while (0)
|
||||||
|
|
||||||
|
/** Error: goto.
|
||||||
|
*
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
||||||
@ -0,0 +1,26 @@
|
|||||||
|
From 4d3f2070b013036f0d936cda0b9262e8a8445b2e Mon Sep 17 00:00:00 2001
|
||||||
|
From: Koen Zandberg <koen@bergzand.net>
|
||||||
|
Date: Thu, 5 Sep 2019 09:46:10 +0200
|
||||||
|
Subject: [PATCH 2/2] replace struct initializer for c99 compatibility
|
||||||
|
|
||||||
|
---
|
||||||
|
src/ocb.c | 3 ++-
|
||||||
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/src/ocb.c b/src/ocb.c
|
||||||
|
index 3d244d4..fb6d822 100644
|
||||||
|
--- a/src/ocb.c
|
||||||
|
+++ b/src/ocb.c
|
||||||
|
@@ -163,7 +163,8 @@ static void ocb_hash_block(void *vctx, const uint8_t *block)
|
||||||
|
static void ocb_process_header(ocb *o, const uint8_t *header, size_t nheader,
|
||||||
|
uint8_t out[BLOCK])
|
||||||
|
{
|
||||||
|
- ocb_hash ctx = { o };
|
||||||
|
+ ocb_hash ctx = { 0 };
|
||||||
|
+ ctx.o = o;
|
||||||
|
ocb_hash_init(&ctx);
|
||||||
|
|
||||||
|
uint8_t partial[BLOCK];
|
||||||
|
--
|
||||||
|
2.21.0
|
||||||
|
|
||||||
Loading…
x
Reference in New Issue
Block a user