forked from Lainports/opnsense-ports
security/libgcrypt: sync with upstream
Taken from: FreeBSD
This commit is contained in:
parent
1ee709feca
commit
6ea7e7e919
7 changed files with 296 additions and 100 deletions
|
|
@ -1,8 +1,7 @@
|
|||
# $FreeBSD$
|
||||
|
||||
PORTNAME= libgcrypt
|
||||
PORTVERSION= 1.6.5
|
||||
PORTREVISION= 1
|
||||
PORTVERSION= 1.7.0
|
||||
CATEGORIES= security
|
||||
MASTER_SITES= GNUPG
|
||||
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
SHA256 (libgcrypt-1.6.5.tar.bz2) = f49ebc5842d455ae7019def33eb5a014a0f07a2a8353dc3aa50a76fd1dafa924
|
||||
SIZE (libgcrypt-1.6.5.tar.bz2) = 2549601
|
||||
SHA256 (libgcrypt-1.7.0.tar.bz2) = b0e67ea74474939913c4d9d9ef4ef5ec378efbe2bebe36389dee319c79bffa92
|
||||
SIZE (libgcrypt-1.7.0.tar.bz2) = 2840453
|
||||
|
|
|
|||
279
security/libgcrypt/files/patch-cipher_crc-intel-pclmul.c
Normal file
279
security/libgcrypt/files/patch-cipher_crc-intel-pclmul.c
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
--- cipher/crc-intel-pclmul.c.orig 2016-04-07 15:30:08 UTC
|
||||
+++ cipher/crc-intel-pclmul.c
|
||||
@@ -143,7 +143,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
[inbuf_2] "m" (inbuf[2 * 16]),
|
||||
[inbuf_3] "m" (inbuf[3 * 16]),
|
||||
[crc] "m" (*pcrc)
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 4 * 16;
|
||||
inlen -= 4 * 16;
|
||||
@@ -151,7 +151,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
asm volatile ("movdqa %[k1k2], %%xmm4\n\t"
|
||||
:
|
||||
: [k1k2] "m" (consts->k[1 - 1])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
/* Fold by 4. */
|
||||
while (inlen >= 4 * 16)
|
||||
@@ -188,7 +188,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
[inbuf_1] "m" (inbuf[1 * 16]),
|
||||
[inbuf_2] "m" (inbuf[2 * 16]),
|
||||
[inbuf_3] "m" (inbuf[3 * 16])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 4 * 16;
|
||||
inlen -= 4 * 16;
|
||||
@@ -199,7 +199,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
:
|
||||
: [k3k4] "m" (consts->k[3 - 1]),
|
||||
[my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
/* Fold 4 to 1. */
|
||||
|
||||
@@ -222,7 +222,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
"pxor %%xmm4, %%xmm0\n\t"
|
||||
:
|
||||
:
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -236,7 +236,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
[crc] "m" (*pcrc),
|
||||
[k3k4] "m" (consts->k[3 - 1]),
|
||||
[my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 16;
|
||||
inlen -= 16;
|
||||
@@ -256,7 +256,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
"pxor %%xmm1, %%xmm0\n\t"
|
||||
:
|
||||
: [inbuf] "m" (*inbuf)
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 16;
|
||||
inlen -= 16;
|
||||
@@ -288,7 +288,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
[mask] "m" (crc32_partial_fold_input_mask[inlen]),
|
||||
[shl_shuf] "m" (crc32_refl_shuf_shift[inlen]),
|
||||
[shr_shuf] "m" (crc32_refl_shuf_shift[inlen + 16])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += inlen;
|
||||
inlen -= inlen;
|
||||
@@ -318,7 +318,7 @@ crc32_reflected_bulk (u32 *pcrc, const b
|
||||
"pextrd $2, %%xmm0, %[out]\n\t"
|
||||
: [out] "=m" (*pcrc)
|
||||
: [k5] "m" (consts->k[5 - 1])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
|
||||
static inline void
|
||||
@@ -333,7 +333,7 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
asm volatile ("movdqa %[my_p], %%xmm5\n\t"
|
||||
:
|
||||
: [my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
if (inlen == 1)
|
||||
{
|
||||
@@ -372,7 +372,7 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
: [out] "=m" (*pcrc)
|
||||
: [in] "rm" (data),
|
||||
[crc] "rm" (crc)
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
else if (inlen == 4)
|
||||
{
|
||||
@@ -391,7 +391,7 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
: [in] "m" (*inbuf),
|
||||
[crc] "m" (*pcrc),
|
||||
[my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -404,14 +404,14 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
[crc] "m" (*pcrc),
|
||||
[my_p] "m" (consts->my_p[0]),
|
||||
[k3k4] "m" (consts->k[3 - 1])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
if (inlen >= 8)
|
||||
{
|
||||
asm volatile ("movq %[inbuf], %%xmm0\n\t"
|
||||
:
|
||||
: [inbuf] "m" (*inbuf)
|
||||
- : );
|
||||
+ );
|
||||
if (inlen > 8)
|
||||
{
|
||||
asm volatile (/*"pinsrq $1, %[inbuf_tail], %%xmm0\n\t"*/
|
||||
@@ -422,7 +422,7 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
: [inbuf_tail] "m" (inbuf[inlen - 8]),
|
||||
[merge_shuf] "m"
|
||||
(*crc32_merge9to15_shuf[inlen - 9])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -435,7 +435,7 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
[inbuf_tail] "m" (inbuf[inlen - 4]),
|
||||
[merge_shuf] "m"
|
||||
(*crc32_merge5to7_shuf[inlen - 5])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
|
||||
/* Final fold. */
|
||||
@@ -465,7 +465,7 @@ crc32_reflected_less_than_16 (u32 *pcrc,
|
||||
"pextrd $2, %%xmm0, %[out]\n\t"
|
||||
: [out] "=m" (*pcrc)
|
||||
: [k5] "m" (consts->k[5 - 1])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
asm volatile ("movdqa %[bswap], %%xmm7\n\t"
|
||||
:
|
||||
: [bswap] "m" (*crc32_bswap_shuf)
|
||||
- : );
|
||||
+ );
|
||||
|
||||
if (inlen >= 8 * 16)
|
||||
{
|
||||
@@ -497,7 +497,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
[inbuf_2] "m" (inbuf[2 * 16]),
|
||||
[inbuf_3] "m" (inbuf[3 * 16]),
|
||||
[crc] "m" (*pcrc)
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 4 * 16;
|
||||
inlen -= 4 * 16;
|
||||
@@ -505,7 +505,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
asm volatile ("movdqa %[k1k2], %%xmm4\n\t"
|
||||
:
|
||||
: [k1k2] "m" (consts->k[1 - 1])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
/* Fold by 4. */
|
||||
while (inlen >= 4 * 16)
|
||||
@@ -546,7 +546,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
[inbuf_1] "m" (inbuf[1 * 16]),
|
||||
[inbuf_2] "m" (inbuf[2 * 16]),
|
||||
[inbuf_3] "m" (inbuf[3 * 16])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 4 * 16;
|
||||
inlen -= 4 * 16;
|
||||
@@ -557,7 +557,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
:
|
||||
: [k3k4] "m" (consts->k[3 - 1]),
|
||||
[my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
/* Fold 4 to 1. */
|
||||
|
||||
@@ -580,7 +580,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
"pxor %%xmm4, %%xmm0\n\t"
|
||||
:
|
||||
:
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -595,7 +595,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
[crc] "m" (*pcrc),
|
||||
[k3k4] "m" (consts->k[3 - 1]),
|
||||
[my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 16;
|
||||
inlen -= 16;
|
||||
@@ -616,7 +616,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
"pxor %%xmm1, %%xmm0\n\t"
|
||||
:
|
||||
: [inbuf] "m" (*inbuf)
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += 16;
|
||||
inlen -= 16;
|
||||
@@ -650,7 +650,7 @@ crc32_bulk (u32 *pcrc, const byte *inbuf
|
||||
[mask] "m" (crc32_partial_fold_input_mask[inlen]),
|
||||
[shl_shuf] "m" (crc32_refl_shuf_shift[32 - inlen]),
|
||||
[shr_shuf] "m" (crc32_shuf_shift[inlen + 16])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
inbuf += inlen;
|
||||
inlen -= inlen;
|
||||
@@ -697,7 +697,7 @@ crc32_less_than_16 (u32 *pcrc, const byt
|
||||
asm volatile ("movdqa %[my_p], %%xmm5\n\t"
|
||||
:
|
||||
: [my_p] "m" (consts->my_p[0])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
if (inlen == 1)
|
||||
{
|
||||
@@ -774,14 +774,14 @@ crc32_less_than_16 (u32 *pcrc, const byt
|
||||
[crc] "m" (*pcrc),
|
||||
[my_p] "m" (consts->my_p[0]),
|
||||
[k3k4] "m" (consts->k[3 - 1])
|
||||
- : );
|
||||
+ );
|
||||
|
||||
if (inlen >= 8)
|
||||
{
|
||||
asm volatile ("movq %[inbuf], %%xmm0\n\t"
|
||||
:
|
||||
: [inbuf] "m" (*inbuf)
|
||||
- : );
|
||||
+ );
|
||||
if (inlen > 8)
|
||||
{
|
||||
asm volatile (/*"pinsrq $1, %[inbuf_tail], %%xmm0\n\t"*/
|
||||
@@ -792,7 +792,7 @@ crc32_less_than_16 (u32 *pcrc, const byt
|
||||
: [inbuf_tail] "m" (inbuf[inlen - 8]),
|
||||
[merge_shuf] "m"
|
||||
(*crc32_merge9to15_shuf[inlen - 9])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -805,7 +805,7 @@ crc32_less_than_16 (u32 *pcrc, const byt
|
||||
[inbuf_tail] "m" (inbuf[inlen - 4]),
|
||||
[merge_shuf] "m"
|
||||
(*crc32_merge5to7_shuf[inlen - 5])
|
||||
- : );
|
||||
+ );
|
||||
}
|
||||
|
||||
/* Final fold. */
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
--- cipher/salsa20.c.orig 2016-03-23 16:34:00 UTC
|
||||
+++ cipher/salsa20.c
|
||||
@@ -485,7 +485,8 @@ salsa20r12_encrypt_stream (void *context
|
||||
static const char*
|
||||
selftest (void)
|
||||
{
|
||||
- SALSA20_context_t ctx;
|
||||
+ byte ctxbuf[sizeof(SALSA20_context_t) + 15];
|
||||
+ SALSA20_context_t *ctx;
|
||||
byte scratch[8+1];
|
||||
byte buf[256+64+4];
|
||||
int i;
|
||||
@@ -502,32 +503,35 @@ selftest (void)
|
||||
static const byte ciphertext_1[] =
|
||||
{ 0xE3, 0xBE, 0x8F, 0xDD, 0x8B, 0xEC, 0xA2, 0xE3};
|
||||
|
||||
- salsa20_setkey (&ctx, key_1, sizeof key_1);
|
||||
- salsa20_setiv (&ctx, nonce_1, sizeof nonce_1);
|
||||
+ /* 16-byte alignment required for amd64 implementation. */
|
||||
+ ctx = (SALSA20_context_t *)((uintptr_t)(ctxbuf + 15) & ~(uintptr_t)15);
|
||||
+
|
||||
+ salsa20_setkey (ctx, key_1, sizeof key_1);
|
||||
+ salsa20_setiv (ctx, nonce_1, sizeof nonce_1);
|
||||
scratch[8] = 0;
|
||||
- salsa20_encrypt_stream (&ctx, scratch, plaintext_1, sizeof plaintext_1);
|
||||
+ salsa20_encrypt_stream (ctx, scratch, plaintext_1, sizeof plaintext_1);
|
||||
if (memcmp (scratch, ciphertext_1, sizeof ciphertext_1))
|
||||
return "Salsa20 encryption test 1 failed.";
|
||||
if (scratch[8])
|
||||
return "Salsa20 wrote too much.";
|
||||
- salsa20_setkey( &ctx, key_1, sizeof(key_1));
|
||||
- salsa20_setiv (&ctx, nonce_1, sizeof nonce_1);
|
||||
- salsa20_encrypt_stream (&ctx, scratch, scratch, sizeof plaintext_1);
|
||||
+ salsa20_setkey( ctx, key_1, sizeof(key_1));
|
||||
+ salsa20_setiv (ctx, nonce_1, sizeof nonce_1);
|
||||
+ salsa20_encrypt_stream (ctx, scratch, scratch, sizeof plaintext_1);
|
||||
if (memcmp (scratch, plaintext_1, sizeof plaintext_1))
|
||||
return "Salsa20 decryption test 1 failed.";
|
||||
|
||||
for (i = 0; i < sizeof buf; i++)
|
||||
buf[i] = i;
|
||||
- salsa20_setkey (&ctx, key_1, sizeof key_1);
|
||||
- salsa20_setiv (&ctx, nonce_1, sizeof nonce_1);
|
||||
+ salsa20_setkey (ctx, key_1, sizeof key_1);
|
||||
+ salsa20_setiv (ctx, nonce_1, sizeof nonce_1);
|
||||
/*encrypt*/
|
||||
- salsa20_encrypt_stream (&ctx, buf, buf, sizeof buf);
|
||||
+ salsa20_encrypt_stream (ctx, buf, buf, sizeof buf);
|
||||
/*decrypt*/
|
||||
- salsa20_setkey (&ctx, key_1, sizeof key_1);
|
||||
- salsa20_setiv (&ctx, nonce_1, sizeof nonce_1);
|
||||
- salsa20_encrypt_stream (&ctx, buf, buf, 1);
|
||||
- salsa20_encrypt_stream (&ctx, buf+1, buf+1, (sizeof buf)-1-1);
|
||||
- salsa20_encrypt_stream (&ctx, buf+(sizeof buf)-1, buf+(sizeof buf)-1, 1);
|
||||
+ salsa20_setkey (ctx, key_1, sizeof key_1);
|
||||
+ salsa20_setiv (ctx, nonce_1, sizeof nonce_1);
|
||||
+ salsa20_encrypt_stream (ctx, buf, buf, 1);
|
||||
+ salsa20_encrypt_stream (ctx, buf+1, buf+1, (sizeof buf)-1-1);
|
||||
+ salsa20_encrypt_stream (ctx, buf+(sizeof buf)-1, buf+(sizeof buf)-1, 1);
|
||||
for (i = 0; i < sizeof buf; i++)
|
||||
if (buf[i] != (byte)i)
|
||||
return "Salsa20 encryption test 2 failed.";
|
||||
|
|
@ -1,27 +1,27 @@
|
|||
--- mpi/longlong.h.orig 2016-03-23 17:33:08 UTC
|
||||
--- mpi/longlong.h.orig 2016-04-18 19:16:10 UTC
|
||||
+++ mpi/longlong.h
|
||||
@@ -170,6 +170,7 @@ MA 02111-1307, USA. */
|
||||
@@ -174,6 +174,7 @@ MA 02111-1307, USA. */
|
||||
(pl) = __m0 * __m1; \
|
||||
} while (0)
|
||||
#define UMUL_TIME 46
|
||||
+#if 0
|
||||
#ifndef LONGLONG_STANDALONE
|
||||
#define udiv_qrnnd(q, r, n1, n0, d) \
|
||||
# define UMUL_TIME 46
|
||||
+# if 0
|
||||
# ifndef LONGLONG_STANDALONE
|
||||
# define udiv_qrnnd(q, r, n1, n0, d) \
|
||||
do { UDItype __r; \
|
||||
@@ -179,6 +180,7 @@ MA 02111-1307, USA. */
|
||||
@@ -183,6 +184,7 @@ MA 02111-1307, USA. */
|
||||
extern UDItype __udiv_qrnnd ();
|
||||
#define UDIV_TIME 220
|
||||
#endif /* LONGLONG_STANDALONE */
|
||||
+#endif /* 0 */
|
||||
# define UDIV_TIME 220
|
||||
# endif /* !LONGLONG_STANDALONE */
|
||||
+# endif /* 0 */
|
||||
#endif /* __alpha */
|
||||
|
||||
/***************************************
|
||||
@@ -1287,7 +1289,7 @@ typedef unsigned int UTItype __attribute
|
||||
@@ -1293,7 +1295,7 @@ typedef unsigned int UTItype __attribute
|
||||
"rJ" ((USItype)(al)), \
|
||||
"rI" ((USItype)(bl)) \
|
||||
__CLOBBER_CC)
|
||||
-#if defined (__sparc_v8__) || defined(__sparcv8)
|
||||
+#if defined (__sparc_v8__) || defined(__sparcv8) || defined (__sparc__)
|
||||
-# if defined (__sparc_v8__)
|
||||
+# if defined (__sparc_v8__) || defined (__sparc__)
|
||||
/* Don't match immediate range because, 1) it is not often useful,
|
||||
2) the 'I' flag thinks of the range as a 13 bit signed interval,
|
||||
while we want to match a 13 bit interval, sign extended to 32 bits,
|
||||
|
|
|
|||
|
|
@ -1,20 +0,0 @@
|
|||
--- src/gcrypt.h.in.orig 2015-09-07 12:05:57 UTC
|
||||
+++ src/gcrypt.h.in
|
||||
@@ -506,7 +506,7 @@ enum gcry_mpi_flag
|
||||
GCRYMPI_FLAG_USER1 = 0x0100,/* User flag 1. */
|
||||
GCRYMPI_FLAG_USER2 = 0x0200,/* User flag 2. */
|
||||
GCRYMPI_FLAG_USER3 = 0x0400,/* User flag 3. */
|
||||
- GCRYMPI_FLAG_USER4 = 0x0800,/* User flag 4. */
|
||||
+ GCRYMPI_FLAG_USER4 = 0x0800 /* User flag 4. */
|
||||
};
|
||||
|
||||
|
||||
@@ -1343,7 +1343,7 @@ enum gcry_mac_algos
|
||||
/* Flags used with the open function. */
|
||||
enum gcry_mac_flags
|
||||
{
|
||||
- GCRY_MAC_FLAG_SECURE = 1, /* Allocate all buffers in "secure" memory. */
|
||||
+ GCRY_MAC_FLAG_SECURE = 1 /* Allocate all buffers in "secure" memory. */
|
||||
};
|
||||
|
||||
/* Create a MAC handle for algorithm ALGO. FLAGS may be given as an bitwise OR
|
||||
|
|
@ -6,6 +6,6 @@ include/gcrypt.h
|
|||
lib/libgcrypt.a
|
||||
lib/libgcrypt.so
|
||||
lib/libgcrypt.so.20
|
||||
lib/libgcrypt.so.20.0.5
|
||||
lib/libgcrypt.so.20.1.0
|
||||
man/man1/hmac256.1.gz
|
||||
share/aclocal/libgcrypt.m4
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue