Encrypt data and call dumper. */
| 1416 | |
| 1417 | /* Encrypt data and call dumper. */ |
| 1418 | static int |
| 1419 | dump_encrypted_write(struct dumperinfo *di, void *virtual, |
| 1420 | vm_offset_t physical, off_t offset, size_t length) |
| 1421 | { |
| 1422 | static uint8_t buf[KERNELDUMP_BUFFER_SIZE]; |
| 1423 | struct kerneldumpcrypto *kdc; |
| 1424 | int error; |
| 1425 | size_t nbytes; |
| 1426 | |
| 1427 | kdc = di->kdcrypto; |
| 1428 | |
| 1429 | while (length > 0) { |
| 1430 | nbytes = MIN(length, sizeof(buf)); |
| 1431 | bcopy(virtual, buf, nbytes); |
| 1432 | |
| 1433 | if (dump_encrypt(kdc, buf, nbytes) != 0) |
| 1434 | return (EIO); |
| 1435 | |
| 1436 | error = dump_write(di, buf, physical, offset, nbytes); |
| 1437 | if (error != 0) |
| 1438 | return (error); |
| 1439 | |
| 1440 | offset += nbytes; |
| 1441 | virtual = (void *)((uint8_t *)virtual + nbytes); |
| 1442 | length -= nbytes; |
| 1443 | } |
| 1444 | |
| 1445 | return (0); |
| 1446 | } |
| 1447 | #endif /* EKCD */ |
| 1448 | |
| 1449 | static int |
no test coverage detected