Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2:FactoryCandidates
python-PyKMIP
fix_test_mac_with_cryptographic_failure.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File fix_test_mac_with_cryptographic_failure.patch of Package python-PyKMIP
From c70dbe4ed1d53a1a5dbd3aecaaba7fe654a4fbf1 Mon Sep 17 00:00:00 2001 From: arp102 <92389169+arp102@users.noreply.github.com> Date: Tue, 8 Aug 2023 15:35:21 -0400 Subject: [PATCH] Fix test_mac_with_cryptographic_failure unit test. This test is meant to intentionally trigger an exception in the cryptography library by creating a CMAC with a non-block cipher algorithm, IDEA. That doesn't work any more because IDEA is now treated as a block cipher algorithm. To fix this, we now use the ARC4 algorithm instead, which does trigger the expected exception. --- kmip/services/server/crypto/engine.py | 3 +-- kmip/tests/unit/services/server/crypto/test_engine.py | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/kmip/services/server/crypto/engine.py b/kmip/services/server/crypto/engine.py index e6527e4b..15527701 100644 --- a/kmip/services/server/crypto/engine.py +++ b/kmip/services/server/crypto/engine.py @@ -269,8 +269,7 @@ def mac(self, algorithm, key, data): ) cipher_algorithm = self._symmetric_key_algorithms.get(algorithm) try: - # ARC4 and IDEA algorithms will raise exception as CMAC - # requires block ciphers + # ARC4 and other non-block cipher algorithms will raise TypeError exceptions c = cmac.CMAC(cipher_algorithm(key), backend=default_backend()) c.update(data) mac_data = c.finalize() diff --git a/kmip/tests/unit/services/server/crypto/test_engine.py b/kmip/tests/unit/services/server/crypto/test_engine.py index 4adb222b..edb52832 100644 --- a/kmip/tests/unit/services/server/crypto/test_engine.py +++ b/kmip/tests/unit/services/server/crypto/test_engine.py @@ -247,8 +247,8 @@ def __init__(self): engine = crypto.CryptographyEngine() - # IDEA is not block cipher so cmac should raise exception - args = [enums.CryptographicAlgorithm.IDEA, key, data] + # RC4 is not block cipher so cmac should raise exception + args = [enums.CryptographicAlgorithm.RC4, key, data] self.assertRaises( exceptions.CryptographicFailure, engine.mac,
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor