git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Migrating away from SHA-1?

From
HAH. Peter Anvin <hpa@zytor.com>
Date
Apr 12, 2016, 23:06 UTC
Message-ID
<570D7F8D.9050406@zytor.com>
In-Reply-To
<CAGZ79kaUN0G7i0GNZgWU7ZzJvWY=k=Rc6tqWvJsTu8gcRhP5bA@mail.gmail.com>
On 04/12/16 16:00, Stefan Beller wrote:
Show 16 quoted lines
> On Tue, Apr 12, 2016 at 3:38 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> OK, I'm going to open this can of worms...
>>
>> At what point do we migrate from SHA-1?  At this point the cryptoanalysis of
>> SHA-1 is most likely a matter of time.
>
> And I thought the cryptographic properties of SHA1 did not matter for
> Gits use case.
> We could employ broken md5 or such as well.
> ( see http://stackoverflow.com/questions/28792784/why-does-git-use-a-cryptographic-hash-function
> )
> That is because security goes on top via gpg signing of tags/commits.
>
> I am not sure if anyone came up with
> a counter argument to Linus reasoning there?
>

Not true, because what we are signing is a chain of SHA-1s; the signature is meaningless unless the integrity of the hash chain is inviolate.

Show 23 quoted lines
>>
>> For existing repositories we will need to have a migration mechanism. Since
>> we can't modify objects without completely invalidating the cryptographic
>> properties, what I would suggest is that we leave the existing objects as
>> is, with a persistent lookup table from SHA-1 to <new hash>, and have that
>> lookup table signed (e.g. GPG) by the person responsible for converting the
>> repository.  This freezes the cryptographic status of the existing SHA-1
>> objects at the time the conversion happens.  This is a very good reason to
>> do this before SHA-1 is actually broken  In contrast. SHA-2 has been
>> surprisingly resistant to cryptoanalysis, to the point that SHA-3 was
>> motivated by performance and the desire to have a well-tested function based
>> on entirely different principles should a generic attack against the common
>> structure of MD5/SHA-1/SHA-2 would ever be found.
>
> When the kernel moved from BitKeeper to Git, all history was thrown away,
> and started from scratch. The old history could be grafted into the
> repo, if you cared
> though.
>
> I'd propose to go that route again and use a sha1 graft history which
> you can get optionally
> put into your new history for convenience.
>

That was done more for legal reasons than anything else, as far as I understand. The userbase of git today is also much, much larger than the userbase for BK ever was.

	-hpa
Previous: Stefan BellerNext: Jeff King
Message 3 of 21 in “Migrating away from SHA-1?”
  1. H. Peter AnvinApr 12, 2016
  2. Stefan BellerApr 12, 2016
  3. H. Peter AnvinApr 12, 2016
  4. Jeff KingApr 12, 2016
  5. David TurnerApr 12, 2016
  6. Jeff KingApr 12, 2016
  7. Theodore Ts'oApr 14, 2016
  8. Joey HessApr 14, 2016
  9. David TurnerApr 14, 2016
  10. H. Peter AnvinApr 14, 2016
  11. Theodore Ts'oApr 14, 2016
  12. Jeff KingApr 15, 2016
  13. Junio C HamanoApr 15, 2016
  14. Jeff KingApr 15, 2016
  15. Jeff KingApr 12, 2016
  16. Junio C HamanoApr 13, 2016
  17. Jeff KingApr 13, 2016
  18. H. Peter AnvinApr 13, 2016
  19. Duy NguyenApr 13, 2016
  20. H. Peter AnvinApr 13, 2016
  21. brian m. carlsonApr 15, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.