Revert "removed testing of "stripped" rsa key"
This reverts commit 496453f28920c6f5d657173ed8028d3a73fd5115.
This commit is contained in:
		
							parent
							
								
									7842e338bf
								
							
						
					
					
						commit
						b1f29539be
					
				@ -61,6 +61,18 @@ static const unsigned char openssl_public_rsa[] = {
 | 
			
		||||
   0x60, 0x3f, 0x8b, 0x54, 0x3a, 0xc3, 0x4d, 0x31, 0xe7, 0x94, 0xa4, 0x44, 0xfd, 0x02, 0x03, 0x01,
 | 
			
		||||
   0x00, 0x01,  };
 | 
			
		||||
 | 
			
		||||
/* same key but with extra headers stripped */
 | 
			
		||||
static const unsigned char openssl_public_rsa_stripped[] = {
 | 
			
		||||
   0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xcf, 0x9a, 0xde, 
 | 
			
		||||
   0x64, 0x8a, 0xda, 0xc8, 0x33, 0x20, 0xa9, 0xd7, 0x83, 0x31, 0x19, 0x54, 0xb2, 0x9a, 0x85, 0xa7, 
 | 
			
		||||
   0xa1, 0xb7, 0x75, 0x33, 0xb6, 0xa9, 0xac, 0x84, 0x24, 0xb3, 0xde, 0xdb, 0x7d, 0x85, 0x2d, 0x96, 
 | 
			
		||||
   0x65, 0xe5, 0x3f, 0x72, 0x95, 0x24, 0x9f, 0x28, 0x68, 0xca, 0x4f, 0xdb, 0x44, 0x1c, 0x3e, 0x60, 
 | 
			
		||||
   0x12, 0x8a, 0xdd, 0x26, 0xa5, 0xeb, 0xff, 0x0b, 0x5e, 0xd4, 0x88, 0x38, 0x49, 0x2a, 0x6e, 0x5b, 
 | 
			
		||||
   0xbf, 0x12, 0x37, 0x47, 0xbd, 0x05, 0x6b, 0xbc, 0xdb, 0xf3, 0xee, 0xe4, 0x11, 0x8e, 0x41, 0x68, 
 | 
			
		||||
   0x7c, 0x61, 0x13, 0xd7, 0x42, 0xc8, 0x80, 0xbe, 0x36, 0x8f, 0xdc, 0x08, 0x8b, 0x4f, 0xac, 0xa4, 
 | 
			
		||||
   0xe2, 0x76, 0x0c, 0xc9, 0x63, 0x6c, 0x49, 0x58, 0x93, 0xed, 0xcc, 0xaa, 0xdc, 0x25, 0x3b, 0x0a, 
 | 
			
		||||
   0x60, 0x3f, 0x8b, 0x54, 0x3a, 0xc3, 0x4d, 0x31, 0xe7, 0x94, 0xa4, 0x44, 0xfd, 0x02, 0x03, 0x01, 
 | 
			
		||||
   0x00, 0x01,  };
 | 
			
		||||
 | 
			
		||||
static int rsa_compat_test(void)
 | 
			
		||||
{
 | 
			
		||||
@ -81,17 +93,27 @@ static int rsa_compat_test(void)
 | 
			
		||||
 | 
			
		||||
   len = sizeof(buf);
 | 
			
		||||
   DO(rsa_export(buf, &len, PK_PUBLIC, &key));
 | 
			
		||||
   if (len != sizeof(openssl_public_rsa) || memcmp(buf, openssl_public_rsa, len)) {
 | 
			
		||||
   if (len != sizeof(openssl_public_rsa_stripped) || memcmp(buf, openssl_public_rsa_stripped, len)) {
 | 
			
		||||
      fprintf(stderr, "RSA(private) public export failed to match OpenSSL output\n");
 | 
			
		||||
      return 1;
 | 
			
		||||
   }
 | 
			
		||||
   rsa_free(&key);
 | 
			
		||||
 | 
			
		||||
   /* try reading the public key */
 | 
			
		||||
   DO(rsa_import(openssl_public_rsa_stripped, sizeof(openssl_public_rsa_stripped), &key));
 | 
			
		||||
   len = sizeof(buf);
 | 
			
		||||
   DO(rsa_export(buf, &len, PK_PUBLIC, &key));
 | 
			
		||||
   if (len != sizeof(openssl_public_rsa_stripped) || memcmp(buf, openssl_public_rsa_stripped, len)) {
 | 
			
		||||
      fprintf(stderr, "RSA(public) stripped public import failed to match OpenSSL output\n");
 | 
			
		||||
      return 1;
 | 
			
		||||
   }
 | 
			
		||||
   rsa_free(&key);
 | 
			
		||||
 | 
			
		||||
   /* try reading the public key */
 | 
			
		||||
   DO(rsa_import(openssl_public_rsa, sizeof(openssl_public_rsa), &key));
 | 
			
		||||
   len = sizeof(buf);
 | 
			
		||||
   DO(rsa_export(buf, &len, PK_PUBLIC, &key));
 | 
			
		||||
   if (len != sizeof(openssl_public_rsa) || memcmp(buf, openssl_public_rsa, len)) {
 | 
			
		||||
   if (len != sizeof(openssl_public_rsa_stripped) || memcmp(buf, openssl_public_rsa_stripped, len)) {
 | 
			
		||||
      fprintf(stderr, "RSA(public) SSL public import failed to match OpenSSL output\n");
 | 
			
		||||
      return 1;
 | 
			
		||||
   }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user