Classes | Typedefs | Functions | Variables
voprf.c File Reference
#include <openssl/trust_token.h>
#include <openssl/bn.h>
#include <openssl/bytestring.h>
#include <openssl/ec.h>
#include <openssl/err.h>
#include <openssl/mem.h>
#include <openssl/nid.h>
#include <openssl/rand.h>
#include "../ec_extra/internal.h"
#include "../fipsmodule/ec/internal.h"
#include "internal.h"
Include dependency graph for voprf.c:

Go to the source code of this file.

Classes

struct  VOPRF_METHOD
 

Typedefs

typedef int(* hash_to_group_func_t) (const EC_GROUP *group, EC_RAW_POINT *out, const uint8_t t[TRUST_TOKEN_NONCE_SIZE])
 
typedef int(* hash_to_scalar_func_t) (const EC_GROUP *group, EC_SCALAR *out, uint8_t *buf, size_t len)
 

Functions

static int cbb_add_point (CBB *out, const EC_GROUP *group, const EC_AFFINE *point)
 
static int cbs_get_point (CBS *cbs, const EC_GROUP *group, EC_AFFINE *out)
 
static int dleq_generate (const VOPRF_METHOD *method, CBB *cbb, const TRUST_TOKEN_ISSUER_KEY *priv, const EC_RAW_POINT *T, const EC_RAW_POINT *W)
 
static int dleq_verify (const VOPRF_METHOD *method, CBS *cbs, const TRUST_TOKEN_CLIENT_KEY *pub, const EC_RAW_POINT *T, const EC_RAW_POINT *W)
 
static int hash_to_scalar_batch (const VOPRF_METHOD *method, EC_SCALAR *out, const CBB *points, size_t index)
 
static int hash_to_scalar_dleq (const VOPRF_METHOD *method, EC_SCALAR *out, const EC_AFFINE *X, const EC_AFFINE *T, const EC_AFFINE *W, const EC_AFFINE *K0, const EC_AFFINE *K1)
 
static int mul_public_2 (const EC_GROUP *group, EC_RAW_POINT *out, const EC_RAW_POINT *p0, const EC_SCALAR *scalar0, const EC_RAW_POINT *p1, const EC_SCALAR *scalar1)
 
static int scalar_from_cbs (CBS *cbs, const EC_GROUP *group, EC_SCALAR *out)
 
static int scalar_to_cbb (CBB *out, const EC_GROUP *group, const EC_SCALAR *scalar)
 
static STACK_OF (TRUST_TOKEN)
 
static STACK_OF (TRUST_TOKEN_PRETOKEN)
 
static int voprf_client_key_from_bytes (const VOPRF_METHOD *method, TRUST_TOKEN_CLIENT_KEY *key, const uint8_t *in, size_t len)
 
int voprf_exp2_client_key_from_bytes (TRUST_TOKEN_CLIENT_KEY *key, const uint8_t *in, size_t len)
 
int voprf_exp2_generate_key (CBB *out_private, CBB *out_public)
 
static int voprf_exp2_hash_to_group (const EC_GROUP *group, EC_RAW_POINT *out, const uint8_t t[TRUST_TOKEN_NONCE_SIZE])
 
static int voprf_exp2_hash_to_scalar (const EC_GROUP *group, EC_SCALAR *out, uint8_t *buf, size_t len)
 
static int voprf_exp2_init_method (void)
 
static void voprf_exp2_init_method_impl (void)
 
int voprf_exp2_issuer_key_from_bytes (TRUST_TOKEN_ISSUER_KEY *key, const uint8_t *in, size_t len)
 
int voprf_exp2_read (const TRUST_TOKEN_ISSUER_KEY *key, uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE], uint8_t *out_private_metadata, const uint8_t *token, size_t token_len)
 
int voprf_exp2_sign (const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs, size_t num_requested, size_t num_to_issue, uint8_t private_metadata)
 
static int voprf_generate_key (const VOPRF_METHOD *method, CBB *out_private, CBB *out_public)
 
static int voprf_init_method (VOPRF_METHOD *method, int curve_nid, hash_to_group_func_t hash_to_group, hash_to_scalar_func_t hash_to_scalar)
 
