mirror of https://github.com/openssl/openssl.git
				
				
				
			evp_test: add a ctx dup operation to the KDF tests
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/17572)
(cherry picked from commit c8adf19d2d)
Reviewed-by: Hugo Landau <hlandau@openssl.org>
			
			
This commit is contained in:
		
							parent
							
								
									a262d4ff18
								
							
						
					
					
						commit
						f46befd667
					
				|  | @ -2808,6 +2808,7 @@ static int kdf_test_run(EVP_TEST *t) | ||||||
|     KDF_DATA *expected = t->data; |     KDF_DATA *expected = t->data; | ||||||
|     unsigned char *got = NULL; |     unsigned char *got = NULL; | ||||||
|     size_t got_len = expected->output_len; |     size_t got_len = expected->output_len; | ||||||
|  |     EVP_KDF_CTX *ctx; | ||||||
| 
 | 
 | ||||||
|     if (!EVP_KDF_CTX_set_params(expected->ctx, expected->params)) { |     if (!EVP_KDF_CTX_set_params(expected->ctx, expected->params)) { | ||||||
|         t->err = "KDF_CTRL_ERROR"; |         t->err = "KDF_CTRL_ERROR"; | ||||||
|  | @ -2817,6 +2818,10 @@ static int kdf_test_run(EVP_TEST *t) | ||||||
|         t->err = "INTERNAL_ERROR"; |         t->err = "INTERNAL_ERROR"; | ||||||
|         goto err; |         goto err; | ||||||
|     } |     } | ||||||
|  |     if ((ctx = EVP_KDF_CTX_dup(expected->ctx)) != NULL) { | ||||||
|  |         EVP_KDF_CTX_free(expected->ctx); | ||||||
|  |         expected->ctx = ctx; | ||||||
|  |     } | ||||||
|     if (EVP_KDF_derive(expected->ctx, got, got_len, NULL) <= 0) { |     if (EVP_KDF_derive(expected->ctx, got, got_len, NULL) <= 0) { | ||||||
|         t->err = "KDF_DERIVE_ERROR"; |         t->err = "KDF_DERIVE_ERROR"; | ||||||
|         goto err; |         goto err; | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue