cswift.h revision 7c478bd95313f5f23a4c958a745db2134aa03244
/* Attribution notice: Rainbow have generously allowed me to reproduce
* the necessary definitions here from their API. This means the support
* can build independently of whether application builders have the
* API or hardware. This will allow developers to easily produce software
* that has latent hardware support for any users that have accelertors
* installed, without the developers themselves needing anything extra.
*
* I have only clipped the parts from the CryptoSwift header files that
* are (or seem) relevant to the CryptoSwift support code. This is
* simply to keep the file sizes reasonable.
* [Geoff]
*/
/* NB: These type widths do *not* seem right in general, in particular
* they're not terribly friendly to 64-bit architectures (unsigned long)
* will be 64-bit on IA-64 for a start. I'm leaving these alone as they
* agree with Rainbow's API and this will only be called into question
* on platforms with Rainbow support anyway! ;-) */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef long SW_STATUS; /* status */
typedef unsigned char SW_BYTE; /* 8 bit byte */
typedef unsigned short SW_U16; /* 16 bit number */
#if defined(_IRIX)
#include <sgidefs.h>
typedef __uint32_t SW_U32;
#else
typedef unsigned long SW_U32; /* 32 bit integer */
#endif
#if defined(OPENSSL_SYS_WIN32)
typedef struct _SW_U64 {
} SW_U64; /* 64 bit integer */
#elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
#else /* Unix variants */
typedef struct _SW_U64 {
} SW_U64; /* 64 bit integer */
#endif
/* status codes */
#define SW_OK (0L)
#define SW_ERR_BASE (-10000L)
/* up yet */
/* time out */
/* execute the command */
/* NULL */
/* small, too large. */
/* handle */
/* standing at this */
/* context handle */
/* in SW_PARAM structure */
/* context. */
/* swAttachKeyParam() is */
/* not called. */
#define SW_ERR_KEY_CMD_MISMATCH \
/* SW_COMMAND_CODE since */
/* key attached via */
/* swAttachKeyParam() */
/* cannot be used for this*/
/* SW_COMMAND_CODE. */
#define SW_ERR_NOT_IMPLEMENTED \
/* the "initems" or */
/* "outitems". */
/* test fail, look at the */
/* selfTestBitmap in */
/* SW_ACCELERATOR_INFO for*/
/* details. */
/* key materials aligned */
/* in certain order, e.g. */
/* 128 bit for CRT */
#define SW_ERR_OUTPUT_NULL_PTR \
/* NULL */
#define SW_ERR_OUTPUT_SIZE \
/* small, too large. */
#define SW_ERR_FIRMWARE_CHECKSUM \
/* download failed. */
#define SW_ERR_UNKNOWN_FIRMWARE \
/* it's waiting to be */
/* completed. */
/* volatile memory */
/* writing to NV memory */
/* failure */
/* calculations */
/* board memory */
#define SW_ERR_FIRMWARE_VERSION \
/* update */
#define SW_ERR_ZERO_WORKING_ACCELERATOR \
/* algorithm type */
#define SW_ALG_CRT 1
#define SW_ALG_EXP 2
#define SW_ALG_DSA 3
#define SW_ALG_NVDATA 4
/* command code */
/* Chinese Remainder Theorem (CRT) */
typedef struct _SW_LARGENUMBER {
/* bytes in network (big endian) order */
#if defined(OPENSSL_SYS_WIN32)
#include <windows.h>
#define SW_CALLCONV _stdcall
#elif defined(OPENSSL_SYS_MACINTOSH_CLASSIC)
/* async callback mechanisms */
/* swiftCallbackLevel */
#define SW_MAC_CALLBACK_LEVEL_NO 0
typedef int SW_MAC_CALLBACK_LEVEL;
typedef int SW_OSHANDLE;
#define SW_OS_INVALID_HANDLE (-1)
#define SW_CALLCONV
#else /* Unix variants */
typedef int SW_OSHANDLE; /* handle to driver */
#define SW_OS_INVALID_HANDLE (-1)
#define SW_CALLCONV
#endif
typedef struct _SW_CRT {
SW_LARGENUMBER p; /* prime number p */
SW_LARGENUMBER q; /* prime number q */
} SW_CRT;
typedef struct _SW_EXP {
} SW_EXP;
typedef struct _SW_DSA {
SW_LARGENUMBER p; /* */
SW_LARGENUMBER q; /* */
SW_LARGENUMBER g; /* */
} SW_DSA;
typedef struct _SW_NVDATA {
} SW_NVDATA;
typedef struct _SW_PARAM {
union {
} up;
} SW_PARAM;
/* Now the OpenSSL bits, these function types are the for the function
* pointers that will bound into the Rainbow shared libraries. */
#ifdef __cplusplus
}
#endif /* __cplusplus */