Changes In Branch tls-server Excluding Merge-Ins
This is equivalent to a diff from 33dbefb035 to 43864736e7
2024-11-16
| ||
22:36 | OFTLSStream: Add API for server mode Leaf check-in: 43864736e7 user: js tags: tls-server | |
14:17 | OFSecureTransportTLSStream: Use more error codes Leaf check-in: 33dbefb035 user: js tags: trunk | |
13:31 | Don't build test plugin as bundle and plugin check-in: 50dce32144 user: js tags: trunk | |
Modified configure.ac from [ce4406a7fa] to [94e207d211].
︙ | |||
1885 1886 1887 1888 1889 1890 1891 | 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 | - - + + | LIBS="-framework Security -framework Foundation $LIBS" AC_CHECK_FUNC(SSLHandshake, [ tls_support="Secure Transport" TLS_LIBS="-framework Foundation $TLS_LIBS" TLS_LIBS="-framework Security $TLS_LIBS" |
︙ | |||
1913 1914 1915 1916 1917 1918 1919 | 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 | - + - - + - + - | esac AC_CHECK_LIB($ssl, SSL_set1_host, [ AC_CHECK_HEADER(openssl/ssl.h, [ tls_support="OpenSSL" TLS_LIBS="-l$ssl -l$crypto $TLS_LIBS" |
︙ |
Modified extra.mk.in from [345fdf7b48] to [dceacd0c39].
︙ | |||
64 65 66 67 68 69 70 | 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | - - - - | OFDNS = @OFDNS@ OFHASH = @OFHASH@ OFHASH_LIBS = @OFHTTP_LIBS@ OFHTTP = @OFHTTP@ OFHTTP_LIBS = @OFHTTP_LIBS@ OF_BLOCK_TESTS_M = @OF_BLOCK_TESTS_M@ OF_EPOLL_KERNEL_EVENT_OBSERVER_M = @OF_EPOLL_KERNEL_EVENT_OBSERVER_M@ |
︙ | |||
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 | 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 118 119 | + + + + | TLS_CPPFLAGS = @TLS_CPPFLAGS@ TLS_LIBS = @TLS_LIBS@ UNICODE_M = @UNICODE_M@ USE_INCLUDES_ATOMIC = @USE_INCLUDES_ATOMIC@ USE_SRCS_APPLETALK = @USE_SRCS_APPLETALK@ USE_SRCS_EVDEV = @USE_SRCS_EVDEV@ USE_SRCS_FILES = @USE_SRCS_FILES@ USE_SRCS_GNUTLS = @USE_SRCS_GNUTLS@ USE_SRCS_IPX = @USE_SRCS_IPX@ USE_SRCS_MBEDTLS = @USE_SRCS_MBEDTLS@ USE_SRCS_NINTENDO_3DS = @USE_SRCS_NINTENDO_3DS@ USE_SRCS_NINTENDO_DS = @USE_SRCS_NINTENDO_DS@ USE_SRCS_NINTENDO_SWITCH = @USE_SRCS_NINTENDO_SWITCH@ USE_SRCS_OPENSSL = @USE_SRCS_OPENSSL@ USE_SRCS_PLUGINS = @USE_SRCS_PLUGINS@ USE_SRCS_SCTP = @USE_SRCS_SCTP@ USE_SRCS_SECURETRANSPORT = @USE_SRCS_SECURETRANSPORT@ USE_SRCS_SOCKETS = @USE_SRCS_SOCKETS@ USE_SRCS_SUBPROCESSES = @USE_SRCS_SUBPROCESSES@ USE_SRCS_TAGGED_POINTERS = @USE_SRCS_TAGGED_POINTERS@ USE_SRCS_THREADS = @USE_SRCS_THREADS@ USE_SRCS_UNIX_SOCKETS = @USE_SRCS_UNIX_SOCKETS@ USE_SRCS_WII = @USE_SRCS_WII@ USE_SRCS_WINDOWS = @USE_SRCS_WINDOWS@ USE_SRCS_XINPUT = @USE_SRCS_XINPUT@ WII_U_TESTS_LIBS = @WII_U_TESTS_LIBS@ WRAPPER = @WRAPPER@ |
Modified src/Makefile from [04dfd40e3e] to [486aeb0a5d].
︙ | |||
148 149 150 151 152 153 154 155 156 157 158 159 160 161 | 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 | + | OFStreamSocket.m \ OFSystemInfo+NetworkInterfaces.m \ OFTCPSocket.m \ OFTLSStream.m \ OFTXTDNSResourceRecord.m \ OFUDPSocket.m \ OFURIDNSResourceRecord.m \ OFX509Certificate.m \ ${USE_SRCS_APPLETALK} \ ${USE_SRCS_IPX} \ ${USE_SRCS_SCTP} \ ${USE_SRCS_UNIX_SOCKETS} SRCS_APPLETALK = OFDDPSocket.m SRCS_IPX = OFIPXSocket.m \ OFSPXSocket.m \ |
︙ |
Modified src/OFTLSStream.h from [c23d19a2a9] to [1a6c8de484].
︙ | |||
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | + + | #import "OFStream.h" #import "OFRunLoop.h" OF_ASSUME_NONNULL_BEGIN /** @file */ @class OFArray OF_GENERIC(ObjectType); @class OFTLSStream; @class OFX509Certificate; /** * @brief An enum representing an error of an OFTLSStream. */ typedef enum { /** @brief An unknown error. */ OFTLSStreamErrorCodeUnknown, |
︙ | |||
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 | 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 82 83 84 85 86 87 | + + + + + + + + + + + + | /** * @protocol OFTLSStreamDelegate OFTLSStream.h ObjFW/ObjFW.h * * A delegate for OFTLSStream. */ @protocol OFTLSStreamDelegate <OFStreamDelegate> @optional /** * @brief A method which is called when a TLS stream performed the client * handshake. * * @param stream The TLS stream which performed the handshake * @param host The host for which the handshake was performed * @param exception An exception that occurred during the handshake, or nil on * success */ - (void)stream: (OFTLSStream *)stream didPerformClientHandshakeWithHost: (OFString *)host exception: (nullable id)exception; /** * @brief A method which is called when a TLS stream performed the server * handshake. * * @param stream The TLS stream which performed the handshake * @param exception An exception that occurred during the handshake, or nil on * success */ - (void)streamDidPerformServerHandshake: (OFTLSStream *)stream exception: (nullable id)exception; @end /** * @class OFTLSStream OFTLSStream.h ObjFW/ObjFW.h * * @brief A class that provides Transport Layer Security on top of a stream. * |
︙ | |||
84 85 86 87 88 89 90 | 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | + - + | */ @interface OFTLSStream: OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> { OFStream <OFReadyForReadingObserving, OFReadyForWritingObserving> *_underlyingStream; bool _verifiesCertificates; OFArray OF_GENERIC(OFX509Certificate *) *_Nullable _certificateChain; |
︙ | |||
107 108 109 110 111 112 113 114 115 116 117 118 119 120 | 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | + + + + + + | id <OFTLSStreamDelegate> delegate; /** * @brief Whether certificates are verified. Default is true. */ @property (nonatomic) bool verifiesCertificates; /** * @brief The certificate chain to use. */ @property OF_NULLABLE_PROPERTY (copy, nonatomic) OFArray OF_GENERIC(OFX509Certificate *) *certificateChain; - (instancetype)init OF_UNAVAILABLE; /** * @brief Creates a new TLS stream with the specified stream as its underlying * stream. * * @param stream The stream to use as underlying stream. Must not be closed |
︙ | |||
165 166 167 168 169 170 171 172 173 174 175 176 177 178 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + | * @brief Performs the TLS client handshake for the specified host. * * @param host The host to perform the handshake with * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)performClientHandshakeWithHost: (OFString *)host; /** * @brief Asynchronously performs the TLS server handshake and calls the * delegate afterwards. * * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)asyncPerformServerHandshake; /** * @brief Asynchronously performs the TLS server handshake and calls the * delegate afterwards. * * @param runLoopMode The run loop mode in which to perform the async handshake * * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)asyncPerformServerHandshakeWithRunLoopMode: (OFRunLoopMode)runLoopMode; /** * @brief Performs the TLS server handshake. * * @throw OFTLSHandshakeFailedException The TLS handshake failed * @throw OFAlreadyOpenException The handshake was already performed */ - (void)performServerHandshake; @end #ifdef __cplusplus extern "C" { #endif /** * @brief The implementation for OFTLSStream to use. |
︙ |
Modified src/OFTLSStream.m from [78c4319f41] to [3b181aebf6].
︙ | |||
16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | + | * version 3.0 along with this program. If not, see * <https://www.gnu.org/licenses/>. */ #include "config.h" #import "OFTLSStream.h" #import "OFArray.h" #import "OFDate.h" #import "OFNotImplementedException.h" #import "OFTLSHandshakeFailedException.h" @interface OFTLSStreamHandshakeDelegate: OFObject <OFTLSStreamDelegate> { |
︙ | |||
76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | + + + + + + + | [super dealloc]; } - (void)stream: (OFTLSStream *)stream didPerformClientHandshakeWithHost: (OFString *)host exception: (id)exception { _done = true; _exception = [exception retain]; } - (void)streamDidPerformServerHandshake: (OFTLSStream *)stream exception: (id)exception { _done = true; _exception = [exception retain]; } @end @implementation OFTLSStream @synthesize underlyingStream = _underlyingStream; |
︙ | |||
140 141 142 143 144 145 146 147 148 149 150 151 152 153 | 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 | + + + + + + + + + + + + + | - (void)close { [_underlyingStream release]; _underlyingStream = nil; [super close]; } - (void)setCertificateChain: (OFArray OF_GENERIC(OFX509Certificate *) *)certificateChain { OFArray OF_GENERIC(OFX509Certificate *) *old = _certificateChain; _certificateChain = [certificateChain copy]; [old release]; } - (OFArray OF_GENERIC(OFX509Certificate *) *)certificateChain { return _certificateChain; } - (size_t)lowlevelReadIntoBuffer: (void *)buffer length: (size_t)length { OF_UNRECOGNIZED_SELECTOR } - (size_t)lowlevelWriteBuffer: (const void *)buffer length: (size_t)length |
︙ | |||
190 191 192 193 194 195 196 197 198 199 200 201 202 203 | 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 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + | [[[OFTLSStreamHandshakeDelegate alloc] init] autorelease]; OFRunLoop *runLoop = [OFRunLoop currentRunLoop]; _delegate = handshakeDelegate; [self asyncPerformClientHandshakeWithHost: host runLoopMode: handshakeRunLoopMode]; while (!handshakeDelegate->_done) [runLoop runMode: handshakeRunLoopMode beforeDate: nil]; /* Cleanup */ [runLoop runMode: handshakeRunLoopMode beforeDate: [OFDate date]]; _delegate = delegate; if (handshakeDelegate->_exception != nil) @throw handshakeDelegate->_exception; objc_autoreleasePoolPop(pool); } - (void)asyncPerformServerHandshake { [self asyncPerformServerHandshakeWithRunLoopMode: OFDefaultRunLoopMode]; } - (void)asyncPerformServerHandshakeWithRunLoopMode: (OFRunLoopMode)runLoopMode { OF_UNRECOGNIZED_SELECTOR } - (void)performServerHandshake { void *pool = objc_autoreleasePoolPush(); id <OFTLSStreamDelegate> delegate = _delegate; OFTLSStreamHandshakeDelegate *handshakeDelegate = [[[OFTLSStreamHandshakeDelegate alloc] init] autorelease]; OFRunLoop *runLoop = [OFRunLoop currentRunLoop]; _delegate = handshakeDelegate; [self asyncPerformServerHandshakeWithRunLoopMode: handshakeRunLoopMode]; while (!handshakeDelegate->_done) [runLoop runMode: handshakeRunLoopMode beforeDate: nil]; /* Cleanup */ [runLoop runMode: handshakeRunLoopMode beforeDate: [OFDate date]]; _delegate = delegate; |
︙ |
Added src/OFX509Certificate.h version [bbdec4f618].
|
Added src/OFX509Certificate.m version [bef6dd357c].
|
Modified src/tls/Makefile from [1c286ab06b] to [24a2c6b174].
1 2 3 4 5 6 7 8 9 10 11 12 | 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 | - - - - + + + + + + + + + | include ../../extra.mk DISTCLEAN = Info.plist SHARED_LIB = ${OBJFWTLS_SHARED_LIB} STATIC_LIB = ${OBJFWTLS_STATIC_LIB} FRAMEWORK = ${OBJFWTLS_FRAMEWORK} LIB_MAJOR = ${OBJFWTLS_LIB_MAJOR} LIB_MINOR = ${OBJFWTLS_LIB_MINOR} LIB_PATCH = ${OBJFWTLS_LIB_PATCH} INCLUDES := ObjFWTLS.h |
︙ |