symm: Expunge stubby header files from the source tree.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 22 Dec 2014 20:32:58 +0000 (20:32 +0000)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 15 Mar 2015 02:20:02 +0000 (02:20 +0000)
Construct them at compile time instead.

.gitignore
build-setup
symm/Makefile.am
symm/safersk.c
symm/safersk.h [deleted file]
symm/sha224.h [deleted file]
symm/sha384.h [deleted file]
symm/stub.c.in [new file with mode: 0644]
symm/stub.h.in [new file with mode: 0644]
symm/stubs.am.in [new file with mode: 0644]
symm/whirlpool256.h [deleted file]

index 7603014..39e8565 100644 (file)
@@ -8,5 +8,16 @@ precomp
 progs/getdate.h
 progs/getdate.y
 symm/modes.am
+symm/stubs.am
 *.t
 *.to
+/symm/safersk.h
+/symm/salsa2012.h
+/symm/salsa208.h
+/symm/sha224.h
+/symm/sha384.h
+/symm/whirlpool256.h
+/symm/xsalsa20.h
+/symm/xsalsa2012.h
+/symm/xsalsa208.h
+/symm/stubs.gen-stamp
index 77af12e..ded8b11 100755 (executable)
@@ -1,2 +1,4 @@
 #! /bin/sh -ex
-if [ ! -r symm/modes.am ]; then touch -t197001010000.00 symm/modes.am; fi
+for gen in symm/modes.am symm/stubs.am; do
+  if [ ! -r $gen ]; then touch -t197001010000.00 $gen; fi
+done
index 7107f1f..bd7710b 100644 (file)
@@ -46,10 +46,16 @@ EXTRA_DIST          += multigen
 ## we generate it using `multigen'.  Unfortunately, this needs to be done
 ## at the Automake level, which causes some interesting bootstrapping
 ## problems.
+##
+## Of course, now that we have this machinery for the complicated modes
+## generation, we might as well use it for simpler things.
 include modes.am
+include stubs.am
 
 EXTRA_DIST             += modes.am.in modes.am
+EXTRA_DIST             += stubs.am.in stubs.am
 MAINTAINERCLEANFILES   += $(srcdir)/modes.am
+MAINTAINERCLEANFILES   += $(srcdir)/stubs.am
 
 ## Generate the lists.
 $(srcdir)/modes.am: modes.am.in Makefile.am
@@ -61,12 +67,19 @@ $(srcdir)/modes.am: modes.am.in Makefile.am
                        hashmode="$(HASHMODES)" \
                        hashciphermode="$(HASHCIPHERMODES)" \
                        hashmacmode="$(HASHMACMODES)"
+$(srcdir)/stubs.am: stubs.am.in Makefile.am
+       $(AM_V_GEN)$(multigen) -g $(srcdir)/stubs.am.in $(srcdir)/stubs.am \
+               descr,hname,base="$(STUBS_HDR)" cname="$(STUBS_SRC)"
 
 ## Initialize lists of known classes.
 ALL_CIPHERS             = $(CIPHER_MODES)
 ALL_HASHES              = $(HASHES)
 ALL_MACS                = $(MAC_MODES)
 
+## Stub headers and sources.
+STUBS_HDR               =
+STUBS_SRC               =
+
 ###--------------------------------------------------------------------------
 ### Block ciphers.
 
@@ -191,6 +204,7 @@ BLKCS                       += safer safersk
 libsymm_la_SOURCES     += $(precomp)/safer-tab.c
 PRECOMPS               += $(precomp)/safer-tab.c
 PRECOMP_PROGS          += safer-mktab
+STUBS_HDR              += SAFER-SK,safersk,safer
 if !CROSS_COMPILING
 $(precomp)/safer-tab.c:
        $(AM_V_at)$(MKDIR_P) $(precomp)
@@ -297,6 +311,8 @@ HASHES                      += sha
 ## The National Security Agency's `SHA-2' suite.
 HASHES                 += sha224 sha256
 HASHES                 += sha384 sha512
+STUBS_HDR              += SHA-224,sha224,sha256
+STUBS_HDR              += SHA-384,sha384,sha512
 
 ## Anderson and Biham's `Tiger' hash function.
 HASHES                 += tiger
@@ -316,6 +332,7 @@ HASHES                      += whirlpool whirlpool256
 libsymm_la_SOURCES     += $(precomp)/whirlpool-tab.c
 PRECOMPS               += $(precomp)/whirlpool-tab.c
 PRECOMP_PROGS          += whirlpool-mktab
+STUBS_HDR              += Whirlpool-256,whirlpool256,whirlpool
 if !CROSS_COMPILING
 $(precomp)/whirlpool-tab.c:
        $(AM_V_at)$(MKDIR_P) $(precomp)
