Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12:Update
compat-openssl098.29129
0005-err-err.c-add-err_clear_last_constant_time...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0005-err-err.c-add-err_clear_last_constant_time.patch of Package compat-openssl098.29129
From 8db50d6dafc67fbaa0380420fc1f74f977d16606 Mon Sep 17 00:00:00 2001 From: Andy Polyakov <appro@openssl.org> Date: Sat, 1 Sep 2018 12:19:30 +0200 Subject: [PATCH 1/5] err/err.c: add err_clear_last_constant_time. Expected usage pattern is to unconditionally set error and then wipe it if there was no actual error. Reviewed-by: Richard Levitte <levitte@openssl.org> Reviewed-by: Matt Caswell <matt@openssl.org> (cherry picked from commit f658a3b64d8750642f4975090740865f770c2a1b) Resolved conflicts: crypto/err/err.c crypto/constant_time_locl.h (Merged from https://github.com/openssl/openssl/pull/7737) --- crypto/constant_time_locl.h | 6 ++++++ crypto/err/err.c | 38 +++++++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) Index: openssl-0.9.8j/crypto/constant_time_locl.h =================================================================== --- openssl-0.9.8j.orig/crypto/constant_time_locl.h +++ openssl-0.9.8j/crypto/constant_time_locl.h @@ -204,6 +204,12 @@ static inline int constant_time_select_i return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b))); } +/* + * Expected usage pattern is to unconditionally set error and then + * wipe it if there was no actual error. |clear| is 1 or 0. + */ +void err_clear_last_constant_time(int clear); + #ifdef __cplusplus } #endif Index: openssl-0.9.8j/crypto/err/err.c =================================================================== --- openssl-0.9.8j.orig/crypto/err/err.c +++ openssl-0.9.8j/crypto/err/err.c @@ -118,6 +118,7 @@ #include <openssl/buffer.h> #include <openssl/bio.h> #include <openssl/err.h> +#include "constant_time_locl.h" static unsigned long get_error_values(int inc,int top, const char **file,int *line, @@ -384,6 +385,43 @@ int ERR_pop_to_mark(void) return 1; } +#ifdef UINTPTR_T +# undef UINTPTR_T +#endif +/* + * uintptr_t is the answer, but unformtunately we can't assume that all + * compilers supported by 1.0.2 have it :-( + */ +#if defined(OPENSSL_SYS_VMS) && __INITIAL_POINTER_SIZE==64 +/* + * But we can't use size_t on VMS, because it adheres to sizeof(size_t)==4 + * even in 64-bit builds, which means that it won't work as mask. + */ +# define UINTPTR_T unsigned long long +#else +# define UINTPTR_T size_t +#endif + +void err_clear_last_constant_time(int clear) +{ + ERR_STATE *es; + int top; + + es = ERR_get_state(); + if (es == NULL) + return; + + top = es->top; + + es->err_flags[top] &= ~(0 - clear); + es->err_buffer[top] &= ~(0UL - clear); + es->err_file[top] = (const char *)((UINTPTR_T)es->err_file[top] & + ~((UINTPTR_T)0 - clear)); + es->err_line[top] |= 0 - clear; + + es->top = (top + ERR_NUM_ERRORS - clear) % ERR_NUM_ERRORS; +} + #ifdef OPENSSL_FIPS static ERR_STATE *fget_state(void)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor