updates to shutdown and mymktemp
This commit is contained in:
parent
b26b5f1b51
commit
4c7b076cea
@ -6351,9 +6351,7 @@ static int DoAlert(WOLFSSL* ssl, byte* input, word32* inOutIdx, int* type,
|
||||
WOLFSSL_MSG(" close notify");
|
||||
ssl->options.closeNotify = 1;
|
||||
}
|
||||
if (!ssl->options.sentNotify) {
|
||||
WOLFSSL_ERROR(*type);
|
||||
}
|
||||
WOLFSSL_ERROR(*type);
|
||||
if (ssl->keys.encryptionOn) {
|
||||
if (*inOutIdx + ssl->keys.padSz > totalSz)
|
||||
return BUFFER_E;
|
||||
@ -7751,9 +7749,7 @@ startScr:
|
||||
|
||||
while (ssl->buffers.clearOutputBuffer.length == 0) {
|
||||
if ( (ssl->error = ProcessReply(ssl)) < 0) {
|
||||
if (!ssl->options.sentNotify) {
|
||||
WOLFSSL_ERROR(ssl->error);
|
||||
}
|
||||
WOLFSSL_ERROR(ssl->error);
|
||||
if (ssl->error == ZERO_RETURN) {
|
||||
WOLFSSL_MSG("Zero return, no more data coming");
|
||||
return 0; /* no more data coming */
|
||||
|
20
src/ssl.c
20
src/ssl.c
@ -917,6 +917,7 @@ int wolfSSL_recv(WOLFSSL* ssl, void* data, int sz, int flags)
|
||||
/* SSL_SUCCESS on ok */
|
||||
int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
{
|
||||
byte tmp;
|
||||
WOLFSSL_ENTER("SSL_shutdown()");
|
||||
|
||||
if (ssl == NULL)
|
||||
@ -937,23 +938,26 @@ int wolfSSL_shutdown(WOLFSSL* ssl)
|
||||
}
|
||||
ssl->options.sentNotify = 1; /* don't send close_notify twice */
|
||||
WOLFSSL_LEAVE("SSL_shutdown()", ssl->error);
|
||||
return 0;
|
||||
|
||||
if (ssl->options.closeNotify)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* call wolfSSL_shutdown again for bidirectional shudown */
|
||||
if (ssl->options.sentNotify && !ssl->options.closeNotify) {
|
||||
ssl->error = ReceiveData(ssl, 0, 0, 0);
|
||||
ssl->error = wolfSSL_read(ssl, &tmp, 0);
|
||||
if (ssl->error < 0) {
|
||||
WOLFSSL_ERROR(ssl->error);
|
||||
return SSL_FATAL_ERROR;
|
||||
}
|
||||
WOLFSSL_LEAVE("SSL_shutdown()", ssl->error);
|
||||
ssl->error = SSL_ERROR_SYSCALL; /* simulate OpenSSL behavior */
|
||||
if(ssl->options.closeNotify)
|
||||
return SSL_SUCCESS;
|
||||
}
|
||||
|
||||
WOLFSSL_LEAVE("SSL_shutdown()", ssl->error);
|
||||
|
||||
ssl->error = SSL_ERROR_SYSCALL; /* simulate OpenSSL behavior */
|
||||
|
||||
return SSL_SUCCESS;
|
||||
return SSL_FATAL_ERROR;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1800,7 +1800,7 @@ static INLINE const char* mymktemp(char *tempfn, int len, int num)
|
||||
static const char alphanum[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"
|
||||
"abcdefghijklmnopqrstuvwxyz";
|
||||
RNG rng;
|
||||
int out;
|
||||
byte out;
|
||||
|
||||
if (tempfn == NULL || len < 1 || num < 1 || len <= num) {
|
||||
printf("Bad input\n");
|
||||
|
Loading…
Reference in New Issue
Block a user