projects
/
openssl.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix no-chacha and no-poly1305
[openssl.git]
/
test
/
stack_test.c
diff --git
a/test/stack_test.c
b/test/stack_test.c
index ba2ceaf415df6746138d673f3e378588ea39a80e..680f68d60e69b51d3a301adf6a5f60d96f2b0e4e 100644
(file)
--- a/
test/stack_test.c
+++ b/
test/stack_test.c
@@
-16,7
+16,7
@@
#include <openssl/err.h>
#include <openssl/crypto.h>
#include <openssl/err.h>
#include <openssl/crypto.h>
-#include "
e_os
.h"
+#include "
internal/nelem
.h"
#include "testutil.h"
/* The macros below generate unused functions which error out one of the clang
#include "testutil.h"
/* The macros below generate unused functions which error out one of the clang
@@
-50,7
+50,7
@@
static int int_compare(const int *const *a, const int *const *b)
return 0;
}
return 0;
}
-static int test_int_stack(
void
)
+static int test_int_stack(
int reserve
)
{
static int v[] = { 1, 2, -4, 16, 999, 1, -173, 1, 9 };
static int notpresent = -1;
{
static int v[] = { 1, 2, -4, 16, 999, 1, -173, 1, 9 };
static int notpresent = -1;
@@
-84,6
+84,10
@@
static int test_int_stack(void)
int i;
int testresult = 0;
int i;
int testresult = 0;
+ if (!TEST_ptr(s)
+ || (reserve > 0 && !TEST_true(sk_sint_reserve(s, 5 * reserve))))
+ goto end;
+
/* Check push and num */
for (i = 0; i < n; i++) {
if (!TEST_int_eq(sk_sint_num(s), i)) {
/* Check push and num */
for (i = 0; i < n; i++) {
if (!TEST_int_eq(sk_sint_num(s), i)) {
@@
-167,7
+171,7
@@
static int uchar_compare(const unsigned char *const *a,
return **a - (signed int)**b;
}
return **a - (signed int)**b;
}
-static int test_uchar_stack(
void
)
+static int test_uchar_stack(
int reserve
)
{
static const unsigned char v[] = { 1, 3, 7, 5, 255, 0 };
const int n = OSSL_NELEM(v);
{
static const unsigned char v[] = { 1, 3, 7, 5, 255, 0 };
const int n = OSSL_NELEM(v);
@@
-175,6
+179,10
@@
static int test_uchar_stack(void)
int i;
int testresult = 0;
int i;
int testresult = 0;
+ if (!TEST_ptr(s)
+ || (reserve > 0 && !TEST_true(sk_uchar_reserve(s, 5 * reserve))))
+ goto end;
+
/* unshift and num */
for (i = 0; i < n; i++) {
if (!TEST_int_eq(sk_uchar_num(s), i)) {
/* unshift and num */
for (i = 0; i < n; i++) {
if (!TEST_int_eq(sk_uchar_num(s), i)) {
@@
-364,8
+372,8
@@
end:
int setup_tests(void)
{
int setup_tests(void)
{
- ADD_
TEST(test_int_stack
);
- ADD_
TEST(test_uchar_stack
);
+ ADD_
ALL_TESTS(test_int_stack, 4
);
+ ADD_
ALL_TESTS(test_uchar_stack, 4
);
ADD_TEST(test_SS_stack);
ADD_TEST(test_SU_stack);
return 1;
ADD_TEST(test_SS_stack);
ADD_TEST(test_SU_stack);
return 1;