Package: gost-crypto-dkms
Version: 0.3.2-2
Severity: important

Dear Maintainer,

gost-crypto fails to build against Linux 5.6:

...
  CC [M]  /home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.o
/home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.c: In function 
‘crypto_gost28147_set_key’:
/home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.c:103:29: error: 
‘CRYPTO_TFM_RES_BAD_KEY_LEN’ undeclared (first use in this function); did you 
mean ‘CRYPTO_TFM_NEED_KEY’?
  103 |   crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
      |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                             CRYPTO_TFM_NEED_KEY
/home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.c:103:29: note: each 
undeclared identifier is reported only once for each function it appears in
/home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.c: In function 
‘gost28147imit_setkey’:
/home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.c:316:31: error: 
‘CRYPTO_TFM_RES_BAD_KEY_LEN’ undeclared (first use in this function); did you 
mean ‘CRYPTO_TFM_NEED_KEY’?
  316 |   crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
      |                               ^~~~~~~~~~~~~~~~~~~~~~~~~~
      |                               CRYPTO_TFM_NEED_KEY
make[2]: *** [scripts/Makefile.build:276:
/home/ubuntu/gost-crypto/gost-crypto-0.3.2/gost28147_basic.o] Error 1
...

The attached debdiff fixes it.

-- System Information:
Debian Release: bullseye/sid
  APT prefers focal-updates
  APT policy: (500, 'focal-updates'), (500, 'focal-security'), (500, 
'focal-proposed'), (500, 'focal'), (100, 'focal-backports')
Architecture: amd64 (x86_64)

Kernel: Linux 5.4.0-31-generic (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) (ignored: LC_ALL 
set to C.UTF-8), LANGUAGE=en_US:en (charmap=UTF-8) (ignored: LC_ALL set to 
C.UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages gost-crypto-dkms depends on:
ii  dkms  2.8.1-5ubuntu1

gost-crypto-dkms recommends no packages.

gost-crypto-dkms suggests no packages.
diff -Nru gost-crypto-0.3.2/debian/changelog gost-crypto-0.3.2/debian/changelog
--- gost-crypto-0.3.2/debian/changelog  2019-08-05 01:15:18.000000000 +0000
+++ gost-crypto-0.3.2/debian/changelog  2020-05-14 09:15:50.000000000 +0000
@@ -1,3 +1,9 @@
+gost-crypto (0.3.2-3) unstable; urgency=medium
+
+  * Fix build for Linux 5.6.
+
+ -- Paolo Pisati <paolo.pis...@canonical.com>  Thu, 14 May 2020 09:15:50 +0000
+
 gost-crypto (0.3.2-2) unstable; urgency=medium
 
   * d/control: bump Standards-Version to 4.4.0 (no changes needed)
diff -Nru 
gost-crypto-0.3.2/debian/patches/0001-Linux-5.6-garbage-collect-CRYPTO_TFM_RES_BAD_KEY_LEN.patch
 
gost-crypto-0.3.2/debian/patches/0001-Linux-5.6-garbage-collect-CRYPTO_TFM_RES_BAD_KEY_LEN.patch
--- 
gost-crypto-0.3.2/debian/patches/0001-Linux-5.6-garbage-collect-CRYPTO_TFM_RES_BAD_KEY_LEN.patch
    1970-01-01 00:00:00.000000000 +0000
+++ 
gost-crypto-0.3.2/debian/patches/0001-Linux-5.6-garbage-collect-CRYPTO_TFM_RES_BAD_KEY_LEN.patch
    2020-05-14 09:15:28.000000000 +0000
@@ -0,0 +1,93 @@
+From 7754f7c84e6330a9c0918a4534fedfd1095295c7 Mon Sep 17 00:00:00 2001
+From: Paolo Pisati <paolo.pis...@canonical.com>
+Date: Thu, 14 May 2020 09:11:04 +0000
+Subject: [PATCH] Linux 5.6: garbage collect CRYPTO_TFM_RES_BAD_KEY_LEN flag
+
+commit 674f368a952c48ede71784935a799a5205b92b6c "crypto: remove
+CRYPTO_TFM_RES_BAD_KEY_LEN" in Linux 5.6 removed the above flag since it wasn't
+enforced anywhere (and thus useless) and any external modules now using it end
+up FTBFS.
+
+Signed-off-by: Paolo Pisati <paolo.pis...@canonical.com>
+---
+ gost28147_basic.c    | 14 +++++---------
+ kuznyechik_generic.c |  4 +---
+ magma_generic.c      |  4 +---
+ 3 files changed, 7 insertions(+), 15 deletions(-)
+
+diff --git a/gost28147_basic.c b/gost28147_basic.c
+index 18fa75b..f524519 100644
+--- a/gost28147_basic.c
++++ b/gost28147_basic.c
+@@ -89,9 +89,9 @@ EXPORT_SYMBOL_GPL(gost28147_param_TC26_Z);
+  * @key_len:  The size of the key.
+  * @param:    GOST parameters to be used.
+  *
+- * Returns 0 on success, on failure the %CRYPTO_TFM_RES_BAD_KEY_LEN flag in 
tfm
+- * is set. &crypto_gost28147_ctx _must_ be the private data embedded in @tfm
+- * which is retrieved with crypto_tfm_ctx().
++ * Returns 0 on success. &crypto_gost28147_ctx _must_ be
++ * the private data embedded in @tfm which is retrieved
++ * with crypto_tfm_ctx().
+  */
+ int crypto_gost28147_set_key(struct crypto_tfm *tfm, const u8 *in_key,
+               unsigned int key_len, const struct gost28147_param *param)
+@@ -99,10 +99,8 @@ int crypto_gost28147_set_key(struct crypto_tfm *tfm, const 
u8 *in_key,
+       struct crypto_gost28147_ctx *ctx = crypto_tfm_ctx(tfm);
+       int i;
+ 
+-      if (key_len != GOST28147_KEY_SIZE) {
+-              crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
++      if (key_len != GOST28147_KEY_SIZE)
+               return -EINVAL;
+-      };
+ 
+       for (i = 0; i < GOST28147_KEY_SIZE / 4; i++, in_key += 4)
+               ctx->key[i] = get_unaligned_le32(in_key);
+@@ -312,10 +310,8 @@ static int gost28147imit_setkey(struct crypto_shash *tfm, 
const u8 *key,
+       struct crypto_gost28147imit_ctx *ctx = crypto_shash_ctx(tfm);
+       int i;
+ 
+-      if (key_len != GOST28147IMIT_KEY_SIZE) {
+-              crypto_shash_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
++      if (key_len != GOST28147IMIT_KEY_SIZE)
+               return -EINVAL;
+-      };
+ 
+       for (i = 0; i < GOST28147IMIT_KEY_SIZE / 4; i++, key += 4)
+               ctx->key[i] = get_unaligned_le32(key);
+diff --git a/kuznyechik_generic.c b/kuznyechik_generic.c
+index 538b52f..f72ba6d 100644
+--- a/kuznyechik_generic.c
++++ b/kuznyechik_generic.c
+@@ -169,10 +169,8 @@ static int kuznyechik_set_key(struct crypto_tfm *tfm, 
const u8 *in_key,
+       u32 *flags = &tfm->crt_flags;
+       unsigned int i;
+ 
+-      if (key_len != KUZNYECHIK_KEY_SIZE) {
+-              *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
++      if (key_len != KUZNYECHIK_KEY_SIZE)
+               return -EINVAL;
+-      };
+ 
+       memcpy(ctx->key, in_key, 32);
+       subkey(ctx->key + 32, ctx->key, 0);
+diff --git a/magma_generic.c b/magma_generic.c
+index 1b1532e..f2d8a71 100644
+--- a/magma_generic.c
++++ b/magma_generic.c
+@@ -26,10 +26,8 @@ static int magma_set_key(struct crypto_tfm *tfm, const u8 
*in_key,
+       u32 *flags = &tfm->crt_flags;
+       int i;
+ 
+-      if (key_len != MAGMA_KEY_SIZE) {
+-              *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN;
++      if (key_len != MAGMA_KEY_SIZE)
+               return -EINVAL;
+-      };
+ 
+       for (i = 0; i < MAGMA_KEY_SIZE / 4; i++, in_key += 4)
+               ctx->key[i] = get_unaligned_be32(in_key);
+-- 
+2.25.1
+
diff -Nru gost-crypto-0.3.2/debian/patches/series 
gost-crypto-0.3.2/debian/patches/series
--- gost-crypto-0.3.2/debian/patches/series     1970-01-01 00:00:00.000000000 
+0000
+++ gost-crypto-0.3.2/debian/patches/series     2020-05-14 09:15:47.000000000 
+0000
@@ -0,0 +1 @@
+0001-Linux-5.6-garbage-collect-CRYPTO_TFM_RES_BAD_KEY_LEN.patch

Reply via email to