mirror of
				https://github.com/yuzu-emu/mbedtls.git
				synced 2025-11-04 13:44:49 +00:00 
			
		
		
		
	Add suppport for MD2 to CSR and CRT writing example programs
The example programs programs/x509/cert_req and programs/x509/cert_write (demonstrating the use of X.509 CSR and CRT writing functionality) previously didn't support MD2 signatures. For testing purposes, this commit adds support for MD2 to cert_req, and support for MD2 and MD4 to cert_write.
This commit is contained in:
		
							parent
							
								
									8b3bcbab79
								
							
						
					
					
						commit
						8a0193e619
					
				| 
						 | 
					@ -102,7 +102,7 @@ int main( void )
 | 
				
			||||||
    "                          Add NsCertType even if it is empty\n"    \
 | 
					    "                          Add NsCertType even if it is empty\n"    \
 | 
				
			||||||
    "    md=%%s               default: SHA256\n"       \
 | 
					    "    md=%%s               default: SHA256\n"       \
 | 
				
			||||||
    "                          possible values:\n"     \
 | 
					    "                          possible values:\n"     \
 | 
				
			||||||
    "                          MD4, MD5, SHA1\n"       \
 | 
					    "                          MD2, MD4, MD5, SHA1\n"  \
 | 
				
			||||||
    "                          SHA224, SHA256\n"       \
 | 
					    "                          SHA224, SHA256\n"       \
 | 
				
			||||||
    "                          SHA384, SHA512\n"       \
 | 
					    "                          SHA384, SHA512\n"       \
 | 
				
			||||||
    "\n"
 | 
					    "\n"
 | 
				
			||||||
| 
						 | 
					@ -252,6 +252,13 @@ int main( int argc, char *argv[] )
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
#endif /* MBEDTLS_MD5_C */
 | 
					#endif /* MBEDTLS_MD5_C */
 | 
				
			||||||
 | 
					#if defined(MBEDTLS_MD2_C)
 | 
				
			||||||
 | 
					            if( strcmp( q, "MD2" ) == 0 )
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                opt.md_alg = MBEDTLS_MD_MD2;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else
 | 
				
			||||||
 | 
					#endif /* MBEDTLS_MD2_C */
 | 
				
			||||||
#if defined(MBEDTLS_SHA1_C)
 | 
					#if defined(MBEDTLS_SHA1_C)
 | 
				
			||||||
            if( strcmp( q, "SHA1" ) == 0 )
 | 
					            if( strcmp( q, "SHA1" ) == 0 )
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -372,6 +372,10 @@ int main( int argc, char *argv[] )
 | 
				
			||||||
                opt.md = MBEDTLS_MD_SHA256;
 | 
					                opt.md = MBEDTLS_MD_SHA256;
 | 
				
			||||||
            else if( strcmp( q, "SHA512" ) == 0 )
 | 
					            else if( strcmp( q, "SHA512" ) == 0 )
 | 
				
			||||||
                opt.md = MBEDTLS_MD_SHA512;
 | 
					                opt.md = MBEDTLS_MD_SHA512;
 | 
				
			||||||
 | 
					            else if( strcmp( q, "MD2" ) == 0 )
 | 
				
			||||||
 | 
					                opt.md = MBEDTLS_MD_MD2;
 | 
				
			||||||
 | 
					            else if( strcmp( q, "MD4" ) == 0 )
 | 
				
			||||||
 | 
					                opt.md = MBEDTLS_MD_MD4;
 | 
				
			||||||
            else if( strcmp( q, "MD5" ) == 0 )
 | 
					            else if( strcmp( q, "MD5" ) == 0 )
 | 
				
			||||||
                opt.md = MBEDTLS_MD_MD5;
 | 
					                opt.md = MBEDTLS_MD_MD5;
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue