mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 20:24:39 +02:00
implement get error line data function
This commit is contained in:
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,
|
unsigned long wolfSSL_ERR_get_error_line_data(const char** file, int* line,
|
||||||
const char** data, int *flags)
|
const char** data, int *flags)
|
||||||
{
|
{
|
||||||
/* Not implemented */
|
WOLFSSL_STUB("wolfSSL_ERR_get_error_line_data");
|
||||||
(void)file;
|
|
||||||
(void)line;
|
|
||||||
(void)data;
|
|
||||||
(void)flags;
|
|
||||||
WOLFSSL_STUB("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_API pem_password_cb* wolfSSL_CTX_get_default_passwd_cb(
|
||||||
WOLFSSL_CTX *ctx)
|
WOLFSSL_CTX *ctx)
|
||||||
|
@@ -14236,7 +14236,9 @@ static void test_wolfSSL_ERR_peek_last_error_line(void)
|
|||||||
callback_functions client_cb;
|
callback_functions client_cb;
|
||||||
callback_functions server_cb;
|
callback_functions server_cb;
|
||||||
int line = 0;
|
int line = 0;
|
||||||
|
int flag = ERR_TXT_STRING;
|
||||||
const char* file = NULL;
|
const char* file = NULL;
|
||||||
|
const char* data = NULL;
|
||||||
|
|
||||||
printf(testingFmt, "wolfSSL_ERR_peek_last_error_line()");
|
printf(testingFmt, "wolfSSL_ERR_peek_last_error_line()");
|
||||||
|
|
||||||
@@ -14269,6 +14271,9 @@ static void test_wolfSSL_ERR_peek_last_error_line(void)
|
|||||||
|
|
||||||
FreeTcpReady(&ready);
|
FreeTcpReady(&ready);
|
||||||
|
|
||||||
|
AssertIntGT(ERR_get_error_line_data(NULL, NULL, &data, &flag), 0);
|
||||||
|
AssertNotNull(data);
|
||||||
|
|
||||||
/* check clearing error state */
|
/* check clearing error state */
|
||||||
ERR_remove_state(0);
|
ERR_remove_state(0);
|
||||||
AssertIntEQ((int)ERR_peek_last_error_line(NULL, NULL), 0);
|
AssertIntEQ((int)ERR_peek_last_error_line(NULL, NULL), 0);
|
||||||
|
Reference in New Issue
Block a user