Embed X509_CINF
[openssl.git] / crypto / x509 / x509_set.c
index 0b0d4f5..b5209f2 100644 (file)
@@ -68,15 +68,15 @@ int X509_set_version(X509 *x, long version)
     if (x == NULL)
         return (0);
     if (version == 0) {
-        ASN1_INTEGER_free(x->cert_info->version);
-        x->cert_info->version = NULL;
+        ASN1_INTEGER_free(x->cert_info.version);
+        x->cert_info.version = NULL;
         return (1);
     }
-    if (x->cert_info->version == NULL) {
-        if ((x->cert_info->version = ASN1_INTEGER_new()) == NULL)
+    if (x->cert_info.version == NULL) {
+        if ((x->cert_info.version = ASN1_INTEGER_new()) == NULL)
             return (0);
     }
-    return (ASN1_INTEGER_set(x->cert_info->version, version));
+    return (ASN1_INTEGER_set(x->cert_info.version, version));
 }
 
 int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
@@ -85,12 +85,12 @@ int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
 
     if (x == NULL)
         return (0);
-    in = x->cert_info->serialNumber;
+    in = x->cert_info.serialNumber;
     if (in != serial) {
         in = ASN1_INTEGER_dup(serial);
         if (in != NULL) {
-            ASN1_INTEGER_free(x->cert_info->serialNumber);
-            x->cert_info->serialNumber = in;
+            ASN1_INTEGER_free(x->cert_info.serialNumber);
+            x->cert_info.serialNumber = in;
         }
     }
     return (in != NULL);
@@ -98,16 +98,16 @@ int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
 
 int X509_set_issuer_name(X509 *x, X509_NAME *name)
 {
-    if ((x == NULL) || (x->cert_info == NULL))
+    if (x == NULL)
         return (0);
-    return (X509_NAME_set(&x->cert_info->issuer, name));
+    return (X509_NAME_set(&x->cert_info.issuer, name));
 }
 
 int X509_set_subject_name(X509 *x, X509_NAME *name)
 {
-    if ((x == NULL) || (x->cert_info == NULL))
+    if (x == NULL)
         return (0);
-    return (X509_NAME_set(&x->cert_info->subject, name));
+    return (X509_NAME_set(&x->cert_info.subject, name));
 }
 
 int X509_set_notBefore(X509 *x, const ASN1_TIME *tm)
@@ -116,12 +116,12 @@ int X509_set_notBefore(X509 *x, const ASN1_TIME *tm)
 
     if (x == NULL)
         return (0);
-    in = x->cert_info->validity.notBefore;
+    in = x->cert_info.validity.notBefore;
     if (in != tm) {
         in = ASN1_STRING_dup(tm);
         if (in != NULL) {
-            ASN1_TIME_free(x->cert_info->validity.notBefore);
-            x->cert_info->validity.notBefore = in;
+            ASN1_TIME_free(x->cert_info.validity.notBefore);
+            x->cert_info.validity.notBefore = in;
         }
     }
     return (in != NULL);
@@ -133,12 +133,12 @@ int X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
 
     if (x == NULL)
         return (0);
-    in = x->cert_info->validity.notAfter;
+    in = x->cert_info.validity.notAfter;
     if (in != tm) {
         in = ASN1_STRING_dup(tm);
         if (in != NULL) {
-            ASN1_TIME_free(x->cert_info->validity.notAfter);
-            x->cert_info->validity.notAfter = in;
+            ASN1_TIME_free(x->cert_info.validity.notAfter);
+            x->cert_info.validity.notAfter = in;
         }
     }
     return (in != NULL);
@@ -146,9 +146,9 @@ int X509_set_notAfter(X509 *x, const ASN1_TIME *tm)
 
 int X509_set_pubkey(X509 *x, EVP_PKEY *pkey)
 {
-    if ((x == NULL) || (x->cert_info == NULL))
+    if (x == NULL)
         return (0);
-    return (X509_PUBKEY_set(&(x->cert_info->key), pkey));
+    return (X509_PUBKEY_set(&(x->cert_info.key), pkey));
 }
 
 void X509_up_ref(X509 *x)
@@ -158,17 +158,17 @@ void X509_up_ref(X509 *x)
 
 long X509_get_version(X509 *x)
 {
-    return ASN1_INTEGER_get(x->cert_info->version);
+    return ASN1_INTEGER_get(x->cert_info.version);
 }
 
 ASN1_TIME * X509_get_notBefore(X509 *x)
 {
-    return x->cert_info->validity.notBefore;
+    return x->cert_info.validity.notBefore;
 }
 
 ASN1_TIME *X509_get_notAfter(X509 *x)
 {
-    return x->cert_info->validity.notAfter;
+    return x->cert_info.validity.notAfter;
 }
 
 int X509_get_signature_type(const X509 *x)
@@ -178,5 +178,5 @@ int X509_get_signature_type(const X509 *x)
 
 X509_PUBKEY *X509_get_X509_PUBKEY(const X509 *x)
 {
-    return x->cert_info->key;
+    return x->cert_info.key;
 }