summaryrefslogtreecommitdiffstats
path: root/crypto/userspace/ncr-dh.h
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/userspace/ncr-dh.h')
-rw-r--r--crypto/userspace/ncr-dh.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/crypto/userspace/ncr-dh.h b/crypto/userspace/ncr-dh.h
new file mode 100644
index 00000000000..183f7909154
--- /dev/null
+++ b/crypto/userspace/ncr-dh.h
@@ -0,0 +1,27 @@
+#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, unsigned long *outlen, int type, dh_key *key);
+int dh_import(const uint8_t *in, size_t inlen, dh_key *key);
+
+int dh_derive_gxy(struct key_item_st* newkey, dh_key * key,
+ void* pk, size_t pk_size);
+
+int ncr_pk_get_dh_size( dh_key* key);
+
+#endif