packages feed

raaz 0.3.0 → 0.3.1

raw patch · 4 files changed

+154/−6 lines, 4 files

Files

CHANGELOG.md view
@@ -1,5 +1,11 @@ # Change log for [raaz]. +## [0.3.1] - Oct 6, 2021++This release ensures that missing verse.h C header files. Without that+the version on hackage was unbuildable.++ ## [0.3.0] - May 20, 2021    This is a major rewrite of the raaz library with significant change in the@@ -33,7 +39,7 @@    - Use libverse for the low level FFI implementations. From now on     newer primitives will be coded up in verse instead of hand written-    C/assembly. (See https://github.com/raaz-crypto/libverse/>)+    C/assembly. (See <https://github.com/raaz-crypto/libverse/>)    - Backpack based modules and signatures instead of classes for     primitive implementation. Simplifies the library and allows easy@@ -152,5 +158,6 @@ [0.2.0]: <http://github.com/raaz-crypto/raaz/releases/tag/v0.2.0> [0.2.1]: <http://github.com/raaz-crypto/raaz/releases/tag/v0.2.1> [0.2.2]: <http://github.com/raaz-crypto/raaz/releases/tag/v0.2.2>+[0.2.3]: <http://github.com/raaz-crypto/raaz/releases/tag/v0.2.3> [0.3.0]: <http://github.com/raaz-crypto/raaz/releases/tag/v0.3.0> [raaz]:  <http://github.com/raaz-crypto/raaz/>
indef/keyed/hash/Implementation.hsig view
@@ -21,6 +21,8 @@  -- NOTE: --+-- (This issue does not seem to be applicable any more)+-- -- With https://gitlab.haskell.org/ghc/ghc/issues/15138 and -- https://gitlab.haskell.org/ghc/ghc/issues/15379 fixed I (ppk) had -- expected that one can differ the assignment of Buffer@@ -31,8 +33,8 @@ -- Implementation in the auth case. Therefore, I am setting an -- artificially large base number here. ---# if MIN_VERSION_base(100,100,0)--- # if MIN_VERSION_base(4,13,0)++# if MIN_VERSION_base(4,13,0) import GHC.TypeLits  -- | The alignment requirements on the buffer.
+ libverse/verse.h view
@@ -0,0 +1,138 @@+#pragma once+#include <stdint.h>++/*+ *         Byte swapping. Use platform specific ones when we know it.+ */++# pragma GCC optimize "tree-vectorize" /* Enable vectorisation for gcc */+#ifdef PLATFORM_OSX+#include <libkern/OSByteOrder.h> /* For PLATFORM OSX */++static inline uint16_t verse_bswap16(uint16_t x) { return OSSwapInt16(x); }+static inline uint32_t verse_bswap32(uint32_t x) { return OSSwapInt32(x); }+static inline uint64_t verse_bswap64(uint64_t x) { return OSSwapInt64(x); }++#elif defined(PLATFORM_WINDOWS)+#include <stdlib.h>+static inline uint16_t verse_bswap16(uint16_t x) { return _byteswap_ushort(x); }+static inline uint32_t verse_bswap32(uint32_t x) { return _byteswap_ulong(x); }+static inline uint64_t verse_bswap64(uint64_t x) { return _byteswap_uint64(x); }++#elif defined(PLATFORM_OPENBSD)+#include <endian.h>+static inline uint16_t verse_bswap16(uint16_t x) { return swap16(x); }+static inline uint32_t verse_bswap32(uint32_t x) { return swap32(x); }+static inline uint64_t verse_bswap64(uint64_t x) { return swap64(x); }++#elif defined(PLATFORM_LINUX) /* All other platforms */+#include <byteswap.h>+static inline uint16_t verse_bswap16(uint16_t x) { return bswap_16(x); }+static inline uint32_t verse_bswap32(uint32_t x) { return bswap_32(x); }+static inline uint64_t verse_bswap64(uint64_t x) { return bswap_64(x); }+#else++/* We do not have platform specific byte swap */+#define __VERSE_REQUIRE_PORTABLE_SWAP__++extern uint16_t verse_bswap16(uint16_t x);+extern uint32_t verse_bswap32(uint32_t x);+extern uint64_t verse_bswap64(uint64_t x);++#endif++#ifdef __GNUC__++/* For GNUC compiler use byte order checks to define efficient endian+ * conversion */++#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__++static inline uint16_t verse_to_be16(uint16_t x) { return verse_bswap16(x); }+static inline uint32_t verse_to_be32(uint32_t x) { return verse_bswap32(x); }+static inline uint64_t verse_to_be64(uint64_t x) { return verse_bswap64(x); }+static inline uint16_t verse_from_be16(uint16_t x) { return verse_bswap16(x); }+static inline uint32_t verse_from_be32(uint32_t x) { return verse_bswap32(x); }+static inline uint64_t verse_from_be64(uint64_t x) { return verse_bswap64(x); }++static inline uint16_t verse_to_le16(uint16_t x) { return x; }+static inline uint32_t verse_to_le32(uint32_t x) { return x; }+static inline uint64_t verse_to_le64(uint64_t x) { return x; }+static inline uint16_t verse_from_le16(uint16_t x) { return x; }+static inline uint32_t verse_from_le32(uint32_t x) { return x; }+static inline uint64_t verse_from_le64(uint64_t x) { return x; }++#else++static inline uint16_t verse_to_be16(uint16_t x) { return x; }+static inline uint32_t verse_to_be32(uint32_t x) { return x; }+static inline uint64_t verse_to_be64(uint64_t x) { return x; }+static inline uint16_t verse_from_be16(uint16_t x) { return x; }+static inline uint32_t verse_from_be32(uint32_t x) { return x; }+static inline uint64_t verse_from_be64(uint64_t x) { return x; }++static inline uint16_t verse_to_le16(uint16_t x) { return verse_bswap16(x); }+static inline uint32_t verse_to_le32(uint32_t x) { return verse_bswap32(x); }+static inline uint64_t verse_to_le64(uint64_t x) { return verse_bswap64(x); }+static inline uint16_t verse_from_le16(uint16_t x) { return verse_bswap16(x); }+static inline uint32_t verse_from_le32(uint32_t x) { return verse_bswap32(x); }+static inline uint64_t verse_from_le64(uint64_t x) { return verse_bswap64(x); }++#endif /* Byte order */++#else /* Not __GNUC__ use portable implementations */+#define __VERSE_REQUIRE_PORTABLE_ENDIAN__++extern uint16_t verse_to_be16(uint16_t x);+extern uint32_t verse_to_be32(uint32_t x);+extern uint64_t verse_to_be64(uint64_t x);+extern uint16_t verse_to_le16(uint16_t x);+extern uint32_t verse_to_le32(uint32_t x);+extern uint64_t verse_to_le64(uint64_t x);++extern uint16_t verse_from_be16(uint16_t x);+extern uint32_t verse_from_be32(uint32_t x);+extern uint64_t verse_from_be64(uint64_t x);+extern uint16_t verse_from_le16(uint16_t x);+extern uint32_t verse_from_le32(uint32_t x);+extern uint64_t verse_from_le64(uint64_t x);++#endif++/*+ *         Rotation functions.+ */+++static inline uint8_t verse_rotL8(uint8_t w, int c) {+	return (w << c) | (w >> (8 - c));+}++static inline uint16_t verse_rotL16(uint16_t w, int c) {+	return (w << c) | (w >> (16 - c));+}++static inline uint32_t verse_rotL32(uint32_t w, int c) {+	return (w << c) | (w >> (32 - c));+}++static inline uint64_t verse_rotL64(uint64_t w, int c) {+	return (w << c) | (w >> (64 - c));+}+++static inline uint16_t verse_rotR8(uint8_t w, int c) {+	return (w >> c) | (w << (8 - c));+}++static inline uint16_t verse_rotR16(uint16_t w, int c) {+	return (w >> c) | (w << (16 - c));+}++static inline uint32_t verse_rotR32(uint32_t w, int c) {+	return (w >> c) | (w << (32 - c));+}++static inline uint64_t verse_rotR64(uint64_t w, int c) {+	return (w >> c) | (w << (64 - c));+}
raaz.cabal view
@@ -1,7 +1,7 @@ cabal-version: 3.0  name:    raaz-version: 0.3.0+version: 0.3.1 stability: experimental  synopsis: Fast and type safe cryptography.@@ -82,7 +82,7 @@   -- >          ^                  ^                     ^   -- >          |                  |                     |   -- >    +------------+    +--------------+       +--------------+-  -- >    | digest-api |    |  entropy-api |       |   encryt-api |+  -- >    | digest-api |    |  entropy-api |       |  encrypt-api |   -- >    |            |    |              |       |              |   -- >    |            |    |              |       |              |   -- >    +------------+    +--------------+       +--------------+@@ -264,7 +264,8 @@            , libverse/poly1305/c/portable.c            , libverse/verse.c   include-dirs: libverse-  includes: libverse/verse.h+  includes: verse.h+  install-includes: verse.h   ---------------------- Implementation signature packages -------------