mirror of
				https://github.com/Mbed-TLS/mbedtls.git
				synced 2025-11-03 20:33:16 +03:00 
			
		
		
		
	Add explanatory comments to raw DER test data
Break down the DER-encoded ASN.1 test data into its structure in a comment and explain it, to make it easier to understand where the data came from and how it is corrupted. Signed-off-by: David Horstmann <david.horstmann@arm.com>
This commit is contained in:
		@@ -427,9 +427,43 @@ X509 Get Modified DN #5 Name exactly 255 bytes, ending with comma requiring esca
 | 
				
			|||||||
depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C
 | 
					depends_on:MBEDTLS_PEM_PARSE_C:MBEDTLS_RSA_C:MBEDTLS_SHA1_C
 | 
				
			||||||
mbedtls_x509_dn_gets_subject_replace:"data_files/server1.crt":"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234,":"":MBEDTLS_ERR_X509_BUFFER_TOO_SMALL
 | 
					mbedtls_x509_dn_gets_subject_replace:"data_files/server1.crt":"12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234,":"":MBEDTLS_ERR_X509_BUFFER_TOO_SMALL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Parse the following valid DN:
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 31 0B <- Set of
 | 
				
			||||||
 | 
					#     30 09 <- Sequence of
 | 
				
			||||||
 | 
					#         06 03 55 04 06 <- OID 2.5.4.6 countryName (C)
 | 
				
			||||||
 | 
					#         13 02 4E 4C <- PrintableString "NL"
 | 
				
			||||||
 | 
					# 31 11 <- Set of
 | 
				
			||||||
 | 
					#     30 0F <- Sequence of
 | 
				
			||||||
 | 
					#         06 03 55 04 0A <- OID 2.5.4.10 organizationName (O)
 | 
				
			||||||
 | 
					#         0C 08 50 6F 6C 61 72 53 53 4C <- UTF8String "PolarSSL"
 | 
				
			||||||
 | 
					# 31 19 <- Set of
 | 
				
			||||||
 | 
					#     30 17 <- Sequence of
 | 
				
			||||||
 | 
					#         06 03 55 04 03 <- OID 2.5.4.3 commonName (CN)
 | 
				
			||||||
 | 
					#         0C 10 50 6F 6C 61 72 53 53 4C 20 54 65 73 74 20 43 41 <- UTF8String "PolarSSL Test CA"
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
X509 Get Name Valid DN
 | 
					X509 Get Name Valid DN
 | 
				
			||||||
mbedtls_x509_get_name:"310B3009060355040613024E4C3111300F060355040A0C08506F6C617253534C3119301706035504030C10506F6C617253534C2054657374204341":0
 | 
					mbedtls_x509_get_name:"310B3009060355040613024E4C3111300F060355040A0C08506F6C617253534C3119301706035504030C10506F6C617253534C2054657374204341":0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# Parse the following corrupted DN:
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# 31 0B <- Set of
 | 
				
			||||||
 | 
					#     30 09 <- Sequence of
 | 
				
			||||||
 | 
					#         06 03 55 04 06 <- OID 2.5.4.6 countryName (C)
 | 
				
			||||||
 | 
					#         13 02 4E 4C <- PrintableString "NL"
 | 
				
			||||||
 | 
					# 31 11 <- Set of
 | 
				
			||||||
 | 
					#     30 0F <- Sequence of
 | 
				
			||||||
 | 
					#         06 03 55 04 0A <- OID 2.5.4.10 organizationName (O)
 | 
				
			||||||
 | 
					#         0C 08 50 6F 6C 61 72 53 53 4C <- UTF8String "PolarSSL"
 | 
				
			||||||
 | 
					# 30 19 <- Sequence of (corrupted)
 | 
				
			||||||
 | 
					#     30 17 <- Sequence of
 | 
				
			||||||
 | 
					#         06 03 55 04 03 <- OID 2.5.4.3 commonName (CN)
 | 
				
			||||||
 | 
					#         0C 10 50 6F 6C 61 72 53 53 4C 20 54 65 73 74 20 43 41 <- UTF8String "PolarSSL Test CA"
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
 | 
					# The third 'Set of' is corrupted to instead be a 'Sequence of', causing an
 | 
				
			||||||
 | 
					# error and forcing mbedtls_x509_get_name() to clean up the names it has
 | 
				
			||||||
 | 
					# already allocated.
 | 
				
			||||||
 | 
					#
 | 
				
			||||||
X509 Get Name Corrupted DN Mem Leak
 | 
					X509 Get Name Corrupted DN Mem Leak
 | 
				
			||||||
mbedtls_x509_get_name:"310B3009060355040613024E4C3111300F060355040A0C08506F6C617253534C3019301706035504030C10506F6C617253534C2054657374204341":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
 | 
					mbedtls_x509_get_name:"310B3009060355040613024E4C3111300F060355040A0C08506F6C617253534C3019301706035504030C10506F6C617253534C2054657374204341":MBEDTLS_ERR_X509_INVALID_NAME + MBEDTLS_ERR_ASN1_UNEXPECTED_TAG
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user