Tor
0.4.7.0-alpha-dev
|
Block of functions related with DH utilities and operations. over Z_p. We aren't using this for any new crypto – EC is more efficient. More...
#include "lib/crypt_ops/compat_openssl.h"
#include "lib/crypt_ops/crypto_dh.h"
#include "lib/crypt_ops/crypto_digest.h"
#include "lib/crypt_ops/crypto_hkdf.h"
#include "lib/crypt_ops/crypto_util.h"
#include "lib/log/log.h"
#include "lib/log/util_bug.h"
Go to the source code of this file.
Functions | |
void | crypto_dh_init (void) |
void | crypto_dh_free_all (void) |
ssize_t | crypto_dh_compute_secret (int severity, crypto_dh_t *dh, const char *pubkey, size_t pubkey_len, char *secret_out, size_t secret_bytes_out) |
Variables | |
const unsigned | DH_GENERATOR = 2 |
const char | TLS_DH_PRIME [] |
const char | OAKLEY_PRIME_2 [] |
Block of functions related with DH utilities and operations. over Z_p. We aren't using this for any new crypto – EC is more efficient.
Definition in file crypto_dh.c.
ssize_t crypto_dh_compute_secret | ( | int | severity, |
crypto_dh_t * | dh, | ||
const char * | pubkey, | ||
size_t | pubkey_len, | ||
char * | secret_out, | ||
size_t | secret_bytes_out | ||
) |
Given a DH key exchange object, and our peer's value of g^y (as a pubkey_len-byte value in pubkey) generate secret_bytes_out bytes of shared key material and write them to secret_out. Return the number of bytes generated on success, or -1 on failure.
(We generate key material by computing SHA1( g^xy || "\x00" ) || SHA1( g^xy || "\x01" ) || ... where || is concatenation.)
Definition at line 79 of file crypto_dh.c.
const unsigned DH_GENERATOR = 2 |
Our DH 'g' parameter
Definition at line 23 of file crypto_dh.c.
Referenced by crypto_set_dh_generator().
const char OAKLEY_PRIME_2[] |
This is from rfc2409, section 6.2. It's a safe prime, and supposedly it equals: 2^1024 - 2^960 - 1 + 2^64 * { [2^894 pi] + 129093 }.
Definition at line 39 of file crypto_dh.c.
Referenced by crypto_dh_init_openssl().
const char TLS_DH_PRIME[] |
This is the 1024-bit safe prime that Apache uses for its DH stuff; see modules/ssl/ssl_engine_dh.c; Apache also uses a generator of 2 with this prime.
Definition at line 28 of file crypto_dh.c.
Referenced by crypto_dh_init_openssl().