Description: Fix hmac.new() in python 3.8
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2020-02-10

--- python-oauth2client-4.1.2.orig/oauth2client/contrib/xsrfutil.py
+++ python-oauth2client-4.1.2/oauth2client/contrib/xsrfutil.py
@@ -16,6 +16,7 @@
 
 import base64
 import binascii
+import hashlib
 import hmac
 import time
 
@@ -44,7 +45,7 @@ def generate_token(key, user_id, action_
     Returns:
         A string XSRF protection token.
     """
-    digester = hmac.new(_helpers._to_bytes(key, encoding='utf-8'))
+    digester = hmac.new(_helpers._to_bytes(key, encoding='utf-8'), digestmod=hashlib.md5)
     digester.update(_helpers._to_bytes(str(user_id), encoding='utf-8'))
     digester.update(DELIMITER)
     digester.update(_helpers._to_bytes(action_id, encoding='utf-8'))
--- python-oauth2client-4.1.2.orig/tests/contrib/test_xsrfutil.py
+++ python-oauth2client-4.1.2/tests/contrib/test_xsrfutil.py
@@ -17,6 +17,7 @@
 import base64
 import unittest
 
+import hashlib
 import mock
 
 from oauth2client import _helpers
@@ -46,7 +47,7 @@ class Test_generate_token(unittest.TestC
                                             TEST_USER_ID_1,
                                             action_id=TEST_ACTION_ID_1,
                                             when=TEST_TIME)
-            hmac.new.assert_called_once_with(TEST_KEY)
+            hmac.new.assert_called_once_with(TEST_KEY, digestmod=hashlib.md5)
             digester.digest.assert_called_once_with()
 
             expected_digest_calls = [
@@ -79,7 +80,7 @@ class Test_generate_token(unittest.TestC
                                                 TEST_USER_ID_1,
                                                 action_id=TEST_ACTION_ID_1)
 
-                hmac.new.assert_called_once_with(TEST_KEY)
+                hmac.new.assert_called_once_with(TEST_KEY, digestmod=hashlib.md5)
                 time.time.assert_called_once_with()
                 digester.digest.assert_called_once_with()
 
