diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-27 13:47:06 +0200 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2010-07-27 13:47:06 +0200 |
commit | c0c14cb837e6ea4a1c4ec0f8888f500c78ccdbf6 (patch) | |
tree | 82f4a723fe8c0f1e4c02e044012d4fcb1a945dee /ncr-dh.h | |
parent | 81633c5ffee3806a7195258122fe8e7e337c8c54 (diff) | |
download | kernel-crypto-c0c14cb837e6ea4a1c4ec0f8888f500c78ccdbf6.tar.gz kernel-crypto-c0c14cb837e6ea4a1c4ec0f8888f500c78ccdbf6.tar.xz kernel-crypto-c0c14cb837e6ea4a1c4ec0f8888f500c78ccdbf6.zip |
Added Diffie Hellman key generation.
Diffstat (limited to 'ncr-dh.h')
-rw-r--r-- | ncr-dh.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ncr-dh.h b/ncr-dh.h new file mode 100644 index 00000000000..ba7a92b18a8 --- /dev/null +++ b/ncr-dh.h @@ -0,0 +1,21 @@ +#ifndef NCR_DH_H +# define NCR_DH_H + +#include <tomcrypt.h> + +typedef struct { + int type; /* PK_PRIVATE or PK_PUBLIC */ + mp_int p; + mp_int g; + mp_int x; /* private */ + mp_int y; /* public: y=g^x */ +} dh_key; + +int dh_generate_key(dh_key * key); +int dh_import_params(dh_key * key, uint8_t* p, size_t p_size, uint8_t* g, size_t g_size); +void dh_free(dh_key * key); +int dh_generate_public(dh_key * public, dh_key* private); + +int dh_export(uint8_t *out, size_t *outlen, int type, dh_key *key); +int dh_import(const uint8_t *in, size_t inlen, dh_key *key); +#endif |