diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libcrypto/constant_time_locl.h | 2 | ||||
-rw-r--r-- | lib/libcrypto/err/err.c | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/lib/libcrypto/constant_time_locl.h b/lib/libcrypto/constant_time_locl.h index 2cabfb460e6..2d511cc0bfe 100644 --- a/lib/libcrypto/constant_time_locl.h +++ b/lib/libcrypto/constant_time_locl.h @@ -200,6 +200,8 @@ static inline int constant_time_select_int(unsigned int mask, int a, int b) return (int)(constant_time_select(mask, (unsigned)(a), (unsigned)(b))); } +void err_clear_last_constant_time(int clear); + __END_HIDDEN_DECLS #endif /* HEADER_CONSTANT_TIME_LOCL_H */ diff --git a/lib/libcrypto/err/err.c b/lib/libcrypto/err/err.c index caabfe01d6e..f05567e1739 100644 --- a/lib/libcrypto/err/err.c +++ b/lib/libcrypto/err/err.c @@ -1,4 +1,4 @@ -/* $OpenBSD: err.c,v 1.47 2018/04/03 21:59:37 tb Exp $ */ +/* $OpenBSD: err.c,v 1.48 2019/10/17 14:28:53 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1184,3 +1184,24 @@ ERR_pop_to_mark(void) es->err_flags[es->top]&=~ERR_FLAG_MARK; return 1; } + +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; +} |