Changes In Branch crypto Through [5a41ff9aa1] Excluding Merge-Ins
This is equivalent to a diff from 5a33efb87b to 5a41ff9aa1
2024-02-11
| ||
20:51 | Merged changes from master. check-in: 45be9618dc user: bohagan tags: crypto | |
2024-02-06
| ||
02:42 | Added provider test cases check-in: 5a41ff9aa1 user: bohagan tags: crypto | |
2024-02-05
| ||
01:37 | Added provider command to load non-default providers in OpenSSL 3.0 check-in: b6001442d1 user: bohagan tags: crypto | |
00:55 | Code updates for gcc warnings check-in: 7e672606f5 user: bohagan tags: trunk | |
2024-02-04
| ||
03:31 | Merged changes from master branch check-in: fa17431520 user: bohagan tags: crypto | |
02:58 | Added code to handle unexpected EOF on OpenSSL 3 check-in: 5a33efb87b user: bohagan tags: trunk | |
2024-02-03
| ||
03:15 | Added more IO logging and error callback messages. Removed duplicate messages. check-in: a3728bd654 user: bohagan tags: trunk | |
Modified configure
from [3a830b9e57]
to [db3c76f46d].
︙ | ︙ | |||
5383 5384 5385 5386 5387 5388 5389 | # stub library C source files to compile in TEA_ADD_STUB_SOURCES, # and runtime Tcl library files in TEA_ADD_TCL_SOURCES. # This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS # and PKG_TCL_SOURCES. #----------------------------------------------------------------------- | | | 5383 5384 5385 5386 5387 5388 5389 5390 5391 5392 5393 5394 5395 5396 5397 | # stub library C source files to compile in TEA_ADD_STUB_SOURCES, # and runtime Tcl library files in TEA_ADD_TCL_SOURCES. # This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS # and PKG_TCL_SOURCES. #----------------------------------------------------------------------- vars="tls.c tlsBIO.c tlsDigest.c tlsEncrypt.c tlsInfo.c tlsIO.c tlsKDF.c tlsRand.c tlsUtil.c tlsX509.c" for i in $vars; do case $i in \$*) # allow $-var names PKG_SOURCES="$PKG_SOURCES $i" PKG_OBJECTS="$PKG_OBJECTS $i" ;; |
︙ | ︙ |
Modified configure.ac
from [d5f3ebd9b3]
to [1108be8f97].
︙ | ︙ | |||
67 68 69 70 71 72 73 | # public headers that need to be installed in TEA_ADD_HEADERS, # stub library C source files to compile in TEA_ADD_STUB_SOURCES, # and runtime Tcl library files in TEA_ADD_TCL_SOURCES. # This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS # and PKG_TCL_SOURCES. #----------------------------------------------------------------------- | | | 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # public headers that need to be installed in TEA_ADD_HEADERS, # stub library C source files to compile in TEA_ADD_STUB_SOURCES, # and runtime Tcl library files in TEA_ADD_TCL_SOURCES. # This defines PKG(_STUB)_SOURCES, PKG(_STUB)_OBJECTS, PKG_HEADERS # and PKG_TCL_SOURCES. #----------------------------------------------------------------------- TEA_ADD_SOURCES([tls.c tlsBIO.c tlsDigest.c tlsEncrypt.c tlsInfo.c tlsIO.c tlsKDF.c tlsRand.c tlsUtil.c tlsX509.c]) TEA_ADD_HEADERS([generic/tls.h]) TEA_ADD_INCLUDES([]) TEA_ADD_LIBS([]) TEA_ADD_CFLAGS([]) TEA_ADD_STUB_SOURCES([]) TEA_ADD_TCL_SOURCES([library/tls.tcl]) |
︙ | ︙ |
Added doc/cryptography.html version [c0f7bb9ac4].
Added doc/docs.css version [0ab4787813].
Modified doc/tls.html
from [ec5645fd47]
to [12b4e9e9d7].
|
| < < | | | > > | > | > | | | | < | | | < | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <meta name="Copyright" content="1999 Matt Newman / 2004 Starfish Systems"> <title>TLS (SSL) TCL Commands</title> <link rel="stylesheet" href="docs.css" type="text/css" media="all"> </head> <body class="vsc-initialized"> <h2>Tcl Tls Extension Documentation</h2> <dl> <dd><a href="#NAME">NAME</a> <dl> <dd><b>tls</b> - binding to <b>OpenSSL</b> library for socket and I/O channel communications.</dd> </dl> </dd> <dd><a href="#SYNOPSIS">SYNOPSIS</a> </dd> <dd><dl> <dd><b>package require Tcl</b> <em>?8.5?</em></dd> <dd><b>package require tls</b></dd> <dt> </dt> <dd><b>tls::init</b> <em>?options?</em> </dd> <dd><b>tls::socket</b> <em>?options? host port</em></dd> <dd><b>tls::socket</b> <em>?-server command? ?options? port</em></dd> <dd><b>tls::handshake</b> <em> channel</em></dd> <dd><b>tls::status</b> <em>?-local? channel</em></dd> <dd><b>tls::connection</b> <em>channel</em></dd> <dd><b>tls::import</b> <em>channel ?options?</em></dd> <dd><b>tls::unimport</b> <em>channel</em></dd> <dt> </dt> <dd><b>tls::protocols</b></dd> <dd><b>tls::version</b></dd> </dl> </dd> <dd><a href="#COMMANDS">COMMANDS</a></dd> <dd><a href="#CALLBACK OPTIONS">CALLBACK OPTIONS</a></dd> <dd><a href="#HTTPS EXAMPLE">HTTPS EXAMPLE</a></dd> <dd><a href="#SEE ALSO">SPECIAL CONSIDERATIONS</a></dd> <dd><a href="#SEE ALSO">SEE ALSO</a></dd> </dl> <hr> <h3><a name="NAME">NAME</a></h3> <p><strong>tls</strong> - binding to <strong>OpenSSL</strong> library for socket and I/O channel communications.</p> <h3><a name="SYNOPSIS">SYNOPSIS</a></h3> <p><b>package require Tcl 8.5</b><br> <b>package require tls</b><br> <br> <a href="#tls::init"><b>tls::init</b> <i>?options?</i></a><br> <a href="#tls::socket"><b>tls::socket</b> <i>?options? host port</i><br> <a href="#tls::socket"><b>tls::socket</b> <i>?-server command? ?options? port</i></a><br> <a href="#tls::status"><b>tls::status</b> <i>?-local? channel</i></a><br> <a href="#tls::connection"><b>tls::connection</b> <i>channel</i></a><br> <a href="#tls::handshake"><b>tls::handshake</b> <i>channel</i></a><br> <a href="#tls::import"><b>tls::import</b> <i>channel ?options?</i></a><br> <a href="#tls::unimport"><b>tls::unimport</b> <i>channel</i></a><br> <br> <a href="#tls::protocols"><b>tls::protocols</b></a><br> <a href="#tls::version"><b>tls::version</b></a><br> </p> <h3><a name="DESCRIPTION">DESCRIPTION</a></h3> <p>This extension provides a generic binding to <a href="http://www.openssl.org/">OpenSSL</a>, utilizing the <strong>Tcl_StackChannel</strong> |
︙ | ︙ | |||
97 98 99 100 101 102 103 | <dt> </dt> <dt><a name="tls::socket"><b>tls::socket </b><em>?options? host port</em></a></dt> <dt><b>tls::socket</b><em> ?-server command? ?options? port</em></dt> <dd>This is a helper function that utilizes the underlying commands (<strong>tls::import</strong>). It behaves exactly the same as the native Tcl <strong>socket</strong> | | | | | | | | | 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | <dt> </dt> <dt><a name="tls::socket"><b>tls::socket </b><em>?options? host port</em></a></dt> <dt><b>tls::socket</b><em> ?-server command? ?options? port</em></dt> <dd>This is a helper function that utilizes the underlying commands (<strong>tls::import</strong>). It behaves exactly the same as the native Tcl <strong>socket</strong> command except the options can also include any of the applicable <a href="#tls::import"><strong>tls:import</strong></a> options with one additional option:</dd> <blockquote> <dl> <dt><strong>-autoservername</strong> <em>bool</em></dt> <dd>Automatically set the -servername argument to the <em>host</em> argument (default is <em>false</em>).</dd> </dl> </blockquote> <dt><a name="tls::import"><b>tls::import </b><i>channel ?options?</i></a></dt> <dd>Add SSL/TLS encryption to a regular Tcl channel. It need not be a socket, but must provide bi-directional flow. Also set session parameters for SSL handshake.</dd> <blockquote> <dl> <dt><strong>-alpn</strong> <em>list</em></dt> <dd>List of protocols to offer during Application-Layer Protocol Negotiation (ALPN). For example: <em>h2</em> and <em>http/1.1</em>, but not <em>h3</em> or <em>quic</em>.</dd> |
︙ | ︙ | |||
135 136 137 138 139 140 141 | <dt><strong>-certfile</strong> <em>filename</em></dt> <dd>Specify the filename with the certificate to use.</dd> <dt><strong>-cert</strong> <em>filename</em></dt> <dd>Specify the contents of a certificate to use, as a DER encoded binary value (X.509 DER).</dd> <dt><strong>-cipher</strong> <em>string</em></dt> <dd>List of ciphers to use. String is a colon (":") separated list | | | | | > > | | > | | | < | | > | | | > | | | < | > | | < | 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | <dt><strong>-certfile</strong> <em>filename</em></dt> <dd>Specify the filename with the certificate to use.</dd> <dt><strong>-cert</strong> <em>filename</em></dt> <dd>Specify the contents of a certificate to use, as a DER encoded binary value (X.509 DER).</dd> <dt><strong>-cipher</strong> <em>string</em></dt> <dd>List of ciphers to use. String is a colon (":") separated list of ciphers. Ciphers can be combined using the <b>+</b> character. Prefixes can be used to permanently remove ("!"), delete ("-"), or move a cypher to the end of the list ("+"). Keywords <b>@STRENGTH</b> (sort by algorithm key length), <b>@SECLEVEL=</b><i>n</i> (set security level to n), and <b>DEFAULT</b> (use default cipher list, at start only) can also be specified. See OpenSSL documentation for the full list of valid values. (TLS 1.2 and earlier only)</dd> <dt><strong>-ciphersuites</strong> <em>string</em></dt> <dd>List of cipher suites to use. String is a colon (":") separated list of cipher suite names. (TLS 1.3 only)</dd> <dt><strong>-command</strong> <em>callback</em></dt> <dd>Callback command to invoke at several points during the handshake. This is used to pass errors and tracing information, and it can allow Tcl scripts to perform their own certificate validation in place of the default validation provided by OpenSSL. See <a href="#CALLBACK OPTIONS">CALLBACK OPTIONS</a> for further discussion.</dd> <dt><strong>-dhparams </strong><em>filename</em></dt> <dd>Specify the Diffie-Hellman parameters file.</dd> <dt><strong>-keyfile</strong> <em>filename</em></dt> <dd>Specify the private key file. (default is value of -certfile)</dd> <dt><strong>-key</strong> <em>filename</em></dt> <dd>Specify the private key to use as a DER encoded value (PKCS#1 DER)</dd> <dt><strong>-model</strong> <em>channel</em></dt> <dd>Force this channel to share the same <em><strong>SSL_CTX</strong></em> structure as the specified <em>channel</em>, and therefore share callbacks etc.</dd> <dt><strong>-password</strong> <em>callback</em></dt> <dd>Callback command to invoke when OpenSSL needs to obtain a password. Typically used to unlock the private key of a certificate. The callback should return a string which represents the password to be used. See <a href="#CALLBACK OPTIONS">CALLBACK OPTIONS</a> for further discussion.</dd> <dt><strong>-post_handshake</strong> <em>bool</em></dt> <dd>Allow post-handshake ticket updates.</dd> <dt><strong>-request </strong><em>bool</em></dt> <dd>Request a certificate from peer during SSL handshake. (default is <em>true</em>)</dd> <dt><strong>-require</strong> <em>bool</em></dt> <dd>Require a valid certificate from peer during SSL handshake. If this is set to true, then <strong>-request</strong> must also be set to true and a either a -cadir, -cafile, or platform default must be provided in order to validate against. (default is <em>false</em>)</dd> <dt><strong>-security_level</strong> <em>integer</em></dt> <dd>Set security level. Must be 0 to 5. The security level affects the cipher suite encryption algorithms, supported ECC curves, supported signature algorithms, DH parameter sizes, certificate key sizes and signature algorithms. The default is 1. Level 3 and higher disable support for session tickets and only accept cipher suites that provide forward secrecy.</dd> <dt><strong>-server</strong> <em>bool</em></dt> <dd>Set to act as a server and respond with a server handshake when a client connects and provides a client handshake. (default is <em>false</em>)</dd> <dt><strong>-servername</strong> <em>host</em></dt> <dd>Specify server's hostname. Used to set the TLS 'Server Name Indication' (SNI) extension. Set to the expected servername in the server's certificate or one of the subjectAltName alternates.</dd> <dt><strong>-session_id</strong> <em>string</em></dt> <dd>Session id to resume session.</dd> <dt><strong>-ssl2</strong> <em>bool</em></dt> <dd>Enable use of SSL v2. (default is <em>false</em>)</dd> <dt><strong>-ssl3 </strong><em>bool</em></dt> <dd>Enable use of SSL v3. (default is <em>false</em>)</dd> <dt>-<strong>tls1</strong> <em>bool</em></dt> <dd>Enable use of TLS v1. (default is <em>true</em>)</dd> <dt>-<strong>tls1.1</strong> <em>bool</em></dt> <dd>Enable use of TLS v1.1 (default is <em>true</em>)</dd> <dt>-<strong>tls1.2</strong> <em>bool</em></dt> <dd>Enable use of TLS v1.2 (default is <em>true</em>)</dd> <dt>-<strong>tls1.3</strong> <em>bool</em></dt> <dd>Enable use of TLS v1.3 (default is <em>true</em>)</dd> <dt><strong>-validatecommand</strong> <em>callback</em></dt> <dd>Callback command to invoke to verify or validate protocol config parameters during the protocol negotiation phase. See <a href="#CALLBACK OPTIONS">CALLBACK OPTIONS</a> for further discussion.</dd> </dl> </blockquote> <dt><a name="tls::unimport"><b>tls::unimport </b><i>channel</i></a></dt> <dd>Provided for symmetry to <strong>tls::import</strong>, this unstacks the encryption of a regular Tcl channel. An error is thrown if TLS is not the top stacked channel type.</dd> <dt> </dt> <dt><a name="tls::handshake"><strong>tls::handshake</strong> <em>channel</em></a></dt> <dd>Forces handshake to take place, and returns 0 if handshake is still in progress (non-blocking), or 1 if the handshake was successful. If the handshake failed this routine will throw an error.</dd> <dt> </dt> <dt><a name="tls::status"><strong>tls::status</strong> <em>?</em><b>-local</b><em>? channel</em></a></dt> <dd>Returns the current status of an SSL channel. The result is a list of key-value pairs describing the SSL, certificate, and certificate verification status. If the SSL handshake has not yet completed, an empty list is returned. If <b>-local</b> is specified, then the local certificate is used.</dd> <blockquote> <b>SSL Status</b> <dl> <dt><strong>alpn</strong> <em>protocol</em></dt> <dd>The protocol selected after Application-Layer Protocol Negotiation (ALPN).</dd> <dt><strong>cipher</strong> <em>cipher</em></dt> <dd>The current cipher in use between for the channel.</dd> <dt><strong>peername</strong> <em>name</em></dt> <dd>The peername from the certificate.</dd> <dt><strong>protocol</strong> <em>version</em></dt> <dd>The protocol version used for the connection: SSL2, SSL3, TLS1, TLS1.1, TLS1.2, TLS1.3, or unknown.</dd> <dt><strong>sbits</strong> <em>n</em></dt> <dd>The number of bits used for the session key.</dd> |
︙ | ︙ | |||
274 275 276 277 278 279 280 | <dl> <dt><strong>all</strong> <em>string</em></dt> <dd>Dump of all certificate info.</dd> <dt><strong>version</strong> <em>value</em></dt> <dd>The certificate version.</dd> <dt><strong>serialNumber</strong> <em>n</em></dt> | | | 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 | <dl> <dt><strong>all</strong> <em>string</em></dt> <dd>Dump of all certificate info.</dd> <dt><strong>version</strong> <em>value</em></dt> <dd>The certificate version.</dd> <dt><strong>serialNumber</strong> <em>n</em></dt> <dd>The serial number of the certificate as a hex string.</dd> <dt><strong>signature</strong> <em>algorithm</em></dt> <dd>Cipher algorithm used for certificate signature.</dd> <dt><strong>issuer</strong> <em>dn</em></dt> <dd>The distinguished name (DN) of the certificate issuer.</dd> <dt><strong>notBefore</strong> <em>date</em></dt> <dd>The begin date for the validity of the certificate.</dd> <dt><strong>notAfter</strong> <em>date</em></dt> |
︙ | ︙ | |||
298 299 300 301 302 303 304 | <dt><strong>num_extensions</strong> <em>n</em></dt> <dd>Number of certificate extensions.</dd> <dt><strong>extensions</strong> <em>list</em></dt> <dd>List of certificate extension names.</dd> <dt><strong>authorityKeyIdentifier</strong> <em>string</em></dt> <dd>(AKI) Key identifier of the Issuing CA certificate that signed | | | | | | | | | | | | < | | > > | > > > | > > | < < < < < < < < < < | | | 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 | <dt><strong>num_extensions</strong> <em>n</em></dt> <dd>Number of certificate extensions.</dd> <dt><strong>extensions</strong> <em>list</em></dt> <dd>List of certificate extension names.</dd> <dt><strong>authorityKeyIdentifier</strong> <em>string</em></dt> <dd>(AKI) Key identifier of the Issuing CA certificate that signed the SSL certificate as a hex string. This value matches the SKI value of the Intermediate CA certificate.</dd> <dt><strong>subjectKeyIdentifier</strong> <em>string</em></dt> <dd>(SKI) Hash of the public key inside the certificate as a hex string. Used to identify certificates that contain a particular public key.</dd> <dt><strong>subjectAltName</strong> <em>list</em></dt> <dd>List of all of the alternative domain names, sub domains, and IP addresses that are secured by the certificate.</dd> <dt><strong>ocsp</strong> <em>list</em></dt> <dd>List of all Online Certificate Status Protocol (OCSP) URLs.</dd> <dt><strong>certificate</strong> <em>cert</em></dt> <dd>The PEM encoded certificate.</dd> <dt><strong>signatureAlgorithm</strong> <em>algorithm</em></dt> <dd>Cipher algorithm used for the certificate signature.</dd> <dt><strong>signatureValue</strong> <em>string</em></dt> <dd>Certificate signature as a hex string.</dd> <dt><strong>signatureDigest</strong> <em>version</em></dt> <dd>Certificate signing digest as a hex string.</dd> <dt><strong>publicKeyAlgorithm</strong> <em>algorithm</em></dt> <dd>Certificate signature public key algorithm.</dd> <dt><strong>publicKey</strong> <em>string</em></dt> <dd>Certificate signature public key as a hex string.</dd> <dt><strong>bits</strong> <em>n</em></dt> <dd>Number of bits used for certificate signature key.</dd> <dt><strong>self_signed</strong> <em>boolean</em></dt> <dd>Whether the certificate signature is self signed.</dd> <dt><strong>sha1_hash</strong> <em>hash</em></dt> <dd>The SHA1 hash of the certificate as a hex string.</dd> <dt><strong>sha256_hash</strong> <em>hash</em></dt> <dd>The SHA256 hash of the certificate as a hex string.</dd> </dl> </blockquote> <dt><a name="tls::connection"><strong>tls::connection</strong> <em>channel</em></a></dt> <dd>Returns the current connection status of an SSL channel. The result is a list of key-value pairs describing the connection.</dd> <blockquote> <b>SSL Status</b> <dl> <dt><strong>state</strong> <em>state</em></dt> <dd>State of the connection.</dd> <dt><strong>servername</strong> <em>name</em></dt> <dd>The name of the connected to server.</dd> <dt><strong>protocol</strong> <em>version</em></dt> <dd>The protocol version used for the connection: SSL2, SSL3, TLS1, TLS1.1, TLS1.2, TLS1.3, or unknown.</dd> <dt><strong>renegotiation_allowed</strong> <em>boolean</em></dt> <dd>Whether protocol renegotiation is supported or not.</dd> <dt><strong>security_level</strong> <em>level</em></dt> <dd>The security level used for selection of ciphers, key size, etc.</dd> <dt><strong>session_reused</strong> <em>boolean</em></dt> <dd>Whether the session has been reused or not.</dd> <dt><strong>is_server</strong> <em>boolean</em></dt> <dd>Whether the connection is configured as a server (1) or client (0).</dd> <dt><strong>compression</strong> <em>mode</em></dt> <dd>Compression method.</dd> <dt><strong>expansion</strong> <em>mode</em></dt> <dd>Expansion method.</dd> <dt><strong>caList</strong> <em>list</em></dt> <dd>List of Certificate Authorities (CA) for X.509 certificate.</dd> </dl> </blockquote> <blockquote> <b>Cipher Info</b> <dl> <dt><strong>cipher</strong> <em>cipher</em></dt> <dd>The current cipher in use for the connection.</dd> <dt><strong>standard_name</strong> <em>name</em></dt> <dd>The standard RFC name of cipher.</dd> <dt><strong>algorithm_bits</strong> <em>n</em></dt> <dd>The number of processed bits used for cipher.</dd> <dt><strong>secret_bits</strong> <em>n</em></dt> <dd>The number of secret bits used for cipher.</dd> <dt><strong>min_version</strong> <em>version</em></dt> <dd>The minimum protocol version for cipher.</dd> <dt><strong>cipher_is_aead</strong> <em>boolean</em></dt> <dd>Whether the cipher is Authenticated Encryption with Associated Data (AEAD).</dd> <dt><strong>cipher_id</strong> <em>id</em></dt> <dd>The OpenSSL cipher id.</dd> <dt><strong>description</strong> <em>string</em></dt> <dd>A text description of the cipher.</dd> <dt><strong>handshake_digest</strong> <em>boolean</em></dt> <dd>Digest used during handshake.</dd> </dl> </blockquote> <blockquote> <b>Session Info</b> <dl> <dt><strong>alpn</strong> <em>protocol</em></dt> <dd>The protocol selected after Application-Layer Protocol Negotiation (ALPN).</dd> <dt><strong>resumable</strong> <em>boolean</em></dt> <dd>Whether the session can be resumed or not.</dd> <dt><strong>start_time</strong> <em>seconds</em></dt> <dd>Time since session started in seconds since epoch.</dd> <dt><strong>timeout</strong> <em>seconds</em></dt> <dd>Max duration of session in seconds before time-out.</dd> <dt><strong>lifetime</strong> <em>seconds</em></dt> <dd>Session ticket lifetime hint in seconds.</dd> <dt><strong>session_id</strong> <em>binary_string</em></dt> <dd>Unique session id for use in resuming the session.</dd> <dt><strong>session_ticket</strong> <em>binary_string</em></dt> <dd>Unique session ticket for use in resuming the session.</dd> <dt><strong>ticket_app_data</strong> <em>binary_string</em></dt> <dd>Unique session ticket application data.</dd> <dt><strong>master_key</strong> <em>binary_string</em></dt> <dd>Unique session master key.</dd> <dt><strong>session_cache_mode</strong> <em>mode</em></dt> <dd>Server cache mode (client, server, or both).</dd> </dl> </blockquote> <dt><a name="tls::protocols"><strong>tls::protocols</strong></a></dt> <dd>Returns a list of the supported protocols. Valid values are: <b>ssl2</b>, <b>ssl3</b>, <b>tls1</b>, <b>tls1.1</b>, <b>tls1.2</b>, and <b>tls1.3</b>. Exact list depends on OpenSSL version and compile time flags.</dd> <dt><a name="tls::version"><strong>tls::version</strong></a></dt> <dd>Returns the OpenSSL version string.</dd> </dl> <h3><a name="CALLBACK OPTIONS">CALLBACK OPTIONS</a></h3> <p> As indicated above, individual channels can be given their own callbacks to handle intermediate processing by the OpenSSL library, using the <strong>-command</strong>, <strong>-password</strong>, and <strong>-validate_command</strong> options passed to either of <strong>tls::socket</strong> or <strong>tls::import</strong>. If the callback generates an error, the <b>bgerror</b> command will be invoked with the error information. </p> <blockquote> <dl> <dt><strong>-command</strong> <em>callback</em></dt> |
︙ | ︙ | |||
646 647 648 649 650 651 652 | internally. The default behavior when the <strong>-password</strong> option is not specified is for TLS to process the associated library callbacks by attempting to call <strong>tls::password</strong>. The difference between these two behaviors is a consequence of maintaining compatibility with earlier implementations. </p> | < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > | | | | | | 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 | internally. The default behavior when the <strong>-password</strong> option is not specified is for TLS to process the associated library callbacks by attempting to call <strong>tls::password</strong>. The difference between these two behaviors is a consequence of maintaining compatibility with earlier implementations. </p> <p> <em> The use of the reference callbacks <strong>tls::callback</strong>, <strong>tls::password</strong>, and <strong>tls::validate_command</strong> is not recommended. They may be removed from future releases. </em> </p> <h3><a name="DEBUG">DEBUG</a></h3> TLS key logging can be enabled by setting the environment variable <b>SSLKEYLOGFILE</b> to the name of the file to log to. Then whenever TLS key material is generated or received it will be logged to the file. This is useful for logging key data for network logging tools to use to decrypt the data. <p> The <strong>tls::debug</strong> variable provides some additional control over these reference callbacks. Its value is zero by default. Higher values produce more diagnostic output, and will also force the verify method in <strong>tls::callback</strong> to accept the certificate, even when it is invalid. </p> <p> <em> The use of the variable <strong>tls::debug</strong> is not recommended. It may be removed from future releases. </em> </p> <h3><a name="HTTPS EXAMPLE">HTTPS EXAMPLE</a></h3> <p>This example uses a sample server.pem provided with the TLS release, courtesy of the <strong>OpenSSL</strong> project.</p> <pre><code> package require http package require tls http::register https 443 [list ::tls::socket -autoservername true -require true -cadir /etc/ssl/certs] set tok [http::geturl https://www.tcl.tk/] </code></pre> <h3><a name="SPECIAL CONSIDERATIONS">SPECIAL CONSIDERATIONS</a></h3> <p>The capabilities of this package can vary enormously based upon how the linked to OpenSSL library was configured and built. New versions may obsolete older protocol versions, add or remove ciphers, change default values, etc. Use the <strong>tls::protocols</strong> commands to obtain the supported protocol versions.</p> <h3><a name="SEE ALSO">SEE ALSO</a></h3> <p><strong>socket</strong>, <strong>fileevent, </strong><a href="http://www.openssl.org/"><strong>OpenSSL</strong></a></p> <hr> |
︙ | ︙ |
Modified generic/tclOpts.h
from [fee5089a30]
to [6a496a0d8f].
1 | /* | < < | < | | < < < < < | | | > > | | | > | < | | | | < > | < | | | | < < | | | | < | | < | < | < | | < < < | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 | /* * Convenient option processing */ #ifndef _TCL_OPTS_H #define _TCL_OPTS_H #define GET_OPT_BOOL(objPtr, varPtr) \ if (Tcl_GetBooleanFromObj(interp, objPtr, varPtr) != TCL_OK) { \ return TCL_ERROR; \ } #define GET_OPT_INT(objPtr, varPtr) \ if (Tcl_GetIntFromObj(interp, objPtr, varPtr) != TCL_OK) { \ return TCL_ERROR; \ } #define GET_OPT_LONG(objPtr, varPtr) \ if (Tcl_GetLongFromObj(interp, objPtr, varPtr) != TCL_OK) { \ return TCL_ERROR; \ } #define GET_OPT_WIDE(objPtr, varPtr) \ if (Tcl_GetWideIntFromObj(interp, objPtr, varPtr) != TCL_OK) { \ return TCL_ERROR; \ } #define GET_OPT_BIGNUM(objPtr, varPtr) \ if (Tcl_GetBignumFromObj(interp, objPtr, varPtr) != TCL_OK) { \ return TCL_ERROR; \ } #define GET_OPT_STRING(objPtr, var, lenPtr) \ if ((var = Tcl_GetStringFromObj(objPtr, lenPtr)) == NULL) { \ return TCL_ERROR; \ } \ #define GET_OPT_BYTE_ARRAY(objPtr, var, lenPtr) \ if ((var = Tcl_GetByteArrayFromObj(objPtr, lenPtr)) == NULL) { \ return TCL_ERROR; \ } \ #endif /* _TCL_OPTS_H */ |
Modified generic/tls.c
from [893e5c4546]
to [08e7f9d341].
︙ | ︙ | |||
22 23 24 25 26 27 28 29 30 31 32 33 34 35 | * */ #include "tlsInt.h" #include "tclOpts.h" #include <stdio.h> #include <stdlib.h> #include <openssl/rsa.h> #include <openssl/safestack.h> /* Min OpenSSL version */ #if OPENSSL_VERSION_NUMBER < 0x10101000L #error "Only OpenSSL v1.1.1 or later is supported" #endif | > > > > | 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | * */ #include "tlsInt.h" #include "tclOpts.h" #include <stdio.h> #include <stdlib.h> #include <openssl/crypto.h> #include <openssl/ssl.h> #include <openssl/evp.h> #include <openssl/objects.h> #include <openssl/rsa.h> #include <openssl/safestack.h> /* Min OpenSSL version */ #if OPENSSL_VERSION_NUMBER < 0x10101000L #error "Only OpenSSL v1.1.1 or later is supported" #endif |
︙ | ︙ | |||
232 233 234 235 236 237 238 | static void MessageCallback(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg) { State *statePtr = (State*)arg; Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; char *ver, *type; BIO *bio; | | | 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 | static void MessageCallback(int write_p, int version, int content_type, const void *buf, size_t len, SSL *ssl, void *arg) { State *statePtr = (State*)arg; Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; char *ver, *type; BIO *bio; char buffer[30000]; buffer[0] = 0; dprintf("Called"); if (statePtr->callback == (Tcl_Obj*)NULL) return; |
︙ | ︙ | |||
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 | break; case SSL3_RT_HANDSHAKE: type = "Handshake"; break; case SSL3_RT_APPLICATION_DATA: type = "App Data"; break; case DTLS1_RT_HEARTBEAT: type = "Heartbeat"; break; default: type = "unknown"; } /* Needs compile time option "enable-ssl-trace". */ if ((bio = BIO_new(BIO_s_mem())) != NULL) { int n; SSL_trace(write_p, version, content_type, buf, len, ssl, (void *)bio); | > > | | 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 | break; case SSL3_RT_HANDSHAKE: type = "Handshake"; break; case SSL3_RT_APPLICATION_DATA: type = "App Data"; break; #if OPENSSL_VERSION_NUMBER < 0x30000000L case DTLS1_RT_HEARTBEAT: type = "Heartbeat"; break; #endif default: type = "unknown"; } /* Needs compile time option "enable-ssl-trace". */ if ((bio = BIO_new(BIO_s_mem())) != NULL) { int n; SSL_trace(write_p, version, content_type, buf, len, ssl, (void *)bio); n = BIO_read(bio, buffer, BIO_pending(bio) < 15000 ? BIO_pending(bio) : 14999); n = (n<0) ? 0 : n; buffer[n] = 0; (void)BIO_flush(bio); BIO_free(bio); } /* Create command to eval */ |
︙ | ︙ | |||
363 364 365 366 367 368 369 | * to a string describing the SSL negotiation failure reason * *------------------------------------------------------------------- */ static int VerifyCallback(int ok, X509_STORE_CTX *ctx) { Tcl_Obj *cmdPtr; | | | 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 | * to a string describing the SSL negotiation failure reason * *------------------------------------------------------------------- */ static int VerifyCallback(int ok, X509_STORE_CTX *ctx) { Tcl_Obj *cmdPtr; SSL *ssl = (SSL*)X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); X509 *cert = X509_STORE_CTX_get_current_cert(ctx); State *statePtr = (State*)SSL_get_app_data(ssl); Tcl_Interp *interp = statePtr->interp; int depth = X509_STORE_CTX_get_error_depth(ctx); int err = X509_STORE_CTX_get_error(ctx); dprintf("Called"); |
︙ | ︙ | |||
588 589 590 591 592 593 594 | * Return codes: * 0 = error where session will be immediately removed from the internal cache. * 1 = success where app retains session in session cache, and must call SSL_SESSION_free() when done. * *------------------------------------------------------------------- */ static int | | | 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 | * Return codes: * 0 = error where session will be immediately removed from the internal cache. * 1 = success where app retains session in session cache, and must call SSL_SESSION_free() when done. * *------------------------------------------------------------------- */ static int SessionCallback(SSL *ssl, SSL_SESSION *session) { State *statePtr = (State*)SSL_get_app_data((SSL *)ssl); Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; const unsigned char *ticket; const unsigned char *session_id; size_t len2; unsigned int ulen; |
︙ | ︙ | |||
655 656 657 658 659 660 661 | * supplied list and the server configuration. The connection will be aborted. * SSL_TLSEXT_ERR_NOACK: ALPN protocol not selected, e.g., because no ALPN * protocols are configured for this connection. The connection continues. * *------------------------------------------------------------------- */ static int | | | | | 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 | * supplied list and the server configuration. The connection will be aborted. * SSL_TLSEXT_ERR_NOACK: ALPN protocol not selected, e.g., because no ALPN * protocols are configured for this connection. The connection continues. * *------------------------------------------------------------------- */ static int ALPNCallback(SSL *ssl, const unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg) { State *statePtr = (State*)arg; Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; int code, res; dprintf("Called"); if (ssl == NULL || arg == NULL) { return SSL_TLSEXT_ERR_NOACK; } /* Select protocol */ if (SSL_select_next_proto((unsigned char **) out, outlen, statePtr->protos, statePtr->protos_len, in, inlen) == OPENSSL_NPN_NEGOTIATED) { /* Match found */ res = SSL_TLSEXT_ERR_OK; } else { /* OPENSSL_NPN_NO_OVERLAP = No overlap, so use first item from client protocol list */ res = SSL_TLSEXT_ERR_NOACK; } if (statePtr->vcmd == (Tcl_Obj*)NULL) { return res; } /* Create command to eval */ cmdPtr = Tcl_DuplicateObj(statePtr->vcmd); Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewStringObj("alpn", -1)); Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewStringObj(Tcl_GetChannelName(statePtr->self), -1)); Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewStringObj((const char *) *out, -1)); Tcl_ListObjAppendElement(interp, cmdPtr, Tcl_NewBooleanObj(res == SSL_TLSEXT_ERR_OK)); /* Eval callback command */ Tcl_IncrRefCount(cmdPtr); if ((code = EvalCallback(interp, statePtr, cmdPtr)) > 1) { res = SSL_TLSEXT_ERR_NOACK; } else if (code == 1) { |
︙ | ︙ | |||
777 778 779 780 781 782 783 | */ static int SNICallback(const SSL *ssl, int *alert, void *arg) { State *statePtr = (State*)arg; Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; int code, res; | | | 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 | */ static int SNICallback(const SSL *ssl, int *alert, void *arg) { State *statePtr = (State*)arg; Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; int code, res; const char *servername = NULL; dprintf("Called"); if (ssl == NULL || arg == NULL) { return SSL_TLSEXT_ERR_NOACK; } |
︙ | ︙ | |||
844 845 846 847 848 849 850 | * SSL_CLIENT_HELLO_RETRY: suspend the handshake, and the handshake function will return immediately * SSL_CLIENT_HELLO_ERROR: failure, terminate connection. Set alert to error code. * SSL_CLIENT_HELLO_SUCCESS: success * *------------------------------------------------------------------- */ static int | | | 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 | * SSL_CLIENT_HELLO_RETRY: suspend the handshake, and the handshake function will return immediately * SSL_CLIENT_HELLO_ERROR: failure, terminate connection. Set alert to error code. * SSL_CLIENT_HELLO_SUCCESS: success * *------------------------------------------------------------------- */ static int HelloCallback(SSL *ssl, int *alert, void *arg) { State *statePtr = (State*)arg; Tcl_Interp *interp = statePtr->interp; Tcl_Obj *cmdPtr; int code, res; const char *servername; const unsigned char *p; size_t len, remaining; |
︙ | ︙ | |||
926 927 928 929 930 931 932 | /********************/ /* Commands */ /********************/ /* *------------------------------------------------------------------- * | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | 932 933 934 935 936 937 938 939 940 941 942 943 944 945 | /********************/ /* Commands */ /********************/ /* *------------------------------------------------------------------- * * HandshakeObjCmd -- * * This command is used to verify whether the handshake is complete * or not. * * Results: * A standard Tcl result. 1 means handshake complete, 0 means pending. |
︙ | ︙ | |||
1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 | } dprintf("Returning TCL_OK with data \"%i\"", ret); Tcl_SetObjResult(interp, Tcl_NewIntObj(ret)); return(TCL_OK); } /* *------------------------------------------------------------------- * * ImportObjCmd -- * * This procedure is invoked to process the "ssl" command * | > > > > > > > > > > > > > > | 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 | } dprintf("Returning TCL_OK with data \"%i\"", ret); Tcl_SetObjResult(interp, Tcl_NewIntObj(ret)); return(TCL_OK); } static const char *command_opts [] = { "-alpn", "-cadir", "-cafile", "-cert", "-certfile", "-cipher", "-ciphers", "-ciphersuites", "-command", "-dhparams", "-key", "-keyfile", "-model", "-password", "-post_handshake", "-request", "-require", "-security_level", "-server", "-servername", "-session_id", "-ssl2", "-ssl3", "-tls1", "-tls1.1", "-tls1.2", "-tls1.3", "-validatecommand", "-vcmd", NULL}; enum _command_opts { _opt_alpn, _opt_cadir, _opt_cafile, _opt_cert, _opt_certfile, _opt_cipher, _opt_ciphers, _opt_ciphersuite, _opt_cmd, _opt_dhparams, _opt_key, _opt_keyfile, _opt_model, _opt_password, _opt_handshake, _opt_request, _opt_require, _opt_security_level, _opt_server, _opt_servername, _opt_session_id, _opt_ssl2, _opt_ssl3, _opt_tls1, _opt_tls11, _opt_tls12, _opt_tls13, _opt_validate, _opt_vcmd }; /* *------------------------------------------------------------------- * * ImportObjCmd -- * * This procedure is invoked to process the "ssl" command * |
︙ | ︙ | |||
1241 1242 1243 1244 1245 1246 1247 | *------------------------------------------------------------------- */ static int ImportObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Channel chan; /* The channel to set a mode on. */ State *statePtr; /* client state for ssl socket */ SSL_CTX *ctx = NULL; | | | | > | | 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 | *------------------------------------------------------------------- */ static int ImportObjCmd(ClientData clientData, Tcl_Interp *interp, int objc, Tcl_Obj *const objv[]) { Tcl_Channel chan; /* The channel to set a mode on. */ State *statePtr; /* client state for ssl socket */ SSL_CTX *ctx = NULL; Tcl_Obj *cmdObj = NULL; Tcl_Obj *passwdObj = NULL; Tcl_Obj *vcmd = NULL; Tcl_DString upperChannelTranslation, upperChannelBlocking, upperChannelEncoding, upperChannelEOFChar; int idx; Tcl_Size fn, len; int flags = TLS_TCL_INIT; int server = 0; /* is connection incoming or outgoing? */ char *keyfile = NULL; char *certfile = NULL; unsigned char *key = NULL; Tcl_Size key_len = 0; unsigned char *cert = NULL; Tcl_Size cert_len = 0; char *ciphers = NULL; char *ciphersuites = NULL; char *CAfile = NULL; char *CAdir = NULL; char *DHparams = NULL; char *model = NULL; char *servername = NULL; /* hostname for Server Name Indication */ const unsigned char *session_id = NULL; Tcl_Size sess_len = 0; Tcl_Obj *alpnObj = NULL; int ssl2 = 0, ssl3 = 0; int tls1 = 1, tls1_1 = 1, tls1_2 = 1, tls1_3 = 1; int proto = 0, level = -1; int verify = 0, require = 0, request = 1, post_handshake = 0; (void) clientData; dprintf("Called"); |
︙ | ︙ | |||
1301 1302 1303 1304 1305 1306 1307 | return TCL_ERROR; } /* Make sure to operate on the topmost channel */ chan = Tcl_GetTopChannel(chan); for (idx = 2; idx < objc; idx++) { | > > > | > > > > | | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | < < < | 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 | return TCL_ERROR; } /* Make sure to operate on the topmost channel */ chan = Tcl_GetTopChannel(chan); for (idx = 2; idx < objc; idx++) { if (Tcl_GetIndexFromObj(interp, objv[idx], command_opts, "option", 0, &fn) != TCL_OK) { return TCL_ERROR; } /* Validate arg has value */ if (++idx >= objc) { Tcl_AppendResult(interp, "No value for option \"", command_opts[fn], "\"", (char *) NULL); return TCL_ERROR; } switch(fn) { case _opt_alpn: alpnObj = objv[idx]; break; case _opt_cadir: GET_OPT_STRING(objv[idx], CAdir, NULL); break; case _opt_cafile: GET_OPT_STRING(objv[idx], CAfile, NULL); break; case _opt_cert: GET_OPT_BYTE_ARRAY(objv[idx], cert, &cert_len); break; case _opt_certfile: GET_OPT_STRING(objv[idx], certfile, NULL); break; case _opt_cipher: case _opt_ciphers: GET_OPT_STRING(objv[idx], ciphers, NULL); break; case _opt_ciphersuite: GET_OPT_STRING(objv[idx], ciphersuites, NULL); break; case _opt_cmd: cmdObj = objv[idx]; break; case _opt_dhparams: GET_OPT_STRING(objv[idx], DHparams, NULL); break; case _opt_key: GET_OPT_BYTE_ARRAY(objv[idx], key, &key_len); break; case _opt_keyfile: GET_OPT_STRING(objv[idx], keyfile, NULL); break; case _opt_model: GET_OPT_STRING(objv[idx], model, NULL); break; case _opt_password: passwdObj = objv[idx]; break; case _opt_handshake: GET_OPT_BOOL(objv[idx], &post_handshake); break; case _opt_request: GET_OPT_BOOL(objv[idx], &request); break; case _opt_require: GET_OPT_BOOL(objv[idx], &require); break; case _opt_security_level: GET_OPT_INT(objv[idx], &level); break; case _opt_server: GET_OPT_BOOL(objv[idx], &server); break; case _opt_servername: GET_OPT_STRING(objv[idx], servername, NULL); break; case _opt_session_id: GET_OPT_BYTE_ARRAY(objv[idx], session_id, &sess_len); break; case _opt_ssl2: GET_OPT_INT(objv[idx], &ssl2); break; case _opt_ssl3: GET_OPT_INT(objv[idx], &ssl3); break; case _opt_tls1: GET_OPT_INT(objv[idx], &tls1); break; case _opt_tls11: GET_OPT_INT(objv[idx], &tls1_1); break; case _opt_tls12: GET_OPT_INT(objv[idx], &tls1_2); break; case _opt_tls13: GET_OPT_INT(objv[idx], &tls1_3); break; case _opt_validate: case _opt_vcmd: vcmd = objv[idx]; break; } } if (request) verify |= SSL_VERIFY_CLIENT_ONCE | SSL_VERIFY_PEER; if (request && require) verify |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; if (request && post_handshake) verify |= SSL_VERIFY_POST_HANDSHAKE; if (verify == 0) verify = SSL_VERIFY_NONE; proto |= (ssl2 ? TLS_PROTO_SSL2 : 0); proto |= (ssl3 ? TLS_PROTO_SSL3 : 0); |
︙ | ︙ | |||
1373 1374 1375 1376 1377 1378 1379 | statePtr->flags = flags; statePtr->interp = interp; statePtr->vflags = verify; statePtr->err = ""; /* allocate script */ | | | | | | | | 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | statePtr->flags = flags; statePtr->interp = interp; statePtr->vflags = verify; statePtr->err = ""; /* allocate script */ if (cmdObj != NULL) { (void) Tcl_GetStringFromObj(cmdObj, &len); if (len) { statePtr->callback = cmdObj; Tcl_IncrRefCount(statePtr->callback); } } /* allocate password */ if (passwdObj != NULL) { (void) Tcl_GetStringFromObj(passwdObj, &len); if (len) { statePtr->password = passwdObj; Tcl_IncrRefCount(statePtr->password); } } /* allocate validate command */ if (vcmd) { (void) Tcl_GetStringFromObj(vcmd, &len); |
︙ | ︙ | |||
1497 1498 1499 1500 1501 1502 1503 | Tcl_SetErrorCode(interp, "TLS", "IMPORT", "HOSTNAME", "FAILED", (char *) NULL); Tls_Free((char *) statePtr); return TCL_ERROR; } } /* Resume session id */ | | | | | | 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 | Tcl_SetErrorCode(interp, "TLS", "IMPORT", "HOSTNAME", "FAILED", (char *) NULL); Tls_Free((char *) statePtr); return TCL_ERROR; } } /* Resume session id */ if (session_id && sess_len <= SSL_MAX_SID_CTX_LENGTH) { /* SSL_set_session() */ if (!SSL_SESSION_set1_id_context(SSL_get_session(statePtr->ssl), session_id, (unsigned int) sess_len)) { Tcl_AppendResult(interp, "Resume session failed: ", GET_ERR_REASON(), (char *) NULL); Tcl_SetErrorCode(interp, "TLS", "IMPORT", "SESSION", "FAILED", (char *) NULL); Tls_Free((char *) statePtr); return TCL_ERROR; } } /* Enable Application-Layer Protocol Negotiation. Examples are: http/1.0, http/1.1, h2, h3, ftp, imap, pop3, xmpp-client, xmpp-server, mqtt, irc, etc. */ if (alpnObj != NULL) { /* Convert a TCL list into a protocol-list in wire-format */ unsigned char *protos, *p; unsigned int protos_len = 0; Tcl_Size cnt, i; int j; Tcl_Obj **list; if (Tcl_ListObjGetElements(interp, alpnObj, &cnt, &list) != TCL_OK) { Tls_Free((char *) statePtr); return TCL_ERROR; } /* Determine the memory required for the protocol-list */ for (i = 0; i < cnt; i++) { Tcl_GetStringFromObj(list[i], &len); |
︙ | ︙ | |||
1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 | statePtr->protos_len = 0; } /* * SSL Callbacks */ SSL_set_app_data(statePtr->ssl, (void *)statePtr); /* point back to us */ SSL_set_verify(statePtr->ssl, verify, VerifyCallback); SSL_set_info_callback(statePtr->ssl, InfoCallback); /* Callback for observing protocol messages */ #ifndef OPENSSL_NO_SSL_TRACE /* void SSL_CTX_set_msg_callback_arg(statePtr->ctx, (void *)statePtr); void SSL_CTX_set_msg_callback(statePtr->ctx, MessageCallback); */ | > | 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | statePtr->protos_len = 0; } /* * SSL Callbacks */ SSL_set_app_data(statePtr->ssl, (void *)statePtr); /* point back to us */ SSL_set_verify(statePtr->ssl, verify, VerifyCallback); SSL_set_info_callback(statePtr->ssl, InfoCallback); /* Callback for observing protocol messages */ #ifndef OPENSSL_NO_SSL_TRACE /* void SSL_CTX_set_msg_callback_arg(statePtr->ctx, (void *)statePtr); void SSL_CTX_set_msg_callback(statePtr->ctx, MessageCallback); */ |
︙ | ︙ | |||
2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 | /* Get certificate for peer or self */ if (objc == 2) { peer = SSL_get_peer_certificate(statePtr->ssl); } else { peer = SSL_get_certificate(statePtr->ssl); } /* Get X509 certificate info */ if (peer) { objPtr = Tls_NewX509Obj(interp, peer); if (objc == 2) { X509_free(peer); peer = NULL; } | > | 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 | /* Get certificate for peer or self */ if (objc == 2) { peer = SSL_get_peer_certificate(statePtr->ssl); } else { peer = SSL_get_certificate(statePtr->ssl); } /* Get X509 certificate info */ if (peer) { objPtr = Tls_NewX509Obj(interp, peer); if (objc == 2) { X509_free(peer); peer = NULL; } |
︙ | ︙ | |||
2190 2191 2192 2193 2194 2195 2196 | (void) clientData; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "channel"); return(TCL_ERROR); } | | | 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 | (void) clientData; if (objc != 2) { Tcl_WrongNumArgs(interp, 1, objv, "channel"); return(TCL_ERROR); } chan = Tcl_GetChannel(interp, Tcl_GetStringFromObj(objv[1], (Tcl_Size *) NULL), NULL); if (chan == (Tcl_Channel) NULL) { return(TCL_ERROR); } /* Make sure to operate on the topmost channel */ chan = Tcl_GetTopChannel(chan); if (Tcl_GetChannelType(chan) != Tls_ChannelType()) { |
︙ | ︙ | |||
2220 2221 2222 2223 2224 2225 2226 | /* Get SNI requested server name */ LAPPEND_STR(interp, objPtr, "servername", SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name), -1); /* Get protocol */ LAPPEND_STR(interp, objPtr, "protocol", SSL_get_version(ssl), -1); /* Renegotiation allowed */ | | | 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 | /* Get SNI requested server name */ LAPPEND_STR(interp, objPtr, "servername", SSL_get_servername(ssl, TLSEXT_NAMETYPE_host_name), -1); /* Get protocol */ LAPPEND_STR(interp, objPtr, "protocol", SSL_get_version(ssl), -1); /* Renegotiation allowed */ LAPPEND_BOOL(interp, objPtr, "renegotiation_allowed", SSL_get_secure_renegotiation_support((SSL *) ssl)); /* Get security level */ LAPPEND_INT(interp, objPtr, "security_level", SSL_get_security_level(ssl)); /* Session info */ LAPPEND_BOOL(interp, objPtr, "session_reused", SSL_session_reused(ssl)); |
︙ | ︙ | |||
2260 2261 2262 2263 2264 2265 2266 | LAPPEND_INT(interp, objPtr, "algorithm_bits", alg_bits); /* alg_bits is actual key secret bits. If use bits and secret (algorithm) bits differ, the rest of the bits are fixed, i.e. for limited export ciphers (bits < 56) */ /* Indicates which SSL/TLS protocol version first defined the cipher */ LAPPEND_STR(interp, objPtr, "min_version", SSL_CIPHER_get_version(cipher), -1); | | < < < < | > > > > > | | 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 | LAPPEND_INT(interp, objPtr, "algorithm_bits", alg_bits); /* alg_bits is actual key secret bits. If use bits and secret (algorithm) bits differ, the rest of the bits are fixed, i.e. for limited export ciphers (bits < 56) */ /* Indicates which SSL/TLS protocol version first defined the cipher */ LAPPEND_STR(interp, objPtr, "min_version", SSL_CIPHER_get_version(cipher), -1); /* Cipher NID, digest NID (none for AEAD cipher suites), Key Exchange NID, and authentication NID */ LAPPEND_STR(interp, objPtr, "cipherNID", (char *)OBJ_nid2ln(SSL_CIPHER_get_cipher_nid(cipher)), -1); LAPPEND_STR(interp, objPtr, "digestNID", (char *)OBJ_nid2ln(SSL_CIPHER_get_digest_nid(cipher)), -1); LAPPEND_STR(interp, objPtr, "keyExchangeNID", (char *)OBJ_nid2ln(SSL_CIPHER_get_kx_nid(cipher)), -1); LAPPEND_STR(interp, objPtr, "authenticationNID", (char *)OBJ_nid2ln(SSL_CIPHER_get_auth_nid(cipher)), -1); /* message authentication code - Cipher is AEAD (e.g. GCM or ChaCha20/Poly1305) or not */ /* Authenticated Encryption with associated data (AEAD) check */ LAPPEND_BOOL(interp, objPtr, "cipher_is_aead", SSL_CIPHER_is_aead(cipher)); /* Get OpenSSL-specific ID, not IANA ID */ LAPPEND_INT(interp, objPtr, "cipher_id", (int) SSL_CIPHER_get_id(cipher)); /* Two-byte ID used in the TLS protocol of the given cipher */ LAPPEND_INT(interp, objPtr, "protocol_id", (int) SSL_CIPHER_get_protocol_id(cipher)); /* Textual description of the cipher. Includes: cipher name, protocol version, key exchange, authentication, symmetric encryption method, message authentication code */ if (SSL_CIPHER_description(cipher, buf, sizeof(buf)) != NULL) { LAPPEND_STR(interp, objPtr, "description", buf, -1); } /* Digest used during the SSL/TLS handshake when using the cipher. */ md = SSL_CIPHER_get_handshake_digest(cipher); LAPPEND_STR(interp, objPtr, "handshake_digest", (char *)EVP_MD_name(md), -1); } /* Session info */ session = SSL_get_session(ssl); if (session != NULL) { const unsigned char *ticket; size_t len2; unsigned int ulen; const unsigned char *session_id, *proto; unsigned char buffer[SSL_MAX_MASTER_KEY_LENGTH]; /* Report the selected protocol as a result of the ALPN negotiation */ SSL_SESSION_get0_alpn_selected(session, &proto, &len2); LAPPEND_STR(interp, objPtr, "alpn", (char *) proto, (Tcl_Size) len2); /* Report the selected protocol as a result of the NPN negotiation */ #ifdef USE_NPN |
︙ | ︙ | |||
2330 2331 2332 2333 2334 2335 2336 | SSL_SESSION_get0_ticket(session, &ticket, &len2); LAPPEND_BARRAY(interp, objPtr, "session_ticket", ticket, (Tcl_Size) len2); /* Session ticket lifetime hint (in seconds) */ LAPPEND_LONG(interp, objPtr, "lifetime", SSL_SESSION_get_ticket_lifetime_hint(session)); /* Ticket app data */ | > | > | 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 | SSL_SESSION_get0_ticket(session, &ticket, &len2); LAPPEND_BARRAY(interp, objPtr, "session_ticket", ticket, (Tcl_Size) len2); /* Session ticket lifetime hint (in seconds) */ LAPPEND_LONG(interp, objPtr, "lifetime", SSL_SESSION_get_ticket_lifetime_hint(session)); /* Ticket app data */ #if OPENSSL_VERSION_NUMBER < 0x30000000L SSL_SESSION_get0_ticket_appdata((SSL_SESSION *) session, &ticket, &len2); LAPPEND_BARRAY(interp, objPtr, "ticket_app_data", ticket, (Tcl_Size) len2); #endif /* Get master key */ len2 = SSL_SESSION_get_master_key(session, buffer, SSL_MAX_MASTER_KEY_LENGTH); LAPPEND_BARRAY(interp, objPtr, "master_key", buffer, (Tcl_Size) len2); /* Compression id */ unsigned int id = SSL_SESSION_get_compress_id(session); |
︙ | ︙ | |||
2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 | /* CA List */ /* IF not a server, same as SSL_get0_peer_CA_list. If server same as SSL_CTX_get_client_CA_list */ listPtr = Tcl_NewListObj(0, NULL); STACK_OF(X509_NAME) *ca_list; if ((ca_list = SSL_get_client_CA_list(ssl)) != NULL) { char buffer[BUFSIZ]; for (int i = 0; i < sk_X509_NAME_num(ca_list); i++) { X509_NAME *name = sk_X509_NAME_value(ca_list, i); if (name) { X509_NAME_oneline(name, buffer, BUFSIZ); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj(buffer, -1)); } } } LAPPEND_OBJ(interp, objPtr, "caList", listPtr); LAPPEND_INT(interp, objPtr, "caListCount", sk_X509_NAME_num(ca_list)); | > < < | < < < < < < < < < < < < < < < < < < < < < < < < < | 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 | /* CA List */ /* IF not a server, same as SSL_get0_peer_CA_list. If server same as SSL_CTX_get_client_CA_list */ listPtr = Tcl_NewListObj(0, NULL); STACK_OF(X509_NAME) *ca_list; if ((ca_list = SSL_get_client_CA_list(ssl)) != NULL) { char buffer[BUFSIZ]; for (int i = 0; i < sk_X509_NAME_num(ca_list); i++) { X509_NAME *name = sk_X509_NAME_value(ca_list, i); if (name) { X509_NAME_oneline(name, buffer, BUFSIZ); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj(buffer, -1)); } } } LAPPEND_OBJ(interp, objPtr, "caList", listPtr); LAPPEND_INT(interp, objPtr, "caListCount", sk_X509_NAME_num(ca_list)); Tcl_SetObjResult(interp, objPtr); return TCL_OK; } /* *------------------------------------------------------------------- * * MiscObjCmd -- misc commands |
︙ | ︙ | |||
2777 2778 2779 2780 2781 2782 2783 | } if (TlsLibInit(0) != TCL_OK) { Tcl_AppendResult(interp, "could not initialize SSL library", (char *) NULL); return TCL_ERROR; } | < > | | | > > > | 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 | } if (TlsLibInit(0) != TCL_OK) { Tcl_AppendResult(interp, "could not initialize SSL library", (char *) NULL); return TCL_ERROR; } Tcl_CreateObjCommand(interp, "tls::connection", ConnectionInfoObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::handshake", HandshakeObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::import", ImportObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::misc", MiscObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::unimport", UnimportObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tcl_CreateObjCommand(interp, "tls::status", StatusObjCmd, (ClientData) NULL, (Tcl_CmdDeleteProc *) NULL); Tls_DigestCommands(interp); Tls_EncryptCommands(interp); Tls_InfoCommands(interp); Tls_KDFCommands(interp); Tls_RandCommands(interp); if (interp) { Tcl_Eval(interp, tlsTclInitScript); } return Tcl_PkgProvide(interp, PACKAGE_NAME, PACKAGE_VERSION); } |
︙ | ︙ | |||
2919 2920 2921 2922 2923 2924 2925 | rnd_seed[i] = 1 + (char) (255.0 * rand()/(RAND_MAX+1.0)); } RAND_seed(rnd_seed, sizeof(rnd_seed)); } while (RAND_status() != 1); #endif #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) | | | 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 | rnd_seed[i] = 1 + (char) (255.0 * rand()/(RAND_MAX+1.0)); } RAND_seed(rnd_seed, sizeof(rnd_seed)); } while (RAND_status() != 1); #endif #if defined(OPENSSL_THREADS) && defined(TCL_THREADS) Tcl_MutexUnlock(&init_mx); #endif return(status); } |
Added generic/tlsDigest.c version [b9cf69269c].
Added generic/tlsEncrypt.c version [892582a1b8].
Modified generic/tlsIO.c
from [89e79806f0]
to [7b8e3f850c].
︙ | ︙ | |||
69 70 71 72 73 74 75 | * Side effects: * Closes the socket of the channel. * *------------------------------------------------------------------- */ static int TlsCloseProc(ClientData instanceData, Tcl_Interp *interp) { State *statePtr = (State *) instanceData; | < | 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | * Side effects: * Closes the socket of the channel. * *------------------------------------------------------------------- */ static int TlsCloseProc(ClientData instanceData, Tcl_Interp *interp) { State *statePtr = (State *) instanceData; dprintf("TlsCloseProc(%p)", (void *) statePtr); Tls_Clean(statePtr); Tcl_EventuallyFree((ClientData)statePtr, Tls_Free); return(0); } |
︙ | ︙ | |||
150 151 152 153 154 155 156 | } else { dprintf("Calling SSL_connect()"); err = SSL_connect(statePtr->ssl); } if (err > 0) { dprintf("Accept or connect was successful"); | < | 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | } else { dprintf("Calling SSL_connect()"); err = SSL_connect(statePtr->ssl); } if (err > 0) { dprintf("Accept or connect was successful"); err = BIO_flush(statePtr->bio); if (err <= 0) { dprintf("Flushing the lower layers failed, this will probably terminate this session"); } } else { dprintf("Accept or connect failed"); } |
︙ | ︙ | |||
215 216 217 218 219 220 221 | *errorCodePtr = EINVAL; Tls_Error(statePtr, "Peer has closed the connection for writing by sending the close_notify alert"); return(-1); case SSL_ERROR_SYSCALL: /* Some non-recoverable, fatal I/O error occurred */ dprintf("SSL_ERROR_SYSCALL"); | < | | | | | 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 | *errorCodePtr = EINVAL; Tls_Error(statePtr, "Peer has closed the connection for writing by sending the close_notify alert"); return(-1); case SSL_ERROR_SYSCALL: /* Some non-recoverable, fatal I/O error occurred */ dprintf("SSL_ERROR_SYSCALL"); if (backingError == 0 && err == 0) { dprintf("EOF reached") *errorCodePtr = ECONNRESET; Tls_Error(statePtr, "(unexpected) EOF reached"); } else if (backingError == 0 && err == -1) { dprintf("I/O error occurred (errno = %lu)", (unsigned long) Tcl_GetErrno()); *errorCodePtr = Tcl_GetErrno(); if (*errorCodePtr == ECONNRESET) { *errorCodePtr = ECONNABORTED; } Tls_Error(statePtr, (char *) Tcl_ErrnoMsg(Tcl_GetErrno())); } else { dprintf("I/O error occurred (backingError = %lu)", backingError); *errorCodePtr = backingError; if (*errorCodePtr == ECONNRESET) { *errorCodePtr = ECONNABORTED; } Tls_Error(statePtr, (char *) ERR_reason_error_string(backingError)); } statePtr->flags |= TLS_TCL_HANDSHAKE_FAILED; return(-1); case SSL_ERROR_SSL: /* A non-recoverable, fatal error in the SSL library occurred, usually a protocol error */ dprintf("SSL_ERROR_SSL: Got permanent fatal SSL error, aborting immediately"); if (backingError != 0) { Tls_Error(statePtr, (char *) ERR_reason_error_string(backingError)); } if (SSL_get_verify_result(statePtr->ssl) != X509_V_OK) { Tls_Error(statePtr, (char *) X509_verify_cert_error_string(SSL_get_verify_result(statePtr->ssl))); } statePtr->flags |= TLS_TCL_HANDSHAKE_FAILED; *errorCodePtr = ECONNABORTED; return(-1); case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_WRITE: |
︙ | ︙ | |||
365 366 367 368 369 370 371 | dprintBuffer(buf, bytesRead); break; case SSL_ERROR_SSL: /* A non-recoverable, fatal error in the SSL library occurred, usually a protocol error */ dprintf("SSL error, indicating that the connection has been aborted"); if (backingError != 0) { | | < | | | 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 | dprintBuffer(buf, bytesRead); break; case SSL_ERROR_SSL: /* A non-recoverable, fatal error in the SSL library occurred, usually a protocol error */ dprintf("SSL error, indicating that the connection has been aborted"); if (backingError != 0) { Tls_Error(statePtr, (char *) ERR_reason_error_string(backingError)); } *errorCodePtr = ECONNABORTED; bytesRead = -1; #if OPENSSL_VERSION_NUMBER >= 0x30000000L /* Unexpected EOF from the peer for OpenSSL 3.0+ */ if (ERR_GET_REASON(backingError) == SSL_R_UNEXPECTED_EOF_WHILE_READING) { dprintf("(Unexpected) EOF reached") *errorCodePtr = 0; bytesRead = 0; Tls_Error(statePtr, "EOF reached"); } #endif break; case SSL_ERROR_SYSCALL: /* Some non-recoverable, fatal I/O error occurred */ if (backingError == 0 && bytesRead == 0) { /* Unexpected EOF from the peer for OpenSSL 1.1 */ dprintf("(Unexpected) EOF reached") *errorCodePtr = 0; bytesRead = 0; Tls_Error(statePtr, "EOF reached"); } else if (backingError == 0 && bytesRead == -1) { dprintf("I/O error occurred (errno = %lu)", (unsigned long) Tcl_GetErrno()); *errorCodePtr = Tcl_GetErrno(); bytesRead = -1; Tls_Error(statePtr, (char *) Tcl_ErrnoMsg(Tcl_GetErrno())); } else { dprintf("I/O error occurred (backingError = %lu)", backingError); *errorCodePtr = backingError; bytesRead = -1; Tls_Error(statePtr, (char *) ERR_reason_error_string(backingError)); } break; case SSL_ERROR_ZERO_RETURN: dprintf("Got SSL_ERROR_ZERO_RETURN, this means an EOF has been reached"); bytesRead = 0; *errorCodePtr = 0; |
︙ | ︙ | |||
552 553 554 555 556 557 558 | written = 0; *errorCodePtr = 0; Tls_Error(statePtr, "Peer has closed the connection for writing by sending the close_notify alert"); break; case SSL_ERROR_SYSCALL: /* Some non-recoverable, fatal I/O error occurred */ | < | | | | 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | written = 0; *errorCodePtr = 0; Tls_Error(statePtr, "Peer has closed the connection for writing by sending the close_notify alert"); break; case SSL_ERROR_SYSCALL: /* Some non-recoverable, fatal I/O error occurred */ if (backingError == 0 && written == 0) { dprintf("EOF reached") *errorCodePtr = 0; written = 0; Tls_Error(statePtr, "EOF reached"); } else if (backingError == 0 && written == -1) { dprintf("I/O error occurred (errno = %lu)", (unsigned long) Tcl_GetErrno()); *errorCodePtr = Tcl_GetErrno(); written = -1; Tls_Error(statePtr, (char *) Tcl_ErrnoMsg(Tcl_GetErrno())); } else { dprintf("I/O error occurred (backingError = %lu)", backingError); *errorCodePtr = backingError; written = -1; Tls_Error(statePtr, (char *) ERR_reason_error_string(backingError)); } break; case SSL_ERROR_SSL: /* A non-recoverable, fatal error in the SSL library occurred, usually a protocol error */ dprintf("SSL error, indicating that the connection has been aborted"); if (backingError != 0) { Tls_Error(statePtr, (char *) ERR_reason_error_string(backingError)); } *errorCodePtr = ECONNABORTED; written = -1; break; default: dprintf("unknown error: %d", err); |
︙ | ︙ | |||
944 945 946 947 948 949 950 | NULL, /* Flush proc */ TlsNotifyProc, /* Handling of events bubbling up */ NULL, /* Wide seek proc */ NULL, /* Thread action */ NULL /* Truncate */ }; | | | 939 940 941 942 943 944 945 946 947 948 | NULL, /* Flush proc */ TlsNotifyProc, /* Handling of events bubbling up */ NULL, /* Wide seek proc */ NULL, /* Thread action */ NULL /* Truncate */ }; const Tcl_ChannelType *Tls_ChannelType(void) { return &tlsChannelType; } |
Added generic/tlsInfo.c version [3aad12f06f].
Modified generic/tlsInt.h
from [07c33eb860]
to [d59da98e39].
︙ | ︙ | |||
33 34 35 36 37 38 39 | #ifndef CONST86 # if TCL_MAJOR_VERSION > 8 # define CONST86 const # else # define CONST86 # endif #endif | < > > > > > > | 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | #ifndef CONST86 # if TCL_MAJOR_VERSION > 8 # define CONST86 const # else # define CONST86 # endif #endif /* * Backwards compatibility for size type change */ #if TCL_MAJOR_VERSION < 9 && TCL_MINOR_VERSION < 7 #include <limits.h> #define TCL_SIZE_MAX INT_MAX #ifndef Tcl_Size typedef int Tcl_Size; #endif #define TCL_SIZE_MODIFIER "" #define Tcl_GetSizeIntFromObj Tcl_GetIntFromObj #define Tcl_NewSizeIntObj Tcl_NewIntObj #define Tcl_NewSizeIntFromObj Tcl_NewWideIntObj #endif #include <openssl/ssl.h> #include <openssl/err.h> #include <openssl/rand.h> #include <openssl/opensslv.h> |
︙ | ︙ | |||
170 171 172 173 174 175 176 | int vflags; /* verify flags */ SSL *ssl; /* Struct for SSL processing */ SSL_CTX *ctx; /* SSL Context */ BIO *bio; /* Struct for SSL processing */ BIO *p_bio; /* Parent BIO (that is layered on Tcl_Channel) */ | | | > > > > > > > > > > > > > > > | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | int vflags; /* verify flags */ SSL *ssl; /* Struct for SSL processing */ SSL_CTX *ctx; /* SSL Context */ BIO *bio; /* Struct for SSL processing */ BIO *p_bio; /* Parent BIO (that is layered on Tcl_Channel) */ unsigned char *protos; /* List of supported protocols in protocol format */ unsigned int protos_len; /* Length of protos */ char *err; } State; #ifdef USE_TCL_STUBS #ifndef Tcl_StackChannel #error "Unable to compile on this version of Tcl" #endif /* Tcl_GetStackedChannel */ #endif /* USE_TCL_STUBS */ /* * Forward declarations */ const Tcl_ChannelType *Tls_ChannelType(void); Tcl_Channel Tls_GetParent(State *statePtr, int maskFlags); Tcl_Obj *Tls_NewX509Obj(Tcl_Interp *interp, X509 *cert); Tcl_Obj *Tls_NewCAObj(Tcl_Interp *interp, const SSL *ssl, int peer); void Tls_Error(State *statePtr, char *msg); void Tls_Free(char *blockPtr); void Tls_Clean(State *statePtr); int Tls_WaitForConnect(State *statePtr, int *errorCodePtr, int handshakeFailureIsPermanent); int Tls_DigestCommands(Tcl_Interp *interp); int Tls_EncryptCommands(Tcl_Interp *interp); int Tls_InfoCommands(Tcl_Interp *interp); int Tls_KDFCommands(Tcl_Interp *interp); int Tls_RandCommands(Tcl_Interp *interp); BIO *BIO_new_tcl(State* statePtr, int flags); EVP_CIPHER *Util_GetCipher(Tcl_Interp *interp, Tcl_Obj *cipherObj, int no_null); EVP_MD *Util_GetDigest(Tcl_Interp *interp, Tcl_Obj *digestObj, int no_null); unsigned char *Util_GetIV(Tcl_Interp *interp, Tcl_Obj *ivObj, Tcl_Size *len, int max, int no_null); unsigned char *Util_GetKey(Tcl_Interp *interp, Tcl_Obj *keyObj, Tcl_Size *len, char *name, int max, int no_null); unsigned char *Util_GetSalt(Tcl_Interp *interp, Tcl_Obj *saltObj, Tcl_Size *len, int max, int no_null); int Util_GetInt(Tcl_Interp *interp, Tcl_Obj *dataObj, int *value, char *name, int min, int max); #if OPENSSL_VERSION_NUMBER >= 0x30000000L EVP_MAC *Util_GetMAC(Tcl_Interp *interp, Tcl_Obj *MacObj, int no_null); #endif #define PTR2INT(x) ((int) ((intptr_t) (x))) #endif /* _TLSINT_H */ |
Added generic/tlsKDF.c version [a4bcf33c6e].
Added generic/tlsRand.c version [4b096f23cb].
Added generic/tlsUtil.c version [b1b9224457].
Modified generic/tlsX509.c
from [37e1c520a1]
to [051a5b0d6c].
︙ | ︙ | |||
58 59 60 61 62 63 64 | const STACK_OF(X509_EXTENSION) *exts; Tcl_Obj *listPtr = Tcl_NewListObj(0, NULL); if (listPtr == NULL) { return NULL; } | | | | | | | 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | const STACK_OF(X509_EXTENSION) *exts; Tcl_Obj *listPtr = Tcl_NewListObj(0, NULL); if (listPtr == NULL) { return NULL; } if ((exts = X509_get0_extensions(cert)) != NULL) { for (int i=0; i < X509_get_ext_count(cert); i++) { X509_EXTENSION *ex = sk_X509_EXTENSION_value(exts, i); ASN1_OBJECT *obj = X509_EXTENSION_get_object(ex); /* ASN1_OCTET_STRING *data = X509_EXTENSION_get_data(ex); */ int critical = X509_EXTENSION_get_critical(ex); LAPPEND_BOOL(interp, listPtr, OBJ_nid2ln(OBJ_obj2nid(obj)), critical); } } return listPtr; } /* * Get Authority and Subject Key Identifiers */ Tcl_Obj *Tls_x509Identifier(const ASN1_OCTET_STRING *astring) { Tcl_Obj *resultPtr = NULL; int len = 0; unsigned char buffer[1024]; if (astring != NULL) { len = String_to_Hex((unsigned char *) ASN1_STRING_get0_data(astring), ASN1_STRING_length(astring), buffer, 1024); } resultPtr = Tcl_NewStringObj((char *) &buffer[0], (Tcl_Size) len); return resultPtr; } /* * Get Key Usage */ Tcl_Obj *Tls_x509KeyUsage(Tcl_Interp *interp, X509 *cert, uint32_t xflags) { |
︙ | ︙ | |||
199 200 201 202 203 204 205 | int len; char buffer[1024]; if (listPtr == NULL) { return NULL; } | | | | 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 | int len; char buffer[1024]; if (listPtr == NULL) { return NULL; } if ((names = X509_get_ext_d2i(cert, nid, NULL, NULL)) != NULL) { for (int i=0; i < sk_GENERAL_NAME_num(names); i++) { const GENERAL_NAME *name = sk_GENERAL_NAME_value(names, i); len = BIO_to_Buffer(name && GENERAL_NAME_print(bio, (GENERAL_NAME *) name), bio, buffer, 1024); LAPPEND_STR(interp, listPtr, NULL, buffer, (Tcl_Size) len); } sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); } return listPtr; } |
︙ | ︙ | |||
269 270 271 272 273 274 275 | STACK_OF(DIST_POINT) *crl; Tcl_Obj *listPtr = Tcl_NewListObj(0, NULL); if (listPtr == NULL) { return NULL; } | | | | | | | | 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 | STACK_OF(DIST_POINT) *crl; Tcl_Obj *listPtr = Tcl_NewListObj(0, NULL); if (listPtr == NULL) { return NULL; } if ((crl = X509_get_ext_d2i(cert, NID_crl_distribution_points, NULL, NULL)) != NULL) { for (int i=0; i < sk_DIST_POINT_num(crl); i++) { DIST_POINT *dp = sk_DIST_POINT_value(crl, i); DIST_POINT_NAME *distpoint = dp->distpoint; if (distpoint->type == 0) { /* full-name GENERALIZEDNAME */ for (int j = 0; j < sk_GENERAL_NAME_num(distpoint->name.fullname); j++) { GENERAL_NAME *gen = sk_GENERAL_NAME_value(distpoint->name.fullname, j); int type; ASN1_STRING *uri = GENERAL_NAME_get0_value(gen, &type); if (type == GEN_URI) { LAPPEND_STR(interp, listPtr, (char *) NULL, (char *) ASN1_STRING_get0_data(uri), (Tcl_Size) ASN1_STRING_length(uri)); } } } else if (distpoint->type == 1) { /* relative-name X509NAME */ STACK_OF(X509_NAME_ENTRY) *sk_relname = distpoint->name.relativename; for (int j = 0; j < sk_X509_NAME_ENTRY_num(sk_relname); j++) { X509_NAME_ENTRY *e = sk_X509_NAME_ENTRY_value(sk_relname, j); ASN1_STRING *d = X509_NAME_ENTRY_get_data(e); LAPPEND_STR(interp, listPtr, (char *) NULL, (char *) ASN1_STRING_data(d), (Tcl_Size) ASN1_STRING_length(d)); } } } CRL_DIST_POINTS_free(crl); } return listPtr; } /* * Get On-line Certificate Status Protocol (OSCP) URL */ Tcl_Obj *Tls_x509Oscp(Tcl_Interp *interp, X509 *cert) { STACK_OF(OPENSSL_STRING) *ocsp; Tcl_Obj *listPtr = Tcl_NewListObj(0, NULL); if (listPtr == NULL) { return NULL; } if ((ocsp = X509_get1_ocsp(cert)) != NULL) { for (int i = 0; i < sk_OPENSSL_STRING_num(ocsp); i++) { LAPPEND_STR(interp, listPtr, NULL, sk_OPENSSL_STRING_value(ocsp, i), -1); } X509_email_free(ocsp); } return listPtr; } /* * Get Certificate Authority (CA) Issuers URL */ Tcl_Obj *Tls_x509CaIssuers(Tcl_Interp *interp, X509 *cert) { STACK_OF(ACCESS_DESCRIPTION) *ads; ACCESS_DESCRIPTION *ad; Tcl_Obj *listPtr = Tcl_NewListObj(0, NULL); unsigned char *buf; int len; if ((ads = X509_get_ext_d2i(cert, NID_info_access, NULL, NULL)) != NULL) { for (int i = 0; i < sk_ACCESS_DESCRIPTION_num(ads); i++) { ad = sk_ACCESS_DESCRIPTION_value(ads, i); if (OBJ_obj2nid(ad->method) == NID_ad_ca_issuers && ad->location) { if (ad->location->type == GEN_URI) { len = ASN1_STRING_to_UTF8(&buf, ad->location->d.uniformResourceIdentifier); Tcl_ListObjAppendElement(interp, listPtr, Tcl_NewStringObj((char *) buf, (Tcl_Size) len)); OPENSSL_free(buf); break; } } } /* sk_ACCESS_DESCRIPTION_pop_free(ads, ACCESS_DESCRIPTION_free); */ AUTHORITY_INFO_ACCESS_free(ads); |
︙ | ︙ | |||
371 372 373 374 375 376 377 378 379 380 381 382 383 384 | */ Tcl_Obj* Tls_NewX509Obj(Tcl_Interp *interp, X509 *cert) { Tcl_Obj *certPtr = Tcl_NewListObj(0, NULL); BIO *bio = BIO_new(BIO_s_mem()); int mdnid, pknid, bits, len; uint32_t xflags; char buffer[BUFSIZ]; unsigned char md[EVP_MAX_MD_SIZE]; unsigned long flags = XN_FLAG_RFC2253 | ASN1_STRFLGS_UTF8_CONVERT; flags &= ~ASN1_STRFLGS_ESC_MSB; if (interp == NULL || cert == NULL || bio == NULL || certPtr == NULL) { | > | 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 | */ Tcl_Obj* Tls_NewX509Obj(Tcl_Interp *interp, X509 *cert) { Tcl_Obj *certPtr = Tcl_NewListObj(0, NULL); BIO *bio = BIO_new(BIO_s_mem()); int mdnid, pknid, bits, len; unsigned int ulen; uint32_t xflags; char buffer[BUFSIZ]; unsigned char md[EVP_MAX_MD_SIZE]; unsigned long flags = XN_FLAG_RFC2253 | ASN1_STRFLGS_UTF8_CONVERT; flags &= ~ASN1_STRFLGS_ESC_MSB; if (interp == NULL || cert == NULL || bio == NULL || certPtr == NULL) { |
︙ | ︙ | |||
394 395 396 397 398 399 400 | const ASN1_BIT_STRING *sig; int sig_nid; X509_get0_signature(&sig, &sig_alg, cert); /* sig_nid = X509_get_signature_nid(cert) */ sig_nid = OBJ_obj2nid(sig_alg->algorithm); LAPPEND_STR(interp, certPtr, "signatureAlgorithm", OBJ_nid2ln(sig_nid), -1); | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | const ASN1_BIT_STRING *sig; int sig_nid; X509_get0_signature(&sig, &sig_alg, cert); /* sig_nid = X509_get_signature_nid(cert) */ sig_nid = OBJ_obj2nid(sig_alg->algorithm); LAPPEND_STR(interp, certPtr, "signatureAlgorithm", OBJ_nid2ln(sig_nid), -1); len = (sig_nid != NID_undef) ? String_to_Hex(sig->data, sig->length, (unsigned char *) buffer, BUFSIZ) : 0; LAPPEND_STR(interp, certPtr, "signatureValue", buffer, (Tcl_Size) len); } /* Version of the encoded certificate - RFC 5280 section 4.1.2.1 */ LAPPEND_LONG(interp, certPtr, "version", X509_get_version(cert)+1); /* Unique number assigned by CA to certificate - RFC 5280 section 4.1.2.2 */ |
︙ | ︙ | |||
429 430 431 432 433 434 435 | /* Subject identifies the entity associated with the public key stored in the subject public key field. RFC 5280 section 4.1.2.6 */ len = BIO_to_Buffer(X509_NAME_print_ex(bio, X509_get_subject_name(cert), 0, flags), bio, buffer, BUFSIZ); LAPPEND_STR(interp, certPtr, "subject", buffer, (Tcl_Size) len); /* SHA1 Digest (Fingerprint) of cert - DER representation */ | | | | | | | | | | | | | | | | 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 | /* Subject identifies the entity associated with the public key stored in the subject public key field. RFC 5280 section 4.1.2.6 */ len = BIO_to_Buffer(X509_NAME_print_ex(bio, X509_get_subject_name(cert), 0, flags), bio, buffer, BUFSIZ); LAPPEND_STR(interp, certPtr, "subject", buffer, (Tcl_Size) len); /* SHA1 Digest (Fingerprint) of cert - DER representation */ if (X509_digest(cert, EVP_sha1(), md, &ulen)) { len = String_to_Hex(md, len, (unsigned char *) buffer, BUFSIZ); LAPPEND_STR(interp, certPtr, "sha1_hash", buffer, (Tcl_Size) ulen); } /* SHA256 Digest (Fingerprint) of cert - DER representation */ if (X509_digest(cert, EVP_sha256(), md, &ulen)) { len = String_to_Hex(md, len, (unsigned char *) buffer, BUFSIZ); LAPPEND_STR(interp, certPtr, "sha256_hash", buffer, (Tcl_Size) ulen); } /* Subject Public Key Info specifies the public key and identifies the algorithm with which the key is used. RFC 5280 section 4.1.2.7 */ if (X509_get_signature_info(cert, &mdnid, &pknid, &bits, &xflags)) { ASN1_BIT_STRING *key; unsigned int n; LAPPEND_STR(interp, certPtr, "signingDigest", OBJ_nid2ln(mdnid), -1); LAPPEND_STR(interp, certPtr, "publicKeyAlgorithm", OBJ_nid2ln(pknid), -1); LAPPEND_INT(interp, certPtr, "bits", bits); /* Effective security bits */ key = X509_get0_pubkey_bitstr(cert); len = String_to_Hex(key->data, key->length, (unsigned char *) buffer, BUFSIZ); LAPPEND_STR(interp, certPtr, "publicKey", buffer, (Tcl_Size) len); len = 0; if (X509_pubkey_digest(cert, EVP_get_digestbynid(pknid), md, &n)) { len = String_to_Hex(md, (int) n, (unsigned char *) buffer, BUFSIZ); } LAPPEND_STR(interp, certPtr, "publicKeyHash", buffer, (Tcl_Size) len); /* digest of the DER representation of the certificate */ len = 0; if (X509_digest(cert, EVP_get_digestbynid(mdnid), md, &n)) { len = String_to_Hex(md, (int) n, (unsigned char *) buffer, BUFSIZ); } LAPPEND_STR(interp, certPtr, "signatureHash", buffer, (Tcl_Size) len); } /* Certificate Purpose. Call before checking for extensions. */ LAPPEND_STR(interp, certPtr, "purpose", Tls_x509Purpose(cert), -1); LAPPEND_OBJ(interp, certPtr, "certificatePurpose", Tls_x509Purposes(interp, cert)); /* Get extensions flags */ xflags = X509_get_extension_flags(cert); LAPPEND_INT(interp, certPtr, "extFlags", xflags); /* Check if cert was issued by CA cert issuer or self signed */ LAPPEND_BOOL(interp, certPtr, "selfIssued", xflags & EXFLAG_SI); LAPPEND_BOOL(interp, certPtr, "selfSigned", xflags & EXFLAG_SS); LAPPEND_BOOL(interp, certPtr, "isProxyCert", xflags & EXFLAG_PROXY); LAPPEND_BOOL(interp, certPtr, "extInvalid", xflags & EXFLAG_INVALID); LAPPEND_BOOL(interp, certPtr, "isCACert", X509_check_ca(cert)); /* The Unique Ids are used to handle the possibility of reuse of subject and/or issuer names over time. RFC 5280 section 4.1.2.8 */ { const ASN1_BIT_STRING *iuid, *suid; X509_get0_uids(cert, &iuid, &suid); Tcl_ListObjAppendElement(interp, certPtr, Tcl_NewStringObj("issuerUniqueId", -1)); if (iuid != NULL) { Tcl_ListObjAppendElement(interp, certPtr, Tcl_NewByteArrayObj((const unsigned char *)iuid->data, (Tcl_Size) iuid->length)); } else { Tcl_ListObjAppendElement(interp, certPtr, Tcl_NewStringObj("", -1)); } Tcl_ListObjAppendElement(interp, certPtr, Tcl_NewStringObj("subjectUniqueId", -1)); if (suid != NULL) { Tcl_ListObjAppendElement(interp, certPtr, Tcl_NewByteArrayObj((const unsigned char *)suid->data, (Tcl_Size) suid->length)); } else { Tcl_ListObjAppendElement(interp, certPtr, Tcl_NewStringObj("", -1)); } } /* X509 v3 Extensions - RFC 5280 section 4.1.2.9 */ LAPPEND_INT(interp, certPtr, "extCount", X509_get_ext_count(cert)); LAPPEND_OBJ(interp, certPtr, "extensions", Tls_x509Extensions(interp, cert)); /* Authority Key Identifier (AKI) is the Subject Key Identifier (SKI) of its signer (the CA). RFC 5280 section 4.2.1.1, NID_authority_key_identifier */ LAPPEND_OBJ(interp, certPtr, "authorityKeyIdentifier", Tls_x509Identifier(X509_get0_authority_key_id(cert))); /* Subject Key Identifier (SKI) is used to identify certificates that contain a particular public key. RFC 5280 section 4.2.1.2, NID_subject_key_identifier */ LAPPEND_OBJ(interp, certPtr, "subjectKeyIdentifier", Tls_x509Identifier(X509_get0_subject_key_id(cert))); /* Key usage extension defines the purpose (e.g., encipherment, signature, certificate signing) of the key in the certificate. RFC 5280 section 4.2.1.3, NID_key_usage */ |
︙ | ︙ | |||
584 585 586 587 588 589 590 | /* Subject Information Access - RFC 5280 section 4.2.2.2, NID_sinfo_access */ /* Certificate Alias. If uses a PKCS#12 structure, alias will reflect the friendlyName attribute (RFC 2985). */ { len = 0; | | | > > | 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 | /* Subject Information Access - RFC 5280 section 4.2.2.2, NID_sinfo_access */ /* Certificate Alias. If uses a PKCS#12 structure, alias will reflect the friendlyName attribute (RFC 2985). */ { len = 0; unsigned char *string = X509_alias_get0(cert, &len); LAPPEND_STR(interp, certPtr, "alias", (char *) string, (Tcl_Size) len); string = X509_keyid_get0 (cert, &len); LAPPEND_STR(interp, certPtr, "keyId", (char *) string, (Tcl_Size) len); } /* Certificate and dump all data */ { char certStr[CERT_STR_SIZE]; /* Get certificate */ |
︙ | ︙ |
Modified tests/all.tcl
from [b91d386182]
to [7643c0fdf5].
︙ | ︙ | |||
16 17 18 19 20 21 22 | if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import ::tcltest::* } # Get common functions if {[file exists [file join $path common.tcl]]} { | | | | | | | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 | if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest namespace import ::tcltest::* } # Get common functions if {[file exists [file join $path common.tcl]]} { source -encoding utf-8 [file join $path common.tcl] } set ::tcltest::testSingleFile false set ::tcltest::testsDirectory [file dir [info script]] # We should ensure that the testsDirectory is absolute. # This was introduced in Tcl 8.3+'s tcltest, so we need a catch. catch {::tcltest::normalizePath ::tcltest::testsDirectory} # # Run all tests in current and any sub directories with an all.tcl file. # set ::exitCode 0 if {[package vsatisfies [package require tcltest] 2.5-]} { if {[::tcltest::runAllTests] == 1} { set ::exitCode 1 } } else { # Hook to determine if any of the tests failed. Then we can exit with the # proper exit code: 0=all passed, 1=one or more failed proc tcltest::cleanupTestsHook {} { variable numTests set ::exitCode [expr {$numTests(Total) == 0 || $numTests(Failed) > 0}] } ::tcltest::runAllTests } # Exit code: 0=all passed, 1=one or more failed exit $::exitCode |
Modified tests/badssl.csv
from [8df90efe9b]
to [152d5864b6].
1 2 | # Group,Name,Constraints,Setup,Body,Cleanup,Match,Result,Output,Error Output,Return Codes command,package require tls,,,,,,,,, | | | | < < | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | # Group,Name,Constraints,Setup,Body,Cleanup,Match,Result,Output,Error Output,Return Codes command,package require tls,,,,,,,,, ,,,,,,,,,, command,# Find default CA certificates directory,,,,,,,,, command,if {[info exists ::env(SSL_CERT_FILE)]} {set ::cafile $::env(SSL_CERT_FILE)} else {set ::cafile [file normalize {C:\Users\Brian\Documents\Source\Build\SSL-1.1\certs\cacert.pem}]},,,,,,,,, ,,,,,,,,,, command,# Constraints,,,,,,,,, command,source [file join [file dirname [info script]] common.tcl],,,,,,,,, ,,,,,,,,,, command,# Helper functions,,,,,,,,, command,"proc badssl {url} {set port 443;lassign [split $url "":""] url port;if {$port eq """"} {set port 443};set ch [tls::socket -autoservername 1 -require 1 -cafile $::cafile $url $port];if {[catch {tls::handshake $ch} err]} {close $ch;return -code error $err} else {close $ch}}",,,,,,,,, ,,,,,,,,,, command,# BadSSL.com Tests,,,,,,,,, BadSSL,1000-sans,,,badssl 1000-sans.badssl.com,,,handshake failed: certificate verify failed due to: certificate has expired,,,1 BadSSL,10000-sans,,,badssl 10000-sans.badssl.com,,,handshake failed: excessive message size,,,1 BadSSL,3des,,,badssl 3des.badssl.com,,,handshake failed: sslv3 alert handshake failure,,,1 BadSSL,captive-portal,,,badssl captive-portal.badssl.com,,,handshake failed: certificate verify failed due to: Hostname mismatch,,,1 BadSSL,cbc,,,badssl cbc.badssl.com,,,,,, BadSSL,client-cert-missing,,,badssl client-cert-missing.badssl.com,,,,,, |
︙ | ︙ |
Modified tests/badssl.test
from [66893a8fa7]
to [62a312d78a].
︙ | ︙ | |||
10 11 12 13 14 15 16 | package require tls # Find default CA certificates directory if {[info exists ::env(SSL_CERT_FILE)]} {set ::cafile $::env(SSL_CERT_FILE)} else {set ::cafile [file normalize {C:\Users\Brian\Documents\Source\Build\SSL-1.1\certs\cacert.pem}]} # Constraints | | < < | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | package require tls # Find default CA certificates directory if {[info exists ::env(SSL_CERT_FILE)]} {set ::cafile $::env(SSL_CERT_FILE)} else {set ::cafile [file normalize {C:\Users\Brian\Documents\Source\Build\SSL-1.1\certs\cacert.pem}]} # Constraints source [file join [file dirname [info script]] common.tcl] # Helper functions proc badssl {url} {set port 443;lassign [split $url ":"] url port;if {$port eq ""} {set port 443};set ch [tls::socket -autoservername 1 -require 1 -cafile $::cafile $url $port];if {[catch {tls::handshake $ch} err]} {close $ch;return -code error $err} else {close $ch}} # BadSSL.com Tests |
︙ | ︙ |
Deleted tests/ciphers.csv version [f4aff3652a].
Deleted tests/ciphers.test version [212c1bf055].
Added tests/common.tcl version [019f917847].
Added tests/digest.csv version [e953e823d3].
Added tests/digest.test version [ee7d628a1a].
Added tests/encrypt.csv version [a8fd540f67].
Added tests/encrypt.test version [30ef9b5ec2].
Added tests/info.csv version [d54aea3b10].
Added tests/info.test version [7b7740348c].
Added tests/kdf.csv version [ecd5209032].
Added tests/kdf.test version [e9cb54f939].
Modified tests/make_test_files.tcl
from [c31b96320d]
to [e265399d3c].
︙ | ︙ | |||
70 71 72 73 74 75 76 | if {$group ne $prev} { incr test set prev $group puts $out "" } # Test case | > | > > > | > | 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | if {$group ne $prev} { incr test set prev $group puts $out "" } # Test case if {[string index $name 0] ne {$}} { set buffer [format "\ntest %s-%d.%d {%s}" $group $test [incr cases($group)] $name] } else { set buffer [format "\ntest %s-%d.%d %s" $group $test [incr cases($group)] $name] } foreach opt [list -constraints -setup -body -cleanup -match -result -output -errorOutput -returnCodes] { set cmd [string trim [set [string trimleft $opt "-"]]] if {$cmd ne ""} { if {$opt in [list -setup -body -cleanup]} { append buffer " " $opt " \{\n" foreach line [split $cmd ";"] { append buffer \t [string trim $line] \n } append buffer " \}" } elseif {$opt in [list -output -errorOutput]} { append buffer " " $opt " {" $cmd \n "}" } elseif {$opt in [list -result]} { if {[string index $cmd 0] in [list \[ \" \{ \$]} { append buffer " " $opt " " $cmd } elseif {[string match {*[\\$]*} $cmd]} { append buffer " " $opt " \"" [string map [list \\\\\" \\\"] [string map [list \" \\\" ] $cmd]] "\"" } else { append buffer " " $opt " {" $cmd "}" } } else { append buffer " " $opt " {" $cmd "}" } } } puts $out $buffer } else { # Empty line puts $out "" } break } } # Output clean-up commands puts $out "\n# Cleanup\n::tcltest::cleanupTests\nreturn" |
︙ | ︙ |
Added tests/random.csv version [354daf498a].
Added tests/random.test version [13cb064c8c].
Added tests/test_vectors/Hash/BLAKE2b512.test version [8e818cab70].
Added tests/test_vectors/Hash/BLAKE2b512.txt version [d3c92f5aad].
Added tests/test_vectors/Hash/BLAKE2s256.test version [0d1c096bbe].
Added tests/test_vectors/Hash/BLAKE2s256.txt version [e3f8f87e87].
Added tests/test_vectors/Hash/MD2.test version [99bc7b516b].
Added tests/test_vectors/Hash/MD2.txt version [72dbd4087b].
Added tests/test_vectors/Hash/MD4.test version [467c08c34a].
Added tests/test_vectors/Hash/MD4.txt version [e0a9e8ce64].
Added tests/test_vectors/Hash/MD5.test version [4a3b7c9208].
Added tests/test_vectors/Hash/MD5.txt version [1f89db3968].
Added tests/test_vectors/Hash/MDC2.test version [9cb43c6d6f].
Added tests/test_vectors/Hash/MDC2.txt version [c90b9728d3].
Added tests/test_vectors/Hash/RIPEMD128.test version [d7315ba5f4].
Added tests/test_vectors/Hash/RIPEMD128.txt version [8200be1de0].
Added tests/test_vectors/Hash/RIPEMD160.test version [e06ba4b6d7].
Added tests/test_vectors/Hash/RIPEMD160.txt version [822adc817c].
Added tests/test_vectors/Hash/RIPEMD256.test version [95937b3173].
Added tests/test_vectors/Hash/RIPEMD256.txt version [df8dae9590].
Added tests/test_vectors/Hash/RIPEMD320.test version [fe9e7cfcb5].
Added tests/test_vectors/Hash/RIPEMD320.txt version [c4941d7c67].
Added tests/test_vectors/Hash/Readme.txt version [6c4218a069].
Added tests/test_vectors/Hash/SHA1.test version [bfbdebdc89].
Added tests/test_vectors/Hash/SHA1.txt version [5945652b07].
Added tests/test_vectors/Hash/SHA1LongMsg.rsp version [dbdb8addfb].
Added tests/test_vectors/Hash/SHA1LongMsg.test version [5629c042e7].
Added tests/test_vectors/Hash/SHA1Monte.rsp version [4d2e851fac].
Added tests/test_vectors/Hash/SHA1Monte.txt version [b358759788].
Added tests/test_vectors/Hash/SHA1ShortMsg.rsp version [ed95dce9c8].
Added tests/test_vectors/Hash/SHA1ShortMsg.test version [79a03d8d0f].
Added tests/test_vectors/Hash/SHA224.test version [222cda757d].
Added tests/test_vectors/Hash/SHA224.txt version [8994f85662].
Added tests/test_vectors/Hash/SHA224LongMsg.rsp version [7da7ea8843].
Added tests/test_vectors/Hash/SHA224LongMsg.test version [0be074bfc3].
Added tests/test_vectors/Hash/SHA224Monte.rsp version [5c52dbe5fd].
Added tests/test_vectors/Hash/SHA224Monte.txt version [e24a7320cb].
Added tests/test_vectors/Hash/SHA224ShortMsg.rsp version [81d8b1b6a9].
Added tests/test_vectors/Hash/SHA224ShortMsg.test version [e931511d8b].
Added tests/test_vectors/Hash/SHA256.test version [e73af40184].
Added tests/test_vectors/Hash/SHA256.txt version [848f077d7a].
Added tests/test_vectors/Hash/SHA256LongMsg.rsp version [9a9ff814db].
Added tests/test_vectors/Hash/SHA256LongMsg.test version [2a205726a8].
Added tests/test_vectors/Hash/SHA256Monte.rsp version [e791ad56c6].
Added tests/test_vectors/Hash/SHA256Monte.txt version [5cbfa7eac0].
Added tests/test_vectors/Hash/SHA256ShortMsg.rsp version [cc5e6df184].
Added tests/test_vectors/Hash/SHA256ShortMsg.test version [3c579310ba].
Added tests/test_vectors/Hash/SHA3-224.test version [0197fd6ae2].
Added tests/test_vectors/Hash/SHA3-224.txt version [0a9192723b].
Added tests/test_vectors/Hash/SHA3-256.test version [97ef336193].
Added tests/test_vectors/Hash/SHA3-256.txt version [48114e564c].
Added tests/test_vectors/Hash/SHA3-384.test version [5173b84b19].
Added tests/test_vectors/Hash/SHA3-384.txt version [37fb9bedac].
Added tests/test_vectors/Hash/SHA3-512.test version [719e522337].
Added tests/test_vectors/Hash/SHA3-512.txt version [abf73210ae].
Added tests/test_vectors/Hash/SHA384.test version [812b725c9b].
Added tests/test_vectors/Hash/SHA384.txt version [a59fdbd28c].
Added tests/test_vectors/Hash/SHA384LongMsg.rsp version [68bddc79c6].
Added tests/test_vectors/Hash/SHA384LongMsg.test version [e10e588e6c].
Added tests/test_vectors/Hash/SHA384Monte.rsp version [81ad726d0a].
Added tests/test_vectors/Hash/SHA384Monte.txt version [eb4d039dbb].
Added tests/test_vectors/Hash/SHA384ShortMsg.rsp version [20b46919ed].
Added tests/test_vectors/Hash/SHA384ShortMsg.test version [b756234b7b].
Added tests/test_vectors/Hash/SHA3_224LongMsg.rsp version [168d15a8b0].
Added tests/test_vectors/Hash/SHA3_224LongMsg.test version [38b62e20fc].
Added tests/test_vectors/Hash/SHA3_224Monte.rsp version [423c5d169a].
Added tests/test_vectors/Hash/SHA3_224ShortMsg.rsp version [953ebf8b62].
Added tests/test_vectors/Hash/SHA3_224ShortMsg.test version [9847c1b7e5].
Added tests/test_vectors/Hash/SHA3_256LongMsg.rsp version [e4cdbd523e].
Added tests/test_vectors/Hash/SHA3_256LongMsg.test version [dfe94a5f89].
Added tests/test_vectors/Hash/SHA3_256Monte.rsp version [8f24bb96f6].
Added tests/test_vectors/Hash/SHA3_256ShortMsg.rsp version [c3416d5f3b].
Added tests/test_vectors/Hash/SHA3_256ShortMsg.test version [f41fb70fc3].
Added tests/test_vectors/Hash/SHA3_384LongMsg.rsp version [f10abc91a6].
Added tests/test_vectors/Hash/SHA3_384LongMsg.test version [72042f9981].
Added tests/test_vectors/Hash/SHA3_384Monte.rsp version [76ef953968].
Added tests/test_vectors/Hash/SHA3_384ShortMsg.rsp version [a36843bb9b].
Added tests/test_vectors/Hash/SHA3_384ShortMsg.test version [0c5d1a014d].
Added tests/test_vectors/Hash/SHA3_512LongMsg.rsp version [0bbf186754].
Added tests/test_vectors/Hash/SHA3_512LongMsg.test version [3f873b49ae].
Added tests/test_vectors/Hash/SHA3_512Monte.rsp version [7d4535045e].
Added tests/test_vectors/Hash/SHA3_512ShortMsg.rsp version [704cd930ab].
Added tests/test_vectors/Hash/SHA3_512ShortMsg.test version [364a0e00c9].
Added tests/test_vectors/Hash/SHA512-224.test version [d9c580556e].
Added tests/test_vectors/Hash/SHA512-224.txt version [2c6688a4b5].
Added tests/test_vectors/Hash/SHA512-256.test version [02704532c4].
Added tests/test_vectors/Hash/SHA512-256.txt version [8c9d8ea3f3].
Added tests/test_vectors/Hash/SHA512.test version [1888d3a9e6].
Added tests/test_vectors/Hash/SHA512.txt version [6130019457].
Added tests/test_vectors/Hash/SHA512LongMsg.rsp version [7b0b7120f4].
Added tests/test_vectors/Hash/SHA512LongMsg.test version [624105ec59].
Added tests/test_vectors/Hash/SHA512Monte.rsp version [b59d6599c8].
Added tests/test_vectors/Hash/SHA512Monte.txt version [8b33951465].
Added tests/test_vectors/Hash/SHA512ShortMsg.rsp version [9ea217fd07].
Added tests/test_vectors/Hash/SHA512ShortMsg.test version [0e3b80ebaf].
Added tests/test_vectors/Hash/SHA512_224LongMsg.rsp version [e09f1924d5].
Added tests/test_vectors/Hash/SHA512_224LongMsg.test version [172b15b0f6].
Added tests/test_vectors/Hash/SHA512_224Monte.rsp version [35cbf23f88].
Added tests/test_vectors/Hash/SHA512_224Monte.txt version [ac358a4d14].
Added tests/test_vectors/Hash/SHA512_224ShortMsg.rsp version [bfcfe7aae4].
Added tests/test_vectors/Hash/SHA512_224ShortMsg.test version [8d641d96bf].
Added tests/test_vectors/Hash/SHA512_256LongMsg.rsp version [0c7527584a].
Added tests/test_vectors/Hash/SHA512_256LongMsg.test version [2cd108e888].
Added tests/test_vectors/Hash/SHA512_256Monte.rsp version [a9f88d891a].
Added tests/test_vectors/Hash/SHA512_256Monte.txt version [a96020f051].
Added tests/test_vectors/Hash/SHA512_256ShortMsg.rsp version [99d45606e7].
Added tests/test_vectors/Hash/SHA512_256ShortMsg.test version [74c616e36d].
Added tests/test_vectors/Hash/SHAKE128.test version [358b30bc0f].
Added tests/test_vectors/Hash/SHAKE128.txt version [0a5deb8560].
Added tests/test_vectors/Hash/SHAKE128LongMsg.rsp version [3e240fc1bf].
Added tests/test_vectors/Hash/SHAKE128LongMsg.test version [d00d2eae4f].
Added tests/test_vectors/Hash/SHAKE128Monte.rsp version [578e911e6e].
Added tests/test_vectors/Hash/SHAKE128ShortMsg.rsp version [353efe20e1].
Added tests/test_vectors/Hash/SHAKE128ShortMsg.test version [28b762cb6c].
Added tests/test_vectors/Hash/SHAKE128VariableOut.rsp version [daf50013d2].
Added tests/test_vectors/Hash/SHAKE256.test version [0cd1f0de19].
Added tests/test_vectors/Hash/SHAKE256.txt version [4480b876cb].
Added tests/test_vectors/Hash/SHAKE256LongMsg.rsp version [8cca1f96ad].
Added tests/test_vectors/Hash/SHAKE256LongMsg.test version [42d4bd0d09].
Added tests/test_vectors/Hash/SHAKE256Monte.rsp version [cbb56034d0].
Added tests/test_vectors/Hash/SHAKE256ShortMsg.rsp version [72834c5f7f].
Added tests/test_vectors/Hash/SHAKE256ShortMsg.test version [cf85a2a49f].
Added tests/test_vectors/Hash/SHAKE256VariableOut.rsp version [8811fe0aa0].
Added tests/test_vectors/Hash/SM3.test version [7ee5f4974a].
Added tests/test_vectors/Hash/SM3.txt version [79643d2e88].
Added tests/test_vectors/Hash/WHIRLPOOL.test version [922707888e].
Added tests/test_vectors/Hash/WHIRLPOOL.txt version [11ce31a497].
Added tests/test_vectors/Hash/all.tcl version [4b0e755a54].
Added tests/test_vectors/Hash/make_test.tcl version [dae86e37f5].
Added tests/test_vectors/KDF/HKDF-SHA1.test version [58a3106b11].
Added tests/test_vectors/KDF/HKDF-SHA1.txt version [091164e5bd].
Added tests/test_vectors/KDF/HKDF-SHA224.test version [a35e08ae37].
Added tests/test_vectors/KDF/HKDF-SHA224.txt version [e1709aae8b].
Added tests/test_vectors/KDF/HKDF-SHA256.test version [3fa42bc239].
Added tests/test_vectors/KDF/HKDF-SHA256.txt version [df67ce3539].
Added tests/test_vectors/KDF/HKDF-SHA384.test version [6b50020add].
Added tests/test_vectors/KDF/HKDF-SHA384.txt version [cb2eac62b3].
Added tests/test_vectors/KDF/HKDF-SHA512.test version [d9f36ba84c].
Added tests/test_vectors/KDF/HKDF-SHA512.txt version [3b3b416e62].
Added tests/test_vectors/KDF/PBKDF2-SHA1.test version [629c4d4319].
Added tests/test_vectors/KDF/PBKDF2-SHA1.txt version [732437c2e8].
Added tests/test_vectors/KDF/PBKDF2-SHA224.test version [fe10f4af17].
Added tests/test_vectors/KDF/PBKDF2-SHA224.txt version [f5f610fe64].
Added tests/test_vectors/KDF/PBKDF2-SHA256.test version [cc7be086d5].
Added tests/test_vectors/KDF/PBKDF2-SHA256.txt version [ecc15b287a].
Added tests/test_vectors/KDF/PBKDF2-SHA384.test version [870e72f47c].
Added tests/test_vectors/KDF/PBKDF2-SHA384.txt version [57fec8e1a5].
Added tests/test_vectors/KDF/PBKDF2-SHA512.test version [4a00a74de4].
Added tests/test_vectors/KDF/PBKDF2-SHA512.txt version [35b0e900f6].
Added tests/test_vectors/KDF/Scrypt.test version [f179668ce8].
Added tests/test_vectors/KDF/Scrypt.txt version [fcdaf5e551].
Added tests/test_vectors/KDF/all.tcl version [4b0e755a54].
Added tests/test_vectors/KDF/make_test.tcl version [260d7b3ffd].
Added tests/test_vectors/MAC/CMAC-AES-128-CBC.test version [3a9c3f08a3].
Added tests/test_vectors/MAC/CMAC-AES-128-CBC.txt version [e79fc9b070].
Added tests/test_vectors/MAC/CMAC-AES-192-CBC.test version [a24d68ab1b].
Added tests/test_vectors/MAC/CMAC-AES-192-CBC.txt version [1327ebd19f].
Added tests/test_vectors/MAC/CMAC-AES-256-CBC.test version [636f80d051].
Added tests/test_vectors/MAC/CMAC-AES-256-CBC.txt version [37559b28d2].
Added tests/test_vectors/MAC/CMAC-DES3.test version [341b1fef8a].
Added tests/test_vectors/MAC/CMAC-DES3.txt version [7b40c26c2f].
Added tests/test_vectors/MAC/HMAC.rsp version [23d90fe189].
Added tests/test_vectors/MAC/HMAC.test version [3f775f13fb].
Added tests/test_vectors/MAC/HMAC_MD5.test version [bda682a8ec].
Added tests/test_vectors/MAC/HMAC_MD5.txt version [28320e2e15].
Added tests/test_vectors/MAC/HMAC_RIPEMD128.test version [d9301fcecf].
Added tests/test_vectors/MAC/HMAC_RIPEMD128.txt version [3e487cc771].
Added tests/test_vectors/MAC/HMAC_RIPEMD160.test version [a79db16564].
Added tests/test_vectors/MAC/HMAC_RIPEMD160.txt version [bb21e99891].
Added tests/test_vectors/MAC/HMAC_SHA1.test version [3eee92fdc9].
Added tests/test_vectors/MAC/HMAC_SHA1.txt version [bbeb4deaa9].
Added tests/test_vectors/MAC/HMAC_SHA224.test version [42a431f4b0].
Added tests/test_vectors/MAC/HMAC_SHA224.txt version [55c849f12e].
Added tests/test_vectors/MAC/HMAC_SHA256.test version [42297378eb].
Added tests/test_vectors/MAC/HMAC_SHA256.txt version [32c296d1a9].
Added tests/test_vectors/MAC/HMAC_SHA3-224.test version [5684f09a47].
Added tests/test_vectors/MAC/HMAC_SHA3-224.txt version [7733ead9c2].
Added tests/test_vectors/MAC/HMAC_SHA3-256.test version [fc1173d064].
Added tests/test_vectors/MAC/HMAC_SHA3-256.txt version [c17f79ca22].
Added tests/test_vectors/MAC/HMAC_SHA3-384.test version [ad0d13b496].
Added tests/test_vectors/MAC/HMAC_SHA3-384.txt version [8df953a228].
Added tests/test_vectors/MAC/HMAC_SHA3-512.test version [3e50a3d7da].
Added tests/test_vectors/MAC/HMAC_SHA3-512.txt version [a1ac4ceeaf].
Added tests/test_vectors/MAC/HMAC_SHA384.test version [3a67faccd9].
Added tests/test_vectors/MAC/HMAC_SHA384.txt version [28134b68af].
Added tests/test_vectors/MAC/HMAC_SHA512.test version [4ce64d21bf].
Added tests/test_vectors/MAC/HMAC_SHA512.txt version [ffd58ca5b8].
Added tests/test_vectors/MAC/all.tcl version [4b0e755a54].
Added tests/test_vectors/MAC/make_test.tcl version [6510cbad4a].
Added tests/test_vectors/all.tcl version [4b0e755a54].
Modified win/makefile.vc
from [11d5b7bf2c]
to [75e334f091].
︙ | ︙ | |||
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | # Define the object files and resource file that make up the extension. # Note the resource file does not makes sense if doing a static library build # hence it is under that condition. TMP_DIR is the output directory # defined by rules for object files. PRJ_OBJS = $(TMP_DIR)\tls.obj \ $(TMP_DIR)\tlsBIO.obj \ $(TMP_DIR)\tlsIO.obj \ $(TMP_DIR)\tlsX509.obj # Define any additional project include flags # SSL_INSTALL_FOLDER = with the OpenSSL installation folder following. PRJ_INCLUDES = -I"$(SSL_INSTALL_FOLDER)\include" -I"$(OPENSSL_INSTALL_DIR)\include" # Define any additional compiler flags that might be required for the project PRJ_DEFINES = -D NO_SSL2 -D NO_SSL3 -D _CRT_SECURE_NO_WARNINGS | > > > > > > | > > > > > | 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | # Define the object files and resource file that make up the extension. # Note the resource file does not makes sense if doing a static library build # hence it is under that condition. TMP_DIR is the output directory # defined by rules for object files. PRJ_OBJS = $(TMP_DIR)\tls.obj \ $(TMP_DIR)\tlsBIO.obj \ $(TMP_DIR)\tlsDigest.obj \ $(TMP_DIR)\tlsEncrypt.obj \ $(TMP_DIR)\tlsInfo.obj \ $(TMP_DIR)\tlsIO.obj \ $(TMP_DIR)\tlsKDF.obj \ $(TMP_DIR)\tlsRand.obj \ $(TMP_DIR)\tlsUtil.obj \ $(TMP_DIR)\tlsX509.obj # Define any additional project include flags # SSL_INSTALL_FOLDER = with the OpenSSL installation folder following. PRJ_INCLUDES = -I"$(SSL_INSTALL_FOLDER)\include" -I"$(OPENSSL_INSTALL_DIR)\include" # Define any additional compiler flags that might be required for the project PRJ_DEFINES = -D NO_SSL2 -D NO_SSL3 -D _CRT_SECURE_NO_WARNINGS # # SSL Libs: # 1. ${LIBCRYPTO}.dll # 2. ${LIBSSL}.dll # Where LIBCRYPTO (#1.) and LIBSSL (#2.) are defined as follows: # v1.1: libcrypto-1.1-x64.dll and libssl-1.1-x64.dll # v3: libcrypto-3-x64.dll and libssl-3-x64.dll # On *nix libcrypto.so.* and libssl.so.* (where suffix is a version indicator). # PRJ_LIBS = \ "$(SSL_INSTALL_FOLDER)\lib\libssl.lib" \ "$(SSL_INSTALL_FOLDER)\lib\libcrypto.lib" \ WS2_32.LIB GDI32.LIB ADVAPI32.LIB CRYPT32.LIB USER32.LIB # Define the standard targets !include "targets.vc" # Project specific targets all: clean: default-clean # We must define a pkgindex target that will create a pkgIndex.tcl # file in the $(OUT_DIR) directory. We can just redirect to the # default-pkgindex target for our sample extension. pkgindex: default-pkgindex # The default install target only installs binaries and scripts so add # an additional target for our documentation. Note this *adds* a target # since no commands are listed after it. The original targets for # install (from targets.vc) will remain. install: default-pkgindex-tea default-install default-install-docs-html # Test package test: default-test |