Skip to main content
  • Home
  • login
  • Browse the archive

    swh mirror partner logo
swh logo
SoftwareHeritage
Software
Heritage
Mirror
Features
  • Search

  • Downloads

  • Save code now

  • Add forge now

  • Help

  • c78f6b3
  • /
  • providers
  • /
  • implementations
  • /
  • kem
  • /
  • kem_util.c
Raw File
Permalinks

To reference or cite the objects present in the Software Heritage archive, permalinks based on SoftWare Hash IDentifiers (SWHIDs) must be used.
Select below a type of object currently browsed in order to display its associated SWHID and permalink.

  • content
  • directory
content badge Iframe embedding
swh:1:cnt:1fd52e1c2d527e6f8c6510b0cf16718ab9e8e1fe
directory badge Iframe embedding
swh:1:dir:1fe4d5595bd3f127f508d395533c5098cb30a85a
kem_util.c
/*
 * Copyright 2022 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include <string.h> /* for memcpy() */
#include <openssl/core_names.h>
#include <openssl/crypto.h>
#include "eckem.h"

typedef struct {
    unsigned int id;
    const char *mode;
} KEM_MODE;

static const KEM_MODE eckem_modename_id_map[] = {
    { KEM_MODE_DHKEM, OSSL_KEM_PARAM_OPERATION_DHKEM },
    { 0, NULL }
};

int ossl_eckem_modename2id(const char *name)
{
    size_t i;

    if (name == NULL)
        return KEM_MODE_UNDEFINED;

    for (i = 0; eckem_modename_id_map[i].mode != NULL; ++i) {
        if (OPENSSL_strcasecmp(name, eckem_modename_id_map[i].mode) == 0)
            return eckem_modename_id_map[i].id;
    }
    return KEM_MODE_UNDEFINED;
}

ENEA — Copyright (C), ENEA. License: GNU AGPLv3+.
Legal notes  ::  JavaScript license information ::  Web API

back to top