Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(170)

Side by Side Diff: utility/tpm-dad-lock

Issue 3492011: Add a script that measures DAD behavior (Dictionary Attack Defense) (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/vboot_reference.git
Patch Set: use tpm_getpubek instead of tpm_clear Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/bin/bash -e
2 #
3 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 # Attempt to trigger the TPM Dictionary Attack Defense Lock and measure its
8 # behavior.
9
10 owned=$(cat /sys/class/misc/tpm0/device/owned)
11 if [ "$owned" = "" ]; then
12 echo "TPM is not functional"
13 exit 1
14 fi
15 if [ "$owned" = "0" ]; then
16 echo "please use random, non-empty passwords"
17 tpm_takeownership || exit 1
18 fi
19
20 attempts=0
21 max=1
22 e=/tmp/x$$
23
24 while true; do
25 attempts=$(( $attempts + 1 ))
26 before=$(date +%s)
27 defending=1
28 while [ $defending -eq 1 ]; do
29 if tpm_getpubek -z 2> $e; then
30 echo "unexpected success of tpm_getpubek"
31 exit 1
32 fi
33 if grep -q communication $e; then
34 echo "communication failure"
35 exit 1
36 fi
37 if ! grep -q dictionary $e; then
38 defending=0
39 fi
40 done
41 after=$(date +%s)
42 elapsed=$(( $after - $before ))
43 if [ $elapsed -gt $max ]; then
44 echo delay of $elapsed seconds after $attempts attempts
45 max=$elapsed
46 fi
47 done
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698