25 lines
644 B
C
25 lines
644 B
C
#ifndef H_DH
|
|
#define H_DH
|
|
|
|
#define CHAR_SIZE 128
|
|
#define PRIVATEKEY_MAX 500
|
|
#define PRIVATEKEY_MIN 100
|
|
|
|
struct bn_dh{
|
|
BIGNUM *bnPrivateKey;
|
|
BIGNUM *bnPublicKey;
|
|
BIGNUM *bnPublicKeyPeer;
|
|
BIGNUM *bnPublicEphemeralKey;
|
|
BN_CTX *ctx;
|
|
};
|
|
static int generatePrimeNumber(unsigned long long int p);
|
|
static BIGNUM *generatePrivateKey();
|
|
static void dumpBN(const char *s, BIGNUM *bn);
|
|
static int combineKey(BIGNUM **pubKey, BIGNUM *e, BIGNUM *x, BIGNUM *bnP, BN_CTX *ctx);
|
|
static BIGNUM *generateP();
|
|
static int charToDec(const char *s);
|
|
static BIGNUM *generateG(const char *nP);
|
|
static void cleanDH(struct bn_dh *dh);
|
|
|
|
#endif
|