/src/openssl32/providers/implementations/kem/kem_util.c
Line  | Count  | Source (jump to first uncovered line)  | 
1  |  | /*  | 
2  |  |  * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.  | 
3  |  |  *  | 
4  |  |  * Licensed under the Apache License 2.0 (the "License").  You may not use  | 
5  |  |  * this file except in compliance with the License.  You can obtain a copy  | 
6  |  |  * in the file LICENSE in the source distribution or at  | 
7  |  |  * https://www.openssl.org/source/license.html  | 
8  |  |  */  | 
9  |  |  | 
10  |  | #include <string.h> /* for memcpy() */  | 
11  |  | #include <openssl/core_names.h>  | 
12  |  | #include <openssl/crypto.h>  | 
13  |  | #include "eckem.h"  | 
14  |  |  | 
15  |  | typedef struct { | 
16  |  |     unsigned int id;  | 
17  |  |     const char *mode;  | 
18  |  | } KEM_MODE;  | 
19  |  |  | 
20  |  | static const KEM_MODE eckem_modename_id_map[] = { | 
21  |  |     { KEM_MODE_DHKEM, OSSL_KEM_PARAM_OPERATION_DHKEM }, | 
22  |  |     { 0, NULL } | 
23  |  | };  | 
24  |  |  | 
25  |  | int ossl_eckem_modename2id(const char *name)  | 
26  | 0  | { | 
27  | 0  |     size_t i;  | 
28  |  | 
  | 
29  | 0  |     if (name == NULL)  | 
30  | 0  |         return KEM_MODE_UNDEFINED;  | 
31  |  |  | 
32  | 0  |     for (i = 0; eckem_modename_id_map[i].mode != NULL; ++i) { | 
33  | 0  |         if (OPENSSL_strcasecmp(name, eckem_modename_id_map[i].mode) == 0)  | 
34  | 0  |             return eckem_modename_id_map[i].id;  | 
35  | 0  |     }  | 
36  | 0  |     return KEM_MODE_UNDEFINED;  | 
37  | 0  | }  |