From 13b1f56323f9704c0aff98a5ddfbd276a235c1bb Mon Sep 17 00:00:00 2001 From: Andrew Jeffery Date: Mon, 27 May 2024 11:42:01 +0930 Subject: [PATCH] bridge: debug: Drop the need for AST_DEBUG_PASSWORD Aspeed have self-published the password. How to locate the public copy it is described in the code comment. Signed-off-by: Andrew Jeffery --- src/bridge/debug.c | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/bridge/debug.c b/src/bridge/debug.c index 4e8e0c3..71ba2ce 100644 --- a/src/bridge/debug.c +++ b/src/bridge/debug.c @@ -24,6 +24,17 @@ #define to_debug(ahb) container_of(ahb, struct debug, ahb) +/* + * Aspeed have self-published the debug UART password. Given that it's no-longer + * secret, embed it directly in culvert rather than require the user to specify + * it in the environment. + * + * Page 381, under "5. start use debug command" + * + * https://github.com/AspeedTech-BMC/openbmc/releases/download/v09.01/SDK_User_Guide_v09.01.pdf + */ +static const char *password = "5z&0VK{@`HW}H~V310=l=JB+M]IV-f;Sz98XfCA&Rp)i|Jo=2?IBN$QaQ2\"Kb|Ov"; + static inline int streq(const char *a, const char *b) { return !strcmp(a, b); @@ -31,17 +42,10 @@ static inline int streq(const char *a, const char *b) int debug_enter(struct debug *ctx) { - const char *password; int rc; logi("Entering debug mode\n"); - password = getenv("AST_DEBUG_PASSWORD"); - if (!password) { - loge("AST_DEBUG_PASSWORD environment variable is not defined\n"); - return -ENOTSUP; - } - rc = console_set_baud(ctx->console, 1200); if (rc < 0) return rc; @@ -464,15 +468,6 @@ int debug_init_v(struct debug *ctx, va_list args) const char *interface; int rc, fd; - /* - * Sanity-check presence of the password, though we also test again below - * where we use it to avoid TOCTOU. - */ - if (!getenv("AST_DEBUG_PASSWORD")) { - loge("AST_DEBUG_PASSWORD environment variable is not defined\n"); - return -ENOTSUP; - } - interface = va_arg(args, const char *); if (!interface)