@@ -419,8 +419,9 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
419419 rc = wh_Server_CertAddTrusted (
420420 server , req .id , req .access , req .flags , req .label ,
421421 WH_NVM_LABEL_LEN , cert_data , req .cert_len );
422+
422423 (void )WH_SERVER_NVM_UNLOCK (server );
423- }
424+ } /* WH_SERVER_NVM_LOCK() */
424425 resp .rc = rc ;
425426
426427 /* Convert the response struct */
@@ -441,8 +442,9 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
441442 rc = WH_SERVER_NVM_LOCK (server );
442443 if (rc == WH_ERROR_OK ) {
443444 rc = wh_Server_CertEraseTrusted (server , req .id );
445+
444446 (void )WH_SERVER_NVM_UNLOCK (server );
445- }
447+ } /* WH_SERVER_NVM_LOCK() */
446448 resp .rc = rc ;
447449
448450 /* Convert the response struct */
@@ -488,8 +490,9 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
488490 resp .cert_len = cert_len ;
489491 }
490492 }
493+
491494 (void )WH_SERVER_NVM_UNLOCK (server );
492- }
495+ } /* WH_SERVER_NVM_LOCK() */
493496 resp .rc = rc ;
494497
495498 /* Convert the response struct */
@@ -529,8 +532,9 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
529532 /* Propagate the keyId back to the client with flags
530533 * preserved */
531534 resp .keyId = wh_KeyId_TranslateToClient (keyId );
535+
532536 (void )WH_SERVER_NVM_UNLOCK (server );
533- }
537+ } /* WH_SERVER_NVM_LOCK() */
534538 resp .rc = rc ;
535539 }
536540
@@ -570,7 +574,7 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
570574 WH_NVM_LABEL_LEN , cert_data , req .cert_len );
571575
572576 (void )WH_SERVER_NVM_UNLOCK (server );
573- } /* WH_SERVER_NVM_LOCK() == WH_ERROR_OK */
577+ } /* WH_SERVER_NVM_LOCK() */
574578 }
575579 if (resp .rc == WH_ERROR_OK ) {
576580 /* Post-process client address */
@@ -620,12 +624,12 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
620624 /* Clamp cert_len to actual stored length */
621625 cert_len = req .cert_len ;
622626 resp .rc = wh_Server_CertReadTrusted (
623- server , req .id , cert_data , & cert_len );
627+ server , req .id , cert_data , & cert_len );
624628 }
625629 }
626630
627631 (void )WH_SERVER_NVM_UNLOCK (server );
628- } /* WH_SERVER_NVM_LOCK() == WH_ERROR_OK */
632+ } /* WH_SERVER_NVM_LOCK() */
629633 }
630634 if (resp .rc == WH_ERROR_OK ) {
631635 /* Post-process client address */
@@ -677,7 +681,7 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
677681 resp .keyId = wh_KeyId_TranslateToClient (keyId );
678682
679683 (void )WH_SERVER_NVM_UNLOCK (server );
680- } /* WH_SERVER_NVM_LOCK() == WH_ERROR_OK */
684+ } /* WH_SERVER_NVM_LOCK() */
681685 }
682686 if (resp .rc == WH_ERROR_OK ) {
683687 /* Post-process client address */
@@ -712,7 +716,7 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
712716 req .trustedRootNvmId );
713717
714718 (void )WH_SERVER_NVM_UNLOCK (server );
715- } /* WH_SERVER_NVM_LOCK() == WH_ERROR_OK */
719+ } /* WH_SERVER_NVM_LOCK() */
716720
717721 /* Signature confirmation error is not an error for the server, so
718722 * propagate this error to the client in the response, otherwise
@@ -760,7 +764,7 @@ int wh_Server_HandleCertRequest(whServerContext* server, uint16_t magic,
760764 server , cert_data , req .cert_len , req .trustedRootNvmId );
761765
762766 (void )WH_SERVER_NVM_UNLOCK (server );
763- } /* WH_SERVER_NVM_LOCK() == WH_ERROR_OK */
767+ } /* WH_SERVER_NVM_LOCK() */
764768
765769 /* Signature confirmation error is not an error for the server,
766770 * so propagate this error to the client in the response,
0 commit comments