Moving the secret inside the tests, not in a library function.
This commit is contained in:
parent
ff1d44b505
commit
5271fc50c7
@ -38,14 +38,12 @@
|
|||||||
#define _SECRET_H_
|
#define _SECRET_H_
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* During automated testing this is set to a random 32-bit value, to ensure
|
* During automated testing all instances of KERNEL_SECRET in trusted tests
|
||||||
* that the kernel is actually running the compiled binaries. A non-zero value
|
* are rewritten to a random value to ensure that the kernel is actually
|
||||||
* can also be used as a flag to change test output. During normal testing
|
* running the appropriate tests. So this value is never actually used, but
|
||||||
* this can be set to zero to disable printing the kernel secret and enable
|
* allows normally compilation and operation.
|
||||||
* normal test output.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// #define KERNEL_SECRET ((unsigned long long)1) // Cast for consistent printf
|
#define KERNEL_SECRET ""
|
||||||
#define KERNEL_SECRET ((unsigned long long)0) // Cast for consistent printf
|
|
||||||
|
|
||||||
#endif /* _SECRET_H_ */
|
#endif /* _SECRET_H_ */
|
||||||
|
@ -204,6 +204,5 @@ void random_spinner(uint32_t);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
int tkprintf(const char *format, ...) __PF(1,2);
|
int tkprintf(const char *format, ...) __PF(1,2);
|
||||||
int skprintf(const char *format, ...) __PF(1,2);
|
|
||||||
|
|
||||||
#endif /* _LIB_H_ */
|
#endif /* _LIB_H_ */
|
||||||
|
@ -149,7 +149,7 @@ tkprintf(const char *fmt, ...)
|
|||||||
int chars;
|
int chars;
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
if (KERNEL_SECRET != 0) {
|
if (strcmp(KERNEL_SECRET, "") != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,26 +160,6 @@ tkprintf(const char *fmt, ...)
|
|||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* kprintf variant that prints the automated secret
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
skprintf(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
int chars;
|
|
||||||
va_list ap;
|
|
||||||
|
|
||||||
if (KERNEL_SECRET != 0) {
|
|
||||||
kprintf("SECRET=%llu ", KERNEL_SECRET);
|
|
||||||
}
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
chars = vkprintf(fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
|
|
||||||
return chars;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* panic() is for fatal errors. It prints the printf arguments it's
|
* panic() is for fatal errors. It prints the printf arguments it's
|
||||||
* passed and then halts the system.
|
* passed and then halts the system.
|
||||||
|
@ -98,9 +98,9 @@ static
|
|||||||
void
|
void
|
||||||
success(bool status, const char *msg) {
|
success(bool status, const char *msg) {
|
||||||
if (status == SUCCESS) {
|
if (status == SUCCESS) {
|
||||||
skprintf("%s: SUCCESS\n", msg);
|
kprintf("%s%s: SUCCESS\n", KERNEL_SECRET, msg);
|
||||||
} else {
|
} else {
|
||||||
skprintf("%s: FAIL\n", msg);
|
kprintf("%s%s: FAIL\n", KERNEL_SECRET, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user