]> git.scottworley.com Git - overonion/commitdiff
Add an operation field to each line.
authorScott Worley <scottworley@scottworley.com>
Sun, 22 Oct 2017 04:01:53 +0000 (21:01 -0700)
committerScott Worley <scottworley@scottworley.com>
Sun, 22 Oct 2017 04:29:01 +0000 (21:29 -0700)
The only operation at first is "openssl-enc"

overonion
overonion-make-key

index a33351a7ece4153b72b765c204c01ac66c37f975..271938c8d05e8de5ceab2a1562132493ccdd59de 100755 (executable)
--- a/overonion
+++ b/overonion
@@ -40,9 +40,14 @@ function go() {
   if (( layer == 0 || layer > num_layers ));then
     cat
   else
   if (( layer == 0 || layer > num_layers ));then
     cat
   else
-    openssl enc $openssl_decrypt "-$(sed -n "${layer}s/ .*//p" "$keyfile")" \
-            -pass fd:37 37< <(sed -n "${layer}s/^[^ ]* //p" "$keyfile") |
-    go $(( layer + next_layer ))
+    operation=$(sed -n "${layer}s/ .*//p" "$keyfile")
+    if [[ "$operation" == openssl-enc ]];then
+      openssl enc $openssl_decrypt "-$(sed -rn "${layer}s/[^ ]+ ([^ ]+) .*/\\1/p" "$keyfile")" \
+              -pass fd:37 37< <(sed -rn "${layer}s/^[^ ]+ [^ ]+ //p" "$keyfile")
+    else
+      die "Unknown operation"
+    fi |
+      go $(( layer + next_layer ))
   fi
 }
 
   fi
 }
 
index da564ad39227896970b3093a29e75c06ac369ae6..ff094721f5e03a1a82418c48111c1419e701936a 100755 (executable)
@@ -36,6 +36,6 @@ fi
 i=0
 while read -r cipher;do
   echo -n $'\r'"Generating key $((++i))/${#ciphers[*]}" >&2
 i=0
 while read -r cipher;do
   echo -n $'\r'"Generating key $((++i))/${#ciphers[*]}" >&2
-  cat >> "$keyfile" <<< "$cipher $(head -c 99 "$random_source" | base64 --wrap=0 )"
+  cat >> "$keyfile" <<< "openssl-enc $cipher $(head -c 99 "$random_source" | base64 --wrap=0 )"
 done < <( IFS=$'\n'; shuf <<< "${ciphers[*]}"; )
 echo >&2
 done < <( IFS=$'\n'; shuf <<< "${ciphers[*]}"; )
 echo >&2