summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordu.net>2015-05-29 17:44:22 +0200
committerLinus Nordberg <linus@nordu.net>2015-05-29 17:44:22 +0200
commitc14d572f160f05e3d532714ad3b62c0b20b03aa1 (patch)
treef878ee42e0ccf81323d55cceeeb6823b6cddad58
parentd9df4af0fcc91e1988a411892bba0b792ce62427 (diff)
parent42eebf1c68849b1367a8e87757f8019732058c50 (diff)
Merge remote-tracking branch 'refs/remotes/map/fsynclogorder'
-rw-r--r--Makefile2
-rw-r--r--tools/certtools.py7
-rwxr-xr-xtools/check-sth.py2
-rwxr-xr-xtools/merge.py6
4 files changed, 14 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 2acaee2..0657b43 100644
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ tests-prepare:
mv $(INSTDIR)/tests/privatekeys/merge-1.pem $(INSTDIR)/tests/publickeys/
-test -x $(SOFTHSM) && $(SOFTHSM) --init-token --slot=0 --label=mylabel --so-pin=ffff --pin=ffff
-test -x $(SOFTHSM) && $(SOFTHSM) --import $(INSTDIR)/tests/keys/logkey-private.pkcs8 --slot 0 --label mylabel --pin ffff --id 00
- rm $(INSTDIR)/cur-sth.json
+ rm -f $(INSTDIR)/cur-sth.json
tests-start:
@for node in $(NODES); do \
diff --git a/tools/certtools.py b/tools/certtools.py
index 405aabd..ccbc76e 100644
--- a/tools/certtools.py
+++ b/tools/certtools.py
@@ -219,7 +219,12 @@ def encode_signature(hash_alg, signature_alg, unpacked_signature):
def check_signature(baseurl, signature, data, publickey=None):
if publickey == None:
- publickey = base64.decodestring(publickeys[baseurl])
+ if baseurl in publickeys:
+ publickey = base64.decodestring(publickeys[baseurl])
+ else:
+ print >>sys.stderr, "Public key for", baseurl, \
+ "not found, specify key file with --publickey"
+ sys.exit(1)
(hash_alg, signature_alg, unpacked_signature) = decode_signature(signature)
assert hash_alg == 4, \
"hash_alg is %d, expected 4" % (hash_alg,) # sha256
diff --git a/tools/check-sth.py b/tools/check-sth.py
index 0cdc031..dacd8e6 100755
--- a/tools/check-sth.py
+++ b/tools/check-sth.py
@@ -26,8 +26,8 @@ parser.add_argument('--cur-sth',
metavar='file',
default=DEFAULT_CUR_FILE,
help="File containing current STH (default=%s)" % DEFAULT_CUR_FILE)
-parser.add_argument('publickey', help='File containing the public key for the CT log')
parser.add_argument('baseurl', help="Base URL for CT log")
+parser.add_argument('--publickey', default=None, metavar='file', help='Public key for the CT log')
parser.add_argument('--cafile', default=None, metavar='file', help='File containing the CA cert')
parser.add_argument('--allow-lag', action='store_true', help='Allow node to lag behind previous STH')
parser.add_argument('--quiet-ok', action='store_true', help="Don't print status if OK")
diff --git a/tools/merge.py b/tools/merge.py
index b426039..8766491 100755
--- a/tools/merge.py
+++ b/tools/merge.py
@@ -73,6 +73,11 @@ def add_to_logorder(key):
f.write(base64.b16encode(key) + "\n")
f.close()
+def fsync_logorder():
+ f = open(logorderfile, "a")
+ os.fsync(f.fileno())
+ f.close()
+
def get_new_entries(node, baseurl):
try:
result = http_request(baseurl + "ct/storage/fetchnewentries", key=own_key, verifynode=node, publickeydir=paths["publickeys"])
@@ -228,6 +233,7 @@ for storagenode in storagenodes:
logorder.append(hash)
certsinlog.add(hash)
added_entries += 1
+fsync_logorder()
timing_point(timing, "add entries")
print "added", added_entries, "entries"