Skip to content

Commit b61d34f

Browse files
committed
First beta.
1 parent 43b6c2c commit b61d34f

File tree

12 files changed

+548
-160
lines changed

12 files changed

+548
-160
lines changed

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"type": "lldb",
88
"request": "launch",
99
"program": "${workspaceFolder}/src/seedtool",
10-
"args": ["--in", "slip39", "foobar"],
10+
"args": ["--in", "hex", "--out", "bip39", "38a8aaa2d6caff920c67"],
1111
"cwd": "${workspaceFolder}/src",
1212
"preLaunchTask": "Build"
1313
}

MANUAL.md

Lines changed: 481 additions & 132 deletions
Large diffs are not rendered by default.

Makefile.in

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,15 @@ $(distdir): FORCE
5252
cp $(srcdir)/bootstrap.sh $(distdir)
5353
cp $(srcdir)/configure.ac $(distdir)
5454
cp $(srcdir)/configure $(distdir)
55-
cp $(srcdir)/config.h.in $(distdir)
5655
cp $(srcdir)/install-sh $(distdir)
5756
cp $(srcdir)/Makefile.in $(distdir)
58-
cp $(srcdir)/src/Makefile.in $(distdir)/src
5957
cp $(srcdir)/.gitignore $(distdir)
58+
cp $(srcdir)/src/Makefile.in $(distdir)/src
59+
cp $(srcdir)/src/config.h.in $(distdir)/src
6060
cp $(srcdir)/src/*.c $(distdir)/src
6161
cp $(srcdir)/src/*.cpp $(distdir)/src
6262
cp $(srcdir)/src/*.h $(distdir)/src
63+
cp $(srcdir)/src/*.hpp $(distdir)/src
6364

6465
.PHONY: distcheck
6566
distcheck: $(tarball)

README.md

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Blockchain Commons bc-seedtool-cli
1+
# 🌱 Blockchain Commons bc-seedtool-cli
22

33
A tool for creating and transforming cryptographic seeds.
44

@@ -22,7 +22,22 @@ $ sudo make install
2222

2323
## Use
2424

25-
See [`MANUAL.md`](MANUAL.md).
25+
```
26+
$ seedtool
27+
8935a8068526d84da555cdb741a3b8a8
28+
29+
$ seedtool --in hex --out bip39 8935a8068526d84da555cdb741a3b8a8
30+
matrix pull accuse apart horn chat next rifle resemble artist until eye
31+
32+
$ seedtool --in bip39 matrix pull accuse apart horn chat next rifle resemble artist until eye
33+
8935a8068526d84da555cdb741a3b8a8
34+
```
35+
36+
```
37+
$ seedtool --help
38+
```
39+
40+
See [`MANUAL.md`](MANUAL.md) for detail, examples, and version history.
2641

2742
## Notes for Maintainers
2843

@@ -44,6 +59,10 @@ This table below also establishes provenance (repository of origin, permalink, a
4459

4560
| File | From | Commit | Authors & Copyright (c) | License |
4661
| --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------ | ----------------------------------------------------------- |
62+
| hkdf.c | [rustyrussell/ccan](https://github.com/rustyrussell/ccan/blob/master/ccan/crypto/hkdf_sha256/hkdf_sha256.c) | [d07f742](https://github.com/rustyrussell/ccan/commit/d07f742c5925b97ed558eb07aae285616f5df823) | 2016 [Rusty Russell](https://github.com/rustyrussell)<br/>2020 Wolf McNally | [MIT](https://github.com/rustyrussell/ccan/blob/master/ccan/crypto/hkdf_sha256/LICENSE)
63+
| hkdf.h | [rustyrussell/ccan](https://github.com/rustyrussell/ccan/blob/master/ccan/crypto/hkdf_sha256/hkdf_sha256.h) | [d07f742](https://github.com/rustyrussell/ccan/commit/d07f742c5925b97ed558eb07aae285616f5df823) | 2016 [Rusty Russell](https://github.com/rustyrussell) | [MIT](https://github.com/rustyrussell/ccan/blob/master/ccan/crypto/hkdf_sha256/LICENSE)
64+
| randombytes.c | [dsprenkels/randombytes](https://github.com/dsprenkels/randombytes/blob/master/randombytes.c) | [6db39aa](https://github.com/dsprenkels/randombytes/commit/6db39aaae6bb9ab97beca00d81bcfe935c56c88d) | 2017-2019 [Daan Sprenkels](https://github.com/dsprenkels/) | [MIT](https://github.com/dsprenkels/randombytes/commit/73ae9b4fce2e62babdd6a480b53ad449dd745ed9) |
65+
| randombytes.h | [dsprenkels/randombytes](https://github.com/dsprenkels/randombytes/blob/master/randombytes.h) | [19fd002](https://github.com/dsprenkels/randombytes/commit/19fd002d9b7b001b333a671186a91231b60d821b) | 2017-2019 [Daan Sprenkels](https://github.com/dsprenkels/) | [MIT](https://github.com/dsprenkels/randombytes/commit/73ae9b4fce2e62babdd6a480b53ad449dd745ed9) |
4766

4867
### Dependencies
4968

@@ -70,7 +89,7 @@ We want to keep all our software safe for everyone. If you have discovered a sec
7089

7190
We do ask that you offer us good faith and use best efforts not to leak information or harm any user, their data, or our developer community. Please give us a reasonable amount of time to fix the issue before you publish it. Do not defraud our users or us in the process of discovery. We promise not to bring legal action against researchers who point out a problem provided they do their best to follow the these guidelines.
7291

73-
### Reporting a Vulnerability
92+
## Reporting a Vulnerability
7493

7594
Please report suspected security vulnerabilities in private via email to [email protected] (do not use this email for support). Please do NOT create publicly viewable issues for suspected security vulnerabilities.
7695

configure

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.69 for bc-seedtool-cli 1.0.
3+
# Generated by GNU Autoconf 2.69 for bc-seedtool-cli 1.0.0b1.
44
#
55
#
66
# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
@@ -577,8 +577,8 @@ MAKEFLAGS=
577577
# Identity of this package.
578578
PACKAGE_NAME='bc-seedtool-cli'
579579
PACKAGE_TARNAME='bc-seedtool-cli'
580-
PACKAGE_VERSION='1.0'
581-
PACKAGE_STRING='bc-seedtool-cli 1.0'
580+
PACKAGE_VERSION='1.0.0b1'
581+
PACKAGE_STRING='bc-seedtool-cli 1.0.0b1'
582582
PACKAGE_BUGREPORT=''
583583
PACKAGE_URL=''
584584

@@ -1231,7 +1231,7 @@ if test "$ac_init_help" = "long"; then
12311231
# Omit some internal or obsolete options to make the list less imposing.
12321232
# This message is too long to be a string in the A/UX 3.1 sh.
12331233
cat <<_ACEOF
1234-
\`configure' configures bc-seedtool-cli 1.0 to adapt to many kinds of systems.
1234+
\`configure' configures bc-seedtool-cli 1.0.0b1 to adapt to many kinds of systems.
12351235
12361236
Usage: $0 [OPTION]... [VAR=VALUE]...
12371237
@@ -1292,7 +1292,7 @@ fi
12921292

12931293
if test -n "$ac_init_help"; then
12941294
case $ac_init_help in
1295-
short | recursive ) echo "Configuration of bc-seedtool-cli 1.0:";;
1295+
short | recursive ) echo "Configuration of bc-seedtool-cli 1.0.0b1:";;
12961296
esac
12971297
cat <<\_ACEOF
12981298
@@ -1374,7 +1374,7 @@ fi
13741374
test -n "$ac_init_help" && exit $ac_status
13751375
if $ac_init_version; then
13761376
cat <<\_ACEOF
1377-
bc-seedtool-cli configure 1.0
1377+
bc-seedtool-cli configure 1.0.0b1
13781378
generated by GNU Autoconf 2.69
13791379
13801380
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1885,7 +1885,7 @@ cat >config.log <<_ACEOF
18851885
This file contains any messages produced by compilers while
18861886
running configure, to aid debugging if configure makes a mistake.
18871887
1888-
It was created by bc-seedtool-cli $as_me 1.0, which was
1888+
It was created by bc-seedtool-cli $as_me 1.0.0b1, which was
18891889
generated by GNU Autoconf 2.69. Invocation command line was
18901890
18911891
$ $0 $@
@@ -2234,7 +2234,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
22342234

22352235

22362236

2237-
ac_config_headers="$ac_config_headers config.h"
2237+
ac_config_headers="$ac_config_headers src/config.h"
22382238

22392239

22402240
# Checks for programs.
@@ -4868,7 +4868,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
48684868
# report actual input values of CONFIG_FILES etc. instead of their
48694869
# values after options handling.
48704870
ac_log="
4871-
This file was extended by bc-seedtool-cli $as_me 1.0, which was
4871+
This file was extended by bc-seedtool-cli $as_me 1.0.0b1, which was
48724872
generated by GNU Autoconf 2.69. Invocation command line was
48734873
48744874
CONFIG_FILES = $CONFIG_FILES
@@ -4930,7 +4930,7 @@ _ACEOF
49304930
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
49314931
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
49324932
ac_cs_version="\\
4933-
bc-seedtool-cli config.status 1.0
4933+
bc-seedtool-cli config.status 1.0.0b1
49344934
configured by $0, generated by GNU Autoconf 2.69,
49354935
with options \\"\$ac_cs_config\\"
49364936
@@ -5052,7 +5052,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
50525052
for ac_config_target in $ac_config_targets
50535053
do
50545054
case $ac_config_target in
5055-
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
5055+
"src/config.h") CONFIG_HEADERS="$CONFIG_HEADERS src/config.h" ;;
50565056
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
50575057
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
50585058

configure.ac

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Process this file with autoconf to produce a configure script.
33

44
AC_PREREQ([2.69])
5-
AC_INIT([bc-seedtool-cli], [1.0])
5+
AC_INIT([bc-seedtool-cli], [1.0.0b1])
66
AC_CONFIG_SRCDIR([src/seedtool.cpp])
7-
AC_CONFIG_HEADERS([config.h])
7+
AC_CONFIG_HEADERS([src/config.h])
88

99
# Checks for programs.
1010
AC_PROG_CXX

src/Makefile.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,3 +96,4 @@ clean:
9696
.PHONY: distclean
9797
distclean: clean
9898
rm -f Makefile
99+
rm -f config.h

config.h.in renamed to src/config.h.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* config.h.in. Generated from configure.ac by autoheader. */
1+
/* src/config.h.in. Generated from configure.ac by autoheader. */
22

