mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			Fixing trng_get_bytes return status
							parent
							
								
									789eb04617
								
							
						
					
					
						commit
						1cb43fa020
					
				| 
						 | 
				
			
			@ -49,7 +49,6 @@ int inject_dummy_rot_key()
 | 
			
		|||
#if !defined(DEVICE_TRNG)
 | 
			
		||||
    uint32_t key[DEVICE_KEY_16BYTE / sizeof(uint32_t)];
 | 
			
		||||
 | 
			
		||||
    memset(key, 0, DEVICE_KEY_16BYTE);
 | 
			
		||||
    memcpy(key, "1234567812345678", DEVICE_KEY_16BYTE);
 | 
			
		||||
    int size = DEVICE_KEY_16BYTE;
 | 
			
		||||
    DeviceKey& devkey = DeviceKey::get_instance();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -253,12 +253,12 @@ int DeviceKey::generate_key_by_trng(uint32_t *output, size_t& size)
 | 
			
		|||
 | 
			
		||||
    final_size = 0;
 | 
			
		||||
    in_size = size;
 | 
			
		||||
    while (DEVICEKEY_SUCCESS == ret && final_size < size) {
 | 
			
		||||
    while (final_size < size) {
 | 
			
		||||
 | 
			
		||||
        ongoing_size = 0;
 | 
			
		||||
        ret = trng_get_bytes(&trng_obj, (unsigned char *)pBuffer, in_size, &ongoing_size);
 | 
			
		||||
        final_size += ongoing_size;
 | 
			
		||||
        if (DEVICEKEY_SUCCESS != ret) {
 | 
			
		||||
        if (0 != ret) {
 | 
			
		||||
            ret = DEVICEKEY_TRNG_ERROR;
 | 
			
		||||
            goto finish;
 | 
			
		||||
        }
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue