diff --git a/build_windows/gostssl.vcxproj b/build_windows/gostssl.vcxproj index f6741a5..3b8e871 100644 --- a/build_windows/gostssl.vcxproj +++ b/build_windows/gostssl.vcxproj @@ -161,7 +161,7 @@ copy /y $(OutDir)$(TargetName)$(TargetExt) u:\chromium\src\out\RELEASE\gostssl.dll - U:\chromium\src\out\RELEASE\gostssl.dll + u:\chromium\src\out\RELEASE\gostssl.dll diff --git a/src/gostssl.cpp b/src/gostssl.cpp index 24e24be..8beee2a 100644 --- a/src/gostssl.cpp +++ b/src/gostssl.cpp @@ -533,7 +533,6 @@ static int msspi_to_ssl_state_ret( MSSPI_STATE state, SSL * s, int ret ) break; case MSSPI_X509_LOOKUP: s->rwstate = SSL_X509_LOOKUP; - s->state = SSL_CB_CONNECT_LOOP; break; case MSSPI_SHUTDOWN: s->rwstate = SSL_NOTHING; @@ -559,8 +558,6 @@ int gostssl_read( SSL * s, void * buf, int len, int * is_gost ) *is_gost = TRUE; - bssls->ERR_clear_error(); - int ret = msspi_read( w->h, buf, len ); return msspi_to_ssl_state_ret( msspi_state( w->h ), s, ret ); } @@ -578,8 +575,6 @@ int gostssl_write( SSL * s, const void * buf, int len, int * is_gost ) *is_gost = TRUE; - bssls->ERR_clear_error(); - int ret = msspi_write( w->h, buf, len ); return msspi_to_ssl_state_ret( msspi_state( w->h ), s, ret ); } @@ -598,7 +593,7 @@ int gostssl_connect( SSL * s, int * is_gost ) *is_gost = TRUE; if( s->state == SSL_ST_INIT ) - s->state = SSL_CB_CONNECT_LOOP; + s->state = SSL_ST_CONNECT; int ret = msspi_connect( w->h ); @@ -648,14 +643,21 @@ int gostssl_connect( SSL * s, int * is_gost ) if( !sk ) return 0; - void * bufs[64]; - int lens[64]; - int count = 64; + std::vector bufs; + std::vector lens; + size_t count; + + if( !msspi_get_peercerts( w->h, NULL, NULL, &count ) ) + return 0; + + bufs.resize( count ); + lens.resize( count ); + bool is_OK = false; - if( msspi_get_peercerts( w->h, bufs, lens, &count ) ) + if( msspi_get_peercerts( w->h, &bufs[0], &lens[0], &count ) ) { - for( int i = 0; i < count; i++ ) + for( size_t i = 0; i < count; i++ ) { const unsigned char * buf = (const unsigned char *)bufs[i]; X509 * x = bssls->d2i_X509( NULL, &buf, lens[i] ); @@ -666,8 +668,6 @@ int gostssl_connect( SSL * s, int * is_gost ) bssls->sk_push( CHECKED_CAST( _STACK *, STACK_OF( X509 ) *, sk ), CHECKED_CAST( void *, X509 *, x ) ); is_OK = true; } - - msspi_get_peercerts_free( w->h, bufs, count ); } if( !is_OK ) diff --git a/src/msspi b/src/msspi index d29d216..2df622f 160000 --- a/src/msspi +++ b/src/msspi @@ -1 +1 @@ -Subproject commit d29d2169d71b92adfa13a553da6b50a056a5ba2c +Subproject commit 2df622ffeb2dc1b6e4afe29867d7c436575ccae8