DMTF / spdm-emu

BSD 3-Clause "New" or "Revised" License
31 stars 42 forks source link

Error message: read_responder_root_public_certificate fail! #279

Closed yongchen65 closed 1 year ago

yongchen65 commented 1 year ago

I am trying to launch the requester and responder in separate windows. The request is hitting an issue saying “read_responder_root_public_certificate fail!” (see the log below).
Could you please shed some light on what might have caused the issue and possible solution? Does the issue have something to do with these errors highlighted in blue?

//--------------- Requester log ---------------------- [root]# ./bin/spdm_requester_emu --trans PCI_DOE spdm_requester_emu version 0.1 trans - 0x2 connect success! Platform port Transmit command: 00 00 de ad Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0e Platform port Transmit buffer: 43 6c 69 65 6e 74 20 48 65 6c 6c 6f 21 00 Platform port Receive command: 00 00 de ad Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0e Platform port Receive buffer: 53 65 72 76 65 72 20 48 65 6c 6c 6f 21 00 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 00 00 03 00 00 00 00 00 00 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 00 00 03 00 00 00 01 00 00 01 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 00 00 03 00 00 00 01 00 00 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 00 00 03 00 00 00 01 00 01 02 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 00 00 03 00 00 00 02 00 00 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 00 00 03 00 00 00 01 00 02 00 DOE(0x0) VendorId-0x0001, DataObjectType-0x00 DOE(0x1) VendorId-0x0001, DataObjectType-0x01 DOE(0x2) VendorId-0x0001, DataObjectType-0x02 context_size - 0x2458 libspdm_send_spdm_request[0] msg SPDM_GET_VERSION(0x84), size (0x4): 0000: 10 84 00 00 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 01 00 03 00 00 00 10 84 00 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 14 Platform port Receive buffer: 01 00 01 00 05 00 00 00 10 04 00 00 00 03 00 10 00 11 00 12 libspdm_receive_spdm_response[0] msg SPDM_VERSION(0x4), size (0xc): 0000: 10 04 00 00 00 03 00 10 00 11 00 12 libspdm_send_spdm_request[0] msg SPDM_GET_CAPABILITIES(0xe1), size (0x14): 0000: 12 e1 00 00 00 00 00 00 c6 f7 02 00 00 12 00 00 00 12 00 00 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 1c Platform port Transmit buffer: 01 00 01 00 07 00 00 00 12 e1 00 00 00 00 00 00 c6 f7 02 00 00 12 00 00 00 12 00 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 1c Platform port Receive buffer: 01 00 01 00 07 00 00 00 12 61 00 00 00 00 00 00 f7 fb 1a 00 00 12 00 00 00 12 00 00 libspdm_receive_spdm_response[0] msg SPDM_CAPABILITIES(0x61), size (0x14): 0000: 12 61 00 00 00 00 00 00 f7 fb 1a 00 00 12 00 00 00 12 00 00 libspdm_send_spdm_request[0] msg SPDM_NEGOTIATE_ALGORITHMS(0xe3), size (0x30): 0000: 12 e3 04 00 30 00 01 02 90 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 02 20 1b 00 03 20 06 00 04 20 0f 00 05 20 01 00 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 38 Platform port Transmit buffer: 01 00 01 00 0e 00 00 00 12 e3 04 00 30 00 01 02 90 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 20 1b 00 03 20 06 00 04 20 0f 00 05 20 01 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 3c Platform port Receive buffer: 01 00 01 00 0f 00 00 00 12 63 04 00 34 00 01 02 08 00 00 00 80 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 20 10 00 03 20 02 00 04 20 08 00 05 20 01 00 libspdm_receive_spdm_response[0] msg SPDM_ALGORITHMS(0x63), size (0x34): 0000: 12 63 04 00 34 00 01 02 08 00 00 00 80 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 00 00 00 00 02 20 10 00 03 20 02 00 04 20 08 00 05 20 01 00 Unable to open file ecp384/ca.cert.der read_responder_root_public_certificate fail! Platform port Transmit command: 00 00 ff fe Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 00 Platform port Transmit buffer:

Platform port Receive command: 00 00 ff fe Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 00 Client stopped

