Compare commits
	
		
			1 Commits
		
	
	
		
			v7.9.6
			...
			feature/ma
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					8192da790f | 
@@ -146,10 +146,54 @@ namespace ix
 | 
			
		||||
 | 
			
		||||
    bool SocketAppleSSL::accept(std::string& errMsg)
 | 
			
		||||
    {
 | 
			
		||||
        errMsg = "TLS not supported yet in server mode with apple ssl backend";
 | 
			
		||||
        OSStatus status;
 | 
			
		||||
        {
 | 
			
		||||
            std::lock_guard<std::mutex> lock(_mutex);
 | 
			
		||||
 | 
			
		||||
            _sslContext = SSLCreateContext(kCFAllocatorDefault, kSSLServerSide, kSSLStreamType);
 | 
			
		||||
 | 
			
		||||
            SSLSetIOFuncs(_sslContext, SocketAppleSSL::readFromSocket, SocketAppleSSL::writeToSocket);
 | 
			
		||||
            SSLSetConnection(_sslContext, (SSLConnectionRef)(long) _sockfd);
 | 
			
		||||
            SSLSetProtocolVersionMin(_sslContext, kTLSProtocol12);
 | 
			
		||||
 | 
			
		||||
            if (_tlsOptions.isPeerVerifyDisabled())
 | 
			
		||||
            {
 | 
			
		||||
                Boolean option(1);
 | 
			
		||||
                SSLSetSessionOption(_sslContext, kSSLSessionOptionBreakOnServerAuth, option);
 | 
			
		||||
 | 
			
		||||
                do
 | 
			
		||||
                {
 | 
			
		||||
                    status = SSLHandshake(_sslContext);
 | 
			
		||||
                } while (errSSLWouldBlock == status || errSSLServerAuthCompleted == status);
 | 
			
		||||
 | 
			
		||||
                if (status == errSSLServerAuthCompleted)
 | 
			
		||||
                {
 | 
			
		||||
                    // proceed with the handshake
 | 
			
		||||
                    do
 | 
			
		||||
                    {
 | 
			
		||||
                        status = SSLHandshake(_sslContext);
 | 
			
		||||
                    } while (errSSLWouldBlock == status || errSSLServerAuthCompleted == status);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            else
 | 
			
		||||
            {
 | 
			
		||||
                do
 | 
			
		||||
                {
 | 
			
		||||
                    status = SSLHandshake(_sslContext);
 | 
			
		||||
                } while (errSSLWouldBlock == status || errSSLServerAuthCompleted == status);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if (noErr != status)
 | 
			
		||||
        {
 | 
			
		||||
            errMsg = getSSLErrorDescription(status);
 | 
			
		||||
            close();
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // No wait support
 | 
			
		||||
    bool SocketAppleSSL::connect(const std::string& host,
 | 
			
		||||
                                 int port,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user