Skip to content

Commit

Permalink
v0.23.7: refactor(algorithm): remove hard-coded KDF in X25519 met…
Browse files Browse the repository at this point in the history
…hods [#4]
  • Loading branch information
rmlibre committed Jun 20, 2024
1 parent 3c2e558 commit 0cfd31b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Minor Changes

- Move ``FrozenInstance`` class to its own module.
- chore(release): Mark complete ``v0.23.x`` series commits with git tags.
- refactor(algorithm): Remove hard-coded KDF in ``X25519`` protocol methods. (#4)
- Improvements & fixes to doc strings.
- Improvements & fixes to package tests.
- Improvements & fixes to code formatting & style.
Expand Down
9 changes: 5 additions & 4 deletions aiootp/keygens/curve_25519/x25519.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class X25519(Base25519):

__slots__ = ("_public_key", "_secret_key")

_KDF: type = DomainKDF
_DoubleDiffieHellmanClient: type = DoubleDiffieHellmanClient
_DoubleDiffieHellmanServer: type = DoubleDiffieHellmanServer
_TripleDiffieHellmanClient: type = TripleDiffieHellmanClient
Expand Down Expand Up @@ -131,7 +132,7 @@ def dh2_client(cls) -> DoubleDiffieHellmanClient:
------------------------------------------------------------------------
"""
return cls._DoubleDiffieHellmanClient(
kdf_type=DomainKDF, key_exchange_type=cls
kdf_type=cls._KDF, key_exchange_type=cls
)

def dh2_server(self) -> DoubleDiffieHellmanServer:
Expand Down Expand Up @@ -166,7 +167,7 @@ def dh2_server(self) -> DoubleDiffieHellmanServer:
------------------------------------------------------------------------
"""
return self._DoubleDiffieHellmanServer(
self, kdf_type=DomainKDF, key_exchange_type=self.__class__
self, kdf_type=self._KDF, key_exchange_type=self.__class__
)

def dh3_client(self) -> TripleDiffieHellmanClient:
Expand Down Expand Up @@ -201,7 +202,7 @@ def dh3_client(self) -> TripleDiffieHellmanClient:
------------------------------------------------------------------------
"""
return self._TripleDiffieHellmanClient(
self, kdf_type=DomainKDF, key_exchange_type=self.__class__
self, kdf_type=self._KDF, key_exchange_type=self.__class__
)

def dh3_server(self) -> TripleDiffieHellmanServer:
Expand Down Expand Up @@ -236,7 +237,7 @@ def dh3_server(self) -> TripleDiffieHellmanServer:
------------------------------------------------------------------------
"""
return self._TripleDiffieHellmanServer(
self, kdf_type=DomainKDF, key_exchange_type=self.__class__
self, kdf_type=self._KDF, key_exchange_type=self.__class__
)


Expand Down

0 comments on commit 0cfd31b

Please sign in to comment.