xref: /freebsd/crypto/openssl/test/evp_byname_test.c (revision a7148ab39c03abd4d1a84997c70bf96f15dd2a09)
1*a7148ab3SEnji Cooper /*
2*a7148ab3SEnji Cooper  * Copyright 2024 The OpenSSL Project Authors. All Rights Reserved.
3*a7148ab3SEnji Cooper  *
4*a7148ab3SEnji Cooper  * Licensed under the Apache License 2.0 (the "License").  You may not use
5*a7148ab3SEnji Cooper  * this file except in compliance with the License.  You can obtain a copy
6*a7148ab3SEnji Cooper  * in the file LICENSE in the source distribution or at
7*a7148ab3SEnji Cooper  * https://www.openssl.org/source/license.html
8*a7148ab3SEnji Cooper  */
9*a7148ab3SEnji Cooper 
10*a7148ab3SEnji Cooper #include <stdio.h>
11*a7148ab3SEnji Cooper #include <stdlib.h>
12*a7148ab3SEnji Cooper #include <string.h>
13*a7148ab3SEnji Cooper 
14*a7148ab3SEnji Cooper #include <openssl/evp.h>
15*a7148ab3SEnji Cooper #include "testutil.h"
16*a7148ab3SEnji Cooper 
test_evp_get_digestbyname(void)17*a7148ab3SEnji Cooper static int test_evp_get_digestbyname(void)
18*a7148ab3SEnji Cooper {
19*a7148ab3SEnji Cooper     const EVP_MD *md;
20*a7148ab3SEnji Cooper 
21*a7148ab3SEnji Cooper     if (!TEST_ptr(md = EVP_get_digestbyname("SHA2-256")))
22*a7148ab3SEnji Cooper         return 0;
23*a7148ab3SEnji Cooper     return 1;
24*a7148ab3SEnji Cooper }
25*a7148ab3SEnji Cooper 
test_evp_get_cipherbyname(void)26*a7148ab3SEnji Cooper static int test_evp_get_cipherbyname(void)
27*a7148ab3SEnji Cooper {
28*a7148ab3SEnji Cooper     const EVP_CIPHER *cipher;
29*a7148ab3SEnji Cooper 
30*a7148ab3SEnji Cooper     if (!TEST_ptr(cipher = EVP_get_cipherbyname("AES-256-WRAP")))
31*a7148ab3SEnji Cooper         return 0;
32*a7148ab3SEnji Cooper     return 1;
33*a7148ab3SEnji Cooper }
34*a7148ab3SEnji Cooper 
setup_tests(void)35*a7148ab3SEnji Cooper int setup_tests(void)
36*a7148ab3SEnji Cooper {
37*a7148ab3SEnji Cooper     ADD_TEST(test_evp_get_digestbyname);
38*a7148ab3SEnji Cooper     ADD_TEST(test_evp_get_cipherbyname);
39*a7148ab3SEnji Cooper     return 1;
40*a7148ab3SEnji Cooper }
41