Build: Fixed some warnings.
Nettle: Fix typo
Nettle: Support nettle 3.5 (cherry picked from commit 9af7432bf2a5eec7cb1db10ca3009c2f70279bab) (cherry picked from commit 47ea46b8c0c7dcd270fe2d87577edfdacd5cc668)
Nettle: Fix typo in previous commit
Nettle: Support nettle 3.5
Nettle.Curve25519: Fixed encoding of Point. The default implemetation of encode() prefixes the value with '\4' (ANSI x9.62 encoding #4), but this should NOT be done for Curve25519 as there is only the single encoding. This fixes key-exchange incompatibilities with SSL.
Merge commit '722771973bd' into patches/lyslyskom22891031 * commit '722771973bd': (6177 commits) Verify that callablep responses are aligned with reality. ...
Merge commit '2470270f500c728d10b8895314d8d8b07016e37b' into grubba/typechecker-automap * commit '2470270f500c728d10b8895314d8d8b07016e37b': (18681 commits) Removed the old typechecker. ...
Merge remote-tracking branch 'origin/master' into new_utf8
Merge remote-tracking branch 'origin/8.1' into gobject-introspection
Merge branch '8.1' into peter/travis
Let module.h include some common includes.
Clean up stack after create.
Nettle [Curve25519]: Improved detection of X25519 support. Don't implement Curve25519 if nettle_ed25519_sha512_sign() isn't available. Improves robustness against mismatching header files and libraries.
Nettle: Don't fail if optional base classes are missing. Attempt to survive without __builtin.Nettle.
Use lexical_inherit.
Less code duplication. This should probably move somewhere more central.
ID_STATIC -> ID_PROTECTED
Added paranoia-check in debug mode.
Only include ECC_Curve when we have at least one curved defined.
Only include ECC_Curve if we have any curve implemented.
Build [Nettle]: Removed redundant declaration. Fixes compilation issues on NT.
Build [Nettle]: Fixed some more C99-isms.
Nettle.Curve25519: Improved support for JOSE. Implements some parts of RFC 8037.
Nettle: Fixed potential compilation issues with old crippled hogweed.
Documentation [Nettle]: Fixed cut'n'paste typo.
Compiler: Moved yyreport() et al to pike_compiler.cmod. More code cleanup.
Nettle.Curve25519.Point: Improved support for Stdio.Buffer. Only read as many bytes as needed from Stdio.Buffer objects.
Crypto.ECC: Unified the APIs for Curve and Curve25519. new_scalar(), get_x() and get_y() now return coordinates in the preferred representation for the curve (ie either as a Gmp.mpz or as a string(8bit)). create(), set() and `*() accept that same value as argument. Added get_{x,y}_{num,str}() to get a specific representation. jose_name() now has a default implementation that returns UNDEFINED. Added default implementation of get_curve(). Curve25519 now has a Point subclass.
Crypto.ECC.Curve.Point: Added jose_name(). Also fixes typo in result of Crypto.ECC.SECP_256R1.jose_name().
Nettle.ECC_Curve.Point: Fixed freeing of unallocated scalar. Fixes SIGSEGV in the testsuite.
Crypto.ECC.Curve.Point: Allow creation without arguments again. Points now default to 'g'. Fixes several testsuite failures.
Crypto.ECC.Curve: Added some more support for JOSE. Added jose_name(), which returns the RFC 7518 name for the curve. It is now possible to initialize a Point from a JWK.
Documentation [Nettle]: Improved doc for Curve25519.
Nettle: Added support for Curve25519 and EdDSA25519. CAVEAT: API subject to change! Note that these have a different API than the other ECC curves due to a different low-level API.
Fix for missing SECP curves.
Nettle: Probe for the SECP curves. Some versions of RedHat have censored the weaker curves (secp_192r1 abd secp_224r1), so we need to survive this. Thanks to Martin Bähr <mbaehr+pike@realss.com> for the report. Fixes [LysLysKOM 21863021].
Added some return value paranoia.
Default to random_string as random function.
Added some static.
Don't clean up stack before returning from void functions.
Nettle [ECDSA]: Fixed parent pointer information. The Point must be inherited by hand, as the parent pointer information otherwise gets lost.
Nettle.ECC.Curve.ECDSA: Inherit the Point.
Don't leak dsa_params bignums on parameter errors.
Doc fixes.
Autodoc fix.
Crypto.ECC.Curve.Point: Added LFUN::_equal(). It is now possible to compare ECC points with predef::equal().
Nettle.ECC_Curve: Survive old versions of Nettle. Thanks to Chris Angelico <rosuav@gmail.com> for the report.
Survive lack of nettle/ecdsa.h Macro definitions inside the guard block were being used outside it, and thus failing in the absence of that header.
Nettle.ECC_Curve: Survive Nettle 2.7.1. ecc_bit_size() is a very new function in Nettle...
The low level API for curve selection only supported a subset of NIST curves. Change into a easier to use and easier to extend API in preparation for curve25519.
Crypto.ECC.Curve: Added LFUN::`==().
Nettle.ECC_Curve: Curve-multiplication now returns Points. NB: This is not backward compatible with previous releases of Pike 8.0.
__builtin.Nettle: Moved Point to ECC_Curve.Point. This will allow for using parent references in ECC_Curve.Point.
ECC_Curve.Point can now deserialize x9.62 curve points.
Nettle.ECC: Added initial implementation of Curve.Point. This is to simplify handling of points on ECC curves. Currently the code is sufficient to perform ECDSA, but eg encode and decode would be nice. TODO: Other code needs to be updated to accept Points.
Nettle.ECC_Curve: Curve-multiplication now returns Points. NB: This is not backward compatible with current Pike 8.0.
Fixed warnings.
Fixed an invariance vaguely pointed out by Niels.
Autodoc fix
More serious attempt at constant time RSA unpadding.
Optimized rsa_unpad a bit.
Nettle: Use PROGRAM_CLEAR_STORAGE.
Nettle: Improve propagation of errors. Use apply() instead of safe_apply() in lots of places. In addition to improving the propagation of errors, it should reduce the stack usage and improve performance, since it avoids the longjump contexts. Also adds quite a few missing proxy functions, and improves the types for some of the existing as well.
AutoDoc: Fixed some markup bugs in Nettle.
Runtime: Improved robustness of parent_storage(). Under some circumstances parent_storage() could return a storage pointer to a class that had inherited the parent program. Fix this by making sure that we get the storage for the program that we expect to find as parent.
Build: Use the recommended way to detect Nettle API differences. The main Nettle developers recommend using the function renaming macros to detect Nettle API differences. In this case we use <nettle/dsa.h>'s remapping of dsa_params_init to nettle_dsa_params_init to detect Nettle 3.0 or later.
Using the nettle_dsa_params_init as 3.0 indicator appears safer to me than a compat header file.
Nettle.DH_Params: Added C-code for Diffie-Hellman. Crypto.DH.DHParams now uses Nettle.DH_Params if available.
Nettle: Support the soon to be released Nettle 3.0. The DSA APIs have been changed in Nettle 3.0. This adds code to use the new API (as the compat API failed due to name conflits).
Address fallout from stronger random type.
Set Crypto.Random.random_string as default random generator for ECDSA.
Nettle: Specify a base name to precompile. The internal C-level symbols generated by precompile are now prefixed with "Nettle_" or "NETTLE_".
Fixed function signature for random_func_wrapper. This actually changes the calling conventions, and on stack based machines it could make a significant difference if size_t and unsigned int does not have the same bytesize.
Fix warnings.
ECDSA: Derive the public key when setting the private. This simplifies the API for the user.
Older versions of nettle (2.0) does not have the qbits argument to generate_dsa_keypair.
Crypto.Sign: Added base class for signature algorithms. Crypto.Sign is to contain the APIs common to Crypto.RSA, Crypto.DSA and Crypto.ECC.Curve.ECDSA.
Crypto.ECC: Added support for ECDSA. This adds support for ECDSA with an API similar to that for RSA and DSA.
Nettle: Fixed some Autodoc markup errors in hogweed.
Fixed warnings and a doc typo.
Crypto.ECC: Changed initialization of curves. This is to allow for extending the Crypto.ECC.Curve API with code written in Pike.
Nettle.ECC_Curve: size() now returns the exact size. Some protocols need greater precision than units of sizeof(mp_limb). A typical case is to implement fix-width encodings like FE2OSP() from IEEE 1363 (aka ANSI x9.62 4.3.3), where leading NULs may be significant (cf eg RFC 4492 5.10).
Bignums: Added API for pushing bignums directly. This simplifies code needing to handle bignums from external sources (eg hogweed).
Crypto.ECC: Added some Elliptic Curve Crypto support.
Nettle.ECC_Curve: Added point_mul(). The ECC APIs should now be sufficient to implement eg ECDH. Also improves robustness against uninitialized curves.
Nettle: Use the new push_bignum() API. Also improves forward compatibility by using the {rsa,dsa}_{private,public}_key_{init,clear} functions, instead of doing it by hand.
Nettle: All narrow strings should now be declared as such.
Nettle: Fixed some broken Autodoc markup. Also fixes an Autodoc typo in udp.c.
Throw exception instead of (incorrectly) returning 0.
Typos
Added support for Nettle RSA/DSA key generation to Nettle. Added code in Crypto.RSA to use it, but currently not active due to CPP strangenewss. Speeds up key generation by 75%.
Nettle.ECC_Curve: Improved documentation about point_mul(). Added note that point_mul() validates that the coordinate is valid for the curve.
Address some warnings.
Don't include gmp.h directly. Use bignum.h
Access bignum_program directly.
Nettle: compat with nettle < 2.7 the second argument of nettle_random_func was changed (along with many other parameters) to size_t. Use the compat type pike_nettle_size_t.
Nettle: moved rsa_unpad() to nettle.cmod rsa_unpad() does not actually depend on hogweed and is used without it. This fixes the Crypto module when compiled with old nettle versions (without hogweed).
Merge remote-tracking branch 'origin/8.0' into string_alloc
Merge branch '8.0' into gobject-introspection