diff --git a/pkg/libb2/Makefile b/pkg/libb2/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..16ac11aae1fcdd675190ab72149140931f8d3104 --- /dev/null +++ b/pkg/libb2/Makefile @@ -0,0 +1,12 @@ +PKG_NAME = libb2 +PKG_URL = https://github.com/BLAKE2/libb2 +PKG_VERSION = 60ea749837362c226e8501718f505ab138e5c19d # v0.98 +PKG_LICENSE = CC0-1.0 + +.PHONY: all + +all: git-download + "$(MAKE)" -C $(PKG_BUILDDIR)/src \ + -f $(RIOTPKG)/libb2/Makefile.$(PKG_NAME) + +include $(RIOTBASE)/pkg/pkg.mk diff --git a/pkg/libb2/Makefile.include b/pkg/libb2/Makefile.include new file mode 100644 index 0000000000000000000000000000000000000000..46c0687c0b919d88e6ad97e4dd7590953f89ba82 --- /dev/null +++ b/pkg/libb2/Makefile.include @@ -0,0 +1,2 @@ +INCLUDES += -I$(PKGDIRBASE)/libb2/src +INCLUDES += -I$(RIOTPKG)/libb2/include diff --git a/pkg/libb2/Makefile.libb2 b/pkg/libb2/Makefile.libb2 new file mode 100644 index 0000000000000000000000000000000000000000..ec993728f8e345203915eaae0f6ed894bdf8e24c --- /dev/null +++ b/pkg/libb2/Makefile.libb2 @@ -0,0 +1,11 @@ +MODULE = libb2 + +# Compiling for native triggers this warning +CFLAGS += -Wno-unused-function + +SRC := blake2s-ref.c \ + blake2b-ref.c \ + blake2sp.c \ + blake2bp.c + +include $(RIOTBASE)/Makefile.base diff --git a/pkg/libb2/doc.txt b/pkg/libb2/doc.txt new file mode 100644 index 0000000000000000000000000000000000000000..7298bc9dfdc772ce5ec67205815993bb4311af01 --- /dev/null +++ b/pkg/libb2/doc.txt @@ -0,0 +1,37 @@ +/** + * @defgroup pkg_libb2 BLAKE2 hashing library + * @ingroup pkg + * @brief C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp + + * + * # BLAKE2 RIOT package + * + * BLAKE2 is a cryptographic hash function specified in RFC 7693. + * It claims to be faster than MD5, SHA-1, SHA-2, and SHA-3, yet at least as + * secure as the latest standard SHA-3. + * + * BLAKE2 comes in two flavors: + * + * - BLAKE2b (or just BLAKE2) is optimized for 64-bit platforms—including NEON-enabled ARMs—and + * produces digests of any size between 1 and 64 bytes + * - BLAKE2s is optimized for 8- to 32-bit platforms and produces digests of + * any size between 1 and 32 bytes + * + * For more information, see the [BLAKE2 website](https://blake2.net/). + * + * ## Usage + * + * Add it as a package in your application's Makefile: + * + * ```makefile + * USEPKG += libb2 + * ``` + * + * Include the BLAKE2 header in your code: + * + * ```c + * #include "blake2.h" + * ``` + * + * @see https://github.com/BLAKE2/libb2 + */ diff --git a/pkg/libb2/include/config.h b/pkg/libb2/include/config.h new file mode 100644 index 0000000000000000000000000000000000000000..55cc6a0e8e5b33e3855e612fc35b8e734831342b --- /dev/null +++ b/pkg/libb2/include/config.h @@ -0,0 +1,19 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Add no suffix to the functions */ +#define SUFFIX + +/* Test for a little-endian machine */ +#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ +#define NATIVE_LITTLE_ENDIAN +#endif + +#ifdef __cplusplus +} +#endif +#endif /* CONFIG_H */