[Mesa-dev] [PATCH] mesa: Add mesa SHA-1 functions

Jonathan Gray jsg at jsg.id.au
Mon Dec 22 02:58:39 PST 2014


On Fri, Dec 19, 2014 at 11:44:42AM -0800, Kenneth Graunke wrote:
> On Sunday, December 14, 2014 03:06:41 PM Emil Velikov wrote:
> > On 11/12/14 21:51, Carl Worth wrote:
> > > From: Kristian Høgsberg <krh at bitplanet.net>
> > > 
> > > The upcoming shader cache uses the SHA-1 algorithm for cryptographic
> > > naming. These new mesa_sha1 functions are implemented with the nettle
> > > library.
> > > ---
> > > 
> > > This patch is another in support of my upcoming shader-cache work. Thanks to
> > > Kritian for coding this piece.
> > > 
> > > As currently written, this patch introduces a new dependency of Mesa on the
> > > Nettle library to implement SHA-1. I'm open to recommendations if people would prefer some other option.
> > > 
> > > For example, the xserver can be configured to get a SHA-1 implementation from
> > > libmd, libc, CommonCrypto, CryptoAPI, libnettle, libgcrypt, libsha1, or
> > > openssl.
> > > 
> > > I don't know if it's important to offer as many options as that, which is why
> > > I'm asking for opinions here.
> > > 
> > Hi Carl,
> > 
> > Can we try to avoid adding new dependencies to mesa unless absolutely
> > needed. Neither of the proprietary drivers does so presently, so it will
> > be nice to keep the trend.
> > 
> > While currently the steam runtime does not include libnettle I can
> > envision one day that they will/might. Even with steam aside I think
> > that this might cause issues with gnome & others' sandboxing.
> > 
> > Long story short - can we import a sha1 implementation from another
> > project ? It will save us the "libstdc++ style steam runtime" issues,
> > plus it will ease the question of what to do under Windows :)
> > 
> > 
> > Thanks
> > Emil
> 
> FWIW, when I hacked together a shader cache proof of concept, I imported
> smallsha1, which is just a pair of .cpp/.h files:
> 
> https://code.google.com/p/smallsha1/
> 
> It's BSD-3-Clause - my main criteria was that it had to be permissively
> licensed.  Having the implementation in a single file is nice as well.
> 
> --Ken

fwiw the version in OpenBSD's libc is public domain and quite small
http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/hash/sha1.c?rev=HEAD
http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/include/sha1.h?rev=HEAD


More information about the mesa-dev mailing list