1 /* ====================================================================
2 * Copyright (c) 1999-2016 The OpenSSL Project. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in
13 * the documentation and/or other materials provided with the
16 * 3. All advertising materials mentioning features or use of this
17 * software must display the following acknowledgment:
18 * "This product includes software developed by the OpenSSL Project
19 * for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
21 * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
22 * endorse or promote products derived from this software without
23 * prior written permission. For written permission, please contact
24 * openssl-core@OpenSSL.org.
26 * 5. Products derived from this software may not be called "OpenSSL"
27 * nor may "OpenSSL" appear in their names without prior written
28 * permission of the OpenSSL Project.
30 * 6. Redistributions of any form whatsoever must retain the following
32 * "This product includes software developed by the OpenSSL Project
33 * for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
35 * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
36 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
37 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
38 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE OpenSSL PROJECT OR
39 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
40 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
41 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
42 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
43 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
44 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
45 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
46 * OF THE POSSIBILITY OF SUCH DAMAGE.
47 * ====================================================================
49 * This product includes cryptographic software written by Eric Young
50 * (eay@cryptsoft.com). This product includes software written by Tim
51 * Hudson (tjh@cryptsoft.com).
55 /* Required for vmsplice */
61 #include <openssl/engine.h>
62 #include <openssl/async.h>
63 #include <openssl/err.h>
65 #include <linux/version.h>
69 #if LINUX_VERSION_CODE <= KERNEL_VERSION(K_MAJ, K_MIN1, K_MIN2)
70 # warning "AFALG ENGINE requires Kernel Headers >= 4.1.0"
71 # warning "Skipping Compilation of AFALG engine"
72 void engine_load_afalg_int(void)
77 # include <linux/if_alg.h>
78 # include <sys/socket.h>
80 # include <sys/utsname.h>
82 # include <linux/aio_abi.h>
83 # include <sys/syscall.h>
88 # define AFALG_LIB_NAME "AFALG"
89 # include "e_afalg_err.h"
96 # ifndef SPLICE_F_GIFT
97 # define SPLICE_F_GIFT (0x08)
101 # define ALG_AES_IV_LEN 16
102 # define ALG_IV_LEN(len) (sizeof(struct af_alg_iv) + (len))
103 # define ALG_OP_TYPE unsigned int
104 # define ALG_OP_LEN (sizeof(ALG_OP_TYPE))
106 #define ALG_MAX_SALG_NAME 64
107 #define ALG_MAX_SALG_TYPE 14
109 # ifdef OPENSSL_NO_DYNAMIC_ENGINE
110 void engine_load_afalg_int(void);
113 /* Local Linkage Functions */
114 static int afalg_init_aio(afalg_aio *aio);
115 static int afalg_fin_cipher_aio(afalg_aio *ptr, int sfd,
116 unsigned char *buf, size_t len);
117 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
118 const char *ciphername);
119 static int afalg_destroy(ENGINE *e);
120 static int afalg_init(ENGINE *e);
121 static int afalg_finish(ENGINE *e);
122 const EVP_CIPHER *afalg_aes_128_cbc(void);
123 static int afalg_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
124 const int **nids, int nid);
125 static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
126 const unsigned char *iv, int enc);
127 static int afalg_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
128 const unsigned char *in, size_t inl);
129 static int afalg_cipher_cleanup(EVP_CIPHER_CTX *ctx);
130 static int afalg_chk_platform(void);
132 /* Engine Id and Name */
133 static const char *engine_afalg_id = "afalg";
134 static const char *engine_afalg_name = "AFALG engine support";
136 static int afalg_cipher_nids[] = {
140 static EVP_CIPHER *_hidden_aes_128_cbc = NULL;
142 static inline int io_setup(unsigned n, aio_context_t *ctx)
144 return syscall(__NR_io_setup, n, ctx);
147 static inline int eventfd(int n)
149 return syscall(__NR_eventfd, n);
152 static inline int io_destroy(aio_context_t ctx)
154 return syscall(__NR_io_destroy, ctx);
157 static inline int io_read(aio_context_t ctx, long n, struct iocb **iocb)
159 return syscall(__NR_io_submit, ctx, n, iocb);
162 static inline int io_getevents(aio_context_t ctx, long min, long max,
163 struct io_event *events,
164 struct timespec *timeout)
166 return syscall(__NR_io_getevents, ctx, min, max, events, timeout);
169 static void afalg_waitfd_cleanup(ASYNC_WAIT_CTX *ctx, const void *key,
170 OSSL_ASYNC_FD waitfd, void *custom)
175 static int afalg_setup_async_event_notification(afalg_aio *aio)
178 ASYNC_WAIT_CTX *waitctx;
182 if ((job = ASYNC_get_current_job()) != NULL) {
184 waitctx = ASYNC_get_wait_ctx(job);
185 if (waitctx == NULL) {
186 ALG_WARN("%s: ASYNC_get_wait_ctx error", __func__);
189 /* Get waitfd from ASYNC_WAIT_CTX if it is alreday set */
190 ret = ASYNC_WAIT_CTX_get_fd(waitctx, engine_afalg_id,
194 * waitfd is not set in ASYNC_WAIT_CTX, create a new one
195 * and set it. efd will be signaled when AIO operation completes
197 aio->efd = eventfd(0);
198 if (aio->efd == -1) {
199 ALG_PERR("%s: Failed to get eventfd : ", __func__);
200 AFALGerr(AFALG_F_AFALG_SETUP_ASYNC_EVENT_NOTIFICATION,
201 AFALG_R_EVENTFD_FAILED);
204 ret = ASYNC_WAIT_CTX_set_wait_fd(waitctx, engine_afalg_id,
206 afalg_waitfd_cleanup);
208 ALG_WARN("%s: Failed to set wait fd", __func__);
212 /* make fd non-blocking in async mode */
213 if (fcntl(aio->efd, F_SETFL, O_NONBLOCK) != 0) {
214 ALG_WARN("%s: Failed to set event fd as NONBLOCKING",
218 aio->mode = MODE_ASYNC;
221 aio->efd = eventfd(0);
222 if (aio->efd == -1) {
223 ALG_PERR("%s: Failed to get eventfd : ", __func__);
224 AFALGerr(AFALG_F_AFALG_SETUP_ASYNC_EVENT_NOTIFICATION,
225 AFALG_R_EVENTFD_FAILED);
228 aio->mode = MODE_SYNC;
233 int afalg_init_aio(afalg_aio *aio)
237 /* Initialise for AIO */
239 r = io_setup(MAX_INFLIGHTS, &aio->aio_ctx);
241 ALG_PERR("%s: io_setup error : ", __func__);
242 AFALGerr(AFALG_F_AFALG_INIT_AIO, AFALG_R_IO_SETUP_FAILED);
246 memset(aio->cbt, 0, sizeof(aio->cbt));
248 aio->mode = MODE_UNINIT;
253 int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
258 unsigned int done = 0;
260 struct timespec timeout;
261 struct io_event events[MAX_INFLIGHTS];
267 /* if efd has not been initialised yet do it here */
268 if (aio->mode == MODE_UNINIT) {
269 r = afalg_setup_async_event_notification(aio);
274 cb = &(aio->cbt[0 % MAX_INFLIGHTS]);
275 memset(cb, '\0', sizeof(*cb));
276 cb->aio_fildes = sfd;
277 cb->aio_lio_opcode = IOCB_CMD_PREAD;
278 cb->aio_buf = (unsigned long)buf;
281 cb->aio_nbytes = len;
282 cb->aio_flags = IOCB_FLAG_RESFD;
283 cb->aio_resfd = aio->efd;
286 * Perform AIO read on AFALG socket, this in turn performs an async
287 * crypto operation in kernel space
289 r = io_read(aio->aio_ctx, 1, &cb);
291 ALG_PWARN("%s: io_read failed : ", __func__);
296 /* While AIO read is being performed pause job */
299 /* Check for completion of AIO read */
300 r = read(aio->efd, &eval, sizeof(eval));
302 if (errno == EAGAIN || errno == EWOULDBLOCK)
304 ALG_PERR("%s: read failed for event fd : ", __func__);
306 } else if (r == 0 || eval <= 0) {
307 ALG_WARN("%s: eventfd read %d bytes, eval = %lu\n", __func__, r,
312 /* Get results of AIO read */
313 r = io_getevents(aio->aio_ctx, 1, MAX_INFLIGHTS,
317 * events.res indicates the actual status of the operation.
318 * Handle the error condition first.
320 if (events[0].res < 0) {
322 * Underlying operation cannot be completed at the time
323 * of previous submission. Resubmit for the operation.
325 if (events[0].res == -EBUSY && retry++ < 3) {
326 r = io_read(aio->aio_ctx, 1, &cb);
328 ALG_PERR("%s: retry %d for io_read failed : ",
335 * Retries exceed for -EBUSY or unrecoverable error
336 * condition for this instance of operation.
339 ("%s: Crypto Operation failed with code %lld\n",
340 __func__, events[0].res);
344 /* Operation successful. */
347 ALG_PERR("%s: io_getevents failed : ", __func__);
350 ALG_WARN("%s: io_geteventd read 0 bytes\n", __func__);
358 static inline void afalg_set_op_sk(struct cmsghdr *cmsg,
359 const unsigned int op)
361 cmsg->cmsg_level = SOL_ALG;
362 cmsg->cmsg_type = ALG_SET_OP;
363 cmsg->cmsg_len = CMSG_LEN(ALG_OP_LEN);
364 *CMSG_DATA(cmsg) = (char)op;
367 static void afalg_set_iv_sk(struct cmsghdr *cmsg, const unsigned char *iv,
368 const unsigned int len)
370 struct af_alg_iv *aiv;
372 cmsg->cmsg_level = SOL_ALG;
373 cmsg->cmsg_type = ALG_SET_IV;
374 cmsg->cmsg_len = CMSG_LEN(ALG_IV_LEN(len));
375 aiv = (struct af_alg_iv *)CMSG_DATA(cmsg);
377 memcpy(aiv->iv, iv, len);
380 static inline int afalg_set_key(afalg_ctx *actx, const unsigned char *key,
384 ret = setsockopt(actx->bfd, SOL_ALG, ALG_SET_KEY, key, klen);
386 ALG_PERR("%s: Failed to set socket option : ", __func__);
387 AFALGerr(AFALG_F_AFALG_SET_KEY, AFALG_R_SOCKET_SET_KEY_FAILED);
394 static int afalg_create_sk(afalg_ctx *actx, const char *ciphertype,
395 const char *ciphername)
397 struct sockaddr_alg sa;
399 actx->bfd = actx->sfd = -1;
402 memset(&sa, 0, sizeof(sa));
403 sa.salg_family = AF_ALG;
404 strncpy((char *) sa.salg_type, ciphertype, ALG_MAX_SALG_TYPE);
405 sa.salg_type[ALG_MAX_SALG_TYPE-1] = '\0';
406 strncpy((char *) sa.salg_name, ciphername, ALG_MAX_SALG_NAME);
407 sa.salg_name[ALG_MAX_SALG_NAME-1] = '\0';
409 actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
410 if (actx->bfd == -1) {
411 ALG_PERR("%s: Failed to open socket : ", __func__);
412 AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_CREATE_FAILED);
416 r = bind(actx->bfd, (struct sockaddr *)&sa, sizeof(sa));
418 ALG_PERR("%s: Failed to bind socket : ", __func__);
419 AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_BIND_FAILED);
423 actx->sfd = accept(actx->bfd, NULL, 0);
425 ALG_PERR("%s: Socket Accept Failed : ", __func__);
426 AFALGerr(AFALG_F_AFALG_CREATE_SK, AFALG_R_SOCKET_ACCEPT_FAILED);
437 actx->bfd = actx->sfd = -1;
441 static int afalg_start_cipher_sk(afalg_ctx *actx, const unsigned char *in,
442 size_t inl, const unsigned char *iv,
445 struct msghdr msg = { 0 };
446 struct cmsghdr *cmsg;
449 # ifdef ALG_ZERO_COPY
452 char cbuf[CMSG_SPACE(ALG_IV_LEN(ALG_AES_IV_LEN)) + CMSG_SPACE(ALG_OP_LEN)];
454 memset(cbuf, 0, sizeof(cbuf));
455 msg.msg_control = cbuf;
456 msg.msg_controllen = sizeof(cbuf);
459 * cipher direction (i.e. encrypt or decrypt) and iv are sent to the
460 * kernel as part of sendmsg()'s ancillary data
462 cmsg = CMSG_FIRSTHDR(&msg);
463 afalg_set_op_sk(cmsg, enc);
464 cmsg = CMSG_NXTHDR(&msg, cmsg);
465 afalg_set_iv_sk(cmsg, iv, ALG_AES_IV_LEN);
467 /* iov that describes input data */
468 iov.iov_base = (unsigned char *)in;
471 msg.msg_flags = MSG_MORE;
473 # ifdef ALG_ZERO_COPY
476 * Works best when buffer is 4k aligned
477 * OPENS: out of place processing (i.e. out != in)
480 /* Input data is not sent as part of call to sendmsg() */
484 /* Sendmsg() sends iv and cipher direction to the kernel */
485 sbytes = sendmsg(actx->sfd, &msg, 0);
487 ALG_PERR("%s: sendmsg failed for zero copy cipher operation : ",
493 * vmsplice and splice are used to pin the user space input buffer for
494 * kernel space processing avoiding copys from user to kernel space
496 ret = vmsplice(actx->zc_pipe[1], &iov, 1, SPLICE_F_GIFT);
498 ALG_PERR("%s: vmsplice failed : ", __func__);
502 ret = splice(actx->zc_pipe[0], NULL, actx->sfd, NULL, inl, 0);
504 ALG_PERR("%s: splice failed : ", __func__);
511 /* Sendmsg() sends iv, cipher direction and input data to the kernel */
512 sbytes = sendmsg(actx->sfd, &msg, 0);
514 ALG_PERR("%s: sendmsg failed for cipher operation : ", __func__);
518 if (sbytes != (ssize_t) inl) {
519 ALG_WARN("Cipher operation send bytes %zd != inlen %zd\n", sbytes,
528 static int afalg_cipher_init(EVP_CIPHER_CTX *ctx, const unsigned char *key,
529 const unsigned char *iv, int enc)
534 char ciphername[ALG_MAX_SALG_NAME];
536 if (ctx == NULL || key == NULL) {
537 ALG_WARN("%s: Null Parameter\n", __func__);
541 if (EVP_CIPHER_CTX_cipher(ctx) == NULL) {
542 ALG_WARN("%s: Cipher object NULL\n", __func__);
546 actx = EVP_CIPHER_CTX_get_cipher_data(ctx);
548 ALG_WARN("%s: Cipher data NULL\n", __func__);
552 ciphertype = EVP_CIPHER_CTX_nid(ctx);
553 switch (ciphertype) {
554 case NID_aes_128_cbc:
555 strncpy(ciphername, "cbc(aes)", ALG_MAX_SALG_NAME);
558 ALG_WARN("%s: Unsupported Cipher type %d\n", __func__, ciphertype);
561 ciphername[ALG_MAX_SALG_NAME-1]='\0';
563 if (ALG_AES_IV_LEN != EVP_CIPHER_CTX_iv_length(ctx)) {
564 ALG_WARN("%s: Unsupported IV length :%d\n", __func__,
565 EVP_CIPHER_CTX_iv_length(ctx));
569 /* Setup AFALG socket for crypto processing */
570 ret = afalg_create_sk(actx, "skcipher", ciphername);
575 ret = afalg_set_key(actx, key, EVP_CIPHER_CTX_key_length(ctx));
579 /* Setup AIO ctx to allow async AFALG crypto processing */
580 if (afalg_init_aio(&actx->aio) == 0)
583 # ifdef ALG_ZERO_COPY
587 actx->init_done = MAGIC_INIT_NUM;
597 static int afalg_do_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
598 const unsigned char *in, size_t inl)
602 char nxtiv[ALG_AES_IV_LEN] = { 0 };
604 if (ctx == NULL || out == NULL || in == NULL) {
605 ALG_WARN("NULL parameter passed to function %s\n", __func__);
609 actx = (afalg_ctx *) EVP_CIPHER_CTX_get_cipher_data(ctx);
610 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM) {
611 ALG_WARN("%s afalg ctx passed\n",
612 ctx == NULL ? "NULL" : "Uninitialised");
617 * set iv now for decrypt operation as the input buffer can be
618 * overwritten for inplace operation where in = out.
620 if (EVP_CIPHER_CTX_encrypting(ctx) == 0) {
621 memcpy(nxtiv, in + (inl - ALG_AES_IV_LEN), ALG_AES_IV_LEN);
624 /* Send input data to kernel space */
625 ret = afalg_start_cipher_sk(actx, (unsigned char *)in, inl,
626 EVP_CIPHER_CTX_iv(ctx),
627 EVP_CIPHER_CTX_encrypting(ctx));
632 /* Perform async crypto operation in kernel space */
633 ret = afalg_fin_cipher_aio(&actx->aio, actx->sfd, out, inl);
637 if (EVP_CIPHER_CTX_encrypting(ctx)) {
638 memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), out + (inl - ALG_AES_IV_LEN),
641 memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), nxtiv, ALG_AES_IV_LEN);
647 static int afalg_cipher_cleanup(EVP_CIPHER_CTX *ctx)
652 ALG_WARN("NULL parameter passed to function %s\n", __func__);
656 actx = (afalg_ctx *) EVP_CIPHER_CTX_get_cipher_data(ctx);
657 if (actx == NULL || actx->init_done != MAGIC_INIT_NUM) {
658 ALG_WARN("%s afalg ctx passed\n",
659 ctx == NULL ? "NULL" : "Uninitialised");
665 # ifdef ALG_ZERO_COPY
666 close(actx->zc_pipe[0]);
667 close(actx->zc_pipe[1]);
669 /* close efd in sync mode, async mode is closed in afalg_waitfd_cleanup() */
670 if (actx->aio.mode == MODE_SYNC)
671 close(actx->aio.efd);
672 io_destroy(actx->aio.aio_ctx);
677 const EVP_CIPHER *afalg_aes_128_cbc(void)
679 if (_hidden_aes_128_cbc == NULL
680 && ((_hidden_aes_128_cbc =
681 EVP_CIPHER_meth_new(NID_aes_128_cbc,
683 AES_KEY_SIZE_128)) == NULL
684 || !EVP_CIPHER_meth_set_iv_length(_hidden_aes_128_cbc, AES_IV_LEN)
685 || !EVP_CIPHER_meth_set_flags(_hidden_aes_128_cbc,
687 EVP_CIPH_FLAG_DEFAULT_ASN1)
688 || !EVP_CIPHER_meth_set_init(_hidden_aes_128_cbc,
690 || !EVP_CIPHER_meth_set_do_cipher(_hidden_aes_128_cbc,
692 || !EVP_CIPHER_meth_set_cleanup(_hidden_aes_128_cbc,
693 afalg_cipher_cleanup)
694 || !EVP_CIPHER_meth_set_impl_ctx_size(_hidden_aes_128_cbc,
695 sizeof(afalg_ctx)))) {
696 EVP_CIPHER_meth_free(_hidden_aes_128_cbc);
697 _hidden_aes_128_cbc = NULL;
699 return _hidden_aes_128_cbc;
702 static int afalg_ciphers(ENGINE *e, const EVP_CIPHER **cipher,
703 const int **nids, int nid)
707 if (cipher == NULL) {
708 *nids = afalg_cipher_nids;
709 return (sizeof(afalg_cipher_nids) / sizeof(afalg_cipher_nids[0]));
713 case NID_aes_128_cbc:
714 *cipher = afalg_aes_128_cbc();
724 static int bind_afalg(ENGINE *e)
726 /* Ensure the afalg error handling is set up */
727 ERR_load_AFALG_strings();
729 if (!ENGINE_set_id(e, engine_afalg_id)
730 || !ENGINE_set_name(e, engine_afalg_name)
731 || !ENGINE_set_destroy_function(e, afalg_destroy)
732 || !ENGINE_set_init_function(e, afalg_init)
733 || !ENGINE_set_finish_function(e, afalg_finish)) {
734 AFALGerr(AFALG_F_BIND_AFALG, AFALG_R_INIT_FAILED);
739 * Create _hidden_aes_128_cbc by calling afalg_aes_128_cbc
740 * now, as bind_aflag can only be called by one thread at a
743 if (afalg_aes_128_cbc() == NULL) {
744 AFALGerr(AFALG_F_BIND_AFALG, AFALG_R_INIT_FAILED);
748 if (!ENGINE_set_ciphers(e, afalg_ciphers)) {
749 AFALGerr(AFALG_F_BIND_AFALG, AFALG_R_INIT_FAILED);
756 # ifndef OPENSSL_NO_DYNAMIC_ENGINE
757 static int bind_helper(ENGINE *e, const char *id)
759 if (id && (strcmp(id, engine_afalg_id) != 0))
762 if (!afalg_chk_platform())
770 IMPLEMENT_DYNAMIC_CHECK_FN()
771 IMPLEMENT_DYNAMIC_BIND_FN(bind_helper)
774 static int afalg_chk_platform(void)
778 int kver[3] = { -1, -1, -1 };
784 AFALGerr(AFALG_F_AFALG_CHK_PLATFORM,
785 AFALG_R_FAILED_TO_GET_PLATFORM_INFO);
789 str = strtok(ut.release, ".");
790 for (i = 0; i < 3 && str != NULL; i++) {
792 str = strtok(NULL, ".");
795 if (KERNEL_VERSION(kver[0], kver[1], kver[2])
796 < KERNEL_VERSION(K_MAJ, K_MIN1, K_MIN2)) {
797 ALG_ERR("ASYNC AFALG not supported this kernel(%d.%d.%d)\n",
798 kver[0], kver[1], kver[2]);
799 ALG_ERR("ASYNC AFALG requires kernel version %d.%d.%d or later\n",
800 K_MAJ, K_MIN1, K_MIN2);
801 AFALGerr(AFALG_F_AFALG_CHK_PLATFORM,
802 AFALG_R_KERNEL_DOES_NOT_SUPPORT_ASYNC_AFALG);
809 # ifdef OPENSSL_NO_DYNAMIC_ENGINE
810 static ENGINE *engine_afalg(void)
812 ENGINE *ret = ENGINE_new();
815 if (!bind_afalg(ret)) {
822 void engine_load_afalg_int(void)
826 if (!afalg_chk_platform())
829 toadd = engine_afalg();
838 static int afalg_init(ENGINE *e)
843 static int afalg_finish(ENGINE *e)
848 static int afalg_destroy(ENGINE *e)
850 ERR_unload_AFALG_strings();
851 EVP_CIPHER_meth_free(_hidden_aes_128_cbc);
852 _hidden_aes_128_cbc = NULL;
856 #endif /* KERNEL VERSION */