cryptint.h
来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 704 行 · 第 1/2 页
H
704 行
/* * The contents of this file are subject to the Mozilla Public * License Version 1.1 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or * implied. See the License for the specific language governing * rights and limitations under the License. * * The Original Code is the Netscape security libraries. * * The Initial Developer of the Original Code is Netscape * Communications Corporation. Portions created by Netscape are * Copyright (C) 1994-2000 Netscape Communications Corporation. All * Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the * terms of the GNU General Public License Version 2 or later (the * "GPL"), in which case the provisions of the GPL are applicable * instead of those above. If you wish to allow use of your * version of this file only under the terms of the GPL and not to * allow others to use your version of this file under the MPL, * indicate your decision by deleting the provisions above and * replace them with the notice and other provisions required by * the GPL. If you do not delete the provisions above, a recipient * may use your version of this file under either the MPL or the * GPL. *//* @(#)cryptint.h 1.26\t10 Nov 1995 *//***************************************************************************** Definitive Fortezza header file. Application Level Interface to Fortezza CI Library. Version for CI Library 1.52 November 8, 1995 NOTICE: Fortezza Export Policy The Fortezza Cryptologic Interface (CI) Library (both source and object) and Fortezza CI Library based applications are defense articles, as defined in the International Traffic In Arms Regulations (ITAR), and are subject to export controls under the ITAR and the Arms Export Control Act. Any export to any country of (a) the Fortezza CI Library, related documentation, and technical data, or (b) your cryptographic application, process, or service that is the direct product of, or contains the Fortezza CI Library must comply with the requirements of the ITAR. If you or your customer intends to engage in such export, contact the United States Department of State, Office of Defense Trade Controls for specific guidance. ****************************************************************************/#ifndef __CRYPTINT_H#define __CRYPTINT_H#if __cplusplus__ || __cplusplusextern "C"{#endif /* C++ */#ifndef PROTO_LIST#ifdef _K_AND_R_#define PROTO_LIST(list) ()#else#define PROTO_LIST(list) list#endif /*_K_AND_R_ */#endif /* PROTO_LIST */#ifndef RETURN_TYPE#if defined( _WIN32 ) || defined( __WIN32__ )#define RETURN_TYPE __declspec(dllimport) int#elif defined( _WINDOWS ) || defined( _Windows )#define RETURN_TYPE extern int _far _pascal#else#define RETURN_TYPE extern int#endif /* Windows */#endif /* RETURN_TYPE *//* MS Visual C++ defines _MSDOS and _WINDOWS *//* Borland C/C++ defines __MSDOS__ and _Windows */#if defined( _WIN32 ) || defined ( __WIN32__ )#define CI_FAR#elif defined( _WINDOWS ) || defined( _Windows )#define CI_FAR _far#else#define CI_FAR#endif /* MS DOS or Windows *//***************************************************************************** Constants ****************************************************************************/#define CI_LIB_VERSION_VAL 0x0152 /* Version 1.52 */#define CI_CERT_SIZE 2048#define CI_CERT_FLAGS_SIZE 16#define CI_CERT_NAME_SIZE 32#define CI_CHALLENGE_SIZE 20#define CI_G_SIZE 128#define CI_HASHVALUE_SIZE 20#define CI_IV_SIZE 24#define CI_KEY_SIZE 12#define CI_KS_SIZE 10#define CI_NAME_SIZE 32#define CI_PASSWORD_SIZE 24#define CI_PIN_SIZE 12#define CI_P_SIZE 128#define CI_Q_SIZE 20#define CI_R_SIZE 40#define CI_RANDOM_NO_SIZE 20#define CI_RANDOM_SEED_SIZE 8#define CI_RA_SIZE 128#define CI_RB_SIZE 128#define CI_REG_FLAGS_SIZE 4#define CI_S_SIZE 40#define CI_SAVE_DATA_SIZE 28#define CI_SERIAL_NUMBER_SIZE 8#define CI_SIGNATURE_SIZE 40#define CI_STATUS_FLAGS_SIZE 4#define CI_TIME_SIZE 16#define CI_TIMESTAMP_SIZE 16#define CI_WRAPPED_X_SIZE 24#define CI_Y_SIZE 128#define CI_X_SIZE 20/* Miscellaneous */#define CI_NULL_FLAG 0 #define CI_POWER_DOWN_FLAG 2#define CI_NO_LOG_OFF_FLAG 4#define CI_INITIATOR_FLAG 0#define CI_RECIPIENT_FLAG 1#define CI_BLOCK_LOCK_FLAG 1#define CI_SSO_LOGGED_ON 0x40#define CI_USER_LOGGED_ON 0x00#define CI_FAST_MODE 0x10#define CI_SLOW_MODE 0x00#define CI_WORST_CASE_MODE 0x40#define CI_TYPICAL_CASE_MODE 0x00/* Card Public Key Algorithms Types */#define CI_DSA_TYPE 0xA#define CI_KEA_TYPE 0x5#define CI_DSA_KEA_TYPE 0xF/* Fortezza Pin Types */#define CI_SSO_PIN 0x25#define CI_USER_PIN 0x2A/* Crypto Types */#define CI_ENCRYPT_TYPE 0#define CI_DECRYPT_TYPE 1#define CI_HASH_TYPE 2/* Save and Restore Types */#define CI_ENCRYPT_INT_TYPE 0x00 /* Internal Encryption */#define CI_ENCRYPT_EXT_TYPE 0x10 /* External Encryption */#define CI_DECRYPT_INT_TYPE 0x01 /* Internal Decryption */#define CI_DECRYPT_EXT_TYPE 0x11 /* External Decryption */#define CI_HASH_INT_TYPE 0x02 /* Internal Hash */#define CI_HASH_EXT_TYPE 0x12 /* External Hash */#define CI_TYPE_EXT_FLAG 0x10 /* Used to differentiate *//* Configuration types */#define CI_SET_SPEED_TYPE 1#define CI_SET_TIMING_TYPE 2/* Lock States */#define CI_SOCKET_UNLOCKED 0#define CI_HOLD_LOCK 1#define CI_SOCKET_LOCKED 2/* Fortezza Crypto Types Modes */#define CI_ECB64_MODE 0#define CI_CBC64_MODE 1#define CI_OFB64_MODE 2#define CI_CFB64_MODE 3#define CI_CFB32_MODE 4#define CI_CFB16_MODE 5#define CI_CFB8_MODE 6/* Card States */#define CI_POWER_UP 0#define CI_UNINITIALIZED 1#define CI_INITIALIZED 2#define CI_SSO_INITIALIZED 3#define CI_LAW_INITIALIZED 4#define CI_USER_INITIALIZED 5#define CI_STANDBY 6#define CI_READY 7#define CI_ZEROIZE 8#define CI_INTERNAL_FAILURE (-1)/* Flags for Firmware Update. */#define CI_NOT_LAST_BLOCK_FLAG 0x00000000UL#define CI_LAST_BLOCK_FLAG 0x80000000UL#define CI_DESTRUCTIVE_FLAG 0x000000FFUL#define CI_NONDESTRUCTIVE_FLAG 0x0000FF00UL/**************************************************************************** Fortezza Library Return Codes ***************************************************************************//* Card Responses */#define CI_OK 0#define CI_FAIL 1#define CI_CHECKWORD_FAIL 2#define CI_INV_TYPE 3#define CI_INV_MODE 4#define CI_INV_KEY_INDEX 5#define CI_INV_CERT_INDEX 6#define CI_INV_SIZE 7#define CI_INV_HEADER 8#define CI_INV_STATE 9#define CI_EXEC_FAIL 10#define CI_NO_KEY 11#define CI_NO_IV 12#define CI_NO_X 13#define CI_NO_SAVE 15#define CI_REG_IN_USE 16#define CI_INV_COMMAND 17#define CI_INV_POINTER 18#define CI_BAD_CLOCK 19#define CI_NO_DSA_PARMS 20/* Library Errors */#define CI_ERROR (-1)#define CI_LIB_NOT_INIT (-2)#define CI_CARD_NOT_READY (-3)#define CI_CARD_IN_USE (-4)#define CI_TIME_OUT (-5)#define CI_OUT_OF_MEMORY (-6)#define CI_NULL_PTR (-7)#define CI_BAD_SIZE (-8)#define CI_NO_DECRYPT (-9)#define CI_NO_ENCRYPT (-10)#define CI_NO_EXECUTE (-11)#define CI_BAD_PARAMETER (-12)#define CI_OUT_OF_RESOURCES (-13)#define CI_NO_CARD (-20)#define CI_NO_DRIVER (-21)#define CI_NO_CRDSRV (-22)#define CI_NO_SCTSRV (-23)#define CI_BAD_CARD (-30)#define CI_BAD_IOCTL (-31)#define CI_BAD_READ (-32)#define CI_BAD_SEEK (-33)#define CI_BAD_WRITE (-34)#define CI_BAD_FLUSH (-35)#define CI_BAD_IOSEEK (-36)#define CI_BAD_ADDR (-37)#define CI_INV_SOCKET_INDEX (-40)#define CI_SOCKET_IN_USE (-41)#define CI_NO_SOCKET (-42)#define CI_SOCKET_NOT_OPENED (-43)#define CI_BAD_TUPLES (-44)#define CI_NOT_A_CRYPTO_CARD (-45)#define CI_INVALID_FUNCTION (-50)#define CI_LIB_ALRDY_INIT (-51)#define CI_SRVR_ERROR (-52)/***************************************************************************** Data Structures ****************************************************************************/typedef unsigned char CI_CERTIFICATE[CI_CERT_SIZE];typedef unsigned char CI_CERT_FLAGS[CI_CERT_FLAGS_SIZE];typedef unsigned char CI_CERT_STR[CI_CERT_NAME_SIZE+4];typedef unsigned char CI_FAR *CI_DATA;typedef unsigned char CI_G[CI_G_SIZE];typedef unsigned char CI_HASHVALUE[CI_HASHVALUE_SIZE];typedef unsigned char CI_IV[CI_IV_SIZE];typedef unsigned char CI_KEY[CI_KEY_SIZE];typedef unsigned char CI_KS[CI_KS_SIZE];typedef unsigned char CI_P[CI_P_SIZE];typedef unsigned char CI_PASSWORD[CI_PASSWORD_SIZE + 4];typedef unsigned char CI_PIN[CI_PIN_SIZE + 4];typedef unsigned char CI_Q[CI_Q_SIZE];typedef unsigned char CI_RA[CI_RA_SIZE];typedef unsigned char CI_RB[CI_RB_SIZE];typedef unsigned char CI_RANDOM[CI_RANDOM_NO_SIZE];typedef unsigned char CI_RANDSEED[CI_RANDOM_SEED_SIZE];typedef unsigned char CI_REG_FLAGS[CI_REG_FLAGS_SIZE];typedef unsigned char CI_SIGNATURE[CI_SIGNATURE_SIZE];typedef unsigned char CI_SAVE_DATA[CI_SAVE_DATA_SIZE];typedef unsigned char CI_SERIAL_NUMBER[CI_SERIAL_NUMBER_SIZE];typedef unsigned int CI_STATE, CI_FAR *CI_STATE_PTR;typedef unsigned char CI_TIME[CI_TIME_SIZE];typedef unsigned char CI_TIMESTAMP[CI_TIMESTAMP_SIZE];typedef unsigned char CI_WRAPPED_X[CI_WRAPPED_X_SIZE];typedef unsigned char CI_Y[CI_Y_SIZE];typedef unsigned char CI_X[CI_X_SIZE];typedef struct { int LibraryVersion; /* CI Library version */ int ManufacturerVersion; /* Card's hardware version */ char ManufacturerName[CI_NAME_SIZE+4]; /* Card manufacturer's name*/ char ProductName[CI_NAME_SIZE+4]; /* Card's product name */
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?