Make a BSSL_CHECK that always aborts
Change-Id: Ie1867ed8a9763331bcc83482cfb22f1e39a281d4
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/62366
Reviewed-by: David Benjamin <davidben@google.com>
Commit-Queue: Bob Beck <bbe@google.com>
diff --git a/include/openssl/base.h b/include/openssl/base.h
index 97a17bb..9430c8e 100644
--- a/include/openssl/base.h
+++ b/include/openssl/base.h
@@ -58,6 +58,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <stdlib.h>
#include <sys/types.h>
#if defined(__MINGW32__)
@@ -383,6 +384,13 @@
typedef void *OPENSSL_BLOCK;
+// BSSL_CHECK aborts if |condition| is not true.
+#define BSSL_CHECK(condition) \
+ do { \
+ if (!(condition)) { \
+ abort(); \
+ } \
+ } while (0);
#if defined(__cplusplus)
} // extern C