@@ -677,6 +677,7 @@ static int TPM2_PCRs_Print(void)
677677 GetCapability_In capIn ;
678678 GetCapability_Out capOut ;
679679 TPML_PCR_SELECTION * pcrSel ;
680+ char buffer [24 ];
680681
681682 /* List available PCR's */
682683 XMEMSET (& capIn , 0 , sizeof (capIn ));
@@ -686,9 +687,11 @@ static int TPM2_PCRs_Print(void)
686687 rc = wolfBoot_tpm2_get_capability (& capIn , & capOut );
687688 if (rc == TPM_RC_SUCCESS ) {
688689 pcrSel = & capOut .capabilityData .data .assignedPCR ;
689- printf ("Assigned PCR's:\n" );
690+ printf ("Assigned PCR's:\r\ n" );
690691 for (pcrCount = 0 ; pcrCount < (int )pcrSel -> count ; pcrCount ++ ) {
691- printf ("\t%s: " , wolfBoot_tpm2_get_alg_name (pcrSel -> pcrSelections [pcrCount ].hash ));
692+
693+ printf ("\t%s: " , wolfBoot_tpm2_get_alg_name (
694+ pcrSel -> pcrSelections [pcrCount ].hash , buffer , sizeof (buffer )));
692695 for (pcrIndex = 0 ;
693696 pcrIndex < pcrSel -> pcrSelections [pcrCount ].sizeofSelect * 8 ;
694697 pcrIndex ++ ) {
@@ -697,7 +700,7 @@ static int TPM2_PCRs_Print(void)
697700 printf (" %d" , pcrIndex );
698701 }
699702 }
700- printf ("\n" );
703+ printf ("\r\ n" );
701704 }
702705 }
703706 return rc ;
@@ -708,13 +711,14 @@ static int cmd_tpm_info(const char *args)
708711 int rc ;
709712 WOLFTPM2_CAPS caps ;
710713 TPML_HANDLE handles ;
714+ char error [100 ];
711715
712- printf ("Get TPM 2.0 module information\n" );
716+ printf ("Get TPM 2.0 module information\r\ n" );
713717
714718 rc = wolfBoot_tpm2_caps (& caps );
715719 if (rc == 0 ) {
716720 printf ("Mfg %s (%d), Vendor %s, Fw %u.%u (0x%x), "
717- "FIPS 140-2 %d, CC-EAL4 %d\n" ,
721+ "FIPS 140-2 %d, CC-EAL4 %d\r\ n" ,
718722 caps .mfgStr , caps .mfg , caps .vendorStr , caps .fwVerMajor ,
719723 caps .fwVerMinor , caps .fwVerVendor , caps .fips140_2 , caps .cc_eal4 );
720724 }
@@ -723,16 +727,17 @@ static int cmd_tpm_info(const char *args)
723727 rc = wolfBoot_tpm2_get_handles (PERSISTENT_FIRST , & handles );
724728 if (rc >= 0 ) {
725729 int i ;
726- printf ("Found %d persistent handles\n" , rc );
730+ printf ("Found %d persistent handles\r\ n" , rc );
727731 for (i = 0 ; i < (int )handles .count ; i ++ ) {
728- printf ("\tHandle 0x%x\n" , (unsigned int )handles .handle [i ]);
732+ printf ("\tHandle 0x%x\r\ n" , (unsigned int )handles .handle [i ]);
729733 }
730734 }
731735
732736 /* Print the available PCR's */
733737 rc = TPM2_PCRs_Print ();
734738 if (rc != 0 ) {
735- printf ("TPM error 0x%x: %s\n" , rc , wolfBoot_tpm2_get_rc_string (rc ));
739+ printf ("TPM error 0x%x: %s\r\n" ,
740+ rc , wolfBoot_tpm2_get_rc_string (rc , error , sizeof (error )));
736741 }
737742
738743 return rc ;
0 commit comments