Skip to content

Commit

Permalink
remove atavisms
Browse files Browse the repository at this point in the history
msspi update
  • Loading branch information
deemru committed Feb 28, 2017
1 parent 6b88cd3 commit 3800577
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build_windows/gostssl.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
</Link>
<CustomBuildStep>
<Command>copy /y $(OutDir)$(TargetName)$(TargetExt) u:\chromium\src\out\RELEASE\gostssl.dll</Command>
<Outputs>U:\chromium\src\out\RELEASE\gostssl.dll</Outputs>
<Outputs>u:\chromium\src\out\RELEASE\gostssl.dll</Outputs>
</CustomBuildStep>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down
26 changes: 13 additions & 13 deletions src/gostssl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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 );
}
Expand All @@ -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 );
}
Expand All @@ -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 );

Expand Down Expand Up @@ -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<const char *> bufs;
std::vector<int> 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] );
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/msspi
Submodule msspi updated 2 files
+111 −69 src/msspi.cpp
+5 −5 src/msspi.h

0 comments on commit 3800577

Please sign in to comment.