myl7/fss 2.0.0
Function secret sharing (FSS) primitives including distributed point/comparison function (DPF/DCF)
Loading...
Searching...
No Matches
fss::prg::Aes128Mmo< mul > Class Template Reference

AES-128 with Matyas-Meyer-Oseas and pre-initialized cipher contexts as a PRG. More...

Public Member Functions

 Aes128Mmo (cuda::std::span< EVP_CIPHER_CTX *, mul > ctxs)
 Constructor.
cuda::std::array< int4, mul > Gen (int4 seed)
 Expand one seed into mul blocks.
cuda::std::array< int4, mul/2 > GenHalf (int4 seed, bool right)
 Return the selected half of Gen() with the same call requirements.

Static Public Member Functions

static cuda::std::array< EVP_CIPHER_CTX *, mul > CreateCtxs (const unsigned char *keys[mul])
 Create cipher contexts.

Detailed Description

template<int mul>
class fss::prg::Aes128Mmo< mul >

AES-128 with Matyas-Meyer-Oseas and pre-initialized cipher contexts as a PRG.

Host-only. Device use of Gen() or GenHalf() fails to build with an unresolved-extern error naming fss_host_only_Aes128Mmo_used_in_device_code.

Concurrency: Gen() runs EVP_EncryptUpdate on the ctxs, and copies of an instance share the same ctxs. OpenSSL does not document one ctx as safe for concurrent updates even for full-block no-padding ECB, so Gen() must not run concurrently on instances sharing ctxs. Parallel host evaluation needs a PRG whose Gen() is safe to call concurrently, such as ChaCha or Aes128MmoRaw.

Template Parameters
mulSee Prgable mul.

Constructor & Destructor Documentation

◆ Aes128Mmo()

template<int mul>
fss::prg::Aes128Mmo< mul >::Aes128Mmo ( cuda::std::span< EVP_CIPHER_CTX *, mul > ctxs)
inline

Constructor.

Parameters
ctxsGenerated by CreateCtxs() and freed by FreeCtxs(). Copies borrow the same mutable contexts. Concurrent Gen() calls require distinct contexts. Users are responsible for managing their lifetime.

Member Function Documentation

◆ CreateCtxs()

template<int mul>
cuda::std::array< EVP_CIPHER_CTX *, mul > fss::prg::Aes128Mmo< mul >::CreateCtxs ( const unsigned char * keys[mul])
inlinestatic

Create cipher contexts.

Parameters
keysmul 16B AES-128 keys.
Exceptions
std::runtime_errorif an OpenSSL context allocation or setup call fails.

◆ Gen()

template<int mul>
cuda::std::array< int4, mul > fss::prg::Aes128Mmo< mul >::Gen ( int4 seed)

Expand one seed into mul blocks.

Exceptions
std::runtime_errorif EVP_EncryptUpdate fails.

◆ GenHalf()

template<int mul>
requires (mul > 0 && mul % 2 == 0)
cuda::std::array< int4, mul/2 > fss::prg::Aes128Mmo< mul >::GenHalf ( int4 seed,
bool right )

Return the selected half of Gen() with the same call requirements.

Parameters
seedSeed block to expand, the same input Gen() takes.
rightfalse selects the first half, true selects the second half.
Exceptions
std::runtime_errorif EVP_EncryptUpdate fails.

The documentation for this class was generated from the following files: