|
Packit |
6b81fa |
/*
|
|
Packit |
6b81fa |
* Copyright (c) 2001 Markus Friedl
|
|
Packit |
6b81fa |
* Copyright (c) 2002 Juha Yrjölä
|
|
Packit |
6b81fa |
* Copyright (c) 2003 Kevin Stefanik
|
|
Packit |
6b81fa |
* Copyright (c) 2016 Michał Trojnara
|
|
Packit |
6b81fa |
*
|
|
Packit |
6b81fa |
* Redistribution and use in source and binary forms, with or without
|
|
Packit |
6b81fa |
* modification, are permitted provided that the following conditions
|
|
Packit |
6b81fa |
* are met:
|
|
Packit |
6b81fa |
* 1. Redistributions of source code must retain the above copyright
|
|
Packit |
6b81fa |
* notice, this list of conditions and the following disclaimer.
|
|
Packit |
6b81fa |
* 2. Redistributions in binary form must reproduce the above copyright
|
|
Packit |
6b81fa |
* notice, this list of conditions and the following disclaimer in the
|
|
Packit |
6b81fa |
* documentation and/or other materials provided with the distribution.
|
|
Packit |
6b81fa |
*
|
|
Packit |
6b81fa |
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
Packit |
6b81fa |
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
Packit |
6b81fa |
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
Packit |
6b81fa |
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
Packit |
6b81fa |
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
Packit |
6b81fa |
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
Packit |
6b81fa |
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
Packit |
6b81fa |
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
Packit |
6b81fa |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
Packit |
6b81fa |
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
Packit |
6b81fa |
*/
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
#ifndef _ENGINE_PKCS11_H
|
|
Packit |
6b81fa |
#define _ENGINE_PKCS11_H
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
#ifndef _WIN32
|
|
Packit |
6b81fa |
#include "config.h"
|
|
Packit |
6b81fa |
#endif
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
#include "libp11.h"
|
|
Packit |
6b81fa |
#include "eng_err.h"
|
|
Packit |
6b81fa |
#include <stdio.h>
|
|
Packit |
6b81fa |
#include <string.h>
|
|
Packit |
6b81fa |
#include <openssl/crypto.h>
|
|
Packit |
6b81fa |
#include <openssl/objects.h>
|
|
Packit |
6b81fa |
#include <openssl/engine.h>
|
|
Packit |
6b81fa |
#include <openssl/ui.h>
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
#define CMD_SO_PATH ENGINE_CMD_BASE
|
|
Packit |
6b81fa |
#define CMD_MODULE_PATH (ENGINE_CMD_BASE+1)
|
|
Packit |
6b81fa |
#define CMD_PIN (ENGINE_CMD_BASE+2)
|
|
Packit |
6b81fa |
#define CMD_VERBOSE (ENGINE_CMD_BASE+3)
|
|
Packit |
6b81fa |
#define CMD_QUIET (ENGINE_CMD_BASE+4)
|
|
Packit |
6b81fa |
#define CMD_LOAD_CERT_CTRL (ENGINE_CMD_BASE+5)
|
|
Packit |
6b81fa |
#define CMD_INIT_ARGS (ENGINE_CMD_BASE+6)
|
|
Packit |
6b81fa |
#define CMD_SET_USER_INTERFACE (ENGINE_CMD_BASE + 7)
|
|
Packit |
6b81fa |
#define CMD_SET_CALLBACK_DATA (ENGINE_CMD_BASE + 8)
|
|
Packit |
6b81fa |
#define CMD_FORCE_LOGIN (ENGINE_CMD_BASE+9)
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
typedef struct st_engine_ctx ENGINE_CTX; /* opaque */
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
/* defined in eng_back.c */
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
ENGINE_CTX *ctx_new();
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
int ctx_destroy(ENGINE_CTX *ctx);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
int ctx_init(ENGINE_CTX *ctx);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
int ctx_finish(ENGINE_CTX *ctx);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
int ctx_engine_ctrl(ENGINE_CTX *ctx, int cmd, long i, void *p, void (*f)());
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
EVP_PKEY *ctx_load_pubkey(ENGINE_CTX *ctx, const char *s_key_id,
|
|
Packit |
6b81fa |
UI_METHOD * ui_method, void *callback_data);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
EVP_PKEY *ctx_load_privkey(ENGINE_CTX *ctx, const char *s_key_id,
|
|
Packit |
6b81fa |
UI_METHOD * ui_method, void *callback_data);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
void ctx_log(ENGINE_CTX *ctx, int level, const char *format, ...)
|
|
Packit |
6b81fa |
#ifdef __GNUC__
|
|
Packit |
6b81fa |
__attribute__((format(printf, 3, 4)))
|
|
Packit |
6b81fa |
#endif
|
|
Packit |
6b81fa |
;
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
/* defined in eng_parse.c */
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
int parse_pkcs11_uri(ENGINE_CTX *ctx,
|
|
Packit |
6b81fa |
const char *uri, PKCS11_TOKEN **p_tok,
|
|
Packit |
6b81fa |
unsigned char *id, size_t *id_len, char *pin, size_t *pin_len,
|
|
Packit |
6b81fa |
char **label);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
int parse_slot_id_string(ENGINE_CTX *ctx,
|
|
Packit |
6b81fa |
const char *slot_id, int *slot,
|
|
Packit |
6b81fa |
unsigned char *id, size_t * id_len, char **label);
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
#endif
|
|
Packit |
6b81fa |
|
|
Packit |
6b81fa |
/* vim: set noexpandtab: */
|