@@ -54,11 +54,8 @@ def generate_entropy(strength, internal_entropy, external_entropy):
5454 return entropy_stripped
5555
5656class TestDeviceReset (common .KeepKeyTest ):
57- def test_reset_device (self ):
58- # No PIN, no passphrase
57+ def _reset_without_pin_and_capture (self , strength ):
5958 external_entropy = b'zlutoucky kun upel divoke ody' * 2
60- strength = 128
61-
6259 ret = self .client .call_raw (proto .ResetDevice (display_random = False ,
6360 strength = strength ,
6461 passphrase_protection = False ,
@@ -77,27 +74,32 @@ def test_reset_device(self):
7774
7875 # Explainer Dialog
7976 self .assertIsInstance (resp , proto .ButtonRequest )
77+ self .client ._capture_oled ()
8078 self .client .debug .press_yes ()
8179 resp = self .client .call_raw (proto .ButtonAck ())
8280
8381 mnemonic = []
8482 while isinstance (resp , proto .ButtonRequest ):
85- mnemonic .append (self .client .debug .read_reset_word ())
83+ self .client ._capture_oled ()
84+ words = self .client .debug .read_reset_word ()
85+ # 7.14.2's debug build exposes each physical subpage as a separate
86+ # ButtonRequest for evidence capture. All subpages in one legacy
87+ # word group intentionally report the same reset_word value.
88+ if not mnemonic or mnemonic [- 1 ] != words :
89+ mnemonic .append (words )
8690 self .client .debug .press_yes ()
8791 resp = self .client .call_raw (proto .ButtonAck ())
8892
8993 mnemonic = ' ' .join (mnemonic )
9094
91- # Compare that device generated proper mnemonic for given entropies
9295 self .assertEqual (mnemonic , expected_mnemonic )
93-
9496 self .assertIsInstance (resp , proto .Success )
97+ self .assertEqual (strength // 32 * 3 , len (mnemonic .split ()))
98+ return self .client .call_raw (proto .Initialize ())
9599
96- # Compare that second pass printed out the same mnemonic once again
97- self .assertEqual (mnemonic , expected_mnemonic )
98-
99- # Check if device is properly initialized
100- resp = self .client .call_raw (proto .Initialize ())
100+ def test_reset_device (self ):
101+ # 128-bit entropy produces the 12-word ceremony.
102+ resp = self ._reset_without_pin_and_capture (128 )
101103 self .assertFalse (resp .pin_protection )
102104 self .assertFalse (resp .passphrase_protection )
103105
@@ -109,6 +111,16 @@ def test_reset_device(self):
109111 resp = self .client .call_raw (proto .Ping (pin_protection = True ))
110112 self .assertIsInstance (resp , proto .Success )
111113
114+ def test_reset_device_18_words (self ):
115+ resp = self ._reset_without_pin_and_capture (192 )
116+ self .assertFalse (resp .pin_protection )
117+ self .assertFalse (resp .passphrase_protection )
118+
119+ def test_reset_device_24_words (self ):
120+ resp = self ._reset_without_pin_and_capture (256 )
121+ self .assertFalse (resp .pin_protection )
122+ self .assertFalse (resp .passphrase_protection )
123+
112124 def test_reset_device_pin (self ):
113125 external_entropy = b'zlutoucky kun upel divoke ody' * 2
114126 strength = 128
@@ -131,11 +143,13 @@ def test_reset_device_pin(self):
131143 ret = self .client .call_raw (proto .ButtonAck ())
132144
133145 self .assertIsInstance (ret , proto .PinMatrixRequest )
146+ self .client ._capture_oled ()
134147
135148 # Enter PIN for first time
136149 pin_encoded = self .client .debug .encode_pin ('654' )
137150 ret = self .client .call_raw (proto .PinMatrixAck (pin = pin_encoded ))
138151 self .assertIsInstance (ret , proto .PinMatrixRequest )
152+ self .client ._capture_oled ()
139153
140154 # Enter PIN for second time
141155 pin_encoded = self .client .debug .encode_pin ('654' )
@@ -152,12 +166,16 @@ def test_reset_device_pin(self):
152166
153167 # Explainer Dialog
154168 self .assertIsInstance (resp , proto .ButtonRequest )
169+ self .client ._capture_oled ()
155170 self .client .debug .press_yes ()
156171 resp = self .client .call_raw (proto .ButtonAck ())
157172
158173 mnemonic = []
159174 while isinstance (resp , proto .ButtonRequest ):
160- mnemonic .append (self .client .debug .read_reset_word ())
175+ self .client ._capture_oled ()
176+ words = self .client .debug .read_reset_word ()
177+ if not mnemonic or mnemonic [- 1 ] != words :
178+ mnemonic .append (words )
161179 self .client .debug .press_yes ()
162180 resp = self .client .call_raw (proto .ButtonAck ())
163181
@@ -206,11 +224,13 @@ def test_failed_pin(self):
206224 ret = self .client .call_raw (proto .ButtonAck ())
207225
208226 self .assertIsInstance (ret , proto .PinMatrixRequest )
227+ self .client ._capture_oled ()
209228
210229 # Enter PIN for first time
211230 pin_encoded = self .client .debug .encode_pin (self .pin4 )
212231 ret = self .client .call_raw (proto .PinMatrixAck (pin = pin_encoded ))
213232 self .assertIsInstance (ret , proto .PinMatrixRequest )
233+ self .client ._capture_oled ()
214234
215235 # Enter PIN for second time
216236 pin_encoded = self .client .debug .encode_pin (self .pin6 )
0 commit comments