static int voprf_issuer_key_from_bytes (const VOPRF_METHOD *method, TRUST_TOKEN_ISSUER_KEY *key, const uint8_t *in, size_t len)
 
static int voprf_read (const VOPRF_METHOD *method, const TRUST_TOKEN_ISSUER_KEY *key, uint8_t out_nonce[TRUST_TOKEN_NONCE_SIZE], const uint8_t *token, size_t token_len)
 
static int voprf_sign (const VOPRF_METHOD *method, const TRUST_TOKEN_ISSUER_KEY *key, CBB *cbb, CBS *cbs, size_t num_requested, size_t num_to_issue)
 

Variables

static const uint8_t kDefaultAdditionalData [32] = {0}
 
static VOPRF_METHOD voprf_exp2_method
 
static CRYPTO_once_t voprf_exp2_method_once = CRYPTO_ONCE_INIT
 
static int voprf_exp2_ok = 0
 

Typedef Documentation

◆ hash_to_group_func_t

typedef int(* hash_to_group_func_t) (const EC_GROUP *group, EC_RAW_POINT *out, const uint8_t t[TRUST_TOKEN_NONCE_SIZE])

Definition at line 31 of file voprf.c.

◆ hash_to_scalar_func_t

typedef int(* hash_to_scalar_func_t) (const EC_GROUP *group, EC_SCALAR *out, uint8_t *buf, size_t len)

Definition at line 33 of file voprf.c.

Function Documentation

◆ cbb_add_point()

static int cbb_add_point ( CBB out,
const EC_GROUP group,
const EC_AFFINE point 
)
static

Definition at line 63 of file voprf.c.

◆ cbs_get_point()

static int cbs_get_point ( CBS cbs,
const EC_GROUP group,
EC_AFFINE out 
)
static

Definition at line 78 of file voprf.c.

◆ dleq_generate()

static int dleq_generate ( const VOPRF_METHOD method,
CBB cbb,
const TRUST_TOKEN_ISSUER_KEY priv,
const EC_RAW_POINT T,
const EC_RAW_POINT W 
)
static

Definition at line 287 of file voprf.c.

◆ dleq_verify()

static int dleq_verify ( const VOPRF_METHOD method,
CBS cbs,
const TRUST_TOKEN_CLIENT_KEY pub,
const EC_RAW_POINT T,
const EC_RAW_POINT W 
)
static

Definition at line 354 of file voprf.c.

◆ hash_to_scalar_batch()

static int hash_to_scalar_batch ( const VOPRF_METHOD method,
EC_SCALAR out,
const CBB points,
size_t  index 
)
static

Definition at line 255 of file voprf.c.

◆ hash_to_scalar_dleq()

static int hash_to_scalar_dleq ( const VOPRF_METHOD method,
EC_SCALAR out,
const EC_AFFINE X,
const EC_AFFINE T,
const EC_AFFINE W,
const EC_AFFINE K0,
const EC_AFFINE K1 
)
static

Definition at line 223 of file voprf.c.

◆ mul_public_2()

static int mul_public_2 ( const EC_GROUP group,
EC_RAW_POINT out,
const EC_RAW_POINT p0,
const EC_SCALAR scalar0,
const EC_RAW_POINT p1,
const EC_SCALAR scalar1 
)
static

Definition at line 345 of file voprf.c.

◆ scalar_from_cbs()

static int scalar_from_cbs ( CBS cbs,
const EC_GROUP group,
EC_SCALAR out 
)
static

Definition at line 101 of file voprf.c.

◆ scalar_to_cbb()

static int scalar_to_cbb ( CBB out,
const EC_GROUP group,
const EC_SCALAR scalar 
)
static

Definition at line 89 of file voprf.c.

◆ STACK_OF() [1/2]

static STACK_OF ( TRUST_TOKEN  )
static

Definition at line 513 of file voprf.c.

◆ STACK_OF() [2/2]

static STACK_OF ( TRUST_TOKEN_PRETOKEN  )
static

Definition at line 166 of file voprf.c.

◆ voprf_client_key_from_bytes()

static int voprf_client_key_from_bytes ( const VOPRF_METHOD method,
TRUST_TOKEN_CLIENT_KEY key,
const uint8_t in,
size_t  len 
)
static

Definition at line 135 of file voprf.c.

◆ voprf_exp2_client_key_from_bytes()

int voprf_exp2_client_key_from_bytes ( TRUST_TOKEN_CLIENT_KEY key,
const uint8_t in,
size_t  len 
)

Definition at line 714 of file voprf.c.

◆ voprf_exp2_generate_key()

int voprf_exp2_generate_key ( CBB out_private,
CBB out_public 
)

Definition at line 706 of file voprf.c.

◆ voprf_exp2_hash_to_group()

static int voprf_exp2_hash_to_group ( const EC_GROUP group,
EC_RAW_POINT out,
const uint8_t  t[TRUST_TOKEN_NONCE_SIZE] 
)
static

Definition at line 673 of file voprf.c.

◆ voprf_exp2_hash_to_scalar()

static int voprf_exp2_hash_to_scalar ( const EC_GROUP group,
EC_SCALAR out,
uint8_t buf,
size_t  len 
)
static

Definition at line 680 of file voprf.c.

◆ voprf_exp2_init_method()

static int voprf_exp2_init_method ( void  )
static

Definition at line 697 of file voprf.c.

◆ voprf_exp2_init_method_impl()

static void voprf_exp2_init_method_impl ( void  )
static

Definition at line 691 of file voprf.c.

◆ voprf_exp2_issuer_key_from_bytes()

int voprf_exp2_issuer_key_from_bytes ( TRUST_TOKEN_ISSUER_KEY key,
const uint8_t in,
size_t  len 
)

Definition at line 722 of file voprf.c.

◆ voprf_exp2_read()

int voprf_exp2_read ( const TRUST_TOKEN_ISSUER_KEY key,
uint8_t  out_nonce[TRUST_TOKEN_NONCE_SIZE],
uint8_t out_private_metadata,
const uint8_t token,
size_t  token_len 
)

Definition at line 758 of file voprf.c.

◆ voprf_exp2_sign()

int voprf_exp2_sign ( const TRUST_TOKEN_ISSUER_KEY key,
CBB cbb,
CBS cbs,
size_t  num_requested,
size_t  num_to_issue,
uint8_t  private_metadata 
)

Definition at line 737 of file voprf.c.

◆ voprf_generate_key()

static int voprf_generate_key ( const VOPRF_METHOD method,
CBB out_private,
CBB out_public 
)
static

Definition at line 113 of file voprf.c.

◆ voprf_init_method()

static int voprf_init_method ( VOPRF_METHOD method,
int  curve_nid,
hash_to_group_func_t  hash_to_group,
hash_to_scalar_func_t  hash_to_scalar 
)
static

Definition at line 49 of file voprf.c.

◆ voprf_issuer_key_from_bytes()

static int voprf_issuer_key_from_bytes ( const VOPRF_METHOD method,
TRUST_TOKEN_ISSUER_KEY key,
const uint8_t in,
size_t  len 
)
static

Definition at line 147 of file voprf.c.

◆ voprf_read()

static int voprf_read ( const VOPRF_METHOD method,
const TRUST_TOKEN_ISSUER_KEY key,
uint8_t  out_nonce[TRUST_TOKEN_NONCE_SIZE],
const uint8_t token,
size_t  token_len 
)
static

Definition at line 639 of file voprf.c.

◆ voprf_sign()

static int voprf_sign ( const VOPRF_METHOD method,
const TRUST_TOKEN_ISSUER_KEY key,
CBB cbb,
CBS cbs,
size_t  num_requested,
size_t  num_to_issue 
)
static

Definition at line 413 of file voprf.c.

Variable Documentation

◆ kDefaultAdditionalData

const uint8_t kDefaultAdditionalData[32] = {0}
static

Definition at line 47 of file voprf.c.

◆ voprf_exp2_method

VOPRF_METHOD voprf_exp2_method
static

Definition at line 688 of file voprf.c.

◆ voprf_exp2_method_once

CRYPTO_once_t voprf_exp2_method_once = CRYPTO_ONCE_INIT
static

Definition at line 689 of file voprf.c.

◆ voprf_exp2_ok

int voprf_exp2_ok = 0
static

Definition at line 687 of file voprf.c.



grpc
Author(s):
autogenerated on Fri May 16 2025 03:01:37