From 7240557b7d6a06cd7e4cd50e52fb1e62d0a750e0 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 5 Oct 2015 22:58:01 +0100 Subject: [PATCH] Fix ASYNC null implementation 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 --- crypto/async/Makefile | 14 ++++- crypto/async/arch/async_null.c | 95 ++++++++++++++++++++++++++++++++++ crypto/async/arch/async_null.h | 4 ++ test/Makefile | 16 ++++++ test/asynctest.c | 3 ++ 5 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 crypto/async/arch/async_null.c diff --git a/crypto/async/Makefile b/crypto/async/Makefile index 4f0b3926de..886873257b 100644 --- a/crypto/async/Makefile +++ b/crypto/async/Makefile @@ -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 index 0000000000..f4adda9788 --- /dev/null +++ b/crypto/async/arch/async_null.c @@ -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 + +#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 + diff --git a/crypto/async/arch/async_null.h b/crypto/async/arch/async_null.h index 7d1c601db2..2dc4f2b42f 100644 --- a/crypto/async/arch/async_null.h +++ b/crypto/async/arch/async_null.h @@ -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 diff --git a/test/Makefile b/test/Makefile index c93586fe5b..efab36667b 100644 --- a/test/Makefile +++ b/test/Makefile @@ -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 diff --git a/test/asynctest.c b/test/asynctest.c index a0e2e1d11e..9ce23fbec2 100644 --- a/test/asynctest.c +++ b/test/asynctest.c @@ -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) { -- 2.34.1