24#define EXIT_SKIPPED 77;
38 "\x40\x41\x42\x43\x44\x45\x46\x47\x48\x49\x4a\x4b\x4c\x4d\x4e\x4f"
42#define N_ITERATIONS 1000
57 struct timeval before, after;
70 if (
yrc != YH_SUCCESS) {
71 fprintf(stderr,
"Unable to initialize\n");
72 fprintf(stderr,
"(Typically this happens if you don't have permissions to "
74 fprintf(stderr,
"try re-running as root/Administrator)\n");
79 fprintf(stderr,
"No suitable device found. Skipping this test\n");
92 fprintf(stderr,
"now doing plain with len %d\n",
len);
94 response_len =
sizeof(response);
96 gettimeofday(&before, NULL);
99 gettimeofday(&after, NULL);
101 this = (after.tv_sec - before.tv_sec) * 1000;
102 this += ((double) (after.tv_usec - before.tv_usec)) / 1000;
107 if (
this > rs[
rep].max) {
110 if (
this < rs[
rep].min) {
117 if (rs[
rep].
len != response_len ||
118 memcmp(data, response, rs[
rep].
len) != 0) {
119 fprintf(stderr,
"Data mismatch\n");
131 if (
yrc != YH_SUCCESS) {
137 16, yh_context, &
ses);
138 if (
yrc != YH_SUCCESS) {
139 fprintf(stderr,
"Failed to create session: %s\n",
yh_strerror(
yrc));
144 if (
yrc != YH_SUCCESS) {
145 fprintf(stderr,
"Failed to create session: %d, %s\n",
yrc,
154 fprintf(stderr,
"now doing auth with len %d\n",
len);
156 response_len =
sizeof(response);
158 gettimeofday(&before, NULL);
161 gettimeofday(&after, NULL);
162 if (
yrc != YH_SUCCESS) {
163 fprintf(stderr,
"Failed to send message: %d, %s\n",
yrc,
168 this = (after.tv_sec - before.tv_sec) * 1000;
169 this += ((double) (after.tv_usec - before.tv_usec)) / 1000;
174 if (
this > rs2[
rep].max) {
177 if (
this < rs2[
rep].min) {
184 if (rs2[
rep].
len != response_len ||
185 memcmp(data, response, rs2[
rep].
len) != 0) {
186 fprintf(stderr,
"Data mismatch\n");
195 fprintf(stdout,
"| Len | min [ms] | max [ms] | avg [ms] | type |\n");
196 fprintf(stdout,
"---------------------------------------------------\n");
198 fprintf(stdout,
"| %6d | %8.02f | %8.02f | %8.02f | plain |\n", rs[i].
len,
202 fprintf(stdout,
"| %6d | %8.02f | %8.02f | %8.02f | auth |\n", rs2[i].
len,
const char * yh_strerror(yh_rc err)
yh_rc yh_create_session(yh_connector *connector, uint16_t authkey_id, const uint8_t *key_enc, size_t key_enc_len, const uint8_t *key_mac, size_t key_mac_len, bool recreate, yh_session **session)
yh_rc yh_set_verbosity(yh_connector *connector, uint8_t verbosity)
yh_rc yh_send_secure_msg(yh_session *session, yh_cmd cmd, const uint8_t *data, size_t data_len, yh_cmd *response_cmd, uint8_t *response, size_t *response_len)
yh_rc yh_authenticate_session(yh_session *session)
yh_rc yh_send_plain_msg(yh_connector *connector, yh_cmd cmd, const uint8_t *data, size_t data_len, yh_cmd *response_cmd, uint8_t *response, size_t *response_len)
#define YH_HOST_CHAL_LEN
Length of host challenge for authentication.
#define YH_MSG_BUF_SIZE
Maximum length of message buffer.
#define YH_KEY_LEN
Length of authentication keys.
#define YH_CONTEXT_LEN
Length of context array for authentication.
memset(pInfo->slotDescription, ' ', 64)
memcpy((char *) pInfo->slotDescription, s, l)