summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/x509/x509_set.c
diff options
context:
space:
mode:
authormarkus <>2002-09-05 12:51:50 +0000
committermarkus <>2002-09-05 12:51:50 +0000
commit15b5d84f9da2ce4bfae8580e56e34a859f74ad71 (patch)
treebf939e82d7fd73cc8a01cf6959002209972091bc /src/lib/libcrypto/x509/x509_set.c
parent027351f729b9e837200dae6e1520cda6577ab930 (diff)
downloadopenbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.gz
openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.tar.bz2
openbsd-15b5d84f9da2ce4bfae8580e56e34a859f74ad71.zip
import openssl-0.9.7-beta1
Diffstat (limited to 'src/lib/libcrypto/x509/x509_set.c')
-rw-r--r--src/lib/libcrypto/x509/x509_set.c54
1 files changed, 20 insertions, 34 deletions
diff --git a/src/lib/libcrypto/x509/x509_set.c b/src/lib/libcrypto/x509/x509_set.c
index 5d0a3a0c0e..aaf61ca062 100644
--- a/src/lib/libcrypto/x509/x509_set.c
+++ b/src/lib/libcrypto/x509/x509_set.c
@@ -58,27 +58,23 @@
58 58
59#include <stdio.h> 59#include <stdio.h>
60#include "cryptlib.h" 60#include "cryptlib.h"
61#include "asn1.h" 61#include <openssl/asn1.h>
62#include "objects.h" 62#include <openssl/objects.h>
63#include "evp.h" 63#include <openssl/evp.h>
64#include "x509.h" 64#include <openssl/x509.h>
65 65
66int X509_set_version(x,version) 66int X509_set_version(X509 *x, long version)
67X509 *x;
68long version;
69 { 67 {
70 if (x == NULL) return(0); 68 if (x == NULL) return(0);
71 if (x->cert_info->version == NULL) 69 if (x->cert_info->version == NULL)
72 { 70 {
73 if ((x->cert_info->version=ASN1_INTEGER_new()) == NULL) 71 if ((x->cert_info->version=M_ASN1_INTEGER_new()) == NULL)
74 return(0); 72 return(0);
75 } 73 }
76 return(ASN1_INTEGER_set(x->cert_info->version,version)); 74 return(ASN1_INTEGER_set(x->cert_info->version,version));
77 } 75 }
78 76
79int X509_set_serialNumber(x,serial) 77int X509_set_serialNumber(X509 *x, ASN1_INTEGER *serial)
80X509 *x;
81ASN1_INTEGER *serial;
82 { 78 {
83 ASN1_INTEGER *in; 79 ASN1_INTEGER *in;
84 80
@@ -86,75 +82,65 @@ ASN1_INTEGER *serial;
86 in=x->cert_info->serialNumber; 82 in=x->cert_info->serialNumber;
87 if (in != serial) 83 if (in != serial)
88 { 84 {
89 in=ASN1_INTEGER_dup(serial); 85 in=M_ASN1_INTEGER_dup(serial);
90 if (in != NULL) 86 if (in != NULL)
91 { 87 {
92 ASN1_INTEGER_free(x->cert_info->serialNumber); 88 M_ASN1_INTEGER_free(x->cert_info->serialNumber);
93 x->cert_info->serialNumber=in; 89 x->cert_info->serialNumber=in;
94 } 90 }
95 } 91 }
96 return(in != NULL); 92 return(in != NULL);
97 } 93 }
98 94
99int X509_set_issuer_name(x,name) 95int X509_set_issuer_name(X509 *x, X509_NAME *name)
100X509 *x;
101X509_NAME *name;
102 { 96 {
103 if ((x == NULL) || (x->cert_info == NULL)) return(0); 97 if ((x == NULL) || (x->cert_info == NULL)) return(0);
104 return(X509_NAME_set(&x->cert_info->issuer,name)); 98 return(X509_NAME_set(&x->cert_info->issuer,name));
105 } 99 }
106 100
107int X509_set_subject_name(x,name) 101int X509_set_subject_name(X509 *x, X509_NAME *name)
108X509 *x;
109X509_NAME *name;
110 { 102 {
111 if ((x == NULL) || (x->cert_info == NULL)) return(0); 103 if ((x == NULL) || (x->cert_info == NULL)) return(0);
112 return(X509_NAME_set(&x->cert_info->subject,name)); 104 return(X509_NAME_set(&x->cert_info->subject,name));
113 } 105 }
114 106
115int X509_set_notBefore(x,tm) 107int X509_set_notBefore(X509 *x, ASN1_TIME *tm)
116X509 *x;
117ASN1_UTCTIME *tm;
118 { 108 {
119 ASN1_UTCTIME *in; 109 ASN1_TIME *in;
120 110
121 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); 111 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0);
122 in=x->cert_info->validity->notBefore; 112 in=x->cert_info->validity->notBefore;
123 if (in != tm) 113 if (in != tm)
124 { 114 {
125 in=ASN1_UTCTIME_dup(tm); 115 in=M_ASN1_TIME_dup(tm);
126 if (in != NULL) 116 if (in != NULL)
127 { 117 {
128 ASN1_UTCTIME_free(x->cert_info->validity->notBefore); 118 M_ASN1_TIME_free(x->cert_info->validity->notBefore);
129 x->cert_info->validity->notBefore=in; 119 x->cert_info->validity->notBefore=in;
130 } 120 }
131 } 121 }
132 return(in != NULL); 122 return(in != NULL);
133 } 123 }
134 124
135int X509_set_notAfter(x,tm) 125int X509_set_notAfter(X509 *x, ASN1_TIME *tm)
136X509 *x;
137ASN1_UTCTIME *tm;
138 { 126 {
139 ASN1_UTCTIME *in; 127 ASN1_TIME *in;
140 128
141 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0); 129 if ((x == NULL) || (x->cert_info->validity == NULL)) return(0);
142 in=x->cert_info->validity->notAfter; 130 in=x->cert_info->validity->notAfter;
143 if (in != tm) 131 if (in != tm)
144 { 132 {
145 in=ASN1_UTCTIME_dup(tm); 133 in=M_ASN1_TIME_dup(tm);
146 if (in != NULL) 134 if (in != NULL)
147 { 135 {
148 ASN1_UTCTIME_free(x->cert_info->validity->notAfter); 136 M_ASN1_TIME_free(x->cert_info->validity->notAfter);
149 x->cert_info->validity->notAfter=in; 137 x->cert_info->validity->notAfter=in;
150 } 138 }
151 } 139 }
152 return(in != NULL); 140 return(in != NULL);
153 } 141 }
154 142
155int X509_set_pubkey(x,pkey) 143int X509_set_pubkey(X509 *x, EVP_PKEY *pkey)
156X509 *x;
157EVP_PKEY *pkey;
158 { 144 {
159 if ((x == NULL) || (x->cert_info == NULL)) return(0); 145 if ((x == NULL) || (x->cert_info == NULL)) return(0);
160 return(X509_PUBKEY_set(&(x->cert_info->key),pkey)); 146 return(X509_PUBKEY_set(&(x->cert_info->key),pkey));