diff options
author | deshevoy <deshevoy@yandex-team.ru> | 2022-02-10 16:46:57 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:57 +0300 |
commit | 28148f76dbfcc644d96427d41c92f36cbf2fdc6e (patch) | |
tree | b83306b6e37edeea782e9eed673d89286c4fef35 /contrib/libs/openssl/crypto/async/arch | |
parent | e988f30484abe5fdeedcc7a5d3c226c01a21800c (diff) | |
download | ydb-28148f76dbfcc644d96427d41c92f36cbf2fdc6e.tar.gz |
Restoring authorship annotation for <deshevoy@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'contrib/libs/openssl/crypto/async/arch')
-rw-r--r-- | contrib/libs/openssl/crypto/async/arch/async_null.c | 44 | ||||
-rw-r--r-- | contrib/libs/openssl/crypto/async/arch/async_null.h | 60 | ||||
-rw-r--r-- | contrib/libs/openssl/crypto/async/arch/async_posix.c | 114 | ||||
-rw-r--r-- | contrib/libs/openssl/crypto/async/arch/async_posix.h | 110 | ||||
-rw-r--r-- | contrib/libs/openssl/crypto/async/arch/async_win.c | 108 | ||||
-rw-r--r-- | contrib/libs/openssl/crypto/async/arch/async_win.h | 72 |
6 files changed, 254 insertions, 254 deletions
diff --git a/contrib/libs/openssl/crypto/async/arch/async_null.c b/contrib/libs/openssl/crypto/async/arch/async_null.c index 8d470ba2b9..26801f8731 100644 --- a/contrib/libs/openssl/crypto/async/arch/async_null.c +++ b/contrib/libs/openssl/crypto/async/arch/async_null.c @@ -1,23 +1,23 @@ -/* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* This must be the first #include file */ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* This must be the first #include file */ #include "../async_local.h" - -#ifdef ASYNC_NULL -int ASYNC_is_capable(void) -{ - return 0; -} - -void async_local_cleanup(void) -{ -} -#endif - + +#ifdef ASYNC_NULL +int ASYNC_is_capable(void) +{ + return 0; +} + +void async_local_cleanup(void) +{ +} +#endif + diff --git a/contrib/libs/openssl/crypto/async/arch/async_null.h b/contrib/libs/openssl/crypto/async/arch/async_null.h index 950cd4bc5b..aef40b5d9e 100644 --- a/contrib/libs/openssl/crypto/async/arch/async_null.h +++ b/contrib/libs/openssl/crypto/async/arch/async_null.h @@ -1,30 +1,30 @@ -/* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -#include <openssl/async.h> - -/* - * If we haven't managed to detect any other async architecture then we default - * to NULL. - */ -#ifndef ASYNC_ARCH -# define ASYNC_NULL -# define ASYNC_ARCH - -typedef struct async_fibre_st { - int dummy; -} async_fibre; - - -# define async_fibre_swapcontext(o,n,r) 0 -# define async_fibre_makecontext(c) 0 -# define async_fibre_free(f) -# define async_fibre_init_dispatcher(f) - -#endif +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#include <openssl/async.h> + +/* + * If we haven't managed to detect any other async architecture then we default + * to NULL. + */ +#ifndef ASYNC_ARCH +# define ASYNC_NULL +# define ASYNC_ARCH + +typedef struct async_fibre_st { + int dummy; +} async_fibre; + + +# define async_fibre_swapcontext(o,n,r) 0 +# define async_fibre_makecontext(c) 0 +# define async_fibre_free(f) +# define async_fibre_init_dispatcher(f) + +#endif diff --git a/contrib/libs/openssl/crypto/async/arch/async_posix.c b/contrib/libs/openssl/crypto/async/arch/async_posix.c index 62759c0535..95678d4fa6 100644 --- a/contrib/libs/openssl/crypto/async/arch/async_posix.c +++ b/contrib/libs/openssl/crypto/async/arch/async_posix.c @@ -1,58 +1,58 @@ -/* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* This must be the first #include file */ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* This must be the first #include file */ #include "../async_local.h" - -#ifdef ASYNC_POSIX - -# include <stddef.h> -# include <unistd.h> - -#define STACKSIZE 32768 - -int ASYNC_is_capable(void) -{ - ucontext_t ctx; - - /* - * Some platforms provide getcontext() but it does not work (notably - * MacOSX PPC64). Check for a working getcontext(); - */ - return getcontext(&ctx) == 0; -} - -void async_local_cleanup(void) -{ -} - -int async_fibre_makecontext(async_fibre *fibre) -{ - fibre->env_init = 0; - if (getcontext(&fibre->fibre) == 0) { - fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE); - if (fibre->fibre.uc_stack.ss_sp != NULL) { - fibre->fibre.uc_stack.ss_size = STACKSIZE; - fibre->fibre.uc_link = NULL; - makecontext(&fibre->fibre, async_start_func, 0); - return 1; - } - } else { - fibre->fibre.uc_stack.ss_sp = NULL; - } - return 0; -} - -void async_fibre_free(async_fibre *fibre) -{ - OPENSSL_free(fibre->fibre.uc_stack.ss_sp); - fibre->fibre.uc_stack.ss_sp = NULL; -} - -#endif + +#ifdef ASYNC_POSIX + +# include <stddef.h> +# include <unistd.h> + +#define STACKSIZE 32768 + +int ASYNC_is_capable(void) +{ + ucontext_t ctx; + + /* + * Some platforms provide getcontext() but it does not work (notably + * MacOSX PPC64). Check for a working getcontext(); + */ + return getcontext(&ctx) == 0; +} + +void async_local_cleanup(void) +{ +} + +int async_fibre_makecontext(async_fibre *fibre) +{ + fibre->env_init = 0; + if (getcontext(&fibre->fibre) == 0) { + fibre->fibre.uc_stack.ss_sp = OPENSSL_malloc(STACKSIZE); + if (fibre->fibre.uc_stack.ss_sp != NULL) { + fibre->fibre.uc_stack.ss_size = STACKSIZE; + fibre->fibre.uc_link = NULL; + makecontext(&fibre->fibre, async_start_func, 0); + return 1; + } + } else { + fibre->fibre.uc_stack.ss_sp = NULL; + } + return 0; +} + +void async_fibre_free(async_fibre *fibre) +{ + OPENSSL_free(fibre->fibre.uc_stack.ss_sp); + fibre->fibre.uc_stack.ss_sp = NULL; +} + +#endif diff --git a/contrib/libs/openssl/crypto/async/arch/async_posix.h b/contrib/libs/openssl/crypto/async/arch/async_posix.h index a701235188..873c0316dd 100644 --- a/contrib/libs/openssl/crypto/async/arch/async_posix.h +++ b/contrib/libs/openssl/crypto/async/arch/async_posix.h @@ -1,58 +1,58 @@ -/* - * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - +/* + * Copyright 2015-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + #ifndef OSSL_CRYPTO_ASYNC_POSIX_H #define OSSL_CRYPTO_ASYNC_POSIX_H -#include <openssl/e_os2.h> - -#if defined(OPENSSL_SYS_UNIX) \ - && defined(OPENSSL_THREADS) && !defined(OPENSSL_NO_ASYNC) \ - && !defined(__ANDROID__) && !defined(__OpenBSD__) - -# include <unistd.h> - -# if _POSIX_VERSION >= 200112L \ - && (_POSIX_VERSION < 200809L || defined(__GLIBC__)) - -# include <pthread.h> - -# define ASYNC_POSIX -# define ASYNC_ARCH - -# include <ucontext.h> -# include <setjmp.h> - -typedef struct async_fibre_st { - ucontext_t fibre; - jmp_buf env; - int env_init; -} async_fibre; - -static ossl_inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r) -{ - o->env_init = 1; - - if (!r || !_setjmp(o->env)) { - if (n->env_init) - _longjmp(n->env, 1); - else - setcontext(&n->fibre); - } - - return 1; -} - -# define async_fibre_init_dispatcher(d) - -int async_fibre_makecontext(async_fibre *fibre); -void async_fibre_free(async_fibre *fibre); - -# endif -#endif +#include <openssl/e_os2.h> + +#if defined(OPENSSL_SYS_UNIX) \ + && defined(OPENSSL_THREADS) && !defined(OPENSSL_NO_ASYNC) \ + && !defined(__ANDROID__) && !defined(__OpenBSD__) + +# include <unistd.h> + +# if _POSIX_VERSION >= 200112L \ + && (_POSIX_VERSION < 200809L || defined(__GLIBC__)) + +# include <pthread.h> + +# define ASYNC_POSIX +# define ASYNC_ARCH + +# include <ucontext.h> +# include <setjmp.h> + +typedef struct async_fibre_st { + ucontext_t fibre; + jmp_buf env; + int env_init; +} async_fibre; + +static ossl_inline int async_fibre_swapcontext(async_fibre *o, async_fibre *n, int r) +{ + o->env_init = 1; + + if (!r || !_setjmp(o->env)) { + if (n->env_init) + _longjmp(n->env, 1); + else + setcontext(&n->fibre); + } + + return 1; +} + +# define async_fibre_init_dispatcher(d) + +int async_fibre_makecontext(async_fibre *fibre); +void async_fibre_free(async_fibre *fibre); + +# endif +#endif #endif /* OSSL_CRYPTO_ASYNC_POSIX_H */ diff --git a/contrib/libs/openssl/crypto/async/arch/async_win.c b/contrib/libs/openssl/crypto/async/arch/async_win.c index 639571b1dc..1f360d895b 100644 --- a/contrib/libs/openssl/crypto/async/arch/async_win.c +++ b/contrib/libs/openssl/crypto/async/arch/async_win.c @@ -1,55 +1,55 @@ -/* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* This must be the first #include file */ +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* This must be the first #include file */ #include "../async_local.h" - -#ifdef ASYNC_WIN - -# include <windows.h> -# include "internal/cryptlib.h" - -int ASYNC_is_capable(void) -{ - return 1; -} - -void async_local_cleanup(void) -{ - async_ctx *ctx = async_get_ctx(); - if (ctx != NULL) { - async_fibre *fibre = &ctx->dispatcher; - if (fibre != NULL && fibre->fibre != NULL && fibre->converted) { - ConvertFiberToThread(); - fibre->fibre = NULL; - } - } -} - -int async_fibre_init_dispatcher(async_fibre *fibre) -{ - fibre->fibre = ConvertThreadToFiber(NULL); - if (fibre->fibre == NULL) { - fibre->converted = 0; - fibre->fibre = GetCurrentFiber(); - if (fibre->fibre == NULL) - return 0; - } else { - fibre->converted = 1; - } - - return 1; -} - -VOID CALLBACK async_start_func_win(PVOID unused) -{ - async_start_func(); -} - -#endif + +#ifdef ASYNC_WIN + +# include <windows.h> +# include "internal/cryptlib.h" + +int ASYNC_is_capable(void) +{ + return 1; +} + +void async_local_cleanup(void) +{ + async_ctx *ctx = async_get_ctx(); + if (ctx != NULL) { + async_fibre *fibre = &ctx->dispatcher; + if (fibre != NULL && fibre->fibre != NULL && fibre->converted) { + ConvertFiberToThread(); + fibre->fibre = NULL; + } + } +} + +int async_fibre_init_dispatcher(async_fibre *fibre) +{ + fibre->fibre = ConvertThreadToFiber(NULL); + if (fibre->fibre == NULL) { + fibre->converted = 0; + fibre->fibre = GetCurrentFiber(); + if (fibre->fibre == NULL) + return 0; + } else { + fibre->converted = 1; + } + + return 1; +} + +VOID CALLBACK async_start_func_win(PVOID unused) +{ + async_start_func(); +} + +#endif diff --git a/contrib/libs/openssl/crypto/async/arch/async_win.h b/contrib/libs/openssl/crypto/async/arch/async_win.h index fd89c58e15..61cfdd72de 100644 --- a/contrib/libs/openssl/crypto/async/arch/async_win.h +++ b/contrib/libs/openssl/crypto/async/arch/async_win.h @@ -1,36 +1,36 @@ -/* - * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. - * - * Licensed under the OpenSSL license (the "License"). You may not use - * this file except in compliance with the License. You can obtain a copy - * in the file LICENSE in the source distribution or at - * https://www.openssl.org/source/license.html - */ - -/* - * This is the same detection used in cryptlib to set up the thread local - * storage that we depend on, so just copy that - */ -#if defined(_WIN32) && !defined(OPENSSL_NO_ASYNC) -#include <openssl/async.h> -# define ASYNC_WIN -# define ASYNC_ARCH - -# include <windows.h> -# include "internal/cryptlib.h" - -typedef struct async_fibre_st { - LPVOID fibre; - int converted; -} async_fibre; - -# define async_fibre_swapcontext(o,n,r) \ - (SwitchToFiber((n)->fibre), 1) -# define async_fibre_makecontext(c) \ - ((c)->fibre = CreateFiber(0, async_start_func_win, 0)) -# define async_fibre_free(f) (DeleteFiber((f)->fibre)) - -int async_fibre_init_dispatcher(async_fibre *fibre); -VOID CALLBACK async_start_func_win(PVOID unused); - -#endif +/* + * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +/* + * This is the same detection used in cryptlib to set up the thread local + * storage that we depend on, so just copy that + */ +#if defined(_WIN32) && !defined(OPENSSL_NO_ASYNC) +#include <openssl/async.h> +# define ASYNC_WIN +# define ASYNC_ARCH + +# include <windows.h> +# include "internal/cryptlib.h" + +typedef struct async_fibre_st { + LPVOID fibre; + int converted; +} async_fibre; + +# define async_fibre_swapcontext(o,n,r) \ + (SwitchToFiber((n)->fibre), 1) +# define async_fibre_makecontext(c) \ + ((c)->fibre = CreateFiber(0, async_start_func_win, 0)) +# define async_fibre_free(f) (DeleteFiber((f)->fibre)) + +int async_fibre_init_dispatcher(async_fibre *fibre); +VOID CALLBACK async_start_func_win(PVOID unused); + +#endif |