From 9ce9c53e9be2a815192a54a17ce191c5f3539883 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Niels=20M=C3=B6ller?= <nisse@lysator.liu.se>
Date: Mon, 14 May 2007 16:43:30 +0200
Subject: [PATCH] Don't use WITH_PUBLIC_KEY / WITH_HOGWEED, then Makefile sorts
 out which files should be compiled.

Rev: nettle/der2rsa.c:1.2
Rev: nettle/dsa-keygen.c:1.2
Rev: nettle/dsa-sign.c:1.2
Rev: nettle/dsa-verify.c:1.2
Rev: nettle/dsa.c:1.2
Rev: nettle/pkcs1-rsa-md5.c:1.2
Rev: nettle/pkcs1-rsa-sha1.c:1.2
Rev: nettle/pkcs1-rsa-sha256.c:1.2
Rev: nettle/pkcs1.c:1.2
Rev: nettle/rsa-compat.c:1.2
Rev: nettle/rsa-decrypt.c:1.2
Rev: nettle/rsa-encrypt.c:1.2
Rev: nettle/rsa-keygen.c:1.2
Rev: nettle/rsa-md5-sign.c:1.2
Rev: nettle/rsa-md5-verify.c:1.2
Rev: nettle/rsa-sha1-sign.c:1.2
Rev: nettle/rsa-sha1-verify.c:1.2
Rev: nettle/rsa-sha256-sign.c:1.2
Rev: nettle/rsa-sha256-verify.c:1.2
Rev: nettle/rsa-sign.c:1.2
Rev: nettle/rsa-verify.c:1.2
Rev: nettle/rsa.c:1.2
Rev: nettle/rsa2openpgp.c:1.2
Rev: nettle/rsa2sexp.c:1.2
Rev: nettle/sexp2dsa.c:1.2
Rev: nettle/sexp2rsa.c:1.2
---
 der2rsa.c           | 4 ----
 dsa-keygen.c        | 4 ----
 dsa-sign.c          | 4 ----
 dsa-verify.c        | 4 ----
 dsa.c               | 4 ----
 pkcs1-rsa-md5.c     | 4 ----
 pkcs1-rsa-sha1.c    | 4 ----
 pkcs1-rsa-sha256.c  | 4 ----
 pkcs1.c             | 4 ----
 rsa-compat.c        | 4 ----
 rsa-decrypt.c       | 4 ----
 rsa-encrypt.c       | 4 ----
 rsa-keygen.c        | 4 ----
 rsa-md5-sign.c      | 4 ----
 rsa-md5-verify.c    | 4 ----
 rsa-sha1-sign.c     | 4 ----
 rsa-sha1-verify.c   | 4 ----
 rsa-sha256-sign.c   | 4 ----
 rsa-sha256-verify.c | 4 ----
 rsa-sign.c          | 4 ----
 rsa-verify.c        | 4 ----
 rsa.c               | 4 ----
 rsa2openpgp.c       | 3 ---
 rsa2sexp.c          | 4 ----
 sexp2dsa.c          | 4 ----
 sexp2rsa.c          | 4 ----
 26 files changed, 103 deletions(-)

diff --git a/der2rsa.c b/der2rsa.c
index 9d8b437f..679b3368 100644
--- a/der2rsa.c
+++ b/der2rsa.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "rsa.h"
 
 #include "bignum.h"
