@@ -1117,11 +1117,13 @@ static int wolfengine_destroy(ENGINE *e)
11171117 return 1 ;
11181118}
11191119
1120- #define WOLFENGINE_CMD_ENABLE_DEBUG ENGINE_CMD_BASE
1121- #define WOLFENGINE_CMD_SET_LOG_LEVEL (ENGINE_CMD_BASE + 1)
1122- #define WOLFENGINE_CMD_SET_LOG_COMPONENTS (ENGINE_CMD_BASE + 2)
1123- #define WOLFENGINE_CMD_SET_LOGGING_CB (ENGINE_CMD_BASE + 3)
1124- #define WOLFENGINE_CMD_ENABLE_FIPS_CHECKS (ENGINE_CMD_BASE + 4)
1120+ #define WOLFENGINE_CMD_ENABLE_DEBUG ENGINE_CMD_BASE
1121+ #define WOLFENGINE_CMD_SET_LOG_LEVEL (ENGINE_CMD_BASE + 1)
1122+ #define WOLFENGINE_CMD_SET_LOG_COMPONENTS (ENGINE_CMD_BASE + 2)
1123+ #define WOLFENGINE_CMD_SET_LOGGING_CB (ENGINE_CMD_BASE + 3)
1124+ #define WOLFENGINE_CMD_ENABLE_FIPS_CHECKS (ENGINE_CMD_BASE + 4)
1125+ #define WOLFENGINE_CMD_ENABLE_DEBUG_WOLFSSL (ENGINE_CMD_BASE + 5)
1126+ #define WOLFENGINE_CMD_SET_LOGGING_CB_WOLFSSL (ENGINE_CMD_BASE + 6)
11251127
11261128/**
11271129 * wolfEngine control command list.
@@ -1177,6 +1179,14 @@ static ENGINE_CMD_DEFN wolfengine_cmd_defns[] = {
11771179 "enable_fips_checks" ,
11781180 "Enable wolfEngine FIPS checks (1=enable, 0=disable)" ,
11791181 ENGINE_CMD_FLAG_NUMERIC },
1182+ { WOLFENGINE_CMD_ENABLE_DEBUG_WOLFSSL ,
1183+ "enable_debug_wolfssl" ,
1184+ "Enable wolfSSL debug logging (1=enable, 0=disable)" ,
1185+ ENGINE_CMD_FLAG_NUMERIC },
1186+ { WOLFENGINE_CMD_SET_LOGGING_CB_WOLFSSL ,
1187+ "set_logging_cb_wolfssl" ,
1188+ "Set wolfSSL logging callback" ,
1189+ ENGINE_CMD_FLAG_INTERNAL },
11801190
11811191 /* last element MUST be NULL/0 entry, do not remove */
11821192 {0 , NULL , NULL , 0 }
@@ -1224,6 +1234,16 @@ static int wolfengine_ctrl(ENGINE* e, int cmd, long i, void* p,
12241234 wolfEngine_Debugging_OFF ();
12251235 }
12261236 break ;
1237+ case WOLFENGINE_CMD_ENABLE_DEBUG_WOLFSSL :
1238+ if (i > 0 ) {
1239+ if (wolfSSL_Debugging_ON () < 0 ) {
1240+ ret = 0 ;
1241+ }
1242+ }
1243+ else {
1244+ wolfSSL_Debugging_OFF ();
1245+ }
1246+ break ;
12271247 case WOLFENGINE_CMD_SET_LOG_LEVEL :
12281248 if (wolfEngine_SetLogLevel ((int )i ) < 0 ) {
12291249 WOLFENGINE_ERROR_MSG (WE_LOG_ENGINE ,
@@ -1250,6 +1270,18 @@ static int wolfengine_ctrl(ENGINE* e, int cmd, long i, void* p,
12501270 "wolfEngine user logging callback registered" );
12511271 }
12521272 break ;
1273+ case WOLFENGINE_CMD_SET_LOGGING_CB_WOLFSSL :
1274+ /* if f is NULL, resets logging back to default */
1275+ if (wolfSSL_SetLoggingCb ((wolfSSL_Logging_cb )f ) != 0 ) {
1276+ WOLFENGINE_ERROR_MSG (WE_LOG_ENGINE ,
1277+ "Error registering wolfSSL logging callback" );
1278+ ret = 0 ;
1279+ }
1280+ else {
1281+ WOLFENGINE_MSG (WE_LOG_ENGINE ,
1282+ "wolfSSL user logging callback registered" );
1283+ }
1284+ break ;
12531285 case WOLFENGINE_CMD_ENABLE_FIPS_CHECKS :
12541286 #if defined(HAVE_FIPS ) || defined(HAVE_FIPS_VERSION )
12551287 wolfEngine_SetFipsChecks (i );
0 commit comments