From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752089AbdBAMNJ (ORCPT ); Wed, 1 Feb 2017 07:13:09 -0500 Received: from verein.lst.de ([213.95.11.211]:34882 "EHLO newverein.lst.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751311AbdBAMNH (ORCPT ); Wed, 1 Feb 2017 07:13:07 -0500 Date: Wed, 1 Feb 2017 13:13:05 +0100 From: Torsten Duwe To: Herbert Xu Cc: stable@vger.kernel.org, Jiri Slaby , linux-kernel@vger.kernel.org Subject: af_alg broken in 3.12 Message-ID: <20170201121305.GA3260@lst.de> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="LyciRD1jyfeSSjG0" Content-Disposition: inline User-Agent: Mutt/1.5.17 (2007-11-01) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --LyciRD1jyfeSSjG0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi Herbert, you sent a backport of 6de62f15b581f920ade22d758f4c338311c2f0d4 to be included in the 3.12 branch (as b2a0707817d3dec83652bb460a7775613058ae), but this leaves af_alg broken for unkeyed hash functions: f382cd5ac26674877143fa7d9c0ea23c6640e706 (3.12 just before your commit) : socket(PF_ALG, SOCK_SEQPACKET, 0) = 3 bind(3, {sa_family=AF_ALG, sa_data="hash\0\0\0\0\0\0\0\0\0\0"}, 88) = 0 accept(3, 0, NULL) = 4 write(4, "abc", 3) = 3 read(4, "\220\1P\230<\322O\260\326\226?}(\341\177r", 16) = 16 and with b2a0707817d3dec83652bb460a7775613058ae applied: socket(PF_ALG, SOCK_SEQPACKET, 0) = 3 bind(3, {sa_family=AF_ALG, sa_data="hash\0\0\0\0\0\0\0\0\0\0"}, 88) = 0 accept(3, 0, NULL) = 4 write(4, "abc", 3) = -1 ENOKEY (Required key not available) read(4, 0x7ffebeba0e30, 16) = -1 ENOKEY (Required key not available) Mainline has meanwhile seen many fixes to this change; can you suggest an elegant and crisp backport for these as well? TIA, Torsten --LyciRD1jyfeSSjG0 Content-Type: text/x-c++src; charset=us-ascii Content-Disposition: attachment; filename="alg.c" #include #include #include #include #include #include #include int main(void) { int opfd; int tfmfd; struct sockaddr_alg sa = { .salg_family = AF_ALG, .salg_type = "hash", .salg_name = "md5" }; char buf[20]; int i; tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0); bind(tfmfd, (struct sockaddr *)&sa, sizeof(sa)); opfd = accept(tfmfd, NULL, 0); write(opfd, "abc", 3); if (read(opfd, buf, 16) == -1) { printf("ERROR: %d\n", errno); exit(-1); } for (i = 0; i < 16; i++) { printf("%02x", (unsigned char)buf[i]); } printf("\n"); close(opfd); close(tfmfd); return 0; } --LyciRD1jyfeSSjG0--