Engine afalg: properly set operation type also on big endian.
authorTomas Mraz <tmraz@fedoraproject.org>
Wed, 12 Oct 2016 12:32:05 +0000 (14:32 +0200)
committerMatt Caswell <matt@openssl.org>
Fri, 14 Oct 2016 19:09:53 +0000 (20:09 +0100)
Copy the whole ALG_OP_TYPE to CMSG_DATA.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(cherry picked from commit 574cffd5d5b8f57f811c8d36d930205041deedee)

engines/afalg/e_afalg.c

index 2c13ba80ed071708730192d3f70149b78fa6d2f3..658de4250b72b7cbf196251e62dfc96874bc25f8 100644 (file)
@@ -322,12 +322,12 @@ int afalg_fin_cipher_aio(afalg_aio *aio, int sfd, unsigned char *buf,
 }
 
 static ossl_inline void afalg_set_op_sk(struct cmsghdr *cmsg,
-                                   const unsigned int op)
+                                   const ALG_OP_TYPE op)
 {
     cmsg->cmsg_level = SOL_ALG;
     cmsg->cmsg_type = ALG_SET_OP;
     cmsg->cmsg_len = CMSG_LEN(ALG_OP_LEN);
-    *CMSG_DATA(cmsg) = (char)op;
+    memcpy(CMSG_DATA(cmsg), &op, ALG_OP_LEN);
 }
 
 static void afalg_set_iv_sk(struct cmsghdr *cmsg, const unsigned char *iv,