lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Mon, 10 Nov 2014 22:00:02 +0800
From:	Herbert Xu <>
To:	Stephan Mueller <>
Subject: Re: crypto: algif_skcipher: check for IV size superfluous?

On Sat, Nov 08, 2014 at 01:32:30AM +0100, Stephan Mueller wrote:
> Hi Herbert,
> I am in the process to extend algif_skcipher to support AEAD ciphers as well. 
> The code already works but I want to run final tests before releasing it.
> In the course of the development I stumbled over the following code:
> static int skcipher_sendmsg(struct kiocb *unused, struct socket *sock,
> 			    struct msghdr *msg, size_t size)
> {
> ...
> 		if (con.iv && con.iv->ivlen != ivsize)
> 			return -EINVAL;
> This code effectively requires that any user space code trying to use a cipher 
> must provide an IV that is equal to the blocksize of the cipher.
> I am wondering why this check is there or whether we can remove that.
> When using the kernel crypto API inside the kernel, there is no such 
> enforcement. One can take shorter IVs which are implicitly padded with 
> trailing zeros.

The kernel requires you to provide an IV that's exactly the size
required by the algorithm.  As otherwise the API would need to
specify an explicit IV size per request.
> However, if we conclude that the check should remain, then I am wondering 
> whether we have to move it to the various _setiv functions of the kernel 
> crypto API instead of leaving it in the skcipher interface. 

The kernel interface does not have an explicit IV size in the
request.  Therefore there is no way for us to check.

Email: Herbert Xu <>
Home Page:
PGP Key:
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists