Man page - mceliece6688128f_dec(3)
Packages contas this manual
- mceliece460896f_enc(3)
- mceliece348864pc_dec(3)
- mceliece348864f(3)
- mceliece6960119pcf_dec(3)
- mceliece6688128f(3)
- mceliece8192128_keypair(3)
- mceliece6688128_dec(3)
- mceliece6688128f_keypair(3)
- mceliece348864_dec(3)
- mceliece6960119f_keypair(3)
- mceliece6960119f(3)
- mceliece460896pc_keypair(3)
- mceliece8192128pc_keypair(3)
- mceliece6688128pc_enc(3)
- mceliece6688128pcf_enc(3)
- mceliece460896pcf_enc(3)
- mceliece348864(3)
- mceliece6688128(3)
- mceliece6688128pcf_keypair(3)
- mceliece348864pcf_keypair(3)
- mceliece460896f_keypair(3)
- mceliece460896pcf_keypair(3)
- mceliece348864f_dec(3)
- mceliece8192128pcf_dec(3)
- mceliece8192128pc_enc(3)
- mceliece460896pc_dec(3)
- mceliece348864_enc(3)
- mceliece6688128pc(3)
- mceliece8192128(3)
- mceliece460896(3)
- mceliece348864pcf(3)
- mceliece6960119_enc(3)
- mceliece6960119pc_enc(3)
- mceliece460896pc_enc(3)
- mceliece460896pc(3)
- mceliece8192128f(3)
- mceliece6960119pcf_keypair(3)
- mceliece460896_dec(3)
- mceliece6960119pc_dec(3)
- mceliece8192128f_dec(3)
- mceliece460896_enc(3)
- mceliece6960119_keypair(3)
- mceliece460896f_dec(3)
- mceliece6960119f_enc(3)
- mceliece460896_keypair(3)
- mceliece348864pc(3)
- mceliece6960119f_dec(3)
- mceliece8192128_dec(3)
- mceliece6688128pc_keypair(3)
- mceliece6688128pcf(3)
- mceliece348864f_enc(3)
- mceliece348864pc_keypair(3)
- mceliece348864pcf_enc(3)
- mceliece8192128pcf_keypair(3)
- mceliece6960119pc_keypair(3)
- mceliece8192128f_enc(3)
- mceliece460896pcf(3)
- mceliece6688128_enc(3)
- mceliece8192128f_keypair(3)
- mceliece8192128pcf_enc(3)
- mceliece6960119pc(3)
- mceliece8192128_enc(3)
- mceliece6688128f_enc(3)
- mceliece6688128_keypair(3)
- mceliece6688128f_dec(3)
- mceliece348864_keypair(3)
- mceliece460896f(3)
- mceliece6960119pcf_enc(3)
- mceliece8192128pcf(3)
- mceliece348864pcf_dec(3)
- mceliece(3)
- mceliece8192128pc(3)
- mceliece6960119pcf(3)
- mceliece6688128pc_dec(3)
- mceliece348864pc_enc(3)
- mceliece6688128pcf_dec(3)
- mceliece6960119(3)
- mceliece8192128pc_dec(3)
- mceliece6960119_dec(3)
- mceliece348864f_keypair(3)
- mceliece460896pcf_dec(3)
apt-get install libmceliece-dev
Manual
| mceliece(3) | mceliece(3) |
NAME
mceliece - C API for the libmceliece implementation of the Classic McEliece cryptosystem
SYNOPSIS
Using libmceliece:
-
#include <mceliece.h>
Link with -lmceliece.
Key generation (for, e.g., mceliece6960119):
-
unsigned char pk[mceliece6960119_PUBLICKEYBYTES]; unsigned char sk[mceliece6960119_SECRETKEYBYTES]; mceliece6960119_keypair(pk,sk);
Encapsulation (for, e.g., mceliece6960119):
-
unsigned char ct[mceliece6960119_CIPHERTEXTBYTES]; unsigned char k[mceliece6960119_BYTES]; const unsigned char pk[mceliece6960119_PUBLICKEYBYTES]; int ret; ret = mceliece6960119_enc(ct,k,pk);
Decapsulation (for, e.g., mceliece6960119):
-
unsigned char k[mceliece6960119_BYTES]; const unsigned char ct[mceliece6960119_CIPHERTEXTBYTES]; const unsigned char sk[mceliece6960119_SECRETKEYBYTES]; int ret; ret = mceliece6960119_dec(k,ct,sk);
DESCRIPTION
libmceliece is an implementation of the Classic McEliece (https://classic.mceliece.org) cryptosystem. The C API for libmceliece provides the following functions:
-
mceliece{6960119,6688128,8192128,460896,348864}_keypair mceliece{6960119,6688128,8192128,460896,348864}_enc mceliece{6960119,6688128,8192128,460896,348864}_dec mceliece{6960119,6688128,8192128,460896,348864}f_keypair mceliece{6960119,6688128,8192128,460896,348864}f_enc mceliece{6960119,6688128,8192128,460896,348864}f_dec
All of these functions follow the SUPERCOP API for KEMs (https://bench.cr.yp.to/call-kem.html) except that
- •
- the function names are libmceliece-specific instead of crypto_kem_*,
- •
- message lengths are long long instead of unsigned long long, and
- •
- the keypair functions return void instead of int.
The details below use mceliece6960119 as an example.
KEY GENERATION
The mceliece6960119_keypair function randomly generates Alice’s secret key sk[0], sk[1], ..., sk[mceliece6960119_SECRETKEYBYTES-1] and Alice’s corresponding public key pk[0], pk[1], ..., pk[mceliece6960119_PUBLICKEYBYTES-1].
ENCAPSULATION
The mceliece6960119_enc function randomly generates a ciphertext ct[0], ct[1], ..., ct[mceliece6960119_CIPHERTEXTBYTES-1] and the corresponding session key k[0], k[1], ..., k[mceliece6960119_BYTES-1] given Alice’s public key pk[0], pk[1], ..., pk[mceliece6960119_PUBLICKEYBYTES-1]. This function then returns 0.
Exception: If the input public key is not “narrowly decodable” (i.e., if bits at particular positions in pk are set), this function returns -1. Currently the function also handles such public keys by clearing ct and k, but callers should not rely on this.
For {6688128,8192128,460896,348864}{,f}, all byte strings of the correct length are narrowly decodable, and the return value is always 0. For 6960119{,f}, the return value can be -1.
DECAPSULATION
The mceliece6960119_dec function, given Alice’s secret key sk[0], sk[1], ..., sk[mceliece6960119_SECRETKEYBYTES-1], computes the session key k[0], k[1], ..., k[mceliece6960119_BYTES-1] corresponding to a ciphertext ct[0], ct[1], ..., ct[mceliece6960119_CIPHERTEXTBYTES-1] that was encapsulated to Alice. This function then returns 0.
Exception: If the input ciphertext is not “narrowly decodable” (i.e., if bits at particular positions in ct are set), this function returns -1. Currently this function also handles such ciphertexts by setting all bytes of k to 255, but callers should not rely on this.
For {6688128,8192128,460896,348864}{,f}, all byte strings of the correct length are narrowly decodable, and the return value is always 0. For 6960119{,f}, the return value can be -1.
THE f VARIANTS
The f variants are internally more complicated than the non-f variants but provide faster key generation. The f variants are interoperable with the non-f variants: for example, a key generated with mceliece6960119f_keypair can decapsulate ciphertexts that were encapsulated with mceliece6960119_enc. The secret-key sizes (and formats) are the same, the enc functions are the same, and the dec functions are the same.
SEE ALSO
mceliece(1), randombytes(3)