diff options
| author | cvs2svn <admin@example.com> | 2002-05-15 02:29:23 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2002-05-15 02:29:23 +0000 |
| commit | fd9566423b542798f5c8b06e68101a9ea5bb9885 (patch) | |
| tree | f2cc037857a260afc5aaaaaa6cf62d06923c6273 /src/lib/libcrypto/engine/vendor_defns | |
| parent | 536c76cbb863bab152f19842ab88772c01e922c7 (diff) | |
| download | openbsd-fd9566423b542798f5c8b06e68101a9ea5bb9885.tar.gz openbsd-fd9566423b542798f5c8b06e68101a9ea5bb9885.tar.bz2 openbsd-fd9566423b542798f5c8b06e68101a9ea5bb9885.zip | |
This commit was manufactured by cvs2git to create branch 'openssl'.
Diffstat (limited to 'src/lib/libcrypto/engine/vendor_defns')
| -rw-r--r-- | src/lib/libcrypto/engine/vendor_defns/aep.h | 178 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/vendor_defns/atalla.h | 61 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/vendor_defns/cswift.h | 213 | ||||
| -rw-r--r-- | src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h | 149 |
4 files changed, 601 insertions, 0 deletions
diff --git a/src/lib/libcrypto/engine/vendor_defns/aep.h b/src/lib/libcrypto/engine/vendor_defns/aep.h new file mode 100644 index 0000000000..2b2792d2d6 --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/aep.h | |||
| @@ -0,0 +1,178 @@ | |||
| 1 | /* This header declares the necessary definitions for using the exponentiation | ||
| 2 | * acceleration capabilities, and rnd number generation of the AEP card. | ||
| 3 | * | ||
| 4 | */ | ||
| 5 | |||
| 6 | /* | ||
| 7 | * | ||
| 8 | * Some AEP defines | ||
| 9 | * | ||
| 10 | */ | ||
| 11 | |||
| 12 | /*Successful return value*/ | ||
| 13 | #define AEP_R_OK 0x00000000 | ||
| 14 | |||
| 15 | /*Miscelleanous unsuccessful return value*/ | ||
| 16 | #define AEP_R_GENERAL_ERROR 0x10000001 | ||
| 17 | |||
| 18 | /*Insufficient host memory*/ | ||
| 19 | #define AEP_R_HOST_MEMORY 0x10000002 | ||
| 20 | |||
| 21 | #define AEP_R_FUNCTION_FAILED 0x10000006 | ||
| 22 | |||
| 23 | /*Invalid arguments in function call*/ | ||
| 24 | #define AEP_R_ARGUMENTS_BAD 0x10020000 | ||
| 25 | |||
| 26 | #define AEP_R_NO_TARGET_RESOURCES 0x10030000 | ||
| 27 | |||
| 28 | /*Error occuring on socket operation*/ | ||
| 29 | #define AEP_R_SOCKERROR 0x10000010 | ||
| 30 | |||
| 31 | /*Socket has been closed from the other end*/ | ||
| 32 | #define AEP_R_SOCKEOF 0x10000011 | ||
| 33 | |||
| 34 | /*Invalid handles*/ | ||
| 35 | #define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3 | ||
| 36 | |||
| 37 | #define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000 | ||
| 38 | |||
| 39 | /*Transaction has not yet returned from accelerator*/ | ||
| 40 | #define AEP_R_TRANSACTION_NOT_READY 0x00010000 | ||
| 41 | |||
| 42 | /*There is already a thread waiting on this transaction*/ | ||
| 43 | #define AEP_R_TRANSACTION_CLAIMED 0x10050000 | ||
| 44 | |||
| 45 | /*The transaction timed out*/ | ||
| 46 | #define AEP_R_TIMED_OUT 0x10060000 | ||
| 47 | |||
| 48 | #define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000 | ||
| 49 | |||
| 50 | #define AEP_R_TARGET_ERROR 0x10080000 | ||
| 51 | |||
| 52 | /*Error in the AEP daemon process*/ | ||
| 53 | #define AEP_R_DAEMON_ERROR 0x10090000 | ||
| 54 | |||
| 55 | /*Invalid ctx id*/ | ||
| 56 | #define AEP_R_INVALID_CTX_ID 0x10009000 | ||
| 57 | |||
| 58 | #define AEP_R_NO_KEY_MANAGER 0x1000a000 | ||
| 59 | |||
| 60 | /*Error obtaining a mutex*/ | ||
| 61 | #define AEP_R_MUTEX_BAD 0x000001A0 | ||
| 62 | |||
| 63 | /*Fxn call before AEP_Initialise ot after AEP_Finialise*/ | ||
| 64 | #define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190 | ||
| 65 | |||
| 66 | /*AEP_Initialise has already been called*/ | ||
| 67 | #define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191 | ||
| 68 | |||
| 69 | /*Maximum number of connections to daemon reached*/ | ||
| 70 | #define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200 | ||
| 71 | |||
| 72 | /* | ||
| 73 | * | ||
| 74 | * Some AEP Type definitions | ||
| 75 | * | ||
| 76 | */ | ||
| 77 | |||
| 78 | /* an unsigned 8-bit value */ | ||
| 79 | typedef unsigned char AEP_U8; | ||
| 80 | |||
| 81 | /* an unsigned 8-bit character */ | ||
| 82 | typedef char AEP_CHAR; | ||
| 83 | |||
| 84 | /* a BYTE-sized Boolean flag */ | ||
| 85 | typedef AEP_U8 AEP_BBOOL; | ||
| 86 | |||
| 87 | /*Unsigned value, at least 16 bits long*/ | ||
| 88 | typedef unsigned short AEP_U16; | ||
| 89 | |||
| 90 | /* an unsigned value, at least 32 bits long */ | ||
| 91 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 92 | typedef unsigned int AEP_U32; | ||
| 93 | #else | ||
| 94 | typedef unsigned long AEP_U32; | ||
| 95 | #endif | ||
| 96 | |||
| 97 | #ifdef SIXTY_FOUR_BIT_LONG | ||
| 98 | typedef unsigned long AEP_U64; | ||
| 99 | #else | ||
| 100 | typedef struct { unsigned long l1, l2; } AEP_U64; | ||
| 101 | #endif | ||
| 102 | |||
| 103 | /* at least 32 bits; each bit is a Boolean flag */ | ||
| 104 | typedef AEP_U32 AEP_FLAGS; | ||
| 105 | |||
| 106 | typedef AEP_U8 *AEP_U8_PTR; | ||
| 107 | typedef AEP_CHAR *AEP_CHAR_PTR; | ||
| 108 | typedef AEP_U32 *AEP_U32_PTR; | ||
| 109 | typedef AEP_U64 *AEP_U64_PTR; | ||
| 110 | typedef void *AEP_VOID_PTR; | ||
| 111 | |||
| 112 | /* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */ | ||
| 113 | typedef AEP_VOID_PTR *AEP_VOID_PTR_PTR; | ||
| 114 | |||
| 115 | /*Used to identify an AEP connection handle*/ | ||
| 116 | typedef AEP_U32 AEP_CONNECTION_HNDL; | ||
| 117 | |||
| 118 | /*Pointer to an AEP connection handle*/ | ||
| 119 | typedef AEP_CONNECTION_HNDL *AEP_CONNECTION_HNDL_PTR; | ||
| 120 | |||
| 121 | /*Used by an application (in conjunction with the apps process id) to | ||
| 122 | identify an individual transaction*/ | ||
| 123 | typedef AEP_U32 AEP_TRANSACTION_ID; | ||
| 124 | |||
| 125 | /*Pointer to an applications transaction identifier*/ | ||
| 126 | typedef AEP_TRANSACTION_ID *AEP_TRANSACTION_ID_PTR; | ||
| 127 | |||
| 128 | /*Return value type*/ | ||
| 129 | typedef AEP_U32 AEP_RV; | ||
| 130 | |||
| 131 | #define MAX_PROCESS_CONNECTIONS 256 | ||
| 132 | |||
| 133 | #define RAND_BLK_SIZE 1024 | ||
| 134 | |||
| 135 | typedef enum{ | ||
| 136 | NotConnected= 0, | ||
| 137 | Connected= 1, | ||
| 138 | InUse= 2 | ||
| 139 | } AEP_CONNECTION_STATE; | ||
| 140 | |||
| 141 | |||
| 142 | typedef struct AEP_CONNECTION_ENTRY{ | ||
| 143 | AEP_CONNECTION_STATE conn_state; | ||
| 144 | AEP_CONNECTION_HNDL conn_hndl; | ||
| 145 | } AEP_CONNECTION_ENTRY; | ||
| 146 | |||
| 147 | |||
| 148 | typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection); | ||
| 149 | typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection); | ||
| 150 | |||
| 151 | typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection, | ||
| 152 | AEP_VOID_PTR pA, AEP_VOID_PTR pP, | ||
| 153 | AEP_VOID_PTR pN, | ||
| 154 | AEP_VOID_PTR pResult, | ||
| 155 | AEP_TRANSACTION_ID* pidTransID); | ||
| 156 | |||
| 157 | typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection, | ||
| 158 | AEP_VOID_PTR pA, AEP_VOID_PTR pP, | ||
| 159 | AEP_VOID_PTR pQ, | ||
| 160 | AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1, | ||
| 161 | AEP_VOID_PTR pIqmp, | ||
| 162 | AEP_VOID_PTR pResult, | ||
| 163 | AEP_TRANSACTION_ID* pidTransID); | ||
| 164 | |||
| 165 | #ifdef AEPRAND | ||
| 166 | typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection, | ||
| 167 | AEP_U32 Len, | ||
| 168 | AEP_U32 Type, | ||
| 169 | AEP_VOID_PTR pResult, | ||
| 170 | AEP_TRANSACTION_ID* pidTransID); | ||
| 171 | #endif | ||
| 172 | |||
| 173 | typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs); | ||
| 174 | typedef AEP_RV t_AEP_Finalize(); | ||
| 175 | typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)(), | ||
| 176 | AEP_RV (*MakeAEPBigNumFunc)(), | ||
| 177 | AEP_RV (*ConverAEPBigNumFunc)()); | ||
| 178 | |||
diff --git a/src/lib/libcrypto/engine/vendor_defns/atalla.h b/src/lib/libcrypto/engine/vendor_defns/atalla.h new file mode 100644 index 0000000000..8111649c54 --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/atalla.h | |||
| @@ -0,0 +1,61 @@ | |||
| 1 | /* This header declares the necessary definitions for using the exponentiation | ||
| 2 | * acceleration capabilities of Atalla cards. The only cryptographic operation | ||
| 3 | * is performed by "ASI_RSAPrivateKeyOpFn" and this takes a structure that | ||
| 4 | * defines an "RSA private key". However, it is really only performing a | ||
| 5 | * regular mod_exp using the supplied modulus and exponent - no CRT form is | ||
| 6 | * being used. Hence, it is a generic mod_exp function in disguise, and we use | ||
| 7 | * it as such. | ||
| 8 | * | ||
| 9 | * Thanks to the people at Atalla for letting me know these definitions are | ||
| 10 | * fine and that they can be reproduced here. | ||
| 11 | * | ||
| 12 | * Geoff. | ||
| 13 | */ | ||
| 14 | |||
| 15 | typedef struct ItemStr | ||
| 16 | { | ||
| 17 | unsigned char *data; | ||
| 18 | int len; | ||
| 19 | } Item; | ||
| 20 | |||
| 21 | typedef struct RSAPrivateKeyStr | ||
| 22 | { | ||
| 23 | void *reserved; | ||
| 24 | Item version; | ||
| 25 | Item modulus; | ||
| 26 | Item publicExponent; | ||
| 27 | Item privateExponent; | ||
| 28 | Item prime[2]; | ||
| 29 | Item exponent[2]; | ||
| 30 | Item coefficient; | ||
| 31 | } RSAPrivateKey; | ||
| 32 | |||
| 33 | /* Predeclare the function pointer types that we dynamically load from the DSO. | ||
| 34 | * These use the same names and form that Ben's original support code had (in | ||
| 35 | * crypto/bn/bn_exp.c) unless of course I've inadvertently changed the style | ||
| 36 | * somewhere along the way! | ||
| 37 | */ | ||
| 38 | |||
| 39 | typedef int tfnASI_GetPerformanceStatistics(int reset_flag, | ||
| 40 | unsigned int *ret_buf); | ||
| 41 | |||
| 42 | typedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf); | ||
| 43 | |||
| 44 | typedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey, | ||
| 45 | unsigned char *output, | ||
| 46 | unsigned char *input, | ||
| 47 | unsigned int modulus_len); | ||
| 48 | |||
| 49 | /* These are the static string constants for the DSO file name and the function | ||
| 50 | * symbol names to bind to. Regrettably, the DSO name on *nix appears to be | ||
| 51 | * "atasi.so" rather than something more consistent like "libatasi.so". At the | ||
| 52 | * time of writing, I'm not sure what the file name on win32 is but clearly | ||
| 53 | * native name translation is not possible (eg libatasi.so on *nix, and | ||
| 54 | * atasi.dll on win32). For the purposes of testing, I have created a symbollic | ||
| 55 | * link called "libatasi.so" so that we can use native name-translation - a | ||
| 56 | * better solution will be needed. */ | ||
| 57 | static const char *ATALLA_LIBNAME = "atasi"; | ||
| 58 | static const char *ATALLA_F1 = "ASI_GetHardwareConfig"; | ||
| 59 | static const char *ATALLA_F2 = "ASI_RSAPrivateKeyOpFn"; | ||
| 60 | static const char *ATALLA_F3 = "ASI_GetPerformanceStatistics"; | ||
| 61 | |||
diff --git a/src/lib/libcrypto/engine/vendor_defns/cswift.h b/src/lib/libcrypto/engine/vendor_defns/cswift.h new file mode 100644 index 0000000000..0af14a1a92 --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/cswift.h | |||
| @@ -0,0 +1,213 @@ | |||
| 1 | /* Attribution notice: Rainbow have generously allowed me to reproduce | ||
| 2 | * the necessary definitions here from their API. This means the support | ||
| 3 | * can build independently of whether application builders have the | ||
| 4 | * API or hardware. This will allow developers to easily produce software | ||
| 5 | * that has latent hardware support for any users that have accelertors | ||
| 6 | * installed, without the developers themselves needing anything extra. | ||
| 7 | * | ||
| 8 | * I have only clipped the parts from the CryptoSwift header files that | ||
| 9 | * are (or seem) relevant to the CryptoSwift support code. This is | ||
| 10 | * simply to keep the file sizes reasonable. | ||
| 11 | * [Geoff] | ||
| 12 | */ | ||
| 13 | |||
| 14 | |||
| 15 | /* NB: These type widths do *not* seem right in general, in particular | ||
| 16 | * they're not terribly friendly to 64-bit architectures (unsigned long) | ||
| 17 | * will be 64-bit on IA-64 for a start. I'm leaving these alone as they | ||
| 18 | * agree with Rainbow's API and this will only be called into question | ||
| 19 | * on platforms with Rainbow support anyway! ;-) */ | ||
| 20 | |||
| 21 | #ifdef __cplusplus | ||
| 22 | extern "C" { | ||
| 23 | #endif /* __cplusplus */ | ||
| 24 | |||
| 25 | typedef long SW_STATUS; /* status */ | ||
| 26 | typedef unsigned char SW_BYTE; /* 8 bit byte */ | ||
| 27 | typedef unsigned short SW_U16; /* 16 bit number */ | ||
| 28 | #if defined(_IRIX) | ||
| 29 | #include <sgidefs.h> | ||
| 30 | typedef __uint32_t SW_U32; | ||
| 31 | #else | ||
| 32 | typedef unsigned long SW_U32; /* 32 bit integer */ | ||
| 33 | #endif | ||
| 34 | |||
| 35 | #if defined(WIN32) | ||
| 36 | typedef struct _SW_U64 { | ||
| 37 | SW_U32 low32; | ||
| 38 | SW_U32 high32; | ||
| 39 | } SW_U64; /* 64 bit integer */ | ||
| 40 | #elif defined(MAC) | ||
| 41 | typedef longlong SW_U64 | ||
| 42 | #else /* Unix variants */ | ||
| 43 | typedef struct _SW_U64 { | ||
| 44 | SW_U32 low32; | ||
| 45 | SW_U32 high32; | ||
| 46 | } SW_U64; /* 64 bit integer */ | ||
| 47 | #endif | ||
| 48 | |||
| 49 | /* status codes */ | ||
| 50 | #define SW_OK (0L) | ||
| 51 | #define SW_ERR_BASE (-10000L) | ||
| 52 | #define SW_ERR_NO_CARD (SW_ERR_BASE-1) /* The Card is not present */ | ||
| 53 | #define SW_ERR_CARD_NOT_READY (SW_ERR_BASE-2) /* The card has not powered */ | ||
| 54 | /* up yet */ | ||
| 55 | #define SW_ERR_TIME_OUT (SW_ERR_BASE-3) /* Execution of a command */ | ||
| 56 | /* time out */ | ||
| 57 | #define SW_ERR_NO_EXECUTE (SW_ERR_BASE-4) /* The Card failed to */ | ||
| 58 | /* execute the command */ | ||
| 59 | #define SW_ERR_INPUT_NULL_PTR (SW_ERR_BASE-5) /* a required pointer is */ | ||
| 60 | /* NULL */ | ||
| 61 | #define SW_ERR_INPUT_SIZE (SW_ERR_BASE-6) /* size is invalid, too */ | ||
| 62 | /* small, too large. */ | ||
| 63 | #define SW_ERR_INVALID_HANDLE (SW_ERR_BASE-7) /* Invalid SW_ACC_CONTEXT */ | ||
| 64 | /* handle */ | ||
| 65 | #define SW_ERR_PENDING (SW_ERR_BASE-8) /* A request is already out- */ | ||
| 66 | /* standing at this */ | ||
| 67 | /* context handle */ | ||
| 68 | #define SW_ERR_AVAILABLE (SW_ERR_BASE-9) /* A result is available. */ | ||
| 69 | #define SW_ERR_NO_PENDING (SW_ERR_BASE-10)/* No request is pending. */ | ||
| 70 | #define SW_ERR_NO_MEMORY (SW_ERR_BASE-11)/* Not enough memory */ | ||
| 71 | #define SW_ERR_BAD_ALGORITHM (SW_ERR_BASE-12)/* Invalid algorithm type */ | ||
| 72 | /* in SW_PARAM structure */ | ||
| 73 | #define SW_ERR_MISSING_KEY (SW_ERR_BASE-13)/* No key is associated with */ | ||
| 74 | /* context. */ | ||
| 75 | /* swAttachKeyParam() is */ | ||
| 76 | /* not called. */ | ||
| 77 | #define SW_ERR_KEY_CMD_MISMATCH \ | ||
| 78 | (SW_ERR_BASE-14)/* Cannot perform requested */ | ||
| 79 | /* SW_COMMAND_CODE since */ | ||
| 80 | /* key attached via */ | ||
| 81 | /* swAttachKeyParam() */ | ||
| 82 | /* cannot be used for this*/ | ||
| 83 | /* SW_COMMAND_CODE. */ | ||
| 84 | #define SW_ERR_NOT_IMPLEMENTED \ | ||
| 85 | (SW_ERR_BASE-15)/* Not implemented */ | ||
| 86 | #define SW_ERR_BAD_COMMAND (SW_ERR_BASE-16)/* Bad command code */ | ||
| 87 | #define SW_ERR_BAD_ITEM_SIZE (SW_ERR_BASE-17)/* too small or too large in */ | ||
| 88 | /* the "initems" or */ | ||
| 89 | /* "outitems". */ | ||
| 90 | #define SW_ERR_BAD_ACCNUM (SW_ERR_BASE-18)/* Bad accelerator number */ | ||
| 91 | #define SW_ERR_SELFTEST_FAIL (SW_ERR_BASE-19)/* At least one of the self */ | ||
| 92 | /* test fail, look at the */ | ||
| 93 | /* selfTestBitmap in */ | ||
| 94 | /* SW_ACCELERATOR_INFO for*/ | ||
| 95 | /* details. */ | ||
| 96 | #define SW_ERR_MISALIGN (SW_ERR_BASE-20)/* Certain alogrithms require*/ | ||
| 97 | /* key materials aligned */ | ||
| 98 | /* in certain order, e.g. */ | ||
| 99 | /* 128 bit for CRT */ | ||
| 100 | #define SW_ERR_OUTPUT_NULL_PTR \ | ||
| 101 | (SW_ERR_BASE-21)/* a required pointer is */ | ||
| 102 | /* NULL */ | ||
| 103 | #define SW_ERR_OUTPUT_SIZE \ | ||
| 104 | (SW_ERR_BASE-22)/* size is invalid, too */ | ||
| 105 | /* small, too large. */ | ||
| 106 | #define SW_ERR_FIRMWARE_CHECKSUM \ | ||
| 107 | (SW_ERR_BASE-23)/* firmware checksum mismatch*/ | ||
| 108 | /* download failed. */ | ||
| 109 | #define SW_ERR_UNKNOWN_FIRMWARE \ | ||
| 110 | (SW_ERR_BASE-24)/* unknown firmware error */ | ||
| 111 | #define SW_ERR_INTERRUPT (SW_ERR_BASE-25)/* request is abort when */ | ||
| 112 | /* it's waiting to be */ | ||
| 113 | /* completed. */ | ||
| 114 | #define SW_ERR_NVWRITE_FAIL (SW_ERR_BASE-26)/* error in writing to Non- */ | ||
| 115 | /* volatile memory */ | ||
| 116 | #define SW_ERR_NVWRITE_RANGE (SW_ERR_BASE-27)/* out of range error in */ | ||
| 117 | /* writing to NV memory */ | ||
| 118 | #define SW_ERR_RNG_ERROR (SW_ERR_BASE-28)/* Random Number Generation */ | ||
| 119 | /* failure */ | ||
| 120 | #define SW_ERR_DSS_FAILURE (SW_ERR_BASE-29)/* DSS Sign or Verify failure*/ | ||
| 121 | #define SW_ERR_MODEXP_FAILURE (SW_ERR_BASE-30)/* Failure in various math */ | ||
| 122 | /* calculations */ | ||
| 123 | #define SW_ERR_ONBOARD_MEMORY (SW_ERR_BASE-31)/* Error in accessing on - */ | ||
| 124 | /* board memory */ | ||
| 125 | #define SW_ERR_FIRMWARE_VERSION \ | ||
| 126 | (SW_ERR_BASE-32)/* Wrong version in firmware */ | ||
| 127 | /* update */ | ||
| 128 | #define SW_ERR_ZERO_WORKING_ACCELERATOR \ | ||
| 129 | (SW_ERR_BASE-44)/* All accelerators are bad */ | ||
| 130 | |||
| 131 | |||
| 132 | /* algorithm type */ | ||
| 133 | #define SW_ALG_CRT 1 | ||
| 134 | #define SW_ALG_EXP 2 | ||
| 135 | #define SW_ALG_DSA 3 | ||
| 136 | #define SW_ALG_NVDATA 4 | ||
| 137 | |||
| 138 | /* command code */ | ||
| 139 | #define SW_CMD_MODEXP_CRT 1 /* perform Modular Exponentiation using */ | ||
| 140 | /* Chinese Remainder Theorem (CRT) */ | ||
| 141 | #define SW_CMD_MODEXP 2 /* perform Modular Exponentiation */ | ||
| 142 | #define SW_CMD_DSS_SIGN 3 /* perform DSS sign */ | ||
| 143 | #define SW_CMD_DSS_VERIFY 4 /* perform DSS verify */ | ||
| 144 | #define SW_CMD_RAND 5 /* perform random number generation */ | ||
| 145 | #define SW_CMD_NVREAD 6 /* perform read to nonvolatile RAM */ | ||
| 146 | #define SW_CMD_NVWRITE 7 /* perform write to nonvolatile RAM */ | ||
| 147 | |||
| 148 | typedef SW_U32 SW_ALGTYPE; /* alogrithm type */ | ||
| 149 | typedef SW_U32 SW_STATE; /* state */ | ||
| 150 | typedef SW_U32 SW_COMMAND_CODE; /* command code */ | ||
| 151 | typedef SW_U32 SW_COMMAND_BITMAP[4]; /* bitmap */ | ||
| 152 | |||
| 153 | typedef struct _SW_LARGENUMBER { | ||
| 154 | SW_U32 nbytes; /* number of bytes in the buffer "value" */ | ||
| 155 | SW_BYTE* value; /* the large integer as a string of */ | ||
| 156 | /* bytes in network (big endian) order */ | ||
| 157 | } SW_LARGENUMBER; | ||
| 158 | |||
| 159 | typedef struct _SW_CRT { | ||
| 160 | SW_LARGENUMBER p; /* prime number p */ | ||
| 161 | SW_LARGENUMBER q; /* prime number q */ | ||
| 162 | SW_LARGENUMBER dmp1; /* exponent1 */ | ||
| 163 | SW_LARGENUMBER dmq1; /* exponent2 */ | ||
| 164 | SW_LARGENUMBER iqmp; /* CRT coefficient */ | ||
| 165 | } SW_CRT; | ||
| 166 | |||
| 167 | typedef struct _SW_EXP { | ||
| 168 | SW_LARGENUMBER modulus; /* modulus */ | ||
| 169 | SW_LARGENUMBER exponent;/* exponent */ | ||
| 170 | } SW_EXP; | ||
| 171 | |||
| 172 | typedef struct _SW_DSA { | ||
| 173 | SW_LARGENUMBER p; /* */ | ||
| 174 | SW_LARGENUMBER q; /* */ | ||
| 175 | SW_LARGENUMBER g; /* */ | ||
| 176 | SW_LARGENUMBER key; /* private/public key */ | ||
| 177 | } SW_DSA; | ||
| 178 | |||
| 179 | typedef struct _SW_NVDATA { | ||
| 180 | SW_U32 accnum; /* accelerator board number */ | ||
| 181 | SW_U32 offset; /* offset in byte */ | ||
| 182 | } SW_NVDATA; | ||
| 183 | |||
| 184 | typedef struct _SW_PARAM { | ||
| 185 | SW_ALGTYPE type; /* type of the alogrithm */ | ||
| 186 | union { | ||
| 187 | SW_CRT crt; | ||
| 188 | SW_EXP exp; | ||
| 189 | SW_DSA dsa; | ||
| 190 | SW_NVDATA nvdata; | ||
| 191 | } up; | ||
| 192 | } SW_PARAM; | ||
| 193 | |||
| 194 | typedef SW_U32 SW_CONTEXT_HANDLE; /* opaque context handle */ | ||
| 195 | |||
| 196 | |||
| 197 | /* Now the OpenSSL bits, these function types are the for the function | ||
| 198 | * pointers that will bound into the Rainbow shared libraries. */ | ||
| 199 | typedef SW_STATUS t_swAcquireAccContext(SW_CONTEXT_HANDLE *hac); | ||
| 200 | typedef SW_STATUS t_swAttachKeyParam(SW_CONTEXT_HANDLE hac, | ||
| 201 | SW_PARAM *key_params); | ||
| 202 | typedef SW_STATUS t_swSimpleRequest(SW_CONTEXT_HANDLE hac, | ||
| 203 | SW_COMMAND_CODE cmd, | ||
| 204 | SW_LARGENUMBER pin[], | ||
| 205 | SW_U32 pin_count, | ||
| 206 | SW_LARGENUMBER pout[], | ||
| 207 | SW_U32 pout_count); | ||
| 208 | typedef SW_STATUS t_swReleaseAccContext(SW_CONTEXT_HANDLE hac); | ||
| 209 | |||
| 210 | #ifdef __cplusplus | ||
| 211 | } | ||
| 212 | #endif /* __cplusplus */ | ||
| 213 | |||
diff --git a/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h b/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h new file mode 100644 index 0000000000..296636e81a --- /dev/null +++ b/src/lib/libcrypto/engine/vendor_defns/hw_4758_cca.h | |||
| @@ -0,0 +1,149 @@ | |||
| 1 | /**********************************************************************/ | ||
| 2 | /* */ | ||
| 3 | /* Prototypes of the CCA verbs used by the 4758 CCA openssl driver */ | ||
| 4 | /* */ | ||
| 5 | /* Maurice Gittens <maurice@gittens.nl> */ | ||
| 6 | /* */ | ||
| 7 | /**********************************************************************/ | ||
| 8 | |||
| 9 | #ifndef __HW_4758_CCA__ | ||
| 10 | #define __HW_4758_CCA__ | ||
| 11 | |||
| 12 | /* | ||
| 13 | * Only WIN32 support for now | ||
| 14 | */ | ||
| 15 | #if defined(WIN32) | ||
| 16 | |||
| 17 | #define CCA_LIB_NAME "CSUNSAPI" | ||
| 18 | |||
| 19 | #define CSNDPKX "CSNDPKX_32" | ||
| 20 | #define CSNDKRR "CSNDKRR_32" | ||
| 21 | #define CSNDPKE "CSNDPKE_32" | ||
| 22 | #define CSNDPKD "CSNDPKD_32" | ||
| 23 | #define CSNDDSV "CSNDDSV_32" | ||
| 24 | #define CSNDDSG "CSNDDSG_32" | ||
| 25 | #define CSNBRNG "CSNBRNG_32" | ||
| 26 | |||
| 27 | #define SECURITYAPI __stdcall | ||
| 28 | #else | ||
| 29 | /* Fixme!! | ||
| 30 | Find out the values of these constants for other platforms. | ||
| 31 | */ | ||
| 32 | #define CCA_LIB_NAME "CSUNSAPI" | ||
| 33 | |||
| 34 | #define CSNDPKX "CSNDPKX" | ||
| 35 | #define CSNDKRR "CSNDKRR" | ||
| 36 | #define CSNDPKE "CSNDPKE" | ||
| 37 | #define CSNDPKD "CSNDPKD" | ||
| 38 | #define CSNDDSV "CSNDDSV" | ||
| 39 | #define CSNDDSG "CSNDDSG" | ||
| 40 | #define CSNBRNG "CSNBRNG" | ||
| 41 | |||
| 42 | #define SECURITYAPI | ||
| 43 | #endif | ||
| 44 | |||
| 45 | /* | ||
| 46 | * security API prototypes | ||
| 47 | */ | ||
| 48 | |||
| 49 | /* PKA Key Record Read */ | ||
| 50 | typedef void (SECURITYAPI *F_KEYRECORDREAD) | ||
| 51 | (long * return_code, | ||
| 52 | long * reason_code, | ||
| 53 | long * exit_data_length, | ||
| 54 | unsigned char * exit_data, | ||
| 55 | long * rule_array_count, | ||
| 56 | unsigned char * rule_array, | ||
| 57 | unsigned char * key_label, | ||
| 58 | long * key_token_length, | ||
| 59 | unsigned char * key_token); | ||
| 60 | |||
| 61 | /* Random Number Generate */ | ||
| 62 | typedef void (SECURITYAPI *F_RANDOMNUMBERGENERATE) | ||
| 63 | (long * return_code, | ||
| 64 | long * reason_code, | ||
| 65 | long * exit_data_length, | ||
| 66 | unsigned char * exit_data, | ||
| 67 | unsigned char * form, | ||
| 68 | unsigned char * random_number); | ||
| 69 | |||
| 70 | /* Digital Signature Generate */ | ||
| 71 | typedef void (SECURITYAPI *F_DIGITALSIGNATUREGENERATE) | ||
| 72 | (long * return_code, | ||
| 73 | long * reason_code, | ||
| 74 | long * exit_data_length, | ||
| 75 | unsigned char * exit_data, | ||
| 76 | long * rule_array_count, | ||
| 77 | unsigned char * rule_array, | ||
| 78 | long * PKA_private_key_id_length, | ||
| 79 | unsigned char * PKA_private_key_id, | ||
| 80 | long * hash_length, | ||
| 81 | unsigned char * hash, | ||
| 82 | long * signature_field_length, | ||
| 83 | long * signature_bit_length, | ||
| 84 | unsigned char * signature_field); | ||
| 85 | |||
| 86 | /* Digital Signature Verify */ | ||
| 87 | typedef void (SECURITYAPI *F_DIGITALSIGNATUREVERIFY)( | ||
| 88 | long * return_code, | ||
| 89 | long * reason_code, | ||
| 90 | long * exit_data_length, | ||
| 91 | unsigned char * exit_data, | ||
| 92 | long * rule_array_count, | ||
| 93 | unsigned char * rule_array, | ||
| 94 | long * PKA_public_key_id_length, | ||
| 95 | unsigned char * PKA_public_key_id, | ||
| 96 | long * hash_length, | ||
| 97 | unsigned char * hash, | ||
| 98 | long * signature_field_length, | ||
| 99 | unsigned char * signature_field); | ||
| 100 | |||
| 101 | /* PKA Public Key Extract */ | ||
| 102 | typedef void (SECURITYAPI *F_PUBLICKEYEXTRACT)( | ||
| 103 | long * return_code, | ||
| 104 | long * reason_code, | ||
| 105 | long * exit_data_length, | ||
| 106 | unsigned char * exit_data, | ||
| 107 | long * rule_array_count, | ||
| 108 | unsigned char * rule_array, | ||
| 109 | long * source_key_identifier_length, | ||
| 110 | unsigned char * source_key_identifier, | ||
| 111 | long * target_key_token_length, | ||
| 112 | unsigned char * target_key_token); | ||
| 113 | |||
| 114 | /* PKA Encrypt */ | ||
| 115 | typedef void (SECURITYAPI *F_PKAENCRYPT) | ||
| 116 | (long * return_code, | ||
| 117 | long * reason_code, | ||
| 118 | long * exit_data_length, | ||
| 119 | unsigned char * exit_data, | ||
| 120 | long * rule_array_count, | ||
| 121 | unsigned char * rule_array, | ||
| 122 | long * key_value_length, | ||
| 123 | unsigned char * key_value, | ||
| 124 | long * data_struct_length, | ||
| 125 | unsigned char * data_struct, | ||
| 126 | long * RSA_public_key_length, | ||
| 127 | unsigned char * RSA_public_key, | ||
| 128 | long * RSA_encipher_length, | ||
| 129 | unsigned char * RSA_encipher ); | ||
| 130 | |||
| 131 | /* PKA Decrypt */ | ||
| 132 | typedef void (SECURITYAPI *F_PKADECRYPT) | ||
| 133 | (long * return_code, | ||
| 134 | long * reason_code, | ||
| 135 | long * exit_data_length, | ||
| 136 | unsigned char * exit_data, | ||
| 137 | long * rule_array_count, | ||
| 138 | unsigned char * rule_array, | ||
| 139 | long * enciphered_key_length, | ||
| 140 | unsigned char * enciphered_key, | ||
| 141 | long * data_struct_length, | ||
| 142 | unsigned char * data_struct, | ||
| 143 | long * RSA_private_key_length, | ||
| 144 | unsigned char * RSA_private_key, | ||
| 145 | long * key_value_length, | ||
| 146 | unsigned char * key_value ); | ||
| 147 | |||
| 148 | |||
| 149 | #endif | ||
