siphash: minor improvements to siphash unit testSigned-off-by: Mark O'Donovan <shiftee@posteo.net>Reviewed by: imp, cpercivaPull Request: https://github.com/freebsd/freebsd-src/pull/1324
siphash: allow zero values for final & len in SipBuf()Currently the assert checks for XOR of final and len.This assert fails when running the unit tests in siphash_test.c.We need to allow the cas
siphash: allow zero values for final & len in SipBuf()Currently the assert checks for XOR of final and len.This assert fails when running the unit tests in siphash_test.c.We need to allow the case where both values are zero.Signed-off-by: Mark O'Donovan <shiftee@posteo.net>Reviewed by: imp, cpercivaPull Request: https://github.com/freebsd/freebsd-src/pull/1324
show more ...
sys: Automated cleanup of cdefs and other formattingApply the following automated changes to try to eliminateno-longer-needed sys/cdefs.h includes as well as now-emptyblank lines in a row.Remov
sys: Automated cleanup of cdefs and other formattingApply the following automated changes to try to eliminateno-longer-needed sys/cdefs.h includes as well as now-emptyblank lines in a row.Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/Remove /\n+#if.*\n#endif.*\n+/Remove /^#if.*\n#endif.*\n/Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/Sponsored by: Netflix
sys: Remove $FreeBSD$: one-line .c patternRemove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
sys: Remove $FreeBSD$: two-line .h patternRemove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
Fix C++ includability of crypto headers with static array sizesC99 allows array function parameters to use the static keyword for theirsizes. This tells the compiler that the parameter will have a
Fix C++ includability of crypto headers with static array sizesC99 allows array function parameters to use the static keyword for theirsizes. This tells the compiler that the parameter will have at least thespecified size, and calling code will fail to compile if that guarantee isnot met. However, this syntax is not legal in C++.This commit reverts r300824, which worked around the problem forsys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) canbe used in headers as a static array size, but will still compile in C++mode.Reviewed by: cem, edMFC after: 4 weeksSponsored by: Spectra Logic CorpDifferential Revision: https://reviews.freebsd.org/D8277
crypto routines: Hint minimum buffer sizes to the compilerUse the C99 'static' keyword to hint to the compiler IVs and output digestsizes. The keyword informs the compiler of the minimum valid si
crypto routines: Hint minimum buffer sizes to the compilerUse the C99 'static' keyword to hint to the compiler IVs and output digestsizes. The keyword informs the compiler of the minimum valid size for a givenarray. Obviously not every pointer can be validated (i.e., the compiler canproduce false negative but not false positive reports).No functional change. No ABI change.Sponsored by: EMC / Isilon Storage Division
Fix const propagation issues to make GCC happy.Submitted by: Michael Butler <imb@protected-networks.net>
SipHash is a cryptographically strong pseudo-random function (a.k.a. keyedhash function) optimized for speed on short messages returning a 64bit hash/digest value.SipHash is simpler and much fast
SipHash is a cryptographically strong pseudo-random function (a.k.a. keyedhash function) optimized for speed on short messages returning a 64bit hash/digest value.SipHash is simpler and much faster than other secure MACs and competitivein speed with popular non-cryptographic hash functions. It uses a 128-bitkey without the hidden cost of a key expansion step. SipHash iterates asimple round function consisting of four additions, four xors, and sixrotations, interleaved with xors of message blocks for a pre-defined numberof compression and finalization rounds. The absence of secret load/storeaddresses or secret branch conditions avoid timing attacks. No state isshared between messages. Hashing is deterministic and doesn't use nonces.It is not susceptible to length extension attacks.Target applications include network traffic authentication, messageauthentication (MAC) and hash-tables protection against hash-floodingdenial-of-service attacks.The number of update/finalization rounds is defined during initialization: SipHash24_Init() for the fast and reasonable strong version. SipHash48_Init() for the strong version (half as fast).SipHash usage is similar to other hash functions: struct SIPHASH_CTX ctx; char *k = "16bytes long key" char *s = "string"; uint64_t h = 0; SipHash24_Init(&ctx); SipHash_SetKey(&ctx, k); SipHash_Update(&ctx, s, strlen(s)); SipHash_Final(&h, &ctx); /* or */ h = SipHash_End(&ctx); /* or */ h = SipHash24(&ctx, k, s, strlen(s));It was designed by Jean-Philippe Aumasson and Daniel J. Bernstein andis described in the paper "SipHash: a fast short-input PRF", 2012.09.18: https://131002.net/siphash/siphash.pdf Permanent ID: b9a943a805fbfc6fde808af9fc0ecdfaImplemented by: andre (based on the paper)Reviewed by: cperciva