2 * Copyright 2015-2020 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
11 * This is the OSSLTEST engine. It provides deliberately crippled digest
12 * implementations for test purposes. It is highly insecure and must NOT be
13 * used for any purpose except testing
16 /* We need to use some engine deprecated APIs */
17 #define OPENSSL_SUPPRESS_DEPRECATED
20 * SHA low level APIs are deprecated for public use, but still ok for
21 * internal use. Note, that due to symbols not being exported, only the
22 * #defines and type definitions can be accessed, function calls are not
23 * available. The digest lengths, block sizes and sizeof(CTX) are used herein
24 * for several different digests.
26 #include "internal/deprecated.h"
31 #include <openssl/engine.h>
32 #include <openssl/sha.h>
33 #include <openssl/md5.h>
34 #include <openssl/rsa.h>
35 #include <openssl/evp.h>
36 #include <openssl/modes.h>
37 #include <openssl/aes.h>
38 #include <openssl/rand.h>
39 #include <openssl/crypto.h>
40 #include <openssl/pem.h>
42 #include "e_ossltest_err.c"
45 # define strncasecmp _strnicmp
48 /* Engine Id and Name */
49 static const char *engine_ossltest_id
= "ossltest";
50 static const char *engine_ossltest_name
= "OpenSSL Test engine support";
53 /* Engine Lifetime functions */
54 static int ossltest_destroy(ENGINE
*e
);
55 static int ossltest_init(ENGINE
*e
);
56 static int ossltest_finish(ENGINE
*e
);
57 void ENGINE_load_ossltest(void);
61 static int ossltest_digests(ENGINE
*e
, const EVP_MD
**digest
,
62 const int **nids
, int nid
);
63 static const RAND_METHOD
*ossltest_rand_method(void);
66 static int digest_md5_init(EVP_MD_CTX
*ctx
);
67 static int digest_md5_update(EVP_MD_CTX
*ctx
, const void *data
,
69 static int digest_md5_final(EVP_MD_CTX
*ctx
, unsigned char *md
);
71 static EVP_MD
*_hidden_md5_md
= NULL
;
72 static const EVP_MD
*digest_md5(void)
74 if (_hidden_md5_md
== NULL
) {
77 if ((md
= EVP_MD_meth_new(NID_md5
, NID_md5WithRSAEncryption
)) == NULL
78 || !EVP_MD_meth_set_result_size(md
, MD5_DIGEST_LENGTH
)
79 || !EVP_MD_meth_set_input_blocksize(md
, MD5_CBLOCK
)
80 || !EVP_MD_meth_set_app_datasize(md
,
81 sizeof(EVP_MD
*) + sizeof(MD5_CTX
))
82 || !EVP_MD_meth_set_flags(md
, 0)
83 || !EVP_MD_meth_set_init(md
, digest_md5_init
)
84 || !EVP_MD_meth_set_update(md
, digest_md5_update
)
85 || !EVP_MD_meth_set_final(md
, digest_md5_final
)) {
91 return _hidden_md5_md
;
95 static int digest_sha1_init(EVP_MD_CTX
*ctx
);
96 static int digest_sha1_update(EVP_MD_CTX
*ctx
, const void *data
,
98 static int digest_sha1_final(EVP_MD_CTX
*ctx
, unsigned char *md
);
100 static EVP_MD
*_hidden_sha1_md
= NULL
;
101 static const EVP_MD
*digest_sha1(void)
103 if (_hidden_sha1_md
== NULL
) {
106 if ((md
= EVP_MD_meth_new(NID_sha1
, NID_sha1WithRSAEncryption
)) == NULL
107 || !EVP_MD_meth_set_result_size(md
, SHA_DIGEST_LENGTH
)
108 || !EVP_MD_meth_set_input_blocksize(md
, SHA_CBLOCK
)
109 || !EVP_MD_meth_set_app_datasize(md
,
110 sizeof(EVP_MD
*) + sizeof(SHA_CTX
))
111 || !EVP_MD_meth_set_flags(md
, EVP_MD_FLAG_DIGALGID_ABSENT
)
112 || !EVP_MD_meth_set_init(md
, digest_sha1_init
)
113 || !EVP_MD_meth_set_update(md
, digest_sha1_update
)
114 || !EVP_MD_meth_set_final(md
, digest_sha1_final
)) {
115 EVP_MD_meth_free(md
);
118 _hidden_sha1_md
= md
;
120 return _hidden_sha1_md
;
124 static int digest_sha256_init(EVP_MD_CTX
*ctx
);
125 static int digest_sha256_update(EVP_MD_CTX
*ctx
, const void *data
,
127 static int digest_sha256_final(EVP_MD_CTX
*ctx
, unsigned char *md
);
129 static EVP_MD
*_hidden_sha256_md
= NULL
;
130 static const EVP_MD
*digest_sha256(void)
132 if (_hidden_sha256_md
== NULL
) {
135 if ((md
= EVP_MD_meth_new(NID_sha256
, NID_sha256WithRSAEncryption
)) == NULL
136 || !EVP_MD_meth_set_result_size(md
, SHA256_DIGEST_LENGTH
)
137 || !EVP_MD_meth_set_input_blocksize(md
, SHA256_CBLOCK
)
138 || !EVP_MD_meth_set_app_datasize(md
,
139 sizeof(EVP_MD
*) + sizeof(SHA256_CTX
))
140 || !EVP_MD_meth_set_flags(md
, EVP_MD_FLAG_DIGALGID_ABSENT
)
141 || !EVP_MD_meth_set_init(md
, digest_sha256_init
)
142 || !EVP_MD_meth_set_update(md
, digest_sha256_update
)
143 || !EVP_MD_meth_set_final(md
, digest_sha256_final
)) {
144 EVP_MD_meth_free(md
);
147 _hidden_sha256_md
= md
;
149 return _hidden_sha256_md
;
153 static int digest_sha384_init(EVP_MD_CTX
*ctx
);
154 static int digest_sha384_update(EVP_MD_CTX
*ctx
, const void *data
,
156 static int digest_sha384_final(EVP_MD_CTX
*ctx
, unsigned char *md
);
158 static int digest_sha512_init(EVP_MD_CTX
*ctx
);
159 static int digest_sha512_update(EVP_MD_CTX
*ctx
, const void *data
,
161 static int digest_sha512_final(EVP_MD_CTX
*ctx
, unsigned char *md
);
163 static EVP_MD
*_hidden_sha384_md
= NULL
;
164 static const EVP_MD
*digest_sha384(void)
166 if (_hidden_sha384_md
== NULL
) {
169 if ((md
= EVP_MD_meth_new(NID_sha384
, NID_sha384WithRSAEncryption
)) == NULL
170 || !EVP_MD_meth_set_result_size(md
, SHA384_DIGEST_LENGTH
)
171 || !EVP_MD_meth_set_input_blocksize(md
, SHA512_CBLOCK
)
172 || !EVP_MD_meth_set_app_datasize(md
,
173 sizeof(EVP_MD
*) + sizeof(SHA512_CTX
))
174 || !EVP_MD_meth_set_flags(md
, EVP_MD_FLAG_DIGALGID_ABSENT
)
175 || !EVP_MD_meth_set_init(md
, digest_sha384_init
)
176 || !EVP_MD_meth_set_update(md
, digest_sha384_update
)
177 || !EVP_MD_meth_set_final(md
, digest_sha384_final
)) {
178 EVP_MD_meth_free(md
);
181 _hidden_sha384_md
= md
;
183 return _hidden_sha384_md
;
185 static EVP_MD
*_hidden_sha512_md
= NULL
;
186 static const EVP_MD
*digest_sha512(void)
188 if (_hidden_sha512_md
== NULL
) {
191 if ((md
= EVP_MD_meth_new(NID_sha512
, NID_sha512WithRSAEncryption
)) == NULL
192 || !EVP_MD_meth_set_result_size(md
, SHA512_DIGEST_LENGTH
)
193 || !EVP_MD_meth_set_input_blocksize(md
, SHA512_CBLOCK
)
194 || !EVP_MD_meth_set_app_datasize(md
,
195 sizeof(EVP_MD
*) + sizeof(SHA512_CTX
))
196 || !EVP_MD_meth_set_flags(md
, EVP_MD_FLAG_DIGALGID_ABSENT
)
197 || !EVP_MD_meth_set_init(md
, digest_sha512_init
)
198 || !EVP_MD_meth_set_update(md
, digest_sha512_update
)
199 || !EVP_MD_meth_set_final(md
, digest_sha512_final
)) {
200 EVP_MD_meth_free(md
);
203 _hidden_sha512_md
= md
;
205 return _hidden_sha512_md
;
207 static void destroy_digests(void)
209 EVP_MD_meth_free(_hidden_md5_md
);
210 _hidden_md5_md
= NULL
;
211 EVP_MD_meth_free(_hidden_sha1_md
);
212 _hidden_sha1_md
= NULL
;
213 EVP_MD_meth_free(_hidden_sha256_md
);
214 _hidden_sha256_md
= NULL
;
215 EVP_MD_meth_free(_hidden_sha384_md
);
216 _hidden_sha384_md
= NULL
;
217 EVP_MD_meth_free(_hidden_sha512_md
);
218 _hidden_sha512_md
= NULL
;
220 static int ossltest_digest_nids(const int **nids
)
222 static int digest_nids
[6] = { 0, 0, 0, 0, 0, 0 };
228 if ((md
= digest_md5()) != NULL
)
229 digest_nids
[pos
++] = EVP_MD_type(md
);
230 if ((md
= digest_sha1()) != NULL
)
231 digest_nids
[pos
++] = EVP_MD_type(md
);
232 if ((md
= digest_sha256()) != NULL
)
233 digest_nids
[pos
++] = EVP_MD_type(md
);
234 if ((md
= digest_sha384()) != NULL
)
235 digest_nids
[pos
++] = EVP_MD_type(md
);
236 if ((md
= digest_sha512()) != NULL
)
237 digest_nids
[pos
++] = EVP_MD_type(md
);
238 digest_nids
[pos
] = 0;
246 static int ossltest_ciphers(ENGINE
*, const EVP_CIPHER
**,
249 static int ossltest_cipher_nids
[] = {
250 NID_aes_128_cbc
, NID_aes_128_gcm
, 0
255 int ossltest_aes128_init_key(EVP_CIPHER_CTX
*ctx
, const unsigned char *key
,
256 const unsigned char *iv
, int enc
);
257 int ossltest_aes128_cbc_cipher(EVP_CIPHER_CTX
*ctx
, unsigned char *out
,
258 const unsigned char *in
, size_t inl
);
259 int ossltest_aes128_gcm_init_key(EVP_CIPHER_CTX
*ctx
, const unsigned char *key
,
260 const unsigned char *iv
, int enc
);
261 int ossltest_aes128_gcm_cipher(EVP_CIPHER_CTX
*ctx
, unsigned char *out
,
262 const unsigned char *in
, size_t inl
);
263 static int ossltest_aes128_gcm_ctrl(EVP_CIPHER_CTX
*ctx
, int type
, int arg
,
266 static EVP_CIPHER
*_hidden_aes_128_cbc
= NULL
;
267 static const EVP_CIPHER
*ossltest_aes_128_cbc(void)
269 if (_hidden_aes_128_cbc
== NULL
270 && ((_hidden_aes_128_cbc
= EVP_CIPHER_meth_new(NID_aes_128_cbc
,
272 16 /* key len */)) == NULL
273 || !EVP_CIPHER_meth_set_iv_length(_hidden_aes_128_cbc
,16)
274 || !EVP_CIPHER_meth_set_flags(_hidden_aes_128_cbc
,
275 EVP_CIPH_FLAG_DEFAULT_ASN1
277 || !EVP_CIPHER_meth_set_init(_hidden_aes_128_cbc
,
278 ossltest_aes128_init_key
)
279 || !EVP_CIPHER_meth_set_do_cipher(_hidden_aes_128_cbc
,
280 ossltest_aes128_cbc_cipher
)
281 || !EVP_CIPHER_meth_set_impl_ctx_size(_hidden_aes_128_cbc
,
282 EVP_CIPHER_impl_ctx_size(EVP_aes_128_cbc())))) {
283 EVP_CIPHER_meth_free(_hidden_aes_128_cbc
);
284 _hidden_aes_128_cbc
= NULL
;
286 return _hidden_aes_128_cbc
;
288 static EVP_CIPHER
*_hidden_aes_128_gcm
= NULL
;
290 #define AES_GCM_FLAGS (EVP_CIPH_FLAG_DEFAULT_ASN1 \
291 | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER \
292 | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT \
293 | EVP_CIPH_CUSTOM_COPY |EVP_CIPH_FLAG_AEAD_CIPHER \
296 static const EVP_CIPHER
*ossltest_aes_128_gcm(void)
298 if (_hidden_aes_128_gcm
== NULL
299 && ((_hidden_aes_128_gcm
= EVP_CIPHER_meth_new(NID_aes_128_gcm
,
301 16 /* key len */)) == NULL
302 || !EVP_CIPHER_meth_set_iv_length(_hidden_aes_128_gcm
,12)
303 || !EVP_CIPHER_meth_set_flags(_hidden_aes_128_gcm
, AES_GCM_FLAGS
)
304 || !EVP_CIPHER_meth_set_init(_hidden_aes_128_gcm
,
305 ossltest_aes128_gcm_init_key
)
306 || !EVP_CIPHER_meth_set_do_cipher(_hidden_aes_128_gcm
,
307 ossltest_aes128_gcm_cipher
)
308 || !EVP_CIPHER_meth_set_ctrl(_hidden_aes_128_gcm
,
309 ossltest_aes128_gcm_ctrl
)
310 || !EVP_CIPHER_meth_set_impl_ctx_size(_hidden_aes_128_gcm
,
311 EVP_CIPHER_impl_ctx_size(EVP_aes_128_gcm())))) {
312 EVP_CIPHER_meth_free(_hidden_aes_128_gcm
);
313 _hidden_aes_128_gcm
= NULL
;
315 return _hidden_aes_128_gcm
;
318 static void destroy_ciphers(void)
320 EVP_CIPHER_meth_free(_hidden_aes_128_cbc
);
321 EVP_CIPHER_meth_free(_hidden_aes_128_gcm
);
322 _hidden_aes_128_cbc
= NULL
;
326 static EVP_PKEY
*load_key(ENGINE
*eng
, const char *key_id
, int pub
,
327 UI_METHOD
*ui_method
, void *ui_data
)
332 if (strncasecmp(key_id
, "ot:", 3) != 0)
336 fprintf(stderr
, "[ossltest]Loading %s key %s\n",
337 pub
? "Public" : "Private", key_id
);
338 in
= BIO_new_file(key_id
, "r");
342 key
= PEM_read_bio_PUBKEY(in
, NULL
, 0, NULL
);
344 key
= PEM_read_bio_PrivateKey(in
, NULL
, 0, NULL
);
349 static EVP_PKEY
*ossltest_load_privkey(ENGINE
*eng
, const char *key_id
,
350 UI_METHOD
*ui_method
, void *ui_data
)
352 return load_key(eng
, key_id
, 0, ui_method
, ui_data
);
355 static EVP_PKEY
*ossltest_load_pubkey(ENGINE
*eng
, const char *key_id
,
356 UI_METHOD
*ui_method
, void *ui_data
)
358 return load_key(eng
, key_id
, 1, ui_method
, ui_data
);
362 static int bind_ossltest(ENGINE
*e
)
364 /* Ensure the ossltest error handling is set up */
365 ERR_load_OSSLTEST_strings();
367 if (!ENGINE_set_id(e
, engine_ossltest_id
)
368 || !ENGINE_set_name(e
, engine_ossltest_name
)
369 || !ENGINE_set_digests(e
, ossltest_digests
)
370 || !ENGINE_set_ciphers(e
, ossltest_ciphers
)
371 || !ENGINE_set_RAND(e
, ossltest_rand_method())
372 || !ENGINE_set_destroy_function(e
, ossltest_destroy
)
373 || !ENGINE_set_load_privkey_function(e
, ossltest_load_privkey
)
374 || !ENGINE_set_load_pubkey_function(e
, ossltest_load_pubkey
)
375 || !ENGINE_set_init_function(e
, ossltest_init
)
376 || !ENGINE_set_finish_function(e
, ossltest_finish
)) {
377 OSSLTESTerr(OSSLTEST_F_BIND_OSSLTEST
, OSSLTEST_R_INIT_FAILED
);
384 #ifndef OPENSSL_NO_DYNAMIC_ENGINE
385 static int bind_helper(ENGINE
*e
, const char *id
)
387 if (id
&& (strcmp(id
, engine_ossltest_id
) != 0))
389 if (!bind_ossltest(e
))
394 IMPLEMENT_DYNAMIC_CHECK_FN()
395 IMPLEMENT_DYNAMIC_BIND_FN(bind_helper
)
398 static ENGINE
*engine_ossltest(void)
400 ENGINE
*ret
= ENGINE_new();
403 if (!bind_ossltest(ret
)) {
410 void ENGINE_load_ossltest(void)
412 /* Copied from eng_[openssl|dyn].c */
413 ENGINE
*toadd
= engine_ossltest();
422 static int ossltest_init(ENGINE
*e
)
428 static int ossltest_finish(ENGINE
*e
)
434 static int ossltest_destroy(ENGINE
*e
)
438 ERR_unload_OSSLTEST_strings();
442 static int ossltest_digests(ENGINE
*e
, const EVP_MD
**digest
,
443 const int **nids
, int nid
)
447 /* We are returning a list of supported nids */
448 return ossltest_digest_nids(nids
);
450 /* We are being asked for a specific digest */
453 *digest
= digest_md5();
456 *digest
= digest_sha1();
459 *digest
= digest_sha256();
462 *digest
= digest_sha384();
465 *digest
= digest_sha512();
475 static int ossltest_ciphers(ENGINE
*e
, const EVP_CIPHER
**cipher
,
476 const int **nids
, int nid
)
480 /* We are returning a list of supported nids */
481 *nids
= ossltest_cipher_nids
;
482 return (sizeof(ossltest_cipher_nids
) - 1)
483 / sizeof(ossltest_cipher_nids
[0]);
485 /* We are being asked for a specific cipher */
487 case NID_aes_128_cbc
:
488 *cipher
= ossltest_aes_128_cbc();
490 case NID_aes_128_gcm
:
491 *cipher
= ossltest_aes_128_gcm();
501 static void fill_known_data(unsigned char *md
, unsigned int len
)
505 for (i
=0; i
<len
; i
++) {
506 md
[i
] = (unsigned char)(i
& 0xff);
511 * MD5 implementation. We go through the motions of doing MD5 by deferring to
512 * the standard implementation. Then we overwrite the result with a will defined
513 * value, so that all "MD5" digests using the test engine always end up with
516 static int digest_md5_init(EVP_MD_CTX
*ctx
)
518 return EVP_MD_meth_get_init(EVP_md5())(ctx
);
521 static int digest_md5_update(EVP_MD_CTX
*ctx
, const void *data
,
524 return EVP_MD_meth_get_update(EVP_md5())(ctx
, data
, count
);
527 static int digest_md5_final(EVP_MD_CTX
*ctx
, unsigned char *md
)
529 int ret
= EVP_MD_meth_get_final(EVP_md5())(ctx
, md
);
532 fill_known_data(md
, MD5_DIGEST_LENGTH
);
538 * SHA1 implementation.
540 static int digest_sha1_init(EVP_MD_CTX
*ctx
)
542 return EVP_MD_meth_get_init(EVP_sha1())(ctx
);
545 static int digest_sha1_update(EVP_MD_CTX
*ctx
, const void *data
,
548 return EVP_MD_meth_get_update(EVP_sha1())(ctx
, data
, count
);
551 static int digest_sha1_final(EVP_MD_CTX
*ctx
, unsigned char *md
)
553 int ret
= EVP_MD_meth_get_final(EVP_sha1())(ctx
, md
);
556 fill_known_data(md
, SHA_DIGEST_LENGTH
);
562 * SHA256 implementation.
564 static int digest_sha256_init(EVP_MD_CTX
*ctx
)
566 return EVP_MD_meth_get_init(EVP_sha256())(ctx
);
569 static int digest_sha256_update(EVP_MD_CTX
*ctx
, const void *data
,
572 return EVP_MD_meth_get_update(EVP_sha256())(ctx
, data
, count
);
575 static int digest_sha256_final(EVP_MD_CTX
*ctx
, unsigned char *md
)
577 int ret
= EVP_MD_meth_get_final(EVP_sha256())(ctx
, md
);
580 fill_known_data(md
, SHA256_DIGEST_LENGTH
);
586 * SHA384 implementation.
588 static int digest_sha384_init(EVP_MD_CTX
*ctx
)
590 return EVP_MD_meth_get_init(EVP_sha384())(ctx
);
593 static int digest_sha384_update(EVP_MD_CTX
*ctx
, const void *data
,
596 return EVP_MD_meth_get_update(EVP_sha384())(ctx
, data
, count
);
599 static int digest_sha384_final(EVP_MD_CTX
*ctx
, unsigned char *md
)
601 int ret
= EVP_MD_meth_get_final(EVP_sha384())(ctx
, md
);
604 fill_known_data(md
, SHA384_DIGEST_LENGTH
);
610 * SHA512 implementation.
612 static int digest_sha512_init(EVP_MD_CTX
*ctx
)
614 return EVP_MD_meth_get_init(EVP_sha512())(ctx
);
617 static int digest_sha512_update(EVP_MD_CTX
*ctx
, const void *data
,
620 return EVP_MD_meth_get_update(EVP_sha512())(ctx
, data
, count
);
623 static int digest_sha512_final(EVP_MD_CTX
*ctx
, unsigned char *md
)
625 int ret
= EVP_MD_meth_get_final(EVP_sha512())(ctx
, md
);
628 fill_known_data(md
, SHA512_DIGEST_LENGTH
);
634 * AES128 Implementation
637 int ossltest_aes128_init_key(EVP_CIPHER_CTX
*ctx
, const unsigned char *key
,
638 const unsigned char *iv
, int enc
)
640 return EVP_CIPHER_meth_get_init(EVP_aes_128_cbc()) (ctx
, key
, iv
, enc
);
643 int ossltest_aes128_cbc_cipher(EVP_CIPHER_CTX
*ctx
, unsigned char *out
,
644 const unsigned char *in
, size_t inl
)
646 unsigned char *tmpbuf
;
649 tmpbuf
= OPENSSL_malloc(inl
);
651 /* OPENSSL_malloc will return NULL if inl == 0 */
652 if (tmpbuf
== NULL
&& inl
> 0)
655 /* Remember what we were asked to encrypt */
657 memcpy(tmpbuf
, in
, inl
);
659 /* Go through the motions of encrypting it */
660 ret
= EVP_CIPHER_meth_get_do_cipher(EVP_aes_128_cbc())(ctx
, out
, in
, inl
);
662 /* Throw it all away and just use the plaintext as the output */
664 memcpy(out
, tmpbuf
, inl
);
665 OPENSSL_free(tmpbuf
);
670 int ossltest_aes128_gcm_init_key(EVP_CIPHER_CTX
*ctx
, const unsigned char *key
,
671 const unsigned char *iv
, int enc
)
673 return EVP_CIPHER_meth_get_init(EVP_aes_128_gcm()) (ctx
, key
, iv
, enc
);
677 int ossltest_aes128_gcm_cipher(EVP_CIPHER_CTX
*ctx
, unsigned char *out
,
678 const unsigned char *in
, size_t inl
)
680 unsigned char *tmpbuf
= OPENSSL_malloc(inl
);
682 /* OPENSSL_malloc will return NULL if inl == 0 */
683 if (tmpbuf
== NULL
&& inl
> 0)
686 /* Remember what we were asked to encrypt */
688 memcpy(tmpbuf
, in
, inl
);
690 /* Go through the motions of encrypting it */
691 EVP_CIPHER_meth_get_do_cipher(EVP_aes_128_gcm())(ctx
, out
, in
, inl
);
693 /* Throw it all away and just use the plaintext as the output */
694 if (tmpbuf
!= NULL
&& out
!= NULL
)
695 memcpy(out
, tmpbuf
, inl
);
696 OPENSSL_free(tmpbuf
);
701 static int ossltest_aes128_gcm_ctrl(EVP_CIPHER_CTX
*ctx
, int type
, int arg
,
704 /* Pass the ctrl down */
705 int ret
= EVP_CIPHER_meth_get_ctrl(EVP_aes_128_gcm())(ctx
, type
, arg
, ptr
);
711 case EVP_CTRL_AEAD_GET_TAG
:
712 /* Always give the same tag */
713 memset(ptr
, 0, EVP_GCM_TLS_TAG_LEN
);
723 static int ossltest_rand_bytes(unsigned char *buf
, int num
)
725 unsigned char val
= 1;
732 static int ossltest_rand_status(void)
737 static const RAND_METHOD
*ossltest_rand_method(void)
740 static RAND_METHOD osslt_rand_meth
= {
749 return &osslt_rand_meth
;