#ifndef _SM_MODULE_H
#define _SM_MODULE_H
#ifdef __cplusplus
extern "C" {
#endif
#include <openssl/des.h>
#include <openssl/sha.h>
#include "libopensc/sm.h"
#include "sm/sm-common.h"
int sm_gp_get_mac(unsigned char *key, DES_cblock *icv, unsigned char *in, int in_len,
DES_cblock *out);
int sm_gp_get_cryptogram(unsigned char *session_key, unsigned char *left, unsigned char *right,
unsigned char *out, int out_len);
int sm_gp_external_authentication(struct sc_context *ctx, struct sm_info *sm_info,
unsigned char *init_data, size_t init_len,
struct sc_remote_data *out,
int (*diversify_keyset)(struct sc_context *ctx, struct sm_info *sm_info,
unsigned char *idata, size_t idata_len));
int sm_gp_initialize(struct sc_context *ctx, struct sm_info *sm_info,
struct sc_remote_data *out);
int sm_gp_securize_apdu(struct sc_context *ctx, struct sm_info *sm_info,
char *init_data, struct sc_apdu *apdu);
int sm_gp_decode_card_answer(struct sc_context *ctx, struct sc_remote_data *rdata,
unsigned char *out, size_t out_len);
void sm_gp_close_session(struct sc_context *ctx, struct sm_gp_session *gp_session);
int sm_cwa_initialize(struct sc_context *ctx, struct sm_info *sm_info,
struct sc_remote_data *out);
int sm_cwa_get_apdus(struct sc_context *ctx, struct sm_info *sm_info,
unsigned char *init_data, size_t init_len, struct sc_remote_data *out, int release_sm);
int sm_cwa_decode_card_data(struct sc_context *ctx, struct sm_info *sm_info, char *str_data,
unsigned char *out, size_t out_len);
int sm_cwa_securize_apdu(struct sc_context *ctx, struct sm_info *sm_info, struct sc_remote_apdu *rapdu);
int sm_cwa_decode_authentication_data(struct sc_context *ctx, struct sm_cwa_keyset *keyset,
struct sm_cwa_session *session_data, unsigned char *auth_data);
int sm_cwa_init_session_keys(struct sc_context *ctx, struct sm_cwa_session *session_data,
unsigned char mechanism);
int sm_authentic_get_apdus(struct sc_context *ctx, struct sm_info *sm_info,
unsigned char *init_data, size_t init_len, struct sc_remote_data *out, int release_sm);
int sm_iasecc_get_apdus(struct sc_context *ctx, struct sm_info *sm_info,
unsigned char *init_data, size_t init_len, struct sc_remote_data *out, int release_sm);
int sm_iasecc_decode_card_data(struct sc_context *ctx, struct sm_info *sm_info, struct sc_remote_data *rdata,
unsigned char *out, size_t out_len);
#ifdef __cplusplus
}
#endif
#endif