Issue #20025: ssl.RAND_bytes() and ssl.RAND_pseudo_bytes() now raise a
ValueError if num is negative (instead of raising a SystemError).
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 374d930..4b02d8d 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -2486,6 +2486,11 @@
     const char *errstr;
     PyObject *v;
 
+    if (len < 0) {
+        PyErr_SetString(PyExc_ValueError, "num must be positive");
+        return NULL;
+    }
+
     bytes = PyBytes_FromStringAndSize(NULL, len);
     if (bytes == NULL)
         return NULL;