]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
ecp_s390x_nistp.c: reorder nullptr checks
authorJoshua Rogers <MegaManSec@users.noreply.github.com>
Sat, 4 Apr 2026 09:20:01 +0000 (17:20 +0800)
committerNorbert Pocs <norbertp@openssl.org>
Wed, 15 Apr 2026 11:00:58 +0000 (13:00 +0200)
Reviewed-by: Eugene Syromiatnikov <esyr@openssl.org>
Reviewed-by: Frederik Wedel-Heinen <fwh.openssl@gmail.com>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
Reviewed-by: Tomas Mraz <tomas@openssl.foundation>
MergeDate: Wed Apr 15 11:01:22 2026
(Merged from https://github.com/openssl/openssl/pull/30648)

crypto/ec/ecp_s390x_nistp.c

index 4b3fbb2f79680c324a0eb4f0e234e5c17ffc70eb..a405625d67331063b97a7b4e4e8d2109b32254fc 100644 (file)
@@ -150,10 +150,25 @@ static ECDSA_SIG *ecdsa_s390x_nistp_sign_sig(const unsigned char *dgst,
         return NULL;
     }
 
+    if (eckey == NULL) {
+        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
+        return NULL;
+    }
+
     group = EC_KEY_get0_group(eckey);
+    if (group == NULL) {
+        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
+        return NULL;
+    }
+
     order = EC_GROUP_get0_order(group);
+    if (order == NULL) {
+        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
+        return NULL;
+    }
+
     privkey = EC_KEY_get0_private_key(eckey);
-    if (group == NULL || order == NULL || privkey == NULL) {
+    if (privkey == NULL) {
         ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
         return NULL;
     }
@@ -295,9 +310,19 @@ static int ecdsa_s390x_nistp_verify_sig(const unsigned char *dgst, int dgstlen,
         return -1;
     }
 
+    if (sig == NULL || eckey == NULL) {
+        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
+        return -1;
+    }
+
     group = EC_KEY_get0_group(eckey);
+    if (group == NULL) {
+        ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
+        return -1;
+    }
+
     pubkey = EC_KEY_get0_public_key(eckey);
-    if (eckey == NULL || group == NULL || pubkey == NULL || sig == NULL) {
+    if (pubkey == NULL) {
         ERR_raise(ERR_LIB_EC, EC_R_MISSING_PARAMETERS);
         return -1;
     }