//--------------- Responder log ---------------------- [root]# ./bin/spdm_responder_emu --trans PCI_DOE spdm_responder_emu version 0.1 trans - 0x2 context_size - 0x2458 Platform server listening on port 2323 Platform port Receive command: 00 00 de ad Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0e Platform port Receive buffer: 43 6c 69 65 6e 74 20 48 65 6c 6c 6f 21 00 Platform port Transmit command: 00 00 de ad Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0e Platform port Transmit buffer: 53 65 72 76 65 72 20 48 65 6c 6c 6f 21 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 00 00 03 00 00 00 00 00 00 00 SpdmReceiveRequest[.] ... transport_decode_message - 0x80010002 transport_decode_message : 0x80010002 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 00 00 03 00 00 00 01 00 00 01 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 00 00 03 00 00 00 01 00 00 00 SpdmReceiveRequest[.] ... transport_decode_message - 0x80010002 transport_decode_message : 0x80010002 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 00 00 03 00 00 00 01 00 01 02 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 00 00 03 00 00 00 02 00 00 00 SpdmReceiveRequest[.] ... transport_decode_message - 0x80010002 transport_decode_message : 0x80010002 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 0c Platform port Transmit buffer: 01 00 00 00 03 00 00 00 01 00 02 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 0c Platform port Receive buffer: 01 00 01 00 03 00 00 00 10 84 00 00 SpdmReceiveRequest[.] ... SpdmReceiveRequest[0] msg SPDM_GET_VERSION(0x84), size (0x4): 0000: 10 84 00 00 SpdmSendResponse[0] ... SpdmSendResponse[0]: msg SPDM_VERSION(0x4), size (0xc): 0000: 10 04 00 00 00 03 00 10 00 11 00 12 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 14 Platform port Transmit buffer: 01 00 01 00 05 00 00 00 10 04 00 00 00 03 00 10 00 11 00 12 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 1c Platform port Receive buffer: 01 00 01 00 07 00 00 00 12 e1 00 00 00 00 00 00 c6 f7 02 00 00 12 00 00 00 12 00 00 SpdmReceiveRequest[.] ... SpdmReceiveRequest[0] msg SPDM_GET_CAPABILITIES(0xe1), size (0x14): 0000: 12 e1 00 00 00 00 00 00 c6 f7 02 00 00 12 00 00 00 12 00 00 SpdmSendResponse[0] ... SpdmSendResponse[0]: msg SPDM_CAPABILITIES(0x61), size (0x14): 0000: 12 61 00 00 00 00 00 00 f7 fb 1a 00 00 12 00 00 00 12 00 00 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 1c Platform port Transmit buffer: 01 00 01 00 07 00 00 00 12 61 00 00 00 00 00 00 f7 fb 1a 00 00 12 00 00 00 12 00 00 Platform port Receive command: 00 00 00 01 Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 38 Platform port Receive buffer: 01 00 01 00 0e 00 00 00 12 e3 04 00 30 00 01 02 90 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 20 1b 00 03 20 06 00 04 20 0f 00 05 20 01 00 SpdmReceiveRequest[.] ... SpdmReceiveRequest[0] msg SPDM_NEGOTIATE_ALGORITHMS(0xe3), size (0x30): 0000: 12 e3 04 00 30 00 01 02 90 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 02 20 1b 00 03 20 06 00 04 20 0f 00 05 20 01 00 SpdmSendResponse[0] ... Unable to open file ecp384/bundle_responder.certchain.der Unable to open file ecp384/bundle_responder.certchain1.der Unable to open file rsa3072/ca.cert.der SpdmSendResponse[0]: msg SPDM_ALGORITHMS(0x63), size (0x34): 0000: 12 63 04 00 34 00 01 02 08 00 00 00 80 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0020: 00 00 00 00 02 20 10 00 03 20 02 00 04 20 08 00 05 20 01 00 Platform port Transmit command: 00 00 00 01 Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 3c Platform port Transmit buffer: 01 00 01 00 0f 00 00 00 12 63 04 00 34 00 01 02 08 00 00 00 80 00 00 00 02 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 02 20 10 00 03 20 02 00 04 20 08 00 05 20 01 00 Platform port Receive command: 00 00 ff fe Platform port Receive transport_type: 00 00 00 02 Platform port Receive size: 00 00 00 00 Platform port Transmit command: 00 00 ff fe Platform port Transmit transport_type: 00 00 00 02 Platform port Transmit size: 00 00 00 00 Platform port Transmit buffer:

Server stopped

yongchen65 commented 1 year ago

@jyao1 Here is the output of spdm_dump

