Fix ASYNC null implementation
authorMatt Caswell <matt@openssl.org>
Mon, 5 Oct 2015 21:58:01 +0000 (22:58 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 20 Nov 2015 23:34:35 +0000 (23:34 +0000)
The ASYNC null implementation has not kept pace with the rest of the async
development and so was failing to compile.

Reviewed-by: Rich Salz <rsalz@openssl.org>
crypto/async/Makefile
crypto/async/arch/async_null.c [new file with mode: 0644]
crypto/async/arch/async_null.h
test/Makefile
test/asynctest.c

index 4f0b3926de85f33c22903601959ee901c792c7c0..886873257b08eb4c9ac07670ba8a83d38ef4bd08 100644 (file)
@@ -17,8 +17,8 @@ TEST=
 APPS=
 
 LIB=$(TOP)/libcrypto.a
-LIBSRC=async.c arch/async_posix.c arch/async_win.c
-LIBOBJ=async.o arch/async_posix.o arch/async_win.o
+LIBSRC=async.c arch/async_posix.c arch/async_win.c arch/async_null.c
+LIBOBJ=async.o arch/async_posix.o arch/async_win.o arch/async_null.o
 
 SRC= $(LIBSRC)
 
@@ -76,6 +76,16 @@ clean:
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
+arch/async_null.o: ../../e_os.h ../../include/openssl/async.h
+arch/async_null.o: ../../include/openssl/crypto.h ../../include/openssl/e_os2.h
+arch/async_null.o: ../../include/openssl/opensslconf.h
+arch/async_null.o: ../../include/openssl/opensslv.h
+arch/async_null.o: ../../include/openssl/ossl_typ.h
+arch/async_null.o: ../../include/openssl/safestack.h
+arch/async_null.o: ../../include/openssl/stack.h
+arch/async_null.o: ../../include/openssl/symhacks.h arch/../arch/async_null.h
+arch/async_null.o: arch/../arch/async_posix.h arch/../arch/async_win.h
+arch/async_null.o: arch/../async_locl.h arch/async_null.c
 arch/async_posix.o: ../../e_os.h ../../include/openssl/async.h
 arch/async_posix.o: ../../include/openssl/crypto.h
 arch/async_posix.o: ../../include/openssl/e_os2.h
diff --git a/crypto/async/arch/async_null.c b/crypto/async/arch/async_null.c
new file mode 100644 (file)
index 0000000..f4adda9
--- /dev/null
@@ -0,0 +1,95 @@
+/* crypto/async/arch/async_null.c */
+/*
+ * Written by Matt Caswell (matt@openssl.org) for the OpenSSL project.
+ */
+/* ====================================================================
+ * Copyright (c) 2015 The OpenSSL Project.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this
+ *    software must display the following acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
+ *
+ * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
+ *    endorse or promote products derived from this software without
+ *    prior written permission. For written permission, please contact
+ *    licensing@OpenSSL.org.
+ *
+ * 5. Products derived from this software may not be called "OpenSSL"
+ *    nor may "OpenSSL" appear in their names without prior written
+ *    permission of the OpenSSL Project.
+ *
+ * 6. Redistributions of any form whatsoever must retain the following
+ *    acknowledgment:
+ *    "This product includes software developed by the OpenSSL Project
+ *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
+ * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+ * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
+ * OF THE POSSIBILITY OF SUCH DAMAGE.
+ * ====================================================================
+ */
+
+#include "../async_locl.h"
+#include <openssl/async.h>
+
+#ifdef ASYNC_NULL
+
+STACK_OF(ASYNC_JOB) *async_get_pool(void)
+{
+    return NULL;
+}
+
+int async_set_pool(STACK_OF(ASYNC_JOB) *poolin, size_t curr_size,
+                   size_t max_size)
+{
+    return 0;
+}
+
+void async_increment_pool_size(void)
+{
+    return;
+}
+
+void async_release_job_to_pool(ASYNC_JOB *job)
+{
+    return;
+}
+
+size_t async_pool_max_size(void)
+{
+    return 0;
+}
+
+void async_release_pool(void)
+{
+    return;
+}
+
+int async_pool_can_grow(void) {
+    return 0;
+}
+
+#endif
+
index 7d1c601db2a835d269727b733df07e665db970f3..2dc4f2b42fb4d08ea557b3e12e60cdf9f650d854 100644 (file)
@@ -73,4 +73,8 @@ typedef struct async_fibre_st {
 # define ASYNC_FIBRE_makecontext(c)
 # define ASYNC_FIBRE_free(f)
 # define ASYNC_FIBRE_init_dispatcher(f)
+# define async_pipe(f)                          0
+# define async_write1(f,b)                      ((*b == 0) ? (f = 0) : (f = 1))
+# define async_read1(f,b)                       (*b = 0)
+
 #endif
index c93586fe5bef7505e5174a9b1642871d89afe7b3..efab36667b2fd87dae28e9548266320bf8093b1a 100644 (file)
@@ -383,6 +383,22 @@ dummytest$(EXE_EXT): dummytest.o $(DLIBCRYPTO)
 
 # DO NOT DELETE THIS LINE -- make depend depends on it.
 
+asynctest.o: ../e_os.h ../include/../apps/apps.h ../include/../apps/progs.h
+asynctest.o: ../include/openssl/asn1.h ../include/openssl/async.h
+asynctest.o: ../include/openssl/bio.h ../include/openssl/buffer.h
+asynctest.o: ../include/openssl/conf.h ../include/openssl/crypto.h
+asynctest.o: ../include/openssl/e_os2.h ../include/openssl/ec.h
+asynctest.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h
+asynctest.o: ../include/openssl/engine.h ../include/openssl/evp.h
+asynctest.o: ../include/openssl/lhash.h ../include/openssl/obj_mac.h
+asynctest.o: ../include/openssl/objects.h ../include/openssl/ocsp.h
+asynctest.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h
+asynctest.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h
+asynctest.o: ../include/openssl/safestack.h ../include/openssl/sha.h
+asynctest.o: ../include/openssl/stack.h ../include/openssl/symhacks.h
+asynctest.o: ../include/openssl/txt_db.h ../include/openssl/x509.h
+asynctest.o: ../include/openssl/x509_vfy.h ../include/openssl/x509v3.h
+asynctest.o: asynctest.c
 bftest.o: ../e_os.h ../include/openssl/blowfish.h ../include/openssl/e_os2.h
 bftest.o: ../include/openssl/opensslconf.h bftest.c
 bntest.o: ../crypto/bn/bn_lcl.h ../crypto/include/internal/bn_int.h ../e_os.h
index a0e2e1d11ef9525d831327c001987b8c791a49ab..9ce23fbec2d26bb9c038092b87d045357638a397 100644 (file)
@@ -75,6 +75,8 @@
 # define ASYNC_NULL
 #endif
 
+#ifndef ASYNC_NULL
+
 static int ctr = 0;
 static ASYNC_JOB *currjob = NULL;
 
@@ -233,6 +235,7 @@ static int test_ASYNC_get_wait_fd()
     ASYNC_free_pool();
     return 1;
 }
+#endif
 
 int main(int argc, char **argv)
 {