mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-04 04:32:24 -05:00 
			
		
		
		
	Swap branches accepting/refusing renegotiation in in ssl_read
This commit is contained in:
		
							parent
							
								
									88f5808c13
								
							
						
					
					
						commit
						b4ff0aafd9
					
				@ -6921,11 +6921,32 @@ int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len )
 | 
				
			|||||||
#endif /* MBEDTLS_SSL_SRV_C */
 | 
					#endif /* MBEDTLS_SSL_SRV_C */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            /* Determine whether renegotiation attempt should be accepted */
 | 
					            /* Determine whether renegotiation attempt should be accepted */
 | 
				
			||||||
 | 
					            if( ! ( ssl->conf->disable_renegotiation == MBEDTLS_SSL_RENEGOTIATION_DISABLED ||
 | 
				
			||||||
            if( ssl->conf->disable_renegotiation == MBEDTLS_SSL_RENEGOTIATION_DISABLED ||
 | 
					 | 
				
			||||||
                    ( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
 | 
					                    ( ssl->secure_renegotiation == MBEDTLS_SSL_LEGACY_RENEGOTIATION &&
 | 
				
			||||||
                      ssl->conf->allow_legacy_renegotiation ==
 | 
					                      ssl->conf->allow_legacy_renegotiation ==
 | 
				
			||||||
                                                MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION ) )
 | 
					                                                   MBEDTLS_SSL_LEGACY_NO_RENEGOTIATION ) ) )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                /*
 | 
				
			||||||
 | 
					                 * Accept renegotiation request
 | 
				
			||||||
 | 
					                 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                /* DTLS clients need to know renego is server-initiated */
 | 
				
			||||||
 | 
					#if defined(MBEDTLS_SSL_PROTO_DTLS)
 | 
				
			||||||
 | 
					                if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
 | 
				
			||||||
 | 
					                    ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    ssl->renego_status = MBEDTLS_SSL_RENEGOTIATION_PENDING;
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
 | 
					                ret = ssl_start_renegotiation( ssl );
 | 
				
			||||||
 | 
					                if( ret != MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO &&
 | 
				
			||||||
 | 
					                    ret != 0 )
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    MBEDTLS_SSL_DEBUG_RET( 1, "ssl_start_renegotiation", ret );
 | 
				
			||||||
 | 
					                    return( ret );
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                /*
 | 
					                /*
 | 
				
			||||||
                 * Refuse renegotiation
 | 
					                 * Refuse renegotiation
 | 
				
			||||||
@ -6963,28 +6984,6 @@ int mbedtls_ssl_read( mbedtls_ssl_context *ssl, unsigned char *buf, size_t len )
 | 
				
			|||||||
                    return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
 | 
					                    return( MBEDTLS_ERR_SSL_INTERNAL_ERROR );
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					 | 
				
			||||||
            {
 | 
					 | 
				
			||||||
                /*
 | 
					 | 
				
			||||||
                 * Accept renegotiation request
 | 
					 | 
				
			||||||
                 */
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                /* DTLS clients need to know renego is server-initiated */
 | 
					 | 
				
			||||||
#if defined(MBEDTLS_SSL_PROTO_DTLS)
 | 
					 | 
				
			||||||
                if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM &&
 | 
					 | 
				
			||||||
                    ssl->conf->endpoint == MBEDTLS_SSL_IS_CLIENT )
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    ssl->renego_status = MBEDTLS_SSL_RENEGOTIATION_PENDING;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
#endif
 | 
					 | 
				
			||||||
                ret = ssl_start_renegotiation( ssl );
 | 
					 | 
				
			||||||
                if( ret != MBEDTLS_ERR_SSL_WAITING_SERVER_HELLO_RENEGO &&
 | 
					 | 
				
			||||||
                    ret != 0 )
 | 
					 | 
				
			||||||
                {
 | 
					 | 
				
			||||||
                    MBEDTLS_SSL_DEBUG_RET( 1, "ssl_start_renegotiation", ret );
 | 
					 | 
				
			||||||
                    return( ret );
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
            }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return( MBEDTLS_ERR_SSL_WANT_READ );
 | 
					            return( MBEDTLS_ERR_SSL_WANT_READ );
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user