Use #error in openssl/srp.h
authorRich Salz <rsalz@akamai.com>
Thu, 14 May 2015 19:21:36 +0000 (15:21 -0400)
committerRich Salz <rsalz@openssl.org>
Fri, 15 May 2015 12:16:21 +0000 (08:16 -0400)
Follow the same convention the other OPENSSL_NO_xxx header files
do, and use #error instead of making the header file be a no-op.

Reviewed-by: Matt Caswell <matt@openssl.org>
apps/s_client.c
apps/s_server.c
apps/srp.c
include/openssl/srp.h
ssl/tls_srp.c

index 8d78dc7df2c96d00eaae6dd3a5aaa936d6948749..ba411f2e11d6874fc316cb20bda03a5b655a3e80 100644 (file)
@@ -925,6 +925,13 @@ int s_client_main(int argc, char **argv)
             srp_arg.amp = 1;
             meth = TLSv1_client_method();
             break;
+#else
+        case OPT_SRPUSER:
+        case OPT_SRPPASS:
+        case OPT_SRP_STRENGTH:
+        case OPT_SRP_LATEUSER:
+        case OPT_SRP_MOREGROUPS:
+            break;
 #endif
 #ifndef OPENSSL_NO_SSL3
         case OPT_SSL3:
index c54caa6fe265534494d368214124b801ba802045..2ef902a5315164251c906e0c88f27c531eb258cb 100644 (file)
@@ -1317,6 +1317,10 @@ int s_server_main(int argc, char *argv[])
             srpuserseed = opt_arg();
             meth = TLSv1_server_method();
             break;
+#else
+        case OPT_SRPVFILE:
+        case OPT_SRPUSERSEED:
+            break;
 #endif
         case OPT_REV:
             rev = 1;
index ec875cb9fbc6cbfb95eab2d372a4d2bdd6e43ab7..6c50a6e6d7c00887c0f5353049597fc6db9169ae 100644 (file)
@@ -680,4 +680,10 @@ int srp_main(int argc, char **argv)
     return (ret);
 }
 
+#else
+
+# if PEDANTIC
+static void *dummy = &dummy;
+# endif
+
 #endif
index de6631d94f39e5a466b04682ae84d014572dfede..3411fe571e79fa335508651bdf508665b20aa157 100644 (file)
 #ifndef __SRP_H__
 # define __SRP_H__
 
-# ifndef OPENSSL_NO_SRP
+#include <openssl/opensslconf.h>
 
-#  include <stdio.h>
-#  include <string.h>
+# ifdef OPENSSL_NO_SRP
+#  error SRP is disabled.
+# endif
+
+# include <stdio.h>
+# include <string.h>
 
 #ifdef  __cplusplus
 extern "C" {
 #endif
 
-#  include <openssl/safestack.h>
-#  include <openssl/bn.h>
-#  include <openssl/crypto.h>
+# include <openssl/safestack.h>
+# include <openssl/bn.h>
+# include <openssl/crypto.h>
 
 typedef struct SRP_gN_cache_st {
     char *b64_bn;
@@ -122,25 +126,25 @@ int SRP_create_verifier_BN(const char *user, const char *pass, BIGNUM **salt,
                            BIGNUM **verifier, const BIGNUM *N,
                            const BIGNUM *g);
 
-#  define SRP_NO_ERROR 0
-#  define SRP_ERR_VBASE_INCOMPLETE_FILE 1
-#  define SRP_ERR_VBASE_BN_LIB 2
-#  define SRP_ERR_OPEN_FILE 3
-#  define SRP_ERR_MEMORY 4
-
-#  define DB_srptype      0
-#  define DB_srpverifier  1
-#  define DB_srpsalt      2
-#  define DB_srpid        3
-#  define DB_srpgN        4
-#  define DB_srpinfo      5
-#  undef  DB_NUMBER
-#  define DB_NUMBER       6
-
-#  define DB_SRP_INDEX    'I'
-#  define DB_SRP_VALID    'V'
-#  define DB_SRP_REVOKED  'R'
-#  define DB_SRP_MODIF    'v'
+# define SRP_NO_ERROR 0
+# define SRP_ERR_VBASE_INCOMPLETE_FILE 1
+# define SRP_ERR_VBASE_BN_LIB 2
+# define SRP_ERR_OPEN_FILE 3
+# define SRP_ERR_MEMORY 4
+
+# define DB_srptype      0
+# define DB_srpverifier  1
+# define DB_srpsalt      2
+# define DB_srpid        3
+# define DB_srpgN        4
+# define DB_srpinfo      5
+# undef  DB_NUMBER
+# define DB_NUMBER       6
+
+# define DB_SRP_INDEX    'I'
+# define DB_SRP_VALID    'V'
+# define DB_SRP_REVOKED  'R'
+# define DB_SRP_MODIF    'v'
 
 /* see srp.c */
 char *SRP_check_known_gN_param(BIGNUM *g, BIGNUM *N);
@@ -160,11 +164,10 @@ BIGNUM *SRP_Calc_client_key(BIGNUM *N, BIGNUM *B, BIGNUM *g, BIGNUM *x,
                             BIGNUM *a, BIGNUM *u);
 int SRP_Verify_B_mod_N(BIGNUM *B, BIGNUM *N);
 
-#  define SRP_MINIMAL_N 1024
+# define SRP_MINIMAL_N 1024
 
 #ifdef  __cplusplus
 }
 #endif
 
-# endif
 #endif
index 7d4fd1db3214ff67e92b7ce13a83789423935565..6bd78452449e6175a80ee0cc7eff20fd38a45f5a 100644 (file)
 
 #include <openssl/crypto.h>
 #include <openssl/rand.h>
-#include <openssl/srp.h>
 #include <openssl/err.h>
 #include "ssl_locl.h"
 
 #ifndef OPENSSL_NO_SRP
+#include <openssl/srp.h>
 
 int SSL_CTX_SRP_CTX_free(struct ssl_ctx_st *ctx)
 {