implement get error line data function
This commit is contained in:
parent
f393eb9176
commit
189a4d74c0
28
src/ssl.c
28
src/ssl.c
@ -14674,20 +14674,30 @@ int wolfSSL_EVP_MD_type(const WOLFSSL_EVP_MD *md)
|
||||
}
|
||||
|
||||
|
||||
#ifndef NO_WOLFSSL_STUB
|
||||
/* Similar to wolfSSL_ERR_get_error_line but takes in a flags argument for
|
||||
* more flexability.
|
||||
*
|
||||
* file output pointer to file where error happened
|
||||
* line output to line number of error
|
||||
* data output data. Is a string if ERR_TXT_STRING flag is used
|
||||
* flags bit flag to adjust data output
|
||||
*
|
||||
* Returns the error value
|
||||
*/
|
||||
unsigned long wolfSSL_ERR_get_error_line_data(const char** file, int* line,
|
||||
const char** data, int *flags)
|
||||
{
|
||||
/* Not implemented */
|
||||
(void)file;
|
||||
(void)line;
|
||||
(void)data;
|
||||
(void)flags;
|
||||
WOLFSSL_STUB("ERR_get_error_line_data");
|
||||
WOLFSSL_STUB("wolfSSL_ERR_get_error_line_data");
|
||||
|
||||
return 0;
|
||||
if (flags != NULL) {
|
||||
if ((*flags & ERR_TXT_STRING) == ERR_TXT_STRING) {
|
||||
return wc_PullErrorNode(file, data, line);
|
||||
}
|
||||
}
|
||||
|
||||
return wc_PullErrorNode(file, NULL, line);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
WOLFSSL_API pem_password_cb* wolfSSL_CTX_get_default_passwd_cb(
|
||||
WOLFSSL_CTX *ctx)
|
||||
|
@ -14236,7 +14236,9 @@ static void test_wolfSSL_ERR_peek_last_error_line(void)
|
||||
callback_functions client_cb;
|
||||
callback_functions server_cb;
|
||||
int line = 0;
|
||||
int flag = ERR_TXT_STRING;
|
||||
const char* file = NULL;
|
||||
const char* data = NULL;
|
||||
|
||||
printf(testingFmt, "wolfSSL_ERR_peek_last_error_line()");
|
||||
|
||||
@ -14269,6 +14271,9 @@ static void test_wolfSSL_ERR_peek_last_error_line(void)
|
||||
|
||||
FreeTcpReady(&ready);
|
||||
|
||||
AssertIntGT(ERR_get_error_line_data(NULL, NULL, &data, &flag), 0);
|
||||
AssertNotNull(data);
|
||||
|
||||
/* check clearing error state */
|
||||
ERR_remove_state(0);
|
||||
AssertIntEQ((int)ERR_peek_last_error_line(NULL, NULL), 0);
|
||||
|
Loading…
Reference in New Issue
Block a user