Commit Graph

339 Commits

Author SHA1 Message Date
xantares
e2a30a859d Fixed libsodium.def dependency 2013-10-09 19:22:23 +02:00
Frank Denis
9599289ae0 Use HAVE_TI_MODE in portable-jane.h to use (or not) int128_t 2013-10-08 13:10:16 -07:00
Frank Denis
5ae6712192 More C89 compat 2013-10-07 19:58:06 -07:00
Frank Denis
1e4157ad19 blake2b: use only pre-C99 style declarations. 2013-10-07 19:46:32 -07:00
Frank Denis
82c7b125af Define an empty SODIUM_EXPORT if SODIUM_STATIC is defined. 2013-10-07 19:32:58 -07:00
Frank Denis
8fbbb98847 Be consistent, keep macros and related functions next to each other. 2013-10-05 14:11:57 -07:00
Frank Denis
5e4e3c9ecf Add an empty line. Yeah, that's a fantastic commit. 2013-10-05 14:08:03 -07:00
Frank Denis
8effa1ea88 Export scalarmult_curve25519 constants 2013-10-05 14:06:09 -07:00
Frank Denis
71489f447a Make MSVC parser not panic when it parses a long literal.
Just use the scientific notation instead.
Found by @sneves, thanks!
2013-10-04 14:48:33 -07:00
Frank Denis
32a8591985 Fix randombytes_salsa20_random.c for MSVC 2013-09-24 14:20:52 -07:00
Frank Denis
26d108d468 MSVC fixes for randombytes_sysrandom.c 2013-09-24 14:09:26 -07:00
Frank Denis
ad49d05a8b Match randombytes() prototype with declaration. 2013-09-24 14:06:26 -07:00
Frank Denis
18015e71e2 randombytes_stir() returns void 2013-09-24 14:05:34 -07:00
Frank Denis
02bb86d18b MSVC/portable-jane.h: don't redefine _CRT_SECURE_NO_WARNINGS 2013-09-24 13:42:23 -07:00
Frank Denis
8086d6f696 blake2: remove more declarations in for() for MSVC 2013-09-24 13:38:02 -07:00
Frank Denis
14809c12c4 MSVC doesn't like a definition in a for() loop. 2013-09-24 13:28:31 -07:00
Frank Denis
c43440f01c More fixes for big-endian architectures 2013-09-21 19:43:39 -07:00
Frank Denis
c19b0128e2 Add aes256-table-be.h to the Makefile 2013-09-21 18:56:24 -07:00
Frank Denis
29f81d167c aes256 table for big endian 2013-09-21 18:55:36 -07:00
Frank Denis
15f87c1c90 Reformat aes-table-le.h 2013-09-21 18:50:59 -07:00
Frank Denis
5dd623e96d Move endian-dependent aes256estream/aes-table.h bits to aes-table-le.h 2013-09-21 18:27:11 -07:00
Frank Denis
30e27fcd25 Make aes256estream implementation less LE dependant. BE Sbox coming up next. 2013-09-21 15:27:34 -07:00
Frank Denis
b03a2991b2 Add crypto_onetimeauth_poly1305_ref() wrapper. 2013-09-09 22:17:54 -07:00
Frank Denis
554ad5bb6c Remove ALIGN definition from portable-jane.h
A macro of the same name is already defined by OpenBSD's libc, and the
portable-jane.h one is not in use yet.
2013-09-08 13:55:54 -07:00
Frank Denis
493f71a98a Use autoconf to possibly define CPU_ALIGNED_ACCESS_REQUIRED 2013-09-08 10:39:27 -07:00
Frank Denis
2181c087e3 Define CPU type in aes256ctr.
That should be changed to an autoconf test.
2013-09-08 10:01:32 -07:00
Frank Denis
05d6defd77 Quick quirk to support unaligned input for aes256estream. 2013-09-07 16:40:51 -07:00
Frank Denis
82d97ce5fb aes256estream: don't assume that unaligned words can be read (for the input) 2013-09-07 16:13:16 -07:00
Frank Denis
69641010c9 Reindent aes256.h, remove commented code 2013-09-07 16:02:24 -07:00
Frank Denis
25c9a00868 Add explicit "const" when casting pointers. No binary changes.
By Massimo Cetra.
2013-09-07 15:39:03 -07:00
Frank Denis
df5a4f56c3 aes256-hongjun: move partial_precompute_tworounds() out of aes256.h 2013-09-07 15:26:46 -07:00
Frank Denis
ecff56742b Rename crypto_onetimeauth_poly1305_ref_implementation_name() prototype. 2013-09-07 15:21:37 -07:00
Massimo Cetra
4e35c3f327 fix compile warnings
When compiling with [-Wold-style-declaration] on GCC, this warning appears:

  warning: ‘inline’ is not at beginning of declaration

