This commit is contained in:
Mario Fetka
2026-05-23 13:28:02 +02:00
parent e5aa3a8b90
commit e6495fb949

View File

@@ -21,7 +21,7 @@ static int tests_same_arg(char *a, char *b)
static void tests_usage(void)
{
fprintf(stdout, "Usage: TESTS [OLD|NETCALL]\n");
fprintf(stdout, "Usage: TESTS [OLD|NETCALL|E300]\n");
}
static int tests_netcall(void)
@@ -89,6 +89,74 @@ static int tests_old(int argc, char *argv[], int mode)
return(0);
}
static void tests_dump_bytes(char *title, unsigned char *p, int len)
{
int i;
fprintf(stdout, "%s", title);
for (i = 0; i < len; i++)
fprintf(stdout, " %02X", p[i]);
fprintf(stdout, "\n");
}
static int tests_netcall_e300(void)
{
struct {
uint16 len;
uint8 func;
} req_asm, req_c;
struct {
uint16 len;
uint8 data[16];
} repl_asm, repl_c;
int asm_rc;
int c_rc;
memset(&req_asm, 0, sizeof(req_asm));
memset(&req_c, 0, sizeof(req_c));
memset(&repl_asm, 0, sizeof(repl_asm));
memset(&repl_c, 0, sizeof(repl_c));
/*
* NCP 17/17 Get Login Encryption Key.
* This is a known safe bindery/login helper call used by LOGIN/PASSWD code.
* Request via old DOS NetWare API AX=E300.
*/
req_asm.len = 1;
req_asm.func = 0x17;
repl_asm.len = 8;
req_c.len = 1;
req_c.func = 0x17;
repl_c.len = 8;
fprintf(stdout, "TEST Net_Call ASM vs C E300/NCP17/17\n");
fprintf(stdout, "Call: Get Login Encryption Key\n\n");
asm_rc = Net_Call(0xE300, &req_asm, &repl_asm);
fprintf(stdout, "ASM Net_Call(E300h) rc=%04X\n", asm_rc);
tests_dump_bytes("ASM key:", repl_asm.data, 8);
c_rc = Net_Call_C(0xE300, &req_c, &repl_c);
fprintf(stdout, "C Net_Call_C(E300h) rc=%04X\n", c_rc);
tests_dump_bytes("C key:", repl_c.data, 8);
Net_Call_C_Dump();
if ((asm_rc & 0xff) == (c_rc & 0xff))
fprintf(stdout, "\nNETCALL C E300 return test OK\n");
else
fprintf(stdout, "\nNETCALL C E300 return test FAILED\n");
/*
* Keys can differ per request, so do not require byte-identical keys.
* We only compare return status and check that both calls returned 8 bytes.
*/
return(0);
}
int func_tests(int argc, char *argv[], int mode)
{
if (argc < 2)
@@ -97,6 +165,9 @@ int func_tests(int argc, char *argv[], int mode)
if (tests_same_arg(argv[1], "NETCALL"))
return tests_netcall();
if (tests_same_arg(argv[1], "E300") || tests_same_arg(argv[1], "NETCALLE300"))
return tests_netcall_e300();
if (tests_same_arg(argv[1], "OLD"))
return tests_old(argc - 1, argv + 1, mode);