File libcryptopp-CVE-2023-50981.patch of Package libcryptopp.32010

Index: libcryptopp-5.6.5/nbtheory.cpp
===================================================================
--- libcryptopp-5.6.5.orig/nbtheory.cpp
+++ libcryptopp-5.6.5/nbtheory.cpp
@@ -573,6 +573,9 @@ Integer CRT(const Integer &xp, const Int
 
 Integer ModularSquareRoot(const Integer &a, const Integer &p)
 {
+	if (!IsPrime(p))
+		throw InvalidArgument("ModularSquareRoot: p must be a prime");
+
 	if (p%4 == 3)
 		return a_exp_b_mod_c(a, (p+1)/4, p);
 
openSUSE Build Service is sponsored by