This is easily fixed moving the INLINE directive at the very beginning of the declaration
2013-09-07 00:15:36 +02:00
Frank Denis
6b3691be00 More CPUs supporting unaligned access 2013-08-07 16:49:45 -07:00
Frank Denis
4b6f1f5114 Don't assume that unaligned word access is ok, except on x86 & amd64. 2013-08-07 16:38:54 -07:00
Frank Denis
bcfed75ad4 Rename stream_salsa20_amd64_xmm6.s to stream_salsa20_amd64_xmm6.S 2013-08-07 14:53:15 -07:00
Manuel Rüger
1f4b11d5ab Add stackmarkings to stream_salsa20_amd64_xmm6.s
I'm trying to package libsodium for gentoo and received
 * !WX --- --- usr/lib64/libsodium.a:stream_salsa20_amd64_xmm6.o

According to http://www.gentoo.org/proj/en/hardened/gnu-stack.xml
this commit fixes it.
2013-08-04 04:42:56 +02:00
Frank Denis
879112786c Switch poly1305-ref to Floodyberry's poly1305-donna-unrolled. 2013-07-20 17:57:32 -07:00
Frank Denis
49f658c647 Fix C++ compat for utils.c 2013-07-12 21:46:27 -07:00
David Sheets
c7313f56a6 Add a crypto_sign_SEEDBYTES macro/getter and associated ed25519 macro/getter 2013-07-12 17:44:32 +01:00
Frank Denis
6ee74618d0 Use sodium_bin2hex() instead of duplicating the same code everywhere. 2013-07-07 23:46:42 -07:00
Frank Denis
1a3786705e Add a sodium_bin2hex utility function. 2013-07-07 23:38:14 -07:00
Frank Denis
34fe1205ac Mark clang false positives 2013-07-07 18:57:09 -07:00
Frank Denis
cdbbe47ed9 Remove dead assignments that the compiler optimizes out. 2013-07-07 14:27:31 -07:00
irungentoo
4c43660f68 libsodium now cross compiles correctly for Windows from Linux. 2013-07-03 14:41:47 -04:00
Frank Denis
d0e84777ab Add missing SODIUM_EXPORT in crypto_stream.h 2013-06-05 21:54:52 -07:00
Frank Denis
01ee32e3a3 Merge remote-tracking branch 'stouset/add-lookup-methods-for-all-constants'
* stouset/add-lookup-methods-for-all-constants:
  Add remaining functions for looking up constants
  Fix definition of crypto_box_curve25519xsalsa20poly1305_macbytes
  Add functions exposing constants for all operation/primitive pairs
