ObjFW  Check-in [f6cc2092af]

Overview
Comment:Make GCC happy again
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | tls-server
Files: files | file ages | folders
SHA3-256: f6cc2092af2a9dd27bec9c805f10c9c9b57bf27f6d3aab40ed35d3a06b4bb453
User & Date: js on 2024-11-18 00:47:35
Other Links: branch diff | manifest | tags
Context
2024-11-18
00:47
Make GCC happy again Leaf check-in: f6cc2092af user: js tags: tls-server
00:38
OFGnuTLSTLSStream: Add server support check-in: 2cb48ceaf1 user: js tags: tls-server
Changes

Modified src/OFTLSStream.h from [73461e1dca] to [05262420c8].

99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
 */
@interface OFTLSStream: OFStream <OFReadyForReadingObserving,
    OFReadyForWritingObserving>
{
	OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving>
	    *_underlyingStream;
	bool _verifiesCertificates;
	OFArray OF_GENERIC(OF_KINDOF(OFX509Certificate *)) *_Nullable
	    _certificateChain;
	OF_KINDOF(OFX509CertificatePrivateKey *) _Nullable _privateKey;
	OF_RESERVE_IVARS(OFTLSStream, 2)
}

/**
 * @brief The underlying stream.
 */
@property (readonly, nonatomic) OFStream <OFReadyForReadingObserving,







<
|
|







99
100
101
102
103
104
105

106
107
108
109
110
111
112
113
114
 */
@interface OFTLSStream: OFStream <OFReadyForReadingObserving,
    OFReadyForWritingObserving>
{
	OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving>
	    *_underlyingStream;
	bool _verifiesCertificates;

	OFArray OF_GENERIC(OFX509Certificate *) *_Nullable _certificateChain;
	OFX509CertificatePrivateKey *_Nullable _privateKey;
	OF_RESERVE_IVARS(OFTLSStream, 2)
}

/**
 * @brief The underlying stream.
 */
@property (readonly, nonatomic) OFStream <OFReadyForReadingObserving,

Modified src/tls/OFGnuTLSTLSStream.m from [2feefe95de] to [e559b50391].

250
251
252
253
254
255
256


257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
				      errorCode: initFailedErrorCode];

		if (_verifiesCertificates)
			gnutls_session_set_verify_cert(_session, _host.UTF8String, 0);
	}

	if (_certificateChain != nil) {


		OFMutableData *certs = [OFMutableData
		    dataWithItemSize: sizeof(gnutls_x509_crt_t)
			    capacity: _certificateChain.count];

		for (OFGnuTLSX509Certificate *cert in _certificateChain) {
			gnutls_x509_crt_t gnuTLSCert =
			    cert.of_gnuTLSCertificate;
			[certs addItem: &gnuTLSCert];
		}

		if (gnutls_certificate_set_x509_key(_credentials,
		    (gnutls_x509_crt_t *)certs.items, (unsigned int)certs.count,
		    [_privateKey of_gnuTLSPrivateKey]) < 0)
			@throw [OFTLSHandshakeFailedException
			    exceptionWithStream: self
					   host: host
				      errorCode: initFailedErrorCode];
	}

	if (gnutls_credentials_set(_session, GNUTLS_CRD_CERTIFICATE,







>
>












|







250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
				      errorCode: initFailedErrorCode];

		if (_verifiesCertificates)
			gnutls_session_set_verify_cert(_session, _host.UTF8String, 0);
	}

	if (_certificateChain != nil) {
		OFGnuTLSX509CertificatePrivateKey *privateKey =
		    (OFGnuTLSX509CertificatePrivateKey *)_privateKey;
		OFMutableData *certs = [OFMutableData
		    dataWithItemSize: sizeof(gnutls_x509_crt_t)
			    capacity: _certificateChain.count];

		for (OFGnuTLSX509Certificate *cert in _certificateChain) {
			gnutls_x509_crt_t gnuTLSCert =
			    cert.of_gnuTLSCertificate;
			[certs addItem: &gnuTLSCert];
		}

		if (gnutls_certificate_set_x509_key(_credentials,
		    (gnutls_x509_crt_t *)certs.items, (unsigned int)certs.count,
		    privateKey.of_gnuTLSPrivateKey) < 0)
			@throw [OFTLSHandshakeFailedException
			    exceptionWithStream: self
					   host: host
				      errorCode: initFailedErrorCode];
	}

	if (gnutls_credentials_set(_session, GNUTLS_CRD_CERTIFICATE,