Browse Source

clean-up macros

no need to enable them separately now
Steffen Jaeckel 6 years ago
parent
commit
54d7c6782b

+ 2 - 10
src/headers/tomcrypt_custom.h

@@ -431,11 +431,8 @@
 /* Digital Signature Algorithm */
 #define LTC_MDSA
 
-/* Ed25519 */
-#define LTC_ED25519
-
-/* X25519 */
-#define LTC_X25519
+/* Ed25519 & X25519 */
+#define LTC_CURVE25519
 
 /* ECC */
 #define LTC_MECC
@@ -467,11 +464,6 @@
 #define LTC_ECC_TIMING_RESISTANT
 #endif
 
-#if defined(LTC_X25519) || defined(LTC_ED25519)
-/* Enable curve25519 shared functionality */
-#define LTC_CURVE25519
-#endif
-
 /* PKCS #1 (RSA) and #5 (Password Handling) stuff */
 #ifndef LTC_NO_PKCS
 

+ 3 - 7
src/headers/tomcrypt_pk.h

@@ -345,10 +345,9 @@ typedef struct {
    unsigned char pub[32];
 } curve25519_key;
 
-#endif /* LTC_CURVE25519 */
 
-#ifdef LTC_ED25519
 
+/* Ed25519 Signature API */
 int ed25519_make_key(prng_state *prng, int wprng, curve25519_key *key);
 
 int ed25519_export(       unsigned char *out, unsigned long *outlen,
@@ -369,10 +368,7 @@ int ed25519_verify(const  unsigned char *msg, unsigned long msglen,
                    const  unsigned char *sig, unsigned long siglen,
                    int *stat, const curve25519_key *public_key);
 
-#endif /* LTC_ED25519 */
-
-#ifdef LTC_X25519
-
+/* X25519 Key-Exchange API */
 int x25519_make_key(prng_state *prng, int wprng, curve25519_key *key);
 
 int x25519_export(       unsigned char *out, unsigned long *outlen,
@@ -389,7 +385,7 @@ int x25519_shared_secret(const curve25519_key *private_key,
                          const curve25519_key *public_key,
                                 unsigned char *out, unsigned long *outlen);
 
-#endif /* LTC_X25519 */
+#endif /* LTC_CURVE25519 */
 
 #ifdef LTC_MDSA
 

+ 2 - 7
src/headers/tomcrypt_private.h

@@ -300,7 +300,7 @@ int dsa_int_validate_primes(const dsa_key *key, int *stat);
 #endif /* LTC_MDSA */
 
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 int crypto_sign(
   unsigned char *sm,unsigned long long *smlen,
@@ -312,15 +312,10 @@ int crypto_sign_open(
   const unsigned char *pk);
 int crypto_sign_keypair(prng_state *prng, int wprng, unsigned char *pk,unsigned char *sk);
 int crypto_sk_to_pk(unsigned char *pk, const unsigned char *sk);
-
-#endif /* LTC_ED25519 */
-
-#ifdef LTC_X25519
-
 int crypto_scalarmult(unsigned char *q, const unsigned char *n, const unsigned char *p);
 int crypto_scalarmult_base(unsigned char *q,const unsigned char *n);
 
-#endif /* LTC_X25519 */
+#endif /* LTC_CURVE25519 */
 
 #ifdef LTC_DER
 

+ 2 - 2
src/misc/crypt/crypt.c

@@ -354,10 +354,10 @@ const char *crypt_build_settings =
     "   DSA\n"
 #endif
 #if defined(LTC_CURVE25519)
-#if defined(LTC_ED25519)
+#if defined(LTC_CURVE25519)
     "   Ed25519\n"
 #endif
-#if defined(LTC_X25519)
+#if defined(LTC_CURVE25519)
     "   X25519\n"
 #endif
 #endif

+ 1 - 1
src/pk/ed25519/ed25519_export.c

@@ -13,7 +13,7 @@
   Export a Ed25519 key to a binary packet, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 /**
    Export a Ed25519 key to a binary packet

+ 1 - 1
src/pk/ed25519/ed25519_import.c

@@ -13,7 +13,7 @@
   Import a Ed25519 key from a binary packet, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 /**
   Import a Ed25519 key from a binary packet

+ 1 - 1
src/pk/ed25519/ed25519_make_key.c

@@ -13,7 +13,7 @@
   Create a Ed25519 key, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 /**
    Create a Ed25519 key

+ 1 - 1
src/pk/ed25519/ed25519_set_key.c

@@ -13,7 +13,7 @@
   Set the parameters of a Ed25519 key, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 /**
    Set the parameters of a Ed25519 key

+ 1 - 1
src/pk/ed25519/ed25519_sign.c

@@ -13,7 +13,7 @@
   Create a Ed25519 signature, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 /**
    Create a Ed25519 signature.

+ 1 - 1
src/pk/ed25519/ed25519_verify.c

@@ -13,7 +13,7 @@
   Verify a Ed25519 signature, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 /**
    Verify a Ed25519 signature.

+ 1 - 1
src/pk/x25519/x25519_export.c

@@ -13,7 +13,7 @@
   Export a X25519 key to a binary packet, Steffen Jaeckel
 */
 
-#ifdef LTC_X25519
+#ifdef LTC_CURVE25519
 
 /**
    Export a X25519 key to a binary packet

+ 1 - 1
src/pk/x25519/x25519_import.c

@@ -13,7 +13,7 @@
   Import a X25519 key from a binary packet, Steffen Jaeckel
 */
 
-#ifdef LTC_X25519
+#ifdef LTC_CURVE25519
 
 /**
   Import a X25519 key from a binary packet

+ 1 - 1
src/pk/x25519/x25519_make_key.c

@@ -13,7 +13,7 @@
   Create a X25519 key, Steffen Jaeckel
 */
 
-#ifdef LTC_X25519
+#ifdef LTC_CURVE25519
 
 /**
    Create a X25519 key

+ 1 - 1
src/pk/x25519/x25519_set_ku.c

@@ -13,7 +13,7 @@
   Set the parameters of a X25519 key, Steffen Jaeckel
 */
 
-#ifdef LTC_X25519
+#ifdef LTC_CURVE25519
 
 /**
    Set the parameters of a X25519 key

+ 1 - 1
src/pk/x25519/x25519_shared_secret.c

@@ -13,7 +13,7 @@
   Create a X25519 shared secret, Steffen Jaeckel
 */
 
-#ifdef LTC_X25519
+#ifdef LTC_CURVE25519
 
 /**
    Create a X25519 shared secret.

+ 1 - 1
tests/ed25519_test.c

@@ -13,7 +13,7 @@
   Ed25519 tests, Steffen Jaeckel
 */
 
-#ifdef LTC_ED25519
+#ifdef LTC_CURVE25519
 
 static int _rfc_8410_10_test(void)
 {

+ 1 - 1
tests/x25519_test.c

@@ -13,7 +13,7 @@
   x25519 tests, Steffen Jaeckel
 */
 
-#ifdef LTC_X25519
+#ifdef LTC_CURVE25519
 
 static int _rfc_7748_5_2_test(void)
 {