2013-05-22 11:42:58 -07:00
Frank Denis
802369e9dd No need to call randombytes_sysrandom_stir_if_needed() twice. 2013-05-22 11:19:13 -07:00
Frank Denis
e68b08a4ff Call randombytes_salsa20_random_stir_if_needed() only when we don't have
anything in stock, and reduce the number of required getpid() calls.
2013-05-22 11:17:37 -07:00
Stephen Touset
98c02a21d6 Add remaining functions for looking up constants
The automated script that generated functions for looking up #define'd
constants didn't handle edge cases in these files, so these have been
added by hand. They're thus either more likely or less likely to
contain mistakes (depending on one's particular point of view).
2013-05-16 15:48:08 -07:00
Stephen Touset
2a0f3d040f Fix definition of crypto_box_curve25519xsalsa20poly1305_macbytes
This function definition was created by an automated script that
incorrectly handled a corner case.
2013-05-16 15:27:28 -07:00
Stephen Touset
8eea4a3f74 Add functions exposing constants for all operation/primitive pairs
Wrappers for other languages can't access constants defined by C
preprocessor macros, so they must be exposed as functions. This was
already done for the "default" implementation of each operation, but
this commit adds functions for (almost) all of the underlying
primitives.

A few are currently excluded due to problems with the automated script
used to generated this commit. They are:

  * crypto_onetimeauth_poly1305
  * crypto_generichash_blake2b
  * crypto_verify16
  * crypto_verify32
2013-05-16 13:17:18 -07:00
Frank Denis
81d604c70c Add crypto_generichash_keybytes() and crypto_generichash_bytes()
to provide a default key/output size.
2013-05-16 11:45:19 -07:00
Frank Denis
4d147466bc Bump generichash minimum key and output size to 128 bits.
People who know what they are doing and who need a truncated output or a
shorter key can still do it.
But we should keep the chance for users to shoot themselves in the foot down
to a minimum.
2013-05-16 11:25:33 -07:00
Frank Denis
9578af69d2 Use crypto_generichash_state for crypto_generichash_*() wrappers. 2013-05-15 21:21:39 -07:00
Jeroen Habraken
fcc7df0e54 Trivial cleanup of crypto_generichash.h 2013-05-15 22:29:21 -05:00
Frank Denis
a8d4c24e42 <stdlib.h> -> <stddef.h> for size_t 2013-05-15 19:57:07 -07:00
Frank Denis
6988a02e4f Remove trailing whitespaces 2013-05-13 17:00:56 -07:00
Frank Denis
ab2e1ab140 hmac/256 -> hmac512/256 in randombytes_salsa20_random_stir() to make code smaller. 2013-05-13 16:59:57 -07:00
Frank Denis
210de1570a Add --disable-asm option to disable assembly implementations.
Check that fesetenv() and fegetenv() are available. If they aren't, still
compile the floating-point implementation of poly1305, but never pick it
in sodium_init().

This helps libsodium compile and work on Emscripten and on environments with
an incomplete libc.
2013-04-28 09:44:23 -07:00
Frank Denis
013cca7087 Remove crypto_stream_salsa20.h for the distfiles. 2013-04-27 11:17:33 -07:00
Frank Denis
808d1807dc Add optimized salsa20 amd64 assembly implementation 2013-04-27 10:21:32 -07:00
Frank Denis
ffb1e24ef1 Make the crypto_stream_salsa20 implementation switchable at compile-time 2013-04-27 09:12:26 -07:00
Frank Denis
5b09876c95 DRY 2013-04-27 09:03:31 -07:00
Frank Denis
cfe3f24964 sizes are unsigned. 2013-04-27 04:41:34 -07:00
Frank Denis
9a35ba5bfd crypto_stream_(before|after)nm is not implemented for salsa20* stream ciphers
Adding this interface is trivial, but until it's done, remove references to it.
2013-04-27 04:34:53 -07:00
Frank Denis
e1a0faee7f Move force_inline to beginning of declarations. 2013-04-26 23:21:46 -07:00
Frank Denis
c9fe802b9b Remove/ignore unused vars, use unsigned long long to iterate over sizes 2013-04-26 23:16:30 -07:00
Frank Denis
a5e9dc8467 Don't doit() 2013-04-26 23:10:47 -07:00
Frank Denis
81be9738ef More int vs unsigned long long 2013-04-26 23:07:27 -07:00
Frank Denis
f3b7ad8817 Remove doit() from onetimeauth_poly1305_try.c - we're not benchmarking for now 2013-04-26 23:05:58 -07:00
Frank Denis
ef1273126e Try a simple verification in onetimeauth_poly1305_try 2013-04-26 23:03:38 -07:00
Frank Denis
c2b6529577 In crypto_hash() lengths are ULL, so dont loop using and int value 2013-04-26 23:00:51 -07:00
Frank Denis
6ec9828b9f Reindent 2013-04-26 22:19:24 -07:00
Frank Denis
0f68434d68 Visual C++ compat is neat, except when it breaks everything else. 2013-04-26 21:59:31 -07:00
Frank Denis
73f68e27ca Add missing return in crypto_stream_aes256estream_beforenm() 2013-04-26 21:55:10 -07:00
Frank Denis
1706d63d65 More Visual C++ compat 2013-04-26 21:48:05 -07:00
Frank Denis
7f7eaf76b0 Missing #include "randombytes.h" 2013-04-26 21:47:19 -07:00
Frank Denis
330fb494e1 More Visual C++ compat 2013-04-26 21:46:57 -07:00
Frank Denis
65a30e52d4 Make ECRYPT_ctx non-anonymous 2013-04-26 21:43:20 -07:00
Frank Denis
ad44ec5b15 Don't use C99isms on Visual C++. 2013-04-26 21:41:32 -07:00
Frank Denis
47bb35cb8b Make struct crypto_generichash_blake2b_state non-anonymous 2013-04-26 21:29:53 -07:00
Frank Denis
bd6fb7e03c style 2013-04-26 21:14:12 -07:00
Frank Denis
57a4552eb1 + aes256estream 2013-04-26 21:06:34 -07:00
Frank Denis
edc5faffd6 Add more information about thread safety until we provide a thread-safe API. 2013-04-26 17:27:55 -07:00
Frank Denis
1b87626e9f Move randombytes_stir() before returning sodium_init(). 2013-04-26 17:05:23 -07:00
Frank Denis
8de0ae0e73 Call randombytes_stir() in sodium_init(). 2013-04-26 17:03:50 -07:00
Frank Denis
076eb56e24 Set initialized=1 when everything has actually been initialized 2013-04-26 17:02:53 -07:00
Frank Denis
efb3d9919f randombytes_buf() returns void. 2013-04-26 16:55:01 -07:00
Frank Denis
1e7fccf806 Sort 2013-04-26 11:26:37 -07:00
Frank Denis
6df4c3a1f3 Explicitly include sodium/crypto_scalarmult_curve25519.h.in in dist files 2013-04-26 11:25:58 -07:00
Frank Denis
65e1b792dc Don't forget SODIUM_EXPORT in version.h.in 2013-04-25 21:43:31 -07:00
Frank Denis
f0d71f9df0 Check allocate() return code. 2013-04-25 15:54:25 -07:00
Jeroen Habraken
eeab6bd2ce The "__attribute__((always_inline))" attribute does not replace "inline", they need to be used togher. This fixes the "warning: always_inline function might not be inlinable [-Wattributes]" warnings emitted by GCC 4.7. 2013-04-24 13:58:35 -05:00
Frank Denis
18369c960f Don't forget exporting symbols from crypto_scalarmult_curve25519 2013-04-24 08:40:43 -07:00
Frank Denis
b381f42d17 Move blake2 own functions to the crypto_generichash_blake2b namespace 2013-04-24 08:10:15 -07:00
Frank Denis
30909a7dea Fix DISTCLEANFILES 2013-04-23 22:57:05 -07:00
Frank Denis
f41677ef2e Remove extra leading spaces 2013-04-23 22:54:14 -07:00
Frank Denis
655a9589b8 Output .DEF file on Win32 2013-04-23 21:24:35 -07:00
Frank Denis
60e8d3c6da No need to define crypto_hash_sha512 as a macro, it's a real function. 2013-04-23 20:38:39 -07:00