[arch-commits] Commit in haskell-cryptonite/repos (6 files)
Felix Yan
fyan at archlinux.org
Wed Jun 8 09:09:47 UTC 2016
Date: Wednesday, June 8, 2016 @ 11:09:47
Author: fyan
Revision: 178596
archrelease: copy trunk to community-staging-i686, community-staging-x86_64
Added:
haskell-cryptonite/repos/community-staging-i686/
haskell-cryptonite/repos/community-staging-i686/PKGBUILD
(from rev 178595, haskell-cryptonite/trunk/PKGBUILD)
haskell-cryptonite/repos/community-staging-i686/i686.patch
(from rev 178595, haskell-cryptonite/trunk/i686.patch)
haskell-cryptonite/repos/community-staging-x86_64/PKGBUILD
(from rev 178595, haskell-cryptonite/trunk/PKGBUILD)
haskell-cryptonite/repos/community-staging-x86_64/i686.patch
(from rev 178595, haskell-cryptonite/trunk/i686.patch)
Deleted:
haskell-cryptonite/repos/community-staging-x86_64/PKGBUILD
-------------------------------------+
/PKGBUILD | 50 ++++++++++++++++++++++
community-staging-i686/PKGBUILD | 50 ++++++++++++++++++++++
community-staging-i686/i686.patch | 75 ++++++++++++++++++++++++++++++++++
community-staging-x86_64/PKGBUILD | 42 -------------------
community-staging-x86_64/i686.patch | 75 ++++++++++++++++++++++++++++++++++
5 files changed, 250 insertions(+), 42 deletions(-)
Copied: haskell-cryptonite/repos/community-staging-i686/PKGBUILD (from rev 178595, haskell-cryptonite/trunk/PKGBUILD)
===================================================================
--- community-staging-i686/PKGBUILD (rev 0)
+++ community-staging-i686/PKGBUILD 2016-06-08 09:09:47 UTC (rev 178596)
@@ -0,0 +1,50 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Arch Haskell Team <arch-haskell at haskell.org>
+
+_hkgname=cryptonite
+pkgname=haskell-cryptonite
+pkgver=0.16
+pkgrel=1
+pkgdesc="Cryptography Primitives sink"
+url="https://github.com/vincenthz/cryptonite"
+license=("custom:BSD3")
+arch=('i686' 'x86_64')
+depends=("ghc=8.0.1" "haskell-memory")
+source=("http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+ i686.patch)
+sha256sums=('5c3bf190954986ea4af466914eb7a0c55a0b4c1c66552d00341277c89082511a'
+ '0bd68b7fd7caa859ca9a5dd7343c45c0dfd22c0c5cd55dec626de2dd9804abec')
+
+prepare() {
+ cd $_hkgname-$pkgver
+ # https://github.com/haskell-crypto/cryptonite/issues/88
+ patch -p1 -i ../i686.patch
+}
+
+build() {
+ cd "${srcdir}/${_hkgname}-${pkgver}"
+
+ runhaskell Setup configure -O --enable-library-profiling --enable-shared \
+ --prefix=/usr --docdir="/usr/share/doc/${pkgname}" \
+ --libsubdir=\$compiler/site-local/\$pkgid \
+ -fsupport_deepseq -finteger-gmp -f-support_pclmuldq -fsupport_rdrand -fsupport_aesni -f-old_toolchain_inliner
+ runhaskell Setup build
+ runhaskell Setup haddock --hoogle --html
+ runhaskell Setup register --gen-script
+ runhaskell Setup unregister --gen-script
+ sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
+ sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+}
+
+package() {
+ cd "${srcdir}/${_hkgname}-${pkgver}"
+
+ install -D -m744 register.sh "${pkgdir}/usr/share/haskell/register/${pkgname}.sh"
+ install -D -m744 unregister.sh "${pkgdir}/usr/share/haskell/unregister/${pkgname}.sh"
+ install -d -m755 "${pkgdir}/usr/share/doc/ghc/html/libraries"
+ ln -s "/usr/share/doc/${pkgname}/html" "${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}"
+ runhaskell Setup copy --destdir="${pkgdir}"
+ install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ rm -f "${pkgdir}/usr/share/doc/${pkgname}/LICENSE"
+}
Copied: haskell-cryptonite/repos/community-staging-i686/i686.patch (from rev 178595, haskell-cryptonite/trunk/i686.patch)
===================================================================
--- community-staging-i686/i686.patch (rev 0)
+++ community-staging-i686/i686.patch 2016-06-08 09:09:47 UTC (rev 178596)
@@ -0,0 +1,75 @@
+From f5a811e755eee253bc34897f327e096e04ad1286 Mon Sep 17 00:00:00 2001
+From: Vincent Hanquez <vincent at snarc.org>
+Date: Fri, 3 Jun 2016 07:12:38 +0100
+Subject: [PATCH] [rdrand] add an untested workaround for i686 machine
+
+---
+ cbits/cryptonite_rdrand.c | 35 ++++++++++++++++++++++++++++-------
+ 1 file changed, 28 insertions(+), 7 deletions(-)
+
+diff --git a/cbits/cryptonite_rdrand.c b/cbits/cryptonite_rdrand.c
+index 54409fc..66501e5 100644
+--- a/cbits/cryptonite_rdrand.c
++++ b/cbits/cryptonite_rdrand.c
+@@ -65,17 +65,38 @@ static inline int crypto_random_rdrand64_step(uint64_t *buffer)
+ : \
+ : "cc")
+
++/* inline encoding of 'rdrand %eax' to cover old binutils
++ * - no inputs
++ * - 'cc' to the clobber list as we modify condition code.
++ * - output of rdrand in eax and have a 8 bit error condition
++ */
++#define inline_rdrand_eax(val, err) \
++ asm(".byte 0x0f,0xc7,0xf0; setc %1" \
++ : "=a" (val), "=q" (err) \
++ : \
++ : "cc")
++
++#ifdef __x86_64__
++# define RDRAND_SZ 8
++# define RDRAND_T uint64_t
++#define inline_rdrand(val, err) inline_rdrand_rax(val, err)
++#else
++# define RDRAND_SZ 4
++# define RDRAND_T uint32_t
++#define inline_rdrand(val, err) inline_rdrand_eax(val, err)
++#endif
++
+ /* Returns the number of bytes succesfully generated */
+ int cryptonite_get_rand_bytes(uint8_t *buffer, size_t len)
+ {
+- uint64_t tmp;
+- int aligned = (intptr_t) buffer % 8;
++ RDRAND_T tmp;
++ int aligned = (intptr_t) buffer % RDRAND_SZ;
+ int orig_len = len;
+- int to_alignment = 8 - aligned;
++ int to_alignment = RDRAND_SZ - aligned;
+ uint8_t ok;
+
+ if (aligned != 0) {
+- inline_rdrand_rax(tmp, ok);
++ inline_rdrand(tmp, ok);
+ if (!ok)
+ return 0;
+ memcpy(buffer, (uint8_t *) &tmp, to_alignment);
+@@ -83,15 +104,15 @@ int cryptonite_get_rand_bytes(uint8_t *buffer, size_t len)
+ len -= to_alignment;
+ }
+
+- for (; len >= 8; buffer += 8, len -= 8) {
+- inline_rdrand_rax(tmp, ok);
++ for (; len >= RDRAND_SZ; buffer += RDRAND_SZ, len -= RDRAND_SZ) {
++ inline_rdrand(tmp, ok);
+ if (!ok)
+ return (orig_len - len);
+ *((uint64_t *) buffer) = tmp;
+ }
+
+ if (len > 0) {
+- inline_rdrand_rax(tmp, ok);
++ inline_rdrand(tmp, ok);
+ if (!ok)
+ return (orig_len - len);
+ memcpy(buffer, (uint8_t *) &tmp, len);
Deleted: community-staging-x86_64/PKGBUILD
===================================================================
--- community-staging-x86_64/PKGBUILD 2016-06-08 09:09:22 UTC (rev 178595)
+++ community-staging-x86_64/PKGBUILD 2016-06-08 09:09:47 UTC (rev 178596)
@@ -1,42 +0,0 @@
-# $Id$
-# Maintainer: Felix Yan <felixonmars at archlinux.org>
-# Contributor: Arch Haskell Team <arch-haskell at haskell.org>
-
-_hkgname=cryptonite
-pkgname=haskell-cryptonite
-pkgver=0.16
-pkgrel=1
-pkgdesc="Cryptography Primitives sink"
-url="https://github.com/vincenthz/cryptonite"
-license=("custom:BSD3")
-arch=('i686' 'x86_64')
-depends=("ghc=8.0.1" "haskell-memory")
-source=("http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz")
-sha256sums=('5c3bf190954986ea4af466914eb7a0c55a0b4c1c66552d00341277c89082511a')
-
-build() {
- cd "${srcdir}/${_hkgname}-${pkgver}"
-
- runhaskell Setup configure -O --enable-library-profiling --enable-shared \
- --prefix=/usr --docdir="/usr/share/doc/${pkgname}" \
- --libsubdir=\$compiler/site-local/\$pkgid \
- -fsupport_deepseq -finteger-gmp -f-support_pclmuldq -fsupport_rdrand -fsupport_aesni -f-old_toolchain_inliner
- runhaskell Setup build
- runhaskell Setup haddock --hoogle --html
- runhaskell Setup register --gen-script
- runhaskell Setup unregister --gen-script
- sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
- sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
-}
-
-package() {
- cd "${srcdir}/${_hkgname}-${pkgver}"
-
- install -D -m744 register.sh "${pkgdir}/usr/share/haskell/register/${pkgname}.sh"
- install -D -m744 unregister.sh "${pkgdir}/usr/share/haskell/unregister/${pkgname}.sh"
- install -d -m755 "${pkgdir}/usr/share/doc/ghc/html/libraries"
- ln -s "/usr/share/doc/${pkgname}/html" "${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}"
- runhaskell Setup copy --destdir="${pkgdir}"
- install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
- rm -f "${pkgdir}/usr/share/doc/${pkgname}/LICENSE"
-}
Copied: haskell-cryptonite/repos/community-staging-x86_64/PKGBUILD (from rev 178595, haskell-cryptonite/trunk/PKGBUILD)
===================================================================
--- community-staging-x86_64/PKGBUILD (rev 0)
+++ community-staging-x86_64/PKGBUILD 2016-06-08 09:09:47 UTC (rev 178596)
@@ -0,0 +1,50 @@
+# $Id$
+# Maintainer: Felix Yan <felixonmars at archlinux.org>
+# Contributor: Arch Haskell Team <arch-haskell at haskell.org>
+
+_hkgname=cryptonite
+pkgname=haskell-cryptonite
+pkgver=0.16
+pkgrel=1
+pkgdesc="Cryptography Primitives sink"
+url="https://github.com/vincenthz/cryptonite"
+license=("custom:BSD3")
+arch=('i686' 'x86_64')
+depends=("ghc=8.0.1" "haskell-memory")
+source=("http://hackage.haskell.org/packages/archive/${_hkgname}/${pkgver}/${_hkgname}-${pkgver}.tar.gz"
+ i686.patch)
+sha256sums=('5c3bf190954986ea4af466914eb7a0c55a0b4c1c66552d00341277c89082511a'
+ '0bd68b7fd7caa859ca9a5dd7343c45c0dfd22c0c5cd55dec626de2dd9804abec')
+
+prepare() {
+ cd $_hkgname-$pkgver
+ # https://github.com/haskell-crypto/cryptonite/issues/88
+ patch -p1 -i ../i686.patch
+}
+
+build() {
+ cd "${srcdir}/${_hkgname}-${pkgver}"
+
+ runhaskell Setup configure -O --enable-library-profiling --enable-shared \
+ --prefix=/usr --docdir="/usr/share/doc/${pkgname}" \
+ --libsubdir=\$compiler/site-local/\$pkgid \
+ -fsupport_deepseq -finteger-gmp -f-support_pclmuldq -fsupport_rdrand -fsupport_aesni -f-old_toolchain_inliner
+ runhaskell Setup build
+ runhaskell Setup haddock --hoogle --html
+ runhaskell Setup register --gen-script
+ runhaskell Setup unregister --gen-script
+ sed -i -r -e "s|ghc-pkg.*update[^ ]* |&'--force' |" register.sh
+ sed -i -r -e "s|ghc-pkg.*unregister[^ ]* |&'--force' |" unregister.sh
+}
+
+package() {
+ cd "${srcdir}/${_hkgname}-${pkgver}"
+
+ install -D -m744 register.sh "${pkgdir}/usr/share/haskell/register/${pkgname}.sh"
+ install -D -m744 unregister.sh "${pkgdir}/usr/share/haskell/unregister/${pkgname}.sh"
+ install -d -m755 "${pkgdir}/usr/share/doc/ghc/html/libraries"
+ ln -s "/usr/share/doc/${pkgname}/html" "${pkgdir}/usr/share/doc/ghc/html/libraries/${_hkgname}"
+ runhaskell Setup copy --destdir="${pkgdir}"
+ install -D -m644 "LICENSE" "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
+ rm -f "${pkgdir}/usr/share/doc/${pkgname}/LICENSE"
+}
Copied: haskell-cryptonite/repos/community-staging-x86_64/i686.patch (from rev 178595, haskell-cryptonite/trunk/i686.patch)
===================================================================
--- community-staging-x86_64/i686.patch (rev 0)
+++ community-staging-x86_64/i686.patch 2016-06-08 09:09:47 UTC (rev 178596)
@@ -0,0 +1,75 @@
+From f5a811e755eee253bc34897f327e096e04ad1286 Mon Sep 17 00:00:00 2001
+From: Vincent Hanquez <vincent at snarc.org>
+Date: Fri, 3 Jun 2016 07:12:38 +0100
+Subject: [PATCH] [rdrand] add an untested workaround for i686 machine
+
+---
+ cbits/cryptonite_rdrand.c | 35 ++++++++++++++++++++++++++++-------
+ 1 file changed, 28 insertions(+), 7 deletions(-)
+
+diff --git a/cbits/cryptonite_rdrand.c b/cbits/cryptonite_rdrand.c
+index 54409fc..66501e5 100644
+--- a/cbits/cryptonite_rdrand.c
++++ b/cbits/cryptonite_rdrand.c
+@@ -65,17 +65,38 @@ static inline int crypto_random_rdrand64_step(uint64_t *buffer)
+ : \
+ : "cc")
+
++/* inline encoding of 'rdrand %eax' to cover old binutils
++ * - no inputs
++ * - 'cc' to the clobber list as we modify condition code.
++ * - output of rdrand in eax and have a 8 bit error condition
++ */
++#define inline_rdrand_eax(val, err) \
++ asm(".byte 0x0f,0xc7,0xf0; setc %1" \
++ : "=a" (val), "=q" (err) \
++ : \
++ : "cc")
++
++#ifdef __x86_64__
++# define RDRAND_SZ 8
++# define RDRAND_T uint64_t
++#define inline_rdrand(val, err) inline_rdrand_rax(val, err)
++#else
++# define RDRAND_SZ 4
++# define RDRAND_T uint32_t
++#define inline_rdrand(val, err) inline_rdrand_eax(val, err)
++#endif
++
+ /* Returns the number of bytes succesfully generated */
+ int cryptonite_get_rand_bytes(uint8_t *buffer, size_t len)
+ {
+- uint64_t tmp;
+- int aligned = (intptr_t) buffer % 8;
++ RDRAND_T tmp;
++ int aligned = (intptr_t) buffer % RDRAND_SZ;
+ int orig_len = len;
+- int to_alignment = 8 - aligned;
++ int to_alignment = RDRAND_SZ - aligned;
+ uint8_t ok;
+
+ if (aligned != 0) {
+- inline_rdrand_rax(tmp, ok);
++ inline_rdrand(tmp, ok);
+ if (!ok)
+ return 0;
+ memcpy(buffer, (uint8_t *) &tmp, to_alignment);
+@@ -83,15 +104,15 @@ int cryptonite_get_rand_bytes(uint8_t *buffer, size_t len)
+ len -= to_alignment;
+ }
+
+- for (; len >= 8; buffer += 8, len -= 8) {
+- inline_rdrand_rax(tmp, ok);
++ for (; len >= RDRAND_SZ; buffer += RDRAND_SZ, len -= RDRAND_SZ) {
++ inline_rdrand(tmp, ok);
+ if (!ok)
+ return (orig_len - len);
+ *((uint64_t *) buffer) = tmp;
+ }
+
+ if (len > 0) {
+- inline_rdrand_rax(tmp, ok);
++ inline_rdrand(tmp, ok);
+ if (!ok)
+ return (orig_len - len);
+ memcpy(buffer, (uint8_t *) &tmp, len);
More information about the arch-commits
mailing list