Seagate / TCGstorageAPI

API for TCG Storage operations on SAS and SATA Self-Encrypting Drives
Apache License 2.0
22 stars 16 forks source link

Core dump when passing in the wrong PSID (python3) #29

Closed simonpha closed 3 years ago

simonpha commented 3 years ago

Describe the bug When trying to run a PSID revert using the sample_cli.py program and passing in the incorrect PSID the program exits with a core dump from boost python.

To Reproduce Steps to reproduce the behavior:

  1. Built and ran in the provided docker container for CentOS7
  2. Run using the python3 sample_cli.py script
  3. Python script and CLI command that's being used: python3 sample_cli.py /dev/sda revert 030303
  4. Type of drive interface that's being used: SAS.
  5. Product type: Seagate drive

Expected behavior The program should return an error that the PSID was incorrect. Not core dump.

Screenshots

The program terminates and core dumps.

[root@892b0cc279ad samples]# python3 sample_cli.py /dev/sda revert 030303
Drive Certificate chain verified from drive to root
Drive signature verified successfully
Device identification successfull, drive being tested is a Seagate drive
terminate called after throwing an instance of 'boost::python::error_already_set'
Aborted (core dumped)

The sedcfg.log file shows that the appropriate Failed to authenticate as PSID error. But this isn't returned back to the program to exit gracefully

2020-11-20 19:41:03,971 sedcfg.log (MainThread) - TCG Send:
0000  00 00 00 00 07 FE 00 00 00 00 00 00 00 00 00 00 ................
0010  00 00 00 5C FF FF FE E9 00 00 00 67 00 00 00 02 ...\.......g....
0020  00 00 00 00 00 00 00 00 00 00 00 44 00 00 00 00 ...........D....
0030  00 00 00 00 00 00 00 37 F8 A8 00 00 00 00 00 00 .......7........
0040  00 01 A8 00 00 00 06 00 00 00 0C F0 A8 00 00 00 ................
0050  09 00 01 FF 01 F2 A9 43 68 61 6C 6C 65 6E 67 65 .......Challenge
0060  A6 30 33 30 33 30 33 F3 F1 F9 F0 00 00 00 F1 00 .030303.........
0070  00 00 00 00 00 00 00 00 00 00 00 00             ............    

2020-11-20 19:41:04,017 sedcfg.log (MainThread) - TCG Receive:
0000  00 00 00 00 07 FE 00 00 00 00 00 00 00 00 00 00 ................
0010  00 00 00 30 FF FF FE E9 00 00 00 67 00 00 00 01 ...0.......g....
0020  00 00 00 00 00 00 00 00 00 00 00 18 00 00 00 00 ................
0030  00 00 00 00 00 00 00 09 F0 00 F1 F9 F0 00 00 00 ................
0040  F1 00 00 00                                     ....            

2020-11-20 19:41:04,018 sedcfg.log (MainThread) - Failed to authenticate as PSID

Desktop (please complete the following information):

Additional context This is happening on the python3 code. This does not happen on the python2.7 code, so the change to python3 seems to be the issue here.