Fix undocumented functions in secretutils

Change-Id: Ic226f4b64b91a1a391d6be2cb3c9f781440ef318
This commit is contained in:
Takashi Kajinami 2025-03-19 10:08:51 +09:00
parent dfdd8fa557
commit 67345b82e0
2 changed files with 9 additions and 1 deletions

View File

@ -3,4 +3,4 @@
=============
.. automodule:: oslo_utils.secretutils
:members: constant_time_compare
:members:

View File

@ -31,6 +31,14 @@ import debtcollector.removals
@debtcollector.removals.remove(message='Use hmac.compare_digest instead',
category=DeprecationWarning)
def constant_time_compare(*args, **kwargs):
"""Return True if both string or binary inputs are equal, otherwise False.
This function should take a constant amount of time regardless of
how many characters in the strings match. This function uses an
approach designed to prevent timing analysis by avoiding
content-based short circuiting behaviour, making it appropriate
for cryptography.
"""
return hmac.compare_digest(*args, **kwargs)