summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* Use autodoc for SSL.ConnectiondocstringsAlex Chan2018-02-132-433/+123
|
* Use autodoc for the SSL.Context classAlex Chan2018-02-132-335/+119
|
* Use autodoc for OpenSSL.cryptoAlex Chan2018-02-132-115/+42
|
* open for 17.6.0 (#727)Paul Kehrer2017-12-012-1/+25
|
* 17.5.0 version bump (#726)17.5.0Paul Kehrer2017-11-302-2/+2
|
* Export keying material support (#725)Paul Kehrer2017-11-303-0/+48
| | | | | | | | | | | | | | * added method to export keying material from an ssl connection * updated tests to use bytestrings to avoid breaking python3 tests * added additional comments to test * simplify export_keying_material * add changelog * address review feedback
* fix a memory leak and a potential UAF and also #722 (#723)Paul Kehrer2017-11-306-11/+36
| | | | | | | | * fix a memory leak and a potential UAF and also #722 * sanity check * bump cryptography minimum version, add changelog
* Pin pytest until we drop 2.6 (#721)Hynek Schlawack2017-11-281-1/+3
|
* define __all__ to make wildcard import work (#719)Nicolas Karolak2017-11-262-0/+128
|
* reopen master (#718)Paul Kehrer2017-11-212-1/+27
|
* Require urllib3 tests to pass; fixes #712 (#716)Alex Gaynor2017-11-221-3/+0
|
* bump to 17.4.0 (#714)17.4.0Paul Kehrer2017-11-212-2/+2
|
* restore a subset of the rand module (#708)Paul Kehrer2017-11-203-0/+81
| | | | | | | | | | * restore a subset of the rand module * flake * remove cleanup, go ahead and assume status will always be 1 * lighten and add power
* Don't use things after they're freed...duh (#709)Alex Gaynor2017-11-203-15/+40
| | | | | | | | * Don't use things after they're freed...duh * changelog * more details
* fix errors with latest flake8 (#710)Alex Gaynor2017-11-204-11/+15
| | | | | | | | | | * fix errors with latest flake8 * Also fix the macOS builds * fix? * allow urllib3 to fail for now
* Improve documentation for passphrase callback (#703)Diego Fernandez2017-10-122-3/+4
| | | Address issue #701
* 17.4.0.dev0 bump (#694)Paul Kehrer2017-09-132-1/+25
|
* bump version and update changelog (#693)17.3.0Paul Kehrer2017-09-132-3/+6
| | | | | | | | * bump version and update changelog * add changelog entries for the memory leak fixes * backticks
* Avoid a double call to X509_STORE_CTX_init as it leaks memory (#691)Jeremy Cline2017-09-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an issue where each instance of ``X509StoreContext`` would leak a small amount of memory, but only if ``verify_certificate`` was called. The reason for this is that ``X509_STORE_CTX_init`` is called in ``X509StoreContext.__init__`` and at the start of ``X509StoreContext.verify_certificate``. According to the man page for ``X509_STORE_CTX_init``: "X509_STORE_CTX_init() sets up ctx for a subsequent verification operation. It must be called before each call to X509_verify_cert(), i.e. a ctx is only good for one call to X509_verify_cert(); if you want to verify a second certificate with the same ctx then you must call X509_STORE_CTX_cleanup() and then X509_STORE_CTX_init() again before the second call to X509_verify_cert()." Prior to this commit, the following script would cause a memory leak: ``` from OpenSSL.crypto import ( X509Store, X509StoreContext, load_certificate, FILETYPE_PEM) certificate = """ -----BEGIN CERTIFICATE----- MIIESTCCA7KgAwIBAgIBAzANBgkqhkiG9w0BAQUFADCBoDELMAkGA1UEBhMCVVMx CzAJBgNVBAgTAk5DMRAwDgYDVQQHEwdSYWxlaWdoMRcwFQYDVQQKEw5GZWRvcmEg UHJvamVjdDEPMA0GA1UECxMGZmVkbXNnMQ8wDQYDVQQDEwZmZWRtc2cxDzANBgNV BCkTBmZlZG1zZzEmMCQGCSqGSIb3DQEJARYXYWRtaW5AZmVkb3JhcHJvamVjdC5v cmcwHhcNMTIwNzE1MjExODUyWhcNMjIwNzEzMjExODUyWjCB2DELMAkGA1UEBhMC VVMxCzAJBgNVBAgTAk5DMRAwDgYDVQQHEwdSYWxlaWdoMRcwFQYDVQQKEw5GZWRv cmEgUHJvamVjdDEPMA0GA1UECxMGZmVkbXNnMSswKQYDVQQDEyJzaGVsbC1hcHAw MS5waHgyLmZlZG9yYXByb2plY3Qub3JnMSswKQYDVQQpEyJzaGVsbC1h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NVHRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4GBAN5r+1rbeTyGDdlelbqWOXBu uS0a9BfusO0uwf3tHK9zeB5CDKFgxdfSZ+Fxg1w2HFRHhCOYoZ2ASPfbyANTzxUF fVAId1uhBD1SlhXpTb3Ndo4uXfalf3W8MrQzFiVHbevvfsyd+RwoVT/PDokE3i4A fftCd0uwvSqVgyE28SFt -----END CERTIFICATE----- """ ca_cert = load_certificate(FILETYPE_PEM, ca_certificate) cert = load_certificate(FILETYPE_PEM, certificate) cert_store = X509Store() cert_store.add_cert(ca_cert) while True: cert_store_context = X509StoreContext(cert_store, cert) cert_store_context.verify_certificate() ``` Moving the creation of ``X509StoreContext`` outside the loop stops the memory leak. Signed-off-by: Jeremy Cline <jeremy@jcline.org>
* Provide a destructor for the CRL object (#690)Jeremy Cline2017-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This frees the memory allocated for the CRL object. Prior to this commit, the following script would leak memory: ``` from OpenSSL.crypto import load_crl, FILETYPE_PEM crl = """ -----BEGIN X509 CRL----- MIIBfDCB5jANBgkqhkiG9w0BAQsFADCBoDELMAkGA1UEBhMCVVMxCzAJBgNVBAgT Ak5DMRAwDgYDVQQHEwdSYWxlaWdoMRcwFQYDVQQKEw5GZWRvcmEgUHJvamVjdDEP MA0GA1UECxMGZmVkbXNnMQ8wDQYDVQQDEwZmZWRtc2cxDzANBgNVBCkTBmZlZG1z ZzEmMCQGCSqGSIb3DQEJARYXYWRtaW5AZmVkb3JhcHJvamVjdC5vcmcXDTE3MDYx NTIxMDMwOFoXDTM3MDYxMDIxMDMwOFowFDASAgECFw0xMjA3MTUyMTE4NTJaMA0G CSqGSIb3DQEBCwUAA4GBAGOBuDxmRFNcYP71LBsCOfFzKij00qpxM01d5/G6+0kM WJT8oTajMQoY6oISvQDq6TkwEoKc1yl6Ld1/XTtCNOhbybzRBAVf/Lxi/nRPP1JO qOdZs5jMLLQq1mRJz+MgKHHTDlnvpbjHMuyTss1RblFDr4iZPHMcBNKPGIj3pmpA -----END X509 CRL----- """ for _ in range(0, 1000000): load_crl(FILETYPE_PEM, crl) ``` Signed-off-by: Jeremy Cline <jeremy@jcline.org>
* Fix another test to not hardcode TLSv1 (#683)Alex Gaynor2017-08-071-1/+1
|
* Don't use "TLSv1" as a default for loopback clients/servers (#682)Alex Gaynor2017-08-071-2/+2
| | | | | | * Don't use "TLSv1" as a default for loopback clients/servers * We're sticklers for spelling
* Delete rand.py (#675)Alex Gaynor2017-07-254-343/+6
|
* Drop py33 (#677)Alex Gaynor2017-07-254-10/+3
|
* Simplify test code (#679)Alex Gaynor2017-07-251-50/+1
| | | | | | * Simplify test code * fix
* Mark this test as flaky (#678)Alex Gaynor2017-07-241-0/+1
|
* Fixes #655 -- deprecate OpenSSL.tsafe (#673)Alex Gaynor2017-07-222-2/+9
| | | | | | * Fixes #655 -- deprecate OpenSSL.tsafe * changelog
* Start new release cycle (#672)Hynek Schlawack2017-07-202-1/+26
|
* Prepare 17.2.0 (#671)17.2.0Hynek Schlawack2017-07-202-2/+2
| | | | | | * Fix version * Prepare 17.2.0
* (EC)DSA signature fix (#670)Paul Kehrer2017-07-203-3/+47
| | | | | | | | | | | | | * Write a test - signatures with EC keys (#609) * Ask for signature length before allocating a buffer. This fixes a potential heap buffer overflow that may happen when a signature is longer than the private key, as with X9.62 ECDSA (#609). * change approach to EVP_PKEY_size and add changelog * add a small assert
* Bend some recent changes to standards (#669)Hynek Schlawack2017-07-205-21/+14
|
* document set_default_verify_paths caveats (#667)Paul Kehrer2017-07-191-2/+9
| | | | | | | | | | * document set_default_verify_paths caveats fixes #642 * add a bit more detail * weasel words
* add note about cryptography to crypto module (#666)Paul Kehrer2017-07-191-0/+10
| | | fixes #663
* fix #664 (#665)Paul Kehrer2017-07-192-2/+8
| | | | | | | | | | | | * fix #664 bytes and strings are different things. * update changelog * let's just make the sentinel values byte strings * flake8
* 101 doesn't work, just mark it flaky (#662)Alex Gaynor2017-07-061-1/+2
|
* move deps to extras (#661)Paul Kehrer2017-07-074-7/+16
| | | | | | * move deps to extras * this file is gone
* FIxed #266 -- attempt to deflake our tests (#660)Alex Gaynor2017-07-062-1/+7
| | | | | | * FIxed #266 -- attempt to deflake our tests * typo
* Fixed #657 -- handle OverflowErrors on large allocation requests (#659)Alex Gaynor2017-07-061-4/+4
| | | | | | * Fixed #657 -- handle OverflowErrors on large allocation requests * always be overflowing
* Fixed #631 -- deprecate all of OpenSSL.rand (#658)Alex Gaynor2017-07-064-43/+9
| | | | | | | | * Fixed #631 -- deprecate all of OpenSSL.rand * syntax fix * flake8
* Start new release cycle (#654)Hynek Schlawack2017-06-302-1/+26
|
* Prepare 17.1 (#653)17.1.0Hynek Schlawack2017-06-302-3/+3
| | | | | | * Prepare 17.1.0 * Fix changelog markup
* Removed the deprecated md5 default on CRL.export() (#652)Alex Gaynor2017-06-303-26/+22
| | | | | | | | | | | | | | * Removed the deprecated md5 default on CRL.export() * Doh * unused import * fixed tests * last one * py3k!!!!!
* Bend CHANGELOG.rst to our shape (#651)Hynek Schlawack2017-06-301-9/+13
| | | Add semantic newlines and parens that make functions and methods more obvious.
* Kill some commented out code and other cleanups (#649)Alex Gaynor2017-06-302-26/+5
|
* remove gibberish comment (#648)Alex Gaynor2017-06-301-2/+0
|
* Kill dead code (#647)Alex Gaynor2017-06-292-11/+5
| | | | | | | | | | * Simplify code * dead code * unused... * write imports normally
* Fixed #461 -- make the tests pass when SSLv3 isn't supported (#644)Alex Gaynor2017-06-291-3/+5
| | | | | | | | | | | | | | * Fixed #461 -- make the tests pass when SSLv3 isn't supported We no longer support OpenSSL 1.0.0, so TLSv1.2 should always be available and this code can be simplified. * Try the opposite direction? * Another shot at getting this passing * uhhh * grump
* try loading trusted certs from a list of fallbacks (#633)Paul Kehrer2017-06-294-1/+168
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * try loading trusted certs from a list of fallbacks pyca/cryptography will shortly begin shipping a wheel. Since SSL_CTX_set_default_verify_paths uses a hardcoded path compiled into the library, this will start failing to load the proper certificates for users on many linux distributions. To avoid this we can use the Go solution of iterating over a list of potential candidates and loading it when found. * capath is lazy loaded so we need to do a lot more checks This now checks to see if env vars are set as well as seeing if the dir exists and has valid certs in it. If either of those are true (or the number of certs is > 0) it won't load the fallback. If it does do the fallback it will also attempt to load certs from a dir as a final fallback * remove an early return * this shouldn't be commented out * oops * very limited testing * sigh, can't use these py3 exceptions of course * expand the tests a bit * coverage! * don't need this now * change the approach to use a pyca/cryptography guard value * test fix * older python sometimes calls itself linux2 * flake8 * add changelog * coverage * slash opt
* dump_privatekey with FILETYPE_TEXT only supports RSA keys (#646)Paul Kehrer2017-06-292-0/+20
| | | | | | | | * dump_privatekey with FILETYPE_TEXT only supports RSA keys FILETYPE_TEXT is terrible but everyone hold their nose * also verify it's a pkey
* add to_cryptography/from_cryptography on CRL and X509Req (#645)Paul Kehrer2017-06-293-0/+99
| | | | | | * add to_cryptography/from_cryptography on CRL and X509Req * add changelog entry