174664626SKris Kennaway /* ssl/ssl_asn1.c */ 274664626SKris Kennaway /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) 374664626SKris Kennaway * All rights reserved. 474664626SKris Kennaway * 574664626SKris Kennaway * This package is an SSL implementation written 674664626SKris Kennaway * by Eric Young (eay@cryptsoft.com). 774664626SKris Kennaway * The implementation was written so as to conform with Netscapes SSL. 874664626SKris Kennaway * 974664626SKris Kennaway * This library is free for commercial and non-commercial use as long as 1074664626SKris Kennaway * the following conditions are aheared to. The following conditions 1174664626SKris Kennaway * apply to all code found in this distribution, be it the RC4, RSA, 1274664626SKris Kennaway * lhash, DES, etc., code; not just the SSL code. The SSL documentation 1374664626SKris Kennaway * included with this distribution is covered by the same copyright terms 1474664626SKris Kennaway * except that the holder is Tim Hudson (tjh@cryptsoft.com). 1574664626SKris Kennaway * 1674664626SKris Kennaway * Copyright remains Eric Young's, and as such any Copyright notices in 1774664626SKris Kennaway * the code are not to be removed. 1874664626SKris Kennaway * If this package is used in a product, Eric Young should be given attribution 1974664626SKris Kennaway * as the author of the parts of the library used. 2074664626SKris Kennaway * This can be in the form of a textual message at program startup or 2174664626SKris Kennaway * in documentation (online or textual) provided with the package. 2274664626SKris Kennaway * 2374664626SKris Kennaway * Redistribution and use in source and binary forms, with or without 2474664626SKris Kennaway * modification, are permitted provided that the following conditions 2574664626SKris Kennaway * are met: 2674664626SKris Kennaway * 1. Redistributions of source code must retain the copyright 2774664626SKris Kennaway * notice, this list of conditions and the following disclaimer. 2874664626SKris Kennaway * 2. Redistributions in binary form must reproduce the above copyright 2974664626SKris Kennaway * notice, this list of conditions and the following disclaimer in the 3074664626SKris Kennaway * documentation and/or other materials provided with the distribution. 3174664626SKris Kennaway * 3. All advertising materials mentioning features or use of this software 3274664626SKris Kennaway * must display the following acknowledgement: 3374664626SKris Kennaway * "This product includes cryptographic software written by 3474664626SKris Kennaway * Eric Young (eay@cryptsoft.com)" 3574664626SKris Kennaway * The word 'cryptographic' can be left out if the rouines from the library 3674664626SKris Kennaway * being used are not cryptographic related :-). 3774664626SKris Kennaway * 4. If you include any Windows specific code (or a derivative thereof) from 3874664626SKris Kennaway * the apps directory (application code) you must include an acknowledgement: 3974664626SKris Kennaway * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" 4074664626SKris Kennaway * 4174664626SKris Kennaway * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND 4274664626SKris Kennaway * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 4374664626SKris Kennaway * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 4474664626SKris Kennaway * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 4574664626SKris Kennaway * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 4674664626SKris Kennaway * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 4774664626SKris Kennaway * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 4874664626SKris Kennaway * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 4974664626SKris Kennaway * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 5074664626SKris Kennaway * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 5174664626SKris Kennaway * SUCH DAMAGE. 5274664626SKris Kennaway * 5374664626SKris Kennaway * The licence and distribution terms for any publically available version or 5474664626SKris Kennaway * derivative of this code cannot be changed. i.e. this code cannot simply be 5574664626SKris Kennaway * copied and put under another distribution licence 5674664626SKris Kennaway * [including the GNU Public Licence.] 5774664626SKris Kennaway */ 5874664626SKris Kennaway 5974664626SKris Kennaway #include <stdio.h> 6074664626SKris Kennaway #include <stdlib.h> 6174664626SKris Kennaway #include <openssl/asn1_mac.h> 6274664626SKris Kennaway #include <openssl/objects.h> 63f579bf8eSKris Kennaway #include <openssl/x509.h> 6474664626SKris Kennaway #include "ssl_locl.h" 6574664626SKris Kennaway 6674664626SKris Kennaway typedef struct ssl_session_asn1_st 6774664626SKris Kennaway { 6874664626SKris Kennaway ASN1_INTEGER version; 6974664626SKris Kennaway ASN1_INTEGER ssl_version; 7074664626SKris Kennaway ASN1_OCTET_STRING cipher; 7174664626SKris Kennaway ASN1_OCTET_STRING master_key; 7274664626SKris Kennaway ASN1_OCTET_STRING session_id; 7374664626SKris Kennaway ASN1_OCTET_STRING session_id_context; 7474664626SKris Kennaway ASN1_OCTET_STRING key_arg; 7574664626SKris Kennaway ASN1_INTEGER time; 7674664626SKris Kennaway ASN1_INTEGER timeout; 77f579bf8eSKris Kennaway ASN1_INTEGER verify_result; 7874664626SKris Kennaway } SSL_SESSION_ASN1; 7974664626SKris Kennaway 8074664626SKris Kennaway int i2d_SSL_SESSION(SSL_SESSION *in, unsigned char **pp) 8174664626SKris Kennaway { 8274664626SKris Kennaway #define LSIZE2 (sizeof(long)*2) 83f579bf8eSKris Kennaway int v1=0,v2=0,v3=0,v4=0,v5=0; 8474664626SKris Kennaway unsigned char buf[4],ibuf1[LSIZE2],ibuf2[LSIZE2]; 85f579bf8eSKris Kennaway unsigned char ibuf3[LSIZE2],ibuf4[LSIZE2],ibuf5[LSIZE2]; 8674664626SKris Kennaway long l; 8774664626SKris Kennaway SSL_SESSION_ASN1 a; 8874664626SKris Kennaway M_ASN1_I2D_vars(in); 8974664626SKris Kennaway 9074664626SKris Kennaway if ((in == NULL) || ((in->cipher == NULL) && (in->cipher_id == 0))) 9174664626SKris Kennaway return(0); 9274664626SKris Kennaway 9374664626SKris Kennaway /* Note that I cheat in the following 2 assignments. I know 94f579bf8eSKris Kennaway * that if the ASN1_INTEGER passed to ASN1_INTEGER_set 9574664626SKris Kennaway * is > sizeof(long)+1, the buffer will not be re-Malloc()ed. 9674664626SKris Kennaway * This is a bit evil but makes things simple, no dynamic allocation 9774664626SKris Kennaway * to clean up :-) */ 9874664626SKris Kennaway a.version.length=LSIZE2; 9974664626SKris Kennaway a.version.type=V_ASN1_INTEGER; 10074664626SKris Kennaway a.version.data=ibuf1; 10174664626SKris Kennaway ASN1_INTEGER_set(&(a.version),SSL_SESSION_ASN1_VERSION); 10274664626SKris Kennaway 10374664626SKris Kennaway a.ssl_version.length=LSIZE2; 10474664626SKris Kennaway a.ssl_version.type=V_ASN1_INTEGER; 10574664626SKris Kennaway a.ssl_version.data=ibuf2; 10674664626SKris Kennaway ASN1_INTEGER_set(&(a.ssl_version),in->ssl_version); 10774664626SKris Kennaway 10874664626SKris Kennaway a.cipher.type=V_ASN1_OCTET_STRING; 10974664626SKris Kennaway a.cipher.data=buf; 11074664626SKris Kennaway 11174664626SKris Kennaway if (in->cipher == NULL) 11274664626SKris Kennaway l=in->cipher_id; 11374664626SKris Kennaway else 11474664626SKris Kennaway l=in->cipher->id; 11574664626SKris Kennaway if (in->ssl_version == SSL2_VERSION) 11674664626SKris Kennaway { 11774664626SKris Kennaway a.cipher.length=3; 11874664626SKris Kennaway buf[0]=((unsigned char)(l>>16L))&0xff; 11974664626SKris Kennaway buf[1]=((unsigned char)(l>> 8L))&0xff; 12074664626SKris Kennaway buf[2]=((unsigned char)(l ))&0xff; 12174664626SKris Kennaway } 12274664626SKris Kennaway else 12374664626SKris Kennaway { 12474664626SKris Kennaway a.cipher.length=2; 12574664626SKris Kennaway buf[0]=((unsigned char)(l>>8L))&0xff; 12674664626SKris Kennaway buf[1]=((unsigned char)(l ))&0xff; 12774664626SKris Kennaway } 12874664626SKris Kennaway 12974664626SKris Kennaway a.master_key.length=in->master_key_length; 13074664626SKris Kennaway a.master_key.type=V_ASN1_OCTET_STRING; 13174664626SKris Kennaway a.master_key.data=in->master_key; 13274664626SKris Kennaway 13374664626SKris Kennaway a.session_id.length=in->session_id_length; 13474664626SKris Kennaway a.session_id.type=V_ASN1_OCTET_STRING; 13574664626SKris Kennaway a.session_id.data=in->session_id; 13674664626SKris Kennaway 13774664626SKris Kennaway a.session_id_context.length=in->sid_ctx_length; 13874664626SKris Kennaway a.session_id_context.type=V_ASN1_OCTET_STRING; 13974664626SKris Kennaway a.session_id_context.data=in->sid_ctx; 14074664626SKris Kennaway 14174664626SKris Kennaway a.key_arg.length=in->key_arg_length; 14274664626SKris Kennaway a.key_arg.type=V_ASN1_OCTET_STRING; 14374664626SKris Kennaway a.key_arg.data=in->key_arg; 14474664626SKris Kennaway 14574664626SKris Kennaway if (in->time != 0L) 14674664626SKris Kennaway { 14774664626SKris Kennaway a.time.length=LSIZE2; 14874664626SKris Kennaway a.time.type=V_ASN1_INTEGER; 14974664626SKris Kennaway a.time.data=ibuf3; 15074664626SKris Kennaway ASN1_INTEGER_set(&(a.time),in->time); 15174664626SKris Kennaway } 15274664626SKris Kennaway 15374664626SKris Kennaway if (in->timeout != 0L) 15474664626SKris Kennaway { 15574664626SKris Kennaway a.timeout.length=LSIZE2; 15674664626SKris Kennaway a.timeout.type=V_ASN1_INTEGER; 15774664626SKris Kennaway a.timeout.data=ibuf4; 15874664626SKris Kennaway ASN1_INTEGER_set(&(a.timeout),in->timeout); 15974664626SKris Kennaway } 16074664626SKris Kennaway 161f579bf8eSKris Kennaway if (in->verify_result != X509_V_OK) 162f579bf8eSKris Kennaway { 163f579bf8eSKris Kennaway a.verify_result.length=LSIZE2; 164f579bf8eSKris Kennaway a.verify_result.type=V_ASN1_INTEGER; 165f579bf8eSKris Kennaway a.verify_result.data=ibuf5; 166f579bf8eSKris Kennaway ASN1_INTEGER_set(&a.verify_result,in->verify_result); 167f579bf8eSKris Kennaway } 168f579bf8eSKris Kennaway 16974664626SKris Kennaway M_ASN1_I2D_len(&(a.version), i2d_ASN1_INTEGER); 17074664626SKris Kennaway M_ASN1_I2D_len(&(a.ssl_version), i2d_ASN1_INTEGER); 17174664626SKris Kennaway M_ASN1_I2D_len(&(a.cipher), i2d_ASN1_OCTET_STRING); 17274664626SKris Kennaway M_ASN1_I2D_len(&(a.session_id), i2d_ASN1_OCTET_STRING); 17374664626SKris Kennaway M_ASN1_I2D_len(&(a.master_key), i2d_ASN1_OCTET_STRING); 17474664626SKris Kennaway if (in->key_arg_length > 0) 17574664626SKris Kennaway M_ASN1_I2D_len_IMP_opt(&(a.key_arg),i2d_ASN1_OCTET_STRING); 17674664626SKris Kennaway if (in->time != 0L) 17774664626SKris Kennaway M_ASN1_I2D_len_EXP_opt(&(a.time),i2d_ASN1_INTEGER,1,v1); 17874664626SKris Kennaway if (in->timeout != 0L) 17974664626SKris Kennaway M_ASN1_I2D_len_EXP_opt(&(a.timeout),i2d_ASN1_INTEGER,2,v2); 18074664626SKris Kennaway if (in->peer != NULL) 18174664626SKris Kennaway M_ASN1_I2D_len_EXP_opt(in->peer,i2d_X509,3,v3); 18274664626SKris Kennaway M_ASN1_I2D_len_EXP_opt(&a.session_id_context,i2d_ASN1_OCTET_STRING,4,v4); 183f579bf8eSKris Kennaway if (in->verify_result != X509_V_OK) 184f579bf8eSKris Kennaway M_ASN1_I2D_len_EXP_opt(&(a.verify_result),i2d_ASN1_INTEGER,5,v5); 18574664626SKris Kennaway 18674664626SKris Kennaway M_ASN1_I2D_seq_total(); 18774664626SKris Kennaway 18874664626SKris Kennaway M_ASN1_I2D_put(&(a.version), i2d_ASN1_INTEGER); 18974664626SKris Kennaway M_ASN1_I2D_put(&(a.ssl_version), i2d_ASN1_INTEGER); 19074664626SKris Kennaway M_ASN1_I2D_put(&(a.cipher), i2d_ASN1_OCTET_STRING); 19174664626SKris Kennaway M_ASN1_I2D_put(&(a.session_id), i2d_ASN1_OCTET_STRING); 19274664626SKris Kennaway M_ASN1_I2D_put(&(a.master_key), i2d_ASN1_OCTET_STRING); 19374664626SKris Kennaway if (in->key_arg_length > 0) 19474664626SKris Kennaway M_ASN1_I2D_put_IMP_opt(&(a.key_arg),i2d_ASN1_OCTET_STRING,0); 19574664626SKris Kennaway if (in->time != 0L) 19674664626SKris Kennaway M_ASN1_I2D_put_EXP_opt(&(a.time),i2d_ASN1_INTEGER,1,v1); 19774664626SKris Kennaway if (in->timeout != 0L) 19874664626SKris Kennaway M_ASN1_I2D_put_EXP_opt(&(a.timeout),i2d_ASN1_INTEGER,2,v2); 19974664626SKris Kennaway if (in->peer != NULL) 20074664626SKris Kennaway M_ASN1_I2D_put_EXP_opt(in->peer,i2d_X509,3,v3); 20174664626SKris Kennaway M_ASN1_I2D_put_EXP_opt(&a.session_id_context,i2d_ASN1_OCTET_STRING,4, 20274664626SKris Kennaway v4); 203f579bf8eSKris Kennaway if (in->verify_result != X509_V_OK) 204f579bf8eSKris Kennaway M_ASN1_I2D_put_EXP_opt(&a.verify_result,i2d_ASN1_INTEGER,5,v5); 20574664626SKris Kennaway M_ASN1_I2D_finish(); 20674664626SKris Kennaway } 20774664626SKris Kennaway 20874664626SKris Kennaway SSL_SESSION *d2i_SSL_SESSION(SSL_SESSION **a, unsigned char **pp, 20974664626SKris Kennaway long length) 21074664626SKris Kennaway { 21174664626SKris Kennaway int version,ssl_version=0,i; 21274664626SKris Kennaway long id; 21374664626SKris Kennaway ASN1_INTEGER ai,*aip; 21474664626SKris Kennaway ASN1_OCTET_STRING os,*osp; 21574664626SKris Kennaway M_ASN1_D2I_vars(a,SSL_SESSION *,SSL_SESSION_new); 21674664626SKris Kennaway 21774664626SKris Kennaway aip= &ai; 21874664626SKris Kennaway osp= &os; 21974664626SKris Kennaway 22074664626SKris Kennaway M_ASN1_D2I_Init(); 22174664626SKris Kennaway M_ASN1_D2I_start_sequence(); 22274664626SKris Kennaway 22374664626SKris Kennaway ai.data=NULL; ai.length=0; 22474664626SKris Kennaway M_ASN1_D2I_get(aip,d2i_ASN1_INTEGER); 22574664626SKris Kennaway version=(int)ASN1_INTEGER_get(aip); 22674664626SKris Kennaway if (ai.data != NULL) { Free(ai.data); ai.data=NULL; ai.length=0; } 22774664626SKris Kennaway 22874664626SKris Kennaway /* we don't care about the version right now :-) */ 22974664626SKris Kennaway M_ASN1_D2I_get(aip,d2i_ASN1_INTEGER); 23074664626SKris Kennaway ssl_version=(int)ASN1_INTEGER_get(aip); 23174664626SKris Kennaway ret->ssl_version=ssl_version; 23274664626SKris Kennaway if (ai.data != NULL) { Free(ai.data); ai.data=NULL; ai.length=0; } 23374664626SKris Kennaway 23474664626SKris Kennaway os.data=NULL; os.length=0; 23574664626SKris Kennaway M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); 23674664626SKris Kennaway if (ssl_version == SSL2_VERSION) 23774664626SKris Kennaway { 23874664626SKris Kennaway if (os.length != 3) 23974664626SKris Kennaway { 24074664626SKris Kennaway c.error=SSL_R_CIPHER_CODE_WRONG_LENGTH; 24174664626SKris Kennaway goto err; 24274664626SKris Kennaway } 24374664626SKris Kennaway id=0x02000000L| 24474664626SKris Kennaway ((unsigned long)os.data[0]<<16L)| 24574664626SKris Kennaway ((unsigned long)os.data[1]<< 8L)| 24674664626SKris Kennaway (unsigned long)os.data[2]; 24774664626SKris Kennaway } 24874664626SKris Kennaway else if ((ssl_version>>8) == 3) 24974664626SKris Kennaway { 25074664626SKris Kennaway if (os.length != 2) 25174664626SKris Kennaway { 25274664626SKris Kennaway c.error=SSL_R_CIPHER_CODE_WRONG_LENGTH; 25374664626SKris Kennaway goto err; 25474664626SKris Kennaway } 25574664626SKris Kennaway id=0x03000000L| 25674664626SKris Kennaway ((unsigned long)os.data[0]<<8L)| 25774664626SKris Kennaway (unsigned long)os.data[1]; 25874664626SKris Kennaway } 25974664626SKris Kennaway else 26074664626SKris Kennaway { 26174664626SKris Kennaway SSLerr(SSL_F_D2I_SSL_SESSION,SSL_R_UNKNOWN_SSL_VERSION); 26274664626SKris Kennaway return(NULL); 26374664626SKris Kennaway } 26474664626SKris Kennaway 26574664626SKris Kennaway ret->cipher=NULL; 26674664626SKris Kennaway ret->cipher_id=id; 26774664626SKris Kennaway 26874664626SKris Kennaway M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); 26974664626SKris Kennaway if ((ssl_version>>8) == SSL3_VERSION) 27074664626SKris Kennaway i=SSL3_MAX_SSL_SESSION_ID_LENGTH; 27174664626SKris Kennaway else /* if (ssl_version == SSL2_VERSION) */ 27274664626SKris Kennaway i=SSL2_MAX_SSL_SESSION_ID_LENGTH; 27374664626SKris Kennaway 27474664626SKris Kennaway if (os.length > i) 27574664626SKris Kennaway os.length=i; 27674664626SKris Kennaway 27774664626SKris Kennaway ret->session_id_length=os.length; 27874664626SKris Kennaway memcpy(ret->session_id,os.data,os.length); 27974664626SKris Kennaway 28074664626SKris Kennaway M_ASN1_D2I_get(osp,d2i_ASN1_OCTET_STRING); 28174664626SKris Kennaway if (ret->master_key_length > SSL_MAX_MASTER_KEY_LENGTH) 28274664626SKris Kennaway ret->master_key_length=SSL_MAX_MASTER_KEY_LENGTH; 28374664626SKris Kennaway else 28474664626SKris Kennaway ret->master_key_length=os.length; 28574664626SKris Kennaway memcpy(ret->master_key,os.data,ret->master_key_length); 28674664626SKris Kennaway 28774664626SKris Kennaway os.length=0; 28874664626SKris Kennaway M_ASN1_D2I_get_IMP_opt(osp,d2i_ASN1_OCTET_STRING,0,V_ASN1_OCTET_STRING); 28974664626SKris Kennaway if (os.length > SSL_MAX_KEY_ARG_LENGTH) 29074664626SKris Kennaway ret->key_arg_length=SSL_MAX_KEY_ARG_LENGTH; 29174664626SKris Kennaway else 29274664626SKris Kennaway ret->key_arg_length=os.length; 29374664626SKris Kennaway memcpy(ret->key_arg,os.data,ret->key_arg_length); 29474664626SKris Kennaway if (os.data != NULL) Free(os.data); 29574664626SKris Kennaway 29674664626SKris Kennaway ai.length=0; 29774664626SKris Kennaway M_ASN1_D2I_get_EXP_opt(aip,d2i_ASN1_INTEGER,1); 29874664626SKris Kennaway if (ai.data != NULL) 29974664626SKris Kennaway { 30074664626SKris Kennaway ret->time=ASN1_INTEGER_get(aip); 30174664626SKris Kennaway Free(ai.data); ai.data=NULL; ai.length=0; 30274664626SKris Kennaway } 30374664626SKris Kennaway else 30474664626SKris Kennaway ret->time=time(NULL); 30574664626SKris Kennaway 30674664626SKris Kennaway ai.length=0; 30774664626SKris Kennaway M_ASN1_D2I_get_EXP_opt(aip,d2i_ASN1_INTEGER,2); 30874664626SKris Kennaway if (ai.data != NULL) 30974664626SKris Kennaway { 31074664626SKris Kennaway ret->timeout=ASN1_INTEGER_get(aip); 31174664626SKris Kennaway Free(ai.data); ai.data=NULL; ai.length=0; 31274664626SKris Kennaway } 31374664626SKris Kennaway else 31474664626SKris Kennaway ret->timeout=3; 31574664626SKris Kennaway 31674664626SKris Kennaway if (ret->peer != NULL) 31774664626SKris Kennaway { 31874664626SKris Kennaway X509_free(ret->peer); 31974664626SKris Kennaway ret->peer=NULL; 32074664626SKris Kennaway } 32174664626SKris Kennaway M_ASN1_D2I_get_EXP_opt(ret->peer,d2i_X509,3); 32274664626SKris Kennaway 32374664626SKris Kennaway os.length=0; 32474664626SKris Kennaway os.data=NULL; 32574664626SKris Kennaway M_ASN1_D2I_get_EXP_opt(osp,d2i_ASN1_OCTET_STRING,4); 32674664626SKris Kennaway 32774664626SKris Kennaway if(os.data != NULL) 32874664626SKris Kennaway { 32974664626SKris Kennaway if (os.length > SSL_MAX_SID_CTX_LENGTH) 33074664626SKris Kennaway SSLerr(SSL_F_D2I_SSL_SESSION,SSL_R_BAD_LENGTH); 33174664626SKris Kennaway ret->sid_ctx_length=os.length; 33274664626SKris Kennaway memcpy(ret->sid_ctx,os.data,os.length); 33374664626SKris Kennaway Free(os.data); os.data=NULL; os.length=0; 33474664626SKris Kennaway } 33574664626SKris Kennaway else 33674664626SKris Kennaway ret->sid_ctx_length=0; 33774664626SKris Kennaway 338f579bf8eSKris Kennaway ai.length=0; 339f579bf8eSKris Kennaway M_ASN1_D2I_get_EXP_opt(aip,d2i_ASN1_INTEGER,5); 340f579bf8eSKris Kennaway if (ai.data != NULL) 341f579bf8eSKris Kennaway { 342f579bf8eSKris Kennaway ret->verify_result=ASN1_INTEGER_get(aip); 343f579bf8eSKris Kennaway Free(ai.data); ai.data=NULL; ai.length=0; 344f579bf8eSKris Kennaway } 345f579bf8eSKris Kennaway else 346f579bf8eSKris Kennaway ret->verify_result=X509_V_OK; 347f579bf8eSKris Kennaway 34874664626SKris Kennaway M_ASN1_D2I_Finish(a,SSL_SESSION_free,SSL_F_D2I_SSL_SESSION); 34974664626SKris Kennaway } 350