Fix no-sock
[openssl.git] / test / dtlsv1listentest.c
index 6eef1b5e4ebd7e7c5e0517fb069c52ac3d8a9a5f..6eb2e5ccfbb8abae301d5317ae3792884b80beb7 100644 (file)
@@ -65,6 +65,8 @@
 #endif
 #include "e_os.h"
 
+#ifndef OPENSSL_NO_SOCK
+
 /* Just a ClientHello without a cookie */
 static const unsigned char clienthello_nocookie[] = {
     0x16, /* Handshake */
@@ -339,7 +341,7 @@ static struct {
     }
 };
 
-#define COOKIE_LEN  20
+# define COOKIE_LEN  20
 
 static int cookie_gen(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len)
 {
@@ -368,9 +370,11 @@ static int cookie_verify(SSL *ssl, const unsigned char *cookie,
 
     return 1;
 }
+#endif
 
 int main(void)
 {
+#ifndef OPENSSL_NO_SOCK
     SSL_CTX *ctx = NULL;
     SSL *ssl = NULL;
     BIO *outbio = NULL;
@@ -459,9 +463,12 @@ int main(void)
     SSL_CTX_free(ctx);
     BIO_free(inbio);
     OPENSSL_free(peer);
-#ifndef OPENSSL_NO_CRYPTO_MDEBUG
+# ifndef OPENSSL_NO_CRYPTO_MDEBUG
     CRYPTO_mem_leaks_fp(stderr);
-#endif
+# endif
     return success ? 0 : 1;
+#else
+    printf("DTLSv1_listen() is not supported by this build - skipping\n");
+    return 0;
+#endif
 }
-