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