mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-10-31 11:40:51 -04:00 
			
		
		
		
	Fix SSL tests scripts with recent OpenSSL server with Diffie-Hellman
Our interoperability tests fail with a recent OpenSSL server. The reason is that they force 1024-bit Diffie-Hellman parameters, which recent OpenSSL (e.g. 1.1.1f on Ubuntu 20.04) reject: ``` 140072814650688:error:1408518A:SSL routines:ssl3_ctx_ctrl:dh key too small:../ssl/s3_lib.c:3782: ``` We've been passing custom DH parameters since 6195767554da332e9f81e6510b07f7565ff8a538 because OpenSSL <=1.0.2a requires it. This is only concerns the version we use as OPENSSL_LEGACY. So only use custom DH parameters for that version. In compat.sh, use it based on the observed version of $OPENSSL_CMD. This way, ssl-opt.sh and compat.sh work (barring other issues) for all our reference versions of OpenSSL as well as for a modern system OpenSSL. Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
		
							parent
							
								
									12f93f4fc2
								
							
						
					
					
						commit
						96f5baecec
					
				| @ -871,10 +871,23 @@ setup_arguments() | |||||||
|     fi |     fi | ||||||
| 
 | 
 | ||||||
|     M_SERVER_ARGS="server_port=$PORT server_addr=0.0.0.0 force_version=$MODE" |     M_SERVER_ARGS="server_port=$PORT server_addr=0.0.0.0 force_version=$MODE" | ||||||
|     O_SERVER_ARGS="-accept $PORT -cipher NULL,ALL -$MODE -dhparam data_files/dhparams.pem" |     O_SERVER_ARGS="-accept $PORT -cipher NULL,ALL -$MODE" | ||||||
|     G_SERVER_ARGS="-p $PORT --http $G_MODE" |     G_SERVER_ARGS="-p $PORT --http $G_MODE" | ||||||
|     G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+SHA256:+SHA384:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE" |     G_SERVER_PRIO="NORMAL:${G_PRIO_CCM}+NULL:+MD5:+PSK:+DHE-PSK:+ECDHE-PSK:+SHA256:+SHA384:+RSA-PSK:-VERS-TLS-ALL:$G_PRIO_MODE" | ||||||
| 
 | 
 | ||||||
|  |     # The default prime for `openssl s_server` depends on the version: | ||||||
|  |     # * OpenSSL <= 1.0.2a: 512-bit | ||||||
|  |     # * OpenSSL 1.0.2b to 1.1.1b: 1024-bit | ||||||
|  |     # * OpenSSL >= 1.1.1c: 2048-bit | ||||||
|  |     # Mbed TLS wants >=1024, so force that for older versions. Don't force | ||||||
|  |     # it for newer versions, which reject a 1024-bit prime. Indifferently | ||||||
|  |     # force it or not for intermediate versions. | ||||||
|  |     case $($OPENSSL_CMD version) in | ||||||
|  |         "OpenSSL 1.0"*) | ||||||
|  |             O_SERVER_ARGS="$O_SERVER_ARGS -dhparam data_files/dhparams.pem" | ||||||
|  |             ;; | ||||||
|  |     esac | ||||||
|  | 
 | ||||||
|     # with OpenSSL 1.0.1h, -www, -WWW and -HTTP break DTLS handshakes |     # with OpenSSL 1.0.1h, -www, -WWW and -HTTP break DTLS handshakes | ||||||
|     if is_dtls "$MODE"; then |     if is_dtls "$MODE"; then | ||||||
|         O_SERVER_ARGS="$O_SERVER_ARGS" |         O_SERVER_ARGS="$O_SERVER_ARGS" | ||||||
|  | |||||||
| @ -1197,7 +1197,7 @@ SRV_DELAY_SECONDS=0 | |||||||
| P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT" | P_SRV="$P_SRV server_addr=127.0.0.1 server_port=$SRV_PORT" | ||||||
| P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT" | P_CLI="$P_CLI server_addr=127.0.0.1 server_port=+SRV_PORT" | ||||||
| P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT ${SEED:+"seed=$SEED"}" | P_PXY="$P_PXY server_addr=127.0.0.1 server_port=$SRV_PORT listen_addr=127.0.0.1 listen_port=$PXY_PORT ${SEED:+"seed=$SEED"}" | ||||||
| O_SRV="$O_SRV -accept $SRV_PORT -dhparam data_files/dhparams.pem" | O_SRV="$O_SRV -accept $SRV_PORT" | ||||||
| O_CLI="$O_CLI -connect localhost:+SRV_PORT" | O_CLI="$O_CLI -connect localhost:+SRV_PORT" | ||||||
| G_SRV="$G_SRV -p $SRV_PORT" | G_SRV="$G_SRV -p $SRV_PORT" | ||||||
| G_CLI="$G_CLI -p +SRV_PORT" | G_CLI="$G_CLI -p +SRV_PORT" | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Gilles Peskine
						Gilles Peskine