Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
internal.h
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#ifndef YUBIHSM_INTERNAL_H
18#define YUBIHSM_INTERNAL_H
19
20#include "scp.h"
21
22#include <stdlib.h>
23#include <stdbool.h>
24
34
35typedef struct state yh_backend;
36
51
52#ifndef __WIN32
53#define YH_INTERNAL __attribute__((visibility("hidden")))
54#else
55#define YH_INTERNAL
56#endif
57
58void YH_INTERNAL dump_hex(FILE *file, const uint8_t *ptr, uint16_t len);
59void YH_INTERNAL dump_msg(FILE *file, const Msg *msg);
60void YH_INTERNAL dump_response(FILE *file, const Msg *msg);
61
62void YH_INTERNAL parse_status_data(char *data, yh_connector *connector);
63bool YH_INTERNAL parse_usb_url(const char *url, unsigned long *serial);
64
66 yh_rc (*backend_init)(uint8_t verbosity, FILE *output);
67 yh_backend *(*backend_create)(void);
68 yh_rc (*backend_connect)(yh_connector *connector, int timeout);
69 void (*backend_disconnect)(yh_backend *connection);
70 yh_rc (*backend_send_msg)(yh_backend *connection, Msg *msg, Msg *response);
71 void (*backend_cleanup)(void);
73 const void *val);
74 void (*backend_set_verbosity)(uint8_t verbosity, FILE *output);
75};
76
77#ifdef STATIC
78struct backend_functions YH_INTERNAL *usb_backend_functions(void);
79struct backend_functions YH_INTERNAL *http_backend_functions(void);
80#endif
81
82#endif
void YH_INTERNAL dump_response(FILE *file, const Msg *msg)
Definition lib_util.c:55
bool YH_INTERNAL parse_usb_url(const char *url, unsigned long *serial)
Definition lib_util.c:140
#define YH_INTERNAL
Definition internal.h:53
void YH_INTERNAL parse_status_data(char *data, yh_connector *connector)
Definition lib_util.c:65
void YH_INTERNAL dump_hex(FILE *file, const uint8_t *ptr, uint16_t len)
Definition lib_util.c:33
void YH_INTERNAL dump_msg(FILE *file, const Msg *msg)
Definition lib_util.c:45
string url
Definition main.cpp:166
#define SCP_KEY_LEN
Definition scp.h:37
#define SCP_CONTEXT_LEN
Definition scp.h:48
unsigned short uint16_t
Definition stdint.h:125
unsigned int uint32_t
Definition stdint.h:126
unsigned char uint8_t
Definition stdint.h:124
Definition scp.h:68
yh_rc(* backend_init)(uint8_t verbosity, FILE *output)
Definition internal.h:66
void(* backend_set_verbosity)(uint8_t verbosity, FILE *output)
Definition internal.h:74
void(* backend_disconnect)(yh_backend *connection)
Definition internal.h:69
yh_rc(* backend_send_msg)(yh_backend *connection, Msg *msg, Msg *response)
Definition internal.h:70
yh_rc(* backend_option)(yh_backend *connection, yh_connector_option opt, const void *val)
Definition internal.h:72
void(* backend_cleanup)(void)
Definition internal.h:71
yh_rc(* backend_connect)(yh_connector *connector, int timeout)
Definition internal.h:68
char * status_url
Definition internal.h:41
void * backend
Definition internal.h:38
char * api_url
Definition internal.h:42
bool has_device
Definition internal.h:43
uint8_t address[32]
Definition internal.h:47
uint32_t port
Definition internal.h:48
struct backend_functions * bf
Definition internal.h:39
uint8_t version_patch
Definition internal.h:46
uint32_t pid
Definition internal.h:49
yh_backend * connection
Definition internal.h:40
uint8_t version_minor
Definition internal.h:45
uint8_t version_major
Definition internal.h:44
bool recreate
Definition internal.h:28
uint8_t key_enc[SCP_KEY_LEN]
Definition internal.h:29
struct yh_connector * parent
Definition internal.h:26
Scp_ctx s
Definition internal.h:31
uint16_t authkey_id
Definition internal.h:27
uint8_t key_mac[SCP_KEY_LEN]
Definition internal.h:30
Definition scp.h:56
yh_connector_option
Definition yubihsm.h:500
yh_rc
Definition yubihsm.h:170
uint32_t serial
size_t len