Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
debug_p11.c
Go to the documentation of this file.
1/*
2 * Copyright 2015-2018 Yubico AB
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include <stdlib.h>
18#include <string.h>
19
20#include "debug_p11.h"
21#include "yubihsm.h"
22
23int _YHP11_DBG = 0;
25FILE *_YHP11_OUTPUT = NULL;
26
27void yh_dbg_init(int dbg, int dinout, int libdbg, const char *debug_file) {
28 if (_YHP11_OUTPUT != stderr && _YHP11_OUTPUT != stdout &&
29 _YHP11_OUTPUT != NULL) {
30 fclose(_YHP11_OUTPUT);
31 _YHP11_OUTPUT = stderr;
32 }
33 if (strcmp(debug_file, "stderr") == 0) {
34 _YHP11_OUTPUT = stderr;
35 } else if (strcmp(debug_file, "stdout") == 0) {
36 _YHP11_OUTPUT = stdout;
37 } else {
38 FILE *file = fopen(debug_file, "ab");
39 if (file) {
40 _YHP11_OUTPUT = file;
41 } else {
42 _YHP11_OUTPUT = stderr;
43 }
44 }
46 if (dbg || getenv("YUBIHSM_PKCS11_DBG")) {
47 _YHP11_DBG = 1;
48 }
49 if (dinout || getenv("YUBIHSM_PKCS11_DINOUT")) {
50 _YHP11_DINOUT = 1;
51 }
52 if (libdbg || getenv("YUBIHSM_LIB_DBG")) {
54 }
55}
FILE * _YHP11_OUTPUT
Definition debug_p11.c:25
int _YHP11_DBG
Definition debug_p11.c:23
void yh_dbg_init(int dbg, int dinout, int libdbg, const char *debug_file)
Definition debug_p11.c:27
int _YHP11_DINOUT
Definition debug_p11.c:24
yh_rc yh_set_verbosity(yh_connector *connector, uint8_t verbosity)
Definition yubihsm.c:3825
void yh_set_debug_output(yh_connector *connector, FILE *output)
Definition yubihsm.c:3848
#define YH_VERB_ALL
Debug level all. All previous options enabled.
Definition yubihsm.h:145