diff options
| author | Jakob Kaivo <jkk@ung.org> | 2020-11-12 19:44:44 -0500 |
|---|---|---|
| committer | Jakob Kaivo <jkk@ung.org> | 2020-11-12 19:44:44 -0500 |
| commit | 25ef0e31af60f54f67bb5d69d1654cc94a48b8fd (patch) | |
| tree | 19905af57e8ec01a4521d88c5ad6c70b9fecf621 | |
| parent | 86a43cdcb7882d9dadd8a3a95b74bf1e9d586556 (diff) | |
s/getkey/genkey/
| -rw-r--r-- | genkey.c (renamed from getkey.c) | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -2,13 +2,14 @@ #include <stdio.h> #include <string.h> #include <stdlib.h> +#include "deonebook.h" #define SCR_SIZE 8 #define CSD_SIZE 16 #define CID_SIZE 16 #define KEY_SIZE 16 -unsigned char twiddle(unsigned char buf[2]) +static unsigned char twiddle(unsigned char buf[2]) { unsigned char c = 0; @@ -32,7 +33,7 @@ unsigned char twiddle(unsigned char buf[2]) return c; } -void get_sd_register(const char *dev, const char *reg, size_t n, unsigned char buf[n]) +static void get_sd_register(const char *dev, const char *reg, size_t n, unsigned char buf[n]) { char path[256]; snprintf(path, sizeof(path), "/sys/block/%s/device/%s", dev, reg); @@ -51,7 +52,7 @@ void get_sd_register(const char *dev, const char *reg, size_t n, unsigned char b fclose(f); } -unsigned char * getkey(const char *dev) +unsigned char * genkey(const char *dev) { static unsigned char key[KEY_SIZE]; const unsigned char keycode[] = "eone"; @@ -80,13 +81,3 @@ unsigned char * getkey(const char *dev) return key; } - -int main(void) -{ - unsigned char *key = getkey("mmcblk0"); - printf("calculated:"); - for (size_t i = 0; i < KEY_SIZE; i++) { - printf(" %02hhx", key[i]); - } - printf("\n"); -} |
