Fix CMP -days option range checking and test failing with enable-ubsan
[openssl.git] / crypto / x509 / x_req.c
index 5bda794a8248063f99bb24ca6fc8eb620149c85e..10b82df5599129e2e58e3c51b7f511ff63369340 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 1995-2020 The OpenSSL Project Authors. All Rights Reserved.
  *
  * Licensed under the Apache License 2.0 (the "License").  You may not use
  * this file except in compliance with the License.  You can obtain a copy
@@ -11,7 +11,9 @@
 #include "internal/cryptlib.h"
 #include <openssl/asn1t.h>
 #include <openssl/x509.h>
-#include "internal/x509_int.h"
+#include "crypto/x509.h"
+
+DEFINE_STACK_OF(X509_ATTRIBUTE)
 
 /*-
  * X509_REQ_INFO is handled in an unusual way to get round
@@ -53,14 +55,14 @@ static int req_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it,
 
     switch (operation) {
     case ASN1_OP_D2I_PRE:
-        ASN1_OCTET_STRING_free(ret->sm2_id);
+        ASN1_OCTET_STRING_free(ret->distinguishing_id);
         /* fall thru */
     case ASN1_OP_NEW_POST:
-        ret->sm2_id = NULL;
+        ret->distinguishing_id = NULL;
         break;
 
     case ASN1_OP_FREE_POST:
-        ASN1_OCTET_STRING_free(ret->sm2_id);
+        ASN1_OCTET_STRING_free(ret->distinguishing_id);
         break;
     }
 #endif
@@ -90,15 +92,13 @@ IMPLEMENT_ASN1_FUNCTIONS(X509_REQ)
 
 IMPLEMENT_ASN1_DUP_FUNCTION(X509_REQ)
 
-#ifndef OPENSSL_NO_SM2
-void X509_REQ_set0_sm2_id(X509_REQ *x, ASN1_OCTET_STRING *sm2_id)
+void X509_REQ_set0_distinguishing_id(X509_REQ *x, ASN1_OCTET_STRING *d_id)
 {
-    ASN1_OCTET_STRING_free(x->sm2_id);
-    x->sm2_id = sm2_id;
+    ASN1_OCTET_STRING_free(x->distinguishing_id);
+    x->distinguishing_id = d_id;
 }
 
-ASN1_OCTET_STRING *X509_REQ_get0_sm2_id(X509_REQ *x)
+ASN1_OCTET_STRING *X509_REQ_get0_distinguishing_id(X509_REQ *x)
 {
-    return x->sm2_id;
+    return x->distinguishing_id;
 }
-#endif