aboutsummaryrefslogtreecommitdiffstats
path: root/tests/hazmat/backends
Commit message (Collapse)AuthorAgeFilesLines
* fix coverage, small cleanups in tests (#4990)Paul Kehrer2019-09-091-0/+10
|
* we don't have these mac builders any more (#4892)Paul Kehrer2019-05-251-7/+1
| | | | | | | | | | * we don't have these mac builders any more let's see if we get coverage from azure like we should! * remove a branch we can't cover in tests * remove unused import
* fix aia encoding memory leak (#4889)Paul Kehrer2019-05-181-0/+60
| | | | | | * fix aia encoding memory leak * don't return anything from the prealloc func
* fix a memory leak in AIA parsing (#4836)Paul Kehrer2019-04-111-1/+20
| | | | | | * fix a memory leak in AIA parsing * oops can't remove that
* reduce our engine bindings even more (#4768)Paul Kehrer2019-02-251-0/+19
|
* support NO_ENGINE (#4763)Paul Kehrer2019-02-251-0/+3
| | | | | | | | * support OPENSSL_NO_ENGINE * support some new openssl config args * sigh
* why did we have these variables (#4764)Paul Kehrer2019-02-241-7/+7
|
* Simplify string formatting (#4757)Alex Gaynor2019-02-201-1/+1
|
* encode IssuingDistributionPoint (#4618)Paul Kehrer2018-12-021-0/+45
|
* PKCS12 Basic Parsing (#4553)Paul Kehrer2018-11-281-0/+18
| | | | | | | | | | | | | | | | | | * PKCS12 parsing support * running all the tests is so gauche * rename func * various significant fixes * dangerous idiot here * move pkcs12 * docs updates * a bit more prose
* support extensions in the OCSP request builder (#4481)Paul Kehrer2018-10-061-0/+21
| | | | | | | | | | * support extensions in the OCSP request builder * cover a missed branch * refactor to use new func * review feedback
* Fixed two memory leaks in x509 csr extensions (#4434)Alex Gaynor2018-08-311-3/+56
| | | | | | | | | | | | * Fixed a memory leak in x.509 OCSP no check * Fix the _actual_ leak * Speed up symbolizations * Disable backtrace by default, because it doesn't work on Windows * line length
* remove freebsd11 builder (#4401)Paul Kehrer2018-08-151-2/+0
| | | | | | | | | | | | * remove freebsd11 builder it's out of date, we can't update it, and it is unreliable * we don't test against freebsd for now * what did case sensitivity ever do for me * don't assert on bsd since we don't test on for now
* Fixed #4380 -- do not assume TLSv1 is available in OpenSSL (#4389)Alex Gaynor2018-08-121-1/+1
| | | | | | | | * Fixed #4380 -- do not assume TLSv1 is available in OpenSSL Hallelujah! It's starting to become the case that some OpenSSLs are disabling it. * cover this file as well
* fix a memory leak when calling X25519PrivateKey.public_key() (#4326)Paul Kehrer2018-07-101-0/+8
|
* Perform an OPENSSL_cleanup before checking the heap in our memleak tests (#4293)Alex Gaynor2018-06-201-0/+3
| | | | | | | | | | * Perform an OPENSSL_cleanup before checking the heap in our memleak tests * Make this binding conditional * typo * need to put this call before we reset the function ptrs
* fix a memory leak in ec derive_private_key (#4096)Paul Kehrer2018-02-041-0/+8
| | | | | | | | * fix a memory leak in ec derive_private_key fixes #4095 * pep8!
* Expose `BN_clear_free` in the OpenSSL backend (#4071)Tux2018-01-051-1/+1
| | | | | | * Expose BN_clear_free * Use BN_clear_free in test_int_to_bn
* Fixed #4058 -- use the thread-safe API from OpenSSL, not the danger one (#4059)Alex Gaynor2017-12-181-3/+3
|
* Inline calls to bit_length now that it's trivial (#3966)Alex Gaynor2017-10-121-3/+3
| | | | | | | | * Inline calls to bit_length now that it's trivial * unused imports * An comment
* RSA OAEP label support for OpenSSL 1.0.2+ (#3897)Paul Kehrer2017-09-081-12/+0
| | | | | | | | | | * RSA OAEP label support for OpenSSL 1.0.2+ * changelog * move around tests, address review feedback, use backend supported method * unsupported padding catches this now
* move x509 tests into a module (#3889)Paul Kehrer2017-09-061-1/+1
| | | | | | | | | | | * move x509 tests into a module This is just to make grouping things like test_ocsp, etc a bit simpler in the future * fix path * pep8
* remove deprecated items (#3794)Paul Kehrer2017-07-201-33/+3
| | | | | | | | | | * remove deprecated items whirlpool, ripemd160, unsupportedextension, and the old interfaces * flake8 and remove a test generator we no longe use * make it clear we warned you about these things
* Fixed a memory leak in EC private numbers (#3741)Alex Gaynor2017-06-301-10/+16
|
* Fix for leaking memory in EllipticCurvePublicNumbers.public_key() (#3732)Alex Gaynor2017-06-281-0/+19
| | | | | | | | | | * Test for leaking memory in EllipticCurvePublicNumbers.public_key() * Fix the memory leak As far as I can tell, from spelunking in the OpenSSL source (as you do), EC_KEY_set_public_key_affine_coordinates doesn't take ownership of "x" or "y". https://github.com/openssl/openssl/blob/master/crypto/ec/ecp_smpl.c#L362-L420 is the place in the source I found that actually uses "x" and "y". * Unused imports
* Dh parameters serialization (#3504)Aviv Palivoda2017-06-241-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support DH parameter serizalization - no X9.42 * Support X9.42 serialization - DER not working * Fix dhp_rfc5114_2.der Changing the DER parameters serialization after the fix in openssl commit a292c9f1b835 * DH parameters X9.42 DER serialization fixed * fix _skip_dhx_unsupported * document DH parameter_bytes * PEP8 fixes * Document load_pem_parameters * Document load_der_parameters * document ParameterFormat * Increase test coverage * Increase test covrage * Remove unneeded check * Fix typo * Fix error in load_der_parameters * Add load_pem_parameters and load_der_parameters to interfaces * CR fixes * Removed unverified phrase * Update version to 2.0 * Fix pep8 * Rename ParameterFormat.ASN1 to ParameterFormat.DHParameter * link pkcs3 * Add new line at end of file to serialization.rst * Rename DHparameters to PKCS3 * doc CR fix
* fix libressl error/refactor some error handling (#3609)Paul Kehrer2017-05-261-4/+1
| | | | | | | | | | | | | | | | | | | | | | | * add libre so I can see the error * add the libre error needed and refactor error handling a bit We were historically matching on lib + func + reason, but func is somewhat unstable so now we match on lib + reason only. Of course, in this case libressl changed both lib and reason so it wouldn't have mattered. All error handling from the error queue in openssl is an illusion * fix a typo, probably an unneeded branch * review feedback * refactor tests to support libressl insert additional rant about libre here, although admittedly these tests were assuming stability where openssl itself guarantees none * better assert, fix flake8
* Close stdout and stderr when spawning a process (#3578)Alex Gaynor2017-05-231-9/+13
|
* remove multibackend (#3555)Paul Kehrer2017-05-201-654/+0
| | | | | | | | * remove multibackend * oops * goodbye pointless tests
* time to remove commoncrypto, fare thee well (#3551)Paul Kehrer2017-05-202-71/+0
| | | | | | | | | | | | | | | | * time to remove commoncrypto, fare thee well * remove even more * update the changelog * remove more things * don't need this function * remove CAST5 CTR tests since that was only supported in commoncrypto * assert a thing
* Attempt to simplify the libressl checing (#3482)Alex Gaynor2017-03-261-4/+1
| | | | | | | | | | * Attempt to simplify the libressl checing * SHENANGINS * Attempted fix * More simplification
* Write a memory leak test for X.509 extensions (#3451)Alex Gaynor2017-03-161-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Bind a pair of mem functions. * do the conditional correctly * move to the right section * Get the code basically working * flake8 * say the correct incantation * WOrkaround for hilarity * Revert "WOrkaround for hilarity" This reverts commit 37b9f3b4ed4063eef5add3bb5d5dd592a007d439. * Swap out these functions for the originals * nonsense for windows * try writing this all out for windows * Debugging utility * Avoid this mess, don't dlopen anything * Throw away this FFI entirely * first pass at some x.509 memleak tests * TODO and fix * Get the tests to passing * String formatting is nasty * some fixes because rebasing * fix for the name API, always use the OpenSSL backend
* Improvements to the memleak tests (#3457)Alex Gaynor2017-03-151-10/+15
| | | | | | | | | * Improvements to the memleak tests * Support passing args * Do more initialization before looking for at the heap * Don't use default_backend for something OpenSSL specific
* Ec is a thing (#3453)Alex Gaynor2017-03-151-23/+1
| | | | | | | | | | | | | | | | * We always have EC * We always have ECDH * We always have ECDSA * We always have EC codes * This can go as well * And this * unused import
* Memleak tests (#3140)Alex Gaynor2017-03-141-0/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Bind a pair of mem functions. * make these conditional * do the conditional correctly * move to the right section * I'm not saying libressl should be illegal, but it is annoying * sigh, typo * first cut at memleak tests. doesn't work * hack around the previous error, onto the next one * drop the pointless restoration of the original functions * Don't try to use the previous malloc functions. The default malloc is CRYPTO_malloc which calls the custom ptr you provided, so it just recurses forever. * flake8 * Get the code basically working * flake8 * say the correct incantation * Don't try to run on old OpenSSL * Flushing this is a good idea * Fixed a py2.7+ism * GRRRRR * WOrkaround for hilarity * Revert "WOrkaround for hilarity" This reverts commit 37b9f3b4ed4063eef5add3bb5d5dd592a007d439. * Swap out these functions for the originals * py3k fix * flake8 * nonsense for windows * py3k * seperate stdout and stderr because py26 has a warning on stderr * try writing this all out for windows * useful error messages * Debugging utility * Avoid this mess, don't dlopen anything * consistency * Throw away this FFI entirely * some useful comments
* reverts a change to our exceptions (#3429)Paul Kehrer2017-03-091-5/+3
| | | | | Trying to be too specific about why key loading fails is very difficult when you're using the same logic across DH, EC, RSA, and DSA. This makes it less fancy.
* missing coverage for dh_x942_serialization_supported in MultiBackend (#3432)Paul Kehrer2017-03-081-0/+1
|
* DH subgroup order (q) (#3369)Aviv Palivoda2017-03-052-4/+86
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support DH q (subgroup order) * Change RFC5114.txt to NIST format * Add tests for DH q * Update docs for DH q * Fix pep8 * Improve test covergae for DH q * Create _dh_params_dup that copy q if DHparams_dup don't On OpenSSL < 1.0.2 DHparams_dup don't copy q. _dh_params_dup call DHparams_dup and if the version is smaller than 1.0.2 copy q manually * Copy q manually on libressl * Add to test vectors serialized RFC5114 2048 bit DH parameters with 224 bit subgroup * Support serialization of DH with q * Add tests for serialization of DH with q * Support DH serialization with q only if Cryptography_HAS_EVP_PKEY_DHX is true * Raise exception when trying to serialize DH X9.42 when not supported * raise unsupported key type when deserilizing DH X9.42 if not supported * pep8 fixes * Fix test_serialization * Add dhx_serialization_supported method to DHBacked * document q in dh_parameters_supported * Rename dhx_serialization_supported to dh_x942_serialization_supported
* switch the PEM password callback to a C implementation (#3382)Paul Kehrer2017-02-131-15/+24
| | | | | | | | | | | | | | | * switch the PEM password callback to a C implementation Calling from C to Python is fraught with edge cases, especially in subinterpreter land. This commit moves the PEM password callback logic into a small C function and then removes all the infrastructure for the cffi callbacks (as we no longer have any) * review feedback and update tests * rename the struct * aaand one more fix
* enforce password must be bytes when loading PEM/DER asymmetric keys (#3383)Paul Kehrer2017-02-081-1/+1
| | | | | | | | | | * enforce password must be bytes when loading PEM/DER asymmetric keys Previously we were using an ffi.buffer on the Python string, which was allowing text implicitly, but our documentation explicitly requires bytes. * add changelog entry
* add openssl_version_number & doc openssl_version_text (#3329)Paul Kehrer2016-12-211-0/+3
| | | | | | | | | | * add openssl_version_number & doc openssl_version_text fixes #3315 * more docs + actually assert on the test... * text
* Drop 1.0.0 (#3312)Alex Gaynor2016-12-131-151/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * delete the 1.0.0 support * drop the version check * drop the AES-CTR stuff * Update the example * openssl truncates for us now * delete unused test * unused imports * Remove a bunch of conditional bindings for NPN * no more 1.0.0 builders * libressl fix * update the docs * remove dead branches * oops * this is a word, damnit * spelling * try removing this * this test is not needed * unused import
* New osrandom_engine in C (#3229)Christian Heimes2016-12-091-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * New osrandom_engine in C Inspired by Python/random.c and the old implementation. Signed-off-by: Christian Heimes <christian@python.org> * osrandom_engine * Fix naming bug caused by search 'n replace mistake * Make it easier to override osrandom auto-detection * Add engine ctrl and backend API to get implementation from ENGINE Signed-off-by: Christian Heimes <christian@python.org> * Better test coverage, documentation, LICENSE Signed-off-by: Christian Heimes <christian@python.org> * Coverage is hard. Signed-off-by: Christian Heimes <christian@python.org> * * enable win32 check * read() returns size_t Signed-off-by: Christian Heimes <christian@python.org> * Add macOS to spelling list. Remove dead code from header file. Signed-off-by: Christian Heimes <christian@python.org> * remove CCRandomGenerateBytes path and update getentropy to work on macOS This change allows us to test all the engines in our CI: * getentropy (tested by macOS sierra) * getrandom (tested on several linux builders) * /dev/urandom (tested on FreeBSD, OS X 10.11 and below, & older linux) * CryptGenRandom (tested on windows builders) I also fixed bugs preventing compilation in the getentropy code * getentropy() returns int and is restricted to 256 bytes on macOS, too. Signed-off-by: Christian Heimes <christian@python.org> * add versionadded * Re-add import of os module * Fixes related to Alex's recent review. Signed-off-by: Christian Heimes <christian@python.org> * Add error reporting and fail for EAGAIN Add error reporting strings for various error cases. This gives us much nicer and understandable error messages. SYS_getrandom() EAGAIN is now an error. Cryptography refuses to initialize its osrandom engine when the Kernel's CPRNG hasn't been seeded yet. Signed-off-by: Christian Heimes <christian@python.org>
* OpenSSL DH backend implementation [Second attempt] (#2914)Aviv Palivoda2016-11-261-3/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Start of OpenSSL DH backend implementation * Supporting DH in MultiBackend * DHBackend has dh_parameters_supported method * Removed DHParametersWithNumbers and DHPrivateKeyWithNumbers from documentation * Removed ExchangeContext. exchange is a method of DHPrivateKeyWithSerialization * PEP8 fixes * Fixed TestDH.test_bad_tls_exchange * Fixed generate_private_key reference in dh documentation * test DH multibackend support * testing DH coversion to serialized * Validating that we receive serialized class in test_generate_dh * Testing DH exchange symmetric key padding * struct DH is now opaqued * PEP8 fixes * Testing load_dh_private_numbers throws ValueError when DH_check fails * Using openssl_assert * Passing keywords arguments in DH key exchange example * test_dh::test_bad_tls_exchange now uses pre calculated parameters * TestDH - Add test that the computed secret is equivalent to the definition by comparing with secret computed in pure python * Add missing generator parameter to DHBackend interface docs. * Include parameter type in DHBackend abc docs. * Add docs for dh.generate_parameters function * Remove the dh Numbers section, and move the DHNumbers class docs to where they are first used. * Add note of big endian byte packing to DH exchange method. * DH documentation updates. Add single sentence overview with wikipedia link. Add paragraph on assembling using Numbers objects. Add link to backend interface docs. First section was all indented, I think by mistake. * Add exchange method to DHPrivateKey abstract base class. * Small tweaks to DH documentation - remove Provider. * Add endian to dictionary * Use utils.int_from_bytes in test_tls_exchange_algorithm * Removed duplicate line * Change dh.rst exchange algorithm from doctest to code-block The example in the Diffie-Hellman exhange algorithm is using 2048 bits key. Generating the parameters of 2048 takes long time. This caused the automated tests to fail. In order to pass the tests we change the example to code-block so it will not run in the doc tests. * Fix dh docs * Document the generator in DHBackend relevant methods * Fix dh tests * use DHparams_dup * Fix key type to unsigned char as expected by DH_compute_key * Validate that DH generator is 2 or 5 * test dh exchange using botan vectors * group all numbers classes * Simplify _DHPrivateKey * Rename test with serialized to numbers * Move bad exchange params to external vector file * update exchange versionadded to 1.7 * Make key_size bit accurate * Change botan link * Added CHANGELOG entry
* change derive_elliptic_curve_public_point to return EllipticCurvePubl… (#3243)Paul Kehrer2016-11-181-3/+3
| | | | | | | | | | | | | | * change derive_elliptic_curve_public_point to return EllipticCurvePublicKey * also rename the backend interface method * review feedback * Rename to derive_elliptic_curve_private_key * Returns EllipticCurvePrivateKey * Reuses the EC_POINT in the openssl impl * Rename "secret" arg to "private_value" which is consistent with our naming for the value in ECPrivateNumbers.
* workaround for application bundling tools (#3235)Paul Kehrer2016-11-141-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | * cx_freeze support for default_backend * updated tabing to spaces * corrected spacing * moved finding backend to backends __init__ * update to check to see if sys is frozen * corrected pep8 issues * update based on comments * changes to simplify, support testing, and improve comments * add changelog entry * right, coverage. I remember now. Time for some contortions. * updated with review feedback
* Add a bytes method to get the DER ASN.1 encoding of an X509 name. (#3236)Paul Kehrer2016-11-131-0/+6
| | | | | | | | | | * Add a bytes method to get the DER ASN.1 encoding of an X509 name. This is useful for creating an OpenSSL style subject_name_hash (#3011) * add to backend interface and update multibackend * bytes -> public_bytes
* add ec.private_key_from_secret_and_curve (#3225)Ofek Lev2016-11-111-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * finish https://github.com/pyca/cryptography/pull/1973 * change API & add test Function will now return an instance of EllipticCurvePrivateKey, as that is the users' ultimate goal anyway. * fix test * improve coverage * complete coverage * final fix * centos fix * retry * cleanup asserts * use openssl_assert * skip unsupported platforms * change API name to derive_private_key * change version added * improve description of `secret` param * separate successful and failure test cases * simplify successful case * add docs for derive_elliptic_curve_public_point * add period
* 1.0.2i changed the way COMP_METHOD is exported if NO_COMP is set (#3162)Paul Kehrer2016-09-221-1/+1
| | | | | | | | | | * 1.0.2i changed the way COMP_METHOD is exported if NO_COMP is set * add a comment explaining why we changed this * 1.0.2i handles NUMERICSTRING properly now so need only test < 1.0.2i * needs to be visible
* fix warnings in cffi 1.8.3 due to wrong buffer types (#3155)Paul Kehrer2016-09-211-2/+2
|