Path: blob/main/crypto/openssl/providers/implementations/kem/kem_util.c
48383 views
/*1* Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.2*3* Licensed under the Apache License 2.0 (the "License"). You may not use4* this file except in compliance with the License. You can obtain a copy5* in the file LICENSE in the source distribution or at6* https://www.openssl.org/source/license.html7*/89#include <string.h> /* for memcpy() */10#include <openssl/core_names.h>11#include <openssl/crypto.h>12#include "eckem.h"1314typedef struct {15unsigned int id;16const char *mode;17} KEM_MODE;1819static const KEM_MODE eckem_modename_id_map[] = {20{ KEM_MODE_DHKEM, OSSL_KEM_PARAM_OPERATION_DHKEM },21{ 0, NULL }22};2324int ossl_eckem_modename2id(const char *name)25{26size_t i;2728if (name == NULL)29return KEM_MODE_UNDEFINED;3031for (i = 0; eckem_modename_id_map[i].mode != NULL; ++i) {32if (OPENSSL_strcasecmp(name, eckem_modename_id_map[i].mode) == 0)33return eckem_modename_id_map[i].id;34}35return KEM_MODE_UNDEFINED;36}373839