summaryrefslogtreecommitdiff
path: root/paper
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2021-09-29 13:44:08 +0200
committerjaseg <git@jaseg.de>2021-09-29 13:44:08 +0200
commit427881c7c570b2694c7f82d4fc29753f15385833 (patch)
tree53de1fdc5e5308d3e33b46f2b1701f0c063f19a6 /paper
parent65734fd7b548ace60c08291e450ffc0cba37cd7b (diff)
downloadihsm-427881c7c570b2694c7f82d4fc29753f15385833.tar.gz
ihsm-427881c7c570b2694c7f82d4fc29753f15385833.tar.bz2
ihsm-427881c7c570b2694c7f82d4fc29753f15385833.zip
Diff improvements
Diffstat (limited to 'paper')
-rw-r--r--paper/diffinator.py44
-rw-r--r--paper/ihsm_paper.tex9
2 files changed, 43 insertions, 10 deletions
diff --git a/paper/diffinator.py b/paper/diffinator.py
index 00a5b4f..a54e844 100644
--- a/paper/diffinator.py
+++ b/paper/diffinator.py
@@ -22,8 +22,8 @@ def generate_git_tex_diff(texfile, bibliography, revision):
bib_proc = subprocess.run(['git', 'diff', f'-U{bib_lines+1}', '--word-diff', '--color=always', revision, bibliography],
check=True, capture_output=True)
- ADDITION_RE_R = '\033\\[32m\\{\\+(.*?)([^\\\\]%.*?)?\\+\\}\033\\[m'
- DELETION_RE_R = '\033\\[31m\\[-(.*?)([^\\\\]%.*?)?\\-]\033\\[m'
+ ADDITION_RE_R = '\033\\[32m\\{\\+([^\033]*?)([^\\\\]%.*?)?\\+\\}\033\\[m'
+ DELETION_RE_R = '\033\\[31m\\[-([^\033]*?)([^\\\\]%.*?)?\\-]\033\\[m'
addition_re = re.compile(ADDITION_RE_R)
deletion_re = re.compile(DELETION_RE_R)
combined_re = re.compile(f'{DELETION_RE_R}{ADDITION_RE_R}')
@@ -61,8 +61,16 @@ def generate_git_tex_diff(texfile, bibliography, revision):
line = line.rstrip()
if document_started: # diff results in preamble
+ import sys
+ debug = 'battery' in line
+ if debug:
+ print('orig:', repr(line), file=sys.stderr)
+
def suppress_small_changes(match):
+ nonlocal debug
old, _1, new, _2 = match.groups()
+ if debug:
+ print(f'old={repr(old)}, new={repr(new)}', file=sys.stderr)
if len(old) < 12 and len(new) < 12:
return new
@@ -70,24 +78,48 @@ def generate_git_tex_diff(texfile, bibliography, revision):
if old.count(' ') < 3 and new.count(' ') < 3:
return new
+ if '}' in old or '{' in old or '{' in new or '}' in new:
+ return new
+
new_chars = list(new)
for char in old:
if char not in string.ascii_letters:
continue
if char not in new_chars:
- return match.group(0) # return original text
+ return r' \color{diffred}' + old + r' \color{diffgreen}' + new + ' \color{black}'
new_chars.remove(char)
if any(char in string.ascii_letters for char in new_chars):
- return match.group(0) # return original text
+ return r' \color{diffred}' + old + r' \color{diffgreen}' + new + ' \color{black}'
return new
line = combined_re.sub(suppress_small_changes, line)
- line = addition_re.sub(r' \\color{diffgreen}\1 \\color{black}', line)
- line = deletion_re.sub(r' \\color{diffred}\1 \\color{black}', line)
+ if debug:
+ print('[1]', line, file=sys.stderr)
+
+ def suppress_small_changes(match, action):
+ change = match.group(1)
+
+ if len(change) < 12 or change.count(' ') < 3 or '}' in change or '{' in change:
+ if action == 'addition':
+ return change
+ else: # deletion
+ return ''
+
+ if action == 'addition':
+ return r' \color{diffgreen}' + change + r' \color{black}'
+ else: # deletion
+ return r' \color{diffred}' + change + r' \color{black}'
+
+ line = addition_re.sub(lambda match: suppress_small_changes(match, 'addition'), line)
+ if debug:
+ print('[2]', line, file=sys.stderr)
+ line = deletion_re.sub(lambda match: suppress_small_changes(match, 'deletion'), line)
+ if debug:
+ print('[3]', line, file=sys.stderr)
else:
if '\\begin{document}' in line:
diff --git a/paper/ihsm_paper.tex b/paper/ihsm_paper.tex
index 56ac7c1..375b096 100644
--- a/paper/ihsm_paper.tex
+++ b/paper/ihsm_paper.tex
@@ -180,10 +180,11 @@ similar approaches to tamper detection~\cite{obermaier2018,drimer2008,anderson20
Shifting our focus from industry use to the academic state of the art, in~\cite{immler2019}, Immler et al. describe an
HSM based on precise capacitance measurements of a security mesh, creating a PUF from the mesh. In contrast to
-traditional meshes, they use a large number of individual traces. Their concept promises a very high degree of
-protection, but is limited in area covered and component height, as well as the high cost of the advanced analog
-circuitry required for monitoring. A core component of their design is that they propose its use as a PUF to allow for
-protection even when powered off, similar to a smart card---but the design is not limited to this use.
+traditional meshes, they use a large number of individual traces (more than 30 in their example). Their concept
+promises a very high degree of protection, but is limited in area covered and component height, as well as the high cost
+of the advanced analog circuitry required for monitoring. A core component of their design is that they propose its use
+as a PUF to allow for protection even when powered off, similar to a smart card---but the design is not limited to this
+use.
In~\cite{tobisch2020}, Tobisch et al.\ describe a construction technique for a hardware security module that is based on
a WiFi transceiver inside a conductive enclosure. In their design, a reference signal is sent into the RF cavity formed