From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-938213-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id EDE3A139694
	for <garchives@archives.gentoo.org>; Mon, 13 Mar 2017 21:47:11 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id ADA7A21C097;
	Mon, 13 Mar 2017 21:47:04 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 7215021C097
	for <gentoo-commits@lists.gentoo.org>; Mon, 13 Mar 2017 21:46:49 +0000 (UTC)
Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 8739D340988
	for <gentoo-commits@lists.gentoo.org>; Mon, 13 Mar 2017 21:46:48 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id 42EE46741
	for <gentoo-commits@lists.gentoo.org>; Mon, 13 Mar 2017 21:46:46 +0000 (UTC)
From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" <mgorny@gentoo.org>
Message-ID: <1489441590.0eba01c258f8b3716cff0a768afaa3bb0271479b.mgorny@gentoo>
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/
X-VCS-Repository: proj/portage
X-VCS-Files: pym/portage/checksum.py
X-VCS-Directories: pym/portage/
X-VCS-Committer: mgorny
X-VCS-Committer-Name: Michał Górny
X-VCS-Revision: 0eba01c258f8b3716cff0a768afaa3bb0271479b
X-VCS-Branch: master
Date: Mon, 13 Mar 2017 21:46:46 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 91cdf5d6-c4a2-44b1-ac2c-96542627ae65
X-Archives-Hash: ffc79a4cca36257bfb993a6831e53260

commit:     0eba01c258f8b3716cff0a768afaa3bb0271479b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 12 17:02:01 2017 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Mar 13 21:46:30 2017 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=0eba01c2

portage.checksum: Support pygost as fallback Streebog provider

Support the pure Python implementation of Streebog in pygost as
a fallback algorithm. The code is horrible (it stores all the data
in memory before hashing), so it is really intended as last fallback.

 pym/portage/checksum.py | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/pym/portage/checksum.py b/pym/portage/checksum.py
index 3ee100c3f..df896533f 100644
--- a/pym/portage/checksum.py
+++ b/pym/portage/checksum.py
@@ -247,6 +247,21 @@ if 'RMD160' not in hashfunc_map or 'WHIRLPOOL' not in hashfunc_map:
 		pass
 
 
+# Support pygost as fallback streebog provider
+# It's mostly provided as a reference implementation; it's pure Python,
+# slow and reads all data to memory (i.e. doesn't hash on update()...)
+if 'STREEBOG256' not in hashfunc_map or 'STREEBOG512' not in hashfunc_map:
+	try:
+		import pygost.gost34112012
+
+		_generate_hash_function("STREEBOG256",
+			functools.partial(pygost.gost34112012.GOST34112012, digest_size=32), origin="pygost")
+		_generate_hash_function("STREEBOG512",
+			functools.partial(pygost.gost34112012.GOST34112012, digest_size=64), origin="pygost")
+	except ImportError:
+		pass
+
+
 _whirlpool_unaccelerated = False
 if "WHIRLPOOL" not in hashfunc_map:
 	# Bundled WHIRLPOOL implementation