Warmcat homepage andy@warmcat.com
libwebsockets
{"schema":"libjg2-1", "vpath":"/git/", "avatar":"/git/avatar/", "alang":"", "gen_ut":1756843566, "reponame":"openssl", "desc":"OpenSSL", "owner": { "name": "Andy Green", "email": "andy@warmcat.com", "md5": "c50933ca2aa61e0fe2c43d46bb6b59cb" },"url":"https://warmcat.com/repo/openssl", "f":3, "items": [ {"schema":"libjg2-1", "cid":"35e7a9fcc5e4f49309584f7c93ca54b6", "commit": {"type":"commit", "time": 1444924926, "time_ofs": 60, "oid_tree": { "oid": "24bdcefbce7277af57cc0f8a4944bf98a23b8fe3", "alias": []}, "oid":{ "oid": "8b7080b0b7f30669c0784d8aa73388f95bbd056b", "alias": []}, "msg": "Remove Obsolete engines", "sig_commit": { "git_time": { "time": 1444924926, "offset": 60 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }, "sig_author": { "git_time": { "time": 1444744967, "offset": 60 }, "name": "Matt Caswell", "email": "matt@openssl.org", "md5": "10f7b441a32d5790efad9fc68cae4af2" }}, "body": "Remove Obsolete engines\n\nThere are a number of engines in the OpenSSL source code which are now\nobsolete. The following engines have been removed: 4758cca, aep, atalla,\ncswift, nuron, sureware.\n\nReviewed-by: Rich Salz \u003crsalz@openssl.org\u003e\n" , "diff": "diff --git a/CHANGES b/CHANGES\nindex cfbb7a7..3408794 100644\n--- a/CHANGES\n+++ b/CHANGES\n@@ -4,6 +4,9 @@\n \n Changes between 1.0.2 and 1.1.0 [xx XXX xxxx]\n \n+ *) Removed obsolete engines: 4758cca, aep, atalla, cswift, nuron and sureware.\n+ [Matt Caswell]\n+\n *) New ASN.1 embed macro.\n \n New ASN.1 macro ASN1_EMBED. This is the same as ASN1_SIMPLE except the\ndiff --git a/crypto/engine/eng_all.c b/crypto/engine/eng_all.c\nindex 5ab498e..5a36994 100644\n--- a/crypto/engine/eng_all.c\n+++ b/crypto/engine/eng_all.c\n@@ -73,29 +73,11 @@ void ENGINE_load_builtin_engines(void)\n ENGINE_load_dynamic();\n #ifndef OPENSSL_NO_STATIC_ENGINE\n # ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_4758_CCA\n- ENGINE_load_4758cca();\n-# endif\n /*-\n * These engines have been disabled as they do not currently build\n-#ifndef OPENSSL_NO_HW_AEP\n- ENGINE_load_aep();\n-#endif\n-#ifndef OPENSSL_NO_HW_ATALLA\n- ENGINE_load_atalla();\n-#endif\n-#ifndef OPENSSL_NO_HW_CSWIFT\n- ENGINE_load_cswift();\n-#endif\n #ifndef OPENSSL_NO_HW_NCIPHER\n ENGINE_load_chil();\n #endif\n-#ifndef OPENSSL_NO_HW_NURON\n- ENGINE_load_nuron();\n-#endif\n-#ifndef OPENSSL_NO_HW_SUREWARE\n- ENGINE_load_sureware();\n-#endif\n #ifndef OPENSSL_NO_HW_UBSEC\n ENGINE_load_ubsec();\n #endif\ndiff --git a/doc/crypto/engine.pod b/doc/crypto/engine.pod\nindex c1be658..9424a7c 100644\n--- a/doc/crypto/engine.pod\n+++ b/doc/crypto/engine.pod\n@@ -24,14 +24,8 @@ engine - ENGINE cryptographic module support\n void ENGINE_load_openssl(void);\n void ENGINE_load_dynamic(void);\n #ifndef OPENSSL_NO_STATIC_ENGINE\n- void ENGINE_load_4758cca(void);\n- void ENGINE_load_aep(void);\n- void ENGINE_load_atalla(void);\n void ENGINE_load_chil(void);\n- void ENGINE_load_cswift(void);\n void ENGINE_load_gmp(void);\n- void ENGINE_load_nuron(void);\n- void ENGINE_load_sureware(void);\n void ENGINE_load_ubsec(void);\n #endif\n void ENGINE_load_cryptodev(void);\ndiff --git a/engines/Makefile b/engines/Makefile\nindex 3773e74..5cd2aa2 100644\n--- a/engines/Makefile\n+++ b/engines/Makefile\n@@ -3,7 +3,7 @@\n #\n \n #The following engines have been disabled as they currently do not build\n-# aep atalla cswift chil nuron sureware ubsec\n+# sureware ubsec\n \n DIR\u003d\tengines\n TOP\u003d\t..\n@@ -31,13 +31,11 @@ AFLAGS\u003d $(ASFLAGS)\n GENERAL\u003dMakefile engines.com install.com engine_vector.mar\n \n LIB\u003d$(TOP)/libcrypto.a\n-LIBNAMES\u003d 4758cca gmp padlock capi\n-LIBSRC\u003d\te_4758cca.c \u005c\n-\te_gmp.c \u005c\n+LIBNAMES\u003d gmp padlock capi\n+LIBSRC\u003d\te_gmp.c \u005c\n \te_padlock.c \u005c\n \te_capi.c\n-LIBOBJ\u003d e_4758cca.o \u005c\n-\te_gmp.o \u005c\n+LIBOBJ\u003d e_gmp.o \u005c\n \te_padlock.o \u005c\n \te_capi.o \u005c\n \t$(ENGINES_ASM_OBJ)\n@@ -48,11 +46,8 @@ TESTLIBOBJ\u003d e_ossltest.o\n \n SRC\u003d $(LIBSRC)\n \n-HEADER\u003d\te_4758cca_err.c e_4758cca_err.h \u005c\n-\te_gmp_err.c e_gmp_err.h \u005c\n+HEADER\u003d\te_gmp_err.c e_gmp_err.h \u005c\n \te_chil_err.c e_chil_err.h \u005c\n-\te_nuron_err.c e_nuron_err.h \u005c\n-\te_sureware_err.c e_sureware_err.h \u005c\n \te_ubsec_err.c e_ubsec_err.h \u005c\n \te_capi_err.c e_capi_err.h \u005c\n \te_ossltest_err.c e_ossltest_err.h\n@@ -159,22 +154,6 @@ clean:\n \n # DO NOT DELETE THIS LINE -- make depend depends on it.\n \n-e_4758cca.o: ../include/openssl/asn1.h ../include/openssl/bio.h\n-e_4758cca.o: ../include/openssl/bn.h ../include/openssl/buffer.h\n-e_4758cca.o: ../include/openssl/crypto.h ../include/openssl/dso.h\n-e_4758cca.o: ../include/openssl/e_os2.h ../include/openssl/ec.h\n-e_4758cca.o: ../include/openssl/ecdh.h ../include/openssl/ecdsa.h\n-e_4758cca.o: ../include/openssl/engine.h ../include/openssl/err.h\n-e_4758cca.o: ../include/openssl/evp.h ../include/openssl/lhash.h\n-e_4758cca.o: ../include/openssl/obj_mac.h ../include/openssl/objects.h\n-e_4758cca.o: ../include/openssl/opensslconf.h ../include/openssl/opensslv.h\n-e_4758cca.o: ../include/openssl/ossl_typ.h ../include/openssl/pkcs7.h\n-e_4758cca.o: ../include/openssl/rand.h ../include/openssl/rsa.h\n-e_4758cca.o: ../include/openssl/safestack.h ../include/openssl/sha.h\n-e_4758cca.o: ../include/openssl/stack.h ../include/openssl/symhacks.h\n-e_4758cca.o: ../include/openssl/x509.h ../include/openssl/x509_vfy.h\n-e_4758cca.o: e_4758cca.c e_4758cca_err.c e_4758cca_err.h\n-e_4758cca.o: vendor_defns/hw_4758_cca.h\n e_capi.o: ../include/openssl/asn1.h ../include/openssl/bio.h\n e_capi.o: ../include/openssl/buffer.h ../include/openssl/crypto.h\n e_capi.o: ../include/openssl/e_os2.h ../include/openssl/ec.h\ndiff --git a/engines/e_4758cca.c b/engines/e_4758cca.c\ndeleted file mode 100644\nindex 396f2c2..0000000\n--- a/engines/e_4758cca.c\n+++ /dev/null\n@@ -1,937 +0,0 @@\n-/* Author: Maurice Gittens \u003cmaurice@gittens.nl\u003e */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * licensing@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003cstring.h\u003e\n-#include \u003copenssl/crypto.h\u003e\n-#include \u003copenssl/dso.h\u003e\n-#include \u003copenssl/x509.h\u003e\n-#include \u003copenssl/objects.h\u003e\n-#include \u003copenssl/engine.h\u003e\n-#include \u003copenssl/rand.h\u003e\n-#ifndef OPENSSL_NO_RSA\n-# include \u003copenssl/rsa.h\u003e\n-#endif\n-#include \u003copenssl/bn.h\u003e\n-\n-#ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_4758_CCA\n-\n-# ifdef FLAT_INC\n-# include \u0022hw_4758_cca.h\u0022\n-# else\n-# include \u0022vendor_defns/hw_4758_cca.h\u0022\n-# endif\n-\n-# include \u0022e_4758cca_err.c\u0022\n-\n-static int ibm_4758_cca_destroy(ENGINE *e);\n-static int ibm_4758_cca_init(ENGINE *e);\n-static int ibm_4758_cca_finish(ENGINE *e);\n-static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p,\n- void (*f) (void));\n-\n-/* rsa functions */\n-/* -------------*/\n-# ifndef OPENSSL_NO_RSA\n-static int cca_rsa_pub_enc(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding);\n-static int cca_rsa_priv_dec(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding);\n-static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,\n- unsigned char *sigret, unsigned int *siglen,\n- const RSA *rsa);\n-static int cca_rsa_verify(int dtype, const unsigned char *m,\n- unsigned int m_len, const unsigned char *sigbuf,\n- unsigned int siglen, const RSA *rsa);\n-\n-/* utility functions */\n-/* ---------------------*/\n-static EVP_PKEY *ibm_4758_load_privkey(ENGINE *, const char *,\n- UI_METHOD *ui_method,\n- void *callback_data);\n-static EVP_PKEY *ibm_4758_load_pubkey(ENGINE *, const char *,\n- UI_METHOD *ui_method,\n- void *callback_data);\n-\n-static int getModulusAndExponent(const unsigned char *token,\n- long *exponentLength,\n- unsigned char *exponent, long *modulusLength,\n- long *modulusFieldLength,\n- unsigned char *modulus);\n-# endif\n-\n-/* RAND number functions */\n-/* ---------------------*/\n-static int cca_get_random_bytes(unsigned char *, int);\n-static int cca_random_status(void);\n-\n-# ifndef OPENSSL_NO_RSA\n-static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,\n- int idx, long argl, void *argp);\n-# endif\n-\n-/* Function pointers for CCA verbs */\n-/* -------------------------------*/\n-# ifndef OPENSSL_NO_RSA\n-static F_KEYRECORDREAD keyRecordRead;\n-static F_DIGITALSIGNATUREGENERATE digitalSignatureGenerate;\n-static F_DIGITALSIGNATUREVERIFY digitalSignatureVerify;\n-static F_PUBLICKEYEXTRACT publicKeyExtract;\n-static F_PKAENCRYPT pkaEncrypt;\n-static F_PKADECRYPT pkaDecrypt;\n-# endif\n-static F_RANDOMNUMBERGENERATE randomNumberGenerate;\n-\n-/* static variables */\n-/* ----------------*/\n-static const char *CCA4758_LIB_NAME \u003d NULL;\n-static const char *get_CCA4758_LIB_NAME(void)\n-{\n- if (CCA4758_LIB_NAME)\n- return CCA4758_LIB_NAME;\n- return CCA_LIB_NAME;\n-}\n-\n-static void free_CCA4758_LIB_NAME(void)\n-{\n- if (CCA4758_LIB_NAME)\n- OPENSSL_free((void *)CCA4758_LIB_NAME);\n- CCA4758_LIB_NAME \u003d NULL;\n-}\n-\n-static long set_CCA4758_LIB_NAME(const char *name)\n-{\n- free_CCA4758_LIB_NAME();\n- return (((CCA4758_LIB_NAME \u003d BUF_strdup(name)) !\u003d NULL) ? 1 : 0);\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-static const char *n_keyRecordRead \u003d CSNDKRR;\n-static const char *n_digitalSignatureGenerate \u003d CSNDDSG;\n-static const char *n_digitalSignatureVerify \u003d CSNDDSV;\n-static const char *n_publicKeyExtract \u003d CSNDPKX;\n-static const char *n_pkaEncrypt \u003d CSNDPKE;\n-static const char *n_pkaDecrypt \u003d CSNDPKD;\n-# endif\n-static const char *n_randomNumberGenerate \u003d CSNBRNG;\n-\n-# ifndef OPENSSL_NO_RSA\n-static int hndidx \u003d -1;\n-# endif\n-static DSO *dso \u003d NULL;\n-\n-/* openssl engine initialization structures */\n-/* ----------------------------------------*/\n-\n-# define CCA4758_CMD_SO_PATH ENGINE_CMD_BASE\n-static const ENGINE_CMD_DEFN cca4758_cmd_defns[] \u003d {\n- {CCA4758_CMD_SO_PATH,\n- \u0022SO_PATH\u0022,\n- \u0022Specifies the path to the '4758cca' shared library\u0022,\n- ENGINE_CMD_FLAG_STRING},\n- {0, NULL, NULL, 0}\n-};\n-\n-# ifndef OPENSSL_NO_RSA\n-static RSA_METHOD ibm_4758_cca_rsa \u003d {\n- \u0022IBM 4758 CCA RSA method\u0022,\n- cca_rsa_pub_enc,\n- NULL,\n- NULL,\n- cca_rsa_priv_dec,\n- NULL, /* rsa_mod_exp, */\n- NULL, /* mod_exp_mont, */\n- NULL, /* init */\n- NULL, /* finish */\n- RSA_FLAG_SIGN_VER, /* flags */\n- NULL, /* app_data */\n- cca_rsa_sign, /* rsa_sign */\n- cca_rsa_verify, /* rsa_verify */\n- NULL /* rsa_keygen */\n-};\n-# endif\n-\n-static RAND_METHOD ibm_4758_cca_rand \u003d {\n- /* \u0022IBM 4758 RAND method\u0022, */\n- NULL, /* seed */\n- cca_get_random_bytes, /* get random bytes from the card */\n- NULL, /* cleanup */\n- NULL, /* add */\n- cca_get_random_bytes, /* pseudo rand */\n- cca_random_status, /* status */\n-};\n-\n-static const char *engine_4758_cca_id \u003d \u00224758cca\u0022;\n-static const char *engine_4758_cca_name \u003d\n- \u0022IBM 4758 CCA hardware engine support\u0022;\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-/* Compatibility hack, the dynamic library uses this form in the path */\n-static const char *engine_4758_cca_id_alt \u003d \u00224758_cca\u0022;\n-# endif\n-\n-/* engine implementation */\n-/* ---------------------*/\n-static int bind_helper(ENGINE *e)\n-{\n- if (!ENGINE_set_id(e, engine_4758_cca_id) ||\n- !ENGINE_set_name(e, engine_4758_cca_name) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_RSA(e, \u0026ibm_4758_cca_rsa) ||\n-# endif\n- !ENGINE_set_RAND(e, \u0026ibm_4758_cca_rand) ||\n- !ENGINE_set_destroy_function(e, ibm_4758_cca_destroy) ||\n- !ENGINE_set_init_function(e, ibm_4758_cca_init) ||\n- !ENGINE_set_finish_function(e, ibm_4758_cca_finish) ||\n- !ENGINE_set_ctrl_function(e, ibm_4758_cca_ctrl) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_load_privkey_function(e, ibm_4758_load_privkey) ||\n- !ENGINE_set_load_pubkey_function(e, ibm_4758_load_pubkey) ||\n-# endif\n- !ENGINE_set_cmd_defns(e, cca4758_cmd_defns))\n- return 0;\n- /* Ensure the error handling is set up */\n- ERR_load_CCA4758_strings();\n- return 1;\n-}\n-\n-# ifdef OPENSSL_NO_DYNAMIC_ENGINE\n-static ENGINE *engine_4758_cca(void)\n-{\n- ENGINE *ret \u003d ENGINE_new();\n- if (!ret)\n- return NULL;\n- if (!bind_helper(ret)) {\n- ENGINE_free(ret);\n- return NULL;\n- }\n- return ret;\n-}\n-\n-void ENGINE_load_4758cca(void)\n-{\n- ENGINE *e_4758 \u003d engine_4758_cca();\n- if (!e_4758)\n- return;\n- ENGINE_add(e_4758);\n- ENGINE_free(e_4758);\n- ERR_clear_error();\n-}\n-# endif\n-\n-static int ibm_4758_cca_destroy(ENGINE *e)\n-{\n- ERR_unload_CCA4758_strings();\n- free_CCA4758_LIB_NAME();\n- return 1;\n-}\n-\n-static int ibm_4758_cca_init(ENGINE *e)\n-{\n- if (dso) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_INIT, CCA4758_R_ALREADY_LOADED);\n- goto err;\n- }\n-\n- dso \u003d DSO_load(NULL, get_CCA4758_LIB_NAME(), NULL, 0);\n- if (!dso) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_INIT, CCA4758_R_DSO_FAILURE);\n- goto err;\n- }\n-#define BINDIT(t, name) (t)DSO_bind_func(dso, name)\n-# ifndef OPENSSL_NO_RSA\n- if ((keyRecordRead \u003d BINDIT(F_KEYRECORDREAD, n_keyRecordRead)) \u003d\u003d NULL\n- || (randomNumberGenerate \u003d BINDIT(F_RANDOMNUMBERGENERATE, n_randomNumberGenerate)) \u003d\u003d NULL\n- || (digitalSignatureGenerate \u003d BINDIT(F_DIGITALSIGNATUREGENERATE, n_digitalSignatureGenerate)) \u003d\u003d NULL\n- || (digitalSignatureVerify \u003d BINDIT(F_DIGITALSIGNATUREVERIFY, n_digitalSignatureVerify)) \u003d\u003d NULL\n- || (publicKeyExtract \u003d BINDIT(F_PUBLICKEYEXTRACT, n_publicKeyExtract)) \u003d\u003d NULL\n- || (pkaEncrypt \u003d BINDIT(F_PKAENCRYPT, n_pkaEncrypt)) \u003d\u003d NULL\n- || (pkaDecrypt \u003d BINDIT(F_PKADECRYPT, n_pkaDecrypt)) \u003d\u003d NULL)\n- {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_INIT, CCA4758_R_DSO_FAILURE);\n- goto err;\n- }\n-# else\n- if ((randomNumberGenerate \u003d BINDIT(F_RANDOMNUMBERGENERATE, n_randomNumberGenerate)) \u003d\u003d NULL) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_INIT, CCA4758_R_DSO_FAILURE);\n- goto err;\n- }\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n- hndidx \u003d RSA_get_ex_new_index(0, \u0022IBM 4758 CCA RSA key handle\u0022,\n- NULL, NULL, cca_ex_free);\n-# endif\n-\n- return 1;\n- err:\n- DSO_free(dso);\n- dso \u003d NULL;\n-\n-# ifndef OPENSSL_NO_RSA\n- keyRecordRead \u003d (F_KEYRECORDREAD) 0;\n- digitalSignatureGenerate \u003d (F_DIGITALSIGNATUREGENERATE) 0;\n- digitalSignatureVerify \u003d (F_DIGITALSIGNATUREVERIFY)0;\n- publicKeyExtract \u003d (F_PUBLICKEYEXTRACT)0;\n- pkaEncrypt \u003d (F_PKAENCRYPT) 0;\n- pkaDecrypt \u003d (F_PKADECRYPT) 0;\n-# endif\n- randomNumberGenerate \u003d (F_RANDOMNUMBERGENERATE) 0;\n- return 0;\n-}\n-\n-static int ibm_4758_cca_finish(ENGINE *e)\n-{\n- free_CCA4758_LIB_NAME();\n- if (!dso) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_FINISH, CCA4758_R_NOT_LOADED);\n- return 0;\n- }\n- if (!DSO_free(dso)) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_FINISH, CCA4758_R_UNIT_FAILURE);\n- return 0;\n- }\n- dso \u003d NULL;\n-# ifndef OPENSSL_NO_RSA\n- keyRecordRead \u003d (F_KEYRECORDREAD) 0;\n- randomNumberGenerate \u003d (F_RANDOMNUMBERGENERATE) 0;\n- digitalSignatureGenerate \u003d (F_DIGITALSIGNATUREGENERATE) 0;\n- digitalSignatureVerify \u003d (F_DIGITALSIGNATUREVERIFY)0;\n- publicKeyExtract \u003d (F_PUBLICKEYEXTRACT)0;\n- pkaEncrypt \u003d (F_PKAENCRYPT) 0;\n- pkaDecrypt \u003d (F_PKADECRYPT) 0;\n-# endif\n- randomNumberGenerate \u003d (F_RANDOMNUMBERGENERATE) 0;\n- return 1;\n-}\n-\n-static int ibm_4758_cca_ctrl(ENGINE *e, int cmd, long i, void *p,\n- void (*f) (void))\n-{\n- int initialised \u003d ((dso \u003d\u003d NULL) ? 0 : 1);\n- switch (cmd) {\n- case CCA4758_CMD_SO_PATH:\n- if (p \u003d\u003d NULL) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL,\n- ERR_R_PASSED_NULL_PARAMETER);\n- return 0;\n- }\n- if (initialised) {\n- CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL, CCA4758_R_ALREADY_LOADED);\n- return 0;\n- }\n- return set_CCA4758_LIB_NAME((const char *)p);\n- default:\n- break;\n- }\n- CCA4758err(CCA4758_F_IBM_4758_CCA_CTRL,\n- CCA4758_R_COMMAND_NOT_IMPLEMENTED);\n- return 0;\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-\n-# define MAX_CCA_PKA_TOKEN_SIZE 2500\n-\n-static EVP_PKEY *ibm_4758_load_privkey(ENGINE *e, const char *key_id,\n- UI_METHOD *ui_method,\n- void *callback_data)\n-{\n- RSA *rtmp \u003d NULL;\n- EVP_PKEY *res \u003d NULL;\n- unsigned char *keyToken \u003d NULL;\n- unsigned char pubKeyToken[MAX_CCA_PKA_TOKEN_SIZE];\n- long pubKeyTokenLength \u003d MAX_CCA_PKA_TOKEN_SIZE;\n- long keyTokenLength \u003d MAX_CCA_PKA_TOKEN_SIZE;\n- long returnCode;\n- long reasonCode;\n- long exitDataLength \u003d 0;\n- long ruleArrayLength \u003d 0;\n- unsigned char exitData[8];\n- unsigned char ruleArray[8];\n- unsigned char keyLabel[64];\n- unsigned long keyLabelLength \u003d strlen(key_id);\n- unsigned char modulus[256];\n- long modulusFieldLength \u003d sizeof(modulus);\n- long modulusLength \u003d 0;\n- unsigned char exponent[256];\n- long exponentLength \u003d sizeof(exponent);\n-\n- if (keyLabelLength \u003e sizeof(keyLabel)) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PRIVKEY,\n- CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return NULL;\n- }\n-\n- memset(keyLabel, ' ', sizeof(keyLabel));\n- memcpy(keyLabel, key_id, keyLabelLength);\n-\n- keyToken \u003d OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));\n- if (!keyToken) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PRIVKEY, ERR_R_MALLOC_FAILURE);\n- goto err;\n- }\n-\n- keyRecordRead(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength,\n- exitData, \u0026ruleArrayLength, ruleArray, keyLabel,\n- \u0026keyTokenLength, keyToken + sizeof(long));\n-\n- if (returnCode) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PRIVKEY,\n- CCA4758_R_FAILED_LOADING_PRIVATE_KEY);\n- goto err;\n- }\n-\n- publicKeyExtract(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength,\n- exitData, \u0026ruleArrayLength, ruleArray, \u0026keyTokenLength,\n- keyToken + sizeof(long), \u0026pubKeyTokenLength,\n- pubKeyToken);\n-\n- if (returnCode) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PRIVKEY,\n- CCA4758_R_FAILED_LOADING_PRIVATE_KEY);\n- goto err;\n- }\n-\n- if (!getModulusAndExponent(pubKeyToken, \u0026exponentLength,\n- exponent, \u0026modulusLength, \u0026modulusFieldLength,\n- modulus)) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PRIVKEY,\n- CCA4758_R_FAILED_LOADING_PRIVATE_KEY);\n- goto err;\n- }\n-\n- (*(long *)keyToken) \u003d keyTokenLength;\n- rtmp \u003d RSA_new_method(e);\n- RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);\n-\n- rtmp-\u003ee \u003d BN_bin2bn(exponent, exponentLength, NULL);\n- rtmp-\u003en \u003d BN_bin2bn(modulus, modulusFieldLength, NULL);\n- rtmp-\u003eflags |\u003d RSA_FLAG_EXT_PKEY;\n-\n- res \u003d EVP_PKEY_new();\n- EVP_PKEY_assign_RSA(res, rtmp);\n-\n- return res;\n- err:\n- OPENSSL_free(keyToken);\n- return NULL;\n-}\n-\n-static EVP_PKEY *ibm_4758_load_pubkey(ENGINE *e, const char *key_id,\n- UI_METHOD *ui_method,\n- void *callback_data)\n-{\n- RSA *rtmp \u003d NULL;\n- EVP_PKEY *res \u003d NULL;\n- unsigned char *keyToken \u003d NULL;\n- long keyTokenLength \u003d MAX_CCA_PKA_TOKEN_SIZE;\n- long returnCode;\n- long reasonCode;\n- long exitDataLength \u003d 0;\n- long ruleArrayLength \u003d 0;\n- unsigned char exitData[8];\n- unsigned char ruleArray[8];\n- unsigned char keyLabel[64];\n- unsigned long keyLabelLength \u003d strlen(key_id);\n- unsigned char modulus[512];\n- long modulusFieldLength \u003d sizeof(modulus);\n- long modulusLength \u003d 0;\n- unsigned char exponent[512];\n- long exponentLength \u003d sizeof(exponent);\n-\n- if (keyLabelLength \u003e sizeof(keyLabel)) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PUBKEY,\n- CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return NULL;\n- }\n-\n- memset(keyLabel, ' ', sizeof(keyLabel));\n- memcpy(keyLabel, key_id, keyLabelLength);\n-\n- keyToken \u003d OPENSSL_malloc(MAX_CCA_PKA_TOKEN_SIZE + sizeof(long));\n- if (!keyToken) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PUBKEY, ERR_R_MALLOC_FAILURE);\n- goto err;\n- }\n-\n- keyRecordRead(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength, exitData,\n- \u0026ruleArrayLength, ruleArray, keyLabel, \u0026keyTokenLength,\n- keyToken + sizeof(long));\n-\n- if (returnCode) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PUBKEY, ERR_R_MALLOC_FAILURE);\n- goto err;\n- }\n-\n- if (!getModulusAndExponent(keyToken + sizeof(long), \u0026exponentLength,\n- exponent, \u0026modulusLength, \u0026modulusFieldLength,\n- modulus)) {\n- CCA4758err(CCA4758_F_IBM_4758_LOAD_PUBKEY,\n- CCA4758_R_FAILED_LOADING_PUBLIC_KEY);\n- goto err;\n- }\n-\n- (*(long *)keyToken) \u003d keyTokenLength;\n- rtmp \u003d RSA_new_method(e);\n- RSA_set_ex_data(rtmp, hndidx, (char *)keyToken);\n- rtmp-\u003ee \u003d BN_bin2bn(exponent, exponentLength, NULL);\n- rtmp-\u003en \u003d BN_bin2bn(modulus, modulusFieldLength, NULL);\n- rtmp-\u003eflags |\u003d RSA_FLAG_EXT_PKEY;\n- res \u003d EVP_PKEY_new();\n- EVP_PKEY_assign_RSA(res, rtmp);\n-\n- return res;\n- err:\n- OPENSSL_free(keyToken);\n- return NULL;\n-}\n-\n-static int cca_rsa_pub_enc(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding)\n-{\n- long returnCode;\n- long reasonCode;\n- long lflen \u003d flen;\n- long exitDataLength \u003d 0;\n- unsigned char exitData[8];\n- long ruleArrayLength \u003d 1;\n- unsigned char ruleArray[8] \u003d \u0022PKCS-1.2\u0022;\n- long dataStructureLength \u003d 0;\n- unsigned char dataStructure[8];\n- long outputLength \u003d RSA_size(rsa);\n- long keyTokenLength;\n- unsigned char *keyToken \u003d (unsigned char *)RSA_get_ex_data(rsa, hndidx);\n-\n- keyTokenLength \u003d *(long *)keyToken;\n- keyToken +\u003d sizeof(long);\n-\n- pkaEncrypt(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength, exitData,\n- \u0026ruleArrayLength, ruleArray, \u0026lflen, (unsigned char *)from,\n- \u0026dataStructureLength, dataStructure, \u0026keyTokenLength,\n- keyToken, \u0026outputLength, to);\n-\n- if (returnCode || reasonCode)\n- return -(returnCode \u003c\u003c 16 | reasonCode);\n- return outputLength;\n-}\n-\n-static int cca_rsa_priv_dec(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding)\n-{\n- long returnCode;\n- long reasonCode;\n- long lflen \u003d flen;\n- long exitDataLength \u003d 0;\n- unsigned char exitData[8];\n- long ruleArrayLength \u003d 1;\n- unsigned char ruleArray[8] \u003d \u0022PKCS-1.2\u0022;\n- long dataStructureLength \u003d 0;\n- unsigned char dataStructure[8];\n- long outputLength \u003d RSA_size(rsa);\n- long keyTokenLength;\n- unsigned char *keyToken \u003d (unsigned char *)RSA_get_ex_data(rsa, hndidx);\n-\n- keyTokenLength \u003d *(long *)keyToken;\n- keyToken +\u003d sizeof(long);\n-\n- pkaDecrypt(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength, exitData,\n- \u0026ruleArrayLength, ruleArray, \u0026lflen, (unsigned char *)from,\n- \u0026dataStructureLength, dataStructure, \u0026keyTokenLength,\n- keyToken, \u0026outputLength, to);\n-\n- return (returnCode | reasonCode) ? 0 : 1;\n-}\n-\n-# define SSL_SIG_LEN 36\n-\n-static int cca_rsa_verify(int type, const unsigned char *m,\n- unsigned int m_len, const unsigned char *sigbuf,\n- unsigned int siglen, const RSA *rsa)\n-{\n- long returnCode;\n- long reasonCode;\n- long lsiglen \u003d siglen;\n- long exitDataLength \u003d 0;\n- unsigned char exitData[8];\n- long ruleArrayLength \u003d 1;\n- unsigned char ruleArray[8] \u003d \u0022PKCS-1.1\u0022;\n- long keyTokenLength;\n- unsigned char *keyToken \u003d (unsigned char *)RSA_get_ex_data(rsa, hndidx);\n- long length \u003d SSL_SIG_LEN;\n- long keyLength;\n- unsigned char *hashBuffer \u003d NULL;\n- X509_SIG sig;\n- ASN1_TYPE parameter;\n- X509_ALGOR algorithm;\n- ASN1_OCTET_STRING digest;\n-\n- keyTokenLength \u003d *(long *)keyToken;\n- keyToken +\u003d sizeof(long);\n-\n- if (type \u003d\u003d NID_md5 || type \u003d\u003d NID_sha1) {\n- sig.algor \u003d \u0026algorithm;\n- algorithm.algorithm \u003d OBJ_nid2obj(type);\n-\n- if (!algorithm.algorithm) {\n- CCA4758err(CCA4758_F_CCA_RSA_VERIFY,\n- CCA4758_R_UNKNOWN_ALGORITHM_TYPE);\n- return 0;\n- }\n-\n- if (!OBJ_length(algorithm.algorithm)) {\n- CCA4758err(CCA4758_F_CCA_RSA_VERIFY,\n- CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD);\n- return 0;\n- }\n-\n- parameter.type \u003d V_ASN1_NULL;\n- parameter.value.ptr \u003d NULL;\n- algorithm.parameter \u003d \u0026parameter;\n-\n- sig.digest \u003d \u0026digest;\n- sig.digest-\u003edata \u003d (unsigned char *)m;\n- sig.digest-\u003elength \u003d m_len;\n-\n- length \u003d i2d_X509_SIG(\u0026sig, NULL);\n- }\n-\n- keyLength \u003d RSA_size(rsa);\n-\n- if (length - RSA_PKCS1_PADDING \u003e keyLength) {\n- CCA4758err(CCA4758_F_CCA_RSA_VERIFY,\n- CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return 0;\n- }\n-\n- switch (type) {\n- case NID_md5_sha1:\n- if (m_len !\u003d SSL_SIG_LEN) {\n- CCA4758err(CCA4758_F_CCA_RSA_VERIFY,\n- CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return 0;\n- }\n-\n- hashBuffer \u003d (unsigned char *)m;\n- length \u003d m_len;\n- break;\n- case NID_md5:\n- {\n- unsigned char *ptr;\n- ptr \u003d hashBuffer \u003d OPENSSL_malloc((unsigned int)keyLength + 1);\n- if (!hashBuffer) {\n- CCA4758err(CCA4758_F_CCA_RSA_VERIFY, ERR_R_MALLOC_FAILURE);\n- return 0;\n- }\n-\n- i2d_X509_SIG(\u0026sig, \u0026ptr);\n- }\n- break;\n- case NID_sha1:\n- {\n- unsigned char *ptr;\n- ptr \u003d hashBuffer \u003d OPENSSL_malloc((unsigned int)keyLength + 1);\n- if (!hashBuffer) {\n- CCA4758err(CCA4758_F_CCA_RSA_VERIFY, ERR_R_MALLOC_FAILURE);\n- return 0;\n- }\n- i2d_X509_SIG(\u0026sig, \u0026ptr);\n- }\n- break;\n- default:\n- return 0;\n- }\n-\n- digitalSignatureVerify(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength,\n- exitData, \u0026ruleArrayLength, ruleArray,\n- \u0026keyTokenLength, keyToken, \u0026length, hashBuffer,\n- \u0026lsiglen, (unsigned char *)sigbuf);\n-\n- if (type \u003d\u003d NID_sha1 || type \u003d\u003d NID_md5)\n- OPENSSL_clear_free(hashBuffer, keyLength + 1);\n-\n- return ((returnCode || reasonCode) ? 0 : 1);\n-}\n-\n-# define SSL_SIG_LEN 36\n-\n-static int cca_rsa_sign(int type, const unsigned char *m, unsigned int m_len,\n- unsigned char *sigret, unsigned int *siglen,\n- const RSA *rsa)\n-{\n- long returnCode;\n- long reasonCode;\n- long exitDataLength \u003d 0;\n- unsigned char exitData[8];\n- long ruleArrayLength \u003d 1;\n- unsigned char ruleArray[8] \u003d \u0022PKCS-1.1\u0022;\n- long outputLength \u003d 256;\n- long outputBitLength;\n- long keyTokenLength;\n- unsigned char *hashBuffer \u003d NULL;\n- unsigned char *keyToken \u003d (unsigned char *)RSA_get_ex_data(rsa, hndidx);\n- long length \u003d SSL_SIG_LEN;\n- long keyLength;\n- X509_SIG sig;\n- ASN1_TYPE parameter;\n- X509_ALGOR algorithm;\n- ASN1_OCTET_STRING digest;\n-\n- keyTokenLength \u003d *(long *)keyToken;\n- keyToken +\u003d sizeof(long);\n-\n- if (type \u003d\u003d NID_md5 || type \u003d\u003d NID_sha1) {\n- sig.algor \u003d \u0026algorithm;\n- algorithm.algorithm \u003d OBJ_nid2obj(type);\n-\n- if (!algorithm.algorithm) {\n- CCA4758err(CCA4758_F_CCA_RSA_SIGN,\n- CCA4758_R_UNKNOWN_ALGORITHM_TYPE);\n- return 0;\n- }\n-\n- if (!OBJ_length(algorithm.algorithm)) {\n- CCA4758err(CCA4758_F_CCA_RSA_SIGN,\n- CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD);\n- return 0;\n- }\n-\n- parameter.type \u003d V_ASN1_NULL;\n- parameter.value.ptr \u003d NULL;\n- algorithm.parameter \u003d \u0026parameter;\n-\n- sig.digest \u003d \u0026digest;\n- sig.digest-\u003edata \u003d (unsigned char *)m;\n- sig.digest-\u003elength \u003d m_len;\n-\n- length \u003d i2d_X509_SIG(\u0026sig, NULL);\n- }\n-\n- keyLength \u003d RSA_size(rsa);\n-\n- if (length - RSA_PKCS1_PADDING \u003e keyLength) {\n- CCA4758err(CCA4758_F_CCA_RSA_SIGN,\n- CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return 0;\n- }\n-\n- switch (type) {\n- case NID_md5_sha1:\n- if (m_len !\u003d SSL_SIG_LEN) {\n- CCA4758err(CCA4758_F_CCA_RSA_SIGN,\n- CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return 0;\n- }\n- hashBuffer \u003d (unsigned char *)m;\n- length \u003d m_len;\n- break;\n- case NID_md5:\n- {\n- unsigned char *ptr;\n- ptr \u003d hashBuffer \u003d OPENSSL_malloc((unsigned int)keyLength + 1);\n- if (!hashBuffer) {\n- CCA4758err(CCA4758_F_CCA_RSA_SIGN, ERR_R_MALLOC_FAILURE);\n- return 0;\n- }\n- i2d_X509_SIG(\u0026sig, \u0026ptr);\n- }\n- break;\n- case NID_sha1:\n- {\n- unsigned char *ptr;\n- ptr \u003d hashBuffer \u003d OPENSSL_malloc((unsigned int)keyLength + 1);\n- if (!hashBuffer) {\n- CCA4758err(CCA4758_F_CCA_RSA_SIGN, ERR_R_MALLOC_FAILURE);\n- return 0;\n- }\n- i2d_X509_SIG(\u0026sig, \u0026ptr);\n- }\n- break;\n- default:\n- return 0;\n- }\n-\n- digitalSignatureGenerate(\u0026returnCode, \u0026reasonCode, \u0026exitDataLength,\n- exitData, \u0026ruleArrayLength, ruleArray,\n- \u0026keyTokenLength, keyToken, \u0026length, hashBuffer,\n- \u0026outputLength, \u0026outputBitLength, sigret);\n-\n- if (type \u003d\u003d NID_sha1 || type \u003d\u003d NID_md5)\n- OPENSSL_clear_free(hashBuffer, keyLength + 1);\n-\n- *siglen \u003d outputLength;\n-\n- return ((returnCode || reasonCode) ? 0 : 1);\n-}\n-\n-static int getModulusAndExponent(const unsigned char *token,\n- long *exponentLength,\n- unsigned char *exponent, long *modulusLength,\n- long *modulusFieldLength,\n- unsigned char *modulus)\n-{\n- unsigned long len;\n-\n- if (*token++ !\u003d (char)0x1E) /* internal PKA token? */\n- return 0;\n-\n- if (*token++) /* token version must be zero */\n- return 0;\n-\n- len \u003d *token++;\n- len \u003d len \u003c\u003c 8;\n- len |\u003d (unsigned char)*token++;\n-\n- token +\u003d 4; /* skip reserved bytes */\n-\n- if (*token++ \u003d\u003d (char)0x04) {\n- if (*token++) /* token version must be zero */\n- return 0;\n-\n- len \u003d *token++;\n- len \u003d len \u003c\u003c 8;\n- len |\u003d (unsigned char)*token++;\n-\n- token +\u003d 2; /* skip reserved section */\n-\n- len \u003d *token++;\n- len \u003d len \u003c\u003c 8;\n- len |\u003d (unsigned char)*token++;\n-\n- *exponentLength \u003d len;\n-\n- len \u003d *token++;\n- len \u003d len \u003c\u003c 8;\n- len |\u003d (unsigned char)*token++;\n-\n- *modulusLength \u003d len;\n-\n- len \u003d *token++;\n- len \u003d len \u003c\u003c 8;\n- len |\u003d (unsigned char)*token++;\n-\n- *modulusFieldLength \u003d len;\n-\n- memcpy(exponent, token, *exponentLength);\n- token +\u003d *exponentLength;\n-\n- memcpy(modulus, token, *modulusFieldLength);\n- return 1;\n- }\n- return 0;\n-}\n-\n-# endif /* OPENSSL_NO_RSA */\n-\n-static int cca_random_status(void)\n-{\n- return 1;\n-}\n-\n-static int cca_get_random_bytes(unsigned char *buf, int num)\n-{\n- long ret_code;\n- long reason_code;\n- long exit_data_length;\n- unsigned char exit_data[4];\n- unsigned char form[] \u003d \u0022RANDOM \u0022;\n- unsigned char rand_buf[8];\n-\n- while (num \u003e\u003d (int)sizeof(rand_buf)) {\n- randomNumberGenerate(\u0026ret_code, \u0026reason_code, \u0026exit_data_length,\n- exit_data, form, rand_buf);\n- if (ret_code)\n- return 0;\n- num -\u003d sizeof(rand_buf);\n- memcpy(buf, rand_buf, sizeof(rand_buf));\n- buf +\u003d sizeof(rand_buf);\n- }\n-\n- if (num) {\n- randomNumberGenerate(\u0026ret_code, \u0026reason_code, NULL, NULL,\n- form, rand_buf);\n- if (ret_code)\n- return 0;\n- memcpy(buf, rand_buf, num);\n- }\n-\n- return 1;\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-static void cca_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad, int idx,\n- long argl, void *argp)\n-{\n- OPENSSL_free(item);\n-}\n-# endif\n-\n-/* Goo to handle building as a dynamic engine */\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-static int bind_fn(ENGINE *e, const char *id)\n-{\n- if (id \u0026\u0026 (strcmp(id, engine_4758_cca_id) !\u003d 0) \u0026\u0026\n- (strcmp(id, engine_4758_cca_id_alt) !\u003d 0))\n- return 0;\n- if (!bind_helper(e))\n- return 0;\n- return 1;\n-}\n-\n-IMPLEMENT_DYNAMIC_CHECK_FN()\n- IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)\n-# endif /* OPENSSL_NO_DYNAMIC_ENGINE */\n-# endif /* !OPENSSL_NO_HW_4758_CCA */\n-#endif /* !OPENSSL_NO_HW */\ndiff --git a/engines/e_4758cca.ec b/engines/e_4758cca.ec\ndeleted file mode 100644\nindex f30ed02..0000000\n--- a/engines/e_4758cca.ec\n+++ /dev/null\n@@ -1 +0,0 @@\n-L CCA4758\te_4758cca_err.h\t\te_4758cca_err.c\ndiff --git a/engines/e_4758cca_err.c b/engines/e_4758cca_err.c\ndeleted file mode 100644\nindex aed7199..0000000\n--- a/engines/e_4758cca_err.c\n+++ /dev/null\n@@ -1,153 +0,0 @@\n-/* e_4758cca_err.c */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-/*\n- * NOTE: this file was auto generated by the mkerr.pl script: any changes\n- * made to it will be overwritten when the script next updates this file,\n- * only reason strings will be preserved.\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/err.h\u003e\n-#include \u0022e_4758cca_err.h\u0022\n-\n-/* BEGIN ERROR CODES */\n-#ifndef OPENSSL_NO_ERR\n-\n-# define ERR_FUNC(func) ERR_PACK(0,func,0)\n-# define ERR_REASON(reason) ERR_PACK(0,0,reason)\n-\n-static ERR_STRING_DATA CCA4758_str_functs[] \u003d {\n- {ERR_FUNC(CCA4758_F_CCA_RSA_SIGN), \u0022CCA_RSA_SIGN\u0022},\n- {ERR_FUNC(CCA4758_F_CCA_RSA_VERIFY), \u0022CCA_RSA_VERIFY\u0022},\n- {ERR_FUNC(CCA4758_F_IBM_4758_CCA_CTRL), \u0022IBM_4758_CCA_CTRL\u0022},\n- {ERR_FUNC(CCA4758_F_IBM_4758_CCA_FINISH), \u0022IBM_4758_CCA_FINISH\u0022},\n- {ERR_FUNC(CCA4758_F_IBM_4758_CCA_INIT), \u0022IBM_4758_CCA_INIT\u0022},\n- {ERR_FUNC(CCA4758_F_IBM_4758_LOAD_PRIVKEY), \u0022IBM_4758_LOAD_PRIVKEY\u0022},\n- {ERR_FUNC(CCA4758_F_IBM_4758_LOAD_PUBKEY), \u0022IBM_4758_LOAD_PUBKEY\u0022},\n- {0, NULL}\n-};\n-\n-static ERR_STRING_DATA CCA4758_str_reasons[] \u003d {\n- {ERR_REASON(CCA4758_R_ALREADY_LOADED), \u0022already loaded\u0022},\n- {ERR_REASON(CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD),\n- \u0022asn1 oid unknown for md\u0022},\n- {ERR_REASON(CCA4758_R_COMMAND_NOT_IMPLEMENTED),\n- \u0022command not implemented\u0022},\n- {ERR_REASON(CCA4758_R_DSO_FAILURE), \u0022dso failure\u0022},\n- {ERR_REASON(CCA4758_R_FAILED_LOADING_PRIVATE_KEY),\n- \u0022failed loading private key\u0022},\n- {ERR_REASON(CCA4758_R_FAILED_LOADING_PUBLIC_KEY),\n- \u0022failed loading public key\u0022},\n- {ERR_REASON(CCA4758_R_NOT_LOADED), \u0022not loaded\u0022},\n- {ERR_REASON(CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL),\n- \u0022size too large or too small\u0022},\n- {ERR_REASON(CCA4758_R_UNIT_FAILURE), \u0022unit failure\u0022},\n- {ERR_REASON(CCA4758_R_UNKNOWN_ALGORITHM_TYPE), \u0022unknown algorithm type\u0022},\n- {0, NULL}\n-};\n-\n-#endif\n-\n-#ifdef CCA4758_LIB_NAME\n-static ERR_STRING_DATA CCA4758_lib_name[] \u003d {\n- {0, CCA4758_LIB_NAME},\n- {0, NULL}\n-};\n-#endif\n-\n-static int CCA4758_lib_error_code \u003d 0;\n-static int CCA4758_error_init \u003d 1;\n-\n-static void ERR_load_CCA4758_strings(void)\n-{\n- if (CCA4758_lib_error_code \u003d\u003d 0)\n- CCA4758_lib_error_code \u003d ERR_get_next_error_library();\n-\n- if (CCA4758_error_init) {\n- CCA4758_error_init \u003d 0;\n-#ifndef OPENSSL_NO_ERR\n- ERR_load_strings(CCA4758_lib_error_code, CCA4758_str_functs);\n- ERR_load_strings(CCA4758_lib_error_code, CCA4758_str_reasons);\n-#endif\n-\n-#ifdef CCA4758_LIB_NAME\n- CCA4758_lib_name-\u003eerror \u003d ERR_PACK(CCA4758_lib_error_code, 0, 0);\n- ERR_load_strings(0, CCA4758_lib_name);\n-#endif\n- }\n-}\n-\n-static void ERR_unload_CCA4758_strings(void)\n-{\n- if (CCA4758_error_init \u003d\u003d 0) {\n-#ifndef OPENSSL_NO_ERR\n- ERR_unload_strings(CCA4758_lib_error_code, CCA4758_str_functs);\n- ERR_unload_strings(CCA4758_lib_error_code, CCA4758_str_reasons);\n-#endif\n-\n-#ifdef CCA4758_LIB_NAME\n- ERR_unload_strings(0, CCA4758_lib_name);\n-#endif\n- CCA4758_error_init \u003d 1;\n- }\n-}\n-\n-static void ERR_CCA4758_error(int function, int reason, char *file, int line)\n-{\n- if (CCA4758_lib_error_code \u003d\u003d 0)\n- CCA4758_lib_error_code \u003d ERR_get_next_error_library();\n- ERR_PUT_error(CCA4758_lib_error_code, function, reason, file, line);\n-}\ndiff --git a/engines/e_4758cca_err.h b/engines/e_4758cca_err.h\ndeleted file mode 100644\nindex 2f29d96..0000000\n--- a/engines/e_4758cca_err.h\n+++ /dev/null\n@@ -1,98 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@openssl.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.openssl.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#ifndef HEADER_CCA4758_ERR_H\n-# define HEADER_CCA4758_ERR_H\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif\n-\n-/* BEGIN ERROR CODES */\n-/*\n- * The following lines are auto generated by the script mkerr.pl. Any changes\n- * made after this point may be overwritten when the script is next run.\n- */\n-static void ERR_load_CCA4758_strings(void);\n-static void ERR_unload_CCA4758_strings(void);\n-static void ERR_CCA4758_error(int function, int reason, char *file, int line);\n-# define CCA4758err(f,r) ERR_CCA4758_error((f),(r),__FILE__,__LINE__)\n-\n-/* Error codes for the CCA4758 functions. */\n-\n-/* Function codes. */\n-# define CCA4758_F_CCA_RSA_SIGN 105\n-# define CCA4758_F_CCA_RSA_VERIFY 106\n-# define CCA4758_F_IBM_4758_CCA_CTRL 100\n-# define CCA4758_F_IBM_4758_CCA_FINISH 101\n-# define CCA4758_F_IBM_4758_CCA_INIT 102\n-# define CCA4758_F_IBM_4758_LOAD_PRIVKEY 103\n-# define CCA4758_F_IBM_4758_LOAD_PUBKEY 104\n-\n-/* Reason codes. */\n-# define CCA4758_R_ALREADY_LOADED 100\n-# define CCA4758_R_ASN1_OID_UNKNOWN_FOR_MD 101\n-# define CCA4758_R_COMMAND_NOT_IMPLEMENTED 102\n-# define CCA4758_R_DSO_FAILURE 103\n-# define CCA4758_R_FAILED_LOADING_PRIVATE_KEY 104\n-# define CCA4758_R_FAILED_LOADING_PUBLIC_KEY 105\n-# define CCA4758_R_NOT_LOADED 106\n-# define CCA4758_R_SIZE_TOO_LARGE_OR_TOO_SMALL 107\n-# define CCA4758_R_UNIT_FAILURE 108\n-# define CCA4758_R_UNKNOWN_ALGORITHM_TYPE 109\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-#endif\ndiff --git a/engines/e_aep.c b/engines/e_aep.c\ndeleted file mode 100644\nindex abcdb15..0000000\n--- a/engines/e_aep.c\n+++ /dev/null\n@@ -1,1182 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * licensing@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/bn.h\u003e\n-#include \u003cstring.h\u003e\n-\n-#include \u003copenssl/e_os2.h\u003e\n-#if !defined(OPENSSL_SYS_MSDOS) || defined(__DJGPP__) || defined(__MINGW32__)\n-# include \u003csys/types.h\u003e\n-# include \u003cunistd.h\u003e\n-#else\n-# include \u003cprocess.h\u003e\n-typedef int pid_t;\n-#endif\n-\n-#if defined(OPENSSL_SYS_NETWARE) \u0026\u0026 defined(NETWARE_CLIB)\n-# define getpid GetThreadID\n-extern int GetThreadID(void);\n-#elif defined(_WIN32) \u0026\u0026 !defined(__WATCOMC__)\n-# define getpid _getpid\n-#endif\n-\n-#include \u003copenssl/crypto.h\u003e\n-#include \u003copenssl/dso.h\u003e\n-#include \u003copenssl/engine.h\u003e\n-#include \u003copenssl/buffer.h\u003e\n-#ifndef OPENSSL_NO_RSA\n-# include \u003copenssl/rsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DSA\n-# include \u003copenssl/dsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DH\n-# include \u003copenssl/dh.h\u003e\n-#endif\n-\n-#ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_AEP\n-# ifdef FLAT_INC\n-# include \u0022aep.h\u0022\n-# else\n-# include \u0022vendor_defns/aep.h\u0022\n-# endif\n-\n-# define AEP_LIB_NAME \u0022aep engine\u0022\n-# define FAIL_TO_SW 0x10101010\n-\n-# include \u0022e_aep_err.c\u0022\n-\n-static int aep_init(ENGINE *e);\n-static int aep_finish(ENGINE *e);\n-static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));\n-static int aep_destroy(ENGINE *e);\n-\n-static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR hConnection);\n-static AEP_RV aep_return_connection(AEP_CONNECTION_HNDL hConnection);\n-static AEP_RV aep_close_connection(AEP_CONNECTION_HNDL hConnection);\n-static AEP_RV aep_close_all_connections(int use_engine_lock, int *in_use);\n-\n-/* BIGNUM stuff */\n-# ifndef OPENSSL_NO_RSA\n-static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx);\n-\n-static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *q, const BIGNUM *dmp1,\n- const BIGNUM *dmq1, const BIGNUM *iqmp,\n- BN_CTX *ctx);\n-# endif\n-\n-/* RSA stuff */\n-# ifndef OPENSSL_NO_RSA\n-static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,\n- BN_CTX *ctx);\n-# endif\n-\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-# ifndef OPENSSL_NO_RSA\n-static int aep_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx);\n-# endif\n-\n-/* DSA stuff */\n-# ifndef OPENSSL_NO_DSA\n-static int aep_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,\n- BN_CTX *ctx, BN_MONT_CTX *in_mont);\n-\n-static int aep_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-/* DH stuff */\n-/* This function is aliased to mod_exp (with the DH and mont dropped). */\n-# ifndef OPENSSL_NO_DH\n-static int aep_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-/* rand stuff */\n-# ifdef AEPRAND\n-static int aep_rand(unsigned char *buf, int num);\n-static int aep_rand_status(void);\n-# endif\n-\n-/* Bignum conversion stuff */\n-static AEP_RV GetBigNumSize(AEP_VOID_PTR ArbBigNum, AEP_U32 *BigNumSize);\n-static AEP_RV MakeAEPBigNum(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize,\n- unsigned char *AEP_BigNum);\n-static AEP_RV ConvertAEPBigNum(void *ArbBigNum, AEP_U32 BigNumSize,\n- unsigned char *AEP_BigNum);\n-\n-/* The definitions for control commands specific to this engine */\n-# define AEP_CMD_SO_PATH ENGINE_CMD_BASE\n-static const ENGINE_CMD_DEFN aep_cmd_defns[] \u003d {\n- {AEP_CMD_SO_PATH,\n- \u0022SO_PATH\u0022,\n- \u0022Specifies the path to the 'aep' shared library\u0022,\n- ENGINE_CMD_FLAG_STRING},\n- {0, NULL, NULL, 0}\n-};\n-\n-# ifndef OPENSSL_NO_RSA\n-/* Our internal RSA_METHOD that we provide pointers to */\n-static RSA_METHOD aep_rsa \u003d {\n- \u0022Aep RSA method\u0022,\n- NULL, /* rsa_pub_encrypt */\n- NULL, /* rsa_pub_decrypt */\n- NULL, /* rsa_priv_encrypt */\n- NULL, /* rsa_priv_encrypt */\n- aep_rsa_mod_exp, /* rsa_mod_exp */\n- aep_mod_exp_mont, /* bn_mod_exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* flags */\n- NULL, /* app_data */\n- NULL, /* rsa_sign */\n- NULL, /* rsa_verify */\n- NULL /* rsa_keygen */\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/* Our internal DSA_METHOD that we provide pointers to */\n-static DSA_METHOD aep_dsa \u003d {\n- \u0022Aep DSA method\u0022,\n- NULL, /* dsa_do_sign */\n- NULL, /* dsa_sign_setup */\n- NULL, /* dsa_do_verify */\n- aep_dsa_mod_exp, /* dsa_mod_exp */\n- aep_mod_exp_dsa, /* bn_mod_exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* flags */\n- NULL, /* app_data */\n- NULL, /* dsa_paramgen */\n- NULL /* dsa_keygen */\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* Our internal DH_METHOD that we provide pointers to */\n-static DH_METHOD aep_dh \u003d {\n- \u0022Aep DH method\u0022,\n- NULL,\n- NULL,\n- aep_mod_exp_dh,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-# ifdef AEPRAND\n-/* our internal RAND_method that we provide pointers to */\n-static RAND_METHOD aep_random \u003d {\n- /*\n- * \u0022AEP RAND method\u0022,\n- */\n- NULL,\n- aep_rand,\n- NULL,\n- NULL,\n- aep_rand,\n- aep_rand_status,\n-};\n-# endif\n-\n-/*\n- * Define an array of structures to hold connections\n- */\n-static AEP_CONNECTION_ENTRY aep_app_conn_table[MAX_PROCESS_CONNECTIONS];\n-\n-/*\n- * Used to determine if this is a new process\n- */\n-static pid_t recorded_pid \u003d 0;\n-\n-# ifdef AEPRAND\n-static AEP_U8 rand_block[RAND_BLK_SIZE];\n-static AEP_U32 rand_block_bytes \u003d 0;\n-# endif\n-\n-/* Constants used when creating the ENGINE */\n-static const char *engine_aep_id \u003d \u0022aep\u0022;\n-static const char *engine_aep_name \u003d \u0022Aep hardware engine support\u0022;\n-\n-static int max_key_len \u003d 2176;\n-\n-/*\n- * This internal function is used by ENGINE_aep() and possibly by the\n- * \u0022dynamic\u0022 ENGINE support too\n- */\n-static int bind_aep(ENGINE *e)\n-{\n-# ifndef OPENSSL_NO_RSA\n- const RSA_METHOD *meth1;\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- const DSA_METHOD *meth2;\n-# endif\n-# ifndef OPENSSL_NO_DH\n- const DH_METHOD *meth3;\n-# endif\n-\n- if (!ENGINE_set_id(e, engine_aep_id) ||\n- !ENGINE_set_name(e, engine_aep_name) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_RSA(e, \u0026aep_rsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- !ENGINE_set_DSA(e, \u0026aep_dsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DH\n- !ENGINE_set_DH(e, \u0026aep_dh) ||\n-# endif\n-# ifdef AEPRAND\n- !ENGINE_set_RAND(e, \u0026aep_random) ||\n-# endif\n- !ENGINE_set_init_function(e, aep_init) ||\n- !ENGINE_set_destroy_function(e, aep_destroy) ||\n- !ENGINE_set_finish_function(e, aep_finish) ||\n- !ENGINE_set_ctrl_function(e, aep_ctrl) ||\n- !ENGINE_set_cmd_defns(e, aep_cmd_defns))\n- return 0;\n-\n-# ifndef OPENSSL_NO_RSA\n- /*\n- * We know that the \u0022PKCS1_SSLeay()\u0022 functions hook properly to the\n- * aep-specific mod_exp and mod_exp_crt so we use those functions. NB: We\n- * don't use ENGINE_openssl() or anything \u0022more generic\u0022 because\n- * something like the RSAref code may not hook properly, and if you own\n- * one of these cards then you have the right to do RSA operations on it\n- * anyway!\n- */\n- meth1 \u003d RSA_PKCS1_SSLeay();\n- aep_rsa.rsa_pub_enc \u003d meth1-\u003ersa_pub_enc;\n- aep_rsa.rsa_pub_dec \u003d meth1-\u003ersa_pub_dec;\n- aep_rsa.rsa_priv_enc \u003d meth1-\u003ersa_priv_enc;\n- aep_rsa.rsa_priv_dec \u003d meth1-\u003ersa_priv_dec;\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n- /*\n- * Use the DSA_OpenSSL() method and just hook the mod_exp-ish bits.\n- */\n- meth2 \u003d DSA_OpenSSL();\n- aep_dsa.dsa_do_sign \u003d meth2-\u003edsa_do_sign;\n- aep_dsa.dsa_sign_setup \u003d meth2-\u003edsa_sign_setup;\n- aep_dsa.dsa_do_verify \u003d meth2-\u003edsa_do_verify;\n-\n- aep_dsa \u003d *DSA_get_default_method();\n- aep_dsa.dsa_mod_exp \u003d aep_dsa_mod_exp;\n- aep_dsa.bn_mod_exp \u003d aep_mod_exp_dsa;\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n- /* Much the same for Diffie-Hellman */\n- meth3 \u003d DH_OpenSSL();\n- aep_dh.generate_key \u003d meth3-\u003egenerate_key;\n- aep_dh.compute_key \u003d meth3-\u003ecompute_key;\n- aep_dh.bn_mod_exp \u003d meth3-\u003ebn_mod_exp;\n-# endif\n-\n- /* Ensure the aep error handling is set up */\n- ERR_load_AEPHK_strings();\n-\n- return 1;\n-}\n-\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-static int bind_helper(ENGINE *e, const char *id)\n-{\n- if (id \u0026\u0026 (strcmp(id, engine_aep_id) !\u003d 0))\n- return 0;\n- if (!bind_aep(e))\n- return 0;\n- return 1;\n-}\n-\n-IMPLEMENT_DYNAMIC_CHECK_FN()\n- IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)\n-# else\n-static ENGINE *engine_aep(void)\n-{\n- ENGINE *ret \u003d ENGINE_new();\n- if (!ret)\n- return NULL;\n- if (!bind_aep(ret)) {\n- ENGINE_free(ret);\n- return NULL;\n- }\n- return ret;\n-}\n-\n-void ENGINE_load_aep(void)\n-{\n- /* Copied from eng_[openssl|dyn].c */\n- ENGINE *toadd \u003d engine_aep();\n- if (!toadd)\n- return;\n- ENGINE_add(toadd);\n- ENGINE_free(toadd);\n- ERR_clear_error();\n-}\n-# endif\n-\n-/*\n- * This is a process-global DSO handle used for loading and unloading the Aep\n- * library. NB: This is only set (or unset) during an init() or finish() call\n- * (reference counts permitting) and they're operating with global locks, so\n- * this should be thread-safe implicitly.\n- */\n-static DSO *aep_dso \u003d NULL;\n-\n-/*\n- * These are the static string constants for the DSO file name and the\n- * function symbol names to bind to.\n- */\n-static const char *AEP_LIBNAME \u003d NULL;\n-static const char *get_AEP_LIBNAME(void)\n-{\n- if (AEP_LIBNAME)\n- return AEP_LIBNAME;\n- return \u0022aep\u0022;\n-}\n-\n-static void free_AEP_LIBNAME(void)\n-{\n- OPENSSL_free(AEP_LIBNAME);\n- AEP_LIBNAME \u003d NULL;\n-}\n-\n-static long set_AEP_LIBNAME(const char *name)\n-{\n- free_AEP_LIBNAME();\n- return ((AEP_LIBNAME \u003d BUF_strdup(name)) !\u003d NULL ? 1 : 0);\n-}\n-\n-static const char *AEP_F1 \u003d \u0022AEP_ModExp\u0022;\n-static const char *AEP_F2 \u003d \u0022AEP_ModExpCrt\u0022;\n-# ifdef AEPRAND\n-static const char *AEP_F3 \u003d \u0022AEP_GenRandom\u0022;\n-# endif\n-static const char *AEP_F4 \u003d \u0022AEP_Finalize\u0022;\n-static const char *AEP_F5 \u003d \u0022AEP_Initialize\u0022;\n-static const char *AEP_F6 \u003d \u0022AEP_OpenConnection\u0022;\n-static const char *AEP_F7 \u003d \u0022AEP_SetBNCallBacks\u0022;\n-static const char *AEP_F8 \u003d \u0022AEP_CloseConnection\u0022;\n-\n-/*\n- * These are the function pointers that are (un)set when the library has\n- * successfully (un)loaded.\n- */\n-static t_AEP_OpenConnection *p_AEP_OpenConnection \u003d NULL;\n-static t_AEP_CloseConnection *p_AEP_CloseConnection \u003d NULL;\n-static t_AEP_ModExp *p_AEP_ModExp \u003d NULL;\n-static t_AEP_ModExpCrt *p_AEP_ModExpCrt \u003d NULL;\n-# ifdef AEPRAND\n-static t_AEP_GenRandom *p_AEP_GenRandom \u003d NULL;\n-# endif\n-static t_AEP_Initialize *p_AEP_Initialize \u003d NULL;\n-static t_AEP_Finalize *p_AEP_Finalize \u003d NULL;\n-static t_AEP_SetBNCallBacks *p_AEP_SetBNCallBacks \u003d NULL;\n-\n-/* (de)initialisation functions. */\n-static int aep_init(ENGINE *e)\n-{\n- t_AEP_ModExp *p1;\n- t_AEP_ModExpCrt *p2;\n-# ifdef AEPRAND\n- t_AEP_GenRandom *p3;\n-# endif\n- t_AEP_Finalize *p4;\n- t_AEP_Initialize *p5;\n- t_AEP_OpenConnection *p6;\n- t_AEP_SetBNCallBacks *p7;\n- t_AEP_CloseConnection *p8;\n-\n- int to_return \u003d 0;\n-\n- if (aep_dso !\u003d NULL) {\n- AEPHKerr(AEPHK_F_AEP_INIT, AEPHK_R_ALREADY_LOADED);\n- goto err;\n- }\n- /* Attempt to load libaep.so. */\n-\n- aep_dso \u003d DSO_load(NULL, get_AEP_LIBNAME(), NULL, 0);\n- if (aep_dso \u003d\u003d NULL) {\n- AEPHKerr(AEPHK_F_AEP_INIT, AEPHK_R_NOT_LOADED);\n- goto err;\n- }\n-\n-#define BINDIT(t, name) (t *)DSO_bind_func(aep_dso, name)\n- if ((p1 \u003d BINDIT(t_AEP_ModExp, AEP_F1)) \u003d\u003d NULL\n- || (p2 \u003d BINDIT(t_AEP_ModExpCrt, AEP_F2)) \u003d\u003d NULL\n-# ifdef AEPRAND\n- || (p3 \u003d BINDIT(t_AEP_GenRandom, AEP_F3)) \u003d\u003d NULL\n-# endif\n- || (p4 \u003d BINDIT(t_AEP_Finalize, AEP_F4)) \u003d\u003d NULL\n- || (p5 \u003d BINDIT(t_AEP_Initialize, AEP_F5)) \u003d\u003d NULL\n- || (p6 \u003d BINDIT(t_AEP_OpenConnection, AEP_F6)) \u003d\u003d NULL\n- || (p7 \u003d BINDIT(t_AEP_SetBNCallBacks, AEP_F7)) \u003d\u003d NULL\n- || (p8 \u003d BINDIT(t_AEP_CloseConnection, AEP_F8)) \u003d\u003d NULL) {\n- AEPHKerr(AEPHK_F_AEP_INIT, AEPHK_R_NOT_LOADED);\n- goto err;\n- }\n-\n- /* Copy the pointers */\n-\n- p_AEP_ModExp \u003d p1;\n- p_AEP_ModExpCrt \u003d p2;\n-# ifdef AEPRAND\n- p_AEP_GenRandom \u003d p3;\n-# endif\n- p_AEP_Finalize \u003d p4;\n- p_AEP_Initialize \u003d p5;\n- p_AEP_OpenConnection \u003d p6;\n- p_AEP_SetBNCallBacks \u003d p7;\n- p_AEP_CloseConnection \u003d p8;\n-\n- to_return \u003d 1;\n-\n- return to_return;\n-\n- err:\n-\n- DSO_free(aep_dso);\n- aep_dso \u003d NULL;\n-\n- p_AEP_OpenConnection \u003d NULL;\n- p_AEP_ModExp \u003d NULL;\n- p_AEP_ModExpCrt \u003d NULL;\n-# ifdef AEPRAND\n- p_AEP_GenRandom \u003d NULL;\n-# endif\n- p_AEP_Initialize \u003d NULL;\n- p_AEP_Finalize \u003d NULL;\n- p_AEP_SetBNCallBacks \u003d NULL;\n- p_AEP_CloseConnection \u003d NULL;\n-\n- return to_return;\n-}\n-\n-/* Destructor (complements the \u0022ENGINE_aep()\u0022 constructor) */\n-static int aep_destroy(ENGINE *e)\n-{\n- free_AEP_LIBNAME();\n- ERR_unload_AEPHK_strings();\n- return 1;\n-}\n-\n-static int aep_finish(ENGINE *e)\n-{\n- int to_return \u003d 0, in_use;\n- AEP_RV rv;\n-\n- if (aep_dso \u003d\u003d NULL) {\n- AEPHKerr(AEPHK_F_AEP_FINISH, AEPHK_R_NOT_LOADED);\n- goto err;\n- }\n-\n- rv \u003d aep_close_all_connections(0, \u0026in_use);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_FINISH, AEPHK_R_CLOSE_HANDLES_FAILED);\n- goto err;\n- }\n- if (in_use) {\n- AEPHKerr(AEPHK_F_AEP_FINISH, AEPHK_R_CONNECTIONS_IN_USE);\n- goto err;\n- }\n-\n- rv \u003d p_AEP_Finalize();\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_FINISH, AEPHK_R_FINALIZE_FAILED);\n- goto err;\n- }\n-\n- if (!DSO_free(aep_dso)) {\n- AEPHKerr(AEPHK_F_AEP_FINISH, AEPHK_R_UNIT_FAILURE);\n- goto err;\n- }\n-\n- aep_dso \u003d NULL;\n- p_AEP_CloseConnection \u003d NULL;\n- p_AEP_OpenConnection \u003d NULL;\n- p_AEP_ModExp \u003d NULL;\n- p_AEP_ModExpCrt \u003d NULL;\n-# ifdef AEPRAND\n- p_AEP_GenRandom \u003d NULL;\n-# endif\n- p_AEP_Initialize \u003d NULL;\n- p_AEP_Finalize \u003d NULL;\n- p_AEP_SetBNCallBacks \u003d NULL;\n-\n- to_return \u003d 1;\n- err:\n- return to_return;\n-}\n-\n-static int aep_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))\n-{\n- int initialised \u003d ((aep_dso \u003d\u003d NULL) ? 0 : 1);\n- switch (cmd) {\n- case AEP_CMD_SO_PATH:\n- if (p \u003d\u003d NULL) {\n- AEPHKerr(AEPHK_F_AEP_CTRL, ERR_R_PASSED_NULL_PARAMETER);\n- return 0;\n- }\n- if (initialised) {\n- AEPHKerr(AEPHK_F_AEP_CTRL, AEPHK_R_ALREADY_LOADED);\n- return 0;\n- }\n- return set_AEP_LIBNAME((const char *)p);\n- default:\n- break;\n- }\n- AEPHKerr(AEPHK_F_AEP_CTRL, AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED);\n- return 0;\n-}\n-\n-static int aep_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx)\n-{\n- int to_return \u003d 0;\n- int r_len \u003d 0;\n- AEP_CONNECTION_HNDL hConnection;\n- AEP_RV rv;\n-\n- r_len \u003d BN_num_bits(m);\n-\n- /* Perform in software if modulus is too large for hardware. */\n-\n- if (r_len \u003e max_key_len) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP, AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- return BN_mod_exp(r, a, p, m, ctx);\n- }\n-\n- /*\n- * Grab a connection from the pool\n- */\n- rv \u003d aep_get_connection(\u0026hConnection);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP, AEPHK_R_GET_HANDLE_FAILED);\n- return BN_mod_exp(r, a, p, m, ctx);\n- }\n-\n- /*\n- * To the card with the mod exp\n- */\n- rv \u003d p_AEP_ModExp(hConnection, (void *)a, (void *)p, (void *)m, (void *)r,\n- NULL);\n-\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP, AEPHK_R_MOD_EXP_FAILED);\n- rv \u003d aep_close_connection(hConnection);\n- return BN_mod_exp(r, a, p, m, ctx);\n- }\n-\n- /*\n- * Return the connection to the pool\n- */\n- rv \u003d aep_return_connection(hConnection);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP, AEPHK_R_RETURN_CONNECTION_FAILED);\n- goto err;\n- }\n-\n- to_return \u003d 1;\n- err:\n- return to_return;\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-static AEP_RV aep_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *q, const BIGNUM *dmp1,\n- const BIGNUM *dmq1, const BIGNUM *iqmp,\n- BN_CTX *ctx)\n-{\n- AEP_RV rv \u003d AEP_R_OK;\n- AEP_CONNECTION_HNDL hConnection;\n-\n- /*\n- * Grab a connection from the pool\n- */\n- rv \u003d aep_get_connection(\u0026hConnection);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT, AEPHK_R_GET_HANDLE_FAILED);\n- return FAIL_TO_SW;\n- }\n-\n- /*\n- * To the card with the mod exp\n- */\n- rv \u003d p_AEP_ModExpCrt(hConnection, (void *)a, (void *)p, (void *)q,\n- (void *)dmp1, (void *)dmq1, (void *)iqmp, (void *)r,\n- NULL);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT, AEPHK_R_MOD_EXP_CRT_FAILED);\n- rv \u003d aep_close_connection(hConnection);\n- return FAIL_TO_SW;\n- }\n-\n- /*\n- * Return the connection to the pool\n- */\n- rv \u003d aep_return_connection(hConnection);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_MOD_EXP_CRT, AEPHK_R_RETURN_CONNECTION_FAILED);\n- goto err;\n- }\n-\n- err:\n- return rv;\n-}\n-# endif\n-\n-# ifdef AEPRAND\n-static int aep_rand(unsigned char *buf, int len)\n-{\n- AEP_RV rv \u003d AEP_R_OK;\n- AEP_CONNECTION_HNDL hConnection;\n-\n- CRYPTO_w_lock(CRYPTO_LOCK_RAND);\n-\n- /*\n- * Can the request be serviced with what's already in the buffer?\n- */\n- if (len \u003c\u003d rand_block_bytes) {\n- memcpy(buf, \u0026rand_block[RAND_BLK_SIZE - rand_block_bytes], len);\n- rand_block_bytes -\u003d len;\n- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);\n- } else\n- /*\n- * If not the get another block of random bytes\n- */\n- {\n- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);\n-\n- rv \u003d aep_get_connection(\u0026hConnection);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_RAND, AEPHK_R_GET_HANDLE_FAILED);\n- goto err_nounlock;\n- }\n-\n- if (len \u003e RAND_BLK_SIZE) {\n- rv \u003d p_AEP_GenRandom(hConnection, len, 2, buf, NULL);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_RAND, AEPHK_R_GET_RANDOM_FAILED);\n- goto err_nounlock;\n- }\n- } else {\n- CRYPTO_w_lock(CRYPTO_LOCK_RAND);\n-\n- rv \u003d p_AEP_GenRandom(hConnection, RAND_BLK_SIZE, 2,\n- \u0026rand_block[0], NULL);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_RAND, AEPHK_R_GET_RANDOM_FAILED);\n-\n- goto err;\n- }\n-\n- rand_block_bytes \u003d RAND_BLK_SIZE;\n-\n- memcpy(buf, \u0026rand_block[RAND_BLK_SIZE - rand_block_bytes], len);\n- rand_block_bytes -\u003d len;\n-\n- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);\n- }\n-\n- rv \u003d aep_return_connection(hConnection);\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_RAND, AEPHK_R_RETURN_CONNECTION_FAILED);\n-\n- goto err_nounlock;\n- }\n- }\n-\n- return 1;\n- err:\n- CRYPTO_w_unlock(CRYPTO_LOCK_RAND);\n- err_nounlock:\n- return 0;\n-}\n-\n-static int aep_rand_status(void)\n-{\n- return 1;\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-static int aep_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa, BN_CTX *ctx)\n-{\n- int to_return \u003d 0;\n- AEP_RV rv \u003d AEP_R_OK;\n-\n- if (!aep_dso) {\n- AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP, AEPHK_R_NOT_LOADED);\n- goto err;\n- }\n-\n- /*\n- * See if we have all the necessary bits for a crt\n- */\n- if (rsa-\u003eq \u0026\u0026 rsa-\u003edmp1 \u0026\u0026 rsa-\u003edmq1 \u0026\u0026 rsa-\u003eiqmp) {\n- rv \u003d aep_mod_exp_crt(r0, I, rsa-\u003ep, rsa-\u003eq, rsa-\u003edmp1, rsa-\u003edmq1,\n- rsa-\u003eiqmp, ctx);\n-\n- if (rv \u003d\u003d FAIL_TO_SW) {\n- const RSA_METHOD *meth \u003d RSA_PKCS1_SSLeay();\n- to_return \u003d (*meth-\u003ersa_mod_exp) (r0, I, rsa, ctx);\n- goto err;\n- } else if (rv !\u003d AEP_R_OK)\n- goto err;\n- } else {\n- if (!rsa-\u003ed || !rsa-\u003en) {\n- AEPHKerr(AEPHK_F_AEP_RSA_MOD_EXP, AEPHK_R_MISSING_KEY_COMPONENTS);\n- goto err;\n- }\n-\n- rv \u003d aep_mod_exp(r0, I, rsa-\u003ed, rsa-\u003en, ctx);\n- if (rv !\u003d AEP_R_OK)\n- goto err;\n-\n- }\n-\n- to_return \u003d 1;\n-\n- err:\n- return to_return;\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-static int aep_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,\n- BN_CTX *ctx, BN_MONT_CTX *in_mont)\n-{\n- BIGNUM t;\n- int to_return \u003d 0;\n- BN_init(\u0026t);\n-\n- /* let rr \u003d a1 ^ p1 mod m */\n- if (!aep_mod_exp(rr, a1, p1, m, ctx))\n- goto end;\n- /* let t \u003d a2 ^ p2 mod m */\n- if (!aep_mod_exp(\u0026t, a2, p2, m, ctx))\n- goto end;\n- /* let rr \u003d rr * t mod m */\n- if (!BN_mod_mul(rr, rr, \u0026t, m, ctx))\n- goto end;\n- to_return \u003d 1;\n- end:\n- BN_free(\u0026t);\n- return to_return;\n-}\n-\n-static int aep_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return aep_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-static int aep_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)\n-{\n- return aep_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* This function is aliased to mod_exp (with the dh and mont dropped). */\n-static int aep_mod_exp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return aep_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-static AEP_RV aep_get_connection(AEP_CONNECTION_HNDL_PTR phConnection)\n-{\n- int count;\n- AEP_RV rv \u003d AEP_R_OK;\n-\n- /*\n- * Get the current process id\n- */\n- pid_t curr_pid;\n-\n- CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n-\n- curr_pid \u003d getpid();\n-\n- /*\n- * Check if this is the first time this is being called from the current\n- * process\n- */\n- if (recorded_pid !\u003d curr_pid) {\n- /*\n- * Remember our pid so we can check if we're in a new process\n- */\n- recorded_pid \u003d curr_pid;\n-\n- /*\n- * Call Finalize to make sure we have not inherited some data from a\n- * parent process\n- */\n- p_AEP_Finalize();\n-\n- /*\n- * Initialise the AEP API\n- */\n- rv \u003d p_AEP_Initialize(NULL);\n-\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_GET_CONNECTION, AEPHK_R_INIT_FAILURE);\n- recorded_pid \u003d 0;\n- goto end;\n- }\n-\n- /*\n- * Set the AEP big num call back functions\n- */\n- rv \u003d p_AEP_SetBNCallBacks(\u0026GetBigNumSize, \u0026MakeAEPBigNum,\n- \u0026ConvertAEPBigNum);\n-\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_GET_CONNECTION,\n- AEPHK_R_SETBNCALLBACK_FAILURE);\n- recorded_pid \u003d 0;\n- goto end;\n- }\n-# ifdef AEPRAND\n- /*\n- * Reset the rand byte count\n- */\n- rand_block_bytes \u003d 0;\n-# endif\n-\n- /*\n- * Init the structures\n- */\n- for (count \u003d 0; count \u003c MAX_PROCESS_CONNECTIONS; count++) {\n- aep_app_conn_table[count].conn_state \u003d NotConnected;\n- aep_app_conn_table[count].conn_hndl \u003d 0;\n- }\n-\n- /*\n- * Open a connection\n- */\n- rv \u003d p_AEP_OpenConnection(phConnection);\n-\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_GET_CONNECTION, AEPHK_R_UNIT_FAILURE);\n- recorded_pid \u003d 0;\n- goto end;\n- }\n-\n- aep_app_conn_table[0].conn_state \u003d InUse;\n- aep_app_conn_table[0].conn_hndl \u003d *phConnection;\n- goto end;\n- }\n- /*\n- * Check the existing connections to see if we can find a free one\n- */\n- for (count \u003d 0; count \u003c MAX_PROCESS_CONNECTIONS; count++) {\n- if (aep_app_conn_table[count].conn_state \u003d\u003d Connected) {\n- aep_app_conn_table[count].conn_state \u003d InUse;\n- *phConnection \u003d aep_app_conn_table[count].conn_hndl;\n- goto end;\n- }\n- }\n- /*\n- * If no connections available, we're going to have to try to open a new\n- * one\n- */\n- for (count \u003d 0; count \u003c MAX_PROCESS_CONNECTIONS; count++) {\n- if (aep_app_conn_table[count].conn_state \u003d\u003d NotConnected) {\n- /*\n- * Open a connection\n- */\n- rv \u003d p_AEP_OpenConnection(phConnection);\n-\n- if (rv !\u003d AEP_R_OK) {\n- AEPHKerr(AEPHK_F_AEP_GET_CONNECTION, AEPHK_R_UNIT_FAILURE);\n- goto end;\n- }\n-\n- aep_app_conn_table[count].conn_state \u003d InUse;\n- aep_app_conn_table[count].conn_hndl \u003d *phConnection;\n- goto end;\n- }\n- }\n- rv \u003d AEP_R_GENERAL_ERROR;\n- end:\n- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n- return rv;\n-}\n-\n-static AEP_RV aep_return_connection(AEP_CONNECTION_HNDL hConnection)\n-{\n- int count;\n-\n- CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n-\n- /*\n- * Find the connection item that matches this connection handle\n- */\n- for (count \u003d 0; count \u003c MAX_PROCESS_CONNECTIONS; count++) {\n- if (aep_app_conn_table[count].conn_hndl \u003d\u003d hConnection) {\n- aep_app_conn_table[count].conn_state \u003d Connected;\n- break;\n- }\n- }\n-\n- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n-\n- return AEP_R_OK;\n-}\n-\n-static AEP_RV aep_close_connection(AEP_CONNECTION_HNDL hConnection)\n-{\n- int count;\n- AEP_RV rv \u003d AEP_R_OK;\n-\n- CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n-\n- /*\n- * Find the connection item that matches this connection handle\n- */\n- for (count \u003d 0; count \u003c MAX_PROCESS_CONNECTIONS; count++) {\n- if (aep_app_conn_table[count].conn_hndl \u003d\u003d hConnection) {\n- rv \u003d p_AEP_CloseConnection(aep_app_conn_table[count].conn_hndl);\n- if (rv !\u003d AEP_R_OK)\n- goto end;\n- aep_app_conn_table[count].conn_state \u003d NotConnected;\n- aep_app_conn_table[count].conn_hndl \u003d 0;\n- break;\n- }\n- }\n-\n- end:\n- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n- return rv;\n-}\n-\n-static AEP_RV aep_close_all_connections(int use_engine_lock, int *in_use)\n-{\n- int count;\n- AEP_RV rv \u003d AEP_R_OK;\n-\n- *in_use \u003d 0;\n- if (use_engine_lock)\n- CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n- for (count \u003d 0; count \u003c MAX_PROCESS_CONNECTIONS; count++) {\n- switch (aep_app_conn_table[count].conn_state) {\n- case Connected:\n- rv \u003d p_AEP_CloseConnection(aep_app_conn_table[count].conn_hndl);\n- if (rv !\u003d AEP_R_OK)\n- goto end;\n- aep_app_conn_table[count].conn_state \u003d NotConnected;\n- aep_app_conn_table[count].conn_hndl \u003d 0;\n- break;\n- case InUse:\n- (*in_use)++;\n- break;\n- case NotConnected:\n- break;\n- }\n- }\n- end:\n- if (use_engine_lock)\n- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n- return rv;\n-}\n-\n-/*\n- * BigNum call back functions, used to convert OpenSSL bignums into AEP\n- * bignums. Note only 32bit Openssl build support\n- */\n-\n-static AEP_RV GetBigNumSize(AEP_VOID_PTR ArbBigNum, AEP_U32 *BigNumSize)\n-{\n- BIGNUM *bn;\n-\n- /*\n- * Cast the ArbBigNum pointer to our BIGNUM struct\n- */\n- bn \u003d (BIGNUM *)ArbBigNum;\n-\n- *BigNumSize \u003d bn-\u003etop * BN_BYTES;\n-\n- if (BN_BYTES \u003e sizeof(AEP_U32) \u0026\u0026 (bn-\u003ed[bn-\u003etop - 1] \u003e\u003e BN_BITS4) \u003d\u003d 0)\n- *BigNumSize -\u003d 4;\n-\n- return AEP_R_OK;\n-}\n-\n-static AEP_RV MakeAEPBigNum(AEP_VOID_PTR ArbBigNum, AEP_U32 BigNumSize,\n- unsigned char *AEP_BigNum)\n-{\n- BIGNUM *bn;\n- const union {\n- long one;\n- char little;\n- } is_endian \u003d {\n- 1\n- };\n- AEP_U32 i, j;\n-\n- /*\n- * Cast the ArbBigNum pointer to our BIGNUM struct\n- */\n- bn \u003d (BIGNUM *)ArbBigNum;\n-\n- /*\n- * Must copy data into a (monotone) least significant byte first format\n- * performing endian conversion if necessary\n- */\n- if (is_endian.little \u0026\u0026 sizeof(bn-\u003ed[0]) \u003d\u003d BN_BYTES)\n- memcpy(AEP_BigNum, bn-\u003ed, BigNumSize);\n- else {\n- BN_ULONG di;\n-\n- for (i \u003d 0; BigNumSize \u003e\u003d BN_BYTES; i++) {\n- di \u003d bn-\u003ed[i];\n- for (j \u003d 0; j \u003c BN_BYTES; j++) {\n- AEP_BigNum[j] \u003d (unsigned char)di;\n- di \u003e\u003e\u003d 8;\n- }\n- AEP_BigNum +\u003d BN_BYTES;\n- BigNumSize -\u003d BN_BYTES;\n- }\n-\n- if (BigNumSize) {\n- di \u003d bn-\u003ed[i];\n- for (j \u003d 0; j \u003c BigNumSize; j++) {\n- AEP_BigNum[j] \u003d (unsigned char)di;\n- di \u003e\u003e\u003d 8;\n- }\n- }\n- }\n-\n- return AEP_R_OK;\n-}\n-\n-/*\n- * Turn an AEP Big Num back to a user big num\n- */\n-static AEP_RV ConvertAEPBigNum(void *ArbBigNum, AEP_U32 BigNumSize,\n- unsigned char *AEP_BigNum)\n-{\n- BIGNUM *bn;\n- const union {\n- long one;\n- char little;\n- } is_endian \u003d {\n- 1\n- };\n- int i, j, top;\n-\n- bn \u003d (BIGNUM *)ArbBigNum;\n-\n- /*\n- * Expand the result bn so that it can hold our big num. Size is in bits\n- */\n- top \u003d (BigNumSize + BN_BYTES - 1) / BN_BYTES;\n- bn_expand(bn, top);\n- bn-\u003etop \u003d top;\n- bn-\u003ed[top - 1] \u003d 0;\n-\n- if (is_endian.little \u0026\u0026 sizeof(bn-\u003ed[0]) \u003d\u003d BN_BYTES)\n- memcpy(bn-\u003ed, AEP_BigNum, BigNumSize);\n- else {\n- BN_ULONG di;\n-\n- for (i \u003d 0; BigNumSize \u003e\u003d BN_BYTES; i++) {\n- for (di \u003d 0, j \u003d BN_BYTES; j !\u003d 0;) {\n- di \u003c\u003c\u003d 8;\n- di |\u003d AEP_BigNum[--j];\n- }\n- bn-\u003ed[i] \u003d di;\n- AEP_BigNum +\u003d BN_BYTES;\n- BigNumSize -\u003d BN_BYTES;\n- }\n-\n- if (BigNumSize) {\n- for (di \u003d 0, j \u003d BigNumSize; j !\u003d 0;) {\n- di \u003c\u003c\u003d 8;\n- di |\u003d AEP_BigNum[--j];\n- }\n- bn-\u003ed[i] \u003d di;\n- }\n- }\n-\n- return AEP_R_OK;\n-}\n-\n-# endif /* !OPENSSL_NO_HW_AEP */\n-#endif /* !OPENSSL_NO_HW */\ndiff --git a/engines/e_aep.ec b/engines/e_aep.ec\ndeleted file mode 100644\nindex 8eae642..0000000\n--- a/engines/e_aep.ec\n+++ /dev/null\n@@ -1 +0,0 @@\n-L AEPHK\t\te_aep_err.h\t\t\te_aep_err.c\ndiff --git a/engines/e_aep_err.c b/engines/e_aep_err.c\ndeleted file mode 100644\nindex 718db37..0000000\n--- a/engines/e_aep_err.c\n+++ /dev/null\n@@ -1,159 +0,0 @@\n-/* e_aep_err.c */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-/*\n- * NOTE: this file was auto generated by the mkerr.pl script: any changes\n- * made to it will be overwritten when the script next updates this file,\n- * only reason strings will be preserved.\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/err.h\u003e\n-#include \u0022e_aep_err.h\u0022\n-\n-/* BEGIN ERROR CODES */\n-#ifndef OPENSSL_NO_ERR\n-\n-# define ERR_FUNC(func) ERR_PACK(0,func,0)\n-# define ERR_REASON(reason) ERR_PACK(0,0,reason)\n-\n-static ERR_STRING_DATA AEPHK_str_functs[] \u003d {\n- {ERR_FUNC(AEPHK_F_AEP_CTRL), \u0022AEP_CTRL\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_FINISH), \u0022AEP_FINISH\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_GET_CONNECTION), \u0022AEP_GET_CONNECTION\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_INIT), \u0022AEP_INIT\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_MOD_EXP), \u0022AEP_MOD_EXP\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_MOD_EXP_CRT), \u0022AEP_MOD_EXP_CRT\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_RAND), \u0022AEP_RAND\u0022},\n- {ERR_FUNC(AEPHK_F_AEP_RSA_MOD_EXP), \u0022AEP_RSA_MOD_EXP\u0022},\n- {0, NULL}\n-};\n-\n-static ERR_STRING_DATA AEPHK_str_reasons[] \u003d {\n- {ERR_REASON(AEPHK_R_ALREADY_LOADED), \u0022already loaded\u0022},\n- {ERR_REASON(AEPHK_R_CLOSE_HANDLES_FAILED), \u0022close handles failed\u0022},\n- {ERR_REASON(AEPHK_R_CONNECTIONS_IN_USE), \u0022connections in use\u0022},\n- {ERR_REASON(AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED),\n- \u0022ctrl command not implemented\u0022},\n- {ERR_REASON(AEPHK_R_FINALIZE_FAILED), \u0022finalize failed\u0022},\n- {ERR_REASON(AEPHK_R_GET_HANDLE_FAILED), \u0022get handle failed\u0022},\n- {ERR_REASON(AEPHK_R_GET_RANDOM_FAILED), \u0022get random failed\u0022},\n- {ERR_REASON(AEPHK_R_INIT_FAILURE), \u0022init failure\u0022},\n- {ERR_REASON(AEPHK_R_MISSING_KEY_COMPONENTS), \u0022missing key components\u0022},\n- {ERR_REASON(AEPHK_R_MOD_EXP_CRT_FAILED), \u0022mod exp crt failed\u0022},\n- {ERR_REASON(AEPHK_R_MOD_EXP_FAILED), \u0022mod exp failed\u0022},\n- {ERR_REASON(AEPHK_R_NOT_LOADED), \u0022not loaded\u0022},\n- {ERR_REASON(AEPHK_R_OK), \u0022ok\u0022},\n- {ERR_REASON(AEPHK_R_RETURN_CONNECTION_FAILED),\n- \u0022return connection failed\u0022},\n- {ERR_REASON(AEPHK_R_SETBNCALLBACK_FAILURE), \u0022setbncallback failure\u0022},\n- {ERR_REASON(AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL),\n- \u0022size too large or too small\u0022},\n- {ERR_REASON(AEPHK_R_UNIT_FAILURE), \u0022unit failure\u0022},\n- {0, NULL}\n-};\n-\n-#endif\n-\n-#ifdef AEPHK_LIB_NAME\n-static ERR_STRING_DATA AEPHK_lib_name[] \u003d {\n- {0, AEPHK_LIB_NAME},\n- {0, NULL}\n-};\n-#endif\n-\n-static int AEPHK_lib_error_code \u003d 0;\n-static int AEPHK_error_init \u003d 1;\n-\n-static void ERR_load_AEPHK_strings(void)\n-{\n- if (AEPHK_lib_error_code \u003d\u003d 0)\n- AEPHK_lib_error_code \u003d ERR_get_next_error_library();\n-\n- if (AEPHK_error_init) {\n- AEPHK_error_init \u003d 0;\n-#ifndef OPENSSL_NO_ERR\n- ERR_load_strings(AEPHK_lib_error_code, AEPHK_str_functs);\n- ERR_load_strings(AEPHK_lib_error_code, AEPHK_str_reasons);\n-#endif\n-\n-#ifdef AEPHK_LIB_NAME\n- AEPHK_lib_name-\u003eerror \u003d ERR_PACK(AEPHK_lib_error_code, 0, 0);\n- ERR_load_strings(0, AEPHK_lib_name);\n-#endif\n- }\n-}\n-\n-static void ERR_unload_AEPHK_strings(void)\n-{\n- if (AEPHK_error_init \u003d\u003d 0) {\n-#ifndef OPENSSL_NO_ERR\n- ERR_unload_strings(AEPHK_lib_error_code, AEPHK_str_functs);\n- ERR_unload_strings(AEPHK_lib_error_code, AEPHK_str_reasons);\n-#endif\n-\n-#ifdef AEPHK_LIB_NAME\n- ERR_unload_strings(0, AEPHK_lib_name);\n-#endif\n- AEPHK_error_init \u003d 1;\n- }\n-}\n-\n-static void ERR_AEPHK_error(int function, int reason, char *file, int line)\n-{\n- if (AEPHK_lib_error_code \u003d\u003d 0)\n- AEPHK_lib_error_code \u003d ERR_get_next_error_library();\n- ERR_PUT_error(AEPHK_lib_error_code, function, reason, file, line);\n-}\ndiff --git a/engines/e_aep_err.h b/engines/e_aep_err.h\ndeleted file mode 100644\nindex 2ed0114..0000000\n--- a/engines/e_aep_err.h\n+++ /dev/null\n@@ -1,106 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@openssl.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.openssl.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#ifndef HEADER_AEPHK_ERR_H\n-# define HEADER_AEPHK_ERR_H\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif\n-\n-/* BEGIN ERROR CODES */\n-/*\n- * The following lines are auto generated by the script mkerr.pl. Any changes\n- * made after this point may be overwritten when the script is next run.\n- */\n-static void ERR_load_AEPHK_strings(void);\n-static void ERR_unload_AEPHK_strings(void);\n-static void ERR_AEPHK_error(int function, int reason, char *file, int line);\n-# define AEPHKerr(f,r) ERR_AEPHK_error((f),(r),__FILE__,__LINE__)\n-\n-/* Error codes for the AEPHK functions. */\n-\n-/* Function codes. */\n-# define AEPHK_F_AEP_CTRL 100\n-# define AEPHK_F_AEP_FINISH 101\n-# define AEPHK_F_AEP_GET_CONNECTION 102\n-# define AEPHK_F_AEP_INIT 103\n-# define AEPHK_F_AEP_MOD_EXP 104\n-# define AEPHK_F_AEP_MOD_EXP_CRT 105\n-# define AEPHK_F_AEP_RAND 106\n-# define AEPHK_F_AEP_RSA_MOD_EXP 107\n-\n-/* Reason codes. */\n-# define AEPHK_R_ALREADY_LOADED 100\n-# define AEPHK_R_CLOSE_HANDLES_FAILED 101\n-# define AEPHK_R_CONNECTIONS_IN_USE 102\n-# define AEPHK_R_CTRL_COMMAND_NOT_IMPLEMENTED 103\n-# define AEPHK_R_FINALIZE_FAILED 104\n-# define AEPHK_R_GET_HANDLE_FAILED 105\n-# define AEPHK_R_GET_RANDOM_FAILED 106\n-# define AEPHK_R_INIT_FAILURE 107\n-# define AEPHK_R_MISSING_KEY_COMPONENTS 108\n-# define AEPHK_R_MOD_EXP_CRT_FAILED 109\n-# define AEPHK_R_MOD_EXP_FAILED 110\n-# define AEPHK_R_NOT_LOADED 111\n-# define AEPHK_R_OK 112\n-# define AEPHK_R_RETURN_CONNECTION_FAILED 113\n-# define AEPHK_R_SETBNCALLBACK_FAILURE 114\n-# define AEPHK_R_SIZE_TOO_LARGE_OR_TOO_SMALL 116\n-# define AEPHK_R_UNIT_FAILURE 115\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-#endif\ndiff --git a/engines/e_atalla.c b/engines/e_atalla.c\ndeleted file mode 100644\nindex 211f29f..0000000\n--- a/engines/e_atalla.c\n+++ /dev/null\n@@ -1,621 +0,0 @@\n-/* crypto/engine/hw_atalla.c */\n-/*\n- * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project\n- * 2000.\n- */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * licensing@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003cstring.h\u003e\n-#include \u003copenssl/crypto.h\u003e\n-#include \u003copenssl/buffer.h\u003e\n-#include \u003copenssl/dso.h\u003e\n-#include \u003copenssl/engine.h\u003e\n-#ifndef OPENSSL_NO_RSA\n-# include \u003copenssl/rsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DSA\n-# include \u003copenssl/dsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DH\n-# include \u003copenssl/dh.h\u003e\n-#endif\n-#include \u003copenssl/bn.h\u003e\n-\n-#ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_ATALLA\n-\n-# ifdef FLAT_INC\n-# include \u0022atalla.h\u0022\n-# else\n-# include \u0022vendor_defns/atalla.h\u0022\n-# endif\n-\n-# define ATALLA_LIB_NAME \u0022atalla engine\u0022\n-# include \u0022e_atalla_err.c\u0022\n-\n-static int atalla_destroy(ENGINE *e);\n-static int atalla_init(ENGINE *e);\n-static int atalla_finish(ENGINE *e);\n-static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));\n-\n-/* BIGNUM stuff */\n-static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx);\n-\n-# ifndef OPENSSL_NO_RSA\n-/* RSA stuff */\n-static int atalla_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,\n- BN_CTX *ctx);\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-static int atalla_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/* DSA stuff */\n-static int atalla_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,\n- BN_CTX *ctx, BN_MONT_CTX *in_mont);\n-static int atalla_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* DH stuff */\n-/* This function is alised to mod_exp (with the DH and mont dropped). */\n-static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r,\n- const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-/* The definitions for control commands specific to this engine */\n-# define ATALLA_CMD_SO_PATH ENGINE_CMD_BASE\n-static const ENGINE_CMD_DEFN atalla_cmd_defns[] \u003d {\n- {ATALLA_CMD_SO_PATH,\n- \u0022SO_PATH\u0022,\n- \u0022Specifies the path to the 'atasi' shared library\u0022,\n- ENGINE_CMD_FLAG_STRING},\n- {0, NULL, NULL, 0}\n-};\n-\n-# ifndef OPENSSL_NO_RSA\n-/* Our internal RSA_METHOD that we provide pointers to */\n-static RSA_METHOD atalla_rsa \u003d {\n- \u0022Atalla RSA method\u0022,\n- NULL,\n- NULL,\n- NULL,\n- NULL,\n- atalla_rsa_mod_exp,\n- atalla_mod_exp_mont,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/* Our internal DSA_METHOD that we provide pointers to */\n-static DSA_METHOD atalla_dsa \u003d {\n- \u0022Atalla DSA method\u0022,\n- NULL, /* dsa_do_sign */\n- NULL, /* dsa_sign_setup */\n- NULL, /* dsa_do_verify */\n- atalla_dsa_mod_exp, /* dsa_mod_exp */\n- atalla_mod_exp_dsa, /* bn_mod_exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* flags */\n- NULL, /* app_data */\n- NULL, /* dsa_paramgen */\n- NULL /* dsa_keygen */\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* Our internal DH_METHOD that we provide pointers to */\n-static DH_METHOD atalla_dh \u003d {\n- \u0022Atalla DH method\u0022,\n- NULL,\n- NULL,\n- atalla_mod_exp_dh,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-/* Constants used when creating the ENGINE */\n-static const char *engine_atalla_id \u003d \u0022atalla\u0022;\n-static const char *engine_atalla_name \u003d \u0022Atalla hardware engine support\u0022;\n-\n-/*\n- * This internal function is used by ENGINE_atalla() and possibly by the\n- * \u0022dynamic\u0022 ENGINE support too\n- */\n-static int bind_helper(ENGINE *e)\n-{\n-# ifndef OPENSSL_NO_RSA\n- const RSA_METHOD *meth1;\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- const DSA_METHOD *meth2;\n-# endif\n-# ifndef OPENSSL_NO_DH\n- const DH_METHOD *meth3;\n-# endif\n- if (!ENGINE_set_id(e, engine_atalla_id) ||\n- !ENGINE_set_name(e, engine_atalla_name) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_RSA(e, \u0026atalla_rsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- !ENGINE_set_DSA(e, \u0026atalla_dsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DH\n- !ENGINE_set_DH(e, \u0026atalla_dh) ||\n-# endif\n- !ENGINE_set_destroy_function(e, atalla_destroy) ||\n- !ENGINE_set_init_function(e, atalla_init) ||\n- !ENGINE_set_finish_function(e, atalla_finish) ||\n- !ENGINE_set_ctrl_function(e, atalla_ctrl) ||\n- !ENGINE_set_cmd_defns(e, atalla_cmd_defns))\n- return 0;\n-\n-# ifndef OPENSSL_NO_RSA\n- /*\n- * We know that the \u0022PKCS1_SSLeay()\u0022 functions hook properly to the\n- * atalla-specific mod_exp and mod_exp_crt so we use those functions. NB:\n- * We don't use ENGINE_openssl() or anything \u0022more generic\u0022 because\n- * something like the RSAref code may not hook properly, and if you own\n- * one of these cards then you have the right to do RSA operations on it\n- * anyway!\n- */\n- meth1 \u003d RSA_PKCS1_SSLeay();\n- atalla_rsa.rsa_pub_enc \u003d meth1-\u003ersa_pub_enc;\n- atalla_rsa.rsa_pub_dec \u003d meth1-\u003ersa_pub_dec;\n- atalla_rsa.rsa_priv_enc \u003d meth1-\u003ersa_priv_enc;\n- atalla_rsa.rsa_priv_dec \u003d meth1-\u003ersa_priv_dec;\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n- /*\n- * Use the DSA_OpenSSL() method and just hook the mod_exp-ish bits.\n- */\n- meth2 \u003d DSA_OpenSSL();\n- atalla_dsa.dsa_do_sign \u003d meth2-\u003edsa_do_sign;\n- atalla_dsa.dsa_sign_setup \u003d meth2-\u003edsa_sign_setup;\n- atalla_dsa.dsa_do_verify \u003d meth2-\u003edsa_do_verify;\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n- /* Much the same for Diffie-Hellman */\n- meth3 \u003d DH_OpenSSL();\n- atalla_dh.generate_key \u003d meth3-\u003egenerate_key;\n- atalla_dh.compute_key \u003d meth3-\u003ecompute_key;\n-# endif\n-\n- /* Ensure the atalla error handling is set up */\n- ERR_load_ATALLA_strings();\n- return 1;\n-}\n-\n-# ifdef OPENSSL_NO_DYNAMIC_ENGINE\n-static ENGINE *engine_atalla(void)\n-{\n- ENGINE *ret \u003d ENGINE_new();\n- if (!ret)\n- return NULL;\n- if (!bind_helper(ret)) {\n- ENGINE_free(ret);\n- return NULL;\n- }\n- return ret;\n-}\n-\n-void ENGINE_load_atalla(void)\n-{\n- /* Copied from eng_[openssl|dyn].c */\n- ENGINE *toadd \u003d engine_atalla();\n- if (!toadd)\n- return;\n- ENGINE_add(toadd);\n- ENGINE_free(toadd);\n- ERR_clear_error();\n-}\n-# endif\n-\n-/*\n- * This is a process-global DSO handle used for loading and unloading the\n- * Atalla library. NB: This is only set (or unset) during an init() or\n- * finish() call (reference counts permitting) and they're operating with\n- * global locks, so this should be thread-safe implicitly.\n- */\n-static DSO *atalla_dso \u003d NULL;\n-\n-/*\n- * These are the function pointers that are (un)set when the library has\n- * successfully (un)loaded.\n- */\n-static tfnASI_GetHardwareConfig *p_Atalla_GetHardwareConfig \u003d NULL;\n-static tfnASI_RSAPrivateKeyOpFn *p_Atalla_RSAPrivateKeyOpFn \u003d NULL;\n-static tfnASI_GetPerformanceStatistics *p_Atalla_GetPerformanceStatistics \u003d\n- NULL;\n-\n-/*\n- * These are the static string constants for the DSO file name and the\n- * function symbol names to bind to. Regrettably, the DSO name on *nix\n- * appears to be \u0022atasi.so\u0022 rather than something more consistent like\n- * \u0022libatasi.so\u0022. At the time of writing, I'm not sure what the file name on\n- * win32 is but clearly native name translation is not possible (eg\n- * libatasi.so on *nix, and atasi.dll on win32). For the purposes of testing,\n- * I have created a symbollic link called \u0022libatasi.so\u0022 so that we can use\n- * native name-translation - a better solution will be needed.\n- */\n-static const char *ATALLA_LIBNAME \u003d NULL;\n-static const char *get_ATALLA_LIBNAME(void)\n-{\n- if (ATALLA_LIBNAME)\n- return ATALLA_LIBNAME;\n- return \u0022atasi\u0022;\n-}\n-\n-static void free_ATALLA_LIBNAME(void)\n-{\n- OPENSSL_free(ATALLA_LIBNAME);\n- ATALLA_LIBNAME \u003d NULL;\n-}\n-\n-static long set_ATALLA_LIBNAME(const char *name)\n-{\n- free_ATALLA_LIBNAME();\n- return (((ATALLA_LIBNAME \u003d BUF_strdup(name)) !\u003d NULL) ? 1 : 0);\n-}\n-\n-static const char *ATALLA_F1 \u003d \u0022ASI_GetHardwareConfig\u0022;\n-static const char *ATALLA_F2 \u003d \u0022ASI_RSAPrivateKeyOpFn\u0022;\n-static const char *ATALLA_F3 \u003d \u0022ASI_GetPerformanceStatistics\u0022;\n-\n-/* Destructor (complements the \u0022ENGINE_atalla()\u0022 constructor) */\n-static int atalla_destroy(ENGINE *e)\n-{\n- free_ATALLA_LIBNAME();\n- /*\n- * Unload the atalla error strings so any error state including our\n- * functs or reasons won't lead to a segfault (they simply get displayed\n- * without corresponding string data because none will be found).\n- */\n- ERR_unload_ATALLA_strings();\n- return 1;\n-}\n-\n-/* (de)initialisation functions. */\n-static int atalla_init(ENGINE *e)\n-{\n- tfnASI_GetHardwareConfig *p1;\n- tfnASI_RSAPrivateKeyOpFn *p2;\n- tfnASI_GetPerformanceStatistics *p3;\n- /*\n- * Not sure of the origin of this magic value, but Ben's code had it and\n- * it seemed to have been working for a few people. :-)\n- */\n- unsigned int config_buf[1024];\n-\n- if (atalla_dso !\u003d NULL) {\n- ATALLAerr(ATALLA_F_ATALLA_INIT, ATALLA_R_ALREADY_LOADED);\n- goto err;\n- }\n- /*\n- * Attempt to load libatasi.so/atasi.dll/whatever. Needs to be changed\n- * unfortunately because the Atalla drivers don't have standard library\n- * names that can be platform-translated well.\n- */\n- /*\n- * TODO: Work out how to actually map to the names the Atalla drivers\n- * really use - for now a symbollic link needs to be created on the host\n- * system from libatasi.so to atasi.so on unix variants.\n- */\n- atalla_dso \u003d DSO_load(NULL, get_ATALLA_LIBNAME(), NULL, 0);\n- if (atalla_dso \u003d\u003d NULL) {\n- ATALLAerr(ATALLA_F_ATALLA_INIT, ATALLA_R_NOT_LOADED);\n- goto err;\n- }\n-#define BINDIT(t, name) (t *)DSO_bind_func(atalla_dso, name)\n- if ((p1 \u003d BINDIT(tfnASI_GetHardwareConfig, ATALLA_F1)) \u003d\u003d NULL\n- || (p2 \u003d BINDIT(tfnASI_RSAPrivateKeyOpFn, ATALLA_F2)) \u003d\u003d NULL\n- || (p3 \u003d BINDIT(tfnASI_GetPerformanceStatistics, ATALLA_F3)) \u003d\u003d NULL) {\n- ATALLAerr(ATALLA_F_ATALLA_INIT, ATALLA_R_NOT_LOADED);\n- goto err;\n- }\n- /* Copy the pointers */\n- p_Atalla_GetHardwareConfig \u003d p1;\n- p_Atalla_RSAPrivateKeyOpFn \u003d p2;\n- p_Atalla_GetPerformanceStatistics \u003d p3;\n- /*\n- * Perform a basic test to see if there's actually any unit running.\n- */\n- if (p1(0L, config_buf) !\u003d 0) {\n- ATALLAerr(ATALLA_F_ATALLA_INIT, ATALLA_R_UNIT_FAILURE);\n- goto err;\n- }\n- /* Everything's fine. */\n- return 1;\n- err:\n- DSO_free(atalla_dso);\n- atalla_dso \u003d NULL;\n- p_Atalla_GetHardwareConfig \u003d NULL;\n- p_Atalla_RSAPrivateKeyOpFn \u003d NULL;\n- p_Atalla_GetPerformanceStatistics \u003d NULL;\n- return 0;\n-}\n-\n-static int atalla_finish(ENGINE *e)\n-{\n- free_ATALLA_LIBNAME();\n- if (atalla_dso \u003d\u003d NULL) {\n- ATALLAerr(ATALLA_F_ATALLA_FINISH, ATALLA_R_NOT_LOADED);\n- return 0;\n- }\n- if (!DSO_free(atalla_dso)) {\n- ATALLAerr(ATALLA_F_ATALLA_FINISH, ATALLA_R_UNIT_FAILURE);\n- return 0;\n- }\n- atalla_dso \u003d NULL;\n- p_Atalla_GetHardwareConfig \u003d NULL;\n- p_Atalla_RSAPrivateKeyOpFn \u003d NULL;\n- p_Atalla_GetPerformanceStatistics \u003d NULL;\n- return 1;\n-}\n-\n-static int atalla_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))\n-{\n- int initialised \u003d ((atalla_dso \u003d\u003d NULL) ? 0 : 1);\n- switch (cmd) {\n- case ATALLA_CMD_SO_PATH:\n- if (p \u003d\u003d NULL) {\n- ATALLAerr(ATALLA_F_ATALLA_CTRL, ERR_R_PASSED_NULL_PARAMETER);\n- return 0;\n- }\n- if (initialised) {\n- ATALLAerr(ATALLA_F_ATALLA_CTRL, ATALLA_R_ALREADY_LOADED);\n- return 0;\n- }\n- return set_ATALLA_LIBNAME((const char *)p);\n- default:\n- break;\n- }\n- ATALLAerr(ATALLA_F_ATALLA_CTRL, ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED);\n- return 0;\n-}\n-\n-static int atalla_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx)\n-{\n- /*\n- * I need somewhere to store temporary serialised values for use with the\n- * Atalla API calls. A neat cheat - I'll use BIGNUMs from the BN_CTX but\n- * access their arrays directly as byte arrays \u003cgrin\u003e. This way I don't\n- * have to clean anything up.\n- */\n- BIGNUM *modulus;\n- BIGNUM *exponent;\n- BIGNUM *argument;\n- BIGNUM *result;\n- RSAPrivateKey keydata;\n- int to_return, numbytes;\n-\n- modulus \u003d exponent \u003d argument \u003d result \u003d NULL;\n- to_return \u003d 0; /* expect failure */\n-\n- if (!atalla_dso) {\n- ATALLAerr(ATALLA_F_ATALLA_MOD_EXP, ATALLA_R_NOT_LOADED);\n- goto err;\n- }\n- /* Prepare the params */\n- BN_CTX_start(ctx);\n- modulus \u003d BN_CTX_get(ctx);\n- exponent \u003d BN_CTX_get(ctx);\n- argument \u003d BN_CTX_get(ctx);\n- result \u003d BN_CTX_get(ctx);\n- if (!result) {\n- ATALLAerr(ATALLA_F_ATALLA_MOD_EXP, ATALLA_R_BN_CTX_FULL);\n- goto err;\n- }\n- if (!bn_wexpand(modulus, m-\u003etop) || !bn_wexpand(exponent, m-\u003etop) ||\n- !bn_wexpand(argument, m-\u003etop) || !bn_wexpand(result, m-\u003etop)) {\n- ATALLAerr(ATALLA_F_ATALLA_MOD_EXP, ATALLA_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- /* Prepare the key-data */\n- memset(\u0026keydata, 0, sizeof(keydata));\n- numbytes \u003d BN_num_bytes(m);\n- memset(exponent-\u003ed, 0, numbytes);\n- memset(modulus-\u003ed, 0, numbytes);\n- BN_bn2bin(p, (unsigned char *)exponent-\u003ed + numbytes - BN_num_bytes(p));\n- BN_bn2bin(m, (unsigned char *)modulus-\u003ed + numbytes - BN_num_bytes(m));\n- keydata.privateExponent.data \u003d (unsigned char *)exponent-\u003ed;\n- keydata.privateExponent.len \u003d numbytes;\n- keydata.modulus.data \u003d (unsigned char *)modulus-\u003ed;\n- keydata.modulus.len \u003d numbytes;\n- /* Prepare the argument */\n- memset(argument-\u003ed, 0, numbytes);\n- memset(result-\u003ed, 0, numbytes);\n- BN_bn2bin(a, (unsigned char *)argument-\u003ed + numbytes - BN_num_bytes(a));\n- /* Perform the operation */\n- if (p_Atalla_RSAPrivateKeyOpFn(\u0026keydata, (unsigned char *)result-\u003ed,\n- (unsigned char *)argument-\u003ed,\n- keydata.modulus.len) !\u003d 0) {\n- ATALLAerr(ATALLA_F_ATALLA_MOD_EXP, ATALLA_R_REQUEST_FAILED);\n- goto err;\n- }\n- /* Convert the response */\n- BN_bin2bn((unsigned char *)result-\u003ed, numbytes, r);\n- to_return \u003d 1;\n- err:\n- BN_CTX_end(ctx);\n- return to_return;\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-static int atalla_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,\n- BN_CTX *ctx)\n-{\n- int to_return \u003d 0;\n-\n- if (!atalla_dso) {\n- ATALLAerr(ATALLA_F_ATALLA_RSA_MOD_EXP, ATALLA_R_NOT_LOADED);\n- goto err;\n- }\n- if (!rsa-\u003ed || !rsa-\u003en) {\n- ATALLAerr(ATALLA_F_ATALLA_RSA_MOD_EXP,\n- ATALLA_R_MISSING_KEY_COMPONENTS);\n- goto err;\n- }\n- to_return \u003d atalla_mod_exp(r0, I, rsa-\u003ed, rsa-\u003en, ctx);\n- err:\n- return to_return;\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/*\n- * This code was liberated and adapted from the commented-out code in\n- * dsa_ossl.c. Because of the unoptimised form of the Atalla acceleration (it\n- * doesn't have a CRT form for RSA), this function means that an Atalla\n- * system running with a DSA server certificate can handshake around 5 or 6\n- * times faster/more than an equivalent system running with RSA. Just check\n- * out the \u0022signs\u0022 statistics from the RSA and DSA parts of \u0022openssl speed\n- * -engine atalla dsa1024 rsa1024\u0022.\n- */\n-static int atalla_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,\n- BN_CTX *ctx, BN_MONT_CTX *in_mont)\n-{\n- BIGNUM t;\n- int to_return \u003d 0;\n-\n- BN_init(\u0026t);\n- /* let rr \u003d a1 ^ p1 mod m */\n- if (!atalla_mod_exp(rr, a1, p1, m, ctx))\n- goto end;\n- /* let t \u003d a2 ^ p2 mod m */\n- if (!atalla_mod_exp(\u0026t, a2, p2, m, ctx))\n- goto end;\n- /* let rr \u003d rr * t mod m */\n- if (!BN_mod_mul(rr, rr, \u0026t, m, ctx))\n- goto end;\n- to_return \u003d 1;\n- end:\n- BN_free(\u0026t);\n- return to_return;\n-}\n-\n-static int atalla_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return atalla_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-static int atalla_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return atalla_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* This function is aliased to mod_exp (with the dh and mont dropped). */\n-static int atalla_mod_exp_dh(const DH *dh, BIGNUM *r,\n- const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)\n-{\n- return atalla_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-/*\n- * This stuff is needed if this ENGINE is being compiled into a\n- * self-contained shared-library.\n- */\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-static int bind_fn(ENGINE *e, const char *id)\n-{\n- if (id \u0026\u0026 (strcmp(id, engine_atalla_id) !\u003d 0))\n- return 0;\n- if (!bind_helper(e))\n- return 0;\n- return 1;\n-}\n-\n-IMPLEMENT_DYNAMIC_CHECK_FN()\n- IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)\n-# endif /* OPENSSL_NO_DYNAMIC_ENGINE */\n-# endif /* !OPENSSL_NO_HW_ATALLA */\n-#endif /* !OPENSSL_NO_HW */\ndiff --git a/engines/e_atalla.ec b/engines/e_atalla.ec\ndeleted file mode 100644\nindex 1d735e1..0000000\n--- a/engines/e_atalla.ec\n+++ /dev/null\n@@ -1 +0,0 @@\n-L ATALLA\te_atalla_err.h\t\t\te_atalla_err.c\ndiff --git a/engines/e_atalla_err.c b/engines/e_atalla_err.c\ndeleted file mode 100644\nindex ff47322..0000000\n--- a/engines/e_atalla_err.c\n+++ /dev/null\n@@ -1,145 +0,0 @@\n-/* e_atalla_err.c */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-/*\n- * NOTE: this file was auto generated by the mkerr.pl script: any changes\n- * made to it will be overwritten when the script next updates this file,\n- * only reason strings will be preserved.\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/err.h\u003e\n-#include \u0022e_atalla_err.h\u0022\n-\n-/* BEGIN ERROR CODES */\n-#ifndef OPENSSL_NO_ERR\n-\n-# define ERR_FUNC(func) ERR_PACK(0,func,0)\n-# define ERR_REASON(reason) ERR_PACK(0,0,reason)\n-\n-static ERR_STRING_DATA ATALLA_str_functs[] \u003d {\n- {ERR_FUNC(ATALLA_F_ATALLA_CTRL), \u0022ATALLA_CTRL\u0022},\n- {ERR_FUNC(ATALLA_F_ATALLA_FINISH), \u0022ATALLA_FINISH\u0022},\n- {ERR_FUNC(ATALLA_F_ATALLA_INIT), \u0022ATALLA_INIT\u0022},\n- {ERR_FUNC(ATALLA_F_ATALLA_MOD_EXP), \u0022ATALLA_MOD_EXP\u0022},\n- {ERR_FUNC(ATALLA_F_ATALLA_RSA_MOD_EXP), \u0022ATALLA_RSA_MOD_EXP\u0022},\n- {0, NULL}\n-};\n-\n-static ERR_STRING_DATA ATALLA_str_reasons[] \u003d {\n- {ERR_REASON(ATALLA_R_ALREADY_LOADED), \u0022already loaded\u0022},\n- {ERR_REASON(ATALLA_R_BN_CTX_FULL), \u0022bn ctx full\u0022},\n- {ERR_REASON(ATALLA_R_BN_EXPAND_FAIL), \u0022bn expand fail\u0022},\n- {ERR_REASON(ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED),\n- \u0022ctrl command not implemented\u0022},\n- {ERR_REASON(ATALLA_R_MISSING_KEY_COMPONENTS), \u0022missing key components\u0022},\n- {ERR_REASON(ATALLA_R_NOT_LOADED), \u0022not loaded\u0022},\n- {ERR_REASON(ATALLA_R_REQUEST_FAILED), \u0022request failed\u0022},\n- {ERR_REASON(ATALLA_R_UNIT_FAILURE), \u0022unit failure\u0022},\n- {0, NULL}\n-};\n-\n-#endif\n-\n-#ifdef ATALLA_LIB_NAME\n-static ERR_STRING_DATA ATALLA_lib_name[] \u003d {\n- {0, ATALLA_LIB_NAME},\n- {0, NULL}\n-};\n-#endif\n-\n-static int ATALLA_lib_error_code \u003d 0;\n-static int ATALLA_error_init \u003d 1;\n-\n-static void ERR_load_ATALLA_strings(void)\n-{\n- if (ATALLA_lib_error_code \u003d\u003d 0)\n- ATALLA_lib_error_code \u003d ERR_get_next_error_library();\n-\n- if (ATALLA_error_init) {\n- ATALLA_error_init \u003d 0;\n-#ifndef OPENSSL_NO_ERR\n- ERR_load_strings(ATALLA_lib_error_code, ATALLA_str_functs);\n- ERR_load_strings(ATALLA_lib_error_code, ATALLA_str_reasons);\n-#endif\n-\n-#ifdef ATALLA_LIB_NAME\n- ATALLA_lib_name-\u003eerror \u003d ERR_PACK(ATALLA_lib_error_code, 0, 0);\n- ERR_load_strings(0, ATALLA_lib_name);\n-#endif\n- }\n-}\n-\n-static void ERR_unload_ATALLA_strings(void)\n-{\n- if (ATALLA_error_init \u003d\u003d 0) {\n-#ifndef OPENSSL_NO_ERR\n- ERR_unload_strings(ATALLA_lib_error_code, ATALLA_str_functs);\n- ERR_unload_strings(ATALLA_lib_error_code, ATALLA_str_reasons);\n-#endif\n-\n-#ifdef ATALLA_LIB_NAME\n- ERR_unload_strings(0, ATALLA_lib_name);\n-#endif\n- ATALLA_error_init \u003d 1;\n- }\n-}\n-\n-static void ERR_ATALLA_error(int function, int reason, char *file, int line)\n-{\n- if (ATALLA_lib_error_code \u003d\u003d 0)\n- ATALLA_lib_error_code \u003d ERR_get_next_error_library();\n- ERR_PUT_error(ATALLA_lib_error_code, function, reason, file, line);\n-}\ndiff --git a/engines/e_atalla_err.h b/engines/e_atalla_err.h\ndeleted file mode 100644\nindex 7b71eff..0000000\n--- a/engines/e_atalla_err.h\n+++ /dev/null\n@@ -1,94 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@openssl.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.openssl.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#ifndef HEADER_ATALLA_ERR_H\n-# define HEADER_ATALLA_ERR_H\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif\n-\n-/* BEGIN ERROR CODES */\n-/*\n- * The following lines are auto generated by the script mkerr.pl. Any changes\n- * made after this point may be overwritten when the script is next run.\n- */\n-static void ERR_load_ATALLA_strings(void);\n-static void ERR_unload_ATALLA_strings(void);\n-static void ERR_ATALLA_error(int function, int reason, char *file, int line);\n-# define ATALLAerr(f,r) ERR_ATALLA_error((f),(r),__FILE__,__LINE__)\n-\n-/* Error codes for the ATALLA functions. */\n-\n-/* Function codes. */\n-# define ATALLA_F_ATALLA_CTRL 100\n-# define ATALLA_F_ATALLA_FINISH 101\n-# define ATALLA_F_ATALLA_INIT 102\n-# define ATALLA_F_ATALLA_MOD_EXP 103\n-# define ATALLA_F_ATALLA_RSA_MOD_EXP 104\n-\n-/* Reason codes. */\n-# define ATALLA_R_ALREADY_LOADED 100\n-# define ATALLA_R_BN_CTX_FULL 101\n-# define ATALLA_R_BN_EXPAND_FAIL 102\n-# define ATALLA_R_CTRL_COMMAND_NOT_IMPLEMENTED 103\n-# define ATALLA_R_MISSING_KEY_COMPONENTS 104\n-# define ATALLA_R_NOT_LOADED 105\n-# define ATALLA_R_REQUEST_FAILED 106\n-# define ATALLA_R_UNIT_FAILURE 107\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-#endif\ndiff --git a/engines/e_cswift.c b/engines/e_cswift.c\ndeleted file mode 100644\nindex 5553794..0000000\n--- a/engines/e_cswift.c\n+++ /dev/null\n@@ -1,1081 +0,0 @@\n-/* crypto/engine/hw_cswift.c */\n-/*\n- * Written by Geoff Thorpe (geoff@geoffthorpe.net) for the OpenSSL project\n- * 2000.\n- */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * licensing@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003cstring.h\u003e\n-#include \u003copenssl/crypto.h\u003e\n-#include \u003copenssl/buffer.h\u003e\n-#include \u003copenssl/dso.h\u003e\n-#include \u003copenssl/engine.h\u003e\n-#ifndef OPENSSL_NO_RSA\n-# include \u003copenssl/rsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DSA\n-# include \u003copenssl/dsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DH\n-# include \u003copenssl/dh.h\u003e\n-#endif\n-#include \u003copenssl/rand.h\u003e\n-#include \u003copenssl/bn.h\u003e\n-\n-#ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_CSWIFT\n-\n-/*\n- * Attribution notice: Rainbow have generously allowed me to reproduce the\n- * necessary definitions here from their API. This means the support can\n- * build independently of whether application builders have the API or\n- * hardware. This will allow developers to easily produce software that has\n- * latent hardware support for any users that have accelerators installed,\n- * without the developers themselves needing anything extra. I have only\n- * clipped the parts from the CryptoSwift header files that are (or seem)\n- * relevant to the CryptoSwift support code. This is simply to keep the file\n- * sizes reasonable. [Geoff]\n- */\n-# ifdef FLAT_INC\n-# include \u0022cswift.h\u0022\n-# else\n-# include \u0022vendor_defns/cswift.h\u0022\n-# endif\n-\n-# define CSWIFT_LIB_NAME \u0022cswift engine\u0022\n-# include \u0022e_cswift_err.c\u0022\n-\n-# define DECIMAL_SIZE(type) ((sizeof(type)*8+2)/3+1)\n-\n-static int cswift_destroy(ENGINE *e);\n-static int cswift_init(ENGINE *e);\n-static int cswift_finish(ENGINE *e);\n-static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void));\n-# ifndef OPENSSL_NO_RSA\n-static int cswift_bn_32copy(SW_LARGENUMBER *out, const BIGNUM *in);\n-# endif\n-\n-/* BIGNUM stuff */\n-static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx);\n-# ifndef OPENSSL_NO_RSA\n-static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *q, const BIGNUM *dmp1,\n- const BIGNUM *dmq1, const BIGNUM *iqmp,\n- BN_CTX *ctx);\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-/* RSA stuff */\n-static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,\n- BN_CTX *ctx);\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/* DSA stuff */\n-static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen,\n- DSA *dsa);\n-static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len,\n- DSA_SIG *sig, DSA *dsa);\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* DH stuff */\n-/* This function is alised to mod_exp (with the DH and mont dropped). */\n-static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,\n- const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx);\n-# endif\n-\n-/* RAND stuff */\n-static int cswift_rand_bytes(unsigned char *buf, int num);\n-static int cswift_rand_status(void);\n-\n-/* The definitions for control commands specific to this engine */\n-# define CSWIFT_CMD_SO_PATH ENGINE_CMD_BASE\n-static const ENGINE_CMD_DEFN cswift_cmd_defns[] \u003d {\n- {CSWIFT_CMD_SO_PATH,\n- \u0022SO_PATH\u0022,\n- \u0022Specifies the path to the 'cswift' shared library\u0022,\n- ENGINE_CMD_FLAG_STRING},\n- {0, NULL, NULL, 0}\n-};\n-\n-# ifndef OPENSSL_NO_RSA\n-/* Our internal RSA_METHOD that we provide pointers to */\n-static RSA_METHOD cswift_rsa \u003d {\n- \u0022CryptoSwift RSA method\u0022,\n- NULL,\n- NULL,\n- NULL,\n- NULL,\n- cswift_rsa_mod_exp,\n- cswift_mod_exp_mont,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/* Our internal DSA_METHOD that we provide pointers to */\n-static DSA_METHOD cswift_dsa \u003d {\n- \u0022CryptoSwift DSA method\u0022,\n- cswift_dsa_sign,\n- NULL, /* dsa_sign_setup */\n- cswift_dsa_verify,\n- NULL, /* dsa_mod_exp */\n- NULL, /* bn_mod_exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* flags */\n- NULL, /* app_data */\n- NULL, /* dsa_paramgen */\n- NULL /* dsa_keygen */\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* Our internal DH_METHOD that we provide pointers to */\n-static DH_METHOD cswift_dh \u003d {\n- \u0022CryptoSwift DH method\u0022,\n- NULL,\n- NULL,\n- cswift_mod_exp_dh,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-static RAND_METHOD cswift_random \u003d {\n- /* \u0022CryptoSwift RAND method\u0022, */\n- NULL,\n- cswift_rand_bytes,\n- NULL,\n- NULL,\n- cswift_rand_bytes,\n- cswift_rand_status,\n-};\n-\n-/* Constants used when creating the ENGINE */\n-static const char *engine_cswift_id \u003d \u0022cswift\u0022;\n-static const char *engine_cswift_name \u003d \u0022CryptoSwift hardware engine support\u0022;\n-\n-/*\n- * This internal function is used by ENGINE_cswift() and possibly by the\n- * \u0022dynamic\u0022 ENGINE support too\n- */\n-static int bind_helper(ENGINE *e)\n-{\n-# ifndef OPENSSL_NO_RSA\n- const RSA_METHOD *meth1;\n-# endif\n-# ifndef OPENSSL_NO_DH\n- const DH_METHOD *meth2;\n-# endif\n- if (!ENGINE_set_id(e, engine_cswift_id) ||\n- !ENGINE_set_name(e, engine_cswift_name) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_RSA(e, \u0026cswift_rsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- !ENGINE_set_DSA(e, \u0026cswift_dsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DH\n- !ENGINE_set_DH(e, \u0026cswift_dh) ||\n-# endif\n- !ENGINE_set_RAND(e, \u0026cswift_random) ||\n- !ENGINE_set_destroy_function(e, cswift_destroy) ||\n- !ENGINE_set_init_function(e, cswift_init) ||\n- !ENGINE_set_finish_function(e, cswift_finish) ||\n- !ENGINE_set_ctrl_function(e, cswift_ctrl) ||\n- !ENGINE_set_cmd_defns(e, cswift_cmd_defns))\n- return 0;\n-\n-# ifndef OPENSSL_NO_RSA\n- /*\n- * We know that the \u0022PKCS1_SSLeay()\u0022 functions hook properly to the\n- * cswift-specific mod_exp and mod_exp_crt so we use those functions. NB:\n- * We don't use ENGINE_openssl() or anything \u0022more generic\u0022 because\n- * something like the RSAref code may not hook properly, and if you own\n- * one of these cards then you have the right to do RSA operations on it\n- * anyway!\n- */\n- meth1 \u003d RSA_PKCS1_SSLeay();\n- cswift_rsa.rsa_pub_enc \u003d meth1-\u003ersa_pub_enc;\n- cswift_rsa.rsa_pub_dec \u003d meth1-\u003ersa_pub_dec;\n- cswift_rsa.rsa_priv_enc \u003d meth1-\u003ersa_priv_enc;\n- cswift_rsa.rsa_priv_dec \u003d meth1-\u003ersa_priv_dec;\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n- /* Much the same for Diffie-Hellman */\n- meth2 \u003d DH_OpenSSL();\n- cswift_dh.generate_key \u003d meth2-\u003egenerate_key;\n- cswift_dh.compute_key \u003d meth2-\u003ecompute_key;\n-# endif\n-\n- /* Ensure the cswift error handling is set up */\n- ERR_load_CSWIFT_strings();\n- return 1;\n-}\n-\n-# ifdef OPENSSL_NO_DYNAMIC_ENGINE\n-static ENGINE *engine_cswift(void)\n-{\n- ENGINE *ret \u003d ENGINE_new();\n- if (!ret)\n- return NULL;\n- if (!bind_helper(ret)) {\n- ENGINE_free(ret);\n- return NULL;\n- }\n- return ret;\n-}\n-\n-void ENGINE_load_cswift(void)\n-{\n- /* Copied from eng_[openssl|dyn].c */\n- ENGINE *toadd \u003d engine_cswift();\n- if (!toadd)\n- return;\n- ENGINE_add(toadd);\n- ENGINE_free(toadd);\n- ERR_clear_error();\n-}\n-# endif\n-\n-/*\n- * This is a process-global DSO handle used for loading and unloading the\n- * CryptoSwift library. NB: This is only set (or unset) during an init() or\n- * finish() call (reference counts permitting) and they're operating with\n- * global locks, so this should be thread-safe implicitly.\n- */\n-static DSO *cswift_dso \u003d NULL;\n-\n-/*\n- * These are the function pointers that are (un)set when the library has\n- * successfully (un)loaded.\n- */\n-t_swAcquireAccContext *p_CSwift_AcquireAccContext \u003d NULL;\n-t_swAttachKeyParam *p_CSwift_AttachKeyParam \u003d NULL;\n-t_swSimpleRequest *p_CSwift_SimpleRequest \u003d NULL;\n-t_swReleaseAccContext *p_CSwift_ReleaseAccContext \u003d NULL;\n-\n-/* Used in the DSO operations. */\n-static const char *CSWIFT_LIBNAME \u003d NULL;\n-static const char *get_CSWIFT_LIBNAME(void)\n-{\n- if (CSWIFT_LIBNAME)\n- return CSWIFT_LIBNAME;\n- return \u0022swift\u0022;\n-}\n-\n-static void free_CSWIFT_LIBNAME(void)\n-{\n- OPENSSL_free(CSWIFT_LIBNAME);\n- CSWIFT_LIBNAME \u003d NULL;\n-}\n-\n-static long set_CSWIFT_LIBNAME(const char *name)\n-{\n- free_CSWIFT_LIBNAME();\n- return (((CSWIFT_LIBNAME \u003d BUF_strdup(name)) !\u003d NULL) ? 1 : 0);\n-}\n-\n-static const char *CSWIFT_F1 \u003d \u0022swAcquireAccContext\u0022;\n-static const char *CSWIFT_F2 \u003d \u0022swAttachKeyParam\u0022;\n-static const char *CSWIFT_F3 \u003d \u0022swSimpleRequest\u0022;\n-static const char *CSWIFT_F4 \u003d \u0022swReleaseAccContext\u0022;\n-\n-/*\n- * CryptoSwift library functions and mechanics - these are used by the\n- * higher-level functions further down. NB: As and where there's no error\n- * checking, take a look lower down where these functions are called, the\n- * checking and error handling is probably down there.\n- */\n-\n-/* utility function to obtain a context */\n-static int get_context(SW_CONTEXT_HANDLE *hac)\n-{\n- SW_STATUS status;\n-\n- status \u003d p_CSwift_AcquireAccContext(hac);\n- if (status !\u003d SW_OK)\n- return 0;\n- return 1;\n-}\n-\n-/* similarly to release one. */\n-static void release_context(SW_CONTEXT_HANDLE hac)\n-{\n- p_CSwift_ReleaseAccContext(hac);\n-}\n-\n-/* Destructor (complements the \u0022ENGINE_cswift()\u0022 constructor) */\n-static int cswift_destroy(ENGINE *e)\n-{\n- free_CSWIFT_LIBNAME();\n- ERR_unload_CSWIFT_strings();\n- return 1;\n-}\n-\n-/* (de)initialisation functions. */\n-static int cswift_init(ENGINE *e)\n-{\n- SW_CONTEXT_HANDLE hac;\n- t_swAcquireAccContext *p1;\n- t_swAttachKeyParam *p2;\n- t_swSimpleRequest *p3;\n- t_swReleaseAccContext *p4;\n-\n- if (cswift_dso !\u003d NULL) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_ALREADY_LOADED);\n- goto err;\n- }\n- /* Attempt to load libswift.so/swift.dll/whatever. */\n- cswift_dso \u003d DSO_load(NULL, get_CSWIFT_LIBNAME(), NULL, 0);\n- if (cswift_dso \u003d\u003d NULL) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_NOT_LOADED);\n- goto err;\n- }\n-\n-#define BINDIT(t, name) (t *)DSO_bind_func(cswift_dso, name)\n- if ((p1 \u003d BINDIT(t_swAcquireAccContext, CSWIFT_F1)) \u003d\u003d NULL\n- || (p2 \u003d BINDIT(t_swAttachKeyParam, CSWIFT_F2)) \u003d\u003d NULL\n- || (p3 \u003d BINDIT(t_swSimpleRequest *) DSO_bind_func(cswift_dso, CSWIFT_F3)) \u003d\u003d NULL\n- || (p4 \u003d BINDIT(t_swReleaseAccContext *) DSO_bind_func(cswift_dso, CSWIFT_F4)) \u003d\u003d NULL) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_NOT_LOADED);\n- goto err;\n- }\n- /* Copy the pointers */\n- p_CSwift_AcquireAccContext \u003d p1;\n- p_CSwift_AttachKeyParam \u003d p2;\n- p_CSwift_SimpleRequest \u003d p3;\n- p_CSwift_ReleaseAccContext \u003d p4;\n- /*\n- * Try and get a context - if not, we may have a DSO but no accelerator!\n- */\n- if (!get_context(\u0026hac)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_INIT, CSWIFT_R_UNIT_FAILURE);\n- goto err;\n- }\n- release_context(hac);\n- /* Everything's fine. */\n- return 1;\n- err:\n- DSO_free(cswift_dso);\n- cswift_dso \u003d NULL;\n- p_CSwift_AcquireAccContext \u003d NULL;\n- p_CSwift_AttachKeyParam \u003d NULL;\n- p_CSwift_SimpleRequest \u003d NULL;\n- p_CSwift_ReleaseAccContext \u003d NULL;\n- return 0;\n-}\n-\n-static int cswift_finish(ENGINE *e)\n-{\n- free_CSWIFT_LIBNAME();\n- if (cswift_dso \u003d\u003d NULL) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_FINISH, CSWIFT_R_NOT_LOADED);\n- return 0;\n- }\n- if (!DSO_free(cswift_dso)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_FINISH, CSWIFT_R_UNIT_FAILURE);\n- return 0;\n- }\n- cswift_dso \u003d NULL;\n- p_CSwift_AcquireAccContext \u003d NULL;\n- p_CSwift_AttachKeyParam \u003d NULL;\n- p_CSwift_SimpleRequest \u003d NULL;\n- p_CSwift_ReleaseAccContext \u003d NULL;\n- return 1;\n-}\n-\n-static int cswift_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))\n-{\n- int initialised \u003d ((cswift_dso \u003d\u003d NULL) ? 0 : 1);\n- switch (cmd) {\n- case CSWIFT_CMD_SO_PATH:\n- if (p \u003d\u003d NULL) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, ERR_R_PASSED_NULL_PARAMETER);\n- return 0;\n- }\n- if (initialised) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_ALREADY_LOADED);\n- return 0;\n- }\n- return set_CSWIFT_LIBNAME((const char *)p);\n- default:\n- break;\n- }\n- CSWIFTerr(CSWIFT_F_CSWIFT_CTRL, CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED);\n- return 0;\n-}\n-\n-/* Un petit mod_exp */\n-static int cswift_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx)\n-{\n- /*\n- * I need somewhere to store temporary serialised values for use with the\n- * CryptoSwift API calls. A neat cheat - I'll use BIGNUMs from the BN_CTX\n- * but access their arrays directly as byte arrays \u003cgrin\u003e. This way I\n- * don't have to clean anything up.\n- */\n- BIGNUM *modulus;\n- BIGNUM *exponent;\n- BIGNUM *argument;\n- BIGNUM *result;\n- SW_STATUS sw_status;\n- SW_LARGENUMBER arg, res;\n- SW_PARAM sw_param;\n- SW_CONTEXT_HANDLE hac;\n- int to_return, acquired;\n-\n- modulus \u003d exponent \u003d argument \u003d result \u003d NULL;\n- to_return \u003d 0; /* expect failure */\n- acquired \u003d 0;\n-\n- if (!get_context(\u0026hac)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_UNIT_FAILURE);\n- goto err;\n- }\n- acquired \u003d 1;\n- /* Prepare the params */\n- BN_CTX_start(ctx);\n- modulus \u003d BN_CTX_get(ctx);\n- exponent \u003d BN_CTX_get(ctx);\n- argument \u003d BN_CTX_get(ctx);\n- result \u003d BN_CTX_get(ctx);\n- if (!result) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_BN_CTX_FULL);\n- goto err;\n- }\n- if (!bn_wexpand(modulus, m-\u003etop) || !bn_wexpand(exponent, p-\u003etop) ||\n- !bn_wexpand(argument, a-\u003etop) || !bn_wexpand(result, m-\u003etop)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- sw_param.type \u003d SW_ALG_EXP;\n- sw_param.up.exp.modulus.nbytes \u003d BN_bn2bin(m,\n- (unsigned char *)modulus-\u003ed);\n- sw_param.up.exp.modulus.value \u003d (unsigned char *)modulus-\u003ed;\n- sw_param.up.exp.exponent.nbytes \u003d BN_bn2bin(p,\n- (unsigned char *)exponent-\u003ed);\n- sw_param.up.exp.exponent.value \u003d (unsigned char *)exponent-\u003ed;\n- /* Attach the key params */\n- sw_status \u003d p_CSwift_AttachKeyParam(hac, \u0026sw_param);\n- switch (sw_status) {\n- case SW_OK:\n- break;\n- case SW_ERR_INPUT_SIZE:\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_BAD_KEY_SIZE);\n- goto err;\n- default:\n- {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- }\n- goto err;\n- }\n- /* Prepare the argument and response */\n- arg.nbytes \u003d BN_bn2bin(a, (unsigned char *)argument-\u003ed);\n- arg.value \u003d (unsigned char *)argument-\u003ed;\n- res.nbytes \u003d BN_num_bytes(m);\n- memset(result-\u003ed, 0, res.nbytes);\n- res.value \u003d (unsigned char *)result-\u003ed;\n- /* Perform the operation */\n- if ((sw_status \u003d p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP, \u0026arg, 1,\n- \u0026res, 1)) !\u003d SW_OK) {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- goto err;\n- }\n- /* Convert the response */\n- BN_bin2bn((unsigned char *)result-\u003ed, res.nbytes, r);\n- to_return \u003d 1;\n- err:\n- if (acquired)\n- release_context(hac);\n- BN_CTX_end(ctx);\n- return to_return;\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-int cswift_bn_32copy(SW_LARGENUMBER *out, const BIGNUM *in)\n-{\n- int mod;\n- int numbytes \u003d BN_num_bytes(in);\n-\n- mod \u003d 0;\n- while (((out-\u003enbytes \u003d (numbytes + mod)) % 32)) {\n- mod++;\n- }\n- out-\u003evalue \u003d OPENSSL_malloc(out-\u003enbytes);\n- if (!out-\u003evalue) {\n- return 0;\n- }\n- BN_bn2bin(in, \u0026out-\u003evalue[mod]);\n- if (mod)\n- memset(out-\u003evalue, 0, mod);\n-\n- return 1;\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-/* Un petit mod_exp chinois */\n-static int cswift_mod_exp_crt(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *q, const BIGNUM *dmp1,\n- const BIGNUM *dmq1, const BIGNUM *iqmp,\n- BN_CTX *ctx)\n-{\n- SW_STATUS sw_status;\n- SW_LARGENUMBER arg, res;\n- SW_PARAM sw_param;\n- SW_CONTEXT_HANDLE hac;\n- BIGNUM *result \u003d NULL;\n- BIGNUM *argument \u003d NULL;\n- int to_return \u003d 0; /* expect failure */\n- int acquired \u003d 0;\n-\n- sw_param.up.crt.p.value \u003d NULL;\n- sw_param.up.crt.q.value \u003d NULL;\n- sw_param.up.crt.dmp1.value \u003d NULL;\n- sw_param.up.crt.dmq1.value \u003d NULL;\n- sw_param.up.crt.iqmp.value \u003d NULL;\n-\n- if (!get_context(\u0026hac)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_UNIT_FAILURE);\n- goto err;\n- }\n- acquired \u003d 1;\n-\n- /* Prepare the params */\n- argument \u003d BN_new();\n- result \u003d BN_new();\n- if (!result || !argument) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_CTX_FULL);\n- goto err;\n- }\n-\n- sw_param.type \u003d SW_ALG_CRT;\n- /************************************************************************/\n- /*\n- * 04/02/2003\n- */\n- /*\n- * Modified by Frederic Giudicelli (deny-all.com) to overcome the\n- */\n- /*\n- * limitation of cswift with values not a multiple of 32\n- */\n- /************************************************************************/\n- if (!cswift_bn_32copy(\u0026sw_param.up.crt.p, p)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- if (!cswift_bn_32copy(\u0026sw_param.up.crt.q, q)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- if (!cswift_bn_32copy(\u0026sw_param.up.crt.dmp1, dmp1)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- if (!cswift_bn_32copy(\u0026sw_param.up.crt.dmq1, dmq1)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- if (!cswift_bn_32copy(\u0026sw_param.up.crt.iqmp, iqmp)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- if (!bn_wexpand(argument, a-\u003etop) || !bn_wexpand(result, p-\u003etop + q-\u003etop)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n-\n- /* Attach the key params */\n- sw_status \u003d p_CSwift_AttachKeyParam(hac, \u0026sw_param);\n- switch (sw_status) {\n- case SW_OK:\n- break;\n- case SW_ERR_INPUT_SIZE:\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_BAD_KEY_SIZE);\n- goto err;\n- default:\n- {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- }\n- goto err;\n- }\n- /* Prepare the argument and response */\n- arg.nbytes \u003d BN_bn2bin(a, (unsigned char *)argument-\u003ed);\n- arg.value \u003d (unsigned char *)argument-\u003ed;\n- res.nbytes \u003d 2 * BN_num_bytes(p);\n- memset(result-\u003ed, 0, res.nbytes);\n- res.value \u003d (unsigned char *)result-\u003ed;\n- /* Perform the operation */\n- if ((sw_status \u003d p_CSwift_SimpleRequest(hac, SW_CMD_MODEXP_CRT, \u0026arg, 1,\n- \u0026res, 1)) !\u003d SW_OK) {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_MOD_EXP_CRT, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- goto err;\n- }\n- /* Convert the response */\n- BN_bin2bn((unsigned char *)result-\u003ed, res.nbytes, r);\n- to_return \u003d 1;\n- err:\n- OPENSSL_free(sw_param.up.crt.p.value);\n- OPENSSL_free(sw_param.up.crt.q.value);\n- OPENSSL_free(sw_param.up.crt.dmp1.value);\n- OPENSSL_free(sw_param.up.crt.dmq1.value);\n- OPENSSL_free(sw_param.up.crt.iqmp.value);\n- BN_free(result);\n- BN_free(argument);\n- if (acquired)\n- release_context(hac);\n- return to_return;\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-static int cswift_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,\n- BN_CTX *ctx)\n-{\n- int to_return \u003d 0;\n- const RSA_METHOD *def_rsa_method;\n-\n- if (!rsa-\u003ep || !rsa-\u003eq || !rsa-\u003edmp1 || !rsa-\u003edmq1 || !rsa-\u003eiqmp) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_RSA_MOD_EXP,\n- CSWIFT_R_MISSING_KEY_COMPONENTS);\n- goto err;\n- }\n-\n- /* Try the limits of RSA (2048 bits) */\n- if (BN_num_bytes(rsa-\u003ep) \u003e 128 ||\n- BN_num_bytes(rsa-\u003eq) \u003e 128 ||\n- BN_num_bytes(rsa-\u003edmp1) \u003e 128 ||\n- BN_num_bytes(rsa-\u003edmq1) \u003e 128 || BN_num_bytes(rsa-\u003eiqmp) \u003e 128) {\n-# ifdef RSA_NULL\n- def_rsa_method \u003d RSA_null_method();\n-# else\n- def_rsa_method \u003d RSA_PKCS1_SSLeay();\n-# endif\n- if (def_rsa_method)\n- return def_rsa_method-\u003ersa_mod_exp(r0, I, rsa, ctx);\n- }\n-\n- to_return \u003d cswift_mod_exp_crt(r0, I, rsa-\u003ep, rsa-\u003eq, rsa-\u003edmp1,\n- rsa-\u003edmq1, rsa-\u003eiqmp, ctx);\n- err:\n- return to_return;\n-}\n-\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-static int cswift_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- const RSA_METHOD *def_rsa_method;\n-\n- /* Try the limits of RSA (2048 bits) */\n- if (BN_num_bytes(r) \u003e 256 ||\n- BN_num_bytes(a) \u003e 256 || BN_num_bytes(m) \u003e 256) {\n-# ifdef RSA_NULL\n- def_rsa_method \u003d RSA_null_method();\n-# else\n- def_rsa_method \u003d RSA_PKCS1_SSLeay();\n-# endif\n- if (def_rsa_method)\n- return def_rsa_method-\u003ebn_mod_exp(r, a, p, m, ctx, m_ctx);\n- }\n-\n- return cswift_mod_exp(r, a, p, m, ctx);\n-}\n-# endif /* OPENSSL_NO_RSA */\n-\n-# ifndef OPENSSL_NO_DSA\n-static DSA_SIG *cswift_dsa_sign(const unsigned char *dgst, int dlen, DSA *dsa)\n-{\n- SW_CONTEXT_HANDLE hac;\n- SW_PARAM sw_param;\n- SW_STATUS sw_status;\n- SW_LARGENUMBER arg, res;\n- BN_CTX *ctx;\n- BIGNUM *dsa_p \u003d NULL;\n- BIGNUM *dsa_q \u003d NULL;\n- BIGNUM *dsa_g \u003d NULL;\n- BIGNUM *dsa_key \u003d NULL;\n- BIGNUM *result \u003d NULL;\n- DSA_SIG *to_return \u003d NULL;\n- int acquired \u003d 0;\n-\n- if ((ctx \u003d BN_CTX_new()) \u003d\u003d NULL)\n- goto err;\n- if (!get_context(\u0026hac)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_UNIT_FAILURE);\n- goto err;\n- }\n- acquired \u003d 1;\n- /* Prepare the params */\n- BN_CTX_start(ctx);\n- dsa_p \u003d BN_CTX_get(ctx);\n- dsa_q \u003d BN_CTX_get(ctx);\n- dsa_g \u003d BN_CTX_get(ctx);\n- dsa_key \u003d BN_CTX_get(ctx);\n- result \u003d BN_CTX_get(ctx);\n- if (!result) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_BN_CTX_FULL);\n- goto err;\n- }\n- if (!bn_wexpand(dsa_p, dsa-\u003ep-\u003etop) ||\n- !bn_wexpand(dsa_q, dsa-\u003eq-\u003etop) ||\n- !bn_wexpand(dsa_g, dsa-\u003eg-\u003etop) ||\n- !bn_wexpand(dsa_key, dsa-\u003epriv_key-\u003etop) ||\n- !bn_wexpand(result, dsa-\u003ep-\u003etop)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- sw_param.type \u003d SW_ALG_DSA;\n- sw_param.up.dsa.p.nbytes \u003d BN_bn2bin(dsa-\u003ep, (unsigned char *)dsa_p-\u003ed);\n- sw_param.up.dsa.p.value \u003d (unsigned char *)dsa_p-\u003ed;\n- sw_param.up.dsa.q.nbytes \u003d BN_bn2bin(dsa-\u003eq, (unsigned char *)dsa_q-\u003ed);\n- sw_param.up.dsa.q.value \u003d (unsigned char *)dsa_q-\u003ed;\n- sw_param.up.dsa.g.nbytes \u003d BN_bn2bin(dsa-\u003eg, (unsigned char *)dsa_g-\u003ed);\n- sw_param.up.dsa.g.value \u003d (unsigned char *)dsa_g-\u003ed;\n- sw_param.up.dsa.key.nbytes \u003d BN_bn2bin(dsa-\u003epriv_key,\n- (unsigned char *)dsa_key-\u003ed);\n- sw_param.up.dsa.key.value \u003d (unsigned char *)dsa_key-\u003ed;\n- /* Attach the key params */\n- sw_status \u003d p_CSwift_AttachKeyParam(hac, \u0026sw_param);\n- switch (sw_status) {\n- case SW_OK:\n- break;\n- case SW_ERR_INPUT_SIZE:\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_BAD_KEY_SIZE);\n- goto err;\n- default:\n- {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- }\n- goto err;\n- }\n- /* Prepare the argument and response */\n- arg.nbytes \u003d dlen;\n- arg.value \u003d (unsigned char *)dgst;\n- res.nbytes \u003d BN_num_bytes(dsa-\u003ep);\n- memset(result-\u003ed, 0, res.nbytes);\n- res.value \u003d (unsigned char *)result-\u003ed;\n- /* Perform the operation */\n- sw_status \u003d p_CSwift_SimpleRequest(hac, SW_CMD_DSS_SIGN, \u0026arg, 1,\n- \u0026res, 1);\n- if (sw_status !\u003d SW_OK) {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_SIGN, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- goto err;\n- }\n- /* Convert the response */\n- if ((to_return \u003d DSA_SIG_new()) \u003d\u003d NULL)\n- goto err;\n- to_return-\u003er \u003d BN_bin2bn((unsigned char *)result-\u003ed, 20, NULL);\n- to_return-\u003es \u003d BN_bin2bn((unsigned char *)result-\u003ed + 20, 20, NULL);\n-\n- err:\n- if (acquired)\n- release_context(hac);\n- if (ctx)\n- BN_CTX_end(ctx);\n- BN_CTX_free(ctx);\n- return to_return;\n-}\n-\n-static int cswift_dsa_verify(const unsigned char *dgst, int dgst_len,\n- DSA_SIG *sig, DSA *dsa)\n-{\n- SW_CONTEXT_HANDLE hac;\n- SW_PARAM sw_param;\n- SW_STATUS sw_status;\n- SW_LARGENUMBER arg[2], res;\n- unsigned long sig_result;\n- BN_CTX *ctx;\n- BIGNUM *dsa_p \u003d NULL;\n- BIGNUM *dsa_q \u003d NULL;\n- BIGNUM *dsa_g \u003d NULL;\n- BIGNUM *dsa_key \u003d NULL;\n- BIGNUM *argument \u003d NULL;\n- int to_return \u003d -1;\n- int acquired \u003d 0;\n-\n- if ((ctx \u003d BN_CTX_new()) \u003d\u003d NULL)\n- goto err;\n- if (!get_context(\u0026hac)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_UNIT_FAILURE);\n- goto err;\n- }\n- acquired \u003d 1;\n- /* Prepare the params */\n- BN_CTX_start(ctx);\n- dsa_p \u003d BN_CTX_get(ctx);\n- dsa_q \u003d BN_CTX_get(ctx);\n- dsa_g \u003d BN_CTX_get(ctx);\n- dsa_key \u003d BN_CTX_get(ctx);\n- argument \u003d BN_CTX_get(ctx);\n- if (!argument) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_BN_CTX_FULL);\n- goto err;\n- }\n- if (!bn_wexpand(dsa_p, dsa-\u003ep-\u003etop) ||\n- !bn_wexpand(dsa_q, dsa-\u003eq-\u003etop) ||\n- !bn_wexpand(dsa_g, dsa-\u003eg-\u003etop) ||\n- !bn_wexpand(dsa_key, dsa-\u003epub_key-\u003etop) ||\n- !bn_wexpand(argument, 40)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_BN_EXPAND_FAIL);\n- goto err;\n- }\n- sw_param.type \u003d SW_ALG_DSA;\n- sw_param.up.dsa.p.nbytes \u003d BN_bn2bin(dsa-\u003ep, (unsigned char *)dsa_p-\u003ed);\n- sw_param.up.dsa.p.value \u003d (unsigned char *)dsa_p-\u003ed;\n- sw_param.up.dsa.q.nbytes \u003d BN_bn2bin(dsa-\u003eq, (unsigned char *)dsa_q-\u003ed);\n- sw_param.up.dsa.q.value \u003d (unsigned char *)dsa_q-\u003ed;\n- sw_param.up.dsa.g.nbytes \u003d BN_bn2bin(dsa-\u003eg, (unsigned char *)dsa_g-\u003ed);\n- sw_param.up.dsa.g.value \u003d (unsigned char *)dsa_g-\u003ed;\n- sw_param.up.dsa.key.nbytes \u003d BN_bn2bin(dsa-\u003epub_key,\n- (unsigned char *)dsa_key-\u003ed);\n- sw_param.up.dsa.key.value \u003d (unsigned char *)dsa_key-\u003ed;\n- /* Attach the key params */\n- sw_status \u003d p_CSwift_AttachKeyParam(hac, \u0026sw_param);\n- switch (sw_status) {\n- case SW_OK:\n- break;\n- case SW_ERR_INPUT_SIZE:\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_BAD_KEY_SIZE);\n- goto err;\n- default:\n- {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- }\n- goto err;\n- }\n- /* Prepare the argument and response */\n- arg[0].nbytes \u003d dgst_len;\n- arg[0].value \u003d (unsigned char *)dgst;\n- arg[1].nbytes \u003d 40;\n- arg[1].value \u003d (unsigned char *)argument-\u003ed;\n- memset(arg[1].value, 0, 40);\n- BN_bn2bin(sig-\u003er, arg[1].value + 20 - BN_num_bytes(sig-\u003er));\n- BN_bn2bin(sig-\u003es, arg[1].value + 40 - BN_num_bytes(sig-\u003es));\n- res.nbytes \u003d 4; /* unsigned long */\n- res.value \u003d (unsigned char *)(\u0026sig_result);\n- /* Perform the operation */\n- sw_status \u003d p_CSwift_SimpleRequest(hac, SW_CMD_DSS_VERIFY, arg, 2,\n- \u0026res, 1);\n- if (sw_status !\u003d SW_OK) {\n- char tmpbuf[DECIMAL_SIZE(sw_status) + 1];\n- CSWIFTerr(CSWIFT_F_CSWIFT_DSA_VERIFY, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, sw_status);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- goto err;\n- }\n- /* Convert the response */\n- to_return \u003d ((sig_result \u003d\u003d 0) ? 0 : 1);\n-\n- err:\n- if (acquired)\n- release_context(hac);\n- if (ctx)\n- BN_CTX_end(ctx);\n- BN_CTX_free(ctx);\n- return to_return;\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* This function is aliased to mod_exp (with the dh and mont dropped). */\n-static int cswift_mod_exp_dh(const DH *dh, BIGNUM *r,\n- const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)\n-{\n- return cswift_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-/* Random bytes are good */\n-static int cswift_rand_bytes(unsigned char *buf, int num)\n-{\n- SW_CONTEXT_HANDLE hac;\n- SW_STATUS swrc;\n- SW_LARGENUMBER largenum;\n- int acquired \u003d 0;\n- int to_return \u003d 0; /* assume failure */\n- unsigned char buf32[1024];\n-\n- if (!get_context(\u0026hac)) {\n- CSWIFTerr(CSWIFT_F_CSWIFT_RAND_BYTES, CSWIFT_R_UNIT_FAILURE);\n- goto err;\n- }\n- acquired \u003d 1;\n-\n- /************************************************************************/\n- /*\n- * 04/02/2003\n- */\n- /*\n- * Modified by Frederic Giudicelli (deny-all.com) to overcome the\n- */\n- /*\n- * limitation of cswift with values not a multiple of 32\n- */\n- /************************************************************************/\n-\n- while (num \u003e\u003d (int)sizeof(buf32)) {\n- largenum.value \u003d buf;\n- largenum.nbytes \u003d sizeof(buf32);\n- /*-\n- * tell CryptoSwift how many bytes we want and where we want it.\n- * Note: - CryptoSwift cannot do more than 4096 bytes at a time.\n- * - CryptoSwift can only do multiple of 32-bits.\n- */\n- swrc \u003d\n- p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, \u0026largenum, 1);\n- if (swrc !\u003d SW_OK) {\n- char tmpbuf[20];\n- CSWIFTerr(CSWIFT_F_CSWIFT_RAND_BYTES, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, swrc);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- goto err;\n- }\n- buf +\u003d sizeof(buf32);\n- num -\u003d sizeof(buf32);\n- }\n- if (num) {\n- largenum.nbytes \u003d sizeof(buf32);\n- largenum.value \u003d buf32;\n- swrc \u003d\n- p_CSwift_SimpleRequest(hac, SW_CMD_RAND, NULL, 0, \u0026largenum, 1);\n- if (swrc !\u003d SW_OK) {\n- char tmpbuf[20];\n- CSWIFTerr(CSWIFT_F_CSWIFT_RAND_BYTES, CSWIFT_R_REQUEST_FAILED);\n- sprintf(tmpbuf, \u0022%ld\u0022, swrc);\n- ERR_add_error_data(2, \u0022CryptoSwift error number is \u0022, tmpbuf);\n- goto err;\n- }\n- memcpy(buf, largenum.value, num);\n- }\n-\n- to_return \u003d 1; /* success */\n- err:\n- if (acquired)\n- release_context(hac);\n-\n- return to_return;\n-}\n-\n-static int cswift_rand_status(void)\n-{\n- return 1;\n-}\n-\n-/*\n- * This stuff is needed if this ENGINE is being compiled into a\n- * self-contained shared-library.\n- */\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-static int bind_fn(ENGINE *e, const char *id)\n-{\n- if (id \u0026\u0026 (strcmp(id, engine_cswift_id) !\u003d 0))\n- return 0;\n- if (!bind_helper(e))\n- return 0;\n- return 1;\n-}\n-\n-IMPLEMENT_DYNAMIC_CHECK_FN()\n- IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)\n-# endif /* OPENSSL_NO_DYNAMIC_ENGINE */\n-# endif /* !OPENSSL_NO_HW_CSWIFT */\n-#endif /* !OPENSSL_NO_HW */\ndiff --git a/engines/e_cswift.ec b/engines/e_cswift.ec\ndeleted file mode 100644\nindex a7f9d11..0000000\n--- a/engines/e_cswift.ec\n+++ /dev/null\n@@ -1 +0,0 @@\n-L CSWIFT\te_cswift_err.h\t\t\te_cswift_err.c\ndiff --git a/engines/e_cswift_err.c b/engines/e_cswift_err.c\ndeleted file mode 100644\nindex f8a2cbb..0000000\n--- a/engines/e_cswift_err.c\n+++ /dev/null\n@@ -1,150 +0,0 @@\n-/* e_cswift_err.c */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-/*\n- * NOTE: this file was auto generated by the mkerr.pl script: any changes\n- * made to it will be overwritten when the script next updates this file,\n- * only reason strings will be preserved.\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/err.h\u003e\n-#include \u0022e_cswift_err.h\u0022\n-\n-/* BEGIN ERROR CODES */\n-#ifndef OPENSSL_NO_ERR\n-\n-# define ERR_FUNC(func) ERR_PACK(0,func,0)\n-# define ERR_REASON(reason) ERR_PACK(0,0,reason)\n-\n-static ERR_STRING_DATA CSWIFT_str_functs[] \u003d {\n- {ERR_FUNC(CSWIFT_F_CSWIFT_CTRL), \u0022CSWIFT_CTRL\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_DSA_SIGN), \u0022CSWIFT_DSA_SIGN\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_DSA_VERIFY), \u0022CSWIFT_DSA_VERIFY\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_FINISH), \u0022CSWIFT_FINISH\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_INIT), \u0022CSWIFT_INIT\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_MOD_EXP), \u0022CSWIFT_MOD_EXP\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_MOD_EXP_CRT), \u0022CSWIFT_MOD_EXP_CRT\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_RAND_BYTES), \u0022CSWIFT_RAND_BYTES\u0022},\n- {ERR_FUNC(CSWIFT_F_CSWIFT_RSA_MOD_EXP), \u0022CSWIFT_RSA_MOD_EXP\u0022},\n- {0, NULL}\n-};\n-\n-static ERR_STRING_DATA CSWIFT_str_reasons[] \u003d {\n- {ERR_REASON(CSWIFT_R_ALREADY_LOADED), \u0022already loaded\u0022},\n- {ERR_REASON(CSWIFT_R_BAD_KEY_SIZE), \u0022bad key size\u0022},\n- {ERR_REASON(CSWIFT_R_BN_CTX_FULL), \u0022bn ctx full\u0022},\n- {ERR_REASON(CSWIFT_R_BN_EXPAND_FAIL), \u0022bn expand fail\u0022},\n- {ERR_REASON(CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED),\n- \u0022ctrl command not implemented\u0022},\n- {ERR_REASON(CSWIFT_R_MISSING_KEY_COMPONENTS), \u0022missing key components\u0022},\n- {ERR_REASON(CSWIFT_R_NOT_LOADED), \u0022not loaded\u0022},\n- {ERR_REASON(CSWIFT_R_REQUEST_FAILED), \u0022request failed\u0022},\n- {ERR_REASON(CSWIFT_R_UNIT_FAILURE), \u0022unit failure\u0022},\n- {0, NULL}\n-};\n-\n-#endif\n-\n-#ifdef CSWIFT_LIB_NAME\n-static ERR_STRING_DATA CSWIFT_lib_name[] \u003d {\n- {0, CSWIFT_LIB_NAME},\n- {0, NULL}\n-};\n-#endif\n-\n-static int CSWIFT_lib_error_code \u003d 0;\n-static int CSWIFT_error_init \u003d 1;\n-\n-static void ERR_load_CSWIFT_strings(void)\n-{\n- if (CSWIFT_lib_error_code \u003d\u003d 0)\n- CSWIFT_lib_error_code \u003d ERR_get_next_error_library();\n-\n- if (CSWIFT_error_init) {\n- CSWIFT_error_init \u003d 0;\n-#ifndef OPENSSL_NO_ERR\n- ERR_load_strings(CSWIFT_lib_error_code, CSWIFT_str_functs);\n- ERR_load_strings(CSWIFT_lib_error_code, CSWIFT_str_reasons);\n-#endif\n-\n-#ifdef CSWIFT_LIB_NAME\n- CSWIFT_lib_name-\u003eerror \u003d ERR_PACK(CSWIFT_lib_error_code, 0, 0);\n- ERR_load_strings(0, CSWIFT_lib_name);\n-#endif\n- }\n-}\n-\n-static void ERR_unload_CSWIFT_strings(void)\n-{\n- if (CSWIFT_error_init \u003d\u003d 0) {\n-#ifndef OPENSSL_NO_ERR\n- ERR_unload_strings(CSWIFT_lib_error_code, CSWIFT_str_functs);\n- ERR_unload_strings(CSWIFT_lib_error_code, CSWIFT_str_reasons);\n-#endif\n-\n-#ifdef CSWIFT_LIB_NAME\n- ERR_unload_strings(0, CSWIFT_lib_name);\n-#endif\n- CSWIFT_error_init \u003d 1;\n- }\n-}\n-\n-static void ERR_CSWIFT_error(int function, int reason, char *file, int line)\n-{\n- if (CSWIFT_lib_error_code \u003d\u003d 0)\n- CSWIFT_lib_error_code \u003d ERR_get_next_error_library();\n- ERR_PUT_error(CSWIFT_lib_error_code, function, reason, file, line);\n-}\ndiff --git a/engines/e_cswift_err.h b/engines/e_cswift_err.h\ndeleted file mode 100644\nindex fde3a82..0000000\n--- a/engines/e_cswift_err.h\n+++ /dev/null\n@@ -1,99 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@openssl.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.openssl.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#ifndef HEADER_CSWIFT_ERR_H\n-# define HEADER_CSWIFT_ERR_H\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif\n-\n-/* BEGIN ERROR CODES */\n-/*\n- * The following lines are auto generated by the script mkerr.pl. Any changes\n- * made after this point may be overwritten when the script is next run.\n- */\n-static void ERR_load_CSWIFT_strings(void);\n-static void ERR_unload_CSWIFT_strings(void);\n-static void ERR_CSWIFT_error(int function, int reason, char *file, int line);\n-# define CSWIFTerr(f,r) ERR_CSWIFT_error((f),(r),__FILE__,__LINE__)\n-\n-/* Error codes for the CSWIFT functions. */\n-\n-/* Function codes. */\n-# define CSWIFT_F_CSWIFT_CTRL 100\n-# define CSWIFT_F_CSWIFT_DSA_SIGN 101\n-# define CSWIFT_F_CSWIFT_DSA_VERIFY 102\n-# define CSWIFT_F_CSWIFT_FINISH 103\n-# define CSWIFT_F_CSWIFT_INIT 104\n-# define CSWIFT_F_CSWIFT_MOD_EXP 105\n-# define CSWIFT_F_CSWIFT_MOD_EXP_CRT 106\n-# define CSWIFT_F_CSWIFT_RAND_BYTES 108\n-# define CSWIFT_F_CSWIFT_RSA_MOD_EXP 107\n-\n-/* Reason codes. */\n-# define CSWIFT_R_ALREADY_LOADED 100\n-# define CSWIFT_R_BAD_KEY_SIZE 101\n-# define CSWIFT_R_BN_CTX_FULL 102\n-# define CSWIFT_R_BN_EXPAND_FAIL 103\n-# define CSWIFT_R_CTRL_COMMAND_NOT_IMPLEMENTED 104\n-# define CSWIFT_R_MISSING_KEY_COMPONENTS 105\n-# define CSWIFT_R_NOT_LOADED 106\n-# define CSWIFT_R_REQUEST_FAILED 107\n-# define CSWIFT_R_UNIT_FAILURE 108\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-#endif\ndiff --git a/engines/e_nuron.c b/engines/e_nuron.c\ndeleted file mode 100644\nindex 01229b0..0000000\n--- a/engines/e_nuron.c\n+++ /dev/null\n@@ -1,435 +0,0 @@\n-/* crypto/engine/hw_nuron.c */\n-/*\n- * Written by Ben Laurie for the OpenSSL Project, leaning heavily on Geoff\n- * Thorpe's Atalla implementation.\n- */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2000-2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * licensing@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003cstring.h\u003e\n-#include \u003copenssl/crypto.h\u003e\n-#include \u003copenssl/buffer.h\u003e\n-#include \u003copenssl/dso.h\u003e\n-#include \u003copenssl/engine.h\u003e\n-#ifndef OPENSSL_NO_RSA\n-# include \u003copenssl/rsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DSA\n-# include \u003copenssl/dsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DH\n-# include \u003copenssl/dh.h\u003e\n-#endif\n-#include \u003copenssl/bn.h\u003e\n-\n-#ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_NURON\n-\n-# define NURON_LIB_NAME \u0022nuron engine\u0022\n-# include \u0022e_nuron_err.c\u0022\n-\n-static const char *NURON_LIBNAME \u003d NULL;\n-static const char *get_NURON_LIBNAME(void)\n-{\n- if (NURON_LIBNAME)\n- return NURON_LIBNAME;\n- return \u0022nuronssl\u0022;\n-}\n-\n-static void free_NURON_LIBNAME(void)\n-{\n- OPENSSL_free(NURON_LIBNAME);\n- NURON_LIBNAME \u003d NULL;\n-}\n-\n-static long set_NURON_LIBNAME(const char *name)\n-{\n- free_NURON_LIBNAME();\n- return (((NURON_LIBNAME \u003d BUF_strdup(name)) !\u003d NULL) ? 1 : 0);\n-}\n-\n-static const char *NURON_F1 \u003d \u0022nuron_mod_exp\u0022;\n-\n-/* The definitions for control commands specific to this engine */\n-# define NURON_CMD_SO_PATH ENGINE_CMD_BASE\n-static const ENGINE_CMD_DEFN nuron_cmd_defns[] \u003d {\n- {NURON_CMD_SO_PATH,\n- \u0022SO_PATH\u0022,\n- \u0022Specifies the path to the 'nuronssl' shared library\u0022,\n- ENGINE_CMD_FLAG_STRING},\n- {0, NULL, NULL, 0}\n-};\n-\n-typedef int tfnModExp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m);\n-static tfnModExp *pfnModExp \u003d NULL;\n-\n-static DSO *pvDSOHandle \u003d NULL;\n-\n-static int nuron_destroy(ENGINE *e)\n-{\n- free_NURON_LIBNAME();\n- ERR_unload_NURON_strings();\n- return 1;\n-}\n-\n-static int nuron_init(ENGINE *e)\n-{\n- if (pvDSOHandle !\u003d NULL) {\n- NURONerr(NURON_F_NURON_INIT, NURON_R_ALREADY_LOADED);\n- return 0;\n- }\n-\n- pvDSOHandle \u003d DSO_load(NULL, get_NURON_LIBNAME(), NULL,\n- DSO_FLAG_NAME_TRANSLATION_EXT_ONLY);\n- if (!pvDSOHandle) {\n- NURONerr(NURON_F_NURON_INIT, NURON_R_DSO_NOT_FOUND);\n- return 0;\n- }\n-\n- pfnModExp \u003d (tfnModExp *) DSO_bind_func(pvDSOHandle, NURON_F1);\n- if (!pfnModExp) {\n- NURONerr(NURON_F_NURON_INIT, NURON_R_DSO_FUNCTION_NOT_FOUND);\n- return 0;\n- }\n-\n- return 1;\n-}\n-\n-static int nuron_finish(ENGINE *e)\n-{\n- free_NURON_LIBNAME();\n- if (pvDSOHandle \u003d\u003d NULL) {\n- NURONerr(NURON_F_NURON_FINISH, NURON_R_NOT_LOADED);\n- return 0;\n- }\n- if (!DSO_free(pvDSOHandle)) {\n- NURONerr(NURON_F_NURON_FINISH, NURON_R_DSO_FAILURE);\n- return 0;\n- }\n- pvDSOHandle \u003d NULL;\n- pfnModExp \u003d NULL;\n- return 1;\n-}\n-\n-static int nuron_ctrl(ENGINE *e, int cmd, long i, void *p, void (*f) (void))\n-{\n- int initialised \u003d ((pvDSOHandle \u003d\u003d NULL) ? 0 : 1);\n- switch (cmd) {\n- case NURON_CMD_SO_PATH:\n- if (p \u003d\u003d NULL) {\n- NURONerr(NURON_F_NURON_CTRL, ERR_R_PASSED_NULL_PARAMETER);\n- return 0;\n- }\n- if (initialised) {\n- NURONerr(NURON_F_NURON_CTRL, NURON_R_ALREADY_LOADED);\n- return 0;\n- }\n- return set_NURON_LIBNAME((const char *)p);\n- default:\n- break;\n- }\n- NURONerr(NURON_F_NURON_CTRL, NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED);\n- return 0;\n-}\n-\n-static int nuron_mod_exp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx)\n-{\n- if (!pvDSOHandle) {\n- NURONerr(NURON_F_NURON_MOD_EXP, NURON_R_NOT_LOADED);\n- return 0;\n- }\n- return pfnModExp(r, a, p, m);\n-}\n-\n-# ifndef OPENSSL_NO_RSA\n-static int nuron_rsa_mod_exp(BIGNUM *r0, const BIGNUM *I, RSA *rsa,\n- BN_CTX *ctx)\n-{\n- return nuron_mod_exp(r0, I, rsa-\u003ed, rsa-\u003en, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/*\n- * This code was liberated and adapted from the commented-out code in\n- * dsa_ossl.c. Because of the unoptimised form of the Atalla acceleration (it\n- * doesn't have a CRT form for RSA), this function means that an Atalla\n- * system running with a DSA server certificate can handshake around 5 or 6\n- * times faster/more than an equivalent system running with RSA. Just check\n- * out the \u0022signs\u0022 statistics from the RSA and DSA parts of \u0022openssl speed\n- * -engine atalla dsa1024 rsa1024\u0022.\n- */\n-static int nuron_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2, BIGNUM *m,\n- BN_CTX *ctx, BN_MONT_CTX *in_mont)\n-{\n- BIGNUM t;\n- int to_return \u003d 0;\n-\n- BN_init(\u0026t);\n- /* let rr \u003d a1 ^ p1 mod m */\n- if (!nuron_mod_exp(rr, a1, p1, m, ctx))\n- goto end;\n- /* let t \u003d a2 ^ p2 mod m */\n- if (!nuron_mod_exp(\u0026t, a2, p2, m, ctx))\n- goto end;\n- /* let rr \u003d rr * t mod m */\n- if (!BN_mod_mul(rr, rr, \u0026t, m, ctx))\n- goto end;\n- to_return \u003d 1;\n- end:\n- BN_free(\u0026t);\n- return to_return;\n-}\n-\n-static int nuron_mod_exp_dsa(DSA *dsa, BIGNUM *r, BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return nuron_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-# ifndef OPENSSL_NO_RSA\n-static int nuron_mod_exp_mont(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return nuron_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* This function is aliased to mod_exp (with the dh and mont dropped). */\n-static int nuron_mod_exp_dh(const DH *dh, BIGNUM *r,\n- const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx, BN_MONT_CTX *m_ctx)\n-{\n- return nuron_mod_exp(r, a, p, m, ctx);\n-}\n-# endif\n-\n-# ifndef OPENSSL_NO_RSA\n-static RSA_METHOD nuron_rsa \u003d {\n- \u0022Nuron RSA method\u0022,\n- NULL,\n- NULL,\n- NULL,\n- NULL,\n- nuron_rsa_mod_exp,\n- nuron_mod_exp_mont,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-static DSA_METHOD nuron_dsa \u003d {\n- \u0022Nuron DSA method\u0022,\n- NULL, /* dsa_do_sign */\n- NULL, /* dsa_sign_setup */\n- NULL, /* dsa_do_verify */\n- nuron_dsa_mod_exp, /* dsa_mod_exp */\n- nuron_mod_exp_dsa, /* bn_mod_exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* flags */\n- NULL, /* app_data */\n- NULL, /* dsa_paramgen */\n- NULL /* dsa_keygen */\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-static DH_METHOD nuron_dh \u003d {\n- \u0022Nuron DH method\u0022,\n- NULL,\n- NULL,\n- nuron_mod_exp_dh,\n- NULL,\n- NULL,\n- 0,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-/* Constants used when creating the ENGINE */\n-static const char *engine_nuron_id \u003d \u0022nuron\u0022;\n-static const char *engine_nuron_name \u003d \u0022Nuron hardware engine support\u0022;\n-\n-/*\n- * This internal function is used by ENGINE_nuron() and possibly by the\n- * \u0022dynamic\u0022 ENGINE support too\n- */\n-static int bind_helper(ENGINE *e)\n-{\n-# ifndef OPENSSL_NO_RSA\n- const RSA_METHOD *meth1;\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- const DSA_METHOD *meth2;\n-# endif\n-# ifndef OPENSSL_NO_DH\n- const DH_METHOD *meth3;\n-# endif\n- if (!ENGINE_set_id(e, engine_nuron_id) ||\n- !ENGINE_set_name(e, engine_nuron_name) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_RSA(e, \u0026nuron_rsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- !ENGINE_set_DSA(e, \u0026nuron_dsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DH\n- !ENGINE_set_DH(e, \u0026nuron_dh) ||\n-# endif\n- !ENGINE_set_destroy_function(e, nuron_destroy) ||\n- !ENGINE_set_init_function(e, nuron_init) ||\n- !ENGINE_set_finish_function(e, nuron_finish) ||\n- !ENGINE_set_ctrl_function(e, nuron_ctrl) ||\n- !ENGINE_set_cmd_defns(e, nuron_cmd_defns))\n- return 0;\n-\n-# ifndef OPENSSL_NO_RSA\n- /*\n- * We know that the \u0022PKCS1_SSLeay()\u0022 functions hook properly to the\n- * nuron-specific mod_exp and mod_exp_crt so we use those functions. NB:\n- * We don't use ENGINE_openssl() or anything \u0022more generic\u0022 because\n- * something like the RSAref code may not hook properly, and if you own\n- * one of these cards then you have the right to do RSA operations on it\n- * anyway!\n- */\n- meth1 \u003d RSA_PKCS1_SSLeay();\n- nuron_rsa.rsa_pub_enc \u003d meth1-\u003ersa_pub_enc;\n- nuron_rsa.rsa_pub_dec \u003d meth1-\u003ersa_pub_dec;\n- nuron_rsa.rsa_priv_enc \u003d meth1-\u003ersa_priv_enc;\n- nuron_rsa.rsa_priv_dec \u003d meth1-\u003ersa_priv_dec;\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n- /*\n- * Use the DSA_OpenSSL() method and just hook the mod_exp-ish bits.\n- */\n- meth2 \u003d DSA_OpenSSL();\n- nuron_dsa.dsa_do_sign \u003d meth2-\u003edsa_do_sign;\n- nuron_dsa.dsa_sign_setup \u003d meth2-\u003edsa_sign_setup;\n- nuron_dsa.dsa_do_verify \u003d meth2-\u003edsa_do_verify;\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n- /* Much the same for Diffie-Hellman */\n- meth3 \u003d DH_OpenSSL();\n- nuron_dh.generate_key \u003d meth3-\u003egenerate_key;\n- nuron_dh.compute_key \u003d meth3-\u003ecompute_key;\n-# endif\n-\n- /* Ensure the nuron error handling is set up */\n- ERR_load_NURON_strings();\n- return 1;\n-}\n-\n-# ifdef OPENSSL_NO_DYNAMIC_ENGINE\n-static ENGINE *engine_nuron(void)\n-{\n- ENGINE *ret \u003d ENGINE_new();\n- if (!ret)\n- return NULL;\n- if (!bind_helper(ret)) {\n- ENGINE_free(ret);\n- return NULL;\n- }\n- return ret;\n-}\n-\n-void ENGINE_load_nuron(void)\n-{\n- /* Copied from eng_[openssl|dyn].c */\n- ENGINE *toadd \u003d engine_nuron();\n- if (!toadd)\n- return;\n- ENGINE_add(toadd);\n- ENGINE_free(toadd);\n- ERR_clear_error();\n-}\n-# endif\n-\n-/*\n- * This stuff is needed if this ENGINE is being compiled into a\n- * self-contained shared-library.\n- */\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-static int bind_fn(ENGINE *e, const char *id)\n-{\n- if (id \u0026\u0026 (strcmp(id, engine_nuron_id) !\u003d 0))\n- return 0;\n- if (!bind_helper(e))\n- return 0;\n- return 1;\n-}\n-\n-IMPLEMENT_DYNAMIC_CHECK_FN()\n- IMPLEMENT_DYNAMIC_BIND_FN(bind_fn)\n-# endif /* OPENSSL_NO_DYNAMIC_ENGINE */\n-# endif /* !OPENSSL_NO_HW_NURON */\n-#endif /* !OPENSSL_NO_HW */\ndiff --git a/engines/e_nuron.ec b/engines/e_nuron.ec\ndeleted file mode 100644\nindex cfa430d..0000000\n--- a/engines/e_nuron.ec\n+++ /dev/null\n@@ -1 +0,0 @@\n-L NURON\t\te_nuron_err.h\t\t\te_nuron_err.c\ndiff --git a/engines/e_nuron_err.c b/engines/e_nuron_err.c\ndeleted file mode 100644\nindex a02c4f0..0000000\n--- a/engines/e_nuron_err.c\n+++ /dev/null\n@@ -1,142 +0,0 @@\n-/* e_nuron_err.c */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-/*\n- * NOTE: this file was auto generated by the mkerr.pl script: any changes\n- * made to it will be overwritten when the script next updates this file,\n- * only reason strings will be preserved.\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/err.h\u003e\n-#include \u0022e_nuron_err.h\u0022\n-\n-/* BEGIN ERROR CODES */\n-#ifndef OPENSSL_NO_ERR\n-\n-# define ERR_FUNC(func) ERR_PACK(0,func,0)\n-# define ERR_REASON(reason) ERR_PACK(0,0,reason)\n-\n-static ERR_STRING_DATA NURON_str_functs[] \u003d {\n- {ERR_FUNC(NURON_F_NURON_CTRL), \u0022NURON_CTRL\u0022},\n- {ERR_FUNC(NURON_F_NURON_FINISH), \u0022NURON_FINISH\u0022},\n- {ERR_FUNC(NURON_F_NURON_INIT), \u0022NURON_INIT\u0022},\n- {ERR_FUNC(NURON_F_NURON_MOD_EXP), \u0022NURON_MOD_EXP\u0022},\n- {0, NULL}\n-};\n-\n-static ERR_STRING_DATA NURON_str_reasons[] \u003d {\n- {ERR_REASON(NURON_R_ALREADY_LOADED), \u0022already loaded\u0022},\n- {ERR_REASON(NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED),\n- \u0022ctrl command not implemented\u0022},\n- {ERR_REASON(NURON_R_DSO_FAILURE), \u0022dso failure\u0022},\n- {ERR_REASON(NURON_R_DSO_FUNCTION_NOT_FOUND), \u0022dso function not found\u0022},\n- {ERR_REASON(NURON_R_DSO_NOT_FOUND), \u0022dso not found\u0022},\n- {ERR_REASON(NURON_R_NOT_LOADED), \u0022not loaded\u0022},\n- {0, NULL}\n-};\n-\n-#endif\n-\n-#ifdef NURON_LIB_NAME\n-static ERR_STRING_DATA NURON_lib_name[] \u003d {\n- {0, NURON_LIB_NAME},\n- {0, NULL}\n-};\n-#endif\n-\n-static int NURON_lib_error_code \u003d 0;\n-static int NURON_error_init \u003d 1;\n-\n-static void ERR_load_NURON_strings(void)\n-{\n- if (NURON_lib_error_code \u003d\u003d 0)\n- NURON_lib_error_code \u003d ERR_get_next_error_library();\n-\n- if (NURON_error_init) {\n- NURON_error_init \u003d 0;\n-#ifndef OPENSSL_NO_ERR\n- ERR_load_strings(NURON_lib_error_code, NURON_str_functs);\n- ERR_load_strings(NURON_lib_error_code, NURON_str_reasons);\n-#endif\n-\n-#ifdef NURON_LIB_NAME\n- NURON_lib_name-\u003eerror \u003d ERR_PACK(NURON_lib_error_code, 0, 0);\n- ERR_load_strings(0, NURON_lib_name);\n-#endif\n- }\n-}\n-\n-static void ERR_unload_NURON_strings(void)\n-{\n- if (NURON_error_init \u003d\u003d 0) {\n-#ifndef OPENSSL_NO_ERR\n- ERR_unload_strings(NURON_lib_error_code, NURON_str_functs);\n- ERR_unload_strings(NURON_lib_error_code, NURON_str_reasons);\n-#endif\n-\n-#ifdef NURON_LIB_NAME\n- ERR_unload_strings(0, NURON_lib_name);\n-#endif\n- NURON_error_init \u003d 1;\n- }\n-}\n-\n-static void ERR_NURON_error(int function, int reason, char *file, int line)\n-{\n- if (NURON_lib_error_code \u003d\u003d 0)\n- NURON_lib_error_code \u003d ERR_get_next_error_library();\n- ERR_PUT_error(NURON_lib_error_code, function, reason, file, line);\n-}\ndiff --git a/engines/e_nuron_err.h b/engines/e_nuron_err.h\ndeleted file mode 100644\nindex aa7849c..0000000\n--- a/engines/e_nuron_err.h\n+++ /dev/null\n@@ -1,91 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@openssl.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.openssl.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#ifndef HEADER_NURON_ERR_H\n-# define HEADER_NURON_ERR_H\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif\n-\n-/* BEGIN ERROR CODES */\n-/*\n- * The following lines are auto generated by the script mkerr.pl. Any changes\n- * made after this point may be overwritten when the script is next run.\n- */\n-static void ERR_load_NURON_strings(void);\n-static void ERR_unload_NURON_strings(void);\n-static void ERR_NURON_error(int function, int reason, char *file, int line);\n-# define NURONerr(f,r) ERR_NURON_error((f),(r),__FILE__,__LINE__)\n-\n-/* Error codes for the NURON functions. */\n-\n-/* Function codes. */\n-# define NURON_F_NURON_CTRL 100\n-# define NURON_F_NURON_FINISH 101\n-# define NURON_F_NURON_INIT 102\n-# define NURON_F_NURON_MOD_EXP 103\n-\n-/* Reason codes. */\n-# define NURON_R_ALREADY_LOADED 100\n-# define NURON_R_CTRL_COMMAND_NOT_IMPLEMENTED 101\n-# define NURON_R_DSO_FAILURE 102\n-# define NURON_R_DSO_FUNCTION_NOT_FOUND 103\n-# define NURON_R_DSO_NOT_FOUND 104\n-# define NURON_R_NOT_LOADED 105\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-#endif\ndiff --git a/engines/e_sureware.c b/engines/e_sureware.c\ndeleted file mode 100644\nindex fb5e55c..0000000\n--- a/engines/e_sureware.c\n+++ /dev/null\n@@ -1,1074 +0,0 @@\n-/*-\n-* Written by Corinne Dive-Reclus(cdive@baltimore.com)\n-*\n-*\n-* Redistribution and use in source and binary forms, with or without\n-* modification, are permitted provided that the following conditions\n-* are met:\n-*\n-* 1. Redistributions of source code must retain the above copyright\n-* notice, this list of conditions and the following disclaimer.\n-*\n-* 2. Redistributions in binary form must reproduce the above copyright\n-* notice, this list of conditions and the following disclaimer in\n-* the documentation and/or other materials provided with the\n-* distribution.\n-*\n-* 3. All advertising materials mentioning features or use of this\n-* software must display the following acknowledgment:\n-* \u0022This product includes software developed by the OpenSSL Project\n-* for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n-*\n-* 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n-* endorse or promote products derived from this software without\n-* prior written permission. For written permission, please contact\n-* licensing@OpenSSL.org.\n-*\n-* 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n-* nor may \u0022OpenSSL\u0022 appear in their names without prior written\n-* permission of the OpenSSL Project.\n-*\n-* 6. Redistributions of any form whatsoever must retain the following\n-* acknowledgment:\n-* \u0022This product includes software developed by the OpenSSL Project\n-* for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n-*\n-* Written by Corinne Dive-Reclus(cdive@baltimore.com)\n-*\n-* Copyright@2001 Baltimore Technologies Ltd.\n-* All right Reserved.\n-* *\n-* THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND *\n-* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE *\n-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *\n-* ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE *\n-* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *\n-* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *\n-* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *\n-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT *\n-* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY *\n-* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF *\n-* SUCH DAMAGE. *\n-\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d*/\n-\n-#include \u003cstdio.h\u003e\n-#include \u003cstring.h\u003e\n-#include \u003copenssl/crypto.h\u003e\n-#include \u003copenssl/pem.h\u003e\n-#include \u003copenssl/dso.h\u003e\n-#include \u003copenssl/engine.h\u003e\n-#include \u003copenssl/rand.h\u003e\n-#ifndef OPENSSL_NO_RSA\n-# include \u003copenssl/rsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DSA\n-# include \u003copenssl/dsa.h\u003e\n-#endif\n-#ifndef OPENSSL_NO_DH\n-# include \u003copenssl/dh.h\u003e\n-#endif\n-#include \u003copenssl/bn.h\u003e\n-\n-#ifndef OPENSSL_NO_HW\n-# ifndef OPENSSL_NO_HW_SUREWARE\n-\n-# ifdef FLAT_INC\n-# include \u0022sureware.h\u0022\n-# else\n-# include \u0022vendor_defns/sureware.h\u0022\n-# endif\n-\n-# define SUREWARE_LIB_NAME \u0022sureware engine\u0022\n-# include \u0022e_sureware_err.c\u0022\n-\n-static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p,\n- void (*f) (void));\n-static int surewarehk_destroy(ENGINE *e);\n-static int surewarehk_init(ENGINE *e);\n-static int surewarehk_finish(ENGINE *e);\n-static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx);\n-\n-/* RSA stuff */\n-# ifndef OPENSSL_NO_RSA\n-static int surewarehk_rsa_priv_dec(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding);\n-static int surewarehk_rsa_sign(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding);\n-# endif\n-\n-/* RAND stuff */\n-static int surewarehk_rand_bytes(unsigned char *buf, int num);\n-static int surewarehk_rand_seed(const void *buf, int num);\n-static int surewarehk_rand_add(const void *buf, int num, double entropy);\n-\n-/* KM stuff */\n-static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id,\n- UI_METHOD *ui_method,\n- void *callback_data);\n-static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id,\n- UI_METHOD *ui_method,\n- void *callback_data);\n-static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,\n- int idx, long argl, void *argp);\n-\n-# ifndef OPENSSL_NO_RSA\n-/* This function is aliased to mod_exp (with the mont stuff dropped). */\n-static int surewarehk_mod_exp_mont(BIGNUM *r, const BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m,\n- BN_CTX *ctx, BN_MONT_CTX *m_ctx)\n-{\n- return surewarehk_modexp(r, a, p, m, ctx);\n-}\n-\n-/* Our internal RSA_METHOD that we provide pointers to */\n-static RSA_METHOD surewarehk_rsa \u003d {\n- \u0022SureWare RSA method\u0022,\n- NULL, /* pub_enc */\n- NULL, /* pub_dec */\n- surewarehk_rsa_sign, /* our rsa_sign is OpenSSL priv_enc */\n- surewarehk_rsa_priv_dec, /* priv_dec */\n- NULL, /* mod_exp */\n- surewarehk_mod_exp_mont, /* mod_exp_mongomery */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* RSA flag */\n- NULL,\n- NULL, /* OpenSSL sign */\n- NULL, /* OpenSSL verify */\n- NULL /* keygen */\n-};\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n-/* Our internal DH_METHOD that we provide pointers to */\n-/* This function is aliased to mod_exp (with the dh and mont dropped). */\n-static int surewarehk_modexp_dh(const DH *dh, BIGNUM *r, const BIGNUM *a,\n- const BIGNUM *p, const BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *m_ctx)\n-{\n- return surewarehk_modexp(r, a, p, m, ctx);\n-}\n-\n-static DH_METHOD surewarehk_dh \u003d {\n- \u0022SureWare DH method\u0022,\n- NULL, /* gen_key */\n- NULL, /* agree, */\n- surewarehk_modexp_dh, /* dh mod exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0, /* flags */\n- NULL,\n- NULL\n-};\n-# endif\n-\n-static RAND_METHOD surewarehk_rand \u003d {\n- /* \u0022SureWare RAND method\u0022, */\n- surewarehk_rand_seed,\n- surewarehk_rand_bytes,\n- NULL, /* cleanup */\n- surewarehk_rand_add,\n- surewarehk_rand_bytes,\n- NULL, /* rand_status */\n-};\n-\n-# ifndef OPENSSL_NO_DSA\n-/* DSA stuff */\n-static DSA_SIG *surewarehk_dsa_do_sign(const unsigned char *dgst, int dlen,\n- DSA *dsa);\n-static int surewarehk_dsa_mod_exp(DSA *dsa, BIGNUM *rr, BIGNUM *a1,\n- BIGNUM *p1, BIGNUM *a2, BIGNUM *p2,\n- BIGNUM *m, BN_CTX *ctx,\n- BN_MONT_CTX *in_mont)\n-{\n- BIGNUM t;\n- int to_return \u003d 0;\n- BN_init(\u0026t);\n- /* let rr \u003d a1 ^ p1 mod m */\n- if (!surewarehk_modexp(rr, a1, p1, m, ctx))\n- goto end;\n- /* let t \u003d a2 ^ p2 mod m */\n- if (!surewarehk_modexp(\u0026t, a2, p2, m, ctx))\n- goto end;\n- /* let rr \u003d rr * t mod m */\n- if (!BN_mod_mul(rr, rr, \u0026t, m, ctx))\n- goto end;\n- to_return \u003d 1;\n- end:\n- BN_free(\u0026t);\n- return to_return;\n-}\n-\n-static DSA_METHOD surewarehk_dsa \u003d {\n- \u0022SureWare DSA method\u0022,\n- surewarehk_dsa_do_sign,\n- NULL, /* sign setup */\n- NULL, /* verify, */\n- surewarehk_dsa_mod_exp, /* mod exp */\n- NULL, /* bn mod exp */\n- NULL, /* init */\n- NULL, /* finish */\n- 0,\n- NULL,\n- NULL,\n- NULL\n-};\n-# endif\n-\n-static const char *engine_sureware_id \u003d \u0022sureware\u0022;\n-static const char *engine_sureware_name \u003d \u0022SureWare hardware engine support\u0022;\n-\n-/* Now, to our own code */\n-\n-/*\n- * As this is only ever called once, there's no need for locking (indeed -\n- * the lock will already be held by our caller!!!)\n- */\n-static int bind_sureware(ENGINE *e)\n-{\n-# ifndef OPENSSL_NO_RSA\n- const RSA_METHOD *meth1;\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- const DSA_METHOD *meth2;\n-# endif\n-# ifndef OPENSSL_NO_DH\n- const DH_METHOD *meth3;\n-# endif\n-\n- if (!ENGINE_set_id(e, engine_sureware_id) ||\n- !ENGINE_set_name(e, engine_sureware_name) ||\n-# ifndef OPENSSL_NO_RSA\n- !ENGINE_set_RSA(e, \u0026surewarehk_rsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- !ENGINE_set_DSA(e, \u0026surewarehk_dsa) ||\n-# endif\n-# ifndef OPENSSL_NO_DH\n- !ENGINE_set_DH(e, \u0026surewarehk_dh) ||\n-# endif\n- !ENGINE_set_RAND(e, \u0026surewarehk_rand) ||\n- !ENGINE_set_destroy_function(e, surewarehk_destroy) ||\n- !ENGINE_set_init_function(e, surewarehk_init) ||\n- !ENGINE_set_finish_function(e, surewarehk_finish) ||\n- !ENGINE_set_ctrl_function(e, surewarehk_ctrl) ||\n- !ENGINE_set_load_privkey_function(e, surewarehk_load_privkey) ||\n- !ENGINE_set_load_pubkey_function(e, surewarehk_load_pubkey))\n- return 0;\n-\n-# ifndef OPENSSL_NO_RSA\n- /*\n- * We know that the \u0022PKCS1_SSLeay()\u0022 functions hook properly to the\n- * cswift-specific mod_exp and mod_exp_crt so we use those functions. NB:\n- * We don't use ENGINE_openssl() or anything \u0022more generic\u0022 because\n- * something like the RSAref code may not hook properly, and if you own\n- * one of these cards then you have the right to do RSA operations on it\n- * anyway!\n- */\n- meth1 \u003d RSA_PKCS1_SSLeay();\n- if (meth1) {\n- surewarehk_rsa.rsa_pub_enc \u003d meth1-\u003ersa_pub_enc;\n- surewarehk_rsa.rsa_pub_dec \u003d meth1-\u003ersa_pub_dec;\n- }\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n- /*\n- * Use the DSA_OpenSSL() method and just hook the mod_exp-ish bits.\n- */\n- meth2 \u003d DSA_OpenSSL();\n- if (meth2) {\n- surewarehk_dsa.dsa_do_verify \u003d meth2-\u003edsa_do_verify;\n- }\n-# endif\n-\n-# ifndef OPENSSL_NO_DH\n- /* Much the same for Diffie-Hellman */\n- meth3 \u003d DH_OpenSSL();\n- if (meth3) {\n- surewarehk_dh.generate_key \u003d meth3-\u003egenerate_key;\n- surewarehk_dh.compute_key \u003d meth3-\u003ecompute_key;\n- }\n-# endif\n-\n- /* Ensure the sureware error handling is set up */\n- ERR_load_SUREWARE_strings();\n- return 1;\n-}\n-\n-# ifndef OPENSSL_NO_DYNAMIC_ENGINE\n-static int bind_helper(ENGINE *e, const char *id)\n-{\n- if (id \u0026\u0026 (strcmp(id, engine_sureware_id) !\u003d 0))\n- return 0;\n- if (!bind_sureware(e))\n- return 0;\n- return 1;\n-}\n-\n-IMPLEMENT_DYNAMIC_CHECK_FN()\n- IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)\n-# else\n-static ENGINE *engine_sureware(void)\n-{\n- ENGINE *ret \u003d ENGINE_new();\n- if (!ret)\n- return NULL;\n- if (!bind_sureware(ret)) {\n- ENGINE_free(ret);\n- return NULL;\n- }\n- return ret;\n-}\n-\n-void ENGINE_load_sureware(void)\n-{\n- /* Copied from eng_[openssl|dyn].c */\n- ENGINE *toadd \u003d engine_sureware();\n- if (!toadd)\n- return;\n- ENGINE_add(toadd);\n- ENGINE_free(toadd);\n- ERR_clear_error();\n-}\n-# endif\n-\n-/*\n- * This is a process-global DSO handle used for loading and unloading the\n- * SureWareHook library. NB: This is only set (or unset) during an init() or\n- * finish() call (reference counts permitting) and they're operating with\n- * global locks, so this should be thread-safe implicitly.\n- */\n-static DSO *surewarehk_dso \u003d NULL;\n-# ifndef OPENSSL_NO_RSA\n-/* Index for KM handle. Not really used yet. */\n-static int rsaHndidx \u003d -1;\n-# endif\n-# ifndef OPENSSL_NO_DSA\n-/* Index for KM handle. Not really used yet. */\n-static int dsaHndidx \u003d -1;\n-# endif\n-\n-/*\n- * These are the function pointers that are (un)set when the library has\n- * successfully (un)loaded.\n- */\n-static SureWareHook_Init_t *p_surewarehk_Init \u003d NULL;\n-static SureWareHook_Finish_t *p_surewarehk_Finish \u003d NULL;\n-static SureWareHook_Rand_Bytes_t *p_surewarehk_Rand_Bytes \u003d NULL;\n-static SureWareHook_Rand_Seed_t *p_surewarehk_Rand_Seed \u003d NULL;\n-static SureWareHook_Load_Privkey_t *p_surewarehk_Load_Privkey \u003d NULL;\n-static SureWareHook_Info_Pubkey_t *p_surewarehk_Info_Pubkey \u003d NULL;\n-static SureWareHook_Load_Rsa_Pubkey_t *p_surewarehk_Load_Rsa_Pubkey \u003d NULL;\n-static SureWareHook_Load_Dsa_Pubkey_t *p_surewarehk_Load_Dsa_Pubkey \u003d NULL;\n-static SureWareHook_Free_t *p_surewarehk_Free \u003d NULL;\n-static SureWareHook_Rsa_Priv_Dec_t *p_surewarehk_Rsa_Priv_Dec \u003d NULL;\n-static SureWareHook_Rsa_Sign_t *p_surewarehk_Rsa_Sign \u003d NULL;\n-static SureWareHook_Dsa_Sign_t *p_surewarehk_Dsa_Sign \u003d NULL;\n-static SureWareHook_Mod_Exp_t *p_surewarehk_Mod_Exp \u003d NULL;\n-\n-/* Used in the DSO operations. */\n-static const char *surewarehk_LIBNAME \u003d \u0022SureWareHook\u0022;\n-static const char *n_surewarehk_Init \u003d \u0022SureWareHook_Init\u0022;\n-static const char *n_surewarehk_Finish \u003d \u0022SureWareHook_Finish\u0022;\n-static const char *n_surewarehk_Rand_Bytes \u003d \u0022SureWareHook_Rand_Bytes\u0022;\n-static const char *n_surewarehk_Rand_Seed \u003d \u0022SureWareHook_Rand_Seed\u0022;\n-static const char *n_surewarehk_Load_Privkey \u003d \u0022SureWareHook_Load_Privkey\u0022;\n-static const char *n_surewarehk_Info_Pubkey \u003d \u0022SureWareHook_Info_Pubkey\u0022;\n-static const char *n_surewarehk_Load_Rsa_Pubkey \u003d\n- \u0022SureWareHook_Load_Rsa_Pubkey\u0022;\n-static const char *n_surewarehk_Load_Dsa_Pubkey \u003d\n- \u0022SureWareHook_Load_Dsa_Pubkey\u0022;\n-static const char *n_surewarehk_Free \u003d \u0022SureWareHook_Free\u0022;\n-static const char *n_surewarehk_Rsa_Priv_Dec \u003d \u0022SureWareHook_Rsa_Priv_Dec\u0022;\n-static const char *n_surewarehk_Rsa_Sign \u003d \u0022SureWareHook_Rsa_Sign\u0022;\n-static const char *n_surewarehk_Dsa_Sign \u003d \u0022SureWareHook_Dsa_Sign\u0022;\n-static const char *n_surewarehk_Mod_Exp \u003d \u0022SureWareHook_Mod_Exp\u0022;\n-static BIO *logstream \u003d NULL;\n-\n-/*\n- * SureWareHook library functions and mechanics - these are used by the\n- * higher-level functions further down. NB: As and where there's no error\n- * checking, take a look lower down where these functions are called, the\n- * checking and error handling is probably down there.\n- */\n-static int threadsafe \u003d 1;\n-static int surewarehk_ctrl(ENGINE *e, int cmd, long i, void *p,\n- void (*f) (void))\n-{\n- int to_return \u003d 1;\n-\n- switch (cmd) {\n- case ENGINE_CTRL_SET_LOGSTREAM:\n- {\n- BIO *bio \u003d (BIO *)p;\n- CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n- BIO_free(logstream);\n- logstream \u003d NULL;\n- if (CRYPTO_add(\u0026bio-\u003ereferences, 1, CRYPTO_LOCK_BIO) \u003e 1)\n- logstream \u003d bio;\n- else\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL,\n- SUREWARE_R_BIO_WAS_FREED);\n- }\n- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n- break;\n- /*\n- * This will prevent the initialisation function from \u0022installing\u0022\n- * the mutex-handling callbacks, even if they are available from\n- * within the library (or were provided to the library from the\n- * calling application). This is to remove any baggage for\n- * applications not using multithreading.\n- */\n- case ENGINE_CTRL_CHIL_NO_LOCKING:\n- CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);\n- threadsafe \u003d 0;\n- CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);\n- break;\n-\n- /* The command isn't understood by this engine */\n- default:\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_CTRL,\n- ENGINE_R_CTRL_COMMAND_NOT_IMPLEMENTED);\n- to_return \u003d 0;\n- break;\n- }\n-\n- return to_return;\n-}\n-\n-/* Destructor (complements the \u0022ENGINE_surewarehk()\u0022 constructor) */\n-static int surewarehk_destroy(ENGINE *e)\n-{\n- ERR_unload_SUREWARE_strings();\n- return 1;\n-}\n-\n-/* (de)initialisation functions. */\n-static int surewarehk_init(ENGINE *e)\n-{\n- char msg[64] \u003d \u0022ENGINE_init\u0022;\n- SureWareHook_Init_t *p1 \u003d NULL;\n- SureWareHook_Finish_t *p2 \u003d NULL;\n- SureWareHook_Rand_Bytes_t *p3 \u003d NULL;\n- SureWareHook_Rand_Seed_t *p4 \u003d NULL;\n- SureWareHook_Load_Privkey_t *p5 \u003d NULL;\n- SureWareHook_Load_Rsa_Pubkey_t *p6 \u003d NULL;\n- SureWareHook_Free_t *p7 \u003d NULL;\n- SureWareHook_Rsa_Priv_Dec_t *p8 \u003d NULL;\n- SureWareHook_Rsa_Sign_t *p9 \u003d NULL;\n- SureWareHook_Dsa_Sign_t *p12 \u003d NULL;\n- SureWareHook_Info_Pubkey_t *p13 \u003d NULL;\n- SureWareHook_Load_Dsa_Pubkey_t *p14 \u003d NULL;\n- SureWareHook_Mod_Exp_t *p15 \u003d NULL;\n-\n- if (surewarehk_dso !\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT, ENGINE_R_ALREADY_LOADED);\n- goto err;\n- }\n- /* Attempt to load libsurewarehk.so/surewarehk.dll/whatever. */\n- surewarehk_dso \u003d DSO_load(NULL, surewarehk_LIBNAME, NULL, 0);\n- if (surewarehk_dso \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT, ENGINE_R_DSO_FAILURE);\n- goto err;\n- }\n- if (!\n- (p1 \u003d\n- (SureWareHook_Init_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Init))\n-|| !(p2 \u003d\n- (SureWareHook_Finish_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Finish))\n-|| !(p3 \u003d\n- (SureWareHook_Rand_Bytes_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Rand_Bytes))\n-|| !(p4 \u003d\n- (SureWareHook_Rand_Seed_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Rand_Seed))\n-|| !(p5 \u003d\n- (SureWareHook_Load_Privkey_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Load_Privkey))\n-|| !(p6 \u003d\n- (SureWareHook_Load_Rsa_Pubkey_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Load_Rsa_Pubkey))\n-|| !(p7 \u003d\n- (SureWareHook_Free_t *) DSO_bind_func(surewarehk_dso, n_surewarehk_Free))\n-|| !(p8 \u003d\n- (SureWareHook_Rsa_Priv_Dec_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Rsa_Priv_Dec))\n-|| !(p9 \u003d\n- (SureWareHook_Rsa_Sign_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Rsa_Sign))\n-|| !(p12 \u003d\n- (SureWareHook_Dsa_Sign_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Dsa_Sign))\n-|| !(p13 \u003d\n- (SureWareHook_Info_Pubkey_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Info_Pubkey))\n-|| !(p14 \u003d\n- (SureWareHook_Load_Dsa_Pubkey_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Load_Dsa_Pubkey))\n-|| !(p15 \u003d\n- (SureWareHook_Mod_Exp_t *) DSO_bind_func(surewarehk_dso,\n- n_surewarehk_Mod_Exp))) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT, ENGINE_R_DSO_FAILURE);\n- goto err;\n- }\n- /* Copy the pointers */\n- p_surewarehk_Init \u003d p1;\n- p_surewarehk_Finish \u003d p2;\n- p_surewarehk_Rand_Bytes \u003d p3;\n- p_surewarehk_Rand_Seed \u003d p4;\n- p_surewarehk_Load_Privkey \u003d p5;\n- p_surewarehk_Load_Rsa_Pubkey \u003d p6;\n- p_surewarehk_Free \u003d p7;\n- p_surewarehk_Rsa_Priv_Dec \u003d p8;\n- p_surewarehk_Rsa_Sign \u003d p9;\n- p_surewarehk_Dsa_Sign \u003d p12;\n- p_surewarehk_Info_Pubkey \u003d p13;\n- p_surewarehk_Load_Dsa_Pubkey \u003d p14;\n- p_surewarehk_Mod_Exp \u003d p15;\n- /* Contact the hardware and initialises it. */\n- if (p_surewarehk_Init(msg, threadsafe) \u003d\u003d SUREWAREHOOK_ERROR_UNIT_FAILURE) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT, SUREWARE_R_UNIT_FAILURE);\n- goto err;\n- }\n- if (p_surewarehk_Init(msg, threadsafe) \u003d\u003d SUREWAREHOOK_ERROR_UNIT_FAILURE) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_INIT, SUREWARE_R_UNIT_FAILURE);\n- goto err;\n- }\n- /*\n- * try to load the default private key, if failed does not return a\n- * failure but wait for an explicit ENGINE_load_privakey\n- */\n- surewarehk_load_privkey(e, NULL, NULL, NULL);\n-\n- /* Everything's fine. */\n-# ifndef OPENSSL_NO_RSA\n- if (rsaHndidx \u003d\u003d -1)\n- rsaHndidx \u003d RSA_get_ex_new_index(0,\n- \u0022SureWareHook RSA key handle\u0022,\n- NULL, NULL, surewarehk_ex_free);\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- if (dsaHndidx \u003d\u003d -1)\n- dsaHndidx \u003d DSA_get_ex_new_index(0,\n- \u0022SureWareHook DSA key handle\u0022,\n- NULL, NULL, surewarehk_ex_free);\n-# endif\n-\n- return 1;\n- err:\n- DSO_free(surewarehk_dso);\n- surewarehk_dso \u003d NULL;\n- p_surewarehk_Init \u003d NULL;\n- p_surewarehk_Finish \u003d NULL;\n- p_surewarehk_Rand_Bytes \u003d NULL;\n- p_surewarehk_Rand_Seed \u003d NULL;\n- p_surewarehk_Load_Privkey \u003d NULL;\n- p_surewarehk_Load_Rsa_Pubkey \u003d NULL;\n- p_surewarehk_Free \u003d NULL;\n- p_surewarehk_Rsa_Priv_Dec \u003d NULL;\n- p_surewarehk_Rsa_Sign \u003d NULL;\n- p_surewarehk_Dsa_Sign \u003d NULL;\n- p_surewarehk_Info_Pubkey \u003d NULL;\n- p_surewarehk_Load_Dsa_Pubkey \u003d NULL;\n- p_surewarehk_Mod_Exp \u003d NULL;\n- return 0;\n-}\n-\n-static int surewarehk_finish(ENGINE *e)\n-{\n- int to_return \u003d 1;\n- if (surewarehk_dso \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH, ENGINE_R_NOT_LOADED);\n- to_return \u003d 0;\n- goto err;\n- }\n- p_surewarehk_Finish();\n- if (!DSO_free(surewarehk_dso)) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_FINISH, ENGINE_R_DSO_FAILURE);\n- to_return \u003d 0;\n- goto err;\n- }\n- err:\n- BIO_free(logstream);\n- surewarehk_dso \u003d NULL;\n- p_surewarehk_Init \u003d NULL;\n- p_surewarehk_Finish \u003d NULL;\n- p_surewarehk_Rand_Bytes \u003d NULL;\n- p_surewarehk_Rand_Seed \u003d NULL;\n- p_surewarehk_Load_Privkey \u003d NULL;\n- p_surewarehk_Load_Rsa_Pubkey \u003d NULL;\n- p_surewarehk_Free \u003d NULL;\n- p_surewarehk_Rsa_Priv_Dec \u003d NULL;\n- p_surewarehk_Rsa_Sign \u003d NULL;\n- p_surewarehk_Dsa_Sign \u003d NULL;\n- p_surewarehk_Info_Pubkey \u003d NULL;\n- p_surewarehk_Load_Dsa_Pubkey \u003d NULL;\n- p_surewarehk_Mod_Exp \u003d NULL;\n- return to_return;\n-}\n-\n-static void surewarehk_error_handling(char *const msg, int func, int ret)\n-{\n- switch (ret) {\n- case SUREWAREHOOK_ERROR_UNIT_FAILURE:\n- ENGINEerr(func, SUREWARE_R_UNIT_FAILURE);\n- break;\n- case SUREWAREHOOK_ERROR_FALLBACK:\n- ENGINEerr(func, SUREWARE_R_REQUEST_FALLBACK);\n- break;\n- case SUREWAREHOOK_ERROR_DATA_SIZE:\n- ENGINEerr(func, SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL);\n- break;\n- case SUREWAREHOOK_ERROR_INVALID_PAD:\n- ENGINEerr(func, SUREWARE_R_PADDING_CHECK_FAILED);\n- break;\n- default:\n- ENGINEerr(func, SUREWARE_R_REQUEST_FAILED);\n- break;\n- case 1: /* nothing */\n- msg[0] \u003d '\u005c0';\n- }\n- if (*msg) {\n- ERR_add_error_data(1, msg);\n- if (logstream) {\n- CRYPTO_w_lock(CRYPTO_LOCK_BIO);\n- BIO_write(logstream, msg, strlen(msg));\n- CRYPTO_w_unlock(CRYPTO_LOCK_BIO);\n- }\n- }\n-}\n-\n-static int surewarehk_rand_bytes(unsigned char *buf, int num)\n-{\n- int ret \u003d 0;\n- char msg[64] \u003d \u0022ENGINE_rand_bytes\u0022;\n- if (!p_surewarehk_Rand_Bytes) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_BYTES,\n- ENGINE_R_NOT_INITIALISED);\n- } else {\n- ret \u003d p_surewarehk_Rand_Bytes(msg, buf, num);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_RAND_BYTES, ret);\n- }\n- return ret \u003d\u003d 1 ? 1 : 0;\n-}\n-\n-static int surewarehk_rand_seed(const void *buf, int num)\n-{\n- int ret \u003d 0;\n- char msg[64] \u003d \u0022ENGINE_rand_seed\u0022;\n- if (!p_surewarehk_Rand_Seed) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RAND_SEED,\n- ENGINE_R_NOT_INITIALISED);\n- return 0;\n- } else {\n- ret \u003d p_surewarehk_Rand_Seed(msg, buf, num);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_RAND_SEED, ret);\n- if (ret \u003d\u003d 1)\n- return 1;\n- else\n- return 0;\n- }\n-}\n-\n-static int surewarehk_rand_add(const void *buf, int num, double entropy)\n-{\n- return surewarehk_rand_seed(buf, num);\n-}\n-\n-static EVP_PKEY *sureware_load_public(ENGINE *e, const char *key_id,\n- char *hptr, unsigned long el,\n- char keytype)\n-{\n- EVP_PKEY *res \u003d NULL;\n-# ifndef OPENSSL_NO_RSA\n- RSA *rsatmp \u003d NULL;\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- DSA *dsatmp \u003d NULL;\n-# endif\n- char msg[64] \u003d \u0022sureware_load_public\u0022;\n- int ret \u003d 0;\n- if (!p_surewarehk_Load_Rsa_Pubkey || !p_surewarehk_Load_Dsa_Pubkey) {\n- SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,\n- ENGINE_R_NOT_INITIALISED);\n- goto err;\n- }\n- switch (keytype) {\n-# ifndef OPENSSL_NO_RSA\n- case 1:\n- /*RSA*/\n- /* set private external reference */\n- rsatmp \u003d RSA_new_method(e);\n- RSA_set_ex_data(rsatmp, rsaHndidx, hptr);\n- rsatmp-\u003eflags |\u003d RSA_FLAG_EXT_PKEY;\n-\n- /* set public big nums */\n- rsatmp-\u003ee \u003d BN_new();\n- rsatmp-\u003en \u003d BN_new();\n- if (!rsatmp-\u003ee || !rsatmp-\u003en)\n- goto err;\n- bn_expand2(rsatmp-\u003ee, el / sizeof(BN_ULONG));\n- bn_expand2(rsatmp-\u003en, el / sizeof(BN_ULONG));\n- if (rsatmp-\u003ee-\u003edmax !\u003d (int)(el / sizeof(BN_ULONG)) ||\n- rsatmp-\u003en-\u003edmax !\u003d (int)(el / sizeof(BN_ULONG)))\n- goto err;\n- ret \u003d p_surewarehk_Load_Rsa_Pubkey(msg, key_id, el,\n- (unsigned long *)rsatmp-\u003en-\u003ed,\n- (unsigned long *)rsatmp-\u003ee-\u003ed);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWARE_LOAD_PUBLIC, ret);\n- if (ret !\u003d 1) {\n- SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,\n- ENGINE_R_FAILED_LOADING_PUBLIC_KEY);\n- goto err;\n- }\n- /* normalise pub e and pub n */\n- rsatmp-\u003ee-\u003etop \u003d el / sizeof(BN_ULONG);\n- bn_fix_top(rsatmp-\u003ee);\n- rsatmp-\u003en-\u003etop \u003d el / sizeof(BN_ULONG);\n- bn_fix_top(rsatmp-\u003en);\n- /* create an EVP object: engine + rsa key */\n- res \u003d EVP_PKEY_new();\n- EVP_PKEY_assign_RSA(res, rsatmp);\n- break;\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n- case 2:\n- /*DSA*/\n- /* set private/public external reference */\n- dsatmp \u003d DSA_new_method(e);\n- DSA_set_ex_data(dsatmp, dsaHndidx, hptr);\n- /*\n- * dsatmp-\u003eflags |\u003d DSA_FLAG_EXT_PKEY;\n- */\n-\n- /* set public key */\n- dsatmp-\u003epub_key \u003d BN_new();\n- dsatmp-\u003ep \u003d BN_new();\n- dsatmp-\u003eq \u003d BN_new();\n- dsatmp-\u003eg \u003d BN_new();\n- if (!dsatmp-\u003epub_key || !dsatmp-\u003ep || !dsatmp-\u003eq || !dsatmp-\u003eg)\n- goto err;\n- bn_expand2(dsatmp-\u003epub_key, el / sizeof(BN_ULONG));\n- bn_expand2(dsatmp-\u003ep, el / sizeof(BN_ULONG));\n- bn_expand2(dsatmp-\u003eq, 20 / sizeof(BN_ULONG));\n- bn_expand2(dsatmp-\u003eg, el / sizeof(BN_ULONG));\n- if (dsatmp-\u003epub_key-\u003edmax !\u003d (int)(el / sizeof(BN_ULONG))\n- || dsatmp-\u003ep-\u003edmax !\u003d (int)(el / sizeof(BN_ULONG))\n- || dsatmp-\u003eq-\u003edmax !\u003d 20 / sizeof(BN_ULONG)\n- || dsatmp-\u003eg-\u003edmax !\u003d (int)(el / sizeof(BN_ULONG)))\n- goto err;\n-\n- ret \u003d p_surewarehk_Load_Dsa_Pubkey(msg, key_id, el,\n- (unsigned long *)dsatmp-\u003e\n- pub_key-\u003ed,\n- (unsigned long *)dsatmp-\u003ep-\u003ed,\n- (unsigned long *)dsatmp-\u003eq-\u003ed,\n- (unsigned long *)dsatmp-\u003eg-\u003ed);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWARE_LOAD_PUBLIC, ret);\n- if (ret !\u003d 1) {\n- SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,\n- ENGINE_R_FAILED_LOADING_PUBLIC_KEY);\n- goto err;\n- }\n- /* set parameters */\n- /* normalise pubkey and parameters in case of */\n- dsatmp-\u003epub_key-\u003etop \u003d el / sizeof(BN_ULONG);\n- bn_fix_top(dsatmp-\u003epub_key);\n- dsatmp-\u003ep-\u003etop \u003d el / sizeof(BN_ULONG);\n- bn_fix_top(dsatmp-\u003ep);\n- dsatmp-\u003eq-\u003etop \u003d 20 / sizeof(BN_ULONG);\n- bn_fix_top(dsatmp-\u003eq);\n- dsatmp-\u003eg-\u003etop \u003d el / sizeof(BN_ULONG);\n- bn_fix_top(dsatmp-\u003eg);\n-\n- /* create an EVP object: engine + rsa key */\n- res \u003d EVP_PKEY_new();\n- EVP_PKEY_assign_DSA(res, dsatmp);\n- break;\n-# endif\n-\n- default:\n- SUREWAREerr(SUREWARE_F_SUREWARE_LOAD_PUBLIC,\n- ENGINE_R_FAILED_LOADING_PRIVATE_KEY);\n- goto err;\n- }\n- return res;\n- err:\n-# ifndef OPENSSL_NO_RSA\n- RSA_free(rsatmp);\n-# endif\n-# ifndef OPENSSL_NO_DSA\n- DSA_free(dsatmp);\n-# endif\n- return NULL;\n-}\n-\n-static EVP_PKEY *surewarehk_load_privkey(ENGINE *e, const char *key_id,\n- UI_METHOD *ui_method,\n- void *callback_data)\n-{\n- EVP_PKEY *res \u003d NULL;\n- int ret \u003d 0;\n- unsigned long el \u003d 0;\n- char *hptr \u003d NULL;\n- char keytype \u003d 0;\n- char msg[64] \u003d \u0022ENGINE_load_privkey\u0022;\n-\n- if (!p_surewarehk_Load_Privkey) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVKEY,\n- ENGINE_R_NOT_INITIALISED);\n- } else {\n- ret \u003d p_surewarehk_Load_Privkey(msg, key_id, \u0026hptr, \u0026el, \u0026keytype);\n- if (ret !\u003d 1) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PRIVKEY,\n- ENGINE_R_FAILED_LOADING_PRIVATE_KEY);\n- ERR_add_error_data(1, msg);\n- } else\n- res \u003d sureware_load_public(e, key_id, hptr, el, keytype);\n- }\n- return res;\n-}\n-\n-static EVP_PKEY *surewarehk_load_pubkey(ENGINE *e, const char *key_id,\n- UI_METHOD *ui_method,\n- void *callback_data)\n-{\n- EVP_PKEY *res \u003d NULL;\n- int ret \u003d 0;\n- unsigned long el \u003d 0;\n- char *hptr \u003d NULL;\n- char keytype \u003d 0;\n- char msg[64] \u003d \u0022ENGINE_load_pubkey\u0022;\n-\n- if (!p_surewarehk_Info_Pubkey) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBKEY,\n- ENGINE_R_NOT_INITIALISED);\n- } else {\n- /* call once to identify if DSA or RSA */\n- ret \u003d p_surewarehk_Info_Pubkey(msg, key_id, \u0026el, \u0026keytype);\n- if (ret !\u003d 1) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_LOAD_PUBKEY,\n- ENGINE_R_FAILED_LOADING_PUBLIC_KEY);\n- ERR_add_error_data(1, msg);\n- } else\n- res \u003d sureware_load_public(e, key_id, hptr, el, keytype);\n- }\n- return res;\n-}\n-\n-/*\n- * This cleans up an RSA/DSA KM key(do not destroy the key into the hardware)\n- * , called when ex_data is freed\n- */\n-static void surewarehk_ex_free(void *obj, void *item, CRYPTO_EX_DATA *ad,\n- int idx, long argl, void *argp)\n-{\n- if (!p_surewarehk_Free) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_EX_FREE, ENGINE_R_NOT_INITIALISED);\n- } else\n- p_surewarehk_Free((char *)item, 0);\n-}\n-\n-/*\n- * return number of decrypted bytes\n- */\n-# ifndef OPENSSL_NO_RSA\n-static int surewarehk_rsa_priv_dec(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding)\n-{\n- int ret \u003d 0, tlen;\n- char *buf \u003d NULL, *hptr \u003d NULL;\n- char msg[64] \u003d \u0022ENGINE_rsa_priv_dec\u0022;\n- if (!p_surewarehk_Rsa_Priv_Dec) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- ENGINE_R_NOT_INITIALISED);\n- }\n- /* extract ref to private key */\n- else if ((hptr \u003d RSA_get_ex_data(rsa, rsaHndidx)) \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- SUREWARE_R_MISSING_KEY_COMPONENTS);\n- goto err;\n- }\n- /* analyse what padding we can do into the hardware */\n- if (padding \u003d\u003d RSA_PKCS1_PADDING) {\n- /* do it one shot */\n- ret \u003d\n- p_surewarehk_Rsa_Priv_Dec(msg, flen, (unsigned char *)from, \u0026tlen,\n- to, hptr, SUREWARE_PKCS1_PAD);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- ret);\n- if (ret !\u003d 1)\n- goto err;\n- ret \u003d tlen;\n- } else { /* do with no padding into hardware */\n-\n- ret \u003d\n- p_surewarehk_Rsa_Priv_Dec(msg, flen, (unsigned char *)from, \u0026tlen,\n- to, hptr, SUREWARE_NO_PAD);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- ret);\n- if (ret !\u003d 1)\n- goto err;\n- /* intermediate buffer for padding */\n- if ((buf \u003d OPENSSL_malloc(tlen)) \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- ERR_R_MALLOC_FAILURE);\n- goto err;\n- }\n- memcpy(buf, to, tlen); /* transfert to into buf */\n- switch (padding) { /* check padding in software */\n- case RSA_PKCS1_OAEP_PADDING:\n- ret \u003d\n- RSA_padding_check_PKCS1_OAEP(to, tlen, (unsigned char *)buf,\n- tlen, tlen, NULL, 0);\n- break;\n- case RSA_SSLV23_PADDING:\n- ret \u003d\n- RSA_padding_check_SSLv23(to, tlen, (unsigned char *)buf, flen,\n- tlen);\n- break;\n- case RSA_NO_PADDING:\n- ret \u003d\n- RSA_padding_check_none(to, tlen, (unsigned char *)buf, flen,\n- tlen);\n- break;\n- default:\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- SUREWARE_R_UNKNOWN_PADDING_TYPE);\n- goto err;\n- }\n- if (ret \u003c 0)\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,\n- SUREWARE_R_PADDING_CHECK_FAILED);\n- }\n- err:\n- OPENSSL_clear_free(buf, tlen);\n- return ret;\n-}\n-\n-/*\n- * Does what OpenSSL rsa_priv_enc does.\n- */\n-static int surewarehk_rsa_sign(int flen, const unsigned char *from,\n- unsigned char *to, RSA *rsa, int padding)\n-{\n- int ret \u003d 0, tlen;\n- char *hptr \u003d NULL;\n- char msg[64] \u003d \u0022ENGINE_rsa_sign\u0022;\n- if (!p_surewarehk_Rsa_Sign) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_SIGN, ENGINE_R_NOT_INITIALISED);\n- }\n- /* extract ref to private key */\n- else if ((hptr \u003d RSA_get_ex_data(rsa, rsaHndidx)) \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_SIGN,\n- SUREWARE_R_MISSING_KEY_COMPONENTS);\n- } else {\n- switch (padding) {\n- case RSA_PKCS1_PADDING: /* do it in one shot */\n- ret \u003d\n- p_surewarehk_Rsa_Sign(msg, flen, (unsigned char *)from, \u0026tlen,\n- to, hptr, SUREWARE_PKCS1_PAD);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_RSA_SIGN,\n- ret);\n- break;\n- case RSA_NO_PADDING:\n- default:\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_SIGN,\n- SUREWARE_R_UNKNOWN_PADDING_TYPE);\n- }\n- }\n- return ret \u003d\u003d 1 ? tlen : ret;\n-}\n-\n-# endif\n-\n-# ifndef OPENSSL_NO_DSA\n-/* DSA sign and verify */\n-static DSA_SIG *surewarehk_dsa_do_sign(const unsigned char *from, int flen,\n- DSA *dsa)\n-{\n- int ret \u003d 0;\n- char *hptr \u003d NULL;\n- DSA_SIG *psign \u003d NULL;\n- char msg[64] \u003d \u0022ENGINE_dsa_do_sign\u0022;\n- if (!p_surewarehk_Dsa_Sign) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,\n- ENGINE_R_NOT_INITIALISED);\n- goto err;\n- }\n- /* extract ref to private key */\n- else if ((hptr \u003d DSA_get_ex_data(dsa, dsaHndidx)) \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,\n- SUREWARE_R_MISSING_KEY_COMPONENTS);\n- goto err;\n- } else {\n- if ((psign \u003d DSA_SIG_new()) \u003d\u003d NULL) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,\n- ERR_R_MALLOC_FAILURE);\n- goto err;\n- }\n- psign-\u003er \u003d BN_new();\n- psign-\u003es \u003d BN_new();\n- if (!psign-\u003er || !psign-\u003es)\n- goto err;\n- bn_expand2(psign-\u003er, 20 / sizeof(BN_ULONG));\n- bn_expand2(psign-\u003es, 20 / sizeof(BN_ULONG));\n- if (psign-\u003er-\u003edmax !\u003d 20 / sizeof(BN_ULONG) ||\n- psign-\u003es-\u003edmax !\u003d 20 / sizeof(BN_ULONG))\n- goto err;\n- ret \u003d p_surewarehk_Dsa_Sign(msg, flen, from,\n- (unsigned long *)psign-\u003er-\u003ed,\n- (unsigned long *)psign-\u003es-\u003ed, hptr);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_DSA_DO_SIGN,\n- ret);\n- }\n- psign-\u003er-\u003etop \u003d 20 / sizeof(BN_ULONG);\n- bn_fix_top(psign-\u003er);\n- psign-\u003es-\u003etop \u003d 20 / sizeof(BN_ULONG);\n- bn_fix_top(psign-\u003es);\n-\n- err:\n- if (psign) {\n- DSA_SIG_free(psign);\n- psign \u003d NULL;\n- }\n- return psign;\n-}\n-# endif\n-\n-static int surewarehk_modexp(BIGNUM *r, const BIGNUM *a, const BIGNUM *p,\n- const BIGNUM *m, BN_CTX *ctx)\n-{\n- int ret \u003d 0;\n- char msg[64] \u003d \u0022ENGINE_modexp\u0022;\n- if (!p_surewarehk_Mod_Exp) {\n- SUREWAREerr(SUREWARE_F_SUREWAREHK_MODEXP, ENGINE_R_NOT_INITIALISED);\n- } else if (r) {\n- bn_expand2(r, m-\u003etop);\n- if (r-\u003edmax \u003d\u003d m-\u003etop) {\n- /* do it */\n- ret \u003d p_surewarehk_Mod_Exp(msg,\n- m-\u003etop * sizeof(BN_ULONG),\n- (unsigned long *)m-\u003ed,\n- p-\u003etop * sizeof(BN_ULONG),\n- (unsigned long *)p-\u003ed,\n- a-\u003etop * sizeof(BN_ULONG),\n- (unsigned long *)a-\u003ed,\n- (unsigned long *)r-\u003ed);\n- surewarehk_error_handling(msg, SUREWARE_F_SUREWAREHK_MODEXP, ret);\n- if (ret \u003d\u003d 1) {\n- /* normalise result */\n- r-\u003etop \u003d m-\u003etop;\n- bn_fix_top(r);\n- }\n- }\n- }\n- return ret;\n-}\n-# endif /* !OPENSSL_NO_HW_SUREWARE */\n-#endif /* !OPENSSL_NO_HW */\ndiff --git a/engines/e_sureware.ec b/engines/e_sureware.ec\ndeleted file mode 100644\nindex 3d266b8..0000000\n--- a/engines/e_sureware.ec\n+++ /dev/null\n@@ -1 +0,0 @@\n-L SUREWARE\te_sureware_err.h\t\te_sureware_err.c\ndiff --git a/engines/e_sureware_err.c b/engines/e_sureware_err.c\ndeleted file mode 100644\nindex f6f7eff..0000000\n--- a/engines/e_sureware_err.c\n+++ /dev/null\n@@ -1,154 +0,0 @@\n-/* e_sureware_err.c */\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 1999-2005 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@OpenSSL.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-/*\n- * NOTE: this file was auto generated by the mkerr.pl script: any changes\n- * made to it will be overwritten when the script next updates this file,\n- * only reason strings will be preserved.\n- */\n-\n-#include \u003cstdio.h\u003e\n-#include \u003copenssl/err.h\u003e\n-#include \u0022e_sureware_err.h\u0022\n-\n-/* BEGIN ERROR CODES */\n-#ifndef OPENSSL_NO_ERR\n-\n-# define ERR_FUNC(func) ERR_PACK(0,func,0)\n-# define ERR_REASON(reason) ERR_PACK(0,0,reason)\n-\n-static ERR_STRING_DATA SUREWARE_str_functs[] \u003d {\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_CTRL), \u0022SUREWAREHK_CTRL\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_DH_EX_FREE), \u0022SUREWAREHK_DH_EX_FREE\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_DSA_DO_SIGN), \u0022SUREWAREHK_DSA_DO_SIGN\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_EX_FREE), \u0022SUREWAREHK_EX_FREE\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_FINISH), \u0022SUREWAREHK_FINISH\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_INIT), \u0022SUREWAREHK_INIT\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_LOAD_PRIVKEY), \u0022SUREWAREHK_LOAD_PRIVKEY\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_LOAD_PUBKEY), \u0022SUREWAREHK_LOAD_PUBKEY\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_MODEXP), \u0022SUREWAREHK_MODEXP\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_RAND_BYTES), \u0022SUREWAREHK_RAND_BYTES\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_RAND_SEED), \u0022SUREWAREHK_RAND_SEED\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC), \u0022SUREWAREHK_RSA_PRIV_DEC\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWAREHK_RSA_SIGN), \u0022SUREWAREHK_RSA_SIGN\u0022},\n- {ERR_FUNC(SUREWARE_F_SUREWARE_LOAD_PUBLIC), \u0022SUREWARE_LOAD_PUBLIC\u0022},\n- {0, NULL}\n-};\n-\n-static ERR_STRING_DATA SUREWARE_str_reasons[] \u003d {\n- {ERR_REASON(SUREWARE_R_BIO_WAS_FREED), \u0022bio was freed\u0022},\n- {ERR_REASON(SUREWARE_R_MISSING_KEY_COMPONENTS), \u0022missing key components\u0022},\n- {ERR_REASON(SUREWARE_R_PADDING_CHECK_FAILED), \u0022padding check failed\u0022},\n- {ERR_REASON(SUREWARE_R_REQUEST_FAILED), \u0022request failed\u0022},\n- {ERR_REASON(SUREWARE_R_REQUEST_FALLBACK), \u0022request fallback\u0022},\n- {ERR_REASON(SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL),\n- \u0022size too large or too small\u0022},\n- {ERR_REASON(SUREWARE_R_UNIT_FAILURE), \u0022unit failure\u0022},\n- {ERR_REASON(SUREWARE_R_UNKNOWN_PADDING_TYPE), \u0022unknown padding type\u0022},\n- {0, NULL}\n-};\n-\n-#endif\n-\n-#ifdef SUREWARE_LIB_NAME\n-static ERR_STRING_DATA SUREWARE_lib_name[] \u003d {\n- {0, SUREWARE_LIB_NAME},\n- {0, NULL}\n-};\n-#endif\n-\n-static int SUREWARE_lib_error_code \u003d 0;\n-static int SUREWARE_error_init \u003d 1;\n-\n-static void ERR_load_SUREWARE_strings(void)\n-{\n- if (SUREWARE_lib_error_code \u003d\u003d 0)\n- SUREWARE_lib_error_code \u003d ERR_get_next_error_library();\n-\n- if (SUREWARE_error_init) {\n- SUREWARE_error_init \u003d 0;\n-#ifndef OPENSSL_NO_ERR\n- ERR_load_strings(SUREWARE_lib_error_code, SUREWARE_str_functs);\n- ERR_load_strings(SUREWARE_lib_error_code, SUREWARE_str_reasons);\n-#endif\n-\n-#ifdef SUREWARE_LIB_NAME\n- SUREWARE_lib_name-\u003eerror \u003d ERR_PACK(SUREWARE_lib_error_code, 0, 0);\n- ERR_load_strings(0, SUREWARE_lib_name);\n-#endif\n- }\n-}\n-\n-static void ERR_unload_SUREWARE_strings(void)\n-{\n- if (SUREWARE_error_init \u003d\u003d 0) {\n-#ifndef OPENSSL_NO_ERR\n- ERR_unload_strings(SUREWARE_lib_error_code, SUREWARE_str_functs);\n- ERR_unload_strings(SUREWARE_lib_error_code, SUREWARE_str_reasons);\n-#endif\n-\n-#ifdef SUREWARE_LIB_NAME\n- ERR_unload_strings(0, SUREWARE_lib_name);\n-#endif\n- SUREWARE_error_init \u003d 1;\n- }\n-}\n-\n-static void ERR_SUREWARE_error(int function, int reason, char *file, int line)\n-{\n- if (SUREWARE_lib_error_code \u003d\u003d 0)\n- SUREWARE_lib_error_code \u003d ERR_get_next_error_library();\n- ERR_PUT_error(SUREWARE_lib_error_code, function, reason, file, line);\n-}\ndiff --git a/engines/e_sureware_err.h b/engines/e_sureware_err.h\ndeleted file mode 100644\nindex bef8623..0000000\n--- a/engines/e_sureware_err.h\n+++ /dev/null\n@@ -1,104 +0,0 @@\n-/* \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- * Copyright (c) 2001 The OpenSSL Project. All rights reserved.\n- *\n- * Redistribution and use in source and binary forms, with or without\n- * modification, are permitted provided that the following conditions\n- * are met:\n- *\n- * 1. Redistributions of source code must retain the above copyright\n- * notice, this list of conditions and the following disclaimer.\n- *\n- * 2. Redistributions in binary form must reproduce the above copyright\n- * notice, this list of conditions and the following disclaimer in\n- * the documentation and/or other materials provided with the\n- * distribution.\n- *\n- * 3. All advertising materials mentioning features or use of this\n- * software must display the following acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit. (http://www.openssl.org/)\u0022\n- *\n- * 4. The names \u0022OpenSSL Toolkit\u0022 and \u0022OpenSSL Project\u0022 must not be used to\n- * endorse or promote products derived from this software without\n- * prior written permission. For written permission, please contact\n- * openssl-core@openssl.org.\n- *\n- * 5. Products derived from this software may not be called \u0022OpenSSL\u0022\n- * nor may \u0022OpenSSL\u0022 appear in their names without prior written\n- * permission of the OpenSSL Project.\n- *\n- * 6. Redistributions of any form whatsoever must retain the following\n- * acknowledgment:\n- * \u0022This product includes software developed by the OpenSSL Project\n- * for use in the OpenSSL Toolkit (http://www.openssl.org/)\u0022\n- *\n- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY\n- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\n- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR\n- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT\n- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,\n- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED\n- * OF THE POSSIBILITY OF SUCH DAMAGE.\n- * \u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\n- *\n- * This product includes cryptographic software written by Eric Young\n- * (eay@cryptsoft.com). This product includes software written by Tim\n- * Hudson (tjh@cryptsoft.com).\n- *\n- */\n-\n-#ifndef HEADER_SUREWARE_ERR_H\n-# define HEADER_SUREWARE_ERR_H\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif\n-\n-/* BEGIN ERROR CODES */\n-/*\n- * The following lines are auto generated by the script mkerr.pl. Any changes\n- * made after this point may be overwritten when the script is next run.\n- */\n-static void ERR_load_SUREWARE_strings(void);\n-static void ERR_unload_SUREWARE_strings(void);\n-static void ERR_SUREWARE_error(int function, int reason, char *file,\n- int line);\n-# define SUREWAREerr(f,r) ERR_SUREWARE_error((f),(r),__FILE__,__LINE__)\n-\n-/* Error codes for the SUREWARE functions. */\n-\n-/* Function codes. */\n-# define SUREWARE_F_SUREWAREHK_CTRL 100\n-# define SUREWARE_F_SUREWAREHK_DH_EX_FREE 112\n-# define SUREWARE_F_SUREWAREHK_DSA_DO_SIGN 101\n-# define SUREWARE_F_SUREWAREHK_EX_FREE 102\n-# define SUREWARE_F_SUREWAREHK_FINISH 103\n-# define SUREWARE_F_SUREWAREHK_INIT 104\n-# define SUREWARE_F_SUREWAREHK_LOAD_PRIVKEY 105\n-# define SUREWARE_F_SUREWAREHK_LOAD_PUBKEY 113\n-# define SUREWARE_F_SUREWAREHK_MODEXP 107\n-# define SUREWARE_F_SUREWAREHK_RAND_BYTES 108\n-# define SUREWARE_F_SUREWAREHK_RAND_SEED 109\n-# define SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC 110\n-# define SUREWARE_F_SUREWAREHK_RSA_SIGN 111\n-# define SUREWARE_F_SUREWARE_LOAD_PUBLIC 106\n-\n-/* Reason codes. */\n-# define SUREWARE_R_BIO_WAS_FREED 100\n-# define SUREWARE_R_MISSING_KEY_COMPONENTS 105\n-# define SUREWARE_R_PADDING_CHECK_FAILED 106\n-# define SUREWARE_R_REQUEST_FAILED 101\n-# define SUREWARE_R_REQUEST_FALLBACK 102\n-# define SUREWARE_R_SIZE_TOO_LARGE_OR_TOO_SMALL 103\n-# define SUREWARE_R_UNIT_FAILURE 104\n-# define SUREWARE_R_UNKNOWN_PADDING_TYPE 107\n-\n-#ifdef __cplusplus\n-}\n-#endif\n-#endif\ndiff --git a/engines/makeengines.com b/engines/makeengines.com\nindex a0bd168..944e415 100644\n--- a/engines/makeengines.com\n+++ b/engines/makeengines.com\n@@ -94,7 +94,7 @@ $! library that isn't necessarely ported to VMS.\n $!\n $ ENGINES \u003d \u0022,\u0022 + P6\n $ IF ENGINES .EQS. \u0022,\u0022 THEN -\n-\tENGINES \u003d \u0022,4758cca,padlock,capi,\u0022\n+\tENGINES \u003d \u0022,padlock,capi,\u0022\n $!\n $! GOST requires a 64-bit integer type, unavailable on VAX.\n $!\n@@ -155,7 +155,6 @@ $ ENGINE_ \u003d \u0022engine_vector.mar\u0022\n $ TV_OBJ_NAME \u003d OBJ_DIR + F$PARSE(ENGINE_,,,\u0022NAME\u0022,\u0022SYNTAX_ONLY\u0022) + \u0022.OBJ\u0022\n $ TV_OBJ \u003d \u0022,''TV_OBJ_NAME'\u0022\n $ ENDIF\n-$ ENGINE_4758CCA \u003d \u0022e_4758cca\u0022\n $ ENGINE_padlock \u003d \u0022e_padlock\u0022\n $ ENGINE_capi \u003d \u0022e_capi\u0022\n $ \ndiff --git a/engines/vendor_defns/aep.h b/engines/vendor_defns/aep.h\ndeleted file mode 100644\nindex 04ab87e..0000000\n--- a/engines/vendor_defns/aep.h\n+++ /dev/null\n@@ -1,235 +0,0 @@\n-/*\n- * This header declares the necessary definitions for using the\n- * exponentiation acceleration capabilities, and rnd number generation of the\n- * AEP card.\n- */\n-\n-/*\n- *\n- * Some AEP defines\n- *\n- */\n-\n-/*\n- * Successful return value\n- */\n-#define AEP_R_OK 0x00000000\n-\n-/*\n- * Miscelleanous unsuccessful return value\n- */\n-#define AEP_R_GENERAL_ERROR 0x10000001\n-\n-/*\n- * Insufficient host memory\n- */\n-#define AEP_R_HOST_MEMORY 0x10000002\n-\n-#define AEP_R_FUNCTION_FAILED 0x10000006\n-\n-/*\n- * Invalid arguments in function call\n- */\n-#define AEP_R_ARGUMENTS_BAD 0x10020000\n-\n-#define AEP_R_NO_TARGET_RESOURCES 0x10030000\n-\n-/*\n- * Error occuring on socket operation\n- */\n-#define AEP_R_SOCKERROR 0x10000010\n-\n-/*\n- * Socket has been closed from the other end\n- */\n-#define AEP_R_SOCKEOF 0x10000011\n-\n-/*\n- * Invalid handles\n- */\n-#define AEP_R_CONNECTION_HANDLE_INVALID 0x100000B3\n-\n-#define AEP_R_TRANSACTION_HANDLE_INVALID 0x10040000\n-\n-/*\n- * Transaction has not yet returned from accelerator\n- */\n-#define AEP_R_TRANSACTION_NOT_READY 0x00010000\n-\n-/*\n- * There is already a thread waiting on this transaction\n- */\n-#define AEP_R_TRANSACTION_CLAIMED 0x10050000\n-\n-/*\n- * The transaction timed out\n- */\n-#define AEP_R_TIMED_OUT 0x10060000\n-\n-#define AEP_R_FXN_NOT_IMPLEMENTED 0x10070000\n-\n-#define AEP_R_TARGET_ERROR 0x10080000\n-\n-/*\n- * Error in the AEP daemon process\n- */\n-#define AEP_R_DAEMON_ERROR 0x10090000\n-\n-/*\n- * Invalid ctx id\n- */\n-#define AEP_R_INVALID_CTX_ID 0x10009000\n-\n-#define AEP_R_NO_KEY_MANAGER 0x1000a000\n-\n-/*\n- * Error obtaining a mutex\n- */\n-#define AEP_R_MUTEX_BAD 0x000001A0\n-\n-/*\n- * Fxn call before AEP_Initialise ot after AEP_Finialise\n- */\n-#define AEP_R_AEPAPI_NOT_INITIALIZED 0x10000190\n-\n-/*\n- * AEP_Initialise has already been called\n- */\n-#define AEP_R_AEPAPI_ALREADY_INITIALIZED 0x10000191\n-\n-/*\n- * Maximum number of connections to daemon reached\n- */\n-#define AEP_R_NO_MORE_CONNECTION_HNDLS 0x10000200\n-\n-/*\n- *\n- * Some AEP Type definitions\n- *\n- */\n-\n-/* an unsigned 8-bit value */\n-typedef unsigned char AEP_U8;\n-\n-/* an unsigned 8-bit character */\n-typedef char AEP_CHAR;\n-\n-/* a BYTE-sized Boolean flag */\n-typedef AEP_U8 AEP_BBOOL;\n-\n-/*\n- * Unsigned value, at least 16 bits long\n- */\n-typedef unsigned short AEP_U16;\n-\n-/* an unsigned value, at least 32 bits long */\n-#ifdef SIXTY_FOUR_BIT_LONG\n-typedef unsigned int AEP_U32;\n-#else\n-typedef unsigned long AEP_U32;\n-#endif\n-\n-#ifdef SIXTY_FOUR_BIT_LONG\n-typedef unsigned long AEP_U64;\n-#else\n-typedef struct {\n- unsigned long l1, l2;\n-} AEP_U64;\n-#endif\n-\n-/* at least 32 bits; each bit is a Boolean flag */\n-typedef AEP_U32 AEP_FLAGS;\n-\n-typedef AEP_U8 *AEP_U8_PTR;\n-typedef AEP_CHAR *AEP_CHAR_PTR;\n-typedef AEP_U32 *AEP_U32_PTR;\n-typedef AEP_U64 *AEP_U64_PTR;\n-typedef void *AEP_VOID_PTR;\n-\n-/* Pointer to a AEP_VOID_PTR-- i.e., pointer to pointer to void */\n-typedef AEP_VOID_PTR *AEP_VOID_PTR_PTR;\n-\n-/*\n- * Used to identify an AEP connection handle\n- */\n-typedef AEP_U32 AEP_CONNECTION_HNDL;\n-\n-/*\n- * Pointer to an AEP connection handle\n- */\n-typedef AEP_CONNECTION_HNDL *AEP_CONNECTION_HNDL_PTR;\n-\n-/*\n- * Used by an application (in conjunction with the apps process id) to\n- * identify an individual transaction\n- */\n-typedef AEP_U32 AEP_TRANSACTION_ID;\n-\n-/*\n- * Pointer to an applications transaction identifier\n- */\n-typedef AEP_TRANSACTION_ID *AEP_TRANSACTION_ID_PTR;\n-\n-/*\n- * Return value type\n- */\n-typedef AEP_U32 AEP_RV;\n-\n-#define MAX_PROCESS_CONNECTIONS 256\n-\n-#define RAND_BLK_SIZE 1024\n-\n-typedef enum {\n- NotConnected \u003d 0,\n- Connected \u003d 1,\n- InUse \u003d 2\n-} AEP_CONNECTION_STATE;\n-\n-typedef struct AEP_CONNECTION_ENTRY {\n- AEP_CONNECTION_STATE conn_state;\n- AEP_CONNECTION_HNDL conn_hndl;\n-} AEP_CONNECTION_ENTRY;\n-\n-typedef AEP_RV t_AEP_OpenConnection(AEP_CONNECTION_HNDL_PTR phConnection);\n-typedef AEP_RV t_AEP_CloseConnection(AEP_CONNECTION_HNDL hConnection);\n-\n-typedef AEP_RV t_AEP_ModExp(AEP_CONNECTION_HNDL hConnection,\n- AEP_VOID_PTR pA, AEP_VOID_PTR pP,\n- AEP_VOID_PTR pN,\n- AEP_VOID_PTR pResult,\n- AEP_TRANSACTION_ID *pidTransID);\n-\n-typedef AEP_RV t_AEP_ModExpCrt(AEP_CONNECTION_HNDL hConnection,\n- AEP_VOID_PTR pA, AEP_VOID_PTR pP,\n- AEP_VOID_PTR pQ,\n- AEP_VOID_PTR pDmp1, AEP_VOID_PTR pDmq1,\n- AEP_VOID_PTR pIqmp,\n- AEP_VOID_PTR pResult,\n- AEP_TRANSACTION_ID *pidTransID);\n-\n-#ifdef AEPRAND\n-typedef AEP_RV t_AEP_GenRandom(AEP_CONNECTION_HNDL hConnection,\n- AEP_U32 Len,\n- AEP_U32 Type,\n- AEP_VOID_PTR pResult,\n- AEP_TRANSACTION_ID *pidTransID);\n-#endif\n-\n-typedef AEP_RV t_AEP_Initialize(AEP_VOID_PTR pInitArgs);\n-typedef AEP_RV t_AEP_Finalize(void);\n-typedef AEP_RV t_AEP_SetBNCallBacks(AEP_RV (*GetBigNumSizeFunc)\n- (AEP_VOID_PTR ArbBigNum,\n- AEP_U32 *BigNumSize),\n- AEP_RV (*MakeAEPBigNumFunc) (AEP_VOID_PTR\n- ArbBigNum,\n- AEP_U32\n- BigNumSize,\n- unsigned char\n- *AEP_BigNum),\n- AEP_RV (*ConverAEPBigNumFunc) (void\n- *ArbBigNum,\n- AEP_U32\n- BigNumSize,\n- unsigned\n- char\n- *AEP_BigNum));\ndiff --git a/engines/vendor_defns/atalla.h b/engines/vendor_defns/atalla.h\ndeleted file mode 100644\nindex 60e7eda..0000000\n--- a/engines/vendor_defns/atalla.h\n+++ /dev/null\n@@ -1,44 +0,0 @@\n-/*\n- * This header declares the necessary definitions for using the\n- * exponentiation acceleration capabilities of Atalla cards. The only\n- * cryptographic operation is performed by \u0022ASI_RSAPrivateKeyOpFn\u0022 and this\n- * takes a structure that defines an \u0022RSA private key\u0022. However, it is really\n- * only performing a regular mod_exp using the supplied modulus and exponent\n- * - no CRT form is being used. Hence, it is a generic mod_exp function in\n- * disguise, and we use it as such. Thanks to the people at Atalla for\n- * letting me know these definitions are fine and that they can be reproduced\n- * here. Geoff.\n- */\n-\n-typedef struct ItemStr {\n- unsigned char *data;\n- int len;\n-} Item;\n-\n-typedef struct RSAPrivateKeyStr {\n- void *reserved;\n- Item version;\n- Item modulus;\n- Item publicExponent;\n- Item privateExponent;\n- Item prime[2];\n- Item exponent[2];\n- Item coefficient;\n-} RSAPrivateKey;\n-\n-/*\n- * Predeclare the function pointer types that we dynamically load from the\n- * DSO. These use the same names and form that Ben's original support code\n- * had (in crypto/bn/bn_exp.c) unless of course I've inadvertently changed\n- * the style somewhere along the way!\n- */\n-\n-typedef int tfnASI_GetPerformanceStatistics(int reset_flag,\n- unsigned int *ret_buf);\n-\n-typedef int tfnASI_GetHardwareConfig(long card_num, unsigned int *ret_buf);\n-\n-typedef int tfnASI_RSAPrivateKeyOpFn(RSAPrivateKey * rsaKey,\n- unsigned char *output,\n- unsigned char *input,\n- unsigned int modulus_len);\ndiff --git a/engines/vendor_defns/cswift.h b/engines/vendor_defns/cswift.h\ndeleted file mode 100644\nindex a5af762..0000000\n--- a/engines/vendor_defns/cswift.h\n+++ /dev/null\n@@ -1,223 +0,0 @@\n-/*\n- * Attribution notice: Rainbow have generously allowed me to reproduce the\n- * necessary definitions here from their API. This means the support can\n- * build independently of whether application builders have the API or\n- * hardware. This will allow developers to easily produce software that has\n- * latent hardware support for any users that have accelertors installed,\n- * without the developers themselves needing anything extra. I have only\n- * clipped the parts from the CryptoSwift header files that are (or seem)\n- * relevant to the CryptoSwift support code. This is simply to keep the file\n- * sizes reasonable. [Geoff]\n- */\n-\n-/*\n- * NB: These type widths do *not* seem right in general, in particular\n- * they're not terribly friendly to 64-bit architectures (unsigned long) will\n- * be 64-bit on IA-64 for a start. I'm leaving these alone as they agree with\n- * Rainbow's API and this will only be called into question on platforms with\n- * Rainbow support anyway! ;-)\n- */\n-\n-#ifdef __cplusplus\n-extern \u0022C\u0022 {\n-#endif /* __cplusplus */\n-\n- typedef long SW_STATUS; /* status */\n- typedef unsigned char SW_BYTE; /* 8 bit byte */\n- typedef unsigned short SW_U16; /* 16 bit number */\n-#if defined(_IRIX)\n-# include \u003csgidefs.h\u003e\n- typedef __uint32_t SW_U32;\n-#else\n- typedef unsigned long SW_U32; /* 32 bit integer */\n-#endif\n-\n-#if defined(OPENSSL_SYS_WIN32)\n- typedef struct _SW_U64 {\n- SW_U32 low32;\n- SW_U32 high32;\n- } SW_U64; /* 64 bit integer */\n-#else /* Unix variants */\n- typedef struct _SW_U64 {\n- SW_U32 low32;\n- SW_U32 high32;\n- } SW_U64; /* 64 bit integer */\n-#endif\n-\n-/* status codes */\n-#define SW_OK (0L)\n-#define SW_ERR_BASE (-10000L)\n-#define SW_ERR_NO_CARD (SW_ERR_BASE-1) /* The Card is not present */\n-#define SW_ERR_CARD_NOT_READY (SW_ERR_BASE-2) /* The card has not powered */\n- /* up yet */\n-#define SW_ERR_TIME_OUT (SW_ERR_BASE-3) /* Execution of a command */\n- /* time out */\n-#define SW_ERR_NO_EXECUTE (SW_ERR_BASE-4) /* The Card failed to */\n- /* execute the command */\n-#define SW_ERR_INPUT_NULL_PTR (SW_ERR_BASE-5) /* a required pointer is */\n- /* NULL */\n-#define SW_ERR_INPUT_SIZE (SW_ERR_BASE-6) /* size is invalid, too */\n- /* small, too large. */\n-#define SW_ERR_INVALID_HANDLE (SW_ERR_BASE-7) /* Invalid SW_ACC_CONTEXT */\n- /* handle */\n-#define SW_ERR_PENDING (SW_ERR_BASE-8) /* A request is already out- */\n- /* standing at this */\n- /* context handle */\n-#define SW_ERR_AVAILABLE (SW_ERR_BASE-9) /* A result is available. */\n-#define SW_ERR_NO_PENDING (SW_ERR_BASE-10) /* No request is pending. */\n-#define SW_ERR_NO_MEMORY (SW_ERR_BASE-11) /* Not enough memory */\n-#define SW_ERR_BAD_ALGORITHM (SW_ERR_BASE-12) /* Invalid algorithm type */\n- /* in SW_PARAM structure */\n-#define SW_ERR_MISSING_KEY (SW_ERR_BASE-13) /* No key is associated with */\n- /* context. */\n- /* swAttachKeyParam() is */\n- /* not called. */\n-#define SW_ERR_KEY_CMD_MISMATCH \u005c\n- (SW_ERR_BASE-14) /* Cannot perform requested */\n- /* SW_COMMAND_CODE since */\n- /* key attached via */\n- /* swAttachKeyParam() */\n- /* cannot be used for this */\n- /* SW_COMMAND_CODE. */\n-#define SW_ERR_NOT_IMPLEMENTED \u005c\n- (SW_ERR_BASE-15) /* Not implemented */\n-#define SW_ERR_BAD_COMMAND (SW_ERR_BASE-16) /* Bad command code */\n-#define SW_ERR_BAD_ITEM_SIZE (SW_ERR_BASE-17) /* too small or too large in */\n- /* the \u0022initems\u0022 or */\n- /* \u0022outitems\u0022. */\n-#define SW_ERR_BAD_ACCNUM (SW_ERR_BASE-18) /* Bad accelerator number */\n-#define SW_ERR_SELFTEST_FAIL (SW_ERR_BASE-19) /* At least one of the self */\n- /* test fail, look at the */\n- /* selfTestBitmap in */\n- /* SW_ACCELERATOR_INFO for */\n- /* details. */\n-#define SW_ERR_MISALIGN (SW_ERR_BASE-20) /* Certain alogrithms require */\n- /* key materials aligned */\n- /* in certain order, e.g. */\n- /* 128 bit for CRT */\n-#define SW_ERR_OUTPUT_NULL_PTR \u005c\n- (SW_ERR_BASE-21) /* a required pointer is */\n- /* NULL */\n-#define SW_ERR_OUTPUT_SIZE \u005c\n- (SW_ERR_BASE-22) /* size is invalid, too */\n- /* small, too large. */\n-#define SW_ERR_FIRMWARE_CHECKSUM \u005c\n- (SW_ERR_BASE-23) /* firmware checksum mismatch */\n- /* download failed. */\n-#define SW_ERR_UNKNOWN_FIRMWARE \u005c\n- (SW_ERR_BASE-24) /* unknown firmware error */\n-#define SW_ERR_INTERRUPT (SW_ERR_BASE-25) /* request is abort when */\n- /* it's waiting to be */\n- /* completed. */\n-#define SW_ERR_NVWRITE_FAIL (SW_ERR_BASE-26) /* error in writing to Non- */\n- /* volatile memory */\n-#define SW_ERR_NVWRITE_RANGE (SW_ERR_BASE-27) /* out of range error in */\n- /* writing to NV memory */\n-#define SW_ERR_RNG_ERROR (SW_ERR_BASE-28) /* Random Number Generation */\n- /* failure */\n-#define SW_ERR_DSS_FAILURE (SW_ERR_BASE-29) /* DSS Sign or Verify failure */\n-#define SW_ERR_MODEXP_FAILURE (SW_ERR_BASE-30) /* Failure in various math */\n- /* calculations */\n-#define SW_ERR_ONBOARD_MEMORY (SW_ERR_BASE-31) /* Error in accessing on - */\n- /* board memory */\n-#define SW_ERR_FIRMWARE_VERSION \u005c\n- (SW_ERR_BASE-32) /* Wrong version in firmware */\n- /* update */\n-#define SW_ERR_ZERO_WORKING_ACCELERATOR \u005c\n- (SW_ERR_BASE-44) /* All accelerators are bad */\n-\n- /* algorithm type */\n-#define SW_ALG_CRT 1\n-#define SW_ALG_EXP 2\n-#define SW_ALG_DSA 3\n-#define SW_ALG_NVDATA 4\n-\n- /* command code */\n-#define SW_CMD_MODEXP_CRT 1 /* perform Modular Exponentiation using */\n- /* Chinese Remainder Theorem (CRT) */\n-#define SW_CMD_MODEXP 2 /* perform Modular Exponentiation */\n-#define SW_CMD_DSS_SIGN 3 /* perform DSS sign */\n-#define SW_CMD_DSS_VERIFY 4 /* perform DSS verify */\n-#define SW_CMD_RAND 5 /* perform random number generation */\n-#define SW_CMD_NVREAD 6 /* perform read to nonvolatile RAM */\n-#define SW_CMD_NVWRITE 7 /* perform write to nonvolatile RAM */\n-\n- typedef SW_U32 SW_ALGTYPE; /* alogrithm type */\n- typedef SW_U32 SW_STATE; /* state */\n- typedef SW_U32 SW_COMMAND_CODE; /* command code */\n- typedef SW_U32 SW_COMMAND_BITMAP[4]; /* bitmap */\n-\n- typedef struct _SW_LARGENUMBER {\n- SW_U32 nbytes; /* number of bytes in the buffer \u0022value\u0022 */\n- SW_BYTE *value; /* the large integer as a string of */\n- /* bytes in network (big endian) order */\n- } SW_LARGENUMBER;\n-\n-#if defined(OPENSSL_SYS_WIN32)\n-# include \u003cwindows.h\u003e\n- typedef HANDLE SW_OSHANDLE; /* handle to kernel object */\n-# define SW_OS_INVALID_HANDLE INVALID_HANDLE_VALUE\n-# define SW_CALLCONV _stdcall\n-#else /* Unix variants */\n- typedef int SW_OSHANDLE; /* handle to driver */\n-# define SW_OS_INVALID_HANDLE (-1)\n-# define SW_CALLCONV\n-#endif\n-\n- typedef struct _SW_CRT {\n- SW_LARGENUMBER p; /* prime number p */\n- SW_LARGENUMBER q; /* prime number q */\n- SW_LARGENUMBER dmp1; /* exponent1 */\n- SW_LARGENUMBER dmq1; /* exponent2 */\n- SW_LARGENUMBER iqmp; /* CRT coefficient */\n- } SW_CRT;\n-\n- typedef struct _SW_EXP {\n- SW_LARGENUMBER modulus; /* modulus */\n- SW_LARGENUMBER exponent; /* exponent */\n- } SW_EXP;\n-\n- typedef struct _SW_DSA {\n- SW_LARGENUMBER p; /* */\n- SW_LARGENUMBER q; /* */\n- SW_LARGENUMBER g; /* */\n- SW_LARGENUMBER key; /* private/public key */\n- } SW_DSA;\n-\n- typedef struct _SW_NVDATA {\n- SW_U32 accnum; /* accelerator board number */\n- SW_U32 offset; /* offset in byte */\n- } SW_NVDATA;\n-\n- typedef struct _SW_PARAM {\n- SW_ALGTYPE type; /* type of the alogrithm */\n- union {\n- SW_CRT crt;\n- SW_EXP exp;\n- SW_DSA dsa;\n- SW_NVDATA nvdata;\n- } up;\n- } SW_PARAM;\n-\n- typedef SW_U32 SW_CONTEXT_HANDLE; /* opaque context handle */\n-\n- /*\n- * Now the OpenSSL bits, these function types are the for the function\n- * pointers that will bound into the Rainbow shared libraries.\n- */\n- typedef SW_STATUS SW_CALLCONV t_swAcquireAccContext(SW_CONTEXT_HANDLE\n- *hac);\n- typedef SW_STATUS SW_CALLCONV t_swAttachKeyParam(SW_CONTEXT_HANDLE hac,\n- SW_PARAM *key_params);\n- typedef SW_STATUS SW_CALLCONV t_swSimpleRequest(SW_CONTEXT_HANDLE hac,\n- SW_COMMAND_CODE cmd,\n- SW_LARGENUMBER pin[],\n- SW_U32 pin_count,\n- SW_LARGENUMBER pout[],\n- SW_U32 pout_count);\n- typedef SW_STATUS SW_CALLCONV t_swReleaseAccContext(SW_CONTEXT_HANDLE\n- hac);\n-\n-#ifdef __cplusplus\n-}\n-#endif /* __cplusplus */\ndiff --git a/engines/vendor_defns/hw_4758_cca.h b/engines/vendor_defns/hw_4758_cca.h\ndeleted file mode 100644\nindex 235543a..0000000\n--- a/engines/vendor_defns/hw_4758_cca.h\n+++ /dev/null\n@@ -1,150 +0,0 @@\n-/**********************************************************************/\n-/* */\n-/* Prototypes of the CCA verbs used by the 4758 CCA openssl driver */\n-/* */\n-/* Maurice Gittens \u003cmaurice@gittens.nl\u003e */\n-/* */\n-/**********************************************************************/\n-\n-#ifndef __HW_4758_CCA__\n-# define __HW_4758_CCA__\n-\n-/*\n- * Only WIN32 support for now\n- */\n-# if defined(WIN32)\n-\n-# define CCA_LIB_NAME \u0022CSUNSAPI\u0022\n-\n-# define CSNDPKX \u0022CSNDPKX_32\u0022\n-# define CSNDKRR \u0022CSNDKRR_32\u0022\n-# define CSNDPKE \u0022CSNDPKE_32\u0022\n-# define CSNDPKD \u0022CSNDPKD_32\u0022\n-# define CSNDDSV \u0022CSNDDSV_32\u0022\n-# define CSNDDSG \u0022CSNDDSG_32\u0022\n-# define CSNBRNG \u0022CSNBRNG_32\u0022\n-\n-# define SECURITYAPI __stdcall\n-# else\n- /*\n- * Fixme!! Find out the values of these constants for other platforms.\n- */\n-# define CCA_LIB_NAME \u0022CSUNSAPI\u0022\n-\n-# define CSNDPKX \u0022CSNDPKX\u0022\n-# define CSNDKRR \u0022CSNDKRR\u0022\n-# define CSNDPKE \u0022CSNDPKE\u0022\n-# define CSNDPKD \u0022CSNDPKD\u0022\n-# define CSNDDSV \u0022CSNDDSV\u0022\n-# define CSNDDSG \u0022CSNDDSG\u0022\n-# define CSNBRNG \u0022CSNBRNG\u0022\n-\n-# define SECURITYAPI\n-# endif\n-\n-/*\n- * security API prototypes\n- */\n-\n-/* PKA Key Record Read */\n-typedef void (SECURITYAPI * F_KEYRECORDREAD)\n- (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char *exit_data,\n- long *rule_array_count,\n- unsigned char *rule_array,\n- unsigned char *key_label, long *key_token_length, unsigned char *key_token);\n-\n-/* Random Number Generate */\n-typedef void (SECURITYAPI * F_RANDOMNUMBERGENERATE)\n- (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char *exit_data,\n- unsigned char *form, unsigned char *random_number);\n-\n-/* Digital Signature Generate */\n-typedef void (SECURITYAPI * F_DIGITALSIGNATUREGENERATE)\n- (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char *exit_data,\n- long *rule_array_count,\n- unsigned char *rule_array,\n- long *PKA_private_key_id_length,\n- unsigned char *PKA_private_key_id,\n- long *hash_length,\n- unsigned char *hash,\n- long *signature_field_length,\n- long *signature_bit_length, unsigned char *signature_field);\n-\n-/* Digital Signature Verify */\n-typedef void (SECURITYAPI * F_DIGITALSIGNATUREVERIFY) (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char\n- *exit_data,\n- long *rule_array_count,\n- unsigned char\n- *rule_array,\n- long\n- *PKA_public_key_id_length,\n- unsigned char\n- *PKA_public_key_id,\n- long *hash_length,\n- unsigned char *hash,\n- long\n- *signature_field_length,\n- unsigned char\n- *signature_field);\n-\n-/* PKA Public Key Extract */\n-typedef void (SECURITYAPI * F_PUBLICKEYEXTRACT) (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char *exit_data,\n- long *rule_array_count,\n- unsigned char *rule_array,\n- long\n- *source_key_identifier_length,\n- unsigned char\n- *source_key_identifier,\n- long\n- *target_key_token_length,\n- unsigned char\n- *target_key_token);\n-\n-/* PKA Encrypt */\n-typedef void (SECURITYAPI * F_PKAENCRYPT)\n- (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char *exit_data,\n- long *rule_array_count,\n- unsigned char *rule_array,\n- long *key_value_length,\n- unsigned char *key_value,\n- long *data_struct_length,\n- unsigned char *data_struct,\n- long *RSA_public_key_length,\n- unsigned char *RSA_public_key,\n- long *RSA_encipher_length, unsigned char *RSA_encipher);\n-\n-/* PKA Decrypt */\n-typedef void (SECURITYAPI * F_PKADECRYPT)\n- (long *return_code,\n- long *reason_code,\n- long *exit_data_length,\n- unsigned char *exit_data,\n- long *rule_array_count,\n- unsigned char *rule_array,\n- long *enciphered_key_length,\n- unsigned char *enciphered_key,\n- long *data_struct_length,\n- unsigned char *data_struct,\n- long *RSA_private_key_length,\n- unsigned char *RSA_private_key,\n- long *key_value_length, unsigned char *key_value);\n-\n-#endif\ndiff --git a/engines/vendor_defns/sureware.h b/engines/vendor_defns/sureware.h\ndeleted file mode 100644\nindex b1423e1..0000000\n--- a/engines/vendor_defns/sureware.h\n+++ /dev/null\n@@ -1,250 +0,0 @@\n-/*-\n- * Written by Corinne Dive-Reclus(cdive@baltimore.com)\n- *\n- * Copyright@2001 Baltimore Technologies Ltd.\n- *\n- * THIS FILE IS PROVIDED BY BALTIMORE TECHNOLOGIES ``AS IS'' AND\n- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n- * ARE DISCLAIMED. IN NO EVENT SHALL BALTIMORE TECHNOLOGIES BE LIABLE\n- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\n- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\n- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\n- * SUCH DAMAGE.\n- */\n-\n-#ifdef WIN32\n-# define SW_EXPORT __declspec ( dllexport )\n-#else\n-# define SW_EXPORT\n-#endif\n-\n-/*\n- * List of exposed SureWare errors\n- */\n-#define SUREWAREHOOK_ERROR_FAILED -1\n-#define SUREWAREHOOK_ERROR_FALLBACK -2\n-#define SUREWAREHOOK_ERROR_UNIT_FAILURE -3\n-#define SUREWAREHOOK_ERROR_DATA_SIZE -4\n-#define SUREWAREHOOK_ERROR_INVALID_PAD -5\n-/*-\n-* -----------------WARNING-----------------------------------\n-* In all the following functions:\n-* msg is a string with at least 24 bytes free.\n-* A 24 bytes string will be concatenated to the existing content of msg.\n-*/\n-/*-\n-* SureWare Initialisation function\n-* in param threadsafe, if !\u003d0, thread safe enabled\n-* return SureWareHOOK_ERROR_UNIT_FAILURE if failure, 1 if success\n-*/\n-typedef int SureWareHook_Init_t(char *const msg, int threadsafe);\n-extern SW_EXPORT SureWareHook_Init_t SureWareHook_Init;\n-/*-\n-* SureWare Finish function\n-*/\n-typedef void SureWareHook_Finish_t(void);\n-extern SW_EXPORT SureWareHook_Finish_t SureWareHook_Finish;\n-/*-\n-* PRE_CONDITION:\n-* DO NOT CALL ANY OF THE FOLLOWING FUNCTIONS IN CASE OF INIT FAILURE\n-*/\n-/*-\n-* SureWare RAND Bytes function\n-* In case of failure, the content of buf is unpredictable.\n-* return 1 if success\n-* SureWareHOOK_ERROR_FALLBACK if function not available in hardware\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure\n-* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf\n-*\n-* in/out param buf : a num bytes long buffer where random bytes will be put\n-* in param num : the number of bytes into buf\n-*/\n-typedef int SureWareHook_Rand_Bytes_t(char *const msg, unsigned char *buf,\n- int num);\n-extern SW_EXPORT SureWareHook_Rand_Bytes_t SureWareHook_Rand_Bytes;\n-\n-/*-\n-* SureWare RAND Seed function\n-* Adds some seed to the Hardware Random Number Generator\n-* return 1 if success\n-* SureWareHOOK_ERROR_FALLBACK if function not available in hardware\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure\n-* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf\n-*\n-* in param buf : the seed to add into the HRNG\n-* in param num : the number of bytes into buf\n-*/\n-typedef int SureWareHook_Rand_Seed_t(char *const msg, const void *buf,\n- int num);\n-extern SW_EXPORT SureWareHook_Rand_Seed_t SureWareHook_Rand_Seed;\n-\n-/*-\n-* SureWare Load Private Key function\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* No hardware is contact for this function.\n-*\n-* in param key_id :the name of the private protected key file without the extension\n- \u0022.sws\u0022\n-* out param hptr : a pointer to a buffer allocated by SureWare_Hook\n-* out param num: the effective key length in bytes\n-* out param keytype: 1 if RSA 2 if DSA\n-*/\n-typedef int SureWareHook_Load_Privkey_t(char *const msg, const char *key_id,\n- char **hptr, unsigned long *num,\n- char *keytype);\n-extern SW_EXPORT SureWareHook_Load_Privkey_t SureWareHook_Load_Privkey;\n-\n-/*-\n-* SureWare Info Public Key function\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* No hardware is contact for this function.\n-*\n-* in param key_id :the name of the private protected key file without the extension\n- \u0022.swp\u0022\n-* out param hptr : a pointer to a buffer allocated by SureWare_Hook\n-* out param num: the effective key length in bytes\n-* out param keytype: 1 if RSA 2 if DSA\n-*/\n-typedef int SureWareHook_Info_Pubkey_t(char *const msg, const char *key_id,\n- unsigned long *num, char *keytype);\n-extern SW_EXPORT SureWareHook_Info_Pubkey_t SureWareHook_Info_Pubkey;\n-\n-/*-\n-* SureWare Load Public Key function\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* No hardware is contact for this function.\n-*\n-* in param key_id :the name of the public protected key file without the extension\n- \u0022.swp\u0022\n-* in param num : the bytes size of n and e\n-* out param n: where to write modulus in bn format\n-* out param e: where to write exponent in bn format\n-*/\n-typedef int SureWareHook_Load_Rsa_Pubkey_t(char *const msg,\n- const char *key_id,\n- unsigned long num,\n- unsigned long *n,\n- unsigned long *e);\n-extern SW_EXPORT SureWareHook_Load_Rsa_Pubkey_t SureWareHook_Load_Rsa_Pubkey;\n-\n-/*-\n-* SureWare Load DSA Public Key function\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* No hardware is contact for this function.\n-*\n-* in param key_id :the name of the public protected key file without the extension\n- \u0022.swp\u0022\n-* in param num : the bytes size of n and e\n-* out param pub: where to write pub key in bn format\n-* out param p: where to write prime in bn format\n-* out param q: where to write sunprime (length 20 bytes) in bn format\n-* out param g: where to write base in bn format\n-*/\n-typedef int SureWareHook_Load_Dsa_Pubkey_t(char *const msg,\n- const char *key_id,\n- unsigned long num,\n- unsigned long *pub,\n- unsigned long *p, unsigned long *q,\n- unsigned long *g);\n-extern SW_EXPORT SureWareHook_Load_Dsa_Pubkey_t SureWareHook_Load_Dsa_Pubkey;\n-\n-/*-\n-* SureWare Free function\n-* Destroy the key into the hardware if destroy\u003d\u003d1\n-*/\n-typedef void SureWareHook_Free_t(char *p, int destroy);\n-extern SW_EXPORT SureWareHook_Free_t SureWareHook_Free;\n-\n-#define SUREWARE_PKCS1_PAD 1\n-#define SUREWARE_ISO9796_PAD 2\n-#define SUREWARE_NO_PAD 0\n-/*-\n-* SureWare RSA Private Decryption\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure\n-* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf\n-*\n-* in param flen : byte size of from and to\n-* in param from : encrypted data buffer, should be a not-null valid pointer\n-* out param tlen: byte size of decrypted data, if error, unexpected value\n-* out param to : decrypted data buffer, should be a not-null valid pointer\n-* in param prsa: a protected key pointer, should be a not-null valid pointer\n-* int padding: padding id as follow\n-* SUREWARE_PKCS1_PAD\n-* SUREWARE_NO_PAD\n-*\n-*/\n-typedef int SureWareHook_Rsa_Priv_Dec_t(char *const msg, int flen,\n- unsigned char *from, int *tlen,\n- unsigned char *to, char *prsa,\n- int padding);\n-extern SW_EXPORT SureWareHook_Rsa_Priv_Dec_t SureWareHook_Rsa_Priv_Dec;\n-/*-\n-* SureWare RSA Signature\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure\n-* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf\n-*\n-* in param flen : byte size of from and to\n-* in param from : encrypted data buffer, should be a not-null valid pointer\n-* out param tlen: byte size of decrypted data, if error, unexpected value\n-* out param to : decrypted data buffer, should be a not-null valid pointer\n-* in param prsa: a protected key pointer, should be a not-null valid pointer\n-* int padding: padding id as follow\n-* SUREWARE_PKCS1_PAD\n-* SUREWARE_ISO9796_PAD\n-*\n-*/\n-typedef int SureWareHook_Rsa_Sign_t(char *const msg, int flen,\n- unsigned char *from, int *tlen,\n- unsigned char *to, char *prsa,\n- int padding);\n-extern SW_EXPORT SureWareHook_Rsa_Sign_t SureWareHook_Rsa_Sign;\n-/*-\n-* SureWare DSA Signature\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure\n-* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf\n-*\n-* in param flen : byte size of from and to\n-* in param from : encrypted data buffer, should be a not-null valid pointer\n-* out param to : decrypted data buffer, should be a 40bytes valid pointer\n-* in param pdsa: a protected key pointer, should be a not-null valid pointer\n-*\n-*/\n-typedef int SureWareHook_Dsa_Sign_t(char *const msg, int flen,\n- const unsigned char *from,\n- unsigned long *r, unsigned long *s,\n- char *pdsa);\n-extern SW_EXPORT SureWareHook_Dsa_Sign_t SureWareHook_Dsa_Sign;\n-\n-/*-\n-* SureWare Mod Exp\n-* return 1 if success\n-* SureWareHOOK_ERROR_FAILED if error while processing\n-* SureWareHOOK_ERROR_UNIT_FAILURE if hardware failure\n-* SUREWAREHOOK_ERROR_DATA_SIZE wrong size for buf\n-*\n-* mod and res are mlen bytes long.\n-* exp is elen bytes long\n-* data is dlen bytes long\n-* mlen,elen and dlen are all multiple of sizeof(unsigned long)\n-*/\n-typedef int SureWareHook_Mod_Exp_t(char *const msg, int mlen,\n- const unsigned long *mod, int elen,\n- const unsigned long *exponent, int dlen,\n- unsigned long *data, unsigned long *res);\n-extern SW_EXPORT SureWareHook_Mod_Exp_t SureWareHook_Mod_Exp;\n","s":{"c":1756843566,"u": 64915}} ],"g": 152824,"chitpc": 0,"ehitpc": 0,"indexed":0 , "ab": 0, "si": 0, "db":0, "di":0, "sat":0, "lfc": "0000"}