mirror of https://github.com/openssl/openssl.git
				
				
				
			Allow use of long name for KDFs
Reviewed-by: Paul Dale <paul.dale@oracle.com> (Merged from https://github.com/openssl/openssl/pull/4079)
This commit is contained in:
		
							parent
							
								
									3f4af53c22
								
							
						
					
					
						commit
						b15d5ab617
					
				|  | @ -389,8 +389,12 @@ static EVP_PKEY_CTX *init_ctx(const char *kdfalg, int *pkeysize, | ||||||
| 
 | 
 | ||||||
|     if (kdfalg != NULL) { |     if (kdfalg != NULL) { | ||||||
|         int kdfnid = OBJ_sn2nid(kdfalg); |         int kdfnid = OBJ_sn2nid(kdfalg); | ||||||
|         if (kdfnid == NID_undef) | 
 | ||||||
|             goto end; |         if (kdfnid == NID_undef) { | ||||||
|  |             kdfnid = OBJ_ln2nid(kdfalg); | ||||||
|  |             if (kdfnid == NID_undef) | ||||||
|  |                 goto end; | ||||||
|  |         } | ||||||
|         ctx = EVP_PKEY_CTX_new_id(kdfnid, impl); |         ctx = EVP_PKEY_CTX_new_id(kdfnid, impl); | ||||||
|     } else { |     } else { | ||||||
|         if (pkey == NULL) |         if (pkey == NULL) | ||||||
|  |  | ||||||
|  | @ -1623,10 +1623,14 @@ typedef struct kdf_data_st { | ||||||
| static int kdf_test_init(EVP_TEST *t, const char *name) | static int kdf_test_init(EVP_TEST *t, const char *name) | ||||||
| { | { | ||||||
|     KDF_DATA *kdata; |     KDF_DATA *kdata; | ||||||
|  |     int kdf_nid = OBJ_sn2nid(name); | ||||||
|  | 
 | ||||||
|  |     if (kdf_nid == NID_undef) | ||||||
|  |         kdf_nid = OBJ_ln2nid(name); | ||||||
| 
 | 
 | ||||||
|     if (!TEST_ptr(kdata = OPENSSL_zalloc(sizeof(*kdata)))) |     if (!TEST_ptr(kdata = OPENSSL_zalloc(sizeof(*kdata)))) | ||||||
|         return 0; |         return 0; | ||||||
|     kdata->ctx = EVP_PKEY_CTX_new_id(OBJ_sn2nid(name), NULL); |     kdata->ctx = EVP_PKEY_CTX_new_id(kdf_nid, NULL); | ||||||
|     if (kdata->ctx == NULL) { |     if (kdata->ctx == NULL) { | ||||||
|         OPENSSL_free(kdata); |         OPENSSL_free(kdata); | ||||||
|         return 0; |         return 0; | ||||||
|  |  | ||||||
|  | @ -46,6 +46,15 @@ Ctrl.server_random = hexseed:ae6c806f8ad4d80784549dff28a4b58fd837681a51d928c3e30 | ||||||
| Ctrl.client_random = hexseed:62e1fd91f23f558a605f28478c58cf72637b89784d959df7e946d3f07bd1b616 | Ctrl.client_random = hexseed:62e1fd91f23f558a605f28478c58cf72637b89784d959df7e946d3f07bd1b616 | ||||||
| Output = d06139889fffac1e3a71865f504aa5d0d2a2e89506c6f2279b670c3e1b74f531016a2530c51a3a0f7e1d6590d0f0566b2f387f8d11fd4f731cdd572d2eae927f6f2f81410b25e6960be68985add6c38445ad9f8c64bf8068bf9a6679485d966f1ad6f68b43495b10a683755ea2b858d70ccac7ec8b053c6bd41ca299d4e51928 | Output = d06139889fffac1e3a71865f504aa5d0d2a2e89506c6f2279b670c3e1b74f531016a2530c51a3a0f7e1d6590d0f0566b2f387f8d11fd4f731cdd572d2eae927f6f2f81410b25e6960be68985add6c38445ad9f8c64bf8068bf9a6679485d966f1ad6f68b43495b10a683755ea2b858d70ccac7ec8b053c6bd41ca299d4e51928 | ||||||
| 
 | 
 | ||||||
|  | # As above but use long name for KDF | ||||||
|  | KDF=tls1-prf | ||||||
|  | Ctrl.md = md:SHA256 | ||||||
|  | Ctrl.Secret = hexsecret:202c88c00f84a17a20027079604787461176455539e705be730890602c289a5001e34eeb3a043e5d52a65e66125188bf | ||||||
|  | Ctrl.label = seed:key expansion | ||||||
|  | Ctrl.server_random = hexseed:ae6c806f8ad4d80784549dff28a4b58fd837681a51d928c3e30ee5ff14f39868 | ||||||
|  | Ctrl.client_random = hexseed:62e1fd91f23f558a605f28478c58cf72637b89784d959df7e946d3f07bd1b616 | ||||||
|  | Output = d06139889fffac1e3a71865f504aa5d0d2a2e89506c6f2279b670c3e1b74f531016a2530c51a3a0f7e1d6590d0f0566b2f387f8d11fd4f731cdd572d2eae927f6f2f81410b25e6960be68985add6c38445ad9f8c64bf8068bf9a6679485d966f1ad6f68b43495b10a683755ea2b858d70ccac7ec8b053c6bd41ca299d4e51928 | ||||||
|  | 
 | ||||||
| # Missing digest. | # Missing digest. | ||||||
| KDF=TLS1-PRF | KDF=TLS1-PRF | ||||||
| Ctrl.Secret = hexsecret:01 | Ctrl.Secret = hexsecret:01 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue