From: Torsten Duwe <duwe@lst.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: stable@vger.kernel.org, Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org
Subject: af_alg broken in 3.12
Date: Wed, 1 Feb 2017 13:13:05 +0100 [thread overview]
Message-ID: <20170201121305.GA3260@lst.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 1074 bytes --]
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
[-- Attachment #2: alg.c --]
[-- Type: text/x-c++src, Size: 713 bytes --]
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <linux/if_alg.h>
#include <errno.h>
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;
}
next reply other threads:[~2017-02-01 12:13 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-01 12:13 Torsten Duwe [this message]
2017-02-03 12:05 ` af_alg broken in 3.12 Torsten Duwe
2017-02-14 15:30 ` [PATCH] Fix af_alg " Torsten Duwe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170201121305.GA3260@lst.de \
--to=duwe@lst.de \
--cc=herbert@gondor.apana.org.au \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).