33
/* Define to 1 if you have the <fcntl.h> header file. */
44
#undef HAVE_FCNTL_H

src/format-bip39.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ void FormatBIP39::process_input(Params* p) {
3535
}
3636

3737
void FormatBIP39::process_output(Params* p) {
38-
if(!is_seed_length_valid(p->seed.size())) { return; }
38+
if(!is_seed_length_valid(p->seed.size())) {
39+
throw runtime_error("Invalid seed length for BIP39. Must be in [12-32] and even.");
40+
}
3941

4042
size_t max_mnemonics_len = 300;
4143
char mnemonics[max_mnemonics_len];

src/format-slip39.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ static vector<uint8_t> combine(vector<string> shares) {
5252

5353
auto combine_result = slip39_combine(
5454
(const uint16_t **)&shares_words_pointers[0], words_in_each_share, shares.size(),
55-
"TREZOR", NULL, &result[0], result.size());
55+
"", NULL, &result[0], result.size());
5656

5757
for(auto v: shares_words) {
5858
delete v;
@@ -73,7 +73,9 @@ void FormatSLIP39::process_input(Params* p) {
7373
}
7474

7575
void FormatSLIP39::process_output(Params* p) {
76-
if(!is_seed_length_valid(p->seed.size())) { return; }
76+
if(!is_seed_length_valid(p->seed.size())) {
77+
throw runtime_error("Invalid seed length for SLIP39. Must be in [16-32] and even.");
78+
}
7779

7880
const char* password = "";
7981

0 commit comments

Comments
 (0)