summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/pki.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/python/vyos/pki.py b/python/vyos/pki.py
index e9f961911..b014c7234 100644
--- a/python/vyos/pki.py
+++ b/python/vyos/pki.py
@@ -112,12 +112,10 @@ def encode_dh_parameters(dh_parameters):
# EC Helper
def get_elliptic_curve(size):
- curve_func = None
name = f'SECP{size}R1'
- if hasattr(ec, name):
- curve_func = getattr(ec, name)
- else:
- curve_func = ec.SECP256R1() # Default to SECP256R1
+ # getattr() must yield the class, not an instance - the caller below is the
+ # one that instantiates it
+ curve_func = getattr(ec, name, ec.SECP256R1) # Default to SECP256R1
return curve_func()
# Creation functions