Latest update

This commit is contained in:
2019-04-01 00:21:15 +09:00
parent c03e0c45f8
commit 48ec086472
209 changed files with 7552 additions and 2495 deletions
+19 -17
View File
@@ -11,6 +11,7 @@
#include <string.h>
#include "testutil.h"
#include "internal/nelem.h"
#include "ossl_test_endian.h"
#include <openssl/params.h>
#include <openssl/bn.h>
@@ -27,20 +28,22 @@ static void swap_copy(unsigned char *out, const void *in, size_t len)
static void copy_to_le(unsigned char *out, const void *in, size_t len)
{
#ifdef B_ENDIAN
swap_copy(out, in, len);
#else
memcpy(out, in, len);
#endif
DECLARE_IS_ENDIAN;
if (IS_LITTLE_ENDIAN)
memcpy(out, in, len);
else
swap_copy(out, in, len);
}
static void copy_be_to_native(unsigned char *out, const void *in, size_t len)
{
#ifdef B_ENDIAN
memcpy(out, in, len);
#else
swap_copy(out, in, len);
#endif
DECLARE_IS_ENDIAN;
if (IS_LITTLE_ENDIAN)
swap_copy(out, in, len);
else
memcpy(out, in, len);
}
static const struct {
@@ -103,12 +106,12 @@ static int test_param_type_extra(const OSSL_PARAM *param, unsigned char *cmp,
if (signd) {
if (!TEST_true(OSSL_PARAM_set_int32(param, 12345))
|| !TEST_true(OSSL_PARAM_get_int64(param, &i64))
|| !TEST_size_t_eq(i64, 12345))
|| !TEST_size_t_eq((size_t)i64, 12345))
return 0;
} else {
if (!TEST_true(OSSL_PARAM_set_uint32(param, 12345))
|| !TEST_true(OSSL_PARAM_get_uint64(param, (uint64_t *)&i64))
|| !TEST_size_t_eq(i64, 12345))
|| !TEST_size_t_eq((size_t)i64, 12345))
return 0;
}
}
@@ -465,7 +468,7 @@ static int test_param_construct(void)
OSSL_PARAM params[20];
char buf[100], buf2[100], *bufp, *bufp2;
unsigned char ubuf[100];
void *vp, *vp2;
void *vp, *vpn = NULL, *vp2;
OSSL_PARAM *p;
const OSSL_PARAM *cp;
static const OSSL_PARAM pend = OSSL_PARAM_END;
@@ -557,7 +560,6 @@ static int test_param_construct(void)
|| !TEST_ptr_eq(bufp2, bufp))
goto err;
/* OCTET string */
vp = NULL;
if (!TEST_ptr(p = locate(params, "octstr"))
|| !TEST_true(OSSL_PARAM_set_octet_string(p, "abcdefghi",
sizeof("abcdefghi")))
@@ -565,12 +567,11 @@ static int test_param_construct(void)
goto err;
/* Match the return size to avoid trailing garbage bytes */
p->data_size = *p->return_size;
if (!TEST_true(OSSL_PARAM_get_octet_string(p, &vp, 0, &s))
if (!TEST_true(OSSL_PARAM_get_octet_string(p, &vpn, 0, &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
|| !TEST_mem_eq(vp, sizeof("abcdefghi"),
|| !TEST_mem_eq(vpn, sizeof("abcdefghi"),
"abcdefghi", sizeof("abcdefghi")))
goto err;
OPENSSL_free(vp);
vp = buf2;
if (!TEST_true(OSSL_PARAM_get_octet_string(p, &vp, sizeof(buf2), &s))
|| !TEST_size_t_eq(s, sizeof("abcdefghi"))
@@ -604,6 +605,7 @@ static int test_param_construct(void)
goto err;
ret = 1;
err:
OPENSSL_free(vpn);
BN_free(bn);
BN_free(bn2);
return ret;