@@ -391,6 +408,27 @@ pkginclude_HEADERS += $(GENMODES_H)
 $(GENMODES_H): modes/gen-stamp
 
 ###--------------------------------------------------------------------------
+### Autogenerated stub headers.
+
+## The master stamp file.
+EXTRA_DIST             += stub.h.in
+EXTRA_DIST             += stubs.gen-stamp
+MAINTAINERCLEANFILES   += stubs.gen-stamp
+stubs.gen-stamp: Makefile.am
+       $(AM_V_at)$(MKDIR_P) $(srcdir)/stubs
+       $(AM_V_GEN)$(multigen) -g $(srcdir)/stub.h.in \
+               $(srcdir)/@name.h descr,name,base="$(STUBS_HDR)"
+       $(AM_V_GEN)$(multigen) -g $(srcdir)/stub.c.in \
+               $(srcdir)/@name.c name="$(STUBS_SRC)"
+       $(AM_V_at)touch $(srcdir)/stubs.gen-stamp
+
+## Generated stub headers.
+BUILT_SOURCES          += $(STUB_H) $(STUB_C)
+MAINTAINERCLEANFILES   += $(STUB_H) $(STUB_C)
+pkginclude_HEADERS     += $(STUB_H)
+$(STUB_H) $(STUB_C): stubs.gen-stamp
+
+###--------------------------------------------------------------------------
 ### Tables of classes for encryption, hashing, and message authentication.
 
 ## The skeleton for the class tables.
index c9041ee..389b553 100644 (file)
@@ -1,13 +1,10 @@
 /* -*-c-*-
  *
- * Stub source for SAFER SK
- *
- * (c) 2001 Straylight/Edgeware
+ * Stub code for SAFER-SK
  */
 
 #include "blkc.h"
 #include "safersk.h"
 
-const char *safersk_magic = "Compile this useless file";
-
+typedef int uninteresting;
 BLKC_TEST(SAFERSK, safersk)
diff --git a/symm/safersk.h b/symm/safersk.h
deleted file mode 100644 (file)
index 7087432..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/* -*-c-*-
- *
- * Stub header for SAFER SK
- *
- * (c) 2001 Straylight/Edgeware
- */
-
-#ifndef CATACOMB_SAFERSK_H
-#define CATACOMB_SAFERSK_H
-
-#include "safer.h"
-
-extern const char *safersk_magic;
-
-#endif
diff --git a/symm/sha224.h b/symm/sha224.h
deleted file mode 100644 (file)
index 3a49569..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*-c-*-
- *
- * Stub header for SHA-224
- */
-
-#ifndef CATACOMB_SHA224_H
-#define CATACOMB_SHA224_H
-
-#include "sha256.h"
-
-#endif
diff --git a/symm/sha384.h b/symm/sha384.h
deleted file mode 100644 (file)
index ed7731f..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*-c-*-
- *
- * Stub header for SHA-384
- */
-
-#ifndef CATACOMB_SHA384_H
-#define CATACOMB_SHA384_H
-
-#include "sha512.h"
-
-#endif
diff --git a/symm/stub.c.in b/symm/stub.c.in
new file mode 100644 (file)
index 0000000..59721da
--- /dev/null
@@ -0,0 +1,6 @@
+%## -*-c-*-
+%##
+%## Skeleton stub source file.
+%#
+/* -*-c-*- */
+typedef int uninteresting;
diff --git a/symm/stub.h.in b/symm/stub.h.in
new file mode 100644 (file)
index 0000000..7253194
--- /dev/null
@@ -0,0 +1,15 @@
+%## -*-c-*-
+%##
+%## Skeleton stub header file.
+%#
+/* -*-c-*-
+ *
+ * Stub header for @{descr}
+ */
+
+#ifndef CATACOMB_@{name:u}_H
+#define CATACOMB_@{name:u}_H
+
+#include "@base.h"
+
+#endif
diff --git a/symm/stubs.am.in b/symm/stubs.am.in
new file mode 100644 (file)
index 0000000..104363e
--- /dev/null
@@ -0,0 +1,15 @@
+%## -*-makefile-*-
+%#
+### -*-makefile-*- GENERATED from stubs.am.in
+###
+### A list of the stub header files we have to make.
+
+STUB_H =
+%repeat
+STUB_H += @hname.h
+%end
+
+STUB_C =
+%repeat
+STUB_C += @cname.c
+%end
diff --git a/symm/whirlpool256.h b/symm/whirlpool256.h
deleted file mode 100644 (file)
index 8091d74..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/* -*-c-*-
- *
- * Stub header for Whirlpool-256
- */
-
-#ifndef CATACOMB_WHIRLPOOL256_H
-#define CATACOMB_WHIRLPOOL256_H
-
-#include "whirlpool.h"
-
-#endif