setup: support installations with Python3.13 (#36549)

diff --git a/scripts/setup/constraints.txt b/scripts/setup/constraints.txt
index 1b52443..874d46f 100644
--- a/scripts/setup/constraints.txt
+++ b/scripts/setup/constraints.txt
@@ -32,8 +32,6 @@
     # via -r requirements.zephyr.txt
 certifi==2022.12.7
     # via requests
-cffi==1.15.1
-    # via cryptography
 charset-normalizer==3.0.1
     # via requests
 click==8.1.3
diff --git a/scripts/setup/requirements.all.txt b/scripts/setup/requirements.all.txt
index 346abfa..4a7672a 100644
--- a/scripts/setup/requirements.all.txt
+++ b/scripts/setup/requirements.all.txt
@@ -43,6 +43,8 @@
 protobuf==4.24.4
 types-protobuf==4.24.0.2
 
+cffi==1.15.0; python_version < "3.13"
+cffi==1.17.1; python_version >= "3.13"
 cryptography
 
 # python unit tests
diff --git a/scripts/tools/telink/requirements.txt b/scripts/tools/telink/requirements.txt
index 58b519d..e76b142 100644
--- a/scripts/tools/telink/requirements.txt
+++ b/scripts/tools/telink/requirements.txt
@@ -1,5 +1,6 @@
 cryptography==43.0.1
-cffi==1.15.0
+cffi==1.15.0; python_version < "3.13"
+cffi==1.17.1; python_version >= "3.13"
 future==0.18.3
 pycparser==2.21
 pypng==0.0.21