File tree Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Expand file tree Collapse file tree 3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -36,9 +36,7 @@ void mbedtls_sha256_init(__unused mbedtls_sha256_context *ctx) {
3636}
3737
3838void  mbedtls_sha256_free (__unused  mbedtls_sha256_context  * ctx ) {
39-     if  (ctx -> locked ) {
40-         pico_sha256_unlock (ctx );
41-     }
39+     pico_sha256_cleanup (ctx );
4240}
4341
4442int  mbedtls_sha256_starts_ret (mbedtls_sha256_context  * ctx , int  is224 ) {
Original file line number Diff line number Diff line change @@ -58,15 +58,15 @@ typedef struct pico_sha256_state {
5858    size_t  total_data_size ;
5959} pico_sha256_state_t ;
6060
61- /*! \brief Release the internal lock on the SHA256  hardware 
61+ /*! \brief Release the internal lock on the SHA-256  hardware 
6262 *  \ingroup pico_sha256 
6363 * 
64-  * Release the internal lock on the hardware. 
64+  * Release the internal lock on the SHA-256  hardware. 
6565 * Fails if the internal lock was not claimed. 
6666 * 
6767 * @param state A pointer to a pico_sha256_state_t instance 
6868 */ 
69- void  __weak   pico_sha256_unlock (pico_sha256_state_t  * state );
69+ void  pico_sha256_cleanup (pico_sha256_state_t  * state );
7070
7171/*! \brief Start a SHA-256 calculation returning immediately with an error if the SHA-256 hardware is not available 
7272 *  \ingroup pico_sha256 
Original file line number Diff line number Diff line change @@ -30,6 +30,12 @@ void __weak pico_sha256_unlock(pico_sha256_state_t *state) {
3030    state -> locked  =  false;
3131}
3232
33+ void  pico_sha256_cleanup (pico_sha256_state_t  * state ) {
34+     if  (state -> locked ) {
35+         pico_sha256_unlock (state );
36+     }
37+ }
38+ 
3339int  pico_sha256_try_start (pico_sha256_state_t  * state , enum  sha256_endianness  endianness , bool  use_dma ) {
3440    memset (state , 0 , sizeof (* state ));
3541    if  (!pico_sha256_lock (state )) return  PICO_ERROR_RESOURCE_IN_USE ;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments