1) Download the files and directories for this lab to your laptop. COPY YOUR AT_Master_TDC.db and NAT_Master_TDC.db INTO THIS DIRECTORY (from the previous lab) NOTE: For ubuntu users. Be sure sqlite is installed on your laptop. You should have done this in the previous lab where you run device authentication only. apt install sqlite3 apt install libsqlite3-dev You must have openssl version 1.1.1 installed too. On my ubuntu machine, it is there by default. Check the version, type openssl version This should return OpenSSL 1.1.1 2) Edit the Makefile and change the path to where you installed Vivado. For CORA, you will need to use a version of Vivado 2017.x, otherwise you will get an error 'GLIBC_2.28' not found. Run the command make 3) PROGRAM THE ZYBO OR CORA BOARD WITH ONE OF THE BITSTREAMS (ZYBO use 'echo' command, CORA use Hardware Manager in Vivado). 4) Copy the following files to your Zybo/Cora board scp device_regeneration.elf root@192.168.1.10: scp Challenges.db root@192.168.1.10: ZYBO: scp ZYBO_LIBS/libsqlite3.so.0.8.6 root@192.168.1.10:/lib CORA: scp CORA_LIBS/libsqlite3.so.0.8.6 root@192.168.1.10:/lib BOTH ZYBO AND CORA scp ARM_LIBS/libcrypto.so.1.1 root@192.168.1.10:/lib scp ARM_LIBS/libssl.so.1.1 root@192.168.1.10:/lib 5) After copying the libsqlite3.so.0.8.6, do the following on your Cora or Zybo boards cd /lib ln -s libsqlite3.so.0.8.6 libsqlite3.so.0 ln -s libsqlite3.so.0.8.6 libsqlite3.so ln -s libcrypto.so.1.1 libcrypto.so ln -s libssl.so.1.1 libssl.so cd 6) YOU MUST PROGRAM THE BOARD BEFORE RUNNING THESE COMMANDS ZYBO: Program with each of these, one-at-a-time, using the 'echo' command and run authentication CORA: Program with each of these, one-at-a-time, from Vivado/Hardware Manager and run authentication echo SR_RFM_V4_TDC_Macro_P1.bit.bin > /sys/class/fpga_manager/fpga0/firmware echo SR_RFM_V4_TDC_Macro_P2.bit.bin > /sys/class/fpga_manager/fpga0/firmware echo SR_RFM_V4_TDC_Macro_P3.bit.bin > /sys/class/fpga_manager/fpga0/firmware echo SR_RFM_V4_TDC_Macro_P4.bit.bin > /sys/class/fpga_manager/fpga0/firmware 7) Run this on your laptop FIRST -- wait for it to get to 'waiting for connections ...', change the IP as needed verifier_regeneration Master_TDC SR_RFM_V4_TDC SRFSyn1 192.168.1.20 Master1_OptKEK_TVN_0.00_WID_1.75 Wait for it to finish, i.e. to print 'Waiting for connections ...' 8) Run this on your Cora/Zybo, change the IP as needed ./device_regeneration.elf Jim 192.168.1.10 192.168.1.20 9) If successful, you will see something like the following: ON YOUR LAPTOP: ITERATION 0 Date: 2023-03-26 19:08:17.509.027 192.168.1.10 SD and Client_IP returned by OpenMultipleSocketServer 5 and 192.168.1.10 Client index 0 Client socket 5 IterationCnt 0! Tasking Thread 0 CLIENT-SERVER-KEYGEN-AUTHENTICATION: BankThread(): Request from socket 5 at index 0! IterationCnt 0 ******************* DEVICE SKE MODE AUTHENTICATION BEGINS ******************* GenVecSeedChlngsTimingData(): Number of vectors read 256 Number of rising vectors 107 Elapsed: Time to get PNs: 12679 us SKE SUCCESSFUL AUTHENTICATION: Chip 3 ID Instance Name: Z_Jim_64 Device Name: ZYBO Placement Name: P4! *** DA SUCCESS *** Elapsed: DEVICE FSB AUTHENTICATION 2715224 us ******************* VERIFIER AUTHENTICATION BEGINS ******************* GenVecSeedChlngsTimingData(): Number of vectors read 255 Number of rising vectors 106 Elapsed: Time to get PNs: 7968 us KEK_VerifierAuthentication PASSED for chip 3 Elapsed: VERIFIER AUTHENTICATION 1350410 us ******************* SESSION KEY GEN BEGINS ******************* GenVecSeedChlngsTimingData(): Number of vectors read 250 Number of rising vectors 106 Elapsed: Time to get PNs: 9752 us MINORITY BIT FLIP SUMMARY: Num minority bit flips 0! MINORITY BIT FLIP SUMMARY: Num minority bit flips 0! SESSION KEY GENERATION PASSED for chip 3 Elapsed: SESSION ENCRYPTION 1368046 us Elapsed: For 'CLIENT-SERVER-KEYGEN' 5433873 us IterationCnt 0 ON YOUR FPGA: Parameters: This Device IP 192.168.1.10 Bank IP 192.168.1.20 FIX PARAMS 0 Num Sams 4 PCR/PBD/PO 0 PARAMETERS: PCR/PBD 0 SE Target Num Bits 256 Reading filesystem database 'Challenges.db' into memory! AUTHENTICATION NUMBER 0 ******************* TRNG INTERNAL BEGINS ******************* ******************* TRNG INTERNAL BEGINS ******************* TOTAL EXEC TIME 400384 us ******************* DEVICE SKE MODE AUTHENTICATION BEGINS ******************* Number of vectors received 252 Number of rising vectors 104 Has masks ? 1 Num nonce bits 256 Number of iterations 12 Server SUCCEEDED to authenticate device Chip Num received 3! Elapsed: DEVICE AUTHENTICATION 2241639 us ******************* VERIFIER AUTHENTICATION BEGINS ******************* Number of vectors received 258 Number of rising vectors 107 Has masks ? 1 MATCHED*** Total bits mismatched 0 From total 256 Remaining 0 Total 0 Elapsed: VERIFIER AUTHENTICATION 1276045 us ************************ SESSION KEY GEN BEGINS ****************************** ******************* KEK BEGINS: ENROLL ******************* Number of vectors received 255 Number of rising vectors 107 Has masks ? 1 Target attempt 0 Mode 0 XMR 5 LFSR low 751 LFSR high 1145 RC 180 SC 20 TH 3 TCC 329 Target attempt 1 Mode 0 XMR 5 LFSR low 751 LFSR high 1146 RC 180 SC 20 TH 3 TCC 327 ENROLL: FINAL KEK KEY: Requested Bits 256 Actual number of Bits 327 39 9E 7D 1E 97 55 E4 32 83 52 04 C1 20 6E A2 17 40 DD 6E 15 54 EE 09 7C 1A E3 6C 2F D0 44 06 E KEK_Enroll(): Total number of iterations 2 ******************* SESSION ENCRYPTION RESULTS ******************* SE SUCCESS: Decrypted text matches 'HELLO WORLD!' ************* Elapsed: SESSION KEY GEN 1414343 us