[openssl-commits] [openssl] OpenSSL_1_1_0-stable update
Rich Salz
rsalz at openssl.org
Tue Feb 28 18:58:53 UTC 2017
The branch OpenSSL_1_1_0-stable has been updated
via 3cca3e29f9c694585783074ba5fcc90dfd58c1f7 (commit)
from 4ba808de916c9390d45d733563313d8d8f8dbe44 (commit)
- Log -----------------------------------------------------------------
commit 3cca3e29f9c694585783074ba5fcc90dfd58c1f7
Author: Rich Salz <rsalz at openssl.org>
Date: Tue Feb 28 10:53:28 2017 -0500
Exdata test was never enabled.
Reviewed-by: Richard Levitte <levitte at openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2787)
(cherry picked from commit 629192c1b9f17965e0a6b73229b7b1e004bfbd98)
-----------------------------------------------------------------------
Summary of changes:
test/build.info | 6 ++-
test/exdatatest.c | 59 ++++++++++++----------
.../{90-test_bioprint.t => 03-test_exdata.t} | 4 +-
3 files changed, 38 insertions(+), 31 deletions(-)
copy test/recipes/{90-test_bioprint.t => 03-test_exdata.t} (73%)
diff --git a/test/build.info b/test/build.info
index 0c2c909..641505d 100644
--- a/test/build.info
+++ b/test/build.info
@@ -1,7 +1,7 @@
IF[{- !$disabled{tests} -}]
PROGRAMS_NO_INST=\
aborttest \
- sanitytest bntest \
+ sanitytest exdatatest bntest \
ectest ecdsatest ecdhtest gmdifftest pbelutest ideatest \
md2test md4test md5test \
hmactest wp_test \
@@ -26,6 +26,10 @@ IF[{- !$disabled{tests} -}]
INCLUDE[sanitytest]=../include
DEPEND[sanitytest]=../libcrypto
+ SOURCE[exdatatest]=exdatatest.c
+ INCLUDE[exdatatest]=../include
+ DEPEND[exdatatest]=../libcrypto
+
SOURCE[bntest]=bntest.c
INCLUDE[bntest]=.. ../crypto/include ../include
DEPEND[bntest]=../libcrypto
diff --git a/test/exdatatest.c b/test/exdatatest.c
index 8e35068..e82fdbf 100644
--- a/test/exdatatest.c
+++ b/test/exdatatest.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2015-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2015-2017 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the OpenSSL license (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
@@ -8,68 +8,66 @@
*/
#include <stdio.h>
-#include <assert.h>
#include <string.h>
#include <stdlib.h>
+#include <assert.h>
#include <openssl/crypto.h>
-static long sargl;
-static void *sargp;
-static int sidx;
+static long saved_argl;
+static void *saved_argp;
+static int saved_idx;
static void exnew(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
int idx, long argl, void *argp)
{
- assert(idx == sidx);
- assert(argl == sargl);
- assert(argp == sargp);
+ assert(idx == saved_idx);
+ assert(argl == saved_argl);
+ assert(argp == saved_argp);
}
-static int exdup(CRYPTO_EX_DATA *to, CRYPTO_EX_DATA *from,
+static int exdup(CRYPTO_EX_DATA *to, const CRYPTO_EX_DATA *from,
void *from_d, int idx, long argl, void *argp)
{
- assert(idx == sidx);
- assert(argl == sargl);
- assert(argp == sargp);
+ assert(idx == saved_idx);
+ assert(argl == saved_argl);
+ assert(argp == saved_argp);
return 0;
}
static void exfree(void *parent, void *ptr, CRYPTO_EX_DATA *ad,
int idx, long argl, void *argp)
{
- assert(idx == sidx);
- assert(argl == sargl);
- assert(argp == sargp);
+ assert(idx == saved_idx);
+ assert(argl == saved_argl);
+ assert(argp == saved_argp);
}
typedef struct myobj_st {
CRYPTO_EX_DATA ex_data;
int id;
+ int st;
} MYOBJ;
static MYOBJ *MYOBJ_new()
{
static int count = 0;
MYOBJ *obj = OPENSSL_malloc(sizeof(*obj));
- int st;
obj->id = ++count;
- st = CRYPTO_new_ex_data(CRYPTO_EX_INDEX_APP, obj, &obj->ex_data);
- assert(st != 0);
+ obj->st = CRYPTO_new_ex_data(CRYPTO_EX_INDEX_APP, obj, &obj->ex_data);
+ assert(obj->st != 0);
return obj;
}
static void MYOBJ_sethello(MYOBJ *obj, char *cp)
{
- int st;
-
- st = CRYPTO_set_ex_data(&obj->ex_data, sidx, cp);
- assert(st != 0);
+ obj->st = CRYPTO_set_ex_data(&obj->ex_data, saved_idx, cp);
+ assert(obj->st != 0);
}
static char *MYOBJ_gethello(MYOBJ *obj)
{
- return CRYPTO_get_ex_data(&obj->ex_data, sidx);
+ return CRYPTO_get_ex_data(&obj->ex_data, saved_idx);
}
static void MYOBJ_free(MYOBJ *obj)
@@ -85,20 +83,25 @@ int main()
char *p;
p = strdup("hello world");
- sargl = 21;
- sargp = malloc(1);
- sidx = CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_APP, sargl, sargp,
- exnew, exdup, exfree);
+ saved_argl = 21;
+ saved_argp = malloc(1);
+ saved_idx = CRYPTO_get_ex_new_index(CRYPTO_EX_INDEX_APP,
+ saved_argl, saved_argp,
+ exnew, exdup, exfree);
t1 = MYOBJ_new();
t2 = MYOBJ_new();
MYOBJ_sethello(t1, p);
cp = MYOBJ_gethello(t1);
assert(cp == p);
+ if (cp != p)
+ return 1;
cp = MYOBJ_gethello(t2);
assert(cp == NULL);
+ if (cp != NULL)
+ return 1;
MYOBJ_free(t1);
MYOBJ_free(t2);
- free(sargp);
+ free(saved_argp);
free(p);
return 0;
}
diff --git a/test/recipes/90-test_bioprint.t b/test/recipes/03-test_exdata.t
similarity index 73%
copy from test/recipes/90-test_bioprint.t
copy to test/recipes/03-test_exdata.t
index b86e828..da66f95 100644
--- a/test/recipes/90-test_bioprint.t
+++ b/test/recipes/03-test_exdata.t
@@ -1,5 +1,5 @@
#! /usr/bin/env perl
-# Copyright 2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
#
# Licensed under the OpenSSL license (the "License"). You may not use
# this file except in compliance with the License. You can obtain a copy
@@ -9,4 +9,4 @@
use OpenSSL::Test::Simple;
-simple_test("test_bioprint", "bioprinttest");
+simple_test("test_exdata", "exdatatest");
More information about the openssl-commits
mailing list