mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			reopening #9754 after the changes where overrun
changing the SPM error codes from invalid argument to bad state aligned to PSA specpull/9829/head
							parent
							
								
									5f38878f3a
								
							
						
					
					
						commit
						b5b0e981f8
					
				| 
						 | 
				
			
			@ -129,7 +129,7 @@ psa_status_t psa_mac_update(psa_mac_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err = psa_call(operation->handle, in_vec, 2, NULL, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -153,7 +153,7 @@ psa_status_t psa_mac_sign_finish(psa_mac_operation_t *operation,
 | 
			
		|||
    psa_outvec out_vec[2] = { { mac, mac_size }, { mac_length, sizeof(*mac_length) } };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(operation->handle, in_vec, 2, out_vec, 2);
 | 
			
		||||
| 
						 | 
				
			
			@ -178,7 +178,7 @@ psa_status_t psa_mac_verify_finish(psa_mac_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(operation->handle, in_vec, 3, NULL, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -248,7 +248,7 @@ psa_status_t psa_hash_update(psa_hash_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err = psa_call(operation->handle, in_vec, 2, NULL, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -274,7 +274,7 @@ psa_status_t psa_hash_finish(psa_hash_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(operation->handle, in_vec, 2, out_vec, 2);
 | 
			
		||||
| 
						 | 
				
			
			@ -299,7 +299,7 @@ psa_status_t psa_hash_verify(psa_hash_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(operation->handle, in_vec, 3, NULL, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1103,7 +1103,7 @@ psa_status_t psa_get_generator_capacity(const psa_crypto_generator_t *generator,
 | 
			
		|||
    psa_outvec out_vec = { capacity, sizeof(*capacity) };
 | 
			
		||||
 | 
			
		||||
    if (generator->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(generator->handle, &in_vec, 1, &out_vec, 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -1122,7 +1122,7 @@ psa_status_t psa_generator_read(psa_crypto_generator_t *generator,
 | 
			
		|||
    psa_outvec out_vec = { output, output_length };
 | 
			
		||||
 | 
			
		||||
    if (generator->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(generator->handle, &in_vec, 1, &out_vec, 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -1145,7 +1145,7 @@ psa_status_t psa_generator_import_key(psa_key_handle_t key_handle,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (generator->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(generator->handle, in_vec, 3, NULL, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1306,7 +1306,7 @@ psa_status_t psa_cipher_generate_iv(psa_cipher_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err = psa_call(operation->handle, &in_vec, 1, out_vec, 2);
 | 
			
		||||
| 
						 | 
				
			
			@ -1332,7 +1332,7 @@ psa_status_t psa_cipher_set_iv(psa_cipher_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err = psa_call(operation->handle, in_vec, 2, NULL, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -1370,7 +1370,7 @@ psa_status_t psa_cipher_update(psa_cipher_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err = psa_call(operation->handle, in_vec, 2, out_vec, 2);
 | 
			
		||||
| 
						 | 
				
			
			@ -1403,7 +1403,7 @@ psa_status_t psa_cipher_finish(psa_cipher_operation_t *operation,
 | 
			
		|||
    };
 | 
			
		||||
 | 
			
		||||
    if (operation->handle <= 0) {
 | 
			
		||||
        return (PSA_ERROR_INVALID_ARGUMENT);
 | 
			
		||||
        return (PSA_ERROR_BAD_STATE);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    err_call = psa_call(operation->handle, &in_vec, 1, out_vec, 2);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue