File 8732-crypto-Ensble-using-curve-names-that-are-unknown-to-.patch of Package erlang
From 6c588a8aa33967fa89b0e9265b83a7635fdc61b5 Mon Sep 17 00:00:00 2001
From: Hans Nilsson <hans@erlang.org>
Date: Fri, 17 Jun 2022 09:19:44 +0200
Subject: [PATCH 2/2] crypto: Ensble using curve names that are unknown to
crypto
---
lib/crypto/src/crypto.erl | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/lib/crypto/src/crypto.erl b/lib/crypto/src/crypto.erl
index e4b68da8a6..7bfceba6d8 100644
--- a/lib/crypto/src/crypto.erl
+++ b/lib/crypto/src/crypto.erl
@@ -2323,12 +2323,20 @@ nif_curve_params({PrimeField, Curve, BasePoint, Order, CoFactor}) ->
},
undefined %% The curve name
};
-nif_curve_params(Curve) when is_atom(Curve) ->
- %% named curve
- case Curve of
- x448 -> {evp,Curve};
- x25519 -> {evp,Curve};
- _ -> {crypto_ec_curves:curve(Curve), Curve}
+nif_curve_params(CurveName) when is_atom(CurveName) ->
+ %% A named curve
+ case CurveName of
+ x448 -> {evp,CurveName};
+ x25519 -> {evp,CurveName};
+ _ ->
+ Spec =
+ try
+ crypto_ec_curves:curve(CurveName)
+ catch
+ _:_ ->
+ undefined
+ end,
+ {Spec, CurveName}
end.
--
2.35.3