chiark / gitweb /
rsa: Introduce LDPUBFATAL
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 23 Nov 2019 13:37:01 +0000 (13:37 +0000)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 15 Feb 2020 21:56:50 +0000 (21:56 +0000)
Error handling, and thus the implementation, is going to change.
So move bring it into a common place.

No functional change.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
rsa.c

diff --git a/rsa.c b/rsa.c
index 9261ab30c93bdd42558a27a01796233b416a595f..44b9b818b7e5a28440d7d78f83486e4a2b3bb23f 100644 (file)
--- a/rsa.c
+++ b/rsa.c
@@ -315,6 +315,9 @@ static void rsapub_dispose(void *sst) {
 #define RSAPUB_LOADCORE_DEFBN(ix,en,what) \
     const char *en##s, struct cloc en##_loc,
 
+#define LDPUBFATAL(enloc,...) \
+    cfgfatal(enloc, "rsa-public", __VA_ARGS__)
+
 static struct rsapub *rsa_loadpub_core(RSAPUB_BNS(RSAPUB_LOADCORE_DEFBN)
                                       struct cloc overall_loc)
 {
@@ -336,11 +339,11 @@ static struct rsapub *rsa_loadpub_core(RSAPUB_BNS(RSAPUB_LOADCORE_DEFBN)
 
 #define RSAPUB_LOADCORE_GETBN(ix,en,what)                              \
     if (mpz_init_set_str(&st->en,en##s,10)!=0) {                       \
-       cfgfatal(en##_loc,"rsa-public", what " \"%s\" is not a "        \
+       LDPUBFATAL(en##_loc, what " \"%s\" is not a "                   \
                 "decimal number string\n",en##s);                      \
     }                                                                  \
     if (mpz_sizeinbase(&st->en, 256) > RSA_MAX_MODBYTES) {             \
-       cfgfatal(en##_loc, "rsa-public", "implausibly large " what "\n"); \
+       LDPUBFATAL(en##_loc, "implausibly large " what "\n");           \
     }
 
     RSAPUB_BNS(RSAPUB_LOADCORE_GETBN)