Linux Crypto API changed to using aead_request_set_ad()
instead of aead_request_set_assoc().

Based on Horia Geantă's patch from
https://mail.gna.org/public/cryptodev-linux-devel/2015-11/msg00002.html

However we need to version-guard the change for older versions of the
kernel to avoid the build from breaking for them.

Tested with 4.3 on a p1010rdb.

Signed-off-by: Gustavo Zacarias <gust...@zacarias.com.ar>
---
 cryptlib.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/cryptlib.h b/cryptlib.h
index a0a8a63..f0c2736 100644
--- a/cryptlib.h
+++ b/cryptlib.h
@@ -1,6 +1,8 @@
 #ifndef CRYPTLIB_H
 # define CRYPTLIB_H
 
+#include <linux/version.h>
+
 struct cipher_data {
        int init; /* 0 uninitialized */
        int blocksize;
@@ -40,7 +42,11 @@ static inline void cryptodev_cipher_auth(struct cipher_data 
*cdata,
                                         struct scatterlist *sg1, size_t len)
 {
        /* for some reason we _have_ to call that even for zero length sgs */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0))
        aead_request_set_assoc(cdata->async.arequest, len ? sg1 : NULL, len);
+#else
+       aead_request_set_ad(cdata->async.arequest, len);
+#endif
 }
 
 static inline void cryptodev_cipher_set_tag_size(struct cipher_data *cdata, 
int size)
-- 
2.4.10


_______________________________________________
Cryptodev-linux-devel mailing list
Cryptodev-linux-devel@gna.org
https://mail.gna.org/listinfo/cryptodev-linux-devel

Reply via email to