73 #ifndef OPENSSL_NO_RSA
76 #ifndef OPENSSL_NO_DSA
86 #define TEST_ENG_OPENSSL_RC4
87 #define TEST_ENG_OPENSSL_PKEY
89 #define TEST_ENG_OPENSSL_RC4_P_INIT
91 #define TEST_ENG_OPENSSL_SHA
99 #undef TEST_ENG_OPENSSL_RC4
100 #undef TEST_ENG_OPENSSL_RC4_OTHERS
101 #undef TEST_ENG_OPENSSL_RC4_P_INIT
102 #undef TEST_ENG_OPENSSL_RC4_P_CIPHER
104 #if defined(OPENSSL_NO_SHA) || defined(OPENSSL_NO_SHA0) || defined(OPENSSL_NO_SHA1)
105 #undef TEST_ENG_OPENSSL_SHA
106 #undef TEST_ENG_OPENSSL_SHA_OTHERS
107 #undef TEST_ENG_OPENSSL_SHA_P_INIT
108 #undef TEST_ENG_OPENSSL_SHA_P_UPDATE
109 #undef TEST_ENG_OPENSSL_SHA_P_FINAL
112 #ifdef TEST_ENG_OPENSSL_RC4
114 const int **nids,
int nid);
116 #ifdef TEST_ENG_OPENSSL_SHA
118 const int **nids,
int nid);
121 #ifdef TEST_ENG_OPENSSL_PKEY
122 static EVP_PKEY *openssl_load_privkey(
ENGINE *eng,
const char *key_id,
123 UI_METHOD *ui_method,
void *callback_data);
127 static const char *engine_openssl_id =
"openssl";
128 static const char *engine_openssl_name =
"Software engine support";
132 static int bind_helper(
ENGINE *
e)
136 #ifndef TEST_ENG_OPENSSL_NO_ALGORITHMS
137 #ifndef OPENSSL_NO_RSA
140 #ifndef OPENSSL_NO_DSA
143 #ifndef OPENSSL_NO_ECDH
146 #ifndef OPENSSL_NO_ECDSA
149 #ifndef OPENSSL_NO_DH
170 static ENGINE *engine_openssl(
void)
175 if(!bind_helper(ret))
185 ENGINE *toadd = engine_openssl();
196 #ifdef ENGINE_DYNAMIC_SUPPORT
197 static int bind_fn(
ENGINE *e,
const char *
id)
199 if(
id && (strcmp(
id, engine_openssl_id) != 0))
209 #ifdef TEST_ENG_OPENSSL_RC4
221 #define TEST_RC4_KEY_SIZE 16
223 static int test_cipher_nids_number = 2;
228 #define test(ctx) ((TEST_RC4_KEY *)(ctx)->cipher_data)
230 const unsigned char *iv,
int enc)
232 #ifdef TEST_ENG_OPENSSL_RC4_P_INIT
233 fprintf(stderr,
"(TEST_ENG_OPENSSL_RC4) test_init_key() called\n");
240 static int test_rc4_cipher(
EVP_CIPHER_CTX *ctx,
unsigned char *out,
241 const unsigned char *in,
size_t inl)
243 #ifdef TEST_ENG_OPENSSL_RC4_P_CIPHER
244 fprintf(stderr,
"(TEST_ENG_OPENSSL_RC4) test_cipher() called\n");
246 RC4(&
test(ctx)->ks,inl,in,out);
278 const int **nids,
int nid)
283 *nids = test_cipher_nids;
284 return test_cipher_nids_number;
288 *cipher = &test_r4_cipher;
290 *cipher = &test_r4_40_cipher;
293 #ifdef TEST_ENG_OPENSSL_RC4_OTHERS
294 fprintf(stderr,
"(TEST_ENG_OPENSSL_RC4) returning NULL for "
304 #ifdef TEST_ENG_OPENSSL_SHA
307 static int test_digest_nids[] = {
NID_sha1};
308 static int test_digest_nids_number = 1;
311 #ifdef TEST_ENG_OPENSSL_SHA_P_INIT
312 fprintf(stderr,
"(TEST_ENG_OPENSSL_SHA) test_sha1_init() called\n");
316 static int test_sha1_update(
EVP_MD_CTX *ctx,
const void *
data,
size_t count)
318 #ifdef TEST_ENG_OPENSSL_SHA_P_UPDATE
319 fprintf(stderr,
"(TEST_ENG_OPENSSL_SHA) test_sha1_update() called\n");
323 static int test_sha1_final(
EVP_MD_CTX *ctx,
unsigned char *md)
325 #ifdef TEST_ENG_OPENSSL_SHA_P_FINAL
326 fprintf(stderr,
"(TEST_ENG_OPENSSL_SHA) test_sha1_final() called\n");
330 static const EVP_MD test_sha_md=
345 static int openssl_digests(
ENGINE *e,
const EVP_MD **digest,
346 const int **nids,
int nid)
351 *nids = test_digest_nids;
352 return test_digest_nids_number;
356 *digest = &test_sha_md;
359 #ifdef TEST_ENG_OPENSSL_SHA_OTHERS
360 fprintf(stderr,
"(TEST_ENG_OPENSSL_SHA) returning NULL for "
370 #ifdef TEST_ENG_OPENSSL_PKEY
371 static EVP_PKEY *openssl_load_privkey(
ENGINE *eng,
const char *key_id,
372 UI_METHOD *ui_method,
void *callback_data)
376 fprintf(stderr,
"(TEST_ENG_OPENSSL_PKEY)Loading Private key %s\n", key_id);