Skip to content

Commit

Permalink
Merge pull request tlsfuzzer#919 from GeorgePantelakis/master
Browse files Browse the repository at this point in the history
tlsfuzzer: add Hamming weight extraction and more
  • Loading branch information
tomato42 authored Apr 5, 2024
2 parents b2e8359 + b0817a0 commit 5bdd4e4
Show file tree
Hide file tree
Showing 4 changed files with 485 additions and 207 deletions.
9 changes: 6 additions & 3 deletions tests/test_tlsfuzzer_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -998,7 +998,7 @@ def test_call_with_parametrized_smart_analysis(self):
bit_size_desire_ci = 5
bit_recognition_size = 2
args = ["analysis.py", "-o", output, "--bit-size",
"--bit-size-desire-ci", bit_size_desire_ci,
"--bit-size-desired-ci", bit_size_desire_ci,
"--bit-recognition-size", bit_recognition_size,]
mock_init = mock.Mock()
mock_init.return_value = None
Expand Down Expand Up @@ -1797,7 +1797,6 @@ def test_figure_out_analysis_data_size(self, print_mock,
calc_diff_conf_int_mock):
k_sizes = [256, 255, 254, 253, 252]
old_bit_recall_size = self.analysis.bit_recognition_size
self.analysis._bit_size_data_used = 1000
self.analysis.verbose = True

calc_diff_conf_int_mock.return_value = {
Expand All @@ -1811,39 +1810,43 @@ def test_figure_out_analysis_data_size(self, print_mock,

# first test run
self.analysis._bit_size_data_limit = 10000
self.analysis._bit_size_data_used = 1000
self.analysis.bit_recognition_size = 1
self.analysis._figure_out_analysis_data_size(k_sizes)
self.assertEqual(self.analysis._bit_size_data_limit, 8281000)

# second test run
self.analysis._bit_size_data_limit = 10000
self.analysis._bit_size_data_used = 1000
self.analysis.bit_recognition_size = 2
self.analysis._figure_out_analysis_data_size(k_sizes)
self.assertEqual(self.analysis._bit_size_data_limit, 8281000)

# third test run
self.analysis._bit_size_data_limit = 10000
self.analysis._bit_size_data_used = 1000
self.analysis.bit_recognition_size = 3
self.analysis._figure_out_analysis_data_size(k_sizes)
self.assertEqual(self.analysis._bit_size_data_limit, 8281000)

# forth test run
self.analysis._bit_size_data_limit = 10000
self.analysis._bit_size_data_used = 1000
self.analysis.bit_recognition_size = 30
self.analysis._figure_out_analysis_data_size(k_sizes)
self.assertEqual(self.analysis._bit_size_data_limit, 8281000)

# forth test run
self.analysis.verbose = False
self.analysis._bit_size_data_limit = 10000
self.analysis._bit_size_data_used = 1000
self.analysis.bit_recognition_size = 4
self.analysis._figure_out_analysis_data_size(k_sizes)
self.assertEqual(self.analysis._bit_size_data_limit, 8281000)

# restore of changed variables
self._bit_size_data_limit = 10000
self.analysis.bit_recognition_size = old_bit_recall_size
self.analysis._bit_size_data_used = None

self.assertEqual(self.analysis.output, "/tmp")

Expand Down
Loading

0 comments on commit 5bdd4e4

Please sign in to comment.