Tor 0.4.9.0-alpha-dev
Data Structures | Functions | Variables
crypto_dh_nss.c File Reference

NSS implementation of Diffie-Hellman over Z_p. More...

#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_nss_mgt.h"
#include "lib/encoding/binascii.h"
#include "lib/log/util_bug.h"
#include "lib/malloc/malloc.h"
#include <cryptohi.h>
#include <keyhi.h>
#include <pk11pub.h>

Go to the source code of this file.

Data Structures

struct  crypto_dh_t
 

Functions

void crypto_dh_init_nss (void)
 
void crypto_dh_free_all_nss (void)
 
crypto_dh_tcrypto_dh_new (int dh_type)
 
crypto_dh_tcrypto_dh_dup (const crypto_dh_t *dh)
 
int crypto_dh_get_bytes (crypto_dh_t *dh)
 
int crypto_dh_generate_public (crypto_dh_t *dh)
 
int crypto_dh_get_public (crypto_dh_t *dh, char *pubkey_out, size_t pubkey_out_len)
 
void crypto_dh_free_ (crypto_dh_t *dh)
 
ssize_t crypto_dh_handshake (int severity, crypto_dh_t *dh, const char *pubkey, size_t pubkey_len, unsigned char *secret_out, size_t secret_bytes_out)
 

Variables

static int dh_initialized = 0
 
static SECKEYDHParams tls_dh_param
 
static SECKEYDHParams circuit_dh_param
 
static unsigned char tls_dh_prime_data [DH1024_KEY_LEN]
 
static unsigned char circuit_dh_prime_data [DH1024_KEY_LEN]
 
static unsigned char dh_generator_data [1]
 

Detailed Description

NSS implementation of Diffie-Hellman over Z_p.

Definition in file crypto_dh_nss.c.

Function Documentation

◆ crypto_dh_dup()

crypto_dh_t * crypto_dh_dup ( const crypto_dh_t dh)

Definition at line 83 of file crypto_dh_nss.c.

◆ crypto_dh_free_()

void crypto_dh_free_ ( crypto_dh_t dh)

Definition at line 143 of file crypto_dh_nss.c.

◆ crypto_dh_free_all_nss()

void crypto_dh_free_all_nss ( void  )

Definition at line 63 of file crypto_dh_nss.c.

◆ crypto_dh_generate_public()

int crypto_dh_generate_public ( crypto_dh_t dh)

Definition at line 102 of file crypto_dh_nss.c.

◆ crypto_dh_get_bytes()

int crypto_dh_get_bytes ( crypto_dh_t dh)

Definition at line 95 of file crypto_dh_nss.c.

◆ crypto_dh_get_public()

int crypto_dh_get_public ( crypto_dh_t dh,
char *  pubkey_out,
size_t  pubkey_out_len 
)

Definition at line 118 of file crypto_dh_nss.c.

◆ crypto_dh_handshake()

ssize_t crypto_dh_handshake ( int  severity,
crypto_dh_t dh,
const char *  pubkey,
size_t  pubkey_len,
unsigned char *  secret_out,
size_t  secret_bytes_out 
)

Definition at line 155 of file crypto_dh_nss.c.

◆ crypto_dh_init_nss()

void crypto_dh_init_nss ( void  )

Definition at line 33 of file crypto_dh_nss.c.

◆ crypto_dh_new()

crypto_dh_t * crypto_dh_new ( int  dh_type)

Definition at line 75 of file crypto_dh_nss.c.

Variable Documentation

◆ circuit_dh_param

SECKEYDHParams circuit_dh_param
static

Definition at line 27 of file crypto_dh_nss.c.

◆ circuit_dh_prime_data

unsigned char circuit_dh_prime_data[DH1024_KEY_LEN]
static

Definition at line 29 of file crypto_dh_nss.c.

◆ dh_generator_data

unsigned char dh_generator_data[1]
static

Definition at line 30 of file crypto_dh_nss.c.

◆ dh_initialized

int dh_initialized = 0
static

Definition at line 26 of file crypto_dh_nss.c.

◆ tls_dh_param

SECKEYDHParams tls_dh_param
static

Definition at line 27 of file crypto_dh_nss.c.

◆ tls_dh_prime_data

unsigned char tls_dh_prime_data[DH1024_KEY_LEN]
static

Definition at line 28 of file crypto_dh_nss.c.