mirror of https://github.com/openssl/openssl.git
				
				
				
			Properly return error on EVP_PKEY_CTX_set_dh_nid and EVP_PKEY_CTX_set_dhx_rfc5114
Fixes #17485 Reviewed-by: Matt Caswell <matt@openssl.org> (Merged from https://github.com/openssl/openssl/pull/17498)
This commit is contained in:
		
							parent
							
								
									144316d276
								
							
						
					
					
						commit
						f58bb2dd00
					
				|  | @ -1004,8 +1004,11 @@ static int fix_dh_nid(enum state state, | ||||||
|         return 0; |         return 0; | ||||||
| 
 | 
 | ||||||
|     if (state == PRE_CTRL_TO_PARAMS) { |     if (state == PRE_CTRL_TO_PARAMS) { | ||||||
|         ctx->p2 = (char *)ossl_ffc_named_group_get_name |         if ((ctx->p2 = (char *)ossl_ffc_named_group_get_name | ||||||
|             (ossl_ffc_uid_to_dh_named_group(ctx->p1)); |              (ossl_ffc_uid_to_dh_named_group(ctx->p1))) == NULL) { | ||||||
|  |             ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE); | ||||||
|  |             return 0; | ||||||
|  |         } | ||||||
|         ctx->p1 = 0; |         ctx->p1 = 0; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | @ -1028,16 +1031,24 @@ static int fix_dh_nid5114(enum state state, | ||||||
| 
 | 
 | ||||||
|     switch (state) { |     switch (state) { | ||||||
|     case PRE_CTRL_TO_PARAMS: |     case PRE_CTRL_TO_PARAMS: | ||||||
|         ctx->p2 = (char *)ossl_ffc_named_group_get_name |         if ((ctx->p2 = (char *)ossl_ffc_named_group_get_name | ||||||
|             (ossl_ffc_uid_to_dh_named_group(ctx->p1)); |              (ossl_ffc_uid_to_dh_named_group(ctx->p1))) == NULL) { | ||||||
|  |             ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE); | ||||||
|  |             return 0; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         ctx->p1 = 0; |         ctx->p1 = 0; | ||||||
|         break; |         break; | ||||||
| 
 | 
 | ||||||
|     case PRE_CTRL_STR_TO_PARAMS: |     case PRE_CTRL_STR_TO_PARAMS: | ||||||
|         if (ctx->p2 == NULL) |         if (ctx->p2 == NULL) | ||||||
|             return 0; |             return 0; | ||||||
|         ctx->p2 = (char *)ossl_ffc_named_group_get_name |         if ((ctx->p2 = (char *)ossl_ffc_named_group_get_name | ||||||
|             (ossl_ffc_uid_to_dh_named_group(atoi(ctx->p2))); |              (ossl_ffc_uid_to_dh_named_group(atoi(ctx->p2)))) == NULL) { | ||||||
|  |             ERR_raise(ERR_LIB_EVP, EVP_R_INVALID_VALUE); | ||||||
|  |             return 0; | ||||||
|  |         } | ||||||
|  | 
 | ||||||
|         ctx->p1 = 0; |         ctx->p1 = 0; | ||||||
|         break; |         break; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue