1 #include <nuklear.h>
2 
3 #include <ui/display.h>
4 #include <ui/font.h>
5 #include <ui/window.h>
6 
7 #include <vuln/ssb.h>
8 
9 #include "style.h"
10 
11 void
show_ssb_tab(struct nk_context * ctx,struct style * style,struct ssb_info * info,int flags)12 show_ssb_tab(struct nk_context *ctx, struct style *style, struct ssb_info *info, int flags)
13 {
14 	float ratios[] = {0.3f, 0.7f};
15 	int ret;
16 
17 	ui_set_font(ctx, style->header_font);
18 	ret = nk_tree_push(ctx, NK_TREE_TAB, "Speculative Store Bypass", flags);
19 	ui_set_font(ctx, style->font);
20 
21 	if (!ret)
22 		return;
23 
24 	nk_layout_row(ctx, NK_DYNAMIC, 20, 2, ratios);
25 	ui_set_font(ctx, style->bold_font);
26 	nk_label_wrap(ctx, "Speculative Store Bypass");
27 	ui_set_font(ctx, style->font);
28 
29 	if (info->affected) {
30 		nk_label_colored_wrap(ctx, "Vulnerable", style->red);
31 	} else {
32 		nk_label_colored_wrap(ctx, "Not Affected", style->green);
33 	}
34 
35 	ui_set_font(ctx, style->bold_font);
36 	nk_label_wrap(ctx, "Speculative Store Bypass Disable:");
37 	ui_set_font(ctx, style->font);
38 
39 	if (info->affected) {
40 		switch (info->ssbd) {
41 		case SSBD_OS_SUPPORT: nk_label_colored_wrap(ctx, "OS Support", style->green); break;
42 		case SSBD_PRESENT: nk_label_colored_wrap(ctx, "Available", style->yellow); break;
43 		default: nk_label_colored_wrap(ctx, "Not Available", style->red);
44 		}
45 	} else {
46 		nk_label_colored_wrap(ctx, "Not Required", style->green);
47 	}
48 
49 	nk_tree_pop(ctx);
50 }
51