nixpkgs/pkgs/applications/misc/pass-secret-service/int_from_bytes-deprecation-fix.patch
Aidan Gauland d9119dbbdf
pass-secret-service: unstable-2020-04-12 -> unstable-2022-03-21
* Update to the latest upstream version of pass-secret-service that includes
  systemd service files.
* Add patch to fix use of a function that has been removed from the Python
  Cryptography library in NixOS 22.05
* Install systemd service files in the Nix package.
* Add NixOS test to ensure the D-Bus API activates the service unit.
* Add myself as a maintainer to the package and NixOS test.
* Use checkTarget instead of equivalent custom checkPhase.
2022-07-12 07:33:26 +12:00

23 lines
1.0 KiB
Diff

--- a/pass_secret_service/interfaces/session.py
+++ b/pass_secret_service/interfaces/session.py
@@ -4,7 +4,6 @@
import os
import hmac
from hashlib import sha256
-from cryptography.utils import int_from_bytes
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.ciphers import Cipher
from cryptography.hazmat.primitives.ciphers.modes import CBC
@@ -27,9 +26,9 @@ class Session(ServiceInterface, SerialMixin):
@classmethod
@run_in_executor
def _create_dh(cls, input):
- priv_key = int_from_bytes(os.urandom(0x80), "big")
+ priv_key = int.from_bytes(os.urandom(0x80), "big")
pub_key = pow(2, priv_key, dh_prime)
- shared_secret = pow(int_from_bytes(input, "big"), priv_key, dh_prime)
+ shared_secret = pow(int.from_bytes(input, "big"), priv_key, dh_prime)
salt = b"\x00" * 0x20
shared_key = hmac.new(salt, shared_secret.to_bytes(0x80, "big"), sha256).digest()
aes_key = hmac.new(shared_key, b"\x01", sha256).digest()[:0x10]