[root]# ./bin/spdm_dump -r ../../spdm-emu/build/SpdmRequester.pcap spdm_dump version 0.1 PcapFile: Magic - 'a1b2c3d4', version2.4, DataLink - 292 (PCI_DOE), MaxPacketSize - 65536 1 (1689716163) PCI_DOE(1, 0) 2 (1689716163) PCI_DOE(1, 0) 3 (1689716163) PCI_DOE(1, 0) 4 (1689716163) PCI_DOE(1, 0) 5 (1689716163) PCI_DOE(1, 0) 6 (1689716163) PCI_DOE(1, 0) 7 (1689716163) PCI_DOE(1, 1) REQ->RSP SPDM(10, 0x84) SPDM_GET_VERSION () 8 (1689716163) PCI_DOE(1, 1) RSP->REQ SPDM(10, 0x04) SPDM_VERSION (1.0.0.0, 1.1.0.0, 1.2.0.0) 9 (1689716163) PCI_DOE(1, 1) REQ->RSP SPDM(12, 0xe1) SPDM_GET_CAPABILITIES (Flags=0x0002f7c6, CTExponent=0x00, DataTransSize=0x00001200, MaxSpdmMsgSize=0x00001200) 10 (1689716163) PCI_DOE(1, 1) RSP->REQ SPDM(12, 0x61) SPDM_CAPABILITIES (Flags=0x001afbf7, CTExponent=0x00, DataTransSize=0x00001200, MaxSpdmMsgSize=0x00001200) 11 (1689716163) PCI_DOE(1, 1) REQ->RSP SPDM(12, 0xe3) SPDM_NEGOTIATE_ALGORITHMS (MeasSpec=0x01(DMTF), OtherParam=0x02(OPAQUE_FMT_1), Hash=0x00000003(SHA_256,SHA_384), Asym=0x00000090(ECDSA_P256,ECDSA_P384), DHE=0x001b(FFDHE_2048,FFDHE_3072,SECP_256_R1,SECP_384_R1), AEAD=0x0006(AES_256_GCM,CHACHA20_POLY1305), ReqAsym=0x000f(RSASSA_2048,RSASSA_3072,RSAPSS_2048,RSAPSS_3072), KeySchedule=0x0001(HMAC_HASH)) 12 (1689716163) PCI_DOE(1, 1) RSP->REQ SPDM(12, 0x63) SPDM_ALGORITHMS (MeasSpec=0x01(DMTF), OtherParam=0x02(OPAQUE_FMT_1), Hash=0x00000002(SHA_384), MeasHash=0x00000008(SHA_512), Asym=0x00000080(ECDSA_P384), DHE=0x0010(SECP_384_R1), AEAD=0x0002(AES_256_GCM), ReqAsym=0x0008(RSAPSS_3072), KeySchedule=0x0001(HMAC_HASH))

jyao1 commented 1 year ago

are you following the step by step in readme?

cd spdm_emu
mkdir build
cd build
cmake -G"NMake Makefiles" -DARCH=<x64|ia32> -DTOOLCHAIN=<toolchain> -DTARGET=<Debug|Release> -DCRYPTO=<mbedtls|openssl> ..
nmake copy_sample_key
nmake

Then "The spdm_emu output is at spdm_emu/build/bin. Open one command prompt at output dir to run spdm_responder_emu and another command prompt to run spdm_requester_emu." ?

yongchen65 commented 1 year ago

Yes, I did follow the steps in readme.

Here is the list of command I used to generate the binary (In Linux env):

Then I ran the following two commands from two consoles: ./bin/spdm_responder_emu --trans PCI_DOE ./bin/spdm_requester_emu --pcap SpdmRequester.pcap --trans PCI_DOE

steven-bellock commented 1 year ago

Maybe it's a permissions issue on your system? Some anti-virus software may not like .der files.

jyao1 commented 1 year ago

You need "Open one command prompt at output dir to run spdm_responder_emu and another command prompt to run spdm_requester_emu"

Please

cd bin
spdm_responder_emu --trans PCI_DOE

and

cd bin
spdm_requester_emu --pcap SpdmRequester.pcap --trans PCI_DOE
yongchen65 commented 1 year ago

I missed this part "Open one command prompt at output dir" from readme. Running spdm_responder_emu and spdm_requester_emu from the output dir does solve the issue.

Thanks so much!