@@ -133,5 +131,3 @@ rsa_keypair_from_der(struct rsa_public_key *pub,
   else
     return rsa_public_key_from_der_iterator(pub, limit, &i);    
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/dsa-keygen.c b/dsa-keygen.c
index 9f517225..2d12bc24 100644
--- a/dsa-keygen.c
+++ b/dsa-keygen.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <stdlib.h>
 
 #include "dsa.h"
@@ -249,5 +247,3 @@ dsa_generate_keypair(struct dsa_public_key *pub,
 
   return 1;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/dsa-sign.c b/dsa-sign.c
index 7204e7fc..a44c2ea0 100644
--- a/dsa-sign.c
+++ b/dsa-sign.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <stdlib.h>
 
 #include "dsa.h"
@@ -93,5 +91,3 @@ dsa_sign(const struct dsa_public_key *pub,
   dsa_sign_digest(pub, key, random_ctx, random,
 		  digest, signature);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/dsa-verify.c b/dsa-verify.c
index 798f1ab8..519c4207 100644
--- a/dsa-verify.c
+++ b/dsa-verify.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <stdlib.h>
 
 #include "dsa.h"
@@ -108,5 +106,3 @@ dsa_verify(const struct dsa_public_key *key,
 
   return dsa_verify_digest(key, digest, signature);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/dsa.c b/dsa.c
index ed733b6c..02cc7858 100644
--- a/dsa.c
+++ b/dsa.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "dsa.h"
 
 #include "bignum.h"
@@ -78,5 +76,3 @@ dsa_signature_clear(struct dsa_signature *signature)
   mpz_clear(signature->r);
   mpz_clear(signature->s);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/pkcs1-rsa-md5.c b/pkcs1-rsa-md5.c
index d3ccd8b0..1b9af157 100644
--- a/pkcs1-rsa-md5.c
+++ b/pkcs1-rsa-md5.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -92,5 +90,3 @@ pkcs1_rsa_md5_encode_digest(mpz_t m, unsigned length, const uint8_t *digest)
   memcpy(em + length - MD5_DIGEST_SIZE, digest, MD5_DIGEST_SIZE);
   nettle_mpz_set_str_256_u(m, length, em);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/pkcs1-rsa-sha1.c b/pkcs1-rsa-sha1.c
index 11c52eb3..b13be63c 100644
--- a/pkcs1-rsa-sha1.c
+++ b/pkcs1-rsa-sha1.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -92,5 +90,3 @@ pkcs1_rsa_sha1_encode_digest(mpz_t m, unsigned length, const uint8_t *digest)
   memcpy(em + length - SHA1_DIGEST_SIZE, digest, SHA1_DIGEST_SIZE);
   nettle_mpz_set_str_256_u(m, length, em);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/pkcs1-rsa-sha256.c b/pkcs1-rsa-sha256.c
index 77f9d048..82c169a5 100644
--- a/pkcs1-rsa-sha256.c
+++ b/pkcs1-rsa-sha256.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -90,5 +88,3 @@ pkcs1_rsa_sha256_encode_digest(mpz_t m, unsigned length, const uint8_t *digest)
   memcpy(em + length - SHA256_DIGEST_SIZE, digest, SHA256_DIGEST_SIZE);
   nettle_mpz_set_str_256_u(m, length, em);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/pkcs1.c b/pkcs1.c
index 74d7cfc0..1a0fa9dd 100644
--- a/pkcs1.c
+++ b/pkcs1.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <string.h>
 
@@ -57,5 +55,3 @@ pkcs1_signature_prefix(unsigned length,
   memset(buffer + 1, 0xff, length - 1);
   buffer[0] = 1;
 }
-		     
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-compat.c b/rsa-compat.c
index 6e994385..7106acea 100644
--- a/rsa-compat.c
+++ b/rsa-compat.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "rsa-compat.h"
 
 #include "bignum.h"
@@ -154,5 +152,3 @@ R_VerifyFinal(R_SIGNATURE_CTX *ctx,
 
   return res;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-decrypt.c b/rsa-decrypt.c
index 058a7580..973fa653 100644
--- a/rsa-decrypt.c
+++ b/rsa-decrypt.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -80,5 +78,3 @@ rsa_decrypt(const struct rsa_private_key *key,
 
   return 1;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-encrypt.c b/rsa-encrypt.c
index fab5f82b..a901e710 100644
--- a/rsa-encrypt.c
+++ b/rsa-encrypt.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <stdlib.h>
 #include <string.h>
@@ -83,5 +81,3 @@ rsa_encrypt(const struct rsa_public_key *key,
 
   return 1;  
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-keygen.c b/rsa-keygen.c
index 236bc121..e4731d54 100644
--- a/rsa-keygen.c
+++ b/rsa-keygen.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 #include <limits.h>
 #include <stdlib.h>
@@ -332,5 +330,3 @@ rsa_generate_keypair(struct rsa_public_key *pub,
 
   return 1;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-md5-sign.c b/rsa-md5-sign.c
index 710baa78..2d26eeba 100644
--- a/rsa-md5-sign.c
+++ b/rsa-md5-sign.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 
 #include "rsa.h"
@@ -59,5 +57,3 @@ rsa_md5_sign_digest(const struct rsa_private_key *key,
 
   rsa_compute_root(key, s, s);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-md5-verify.c b/rsa-md5-verify.c
index 5b8d4341..0f232b4b 100644
--- a/rsa-md5-verify.c
+++ b/rsa-md5-verify.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 
 #include "rsa.h"
@@ -74,5 +72,3 @@ rsa_md5_verify_digest(const struct rsa_public_key *key,
 
   return res;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-sha1-sign.c b/rsa-sha1-sign.c
index 9fa953a6..90338af8 100644
--- a/rsa-sha1-sign.c
+++ b/rsa-sha1-sign.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 
 #include "rsa.h"
@@ -59,5 +57,3 @@ rsa_sha1_sign_digest(const struct rsa_private_key *key,
 
   rsa_compute_root(key, s, s);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-sha1-verify.c b/rsa-sha1-verify.c
index f1dd2fd8..2f6b57b4 100644
--- a/rsa-sha1-verify.c
+++ b/rsa-sha1-verify.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 
 #include "rsa.h"
@@ -73,5 +71,3 @@ rsa_sha1_verify_digest(const struct rsa_public_key *key,
 
   return res;
 }
-     
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-sha256-sign.c b/rsa-sha256-sign.c
index ab34c19c..cf146061 100644
--- a/rsa-sha256-sign.c
+++ b/rsa-sha256-sign.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 
 #include "rsa.h"
@@ -59,5 +57,3 @@ rsa_sha256_sign_digest(const struct rsa_private_key *key,
 
   rsa_compute_root(key, s, s);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-sha256-verify.c b/rsa-sha256-verify.c
index a0235a48..aba5fefb 100644
--- a/rsa-sha256-verify.c
+++ b/rsa-sha256-verify.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <assert.h>
 
 #include "rsa.h"
@@ -73,5 +71,3 @@ rsa_sha256_verify_digest(const struct rsa_public_key *key,
 
   return res;
 }
-     
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-sign.c b/rsa-sign.c
index 5a89b4ac..4be75cda 100644
--- a/rsa-sign.c
+++ b/rsa-sign.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "rsa.h"
 
 #include "bignum.h"
@@ -138,5 +136,3 @@ rsa_compute_root(const struct rsa_private_key *key,
 
   mpz_clear(xp); mpz_clear(xq);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa-verify.c b/rsa-verify.c
index c872dd02..734eb80d 100644
--- a/rsa-verify.c
+++ b/rsa-verify.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "rsa.h"
 
 #include "bignum.h"
@@ -57,5 +55,3 @@ _rsa_verify(const struct rsa_public_key *key,
 
   return res;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa.c b/rsa.c
index 9fd77c92..74b1370a 100644
--- a/rsa.c
+++ b/rsa.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "rsa.h"
 
 #include "bignum.h"
@@ -80,5 +78,3 @@ rsa_public_key_prepare(struct rsa_public_key *key)
   
   return (key->size > 0);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa2openpgp.c b/rsa2openpgp.c
index 580cd333..f129ff7a 100644
--- a/rsa2openpgp.c
+++ b/rsa2openpgp.c
@@ -27,8 +27,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <string.h>
 #include <time.h>
 
@@ -102,4 +100,3 @@ rsa_keypair_to_openpgp(struct nettle_buffer *buffer,
 				    PGP_SIGN_CERTIFICATION,
 				    &signature_hash);
 }
-#endif /* WITH_PUBLIC_KEY */
diff --git a/rsa2sexp.c b/rsa2sexp.c
index 26720aa9..8ece86e4 100644
--- a/rsa2sexp.c
+++ b/rsa2sexp.c
@@ -26,8 +26,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include "rsa.h"
 
 #include "sexp.h"
@@ -52,5 +50,3 @@ rsa_keypair_to_sexp(struct nettle_buffer *buffer,
     return sexp_format(buffer, "(public-key(%0s(n%b)(e%b)))",
 		       algorithm_name, pub->n, pub->e);
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/sexp2dsa.c b/sexp2dsa.c
index c947546f..cf87905e 100644
--- a/sexp2dsa.c
+++ b/sexp2dsa.c
@@ -26,8 +26,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <string.h>
 
 #include "dsa.h"
@@ -102,5 +100,3 @@ dsa_signature_from_sexp(struct dsa_signature *rs,
 
   return 1;
 }
-
-#endif /* WITH_PUBLIC_KEY */
diff --git a/sexp2rsa.c b/sexp2rsa.c
index 9416ba98..e3faf68c 100644
--- a/sexp2rsa.c
+++ b/sexp2rsa.c
@@ -26,8 +26,6 @@
 # include "config.h"
 #endif
 
-#if WITH_PUBLIC_KEY
-
 #include <string.h>
 
 #include "rsa.h"
@@ -108,5 +106,3 @@ rsa_keypair_from_sexp(struct rsa_public_key *pub,
 
   return rsa_keypair_from_sexp_alist(pub, priv, limit, &i);
 }
-
-#endif /* WITH_PUBLIC_KEY */
-- 
GitLab