Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/boringssl.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@chromium.org>2015-01-06 19:49:25 +0300
committerAdam Langley <agl@google.com>2015-01-06 21:29:45 +0300
commit2be62c304c3af7d7e02e07fb04edbd0d4c418b40 (patch)
tree5f01f4fc662476ba928f102dadfed7f19b0da115 /crypto/err
parent4dd053e0593cff0e0eb615b2d5a994510922a6f7 (diff)
Test which direction ERR_get_error reads from the error queue.
ERR_get_error returns the least recent error, not the most recent error. Nothing in err_test was actually asserting on that. Change-Id: Ia49e29c231de4bbec77d037860ad1ffa8cce4779 Reviewed-on: https://boringssl-review.googlesource.com/2750 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/err')
-rw-r--r--crypto/err/err_test.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/crypto/err/err_test.c b/crypto/err/err_test.c
index 214f4f2b..09dc1f62 100644
--- a/crypto/err/err_test.c
+++ b/crypto/err/err_test.c
@@ -23,11 +23,15 @@ static int test_overflow(void) {
unsigned i;
for (i = 0; i < ERR_NUM_ERRORS*2; i++) {
- ERR_put_error(1, 2, 3, "test", 1);
+ ERR_put_error(1, 2, i+1, "test", 1);
}
for (i = 0; i < ERR_NUM_ERRORS - 1; i++) {
- if (ERR_get_error() == 0) {
+ uint32_t err = ERR_get_error();
+ /* Errors are returned in order they were pushed, with the least recent ones
+ * removed, up to |ERR_NUM_ERRORS - 1| errors. So the errors returned are
+ * |ERR_NUM_ERRORS + 2| through |ERR_NUM_ERRORS * 2|, inclusive. */
+ if (err == 0 || ERR_GET_REASON(err) != i + ERR_NUM_ERRORS + 2) {
fprintf(stderr, "ERR_get_error failed at %u\n", i);
return 0;
}