diff options
author | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2016-08-25 20:43:54 +0200 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2016-08-25 20:43:54 +0200 |
commit | c23c98732e0991510faaf9c543a06f9b042c0747 (patch) | |
tree | 1371ba46597f5372dbde01aa201b892450fa1df6 | |
parent | 1c6f0cf5abee97a4c90e0f9259ea71cc706c7613 (diff) | |
parent | f53c79abd7a7c7b901d0f410e7cb380451dc4ad4 (diff) | |
download | external_libsamsung-ipc-replicant-6.0.zip external_libsamsung-ipc-replicant-6.0.tar.gz external_libsamsung-ipc-replicant-6.0.tar.bz2 |
Merge remote-tracking branch 'replicant/master' into replicant-6.0replicant-6.0-beta-0002replicant-6.0-beta-0001replicant-6.0-alpha-0006replicant-6.0-alpha-0005replicant-6.0
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | include/rfs.h | 8 | ||||
-rw-r--r-- | samsung-ipc/devices/aries/aries.c | 1 | ||||
-rw-r--r-- | samsung-ipc/devices/crespo/crespo.c | 1 | ||||
-rw-r--r-- | samsung-ipc/utils.c | 1 | ||||
-rw-r--r-- | tools/Makefile.am | 5 | ||||
-rw-r--r-- | tools/nv_data-md5.c | 60 |
7 files changed, 77 insertions, 0 deletions
@@ -31,3 +31,4 @@ build core ipc-modem ipc-test +nv_data-md5 diff --git a/include/rfs.h b/include/rfs.h index 52f9ea2..7950f16 100644 --- a/include/rfs.h +++ b/include/rfs.h @@ -30,6 +30,14 @@ #define IPC_RFS_NV_WRITE_ITEM 0x4202 /* + * Values + */ + +#define NV_DATA_SECRET "Samsung_Android_RIL" +#define NV_DATA_SIZE 0x200000 +#define NV_DATA_CHUNK_SIZE 0x1000 + +/* * Structures */ diff --git a/samsung-ipc/devices/aries/aries.c b/samsung-ipc/devices/aries/aries.c index ec82a4f..39dd015 100644 --- a/samsung-ipc/devices/aries/aries.c +++ b/samsung-ipc/devices/aries/aries.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <stdio.h> #include <stdint.h> +#include <unistd.h> #include <stdbool.h> #include <string.h> #include <unistd.h> diff --git a/samsung-ipc/devices/crespo/crespo.c b/samsung-ipc/devices/crespo/crespo.c index 05831a3..c6837e5 100644 --- a/samsung-ipc/devices/crespo/crespo.c +++ b/samsung-ipc/devices/crespo/crespo.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <stdio.h> #include <stdint.h> +#include <unistd.h> #include <stdbool.h> #include <string.h> #include <unistd.h> diff --git a/samsung-ipc/utils.c b/samsung-ipc/utils.c index 0b16a86..9468c97 100644 --- a/samsung-ipc/utils.c +++ b/samsung-ipc/utils.c @@ -20,6 +20,7 @@ #include <stdio.h> #include <stdlib.h> #include <stdint.h> +#include <unistd.h> #include <string.h> #include <unistd.h> #include <fcntl.h> diff --git a/tools/Makefile.am b/tools/Makefile.am index 4a0a821..9336a64 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -7,6 +7,7 @@ AM_CFLAGS = \ bin_PROGRAMS = \ ipc-modem \ ipc-test \ + nv_data-md5 \ $(NULL) ipc_modem_SOURCES = ipc-modem.c @@ -16,3 +17,7 @@ ipc_modem_LDFLAGS = ipc_test_SOURCES = ipc-test.c ipc_test_LDADD = $(top_builddir)/samsung-ipc/libsamsung-ipc.la ipc_test_LDFLAGS = + +nv_data_md5_SOURCES = nv_data-md5.c +nv_data_md5_LDADD = $(top_builddir)/samsung-ipc/libsamsung-ipc.la +nv_data_md5_LDFLAGS = diff --git a/tools/nv_data-md5.c b/tools/nv_data-md5.c new file mode 100644 index 0000000..8ce0a70 --- /dev/null +++ b/tools/nv_data-md5.c @@ -0,0 +1,60 @@ +/* + * This file is part of libsamsung-ipc. + * + * Copyright (C) 2016 Paul Kocialkowsk <contact@paulk.fr> + * + * libsamsung-ipc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 2 of the License, or + * (at your option) any later version. + * + * libsamsung-ipc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libsamsung-ipc. If not, see <http://www.gnu.org/licenses/>. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <sys/types.h> + +#include <samsung-ipc.h> + +void usage_print(void) +{ + printf("Usage: nv_data-md5 [nv_data.bin]\n"); +} + +int main(int argc, char *argv[]) +{ + char *secret = NV_DATA_SECRET; + size_t size = NV_DATA_SIZE; + size_t chunk_size = NV_DATA_CHUNK_SIZE; + char *md5_string = NULL; + char *path; + int rc; + + if (argc < 2) { + usage_print(); + return 1; + } + + path = argv[1]; + + md5_string = ipc_nv_data_md5_calculate(path, secret, size, chunk_size); + if (md5_string == NULL) { + fprintf(stderr, "Calculating nv_data backup md5 failed\n"); + return 1; + } + + printf("%s", md5_string); + + free(md5_string); + + return 0; +} + +// vim:ts=4:sw=4:expandtab |