summaryrefslogtreecommitdiff
path: root/src/ltc/headers/tomcrypt_pk.h
diff options
context:
space:
mode:
authorKarel Miko <karel.miko@gmail.com>2019-07-01 13:44:06 +0200
committerKarel Miko <karel.miko@gmail.com>2019-07-01 13:44:06 +0200
commit54385f937bd8e80a4ce10e378e630c191e2664e3 (patch)
treef969f0380d63285801579100194a0bce41ebd52e /src/ltc/headers/tomcrypt_pk.h
parent1d5ef1bb9691e98fec4fa477bda0210dd7383533 (diff)
update libtomcrypt to: e01e4c5c 2019-06-11 07:55:21 +0200
Diffstat (limited to 'src/ltc/headers/tomcrypt_pk.h')
-rw-r--r--src/ltc/headers/tomcrypt_pk.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/ltc/headers/tomcrypt_pk.h b/src/ltc/headers/tomcrypt_pk.h
index fc196d01..a58e6000 100644
--- a/src/ltc/headers/tomcrypt_pk.h
+++ b/src/ltc/headers/tomcrypt_pk.h
@@ -325,6 +325,75 @@ int ecc_recover_key(const unsigned char *sig, unsigned long siglen,
#endif
+#ifdef LTC_CURVE25519
+
+typedef struct {
+ /** The key type, PK_PRIVATE or PK_PUBLIC */
+ enum public_key_type type;
+
+ /** The PK-algorithm, PKA_ED25519 or PKA_X25519 */
+ /** This was supposed to be:
+ * enum public_key_algorithms algo;
+ * but that enum is now in tomcrypt_private.h
+ */
+ int algo;
+
+ /** The private key */
+ unsigned char priv[32];
+
+ /** The public key */
+ unsigned char pub[32];
+} curve25519_key;
+
+
+/** Ed25519 Signature API */
+int ed25519_make_key(prng_state *prng, int wprng, curve25519_key *key);
+
+int ed25519_set_key(const unsigned char *sk, unsigned long sklen,
+ const unsigned char *pk, unsigned long pklen,
+ curve25519_key *key);
+
+int ed25519_export( unsigned char *out, unsigned long *outlen,
+ int which,
+ const curve25519_key *key);
+
+int ed25519_import(const unsigned char *in, unsigned long inlen, curve25519_key *key);
+int ed25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key);
+int ed25519_import_pkcs8(const unsigned char *in, unsigned long inlen,
+ const void *pwd, unsigned long pwdlen,
+ curve25519_key *key);
+
+int ed25519_sign(const unsigned char *msg, unsigned long msglen,
+ unsigned char *sig, unsigned long *siglen,
+ const curve25519_key *private_key);
+
+int ed25519_verify(const unsigned char *msg, unsigned long msglen,
+ const unsigned char *sig, unsigned long siglen,
+ int *stat, const curve25519_key *public_key);
+
+/** X25519 Key-Exchange API */
+int x25519_make_key(prng_state *prng, int wprng, curve25519_key *key);
+
+int x25519_set_key(const unsigned char *k, unsigned long klen,
+ const unsigned char *u, unsigned long ulen,
+ curve25519_key *key);
+
+int x25519_export( unsigned char *out, unsigned long *outlen,
+ int which,
+ const curve25519_key *key);
+
+int x25519_import(const unsigned char *in, unsigned long inlen, curve25519_key *key);
+int x25519_import_x509(const unsigned char *in, unsigned long inlen, curve25519_key *key);
+int x25519_import_pkcs8(const unsigned char *in, unsigned long inlen,
+ const void *pwd, unsigned long pwdlen,
+ curve25519_key *key);
+
+int x25519_shared_secret(const curve25519_key *private_key,
+ const curve25519_key *public_key,
+ unsigned char *out, unsigned long *outlen);
+
+#endif /* LTC_CURVE25519 */
+
#ifdef LTC_MDSA
/* Max diff between group and modulus size in bytes */