OpenDNSSEC-libhsm
2.0.3
|
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/shm.h>
#include <sys/sem.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <unistd.h>
#include <termios.h>
#include <errno.h>
#include "libhsm.h"
Go to the source code of this file.
Data Structures | |
union | semun |
Macros | |
#define | SHM_KEY (key_t)0x0d50d5ec |
#define | SEM_KEY (key_t)0x0d50d5ec |
#define | SHM_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP |
#define | SEM_PERM S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP |
Functions | |
void | hsm_ctx_set_error (hsm_ctx_t *ctx, int error, const char *action, const char *message,...) |
char * | hsm_prompt_pin (unsigned int id, const char *repository, unsigned int mode) |
char * | hsm_check_pin (unsigned int id, const char *repository, unsigned int mode) |
int | hsm_logout_pin () |
Variables | |
hsm_ctx_t * | _hsm_ctx |
#define SEM_KEY (key_t)0x0d50d5ec |
Definition at line 52 of file pin.c.
Referenced by hsm_logout_pin().
#define SHM_KEY (key_t)0x0d50d5ec |
Definition at line 51 of file pin.c.
Referenced by hsm_logout_pin().
char* hsm_check_pin | ( | unsigned int | id, |
const char * | repository, | ||
unsigned int | mode | ||
) |
Function that will check if there is a PIN in the shared memory and returns it.
id | Used for identifying the repository. Will have a value between zero and HSM_MAX_SESSIONS. |
repository | The repository name will be included in the prompt |
mode | The type of mode the function should run in. |
Definition at line 325 of file pin.c.
References HSM_MAX_PIN_LENGTH, HSM_MAX_SESSIONS, HSM_PIN_FIRST, HSM_PIN_RETRY, and HSM_PIN_SAVE.
void hsm_ctx_set_error | ( | hsm_ctx_t * | ctx, |
int | error, | ||
const char * | action, | ||
const char * | message, | ||
... | |||
) |
Set HSM Context Error
If the ctx is given, and it's error value is still 0, the value will be set to 'error', and the error_message and error_action will be set to the given strings.
ctx | HSM context |
error | error code |
action | action for which the error occured |
message | error message format string |
Definition at line 203 of file libhsm.c.
References hsm_ctx_t::error, hsm_ctx_t::error_action, and hsm_ctx_t::error_message.
Referenced by hsm_get_dnskey(), hsm_logout_pin(), and hsm_token_attached().
int hsm_logout_pin | ( | void | ) |
char* hsm_prompt_pin | ( | unsigned int | id, |
const char * | repository, | ||
unsigned int | mode | ||
) |
Function that queries for a PIN, can be used as callback for hsm_open(). Stores the PIN in the shared memory.
id | Used for identifying the repository. Will have a value between zero and HSM_MAX_SESSIONS. |
repository | The repository name will be included in the prompt |
mode | The type of mode the function should run in. |
Definition at line 228 of file pin.c.
References HSM_MAX_PIN_LENGTH, HSM_MAX_SESSIONS, HSM_PIN_FIRST, HSM_PIN_RETRY, and HSM_PIN_SAVE.
hsm_ctx_t* _hsm_ctx |
Global (initial) context
Global (initial) context, with mutex to serialize access to it
Definition at line 56 of file libhsm.c.
Referenced by hsm_check_context(), and hsm_get_error().