Go to file
Johannes Schindelin 70f1db321a
vtls: encapsulate SSL backend-specific data
So far, all of the SSL backends' private data has been declared as
part of the ssl_connect_data struct, in one big #if .. #elif .. #endif
block.

This can only work as long as the SSL backend is a compile-time option,
something we want to change in the next commits.

Therefore, let's encapsulate the exact data needed by each SSL backend
into a private struct, and let's avoid bleeding any SSL backend-specific
information into urldata.h. This is also necessary to allow multiple SSL
backends to be compiled in at the same time, as e.g. OpenSSL's and
CyaSSL's headers cannot be included in the same .c file.

To avoid too many malloc() calls, we simply append the private structs
to the connectdata struct in allocate_conn().

This requires us to take extra care of alignment issues: struct fields
often need to be aligned on certain boundaries e.g. 32-bit values need to
be stored at addresses that divide evenly by 4 (= 32 bit / 8
bit-per-byte).

We do that by assuming that no SSL backend's private data contains any
fields that need to be aligned on boundaries larger than `long long`
(typically 64-bit) would need. Under this assumption, we simply add a
dummy field of type `long long` to the `struct connectdata` struct. This
field will never be accessed but acts as a placeholder for the four
instances of ssl_backend_data instead. the size of each ssl_backend_data
struct is stored in the SSL backend-specific metadata, to allow
allocate_conn() to know how much extra space to allocate, and how to
initialize the ssl[sockindex]->backend and proxy_ssl[sockindex]->backend
pointers.

This would appear to be a little complicated at first, but is really
necessary to encapsulate the private data of each SSL backend correctly.
And we need to encapsulate thusly if we ever want to allow selecting
CyaSSL and OpenSSL at runtime, as their headers cannot be included within
the same .c file (there are just too many conflicting definitions and
declarations for that).

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2017-08-28 14:56:58 +02:00
.github ISSUE_TEMPLATE: Add a comment not to file security issues on github 2017-07-11 11:48:37 -04:00
CMake cmake: move cmake_uninstall.cmake to CMake/ 2017-08-10 15:05:49 +02:00
docs examples/threaded-ssl: mention that this is for openssl before 1.1 2017-08-25 08:15:59 +02:00
include system.h: include sys/poll.h for AIX 2017-08-27 19:04:45 +02:00
lib vtls: encapsulate SSL backend-specific data 2017-08-28 14:56:58 +02:00
m4 m4/curl-compilers.m4: use proper quotes around string, not backticks 2017-08-16 00:05:11 +02:00
packages ssh: add the ability to enable compression (for SCP/SFTP) 2017-08-17 03:32:00 -04:00
projects build: check out *.sln files with Windows line endings 2017-08-10 09:11:46 +02:00
scripts scripts/contri*sh: use "git log --use-mailmap" 2017-08-18 22:41:48 +02:00
src curl: shorten and clean up CA cert verification error message 2017-08-22 23:32:43 +02:00
tests tests: Make sure libtests & unittests call curl_global_cleanup() 2017-08-26 22:01:42 +02:00
winbuild winbuild: fix embedded manifest option 2017-08-26 02:33:01 -04:00
.dir-locals.el Add .dir-locals and set c-basic-offset to 2. 2015-12-23 10:16:14 +01:00
.gitattributes .gitattributes: force shell scripts to LF 2017-04-17 08:32:13 +02:00
.gitignore gitignore: ignore .xz now instead of .lzma 2017-08-13 18:11:44 +02:00
.mailmap mailmap: de-duplify some git authors 2017-08-18 17:49:20 +02:00
.travis.yml travis: add metalink to some osx builds 2017-08-16 13:31:13 +02:00
CHANGES CHANGES: spell fix, use correct path to script 2017-02-07 08:22:37 +01:00
CMakeLists.txt cmake: enable picky compiler options with clang and gcc 2017-08-20 23:32:32 +02:00
COPYING COPYING: update the generic copyright year range 2017-01-07 20:25:43 +01:00
GIT-INFO CHANGES.0: removed 2017-02-07 08:20:10 +01:00
MacOSX-Framework includes: remove curl/curlbuild.h and curl/curlrules.h 2017-06-14 11:07:33 +02:00
Makefile.am cmake: move cmake_uninstall.cmake to CMake/ 2017-08-10 15:05:49 +02:00
Makefile.dist VC: remove the makefile.vc6 build infra 2017-01-23 14:27:32 +01:00
README URLs: follow GitHub project rename (also Travis CI) 2016-02-04 23:01:38 +01:00
README.md README.md: show the coverall coverage on github 2017-06-06 14:40:57 +02:00
RELEASE-NOTES RELEASE-NOTES: synced with 8baead425 2017-08-18 23:30:40 +02:00
acinclude.m4 CURL_SIZEOF_LONG: removed, use only SIZEOF_LONG 2017-08-17 10:27:00 +02:00
appveyor.yml AppVeyor: now really use CURL_WERROR 2017-07-29 18:47:18 +02:00
buildconf includes: remove curl/curlbuild.h and curl/curlrules.h 2017-06-14 11:07:33 +02:00
buildconf.bat includes: remove curl/curlbuild.h and curl/curlrules.h 2017-06-14 11:07:33 +02:00
configure.ac CURL_SIZEOF_LONG: removed, use only SIZEOF_LONG 2017-08-17 10:27:00 +02:00
curl-config.in URLs: change all http:// URLs to https:// 2016-02-03 00:19:02 +01:00
libcurl.pc.in URLs: change all http:// URLs to https:// 2016-02-03 00:19:02 +01:00
maketgz maketgz: remove old *.dist files before making the tarball 2017-08-10 22:56:49 +02:00

README.md

curl logo CII Best Practices Coverity passed Build Status Coverage Status

Curl is a command-line tool for transferring data specified with URL syntax. Find out how to use curl by reading the curl.1 man page or the MANUAL document. Find out how to install Curl by reading the INSTALL document.

libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl.3 man page to learn how!

You find answers to the most frequent questions we get in the FAQ document.

Study the COPYING file for distribution terms and similar. If you distribute curl binaries or other binaries that involve libcurl, you might enjoy the LICENSE-MIXING document.

Contact

If you have problems, questions, ideas or suggestions, please contact us by posting to a suitable mailing list.

All contributors to the project are listed in the THANKS document.

Website

Visit the curl web site for the latest news and downloads.

Git

To download the very latest source off the Git server do this:

git clone https://github.com/curl/curl.git

(you'll get a directory named curl created, filled with the source code)

Notice

Curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.