APPS=
LIB=$(TOP)/libcrypto.a
-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
+LIBSRC=async.c async_err.c arch/async_posix.c arch/async_win.c arch/async_null.c
+LIBOBJ=async.o async_err.o arch/async_posix.o arch/async_win.o arch/async_null.o
SRC= $(LIBSRC)
* ====================================================================
*/
+#include <openssl/err.h>
#include <openssl/async.h>
#include <string.h>
#include "async_locl.h"
async_ctx *nctx = NULL;
if(!(nctx = OPENSSL_malloc(sizeof (async_ctx)))) {
- /* Error here */
+ ASYNCerr(ASYNC_F_ASYNC_CTX_NEW, ERR_R_MALLOC_FAILURE);
goto err;
}
int pipefds[2];
if(!(job = OPENSSL_malloc(sizeof (ASYNC_JOB)))) {
+ ASYNCerr(ASYNC_F_ASYNC_JOB_NEW, ERR_R_MALLOC_FAILURE);
return NULL;
}
if(!async_pipe(pipefds)) {
OPENSSL_free(job);
+ ASYNCerr(ASYNC_F_ASYNC_JOB_NEW, ASYNC_R_CANNOT_CREATE_WAIT_PIPE);
return NULL;
}
if(!async_fibre_swapcontext(&job->fibrectx,
&async_get_ctx()->dispatcher, 1)) {
/*
- * Should not happen. Getting here will close the thread...can't do much
- * about it
+ * Should not happen. Getting here will close the thread...can't do
+ * much about it
*/
+ ASYNCerr(ASYNC_F_ASYNC_START_FUNC, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
}
}
}
async_get_ctx()->currjob = *job;
/* Resume previous job */
if(!async_fibre_swapcontext(&async_get_ctx()->dispatcher,
- &async_get_ctx()->currjob->fibrectx, 1))
+ &async_get_ctx()->currjob->fibrectx, 1)) {
+ ASYNCerr(ASYNC_F_ASYNC_START_JOB,
+ ASYNC_R_FAILED_TO_SWAP_CONTEXT);
goto err;
+ }
continue;
}
/* Should not happen */
+ ASYNCerr(ASYNC_F_ASYNC_START_JOB, ERR_R_INTERNAL_ERROR);
async_release_job(async_get_ctx()->currjob);
async_get_ctx()->currjob = NULL;
*job = NULL;
if(args != NULL) {
async_get_ctx()->currjob->funcargs = OPENSSL_malloc(size);
if(!async_get_ctx()->currjob->funcargs) {
+ ASYNCerr(ASYNC_F_ASYNC_START_JOB, ERR_R_MALLOC_FAILURE);
async_release_job(async_get_ctx()->currjob);
async_get_ctx()->currjob = NULL;
return ASYNC_ERR;
async_get_ctx()->currjob->func = func;
if(!async_fibre_swapcontext(&async_get_ctx()->dispatcher,
- &async_get_ctx()->currjob->fibrectx, 1))
+ &async_get_ctx()->currjob->fibrectx, 1)) {
+ ASYNCerr(ASYNC_F_ASYNC_START_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
goto err;
+ }
}
err:
{
ASYNC_JOB *job;
- if(!async_get_ctx() || !async_get_ctx()->currjob)
+ if(!async_get_ctx() || !async_get_ctx()->currjob) {
+ /*
+ * Could be we've deliberately not been started within a job so we
+ * don't put an error on the error queue here.
+ */
return 0;
+ }
job = async_get_ctx()->currjob;
job->status = ASYNC_JOB_PAUSING;
if(!async_fibre_swapcontext(&job->fibrectx,
&async_get_ctx()->dispatcher, 1)) {
- /* Error */
+ ASYNCerr(ASYNC_F_ASYNC_PAUSE_JOB, ASYNC_R_FAILED_TO_SWAP_CONTEXT);
return 0;
}
STACK_OF(ASYNC_JOB) *pool;
size_t curr_size = 0;
- if (init_size > max_size)
+ if (init_size > max_size) {
+ ASYNCerr(ASYNC_F_ASYNC_INIT_POOL, ASYNC_R_INVALID_POOL_SIZE);
return 0;
+ }
pool = sk_ASYNC_JOB_new_null();
if (pool == NULL) {
+ ASYNCerr(ASYNC_F_ASYNC_INIT_POOL, ERR_R_MALLOC_FAILURE);
return 0;
}
/* Pre-create jobs as required */
}
if (!async_set_pool(pool, curr_size, max_size)) {
+ ASYNCerr(ASYNC_F_ASYNC_INIT_POOL, ASYNC_R_FAILED_TO_SET_POOL);
async_empty_pool(pool);
sk_ASYNC_JOB_free(pool);
return 0;
--- /dev/null
+/* crypto/async/async_err.c */
+/* ====================================================================
+ * Copyright (c) 1999-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
+ * openssl-core@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.
+ * ====================================================================
+ *
+ * This product includes cryptographic software written by Eric Young
+ * (eay@cryptsoft.com). This product includes software written by Tim
+ * Hudson (tjh@cryptsoft.com).
+ *
+ */
+
+/*
+ * NOTE: this file was auto generated by the mkerr.pl script: any changes
+ * made to it will be overwritten when the script next updates this file,
+ * only reason strings will be preserved.
+ */
+
+#include <stdio.h>
+#include <openssl/err.h>
+#include <openssl/async.h>
+
+/* BEGIN ERROR CODES */
+#ifndef OPENSSL_NO_ERR
+
+# define ERR_FUNC(func) ERR_PACK(ERR_LIB_ASYNC,func,0)
+# define ERR_REASON(reason) ERR_PACK(ERR_LIB_ASYNC,0,reason)
+
+static ERR_STRING_DATA ASYNC_str_functs[] = {
+ {ERR_FUNC(ASYNC_F_ASYNC_CTX_NEW), "ASYNC_CTX_NEW"},
+ {ERR_FUNC(ASYNC_F_ASYNC_INIT_POOL), "ASYNC_init_pool"},
+ {ERR_FUNC(ASYNC_F_ASYNC_JOB_NEW), "ASYNC_JOB_NEW"},
+ {ERR_FUNC(ASYNC_F_ASYNC_PAUSE_JOB), "ASYNC_pause_job"},
+ {ERR_FUNC(ASYNC_F_ASYNC_START_FUNC), "ASYNC_START_FUNC"},
+ {ERR_FUNC(ASYNC_F_ASYNC_START_JOB), "ASYNC_start_job"},
+ {0, NULL}
+};
+
+static ERR_STRING_DATA ASYNC_str_reasons[] = {
+ {ERR_REASON(ASYNC_R_CANNOT_CREATE_WAIT_PIPE), "cannot create wait pipe"},
+ {ERR_REASON(ASYNC_R_FAILED_TO_SET_POOL), "failed to set pool"},
+ {ERR_REASON(ASYNC_R_FAILED_TO_SWAP_CONTEXT), "failed to swap context"},
+ {ERR_REASON(ASYNC_R_INVALID_POOL_SIZE), "invalid pool size"},
+ {0, NULL}
+};
+
+#endif
+
+void ERR_load_ASYNC_strings(void)
+{
+#ifndef OPENSSL_NO_ERR
+
+ if (ERR_func_error_string(ASYNC_str_functs[0].error) == NULL) {
+ ERR_load_strings(0, ASYNC_str_functs);
+ ERR_load_strings(0, ASYNC_str_reasons);
+ }
+#endif
+}
{ERR_PACK(ERR_LIB_FIPS, 0, 0), "FIPS routines"},
{ERR_PACK(ERR_LIB_CMS, 0, 0), "CMS routines"},
{ERR_PACK(ERR_LIB_HMAC, 0, 0), "HMAC routines"},
+ {ERR_PACK(ERR_LIB_ASYNC, 0, 0), "ASYNC routines"},
{0, NULL},
};
# include <openssl/jpake.h>
#endif
#include <internal/ct_int.h>
+#include <openssl/async.h>
void ERR_load_crypto_strings(void)
{
# ifndef OPENSSL_NO_CT
ERR_load_CT_strings();
# endif
+ ERR_load_ASYNC_strings();
#endif
}
L CMS include/openssl/cms.h crypto/cms/cms_err.c
L JPAKE include/openssl/jpake.h crypto/jpake/jpake_err.c
L FIPS include/openssl/fips.h crypto/fips_err.h
+L ASYNC include/openssl/async.h crypto/async/async_err.c
# additional header files to be scanned for function names
L NONE crypto/x509/x509_vfy.h NONE
void ASYNC_wake(ASYNC_JOB *job);
void ASYNC_clear_wake(ASYNC_JOB *job);
-# ifdef __cplusplus
-}
-# endif
+/* BEGIN ERROR CODES */
+/*
+ * The following lines are auto generated by the script mkerr.pl. Any changes
+ * made after this point may be overwritten when the script is next run.
+ */
+void ERR_load_ASYNC_strings(void);
+/* Error codes for the ASYNC functions. */
+
+/* Function codes. */
+# define ASYNC_F_ASYNC_CTX_NEW 100
+# define ASYNC_F_ASYNC_INIT_POOL 101
+# define ASYNC_F_ASYNC_JOB_NEW 102
+# define ASYNC_F_ASYNC_PAUSE_JOB 103
+# define ASYNC_F_ASYNC_START_FUNC 104
+# define ASYNC_F_ASYNC_START_JOB 105
+
+/* Reason codes. */
+# define ASYNC_R_CANNOT_CREATE_WAIT_PIPE 100
+# define ASYNC_R_FAILED_TO_SET_POOL 101
+# define ASYNC_R_FAILED_TO_SWAP_CONTEXT 102
+# define ASYNC_R_INVALID_POOL_SIZE 103
+
+#ifdef __cplusplus
+}
+#endif
#endif
# define ERR_LIB_HMAC 48
# define ERR_LIB_JPAKE 49
# define ERR_LIB_CT 50
+# define ERR_LIB_ASYNC 51
# define ERR_LIB_USER 128
# define HMACerr(f,r) ERR_PUT_error(ERR_LIB_HMAC,(f),(r),__FILE__,__LINE__)
# define JPAKEerr(f,r) ERR_PUT_error(ERR_LIB_JPAKE,(f),(r),__FILE__,__LINE__)
# define CTerr(f,r) ERR_PUT_error(ERR_LIB_CT,(f),(r),__FILE__,__LINE__)
+# define ASYNCerr(f,r) ERR_PUT_error(ERR_LIB_ASYNC,(f),(r),__FILE__,__LINE__)
/*
* Borland C seems too stupid to be able to shift and do longs in the