]> git.pld-linux.org Git - packages/opensc.git/blame - build.patch
- fix tests build, rel 6
[packages/opensc.git] / build.patch
CommitLineData
5f4e2851
AM
1--- /dev/null 2018-05-15 12:27:28.000000000 +0200
2+++ opensc-0.19.0/src/tests/p11test/p11test_common.h 2018-09-25 21:02:30.158771398 +0200
3@@ -0,0 +1,89 @@
4+/*
5+ * p11test_common.h: Test suite shared declarations for PKCS#11 API
6+ *
7+ * Copyright (C) 2016 Martin Strhársky <strharsky.martin@gmail.com>
8+ * Copyright (C) 2016, 2017 Red Hat, Inc.
9+ *
10+ * Author: Jakub Jelen <jjelen@redhat.com>
11+ *
12+ * This library is free software; you can redistribute it and/or
13+ * modify it under the terms of the GNU Lesser General Public
14+ * License as published by the Free Software Foundation; either
15+ * version 2.1 of the License, or (at your option) any later version.
16+ *
17+ * This library is distributed in the hope that it will be useful,
18+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
19+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20+ * Lesser General Public License for more details.
21+ *
22+ * You should have received a copy of the GNU General Public License
23+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
24+ */
25+
26+#ifndef P11TEST_COMMON_H
27+#define P11TEST_COMMON_H
28+#include "config.h"
29+#include <stdio.h>
30+#include <stdlib.h>
31+#include <string.h>
32+#include <setjmp.h>
33+#include <cmocka.h>
34+#include "pkcs11/pkcs11.h"
35+#include "libopensc/sc-ossl-compat.h"
36+
37+#define MAX_MECHS 200
38+
39+#ifndef NDEBUG
40+ #define debug_print(fmt, ...) \
41+ { fprintf(stderr, fmt "\n", ##__VA_ARGS__); } while (0)
42+#else
43+ #define debug_print(fmt, ...)
44+#endif
45+
46+#define FLAGS_SIGN 0x01
47+#define FLAGS_SIGN_OPENSSL 0x02
48+#define FLAGS_SIGN_ANY ( FLAGS_SIGN | FLAGS_SIGN_OPENSSL )
49+#define FLAGS_DECRYPT 0x04
50+#define FLAGS_DECRYPT_OPENSSL 0x08
51+#define FLAGS_DECRYPT_ANY ( FLAGS_DECRYPT | FLAGS_DECRYPT_OPENSSL )
52+
53+typedef struct {
54+ char *outfile;
55+ FILE *fd;
56+ int in_test;
57+ int first;
58+ int in_data;
59+ int first_data;
60+} log_context_t;
61+
62+typedef struct {
63+ CK_MECHANISM_TYPE mech;
64+ CK_MECHANISM_TYPE hash;
65+ CK_RSA_PKCS_MGF_TYPE mgf;
66+ int salt;
67+ int usage_flags;
68+ int result_flags;
69+} test_mech_t;
70+
71+typedef struct {
72+ CK_FUNCTION_LIST_PTR function_pointer;
73+ CK_SLOT_ID slot_id;
74+ CK_SESSION_HANDLE session_handle;
75+ CK_UTF8CHAR* pin;
76+ size_t pin_length;
77+ char *library_path;
78+ unsigned int interactive;
79+ log_context_t log;
80+
81+ test_mech_t rsa_mechs[MAX_MECHS];
82+ size_t num_rsa_mechs;
83+ test_mech_t ec_mechs[MAX_MECHS];
84+ size_t num_ec_mechs;
85+ test_mech_t keygen_mechs[MAX_MECHS];
86+ size_t num_keygen_mechs;
87+} token_info_t;
88+
0ad4458f 89+extern token_info_t token;
5f4e2851
AM
90+
91+#endif /* P11TEST_COMMON_H */
92+
075acfab
AM
93From c012f46965b3fe24e31367796e52c2d0b14ca5d9 Mon Sep 17 00:00:00 2001
94From: Khem Raj <raj.khem@gmail.com>
95Date: Mon, 17 Dec 2018 18:44:23 -0800
96Subject: [PATCH] Remove redundant logging
97
98Same information is printed a few line below in same function, the only
99difference is that there it takes care of case when label is NULL pointer
100unlike this line
101
102secondly, every function call to cosm_write_tokeninfo() in this file
103passes label=NULL, and then it tries to print a null pointer
104
105Fixes errors like
106src/libopensc/log.h:48:47: error: '%s' directive argument is null
107[-Werror=format-overflow=]
108
109Upstream-Status: Submitted [https://github.com/OpenSC/OpenSC/pull/1557]
110Signed-off-by: Khem Raj <raj.khem@gmail.com>
111---
112 src/pkcs15init/pkcs15-oberthur.c | 1 -
113 1 file changed, 1 deletion(-)
114
115Index: git/src/pkcs15init/pkcs15-oberthur.c
116===================================================================
117--- git.orig/src/pkcs15init/pkcs15-oberthur.c
118+++ git/src/pkcs15init/pkcs15-oberthur.c
119@@ -70,7 +70,6 @@ cosm_write_tokeninfo (struct sc_pkcs15_c
120 ctx = p15card->card->ctx;
121
122 SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_VERBOSE);
123- sc_debug(ctx, SC_LOG_DEBUG_NORMAL, "cosm_write_tokeninfo() label '%s'; flags 0x%X", label, flags);
124 if (sc_profile_get_file(profile, COSM_TITLE"-token-info", &file)) {
125 rv = SC_ERROR_INCONSISTENT_PROFILE;
126 SC_TEST_GOTO_ERR(ctx, SC_LOG_DEBUG_NORMAL, rv, "Cannot find "COSM_TITLE"-token-info");
0ad4458f
JR
127--- opensc-0.19.0/src/tests/p11test/p11test.c~ 2018-09-13 13:52:42.000000000 +0200
128+++ opensc-0.19.0/src/tests/p11test/p11test.c 2021-10-15 22:37:12.303953281 +0200
129@@ -33,6 +33,8 @@
130
131 #define DEFAULT_P11LIB "../../pkcs11/.libs/opensc-pkcs11.so"
132
133+token_info_t token;
134+
135 void display_usage() {
136 fprintf(stdout,
137 " Usage:\n"
This page took 0.054235 seconds and 4 git commands to generate.