/***********************************************************
* Copyright (C) Aktiv Co. 2026-2026                        *
* biopkcs11.h                                              *
* This file contains all symbols for bio functions         *
***********************************************************/

#ifndef __BIOPKCS11_H__
#define __BIOPKCS11_H__

/* Standart header with declarations of all types and functions */
#include "cryptoki.h"

#ifdef _WIN32
#pragma pack(push, biopkcs11, 1)
#endif

#ifdef __cplusplus
extern "C" {
#endif

#include "biopkcs11t.h"

#define __PASTE(x,y)      x##y

/* ==============================================================
 * Define the "extern" form of all the entry points
 * ============================================================*/
 

#define CK_NEED_ARG_LIST  1
#define CK_PKCS11_FUNCTION_INFO(name) \
  extern CK_DECLARE_FUNCTION(CK_RV, name)

/* biopkcs11f.h has all the information about the bio function prototypes */
#include "biopkcs11f.h"

#undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO


/* ==============================================================
 * Define the typedef form of all the entry points.  That is, for
 * each function C_BIO_XXX, define a type CK_C_XXX which
 * is a pointer to that kind of function.
 * ==============================================================
 */

#define CK_NEED_ARG_LIST  1
#define CK_PKCS11_FUNCTION_INFO(name) \
  typedef CK_DECLARE_FUNCTION_POINTER(CK_RV, __PASTE(CK_,name))

/* biopkcs11f.h has all the information about the bio function prototypes */
#include "biopkcs11f.h"

#undef CK_NEED_ARG_LIST
#undef CK_PKCS11_FUNCTION_INFO


/* ========================================================================
 * Define structed vector of entry points. A CK_FUNCTION_LIST_BIO
 * contains a CK_VERSION indicating a library's Cryptoki version
 * and then a whole slew of function pointers to the routines in
 * the library.  This type was declared, but not defined, in biopkcs11t.h.
 * ========================================================================
 */

#define CK_PKCS11_FUNCTION_INFO(name) \
  __PASTE(CK_,name) name;

struct CK_FUNCTION_LIST_BIO {

  CK_VERSION    version;    /* Cryptoki version */

/* Pile all the function pointers into the CK_FUNCTION_LIST_BIO */
/* biopkcs11f.h has all the information about the bio function prototypes */
#include "biopkcs11f.h"

};

#undef CK_PKCS11_FUNCTION_INFO

#undef __PASTE

#ifdef __cplusplus
}
#endif

#ifdef _WIN32
#pragma pack(pop, biopkcs11)
#endif

#endif /* __BIOPKCS11_H__ */

