-rw-r--r-- 3177 libntruprime-20240825/doc/man/sntrup.3 raw
.\" Automatically generated by Pandoc 2.17.1.1 .\" .\" Define V font for inline verbatim, using C font in formats .\" that render this, and otherwise B font. .ie "\f[CB]x\f[]"x" \{\ . ftr V B . ftr VI BI . ftr VB B . ftr VBI BI .\} .el \{\ . ftr V CR . ftr VI CI . ftr VB CB . ftr VBI CBI .\} .TH "sntrup" "3" "" "" "" .hy .SS NAME .PP sntrup - C API for the libntruprime implementation of the Streamlined NTRU Prime cryptosystem .SS SYNOPSIS .PP Using libntruprime: .IP .nf \f[C] #include <ntruprime.h> \f[R] .fi .PP Link with \f[V]-lntruprime\f[R]. .PP Key generation (for, e.g., \f[V]sntrup1277\f[R]): .IP .nf \f[C] unsigned char pk[sntrup1277_PUBLICKEYBYTES]; unsigned char sk[sntrup1277_SECRETKEYBYTES]; sntrup1277_keypair(pk,sk); \f[R] .fi .PP Encapsulation (for, e.g., \f[V]sntrup1277\f[R]): .IP .nf \f[C] unsigned char ct[sntrup1277_CIPHERTEXTBYTES]; unsigned char k[sntrup1277_BYTES]; const unsigned char pk[sntrup1277_PUBLICKEYBYTES]; sntrup1277_enc(ct,k,pk); \f[R] .fi .PP Decapsulation (for, e.g., \f[V]sntrup1277\f[R]): .IP .nf \f[C] unsigned char k[sntrup1277_BYTES]; const unsigned char ct[sntrup1277_CIPHERTEXTBYTES]; const unsigned char sk[sntrup1277_SECRETKEYBYTES]; sntrup1277_dec(k,ct,sk); \f[R] .fi .SS DESCRIPTION .PP libntruprime is an implementation of the Streamlined NTRU Prime (https://ntruprime.cr.yp.to) cryptosystem. The C API for libntruprime provides the following functions: .IP .nf \f[C] sntrup{653,761,857,953,1013,1277}_keypair sntrup{653,761,857,953,1013,1277}_enc sntrup{653,761,857,953,1013,1277}_dec \f[R] .fi .PP All of these functions follow the SUPERCOP API for KEMs (https://bench.cr.yp.to/call-kem.html) except that .IP \[bu] 2 the function names are libntruprime-specific instead of \f[V]crypto_kem_*\f[R], .IP \[bu] 2 message lengths are \f[V]long long\f[R] instead of \f[V]unsigned long long\f[R], and .IP \[bu] 2 the functions return \f[V]void\f[R] instead of \f[V]int\f[R]. .PP The details below use \f[V]sntrup1277\f[R] as an example. .SS KEY GENERATION .PP The \f[V]sntrup1277_keypair\f[R] function randomly generates Alice\[cq]s secret key \f[V]sk[0]\f[R], \f[V]sk[1]\f[R], \&..., \f[V]sk[sntrup1277_SECRETKEYBYTES-1]\f[R] and Alice\[cq]s corresponding public key \f[V]pk[0]\f[R], \f[V]pk[1]\f[R], \&..., \f[V]pk[sntrup1277_PUBLICKEYBYTES-1]\f[R]. .SS ENCAPSULATION .PP The \f[V]sntrup1277_enc\f[R] function randomly generates a ciphertext \f[V]ct[0]\f[R], \f[V]ct[1]\f[R], \&..., \f[V]ct[sntrup1277_CIPHERTEXTBYTES-1]\f[R] and the corresponding session key \f[V]k[0]\f[R], \f[V]k[1]\f[R], \&..., \f[V]k[sntrup1277_BYTES-1]\f[R] given Alice\[cq]s public key \f[V]pk[0]\f[R], \f[V]pk[1]\f[R], \&..., \f[V]pk[sntrup1277_PUBLICKEYBYTES-1]\f[R]. .SS DECAPSULATION .PP The \f[V]sntrup1277_dec\f[R] function, given Alice\[cq]s secret key \f[V]sk[0]\f[R], \f[V]sk[1]\f[R], \&..., \f[V]sk[sntrup1277_SECRETKEYBYTES-1]\f[R], computes the session key \f[V]k[0]\f[R], \f[V]k[1]\f[R], \&..., \f[V]k[sntrup1277_BYTES-1]\f[R] corresponding to a ciphertext \f[V]ct[0]\f[R], \f[V]ct[1]\f[R], \&..., \f[V]ct[sntrup1277_CIPHERTEXTBYTES-1]\f[R] that was encapsulated to Alice. .SS SEE ALSO .PP \f[B]sntrup\f[R](1), \f[B]randombytes\f[R](3)