mirror of
				https://github.com/cuberite/polarssl.git
				synced 2025-11-03 20:22:59 -05:00 
			
		
		
		
	Update guards for ALG_SHA_224 and ALG_SHA_384 in crypto library
The previous revision of guards around SHA_224 and SHA_384 were not correct. This set of changes ensures the proper code is available when SHA_224 and SHA_384 are enabled for use. Signed-off-by: John Durkop <john.durkop@fermatsoftware.com>
This commit is contained in:
		
							parent
							
								
									d62b678473
								
							
						
					
					
						commit
						6ca2327150
					
				@ -2546,16 +2546,22 @@ psa_status_t psa_hash_abort( psa_hash_operation_t *operation )
 | 
			
		||||
            mbedtls_sha1_free( &operation->ctx.sha1 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
        case PSA_ALG_SHA_224:
 | 
			
		||||
            mbedtls_sha256_free( &operation->ctx.sha256 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
 | 
			
		||||
        case PSA_ALG_SHA_256:
 | 
			
		||||
            mbedtls_sha256_free( &operation->ctx.sha256 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
        case PSA_ALG_SHA_384:
 | 
			
		||||
            mbedtls_sha512_free( &operation->ctx.sha512 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
 | 
			
		||||
        case PSA_ALG_SHA_512:
 | 
			
		||||
            mbedtls_sha512_free( &operation->ctx.sha512 );
 | 
			
		||||
            break;
 | 
			
		||||
@ -2689,17 +2695,25 @@ psa_status_t psa_hash_update( psa_hash_operation_t *operation,
 | 
			
		||||
                                           input, input_length );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
        case PSA_ALG_SHA_224:
 | 
			
		||||
            ret = mbedtls_sha256_update_ret( &operation->ctx.sha256,
 | 
			
		||||
                                             input, input_length );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
 | 
			
		||||
        case PSA_ALG_SHA_256:
 | 
			
		||||
            ret = mbedtls_sha256_update_ret( &operation->ctx.sha256,
 | 
			
		||||
                                             input, input_length );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
        case PSA_ALG_SHA_384:
 | 
			
		||||
            ret = mbedtls_sha512_update_ret( &operation->ctx.sha512,
 | 
			
		||||
                                             input, input_length );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
 | 
			
		||||
        case PSA_ALG_SHA_512:
 | 
			
		||||
            ret = mbedtls_sha512_update_ret( &operation->ctx.sha512,
 | 
			
		||||
                                             input, input_length );
 | 
			
		||||
@ -2766,16 +2780,22 @@ psa_status_t psa_hash_finish( psa_hash_operation_t *operation,
 | 
			
		||||
            ret = mbedtls_sha1_finish_ret( &operation->ctx.sha1, hash );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
        case PSA_ALG_SHA_224:
 | 
			
		||||
            ret = mbedtls_sha256_finish_ret( &operation->ctx.sha256, hash );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
 | 
			
		||||
        case PSA_ALG_SHA_256:
 | 
			
		||||
            ret = mbedtls_sha256_finish_ret( &operation->ctx.sha256, hash );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
        case PSA_ALG_SHA_384:
 | 
			
		||||
            ret = mbedtls_sha512_finish_ret( &operation->ctx.sha512, hash );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
 | 
			
		||||
        case PSA_ALG_SHA_512:
 | 
			
		||||
            ret = mbedtls_sha512_finish_ret( &operation->ctx.sha512, hash );
 | 
			
		||||
            break;
 | 
			
		||||
@ -2908,17 +2928,25 @@ psa_status_t psa_hash_clone( const psa_hash_operation_t *source_operation,
 | 
			
		||||
                                &source_operation->ctx.sha1 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_224)
 | 
			
		||||
        case PSA_ALG_SHA_224:
 | 
			
		||||
            mbedtls_sha256_clone( &target_operation->ctx.sha256,
 | 
			
		||||
                                  &source_operation->ctx.sha256 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_256)
 | 
			
		||||
        case PSA_ALG_SHA_256:
 | 
			
		||||
            mbedtls_sha256_clone( &target_operation->ctx.sha256,
 | 
			
		||||
                                  &source_operation->ctx.sha256 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512) || \
 | 
			
		||||
    defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_384)
 | 
			
		||||
        case PSA_ALG_SHA_384:
 | 
			
		||||
            mbedtls_sha512_clone( &target_operation->ctx.sha512,
 | 
			
		||||
                                  &source_operation->ctx.sha512 );
 | 
			
		||||
            break;
 | 
			
		||||
#endif
 | 
			
		||||
#if defined(MBEDTLS_PSA_BUILTIN_ALG_SHA_512)
 | 
			
		||||
        case PSA_ALG_SHA_512:
 | 
			
		||||
            mbedtls_sha512_clone( &target_operation->ctx.sha512,
 | 
			
		||||
                                  &source_operation->ctx.sha512 );
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user