Update nCipher header with more liberal licence.

This commit is contained in:
Ben Laurie 2001-07-04 12:26:39 +00:00
parent 43f9391bcc
commit 5be022712a

View File

@ -8,13 +8,19 @@
* synchronous-within-each-thread, facility. * synchronous-within-each-thread, facility.
* *
* *
* This file is Copyright 1998-1999 nCipher Corporation Limited. * This file is Copyright 1998-2000 nCipher Corporation Limited.
* *
* This file is provided for your information and assistance. You are * Redistribution and use in source and binary forms, with opr without
* permitted to copy it verbatim, to use it to create compatible * modification, are permitted provided that the following conditions
* software, and for review and comment. However, you may not * are met:
* distribute changed versions or other derivative works. All other *
* rights are reserved. * 1. Redistributions of source code must retain the copyright notice,
* this list of conditions, and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions, and the following
* disclaimer, in the documentation and/or other materials provided
* with the distribution
* *
* IN NO EVENT SHALL NCIPHER CORPORATION LIMITED (`NCIPHER') AND/OR * IN NO EVENT SHALL NCIPHER CORPORATION LIMITED (`NCIPHER') AND/OR
* ANY OTHER AUTHORS OR DISTRIBUTORS OF THIS FILE BE LIABLE for any * ANY OTHER AUTHORS OR DISTRIBUTORS OF THIS FILE BE LIABLE for any
@ -52,14 +58,14 @@
* *
* *
* The actual dynamically loadable plugin, and the library files for * The actual dynamically loadable plugin, and the library files for
* static linking, which are also provided in this distribution, are * static linking, which are also provided in some distributions, are
* not covered by the licence described above. You should have * not covered by the licence described above. You should have
* received a separate licence with terms and conditions for these * received a separate licence with terms and conditions for these
* library files; if you received the library files without a licence, * library files; if you received the library files without a licence,
* please contact nCipher. * please contact nCipher.
* *
* *
* $Id: hwcryptohook.h,v 1.2 2000/10/26 21:06:30 levitte Exp $ * $Id: hwcryptohook.h,v 1.3 2001/07/04 12:26:39 ben Exp $
*/ */
#ifndef HWCRYPTOHOOK_H #ifndef HWCRYPTOHOOK_H
@ -111,12 +117,11 @@ typedef struct {
* integer-valued ones). It will, if an ErrMsgBuf is passed, also put * integer-valued ones). It will, if an ErrMsgBuf is passed, also put
* an error message there. * an error message there.
* *
* size is the size of the buffer. When the buffer is filled, it will * size is the size of the buffer, and will not be modified. If you
* always be null-terminated. If you pass 0 buf buf you must pass 0 * pass 0 for size you must pass 0 for buf, and nothing will be
* for size, and nothing will be recorded (just as if you passed 0 for * recorded (just as if you passed 0 for the struct pointer).
* the struct pointer). Size will not be modified when an error is * Messages written to the buffer will always be null-terminated, even
* recorded. The buffer is always null-terminated even if there is an * when truncated to fit within size bytes.
* overrun.
* *
* The contents of the buffer are not defined if there is no error. * The contents of the buffer are not defined if there is no error.
*/ */
@ -126,10 +131,14 @@ typedef struct HWCryptoHook_MPIStruct {
size_t size; size_t size;
} HWCryptoHook_MPI; } HWCryptoHook_MPI;
/* When one of these is returned, a pointer is passed to the function. /* When one of these is returned, a pointer is passed to the function.
* At call, size is the space available. Afterwards it is updated. * At call, size is the space available. Afterwards it is updated to
* buf (the pointer) is not updated. size is in bytes and may be * be set to the actual length (which may be more than the space available,
* zero, but must be a multiple of the limb size. Zero limbs at the * if there was not enough room and the result was truncated).
* MS end are not permitted. * buf (the pointer) is not updated.
*
* size is in bytes and may be zero at call or return, but must be a
* multiple of the limb size. Zero limbs at the MS end are not
* permitted.
*/ */
#define HWCryptoHook_InitFlags_FallbackModExp 0x0002UL #define HWCryptoHook_InitFlags_FallbackModExp 0x0002UL
@ -222,9 +231,9 @@ typedef struct {
*/ */
int (*getpassphrase)(const char *prompt_info, int (*getpassphrase)(const char *prompt_info,
int *len_io, char *buf, int *len_io, char *buf,
HWCryptoHook_PassphraseContext *ppctx, HWCryptoHook_PassphraseContext *ppctx,
HWCryptoHook_CallerContext *cactx); HWCryptoHook_CallerContext *cactx);
/* Passphrases and the prompt_info, if they contain high-bit-set /* Passphrases and the prompt_info, if they contain high-bit-set
* characters, are UTF-8. The prompt_info may be a null pointer if * characters, are UTF-8. The prompt_info may be a null pointer if
* no prompt information is available (it should not be an empty * no prompt information is available (it should not be an empty
@ -239,9 +248,9 @@ typedef struct {
*/ */
int (*getphystoken)(const char *prompt_info, int (*getphystoken)(const char *prompt_info,
const char *wrong_info, const char *wrong_info,
HWCryptoHook_PassphraseContext *ppctx, HWCryptoHook_PassphraseContext *ppctx,
HWCryptoHook_CallerContext *cactx); HWCryptoHook_CallerContext *cactx);
/* Requests that the human user physically insert a different /* Requests that the human user physically insert a different
* smartcard, DataKey, etc. The plugin should check whether the * smartcard, DataKey, etc. The plugin should check whether the
* currently inserted token(s) are appropriate, and if they are it * currently inserted token(s) are appropriate, and if they are it
@ -311,9 +320,9 @@ typedef struct {
typedef typedef
HWCryptoHook_ContextHandle HWCryptoHook_Init_t(const HWCryptoHook_InitInfo *initinfo, HWCryptoHook_ContextHandle HWCryptoHook_Init_t(const HWCryptoHook_InitInfo *initinfo,
size_t initinfosize, size_t initinfosize,
HWCryptoHook_ErrMsgBuf *errors, const HWCryptoHook_ErrMsgBuf *errors,
HWCryptoHook_CallerContext *cactx); HWCryptoHook_CallerContext *cactx);
extern HWCryptoHook_Init_t HWCryptoHook_Init; extern HWCryptoHook_Init_t HWCryptoHook_Init;
/* Caller should set initinfosize to the size of the HWCryptoHook struct, /* Caller should set initinfosize to the size of the HWCryptoHook struct,
@ -339,7 +348,7 @@ extern HWCryptoHook_Init_t HWCryptoHook_Init;
/* The RSAImmed* functions (and key managed RSA) only work with /* The RSAImmed* functions (and key managed RSA) only work with
* modules which have an RSA patent licence - currently that means KM * modules which have an RSA patent licence - currently that means KM
* units; the ModExp* ones work with all modules, so you need a patent * units; the ModExp* ones work with all modules, so you need a patent
* licence in the software in the US. * licence in the software in the US. They are otherwise identical.
*/ */
typedef typedef
@ -349,50 +358,50 @@ extern HWCryptoHook_Finish_t HWCryptoHook_Finish;
typedef typedef
int HWCryptoHook_RandomBytes_t(HWCryptoHook_ContextHandle hwctx, int HWCryptoHook_RandomBytes_t(HWCryptoHook_ContextHandle hwctx,
unsigned char *buf, size_t len, unsigned char *buf, size_t len,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_RandomBytes_t HWCryptoHook_RandomBytes; extern HWCryptoHook_RandomBytes_t HWCryptoHook_RandomBytes;
typedef typedef
int HWCryptoHook_ModExp_t(HWCryptoHook_ContextHandle hwctx, int HWCryptoHook_ModExp_t(HWCryptoHook_ContextHandle hwctx,
HWCryptoHook_MPI a, HWCryptoHook_MPI a,
HWCryptoHook_MPI p, HWCryptoHook_MPI p,
HWCryptoHook_MPI n, HWCryptoHook_MPI n,
HWCryptoHook_MPI *r, HWCryptoHook_MPI *r,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_ModExp_t HWCryptoHook_ModExp; extern HWCryptoHook_ModExp_t HWCryptoHook_ModExp;
typedef typedef
int HWCryptoHook_RSAImmedPub_t(HWCryptoHook_ContextHandle hwctx, int HWCryptoHook_RSAImmedPub_t(HWCryptoHook_ContextHandle hwctx,
HWCryptoHook_MPI m, HWCryptoHook_MPI m,
HWCryptoHook_MPI e, HWCryptoHook_MPI e,
HWCryptoHook_MPI n, HWCryptoHook_MPI n,
HWCryptoHook_MPI *r, HWCryptoHook_MPI *r,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_RSAImmedPub_t HWCryptoHook_RSAImmedPub; extern HWCryptoHook_RSAImmedPub_t HWCryptoHook_RSAImmedPub;
typedef typedef
int HWCryptoHook_ModExpCRT_t(HWCryptoHook_ContextHandle hwctx, int HWCryptoHook_ModExpCRT_t(HWCryptoHook_ContextHandle hwctx,
HWCryptoHook_MPI a, HWCryptoHook_MPI a,
HWCryptoHook_MPI p, HWCryptoHook_MPI p,
HWCryptoHook_MPI q, HWCryptoHook_MPI q,
HWCryptoHook_MPI dmp1, HWCryptoHook_MPI dmp1,
HWCryptoHook_MPI dmq1, HWCryptoHook_MPI dmq1,
HWCryptoHook_MPI iqmp, HWCryptoHook_MPI iqmp,
HWCryptoHook_MPI *r, HWCryptoHook_MPI *r,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_ModExpCRT_t HWCryptoHook_ModExpCRT; extern HWCryptoHook_ModExpCRT_t HWCryptoHook_ModExpCRT;
typedef typedef
int HWCryptoHook_RSAImmedPriv_t(HWCryptoHook_ContextHandle hwctx, int HWCryptoHook_RSAImmedPriv_t(HWCryptoHook_ContextHandle hwctx,
HWCryptoHook_MPI m, HWCryptoHook_MPI m,
HWCryptoHook_MPI p, HWCryptoHook_MPI p,
HWCryptoHook_MPI q, HWCryptoHook_MPI q,
HWCryptoHook_MPI dmp1, HWCryptoHook_MPI dmp1,
HWCryptoHook_MPI dmq1, HWCryptoHook_MPI dmq1,
HWCryptoHook_MPI iqmp, HWCryptoHook_MPI iqmp,
HWCryptoHook_MPI *r, HWCryptoHook_MPI *r,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_RSAImmedPriv_t HWCryptoHook_RSAImmedPriv; extern HWCryptoHook_RSAImmedPriv_t HWCryptoHook_RSAImmedPriv;
/* The RSAImmed* and ModExp* functions may return E_FAILED or /* The RSAImmed* and ModExp* functions may return E_FAILED or
@ -412,10 +421,10 @@ extern HWCryptoHook_RSAImmedPriv_t HWCryptoHook_RSAImmedPriv;
typedef typedef
int HWCryptoHook_RSALoadKey_t(HWCryptoHook_ContextHandle hwctx, int HWCryptoHook_RSALoadKey_t(HWCryptoHook_ContextHandle hwctx,
const char *key_ident, const char *key_ident,
HWCryptoHook_RSAKeyHandle *keyhandle_r, HWCryptoHook_RSAKeyHandle *keyhandle_r,
const HWCryptoHook_ErrMsgBuf *errors, const HWCryptoHook_ErrMsgBuf *errors,
HWCryptoHook_PassphraseContext *ppctx); HWCryptoHook_PassphraseContext *ppctx);
extern HWCryptoHook_RSALoadKey_t HWCryptoHook_RSALoadKey; extern HWCryptoHook_RSALoadKey_t HWCryptoHook_RSALoadKey;
/* The key_ident is a null-terminated string configured by the /* The key_ident is a null-terminated string configured by the
* user via the application's usual configuration mechanisms. * user via the application's usual configuration mechanisms.
@ -430,15 +439,15 @@ extern HWCryptoHook_RSALoadKey_t HWCryptoHook_RSALoadKey;
* and the provider must cope (returning an error if the string is not * and the provider must cope (returning an error if the string is not
* valid). * valid).
* *
* If the key does not exist, it is _not_ an error - in that case, * If the key does not exist, no error is recorded and 0 is returned;
* keyhandle_r will be set to 0 instead of to a key handle. * keyhandle_r will be set to 0 instead of to a key handle.
*/ */
typedef typedef
int HWCryptoHook_RSAGetPublicKey_t(HWCryptoHook_RSAKeyHandle k, int HWCryptoHook_RSAGetPublicKey_t(HWCryptoHook_RSAKeyHandle k,
HWCryptoHook_MPI *n, HWCryptoHook_MPI *n,
HWCryptoHook_MPI *e, HWCryptoHook_MPI *e,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_RSAGetPublicKey_t HWCryptoHook_RSAGetPublicKey; extern HWCryptoHook_RSAGetPublicKey_t HWCryptoHook_RSAGetPublicKey;
/* The crypto plugin will not store certificates. /* The crypto plugin will not store certificates.
* *
@ -462,15 +471,16 @@ extern HWCryptoHook_RSAGetPublicKey_t HWCryptoHook_RSAGetPublicKey;
typedef typedef
int HWCryptoHook_RSAUnloadKey_t(HWCryptoHook_RSAKeyHandle k, int HWCryptoHook_RSAUnloadKey_t(HWCryptoHook_RSAKeyHandle k,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_RSAUnloadKey_t HWCryptoHook_RSAUnloadKey; extern HWCryptoHook_RSAUnloadKey_t HWCryptoHook_RSAUnloadKey;
/* Might fail due to locking problems, or other serious internal problems. */ /* Might fail due to locking problems, or other serious internal problems. */
typedef typedef
int HWCryptoHook_RSA_t(HWCryptoHook_MPI m, int HWCryptoHook_RSA_t(HWCryptoHook_MPI m,
HWCryptoHook_RSAKeyHandle k, HWCryptoHook_RSAKeyHandle k,
HWCryptoHook_MPI *r, HWCryptoHook_MPI *r,
const HWCryptoHook_ErrMsgBuf *errors); const HWCryptoHook_ErrMsgBuf *errors);
extern HWCryptoHook_RSA_t HWCryptoHook_RSA; extern HWCryptoHook_RSA_t HWCryptoHook_RSA;
/* RSA private key operation (sign or decrypt) - raw, unpadded. */
#endif /*HWCRYPTOHOOK_H*/ #endif /*HWCRYPTOHOOK_H*/