From cf0068112d9dac8c3a1a9172e71579e5b65dc71a Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 2 Dec 2025 15:25:41 +0100 Subject: [PATCH 001/320] Change version to 5.3 - we have decided to release that due to all the performance and/or bug fixes. --- CMakeLists.txt | 2 +- debian/changelog | 4 ++-- src/unix/assets/86Box.spec | 6 +++--- src/unix/assets/net.86box.86Box.metainfo.xml | 2 +- vcpkg.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3004b37117d..adec2eedb9e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ if(MUNT_EXTERNAL) endif() project(86Box - VERSION 6.0 + VERSION 5.3 DESCRIPTION "Emulator of x86-based systems" HOMEPAGE_URL "https://86box.net" LANGUAGES C CXX) diff --git a/debian/changelog b/debian/changelog index d2606a616a2..3720d22aa8c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -86box (6.0) UNRELEASED; urgency=medium +86box (5.3) UNRELEASED; urgency=medium * Bump release. - -- Jasmine Iwanek Sun, 26 Oct 2025 17:41:47 +0100 + -- Jasmine Iwanek Tue, 02 Dec 2025 15:24:58 +0100 diff --git a/src/unix/assets/86Box.spec b/src/unix/assets/86Box.spec index 35916ffff1c..c5fbc120fd0 100644 --- a/src/unix/assets/86Box.spec +++ b/src/unix/assets/86Box.spec @@ -12,10 +12,10 @@ # After a successful build, you can install the RPMs as follows: # sudo dnf install RPMS/$(uname -m)/86Box-3* RPMS/noarch/86Box-roms* -%global romver 5.2 +%global romver 5.3 Name: 86Box -Version: 6.0 +Version: 5.3 Release: 1%{?dist} Summary: Classic PC emulator License: GPLv2+ @@ -121,5 +121,5 @@ popd %{_datadir}/%{name}/roms %changelog -* Sat Aug 31 Jasmine Iwanek 6.0-1 +* Sat Aug 31 Jasmine Iwanek 5.3-1 - Bump release diff --git a/src/unix/assets/net.86box.86Box.metainfo.xml b/src/unix/assets/net.86box.86Box.metainfo.xml index 1e929412c24..0cf1a0fb4cd 100644 --- a/src/unix/assets/net.86box.86Box.metainfo.xml +++ b/src/unix/assets/net.86box.86Box.metainfo.xml @@ -11,7 +11,7 @@ net.86box.86Box.desktop - + diff --git a/vcpkg.json b/vcpkg.json index 6a4f6376cb8..43cf367c516 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "86box", - "version-string": "6.0", + "version-string": "5.3", "homepage": "https://86box.net/", "documentation": "https://86box.readthedocs.io/", "license": "GPL-2.0-or-later", From ecf96afe84763ec30ec4137fdfbf6d7576f8b28d Mon Sep 17 00:00:00 2001 From: TC1995 Date: Tue, 2 Dec 2025 15:30:00 +0100 Subject: [PATCH 002/320] Added some SCSI-2 CD-ROM drives with specified speeds as below. As we simply lack some drives specified in the 4x-12x range. --- src/include/86box/cdrom.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 409e303bc25..82c59ccd64f 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -201,6 +201,7 @@ static const struct cdrom_drive_types_s { { "NEC", "CD-ROM DRIVE:211", "1.00", "nec_211", BUS_TYPE_SCSI, 2, 3, 36, 0, 0, { -1, -1, -1, -1 } }, /* The speed of the following two is guesswork based on the CDR-400. */ { "NEC", "CD-ROM DRIVE:464", "1.05", "nec_464", BUS_TYPE_SCSI, 2, 3, 36, 0, 0, { -1, -1, -1, -1 } }, + { "NEC", "CD-ROM DRIVE:900", "2.5a", "nec_900", BUS_TYPE_SCSI, 2, 4, 36, 0, 0, { -1, -1, -1, -1 } }, /* The speed of the following two is guesswork based on the name. */ { "ShinaKen", "CD-ROM DM-3x1S", "1.04", "shinaken_3x1s", BUS_TYPE_SCSI, 1, 3, 36, 0, 0, { -1, -1, -1, -1 } }, { "SONY", "CD-ROM CDU-541", "1.0i", "sony_541", BUS_TYPE_SCSI, 1, 1, 36, 1, 0, { -1, -1, -1, -1 } }, @@ -209,7 +210,10 @@ static const struct cdrom_drive_types_s { { "PHILIPS", "CDD2600", "1.07", "philips_2600", BUS_TYPE_SCSI, 2, 6, 36, 0, 0, { -1, -1, -1, -1 } }, /* NOTE: The real thing is a CD changer drive! */ { "PIONEER", "CD-ROM DRM-604X", "2403", "pioneer_604x", BUS_TYPE_SCSI, 2, 4, 47, 0, 0, { -1, -1, -1, -1 } }, + { "PLEXTOR", "CD-ROM PX-12CS", "1.04", "plextor_12cs", BUS_TYPE_SCSI, 2, 12, 36, 1, 0, { -1, -1, -1, -1 } }, + { "PLEXTOR", "CD-ROM PX-12TS", "1.01", "plextor_12ts", BUS_TYPE_SCSI, 2, 12, 36, 0, 0, { -1, -1, -1, -1 } }, { "PLEXTOR", "CD-ROM PX-32TS", "1.03", "plextor_32ts", BUS_TYPE_SCSI, 2, 32, 36, 0, 0, { -1, -1, -1, -1 } }, + { "PLEXTOR", "CD-ROM PX-83CS", "1.01", "plextor_83cs", BUS_TYPE_SCSI, 2, 8, 36, 1, 0, { -1, -1, -1, -1 } }, /* The speed of the following two is guesswork based on the R55S. */ { "TEAC", "CD 50", "1.00", "teac_50", BUS_TYPE_SCSI, 2, 4, 36, 1, 0, { -1, -1, -1, -1 } }, { "TEAC", "CD-ROM R55S", "1.0R", "teac_55s", BUS_TYPE_SCSI, 2, 4, 36, 0, 0, { -1, -1, -1, -1 } }, @@ -229,6 +233,7 @@ static const struct cdrom_drive_types_s { { "TOSHIBA", "CD-ROM DRIVE:XM", "3433", "toshiba_xm", BUS_TYPE_SCSI, 2, 2, 96, 0, 0, { -1, -1, -1, -1 } }, /* Tray. */ { "TOSHIBA", "CD-ROM XM-3201B", "3232", "toshiba_3201b", BUS_TYPE_SCSI, 1, 1, 96, 1, 0, { -1, -1, -1, -1 } }, /* Caddy. */ { "TOSHIBA", "CD-ROM XM-3301TA", "0272", "toshiba_3301ta", BUS_TYPE_SCSI, 2, 2, 96, 0, 0, { -1, -1, -1, -1 } }, /* Tray. */ + { "TOSHIBA", "CD-ROM XM-3701B", "0236", "toshiba_3701b", BUS_TYPE_SCSI, 2, 6, 96, 0, 0, { -1, -1, -1, -1 } }, /* Tray. */ { "TOSHIBA", "CD-ROM XM-5701TA", "3136", "toshiba_5701a", BUS_TYPE_SCSI, 2, 12, 96, 0, 0, { -1, -1, -1, -1 } }, /* Tray. */ { "TOSHIBA", "DVD-ROM SD-M1401", "1008", "toshiba_m1401", BUS_TYPE_SCSI, 2, 40, 96, 0, 1, { -1, -1, -1, -1 } }, /* Tray. */ { "MATSHITA", "CR-562", "0.75", "cr562", BUS_TYPE_MKE , 0, 2, 0, 0, 0, { -1, -1, -1, -1 } }, From 8a6cf0fcc16796d30bedd972b4264fe28ae7188d Mon Sep 17 00:00:00 2001 From: vitalik1555 <66238862+vitalik1555@users.noreply.github.com> Date: Tue, 2 Dec 2025 19:03:11 +0400 Subject: [PATCH 003/320] Aztech: Fix Missing MPU-401 for Washington --- src/sound/snd_azt2316a.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/snd_azt2316a.c b/src/sound/snd_azt2316a.c index 3eebf616e02..47cf0296bf3 100644 --- a/src/sound/snd_azt2316a.c +++ b/src/sound/snd_azt2316a.c @@ -1670,7 +1670,7 @@ static const device_config_t azt2316a_config[] = { }, { .name = "receive_input401", - .description = "Receive MIDI input", + .description = "Receive MIDI input (MPU-401)", .type = CONFIG_BINARY, .default_string = NULL, .default_int = 0, From e885b02ce6de34008e88424ce2a0b749c50313b9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 3 Dec 2025 02:43:14 +0100 Subject: [PATCH 004/320] Amstrad PC5286: Force the keyboard controller to AT and not PS/2 - the PS/2 mouse is handled by the QuickPort mouse on the C&T F82C710 System I/O chip, fixes #6525. --- src/machine/machine_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 89f231ae5c7..8f3290fbe52 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -20553,7 +20553,7 @@ machine_has_flags_ex(int flags) int ret = machine_has_flags(machine, flags); if (flags & MACHINE_PS2_KBC) { - if (machine_is_ps2) + if (machine_is_ps2 && (strcmp(machine_get_internal_name(), "pc5286"))) ret |= MACHINE_PS2_KBC; else ret &= ~MACHINE_PS2_KBC; From 3c56968921ae5a622ae943bfc3aee69f3e36873f Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:37:06 -0600 Subject: [PATCH 005/320] Give the OPTi 931 its PnP quaternary IDE controller --- src/disk/hdc_ide.c | 30 ++++++++++++++++++++++++++++++ src/include/86box/hdc_ide.h | 1 + src/sound/snd_optimc.c | 10 +++++++++- 3 files changed, 40 insertions(+), 1 deletion(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index 6b116697fdb..fb844da8ff3 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -3010,6 +3010,36 @@ ide_pnp_config_changed_1addr(uint8_t ld, isapnp_device_config_t *config, void *p } } +/* OPTi 931 PnP ROM flips the main and side IDE I/O port ranges */ +void +ide_pnp_config_changed_opti931(uint8_t ld, isapnp_device_config_t *config, void *priv) +{ + intptr_t board = (intptr_t) priv; + + if (ld) + return; + + if (ide_boards[board]->base[0] || ide_boards[board]->base[1]) { + ide_remove_handlers(board); + ide_boards[board]->base[0] = ide_boards[board]->base[1] = 0; + } + + ide_boards[board]->irq = -1; + + if (config->activate) { + ide_boards[board]->base[1] = (config->io[0].base != ISAPNP_IO_DISABLED) ? + config->io[0].base : 0x0000; + ide_boards[board]->base[0] = (config->io[1].base != ISAPNP_IO_DISABLED) ? + config->io[1].base : 0x0000; + + if (ide_boards[board]->base[0] && ide_boards[board]->base[1]) + ide_set_handlers(board); + + if (config->irq[0].irq != ISAPNP_IRQ_DISABLED) + ide_boards[board]->irq = config->irq[0].irq; + } +} + void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv) { diff --git a/src/include/86box/hdc_ide.h b/src/include/86box/hdc_ide.h index 99d97efd98d..a1c22d04526 100644 --- a/src/include/86box/hdc_ide.h +++ b/src/include/86box/hdc_ide.h @@ -210,6 +210,7 @@ extern void ide_handlers(uint8_t board, int set); extern void ide_board_set_force_ata3(int board, int force_ata3); #ifdef EMU_ISAPNP_H extern void ide_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv); +extern void ide_pnp_config_changed_opti931(uint8_t ld, isapnp_device_config_t *config, void *priv); extern void ide_pnp_config_changed_1addr(uint8_t ld, isapnp_device_config_t *config, void *priv); #endif diff --git a/src/sound/snd_optimc.c b/src/sound/snd_optimc.c index 7c72104aec2..e9198b9f0e9 100644 --- a/src/sound/snd_optimc.c +++ b/src/sound/snd_optimc.c @@ -38,7 +38,9 @@ #include <86box/mem.h> #include <86box/rom.h> #include <86box/plat_unused.h> +#include <86box/hdc.h> #include <86box/isapnp.h> +#include <86box/hdc_ide.h> #include <86box/log.h> #define PNP_ROM_OPTI931 "roms/sound/opti931/adsrom.bin" @@ -889,7 +891,8 @@ opti931_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *pri optimc_log(optimc->log, "PnP Config changed\n"); switch (ld) { - case 0: /* Aux Device */ + case 0: /* IDE CD-ROM */ + ide_pnp_config_changed_opti931(0, config, (void *) 3); break; case 1: /* WSS/OPL3/SBPro/Control regs */ if (optimc->cur_wss_addr) { @@ -1155,6 +1158,11 @@ optimc_init(const device_t *info) /* Set up ISAPnP handlers to intercept Read Data port changes */ io_sethandler(0x279, 0x0001, NULL, NULL, NULL, opti931_isapnp_write, NULL, NULL, optimc); io_sethandler(0xA79, 0x0001, NULL, NULL, NULL, opti931_isapnp_write, NULL, NULL, optimc); + + /* Add ISAPnP quaternary IDE controller */ + device_add(&ide_qua_pnp_device); + other_ide_present++; + ide_remove_handlers(3); } /* OPTi 930 DOS sound test utility starts DMA playback without setting a time constant likely making */ From f957b4bb33252f20378bfce39ddf4d46d62ebdfa Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:40:23 -0600 Subject: [PATCH 006/320] Make the Yamaha YMF701/71x use the YMF289B variant of the OPL3 per the YMF-715 datasheet --- src/sound/snd_ymf701.c | 2 +- src/sound/snd_ymf71x.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sound/snd_ymf701.c b/src/sound/snd_ymf701.c index 3b352932040..c6b1467c8bb 100644 --- a/src/sound/snd_ymf701.c +++ b/src/sound/snd_ymf701.c @@ -428,7 +428,7 @@ ymf701_init(const device_t *info) ymf701->sb->opl_mixer = ymf701; ymf701->sb->opl_mix = ymf701_filter_opl; - fm_driver_get(FM_YMF262, &ymf701->sb->opl); + fm_driver_get(FM_YMF289B, &ymf701->sb->opl); io_sethandler(ymf701->cur_sb_addr + 0, 0x0004, ymf701->sb->opl.read, NULL, NULL, ymf701->sb->opl.write, NULL, NULL, ymf701->sb->opl.priv); io_sethandler(ymf701->cur_sb_addr + 8, 0x0002, ymf701->sb->opl.read, NULL, NULL, ymf701->sb->opl.write, NULL, NULL, ymf701->sb->opl.priv); io_sethandler(0x0388, 0x0004, ymf701->sb->opl.read, NULL, NULL, ymf701->sb->opl.write, NULL, NULL, ymf701->sb->opl.priv); diff --git a/src/sound/snd_ymf71x.c b/src/sound/snd_ymf71x.c index c79263ce0ea..70ccf68726e 100644 --- a/src/sound/snd_ymf71x.c +++ b/src/sound/snd_ymf71x.c @@ -718,7 +718,7 @@ ymf71x_init(const device_t *info) ymf71x->sb->opl_mixer = ymf71x; ymf71x->sb->opl_mix = ymf71x_filter_opl; - fm_driver_get(FM_YMF262, &ymf71x->sb->opl); + fm_driver_get(FM_YMF289B, &ymf71x->sb->opl); sound_add_handler(ymf71x_get_buffer, ymf71x); music_add_handler(sb_get_music_buffer_sbpro, ymf71x->sb); From 1fabffaa3b2119d83ece881aea2f737173df4fa4 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Wed, 3 Dec 2025 17:49:54 -0600 Subject: [PATCH 007/320] Add config migration for the Aztech 1605/2316 codec type selection --- src/config.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/config.c b/src/config.c index 86dc95ccaf1..197ed6b2788 100644 --- a/src/config.c +++ b/src/config.c @@ -740,6 +740,25 @@ load_sound(void) } } + /* Correct Aztech codec selection in old configs so the OPTi 930 AD1848 type isn't selected */ + for (int i = 0; i < (sizeof(sound_card_current) / sizeof(sound_card_current[0])); i++) { + sprintf(temp, "Aztech Sound Galaxy Pro 16 AB (Washington) #%i", i + 1); + ini_section_t c = ini_find_section(config, temp); + if (c != NULL) { + if (ini_section_get_int(c, "codec", 1) == 2) + ini_section_set_int(c, "codec", 3); + } + } + for (int i = 0; i < (sizeof(sound_card_current) / sizeof(sound_card_current[0])); i++) { + sprintf(temp, "Aztech Sound Galaxy Nova 16 Extra (Clinton) #%i", i + 1); + ini_section_t c = ini_find_section(config, temp); + if (c != NULL) { + if (ini_section_get_int(c, "codec", 1) == 2) + ini_section_set_int(c, "codec", 3); + } + } + + memset(temp, '\0', sizeof(temp)); p = ini_section_get_string(cat, "sound_type", "float"); if (strlen(p) > 511) From 48f6db24e27cf7aefa0721ef9c9aae6bf93d2fe1 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 4 Dec 2025 23:44:07 +0600 Subject: [PATCH 008/320] Add ASUS TX97-XV (HP OEM) board Shipped with either ATi RAGE II or ATi Mach64 VT3 --- src/include/86box/machine.h | 1 + src/include/86box/video.h | 1 + src/machine/m_at_socket7.c | 34 ++ src/machine/machine_table.c | 45 +++ src/video/vid_ati_mach64.c | 606 +++++++++++++++++++++++++++++++++++- src/video/vid_s3.c | 2 +- src/video/vid_s3_virge.c | 2 +- 7 files changed, 674 insertions(+), 17 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 941286e0fb4..789168d6e34 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1088,6 +1088,7 @@ extern int machine_at_i430vx_init(const machine_t *); /* i430TX */ extern int machine_at_nupro592_init(const machine_t *); extern int machine_at_tx97_init(const machine_t *); +extern int machine_at_tx97xv_init(const machine_t *); extern void machine_at_optiplex_21152_init(void); extern int machine_at_optiplexgn_init(const machine_t *); extern int machine_at_tomahawk_init(const machine_t *); diff --git a/src/include/86box/video.h b/src/include/86box/video.h index acaf7cdc4f4..ff63a3a7986 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -336,6 +336,7 @@ extern const device_t mach64ct_device; extern const device_t mach64ct_device_onboard; extern const device_t mach64vt_device; extern const device_t mach64vt2_device; +extern const device_t mach64vt3_onboard_device; /* ATi 18800 */ extern const device_t ati18800_wonder_device; diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 4715e72eb64..31580e6e358 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -1484,6 +1484,40 @@ machine_at_ym430tx_init(const machine_t *model) return ret; } +int +machine_at_tx97xv_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/tx97xv/Bios.rom", + 0x000c0000, 262144, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); /* PIIX4 */ + pci_register_slot(0x09, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x0A, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x0B, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x0C, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x0D, PCI_CARD_VIDEO, 1, 0, 0, 0); + + device_add(&i430tx_device); + device_add(&piix4_device); + device_add_params(&pc87307_device, (void *) (PCX730X_AMI | PCX7307_PC87307 | PCX730X_02E)); + device_add(&intel_flash_bxt_device); + spd_register(SPD_TYPE_SDRAM, 0x3, 128); + + if ((gfxcard[0] == VID_INTERNAL) && machine_get_vid_device(machine)) + device_add(machine_get_vid_device(machine)); + + return ret; +} + int machine_at_thunderbolt_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 8f3290fbe52..0cd58032ab2 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -15860,6 +15860,51 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, + /* Has a National Semiconductor PC87307 Super I/O with on-chip KBC, which has one of these + firmwares: AMI '5' MegaKey, Phoenix MultiKey/42 1.37, or Phoenix MultiKey/42i 4.16. */ + { + .name = "[i430TX] ASUS TX97-XV (HP OEM)", + .internal_name = "tx97xv", + .type = MACHINE_TYPE_SOCKET7, + .chipset = MACHINE_CHIPSET_INTEL_430TX, + .init = machine_at_tx97xv_init, + .p1_handler = machine_generic_p1_handler, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SOCKET5_7, + .block = CPU_BLOCK_NONE, + .min_bus = 50000000, + .max_bus = 75000000, + .min_voltage = 2100, + .max_voltage = 3520, + .min_multi = 1.5, + .max_multi = 3.5 + }, + .bus_flags = MACHINE_PS2_PCI | MACHINE_BUS_USB, + .flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_USB | MACHINE_VIDEO, + .ram = { + .min = 8192, + .max = 262144, + .step = 8192 + }, + .nvrmask = 255, + .jumpered_ecp_dma = 0, + .default_jumpered_ecp_dma = -1, + .kbc_device = &kbc_at_device, + .kbc_params = KBC_VEN_AMI | 0x00004600, + .kbc_p1 = 0x00000cf0, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = NULL, + .kbd_device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = &mach64vt3_onboard_device, + .snd_device = NULL, + .net_device = NULL + }, /* This has the AMIKey KBC firmware, which is type 'F' (YM430TX is based on the TX97). */ { .name = "[i430TX] ASUS TX97", diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 9aa8b687db8..3d244e55144 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -79,7 +79,8 @@ enum { MACH64_GX = 0, MACH64_CT, MACH64_VT, - MACH64_VT2 + MACH64_VT2, + MACH64_VT3 }; typedef struct mach64_t { @@ -138,6 +139,8 @@ typedef struct mach64_t { uint32_t cur_horz_vert_posn; uint32_t cur_offset; + uint32_t gp_io; + uint32_t dac_cntl; uint32_t dp_bkgd_clr; @@ -145,6 +148,7 @@ typedef struct mach64_t { uint32_t dp_mix; uint32_t dp_pix_width; uint32_t dp_src; + uint32_t dp_set_gui_engine; uint32_t dst_bres_lnth; uint32_t dst_bres_dec; @@ -177,6 +181,8 @@ typedef struct mach64_t { uint32_t scratch_reg0; uint32_t scratch_reg1; + uint32_t scratch_reg2; + uint32_t scratch_reg3; uint32_t src_cntl; uint32_t src_off_pitch; @@ -229,6 +235,7 @@ typedef struct mach64_t { int pattern[8][8]; uint8_t pattern_clr4x2[2][4]; uint8_t pattern_clr8x1[8]; + uint8_t pattern_clr8x8[8][8]; int sc_left; int sc_right; int sc_top; @@ -254,6 +261,18 @@ typedef struct mach64_t { int poly_draw; } accel; +#ifdef DMA_BM + struct { + atomic_int state; + + atomic_uint frame_buf_offset, system_buf_addr, command, status; + + atomic_bool system_triggered; + + mutex_t *lock; + } dma; +#endif + fifo_entry_t fifo[FIFO_SIZE]; atomic_int fifo_read_idx; atomic_int fifo_write_idx; @@ -299,6 +318,15 @@ typedef struct mach64_t { uint32_t buf_offset[2]; uint32_t buf_pitch[2]; + uint32_t scaler_buf_offset[2]; + uint32_t scaler_buf_pitch; + uint32_t overlay_exclusive_horz, overlay_exclusive_vert; + + uint32_t vga_dsp_config; + uint32_t vga_dsp_on_off; + uint32_t dsp_config; + uint32_t dsp_on_off; + int overlay_v_acc; uint32_t overlay_uv_addr; @@ -307,6 +335,7 @@ typedef struct mach64_t { uint8_t thread_run; void *i2c; + void *i2c_tv; void *ddc; } mach64_t; @@ -348,7 +377,10 @@ enum { SRC_PATT_EN = 1, SRC_PATT_ROT_EN = 2, SRC_LINEAR_EN = 4, - SRC_BYTE_ALIGN = 8 + SRC_BYTE_ALIGN = 8, + SRC_8x8x8_BRUSH = 32, + + SRC_8x8x8_BRUSH_LOADED = 1 << 12 }; enum { @@ -415,6 +447,8 @@ mach64_log(const char *fmt, ...) # define mach64_log(fmt, ...) #endif +static mach64_t *reset_state[2] = { NULL, NULL }; + void mach64_out(uint16_t addr, uint8_t val, void *priv) { @@ -559,34 +593,40 @@ mach64_recalctimings(svga_t *svga) if (mach64->type != MACH64_GX) svga->render = svga_render_4bpp_highres; svga->hdisp <<= 3; + svga->bpp = 4; break; case BPP_8: if (mach64->type != MACH64_GX) svga->render = svga_render_8bpp_clone_highres; svga->hdisp <<= 3; svga->rowoffset >>= 1; + svga->bpp = 8; break; case BPP_15: if (mach64->type != MACH64_GX) svga->render = svga_render_15bpp_highres; svga->hdisp <<= 3; + svga->bpp = 15; break; case BPP_16: if (mach64->type != MACH64_GX) svga->render = svga_render_16bpp_highres; svga->hdisp <<= 3; + svga->bpp = 16; break; case BPP_24: if (mach64->type != MACH64_GX) svga->render = svga_render_24bpp_highres; svga->hdisp <<= 3; svga->rowoffset = (svga->rowoffset * 3) / 2; + svga->bpp = 24; break; case BPP_32: if (mach64->type != MACH64_GX) svga->render = svga_render_32bpp_highres; svga->hdisp <<= 3; svga->rowoffset <<= 1; + svga->bpp = 32; break; default: @@ -597,6 +637,7 @@ mach64_recalctimings(svga_t *svga) } else { svga->vram_display_mask = (mach64->regs[0x36] & 0x01) ? mach64->vram_mask : 0x3ffff; svga->lut_map = 0; + svga->bpp = 8; } } @@ -737,6 +778,154 @@ mach64_wait_fifo_idle(mach64_t *mach64) break; \ } + +static void +mach64_accel_write_fifo_l(mach64_t *mach64, uint32_t addr, uint32_t val); + +static void +mach64_recalc_dp_set_engine(mach64_t *mach64) +{ + static const unsigned int pitches[16] = + { + [0] = 320, // fallback + [1] = 320, + [2] = 352, + [3] = 384, + [4] = 640, + [5] = 800, + [6] = 896, + [7] = 512, + [8] = 1024, + [9] = 1152, + [10] = 1280, + [11] = 400, + [12] = 832, + [13] = 1600, + [14] = 448, + [15] = 2048 + }; + + mach64->dst_y_x = 0; + mach64->dst_height_width = 0; + mach64->src_y_x = 0; + mach64->sc_top_bottom = 0x3FFF0000; + mach64->sc_left_right = 0x1FFF0000; + mach64->write_mask = ~0u; + mach64->clr_cmp_clr = 0; + mach64->src_y_x_start = 0; + mach64->src_cntl &= ~((3 << 13) | (1 << 5) | (1 << 12)); + mach64->dst_cntl &= ~(7 << 13); + mach64->dp_pix_width &= (1 << 13); + + mach64->dp_pix_width = (mach64->dp_pix_width & ~7) | ((mach64->dp_set_gui_engine >> 3) & 7); + mach64->dp_pix_width = (mach64->dp_pix_width & ~(0xf << 8)) | ((mach64->dp_set_gui_engine & (1 << 6)) ? ((mach64->dp_pix_width & 7) << 8) : 0); + + mach64->dst_off_pitch = (262144 * ((mach64->dp_set_gui_engine >> 7) & 3)) & ((1 << 20) - 1); + mach64->dst_off_pitch |= (((pitches[(mach64->dp_set_gui_engine >> 10) & 0xF]) * ((mach64->dp_set_gui_engine & (1 << 14)) ? 2 : 1)) / 8) << 22; + + mach64->src_off_pitch = 0; + if (mach64->dp_set_gui_engine & (1 << 15)) + mach64->src_off_pitch = mach64->dst_off_pitch; + + switch ((mach64->dp_set_gui_engine >> 16) & 3) + { + case 0: + mach64->src_height1_width1 = mach64->src_height2_width2 = (0x00080008); + break; + case 1: + mach64->src_height1_width1 = mach64->src_height2_width2 = (0x00200001); + break; + case 2: + mach64->src_height1_width1 = mach64->src_height2_width2 = (0x00180008); + break; + } + + switch ((mach64->dp_set_gui_engine >> 20) & 0xf) + { + case 0: + { + pclog("unknown drawing combo2\n"); + break; + } + case 1: + mach64->dp_mix = 0x070003; + mach64->dp_src = 0x0000100; + mach64->gui_traj_cntl = 0x23; + break; + case 2: + mach64->dp_src = 0x200; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x3; + break; + case 3: + mach64->dp_src = 0x20100; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x3; + break; + case 4: + mach64->dp_src = 0x100; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x3; + break; + case 5: + mach64->dp_src = 0x10100; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x01000003; + break; + case 6: + mach64->dp_src = 0x100; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x3; + break; + case 7: + mach64->dp_src = 0x300; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x30003; + break; + case 8: + mach64->dp_src = 0x300; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0; + break; + case 9: + mach64->dp_src = 0x300; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 1; + break; + case 10: + mach64->dp_src = 0x300; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 2; + break; + case 11: + mach64->dp_src = 0x300; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 3; + break; + case 12: + mach64->dp_src = 0x20100; + mach64->dp_mix = 0x70003; + mach64->gui_traj_cntl = 0x1004001B; + break; + case 13: + mach64->dp_src = 0x20100; + mach64->dp_mix = 0x70003; + mach64->gui_traj_cntl = 0x0004001B; + break; + case 14: + { + pclog("unknown drawing combo\n"); + break; + } + case 15: + mach64->dp_src = 0x300; + mach64->dp_mix = 0x70007; + mach64->gui_traj_cntl = 0x0004001B; + break; + } + mach64_accel_write_fifo_l(mach64, 0x330, mach64->gui_traj_cntl); +} + static void mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) { @@ -763,6 +952,12 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) case 0x10f: WRITE8(addr, mach64->dst_y_x, val); break; + case 0x2e8: + case 0x2e9: + case 0x2ea: + case 0x2eb: + WRITE8(addr ^ 2, mach64->dst_y_x, val); + break; case 0x110: case 0x111: WRITE8(addr + 2, mach64->dst_height_width, val); @@ -779,6 +974,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) fallthrough; case 0x113: if (((addr & 0x3ff) == 0x11b || (addr & 0x3ff) == 0x11f || (addr & 0x3ff) == 0x113) && !(val & 0x80)) { +start_blit_op: mach64_start_fill(mach64); mach64_log("%i %i %i %i %i %08x\n", (mach64->dst_height_width & 0x7ff), (mach64->dst_height_width & 0x7ff0000), ((mach64->dp_src & 7) != SRC_HOST), (((mach64->dp_src >> 8) & 7) != SRC_HOST), @@ -787,6 +983,16 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) mach64_blit(0, -1, mach64); } break; + + case 0x2ec: + case 0x2ed: + case 0x2ee: + case 0x2ef: + WRITE8(addr ^ 2, mach64->dst_height_width, val); + if ((addr & 0x3ff) == 0x2ef) { + goto start_blit_op; + } + break; case 0x120: case 0x121: @@ -894,6 +1100,12 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) case 0x1b6: case 0x1b7: WRITE8(addr, mach64->src_cntl, val); +#ifdef DMA_BM + if (mach64->src_cntl & (1 << 9)) + pclog("Bus master enabled\n"); + else + pclog("Bus master disabled\n"); +#endif break; case 0x200: @@ -1063,6 +1275,13 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) case 0x2db: WRITE8(addr, mach64->dp_src, val); break; + case 0x2fc: + case 0x2fd: + case 0x2fe: + case 0x2ff: + WRITE8(addr, mach64->dp_set_gui_engine, val); + mach64_recalc_dp_set_engine(mach64); + break; case 0x300: case 0x301: @@ -1148,6 +1367,16 @@ mach64_accel_write_fifo_w(mach64_t *mach64, uint32_t addr, uint16_t val) mach64_blit(val, 16, mach64); break; + case 0x2fc: + mach64->dp_set_gui_engine |= (mach64->dp_set_gui_engine & 0xffff0000) | val; + mach64_recalc_dp_set_engine(mach64); + break; + + case 0x2fe: + mach64->dp_set_gui_engine |= (mach64->dp_set_gui_engine & 0xffff) | (val << 16); + mach64_recalc_dp_set_engine(mach64); + break; + case 0x32c: mach64->context_load_cntl = (mach64->context_load_cntl & 0xffff0000) | val; break; @@ -1196,6 +1425,11 @@ mach64_accel_write_fifo_l(mach64_t *mach64, uint32_t addr, uint32_t val) mach64_blit(((val & 0xff000000) >> 24) | ((val & 0x00ff0000) >> 8) | ((val & 0x0000ff00) << 8) | ((val & 0x000000ff) << 24), 32, mach64); break; + case 0x2fc: + mach64->dp_set_gui_engine = val; + mach64_recalc_dp_set_engine(mach64); + break; + default: mach64_accel_write_fifo_w(mach64, addr, val); mach64_accel_write_fifo_w(mach64, addr + 2, val >> 16); @@ -1203,6 +1437,18 @@ mach64_accel_write_fifo_l(mach64_t *mach64, uint32_t addr, uint32_t val) } } +#ifdef DMA_BM +static void +run_dma(mach64_t *mach64) +{ + int words_transferred = 0; + + thread_wait_mutex(mach64->dma.lock); + thread_release_mutex(mach64->dma.lock); + +} +#endif + static void fifo_thread(void *param) { @@ -1243,6 +1489,9 @@ fifo_thread(void *param) end_time = plat_timer_read(); mach64->blitter_time += end_time - start_time; } +#ifdef DMA_BM + run_dma(mach64); +#endif mach64->blitter_busy = 0; } } @@ -1433,6 +1682,13 @@ mach64_start_fill(mach64_t *mach64) mach64->accel.pattern_clr8x1[7] = ((mach64->pat_reg1 >> 24) & 0xff); } + if ((mach64->src_cntl & SRC_8x8x8_BRUSH) && !(mach64->src_cntl & SRC_8x8x8_BRUSH_LOADED)) + { + for (int y = 0; y < 8; y++) + for (int x = 0; x < 8; x++) + mach64->accel.pattern_clr8x8[y][x] = mach64->svga.vram[(mach64->accel.src_offset & ~7) + (y * 8) + x]; + } + mach64->accel.sc_left = mach64->sc_left_right & 0x1fff; mach64->accel.sc_right = (mach64->sc_left_right >> 16) & 0x1fff; mach64->accel.sc_top = mach64->sc_top_bottom & 0x7fff; @@ -1450,7 +1706,6 @@ mach64_start_fill(mach64_t *mach64) mach64->accel.poly_draw = 0; mach64->accel.busy = 1; - mach64_log("mach64_start_fill : dst %i, %i src %i, %i size %i, %i src pitch %i offset %X dst pitch %i offset %X scissor %i %i %i %i src_fg %i mix %02X %02X\n", mach64->accel.dst_x_start, mach64->accel.dst_y_start, mach64->accel.src_x_start, mach64->accel.src_y_start, mach64->accel.dst_width, mach64->accel.dst_height, mach64->accel.src_pitch, mach64->accel.src_offset, mach64->accel.dst_pitch, mach64->accel.dst_offset, mach64->accel.sc_left, mach64->accel.sc_right, mach64->accel.sc_top, mach64->accel.sc_bottom, mach64->accel.source_fg, mach64->accel.mix_fg, mach64->accel.mix_bg); mach64->accel.op = OP_RECT; } @@ -1513,7 +1768,6 @@ mach64_start_line(mach64_t *mach64) } } } - mach64->accel.sc_left = mach64->sc_left_right & 0x1fff; mach64->accel.sc_right = (mach64->sc_left_right >> 16) & 0x1fff; mach64->accel.sc_top = mach64->sc_top_bottom & 0x7fff; @@ -1726,7 +1980,10 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) src_dat = host_dat; break; case SRC_BLITSRC: - READ(mach64->accel.src_offset + (src_y * mach64->accel.src_pitch) + src_x, src_dat, mach64->accel.src_size); + if (mach64->accel.src_size == 0 && mach64->type == MACH64_VT3 && (mach64->src_cntl & SRC_8x8x8_BRUSH)) + src_dat = mach64->accel.pattern_clr8x8[dst_y & 7][dst_x & 7]; + else + READ(mach64->accel.src_offset + (src_y * mach64->accel.src_pitch) + src_x, src_dat, mach64->accel.src_size); break; case SRC_FG: if (mach64->dst_cntl & DST_24_ROT_EN) { @@ -1963,7 +2220,10 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) src_dat = host_dat; break; case SRC_BLITSRC: - READ(mach64->accel.src_offset + (mach64->accel.src_y * mach64->accel.src_pitch) + mach64->accel.src_x, src_dat, mach64->accel.src_size); + if (mach64->accel.src_size == 0 && mach64->type == MACH64_VT3 && (mach64->src_cntl & SRC_8x8x8_BRUSH)) + src_dat = mach64->accel.pattern_clr8x8[mach64->accel.dst_y & 7][mach64->accel.dst_x & 7]; + else + READ(mach64->accel.src_offset + (mach64->accel.src_y * mach64->accel.src_pitch) + mach64->accel.src_x, src_dat, mach64->accel.src_size); break; case SRC_FG: src_dat = mach64->accel.dp_frgd_clr; @@ -2328,8 +2588,13 @@ mach64_vblank_start(svga_t *svga) svga->overlay.cur_xsize = ((mach64->overlay_y_x_end >> 16) & 0x7ff) - svga->overlay.x; svga->overlay.cur_ysize = (mach64->overlay_y_x_end & 0x7ff) - svga->overlay.y; - svga->overlay.addr = mach64->buf_offset[0] & 0x3ffff8; - svga->overlay.pitch = mach64->buf_pitch[0] & 0xfff; + if (mach64->type >= MACH64_VT3) { + svga->overlay.addr = mach64->scaler_buf_offset[0] & 0x3fffff; + svga->overlay.pitch = mach64->scaler_buf_pitch & 0xfff; + } else { + svga->overlay.addr = mach64->buf_offset[0] & 0x3ffff8; + svga->overlay.pitch = mach64->buf_pitch[0] & 0xfff; + } svga->overlay.ena = (mach64->overlay_scale_cntl & OVERLAY_EN) && (overlay_cmp_mix != 1); @@ -2412,6 +2677,41 @@ mach64_ext_readb(uint32_t addr, void *priv) READ8(addr, mach64->scaler_height_width); break; + case 0x34: + case 0x35: + case 0x36: + case 0x37: + READ8(addr, mach64->scaler_buf_offset[0]); + break; + + case 0x38: + case 0x39: + case 0x3a: + case 0x3b: + READ8(addr, mach64->scaler_buf_offset[1]); + break; + + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + READ8(addr, mach64->scaler_buf_pitch); + break; + + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + READ8(addr, mach64->overlay_exclusive_horz); + break; + + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: + READ8(addr, mach64->overlay_exclusive_vert); + break; + case 0x4a: ret = mach64->scaler_format; break; @@ -2476,6 +2776,20 @@ mach64_ext_readb(uint32_t addr, void *priv) READ8(addr, mach64->crtc_gen_cntl); break; + case 0x20: + case 0x21: + case 0x22: + case 0x23: + READ8(addr, mach64->dsp_config); + break; + + case 0x24: + case 0x25: + case 0x26: + case 0x27: + READ8(addr, mach64->dsp_on_off); + break; + case 0x40: case 0x41: case 0x42: @@ -2494,6 +2808,18 @@ mach64_ext_readb(uint32_t addr, void *priv) case 0x4b: READ8(addr, mach64->ovr_wid_top_bottom); break; + case 0x4c: + case 0x4d: + case 0x4e: + case 0x4f: + READ8(addr, mach64->vga_dsp_config); + break; + case 0x50: + case 0x51: + case 0x52: + case 0x53: + READ8(addr, mach64->vga_dsp_on_off); + break; case 0x60: case 0x61: @@ -2528,8 +2854,29 @@ mach64_ext_readb(uint32_t addr, void *priv) case 0x79: ret = 0x30; + if (mach64->type == MACH64_VT3) + { + ret = (((i2c_gpio_get_scl(mach64->i2c_tv) << 3)) & (~(mach64->gp_io >> 24) & 0xFF)) | ((mach64->gp_io >> 8) & (mach64->gp_io >> 24) & 0xFF); + ret &= ~((1 << 4) | (1 << 5)); + ret |= (i2c_gpio_get_scl(mach64->i2c) << 5) | (i2c_gpio_get_sda(mach64->i2c) << 4); + break; + } + break; + case 0x78: + if (mach64->type == MACH64_VT3) + { + ret = ((i2c_gpio_get_sda(mach64->i2c_tv) << 4) & (~(mach64->gp_io >> 16) & 0xFF)) | ((mach64->gp_io & 0xFF) & ((mach64->gp_io >> 16) & 0xFF)); + break; + } + case 0x7A: + case 0x7B: + if (mach64->type == MACH64_VT3) + { + READ8(addr, mach64->gp_io); + } +// pclog("GPIO READ 0x%X, 0x00\n", addr & 0x3ff); + break; - case 0x80: case 0x81: case 0x82: @@ -2588,7 +2935,7 @@ mach64_ext_readb(uint32_t addr, void *priv) case 0xc7: READ8(addr, mach64->dac_cntl); - if (mach64->type >= MACH64_CT) { + if (mach64->type >= MACH64_CT && mach64->type != MACH64_VT3) { ret &= 0xf9; if (i2c_gpio_get_scl(mach64->i2c)) ret |= 0x04; @@ -2654,6 +3001,21 @@ mach64_ext_readb(uint32_t addr, void *priv) mach64_wait_fifo_idle(mach64); READ8(addr, mach64->dst_y_x); break; + case 0x2e8: + case 0x2e9: + case 0x2ea: + case 0x2eb: + mach64_wait_fifo_idle(mach64); + READ8(addr ^ 2, mach64->dst_y_x); + break; + case 0x2ec: + case 0x2ed: + case 0x2ee: + case 0x2ef: + mach64_wait_fifo_idle(mach64); + READ8(addr ^ 2, mach64->dst_height_width); + break; + case 0x110: case 0x111: addr += 2; @@ -2969,6 +3331,10 @@ mach64_ext_readb(uint32_t addr, void *priv) ret = FIFO_EMPTY ? 0 : 1; break; + + case 0x33a: + ret = FIFO_EMPTY ? 32 : 31; + break; default: ret = 0; @@ -3116,6 +3482,27 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) WRITE8(addr, mach64->scaler_height_width, val); break; + case 0x34: + case 0x35: + case 0x36: + case 0x37: + WRITE8(addr, mach64->scaler_buf_offset[0], val); + break; + + case 0x38: + case 0x39: + case 0x3a: + case 0x3b: + WRITE8(addr, mach64->scaler_buf_offset[1], val); + break; + + case 0x3c: + case 0x3d: + case 0x3e: + case 0x3f: + WRITE8(addr, mach64->scaler_buf_pitch, val); + break; + case 0x4a: mach64->scaler_format = val & 0xf; break; @@ -3124,6 +3511,20 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) mach64->scaler_yuv_aper = val; break; + case 0x58: + case 0x59: + case 0x5a: + case 0x5b: + WRITE8(addr, mach64->overlay_exclusive_horz, val); + break; + + case 0x5c: + case 0x5d: + case 0x5e: + case 0x5f: + WRITE8(addr, mach64->overlay_exclusive_vert, val); + break; + case 0x80: case 0x81: case 0x82: @@ -3225,6 +3626,34 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) svga->fullchange = svga->monitor->mon_changeframecount; break; + case 0x20: + case 0x21: + case 0x22: + case 0x23: + WRITE8(addr, mach64->dsp_config, val); + break; + + case 0x24: + case 0x25: + case 0x26: + case 0x27: + WRITE8(addr, mach64->dsp_on_off, val); + break; + + case 0x4c: + case 0x4d: + case 0x4e: + case 0x4f: + WRITE8(addr, mach64->vga_dsp_config, val); + break; + + case 0x50: + case 0x51: + case 0x52: + case 0x53: + WRITE8(addr, mach64->vga_dsp_on_off, val); + break; + case 0x40: case 0x41: case 0x42: @@ -3292,6 +3721,19 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) svga->hwcursor.yoff = (mach64->cur_horz_vert_off >> 16) & 0x3f; } break; + + case 0x78: + case 0x79: + case 0x7A: + case 0x7B: + if (mach64->type == MACH64_VT3) { + WRITE8(addr, mach64->gp_io, val); + { + i2c_gpio_set(mach64->i2c_tv, !!(mach64->gp_io & (1 << 11)) || !(mach64->gp_io & (1 << (11 + 16))), !!(mach64->gp_io & (1 << 4)) || !(mach64->gp_io & (1 << (4 + 16)))); + i2c_gpio_set(mach64->i2c, !!(mach64->gp_io & (1 << 13)) || !(mach64->gp_io & (1 << (13 + 16))), !!(mach64->gp_io & (1 << 12)) || !(mach64->gp_io & (1 << (12 + 16)))); + } + } + break; case 0x80: case 0x81: @@ -3380,7 +3822,8 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) if (mach64->type == MACH64_GX) ati68860_set_ramdac_type(svga->ramdac, !!(mach64->dac_cntl & 0x100)); } - i2c_gpio_set(mach64->i2c, !(mach64->dac_cntl & 0x20000000) || (mach64->dac_cntl & 0x04000000), !(mach64->dac_cntl & 0x10000000) || (mach64->dac_cntl & 0x02000000)); + if (mach64->type != MACH64_VT3) + i2c_gpio_set(mach64->i2c, !(mach64->dac_cntl & 0x20000000) || (mach64->dac_cntl & 0x04000000), !(mach64->dac_cntl & 0x10000000) || (mach64->dac_cntl & 0x02000000)); break; case 0xd0: @@ -4293,6 +4736,9 @@ mach64_overlay_draw(svga_t *svga, int displine) int video_key_fn = mach64->overlay_key_cntl & 5; int graphics_key_fn = (mach64->overlay_key_cntl >> 4) & 5; int overlay_cmp_mix = (mach64->overlay_key_cntl >> 8) & 0xf; + int gfx_src = 0; + int desktop_x = mach64->svga.overlay_latch.x; + int desktop_y = displine - svga->y_add; p = &buffer32->line[displine][svga->x_add + mach64->svga.overlay_latch.x]; @@ -4365,6 +4811,23 @@ mach64_overlay_draw(svga_t *svga, int displine) default: break; } + switch (svga->bpp) { + case 8: + gfx_src = svga->vram[desktop_y * (svga->rowoffset * 8) + (desktop_x + x) * 1 + svga->memaddr_latch * 4]; + break; + case 15: + case 16: + gfx_src = *(uint16_t*)&svga->vram[desktop_y * (svga->rowoffset * 8) + (desktop_x + x) * 2 + svga->memaddr_latch * 4]; + break; + case 24: + gfx_src = svga->vram[desktop_y * (svga->rowoffset * 8) + (desktop_x + x) * 3 + svga->memaddr_latch * 4] + | (svga->vram[desktop_y * (svga->rowoffset * 8) + (desktop_x + x) * 3 + 1 + svga->memaddr_latch * 4] << 8) + | (svga->vram[desktop_y * (svga->rowoffset * 8) + (desktop_x + x) * 3 + 2 + svga->memaddr_latch * 4] << 16); + break; + case 32: + gfx_src = *(uint32_t*)&svga->vram[desktop_y * (svga->rowoffset * 8) + (desktop_x + x) * 4 + svga->memaddr_latch * 4]; + break; + } switch (graphics_key_fn) { case 0: gr_cmp = 0; @@ -4373,16 +4836,16 @@ mach64_overlay_draw(svga_t *svga, int displine) gr_cmp = 1; break; case 4: - gr_cmp = (((p[x]) ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); + gr_cmp = ((gfx_src ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); break; case 5: - gr_cmp = !(((p[x]) ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); + gr_cmp = !((gfx_src ^ mach64->overlay_graphics_key_clr) & mach64->overlay_graphics_key_msk & 0xffffff); break; default: break; } - vid_cmp = vid_cmp ? -1 : 0; + vid_cmp = vid_cmp ?-1 : 0; gr_cmp = gr_cmp ? -1 : 0; switch (overlay_cmp_mix) { @@ -4862,17 +5325,69 @@ mach64_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) } } +static void +mach64_disable_handlers(mach64_t *dev) +{ + mach64_io_remove(dev); + + mem_mapping_disable(&dev->linear_mapping); + mem_mapping_disable(&dev->linear_mapping_big_endian); + mem_mapping_disable(&dev->mmio_mapping); + mem_mapping_disable(&dev->mmio_linear_mapping); + mem_mapping_disable(&dev->mmio_linear_mapping_2); + mem_mapping_disable(&dev->svga.mapping); + if (dev->pci && !dev->on_board) + mem_mapping_disable(&dev->bios_rom.mapping); + + /* Save all the mappings and the timers because they are part of linked lists. */ + reset_state[dev->svga.monitor_index]->linear_mapping = dev->linear_mapping; + reset_state[dev->svga.monitor_index]->linear_mapping_big_endian = dev->linear_mapping_big_endian; + reset_state[dev->svga.monitor_index]->mmio_mapping = dev->mmio_mapping; + reset_state[dev->svga.monitor_index]->mmio_linear_mapping = dev->mmio_linear_mapping; + reset_state[dev->svga.monitor_index]->mmio_linear_mapping_2 = dev->mmio_linear_mapping_2; + reset_state[dev->svga.monitor_index]->svga.mapping = dev->svga.mapping; + reset_state[dev->svga.monitor_index]->bios_rom.mapping = dev->bios_rom.mapping; + + reset_state[dev->svga.monitor_index]->svga.timer = dev->svga.timer; + reset_state[dev->svga.monitor_index]->svga.timer_8514 = dev->svga.timer_8514; + reset_state[dev->svga.monitor_index]->svga.timer_xga = dev->svga.timer_xga; +} + +static void +mach64_reset(void *priv) +{ + mach64_t *dev = (mach64_t *) priv; + + if (reset_state[dev->svga.monitor_index] != NULL) { + mach64_disable_handlers(dev); + dev->blitter_busy = 0; + dev->fifo_write_idx = 0; + dev->fifo_read_idx = 0; + reset_state[dev->svga.monitor_index]->eeprom = dev->eeprom; + reset_state[dev->svga.monitor_index]->pci_slot = dev->pci_slot; + + *dev = *reset_state[dev->svga.monitor_index]; + mach64_io_set(dev); + memset(dev->svga.vram, 0, dev->svga.vram_max); + memset(dev->svga.changedvram, 0, (dev->svga.vram_max >> 12) + 1); + dev->svga.dpms = 1; + svga_recalctimings(&dev->svga); + dev->svga.dpms = 0; + } +} + static void * mach64_common_init(const device_t *info) { svga_t *svga; mach64_t *mach64 = malloc(sizeof(mach64_t)); memset(mach64, 0, sizeof(mach64_t)); + reset_state[monitor_index_global] = calloc(1, sizeof(mach64_t)); svga = &mach64->svga; mach64->type = info->local & 0xff; - mach64->vram_size = (mach64->type == MACH64_CT || mach64->type == MACH64_VT) ? 2 : ((info->local & (1 << 20)) ? 4 : device_get_config_int("memory")); + mach64->vram_size = (mach64->type == MACH64_CT || mach64->type == MACH64_VT || mach64->type == MACH64_VT3) ? 2 : ((info->local & (1 << 20)) ? 4 : device_get_config_int("memory")); mach64->vram_mask = (mach64->vram_size << 20) - 1; if (mach64->type > MACH64_GX) @@ -4920,8 +5435,13 @@ mach64_common_init(const device_t *info) mach64->on_board = !!(info->local & (1 << 19)); mach64->i2c = i2c_gpio_init("ddc_ati_mach64"); + mach64->i2c_tv = i2c_gpio_init("tv_ati_mach64"); mach64->ddc = ddc_init(i2c_gpio_get_bus(mach64->i2c)); +#ifdef DMA_BM + mach64->dma.lock = thread_create_mutex(); +#endif + return mach64; } @@ -4965,6 +5485,7 @@ mach64gx_init(const device_t *info) rom_init(&mach64->bios_rom, BIOS_ISA_ROM_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); } + *reset_state[monitor_index_global] = *mach64; return mach64; } static void * @@ -4998,6 +5519,7 @@ mach64ct_init(const device_t *info) svga->vblank_start = mach64_vblank_start; svga->adv_flags |= FLAG_PANNING_ATI; + *reset_state[monitor_index_global] = *mach64; return mach64; } static void * @@ -5030,6 +5552,7 @@ mach64vt_init(const device_t *info) svga->vblank_start = mach64_vblank_start; svga->adv_flags |= FLAG_PANNING_ATI; + *reset_state[monitor_index_global] = *mach64; return mach64; } static void * @@ -5062,6 +5585,37 @@ mach64vt2_init(const device_t *info) svga->vblank_start = mach64_vblank_start; svga->adv_flags |= FLAG_PANNING_ATI; + *reset_state[monitor_index_global] = *mach64; + return mach64; +} + +static void * +mach64vt3_onboard_init(const device_t *info) +{ + mach64_t *mach64 = mach64_common_init(info); + svga_t *svga = &mach64->svga; + + svga->dac_hwcursor_draw = NULL; + + svga->hwcursor.cur_ysize = 64; + svga->hwcursor.cur_xsize = 64; + + video_inform(VIDEO_FLAG_TYPE_SPECIAL, &timing_mach64_pci); + + mach64->pci = 1; + mach64->vlb = 0; + mach64->pci_id = 0x5655; + mach64->config_chip_id = 0x9A005655; + mach64->dac_cntl = 1 << 16; /*Internal 24-bit DAC*/ + mach64->config_stat0 = 4; + mach64->use_block_decoded_io = 4; + + mem_mapping_disable(&mach64->bios_rom.mapping); + + svga->vblank_start = mach64_vblank_start; + svga->adv_flags |= FLAG_PANNING_ATI; + + *reset_state[monitor_index_global] = *mach64; return mach64; } @@ -5101,17 +5655,25 @@ mach64_close(void *priv) { mach64_t *mach64 = (mach64_t *) priv; +#ifdef DMA_BM + mach64->dma.state = 0; +#endif mach64->thread_run = 0; thread_set_event(mach64->wake_fifo_thread); thread_wait(mach64->fifo_thread); thread_destroy_event(mach64->fifo_not_full_event); thread_destroy_event(mach64->wake_fifo_thread); +#ifdef DMA_BM + thread_close_mutex(mach64->dma.lock); +#endif svga_close(&mach64->svga); ddc_close(mach64->ddc); i2c_gpio_close(mach64->i2c); + i2c_gpio_close(mach64->i2c_tv); + free(reset_state[mach64->svga.monitor_index]); free(mach64); } @@ -5269,3 +5831,17 @@ const device_t mach64vt2_device = { .force_redraw = mach64_force_redraw, .config = mach64vt2_config }; + +const device_t mach64vt3_onboard_device = { + .name = "ATI Mach64VT3 (Onboard)", + .internal_name = "mach64vt3_onboard", + .flags = DEVICE_PCI, + .local = MACH64_VT3 | (1 << 19), + .init = mach64vt3_onboard_init, + .close = mach64_close, + .reset = mach64_reset, + .available = NULL, + .speed_changed = mach64_speed_changed, + .force_redraw = mach64_force_redraw, + .config = NULL +}; diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index cc3841750e4..453fdffb92b 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -2727,7 +2727,7 @@ s3_trio64v_colorkey(s3_t* s3, uint32_t x, uint32_t y) uint8_t shift = ((s3->streams.chroma_ctrl >> 24) & 7) ^ 7; bool is15bpp = false; - uint32_t base_addr = svga->memaddr_latch; + uint32_t base_addr = svga->memaddr_latch << 2; uint32_t stride = s3->streams.pri_stride; if (!s3->color_key_enabled) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index e9da4b412f8..7862c25acc6 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -4842,7 +4842,7 @@ s3_virge_colorkey(virge_t* virge, uint32_t x, uint32_t y) uint8_t shift = ((virge->streams.chroma_ctrl >> 24) & 7) ^ 7; bool is15bpp = false; - uint32_t base_addr = svga->memaddr_latch; + uint32_t base_addr = svga->memaddr_latch << 2; uint32_t stride = (virge->chip < S3_VIRGEGX2) ? virge->streams.pri_stride : (svga->rowoffset << 3); bool color_key = false; From 390a211bb7fa2bc4e5f58785c431281a153187c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Wed, 3 Dec 2025 18:23:03 +0000 Subject: [PATCH 009/320] Translated using Weblate (Czech) Currently translated at 100.0% (1011 of 1011 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/cs/ --- src/qt/languages/cs-CZ.po | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 5611694c728..0a1ff9f5270 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -1,8 +1,14 @@ msgid "" msgstr "" +"PO-Revision-Date: 2025-12-04 18:56+0000\n" +"Last-Translator: David Hrdlička \n" +"Language-Team: Czech \n" +"Language: cs-CZ\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 2;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: cs_CZ\n" "X-Source-Language: en_US\n" @@ -1936,13 +1942,13 @@ msgid "BIOS address" msgstr "Adresa BIOS" msgid "BIOS address (ROM #1)" -msgstr "Adresa BIOS (ROM 4)" +msgstr "Adresa BIOS (ROM 1)" msgid "BIOS address (ROM #2)" -msgstr "Adresa BIOS (ROM 4)" +msgstr "Adresa BIOS (ROM 2)" msgid "BIOS address (ROM #3)" -msgstr "Adresa BIOS (ROM 4)" +msgstr "Adresa BIOS (ROM 3)" msgid "BIOS address (ROM #4)" msgstr "Adresa BIOS (ROM 4)" @@ -2212,16 +2218,16 @@ msgid "WSS DMA" msgstr "DMA kanál WSS" msgid "RTC IRQ" -msgstr "" +msgstr "IRQ hodin reálného času" msgid "RTC Port Address" -msgstr "" +msgstr "Adresa portu hodin reálného času" msgid "Onboard RTC" -msgstr "" +msgstr "Integrované hodiny reálného času" msgid "Not installed" -msgstr "" +msgstr "Nenainstalováno" msgid "Enable OPL" msgstr "Povolit OPL" @@ -2539,7 +2545,7 @@ msgid "Has secondary 8x8 character set" msgstr "Má druhou sadu 8x8 znaků" msgid "Has Quadcolor II daughter board" -msgstr "Má dceřinnou desků Quadcolor II" +msgstr "Má dceřinnou desku Quadcolor II" msgid "Alternate monochrome contrast" msgstr "Alternativní monochromatický kontrast" @@ -2845,7 +2851,7 @@ msgid "Toggle fullscreen" msgstr "Přepnout režim celé obrazovky" msgid "Toggle UI in fullscreen" -msgstr "" +msgstr "Přepnout rozhraní při celé obrazovce" msgid "Screenshot" msgstr "Pořídit snímek obrazovky" From 3299ad8df59c9d1a49dd2e9eb58e45828fe74cd9 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 4 Dec 2025 04:30:54 +0000 Subject: [PATCH 010/320] Translated using Weblate (French) Currently translated at 100.0% (1011 of 1011 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/fr/ --- src/qt/languages/fr-FR.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index d51553ba6f8..026b53fa301 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2025-11-29 00:34+0000\n" -"Last-Translator: OBattler \n" +"PO-Revision-Date: 2025-12-04 18:56+0000\n" +"Last-Translator: Alexander Babikov \n" "Language-Team: French \n" "Language: fr-FR\n" "MIME-Version: 1.0\n" @@ -2776,7 +2776,7 @@ msgid "Model" msgstr "Modèle" msgid "Model:" -msgstr "Modèle:" +msgstr "Modèle :" msgid "Failed to initialize Vulkan renderer." msgstr "Impossible d’initialiser le moteur de rendu Vulkan." From 7369cbc134dbe727fbe8cf070cc049094ab47fa8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Thu, 4 Dec 2025 20:10:12 -0300 Subject: [PATCH 011/320] Jenkins: Remove forcedir hack, no longer required after all the download front-end changes --- .ci/Jenkinsfile | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.ci/Jenkinsfile b/.ci/Jenkinsfile index 94070569e3d..cc3e415cd43 100644 --- a/.ci/Jenkinsfile +++ b/.ci/Jenkinsfile @@ -281,16 +281,12 @@ pipeline { dir(dynarecNames[dynarec]) { dir("$os - $archName") { ret = runBuild("-b \"$packageName\" \"$arch\" ${presetFlags[preset]} ${dynarecFlags[dynarec]} ${osFlags[os]} $buildFlags") - if (presets.size() == 1) - writeFile file: '.forcedir', text: '' } - if ((osArchs.size() == 1) && (thisOsArchs.size() == 1)) - writeFile file: '.forcedir', text: '' } if (ret == 0) { /* Archive resulting artifacts. */ - archiveArtifacts artifacts: "**/$packageName*, **/.forcedir", defaultExcludes: false + archiveArtifacts artifacts: "**/$packageName*", defaultExcludes: false } else { /* Fail this stage. */ failStage() From 3feb0f135dc609be4a111f26f2dc2cdd8b4170f4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 5 Dec 2025 14:18:17 +0100 Subject: [PATCH 012/320] Add toolbar button and Action menu item to toggle forcing the recompiler to interpret blocks, should help with some slowdowns (tested to help with Daggerfall on both recompilers and Legend of Hero III on new recompiler). --- src/cpu/386_dynarec.c | 3 ++- src/cpu/cpu.h | 2 ++ src/cpu/x86.c | 2 ++ src/include/86box/ui.h | 2 ++ src/qt/languages/86box.pot | 12 ++++++++++++ src/qt/languages/cs-CZ.po | 12 ++++++++++++ src/qt/languages/de-DE.po | 12 ++++++++++++ src/qt/languages/es-ES.po | 12 ++++++++++++ src/qt/languages/fi-FI.po | 12 ++++++++++++ src/qt/languages/fr-FR.po | 12 ++++++++++++ src/qt/languages/hr-HR.po | 12 ++++++++++++ src/qt/languages/it-IT.po | 12 ++++++++++++ src/qt/languages/ja-JP.po | 12 ++++++++++++ src/qt/languages/ko-KR.po | 12 ++++++++++++ src/qt/languages/nb-NO.po | 12 ++++++++++++ src/qt/languages/nl-NL.po | 12 ++++++++++++ src/qt/languages/pl-PL.po | 12 ++++++++++++ src/qt/languages/pt-BR.po | 12 ++++++++++++ src/qt/languages/pt-PT.po | 12 ++++++++++++ src/qt/languages/ru-RU.po | 12 ++++++++++++ src/qt/languages/sk-SK.po | 12 ++++++++++++ src/qt/languages/sl-SI.po | 12 ++++++++++++ src/qt/languages/sv-SE.po | 12 ++++++++++++ src/qt/languages/tr-TR.po | 12 ++++++++++++ src/qt/languages/uk-UA.po | 12 ++++++++++++ src/qt/languages/vi-VN.po | 12 ++++++++++++ src/qt/qt_mainwindow.cpp | 37 +++++++++++++++++++++++++++++++++++++ src/qt/qt_mainwindow.hpp | 2 ++ src/qt/qt_mainwindow.ui | 12 ++++++++++++ src/qt_resources.qrc | 2 ++ src/unix/unix.c | 6 ++++++ 31 files changed, 331 insertions(+), 1 deletion(-) diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index ff729e4cfe4..852c25427f4 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -51,6 +51,7 @@ #define CPU_BLOCK_END() cpu_block_end = 1 +int cpu_force_interpreter = 0; int cpu_override_dynarec = 0; int inrecomp = 0; int cpu_block_end = 0; @@ -778,7 +779,7 @@ exec386_dynarec(int32_t cycs) cycles_old = cycles; oldtsc = tsc; tsc_old = tsc; - if ((!CACHE_ON()) || cpu_override_dynarec) /*Interpret block*/ + if (cpu_force_interpreter || cpu_override_dynarec || (!CACHE_ON())) /*Interpret block*/ { exec386_dynarec_int(); } else { diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 9f6ce23cccf..25564082b8c 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -823,6 +823,8 @@ extern MMX_REG *MMP[8]; extern uint16_t *MMEP[8]; extern int cpu_block_end; + +extern int cpu_force_interpreter; extern int cpu_override_dynarec; extern void mmx_init(void); diff --git a/src/cpu/x86.c b/src/cpu/x86.c index 1090f22a135..38e50a48872 100644 --- a/src/cpu/x86.c +++ b/src/cpu/x86.c @@ -373,6 +373,8 @@ reset_common(int hard) in_lock = 0; cpu_cpurst_on_sr = 0; + + cpu_force_interpreter = 0; } /* Hard reset. */ diff --git a/src/include/86box/ui.h b/src/include/86box/ui.h index 9bfae43304b..08719cc2b0b 100644 --- a/src/include/86box/ui.h +++ b/src/include/86box/ui.h @@ -71,6 +71,8 @@ extern void ui_sb_set_text(char *str); extern void ui_sb_bugui(char *str); extern void ui_sb_mt32lcd(char *str); +extern void ui_update_force_interpreter(void); + #ifdef __cplusplus } #endif diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index 8bedf31f846..f2689b6e148 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -3038,3 +3038,15 @@ msgstr "" msgid "Search:" msgstr "" + +msgid "Force interpretation" +msgstr "" + +msgid "Allow recompilation" +msgstr "" + +msgid "&Force interpretation" +msgstr "" + +msgid "&Allow recompilation" +msgstr "" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 0a1ff9f5270..4b5c1648182 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -3044,3 +3044,15 @@ msgstr "Tmavé" msgid "Search:" msgstr "Hledat:" + +msgid "Force interpretation" +msgstr "Vynutit interpretaci" + +msgid "Allow recompilation" +msgstr "Povolit rekompilaci" + +msgid "&Force interpretation" +msgstr "&Vynutit interpretaci" + +msgid "&Allow recompilation" +msgstr "&Povolit rekompilaci" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 3e23d868263..69b778eda03 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -3044,3 +3044,15 @@ msgstr "Dunkel" msgid "Search:" msgstr "Suche:" + +msgid "Force interpretation" +msgstr "Erzwingen der Interpretation" + +msgid "Allow recompilation" +msgstr "Recompilierung zulassen" + +msgid "&Force interpretation" +msgstr "&Erzwingen der Interpretation" + +msgid "&Allow recompilation" +msgstr "Recompilierung &zulassen" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index a365d62aa5e..b99343d593b 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -3044,3 +3044,15 @@ msgstr "Oscuro" msgid "Search:" msgstr "Buscar:" + +msgid "Force interpretation" +msgstr "Forzar interpretación" + +msgid "Allow recompilation" +msgstr "Permitir recompilación" + +msgid "&Force interpretation" +msgstr "&Forzar interpretación" + +msgid "&Allow recompilation" +msgstr "&Permitir recompilación" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index ce6d6bab449..0409680eca9 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -3038,3 +3038,15 @@ msgstr "Tumma" msgid "Search:" msgstr "Hae:" + +msgid "Force interpretation" +msgstr "Pakota tulkinta" + +msgid "Allow recompilation" +msgstr "Salli uudelleenkompilointi" + +msgid "&Force interpretation" +msgstr "&Pakota tulkinta" + +msgid "&Allow recompilation" +msgstr "&Salli uudelleenkompilointi" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 026b53fa301..6c9175ec9c7 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -3044,3 +3044,15 @@ msgstr "Sombre" msgid "Search:" msgstr "Rechercher :" + +msgid "Force interpretation" +msgstr "Forcer l'interprétation" + +msgid "Allow recompilation" +msgstr "Permettre la recompilation" + +msgid "&Force interpretation" +msgstr "&Forcer l'interprétation" + +msgid "&Allow recompilation" +msgstr "&Permettre la recompilation" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index ee6c238b9b6..3f14ed6e802 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -3046,3 +3046,15 @@ msgstr "Tamno" msgid "Search:" msgstr "Pretrag:" + +msgid "Force interpretation" +msgstr "Prisilna interpretacija" + +msgid "Allow recompilation" +msgstr "Omogući rekompilaciju" + +msgid "&Force interpretation" +msgstr "&Prisilna interpretacija" + +msgid "&Allow recompilation" +msgstr "&Omogući rekompilaciju" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 533377b465a..2e9e34d6128 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -3044,3 +3044,15 @@ msgstr "Scura" msgid "Search:" msgstr "Cerca:" + +msgid "Force interpretation" +msgstr "Forza interpretazione" + +msgid "Allow recompilation" +msgstr "Permetti ricompilazione" + +msgid "&Force interpretation" +msgstr "&Forza interpretazione" + +msgid "&Allow recompilation" +msgstr "&Permetti ricompilazione" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 8d117f34903..ef3edd21dbb 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -3045,3 +3045,15 @@ msgstr "暗闇" msgid "Search:" msgstr "検索:" + +msgid "Force interpretation" +msgstr "解釈を強制する" + +msgid "Allow recompilation" +msgstr "再コンパイルを許可する" + +msgid "&Force interpretation" +msgstr "解釈を強制する(&F)" + +msgid "&Allow recompilation" +msgstr "再コンパイルを許可する(&A)" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 4994e8e6699..ab068684242 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -3038,3 +3038,15 @@ msgstr "어둠" msgid "Search:" msgstr "검색:" + +msgid "Force interpretation" +msgstr "강제 해석" + +msgid "Allow recompilation" +msgstr "재컴파일 허용" + +msgid "&Force interpretation" +msgstr "강제 해석(&F)" + +msgid "&Allow recompilation" +msgstr "재컴파일 허용(&A)" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index 395a56dc9c8..04f605d2805 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -3038,3 +3038,15 @@ msgstr "Mørk" msgid "Search:" msgstr "Søk:" + +msgid "Force interpretation" +msgstr "Tving tolkning" + +msgid "Allow recompilation" +msgstr "Tillat rekompilering" + +msgid "&Force interpretation" +msgstr "&Tving tolkning" + +msgid "&Allow recompilation" +msgstr "&Tillat rekompilering" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index b62014ee72b..1c536976889 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -3038,3 +3038,15 @@ msgstr "Donker" msgid "Search:" msgstr "Zoeken:" + +msgid "Force interpretation" +msgstr "Interpretatie afdwingen" + +msgid "Allow recompilation" +msgstr "Recompilatie toestaan" + +msgid "&Force interpretation" +msgstr "Interpretatie &afdwingen" + +msgid "&Allow recompilation" +msgstr "Recompilatie &toestaan" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index ae47844c256..f861392aeb6 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -3045,3 +3045,15 @@ msgstr "Ciemny" msgid "Search:" msgstr "Szukanie:" + +msgid "Force interpretation" +msgstr "Wymuś interpretację" + +msgid "Allow recompilation" +msgstr "Zezwól na rekompilację" + +msgid "&Force interpretation" +msgstr "&Wymuś interpretację" + +msgid "&Allow recompilation" +msgstr "&Zezwól na rekompilację" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index d8fddc787fa..c263bc02bfd 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -3038,3 +3038,15 @@ msgstr "Escuro" msgid "Search:" msgstr "Pesquisar:" + +msgid "Force interpretation" +msgstr "Forçar interpretação" + +msgid "Allow recompilation" +msgstr "Permitir recompilação" + +msgid "&Force interpretation" +msgstr "&Forçar interpretação" + +msgid "&Allow recompilation" +msgstr "&Permitir recompilação" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 177ef25f62f..de0623bec43 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -3045,3 +3045,15 @@ msgstr "Escuro" msgid "Search:" msgstr "Procurar:" + +msgid "Force interpretation" +msgstr "Forçar interpretação" + +msgid "Allow recompilation" +msgstr "Permitir recompilação" + +msgid "&Force interpretation" +msgstr "&Forçar interpretação" + +msgid "&Allow recompilation" +msgstr "&Permitir recompilação" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 0b20956e747..ceaa7b4b8e9 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -3038,3 +3038,15 @@ msgstr "Тёмная" msgid "Search:" msgstr "Поиск:" + +msgid "Force interpretation" +msgstr "Принудительная интерпретация" + +msgid "Allow recompilation" +msgstr "Разрешить рекомпиляцию" + +msgid "&Force interpretation" +msgstr "&Принудительная интерпретация" + +msgid "&Allow recompilation" +msgstr "&Разрешить рекомпиляцию" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 5f84e59fe84..8e41931ee6b 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -3044,3 +3044,15 @@ msgstr "Tmavá" msgid "Search:" msgstr "Hľadať:" + +msgid "Force interpretation" +msgstr "Vynútiť interpretáciu" + +msgid "Allow recompilation" +msgstr "Povoliť rekompiláciu" + +msgid "&Force interpretation" +msgstr "&Vynútiť interpretáciu" + +msgid "&Allow recompilation" +msgstr "&Povoliť rekompiláciu" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index b654c988967..ca7a3e17b6f 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -3046,3 +3046,15 @@ msgstr "Temno" msgid "Search:" msgstr "Išči:" + +msgid "Force interpretation" +msgstr "Vsili interpretacijo" + +msgid "Allow recompilation" +msgstr "Dovoli prevajanje" + +msgid "&Force interpretation" +msgstr "&Vsili interpretacijo" + +msgid "&Allow recompilation" +msgstr "&Dovoli prevajanje" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index ff0774bed8e..a153443f20f 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -3038,3 +3038,15 @@ msgstr "Mörk" msgid "Search:" msgstr "Sök:" + +msgid "Force interpretation" +msgstr "Tvinga tolkning" + +msgid "Allow recompilation" +msgstr "Tillåt omkompilering" + +msgid "&Force interpretation" +msgstr "&Tvinga tolkning" + +msgid "&Allow recompilation" +msgstr "&Tillåt omkompilering" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 02bf881a59d..ac4f83acfec 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -3038,3 +3038,15 @@ msgstr "Karanlık" msgid "Search:" msgstr "Ara:" + +msgid "Force interpretation" +msgstr "Yorumlanmasını zorla" + +msgid "Allow recompilation" +msgstr "Derlenmesine izin ver" + +msgid "&Force interpretation" +msgstr "&Yorumlanmasını zorla" + +msgid "&Allow recompilation" +msgstr "&Derlenmesine izin ver" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index e98da1f0c76..b29619ae136 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -3046,3 +3046,15 @@ msgstr "Темний" msgid "Search:" msgstr "Пошук:" + +msgid "Force interpretation" +msgstr "Примусове тлумачення" + +msgid "Allow recompilation" +msgstr "Дозволити рекомпіляцію" + +msgid "&Force interpretation" +msgstr "&Примусове тлумачення" + +msgid "&Allow recompilation" +msgstr "&Дозволити рекомпіляцію" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 09d5defa3d3..ac374e389be 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -3038,3 +3038,15 @@ msgstr "Tối" msgid "Search:" msgstr "Tìm:" + +msgid "Force interpretation" +msgstr "Buộc giải thích" + +msgid "Allow recompilation" +msgstr "Cho phép biên dịch lại" + +msgid "&Force interpretation" +msgstr "&Buộc giải thích" + +msgid "&Allow recompilation" +msgstr "&Cho phép biên dịch lại" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 083f0761aa1..df323986e44 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -164,6 +164,8 @@ keyb_filter(BMessage *message, BHandler **target, BMessageFilter *filter) static BMessageFilter *filter; #endif +extern int cpu_force_interpreter; + extern void qt_mouse_capture(int); extern "C" void qt_blit(int x, int y, int w, int h, int monitor_index); @@ -278,8 +280,24 @@ MainWindow::MainWindow(QWidget *parent) vmname.truncate(vmname.size() - 1); this->setWindowTitle(QString("%1 - %2 %3").arg(vmname, EMU_NAME, EMU_VERSION_FULL)); + connect(this, &MainWindow::forceInterpretationCompleted, this, [this]() { + const auto fi_icon = cpu_force_interpreter ? QIcon(":/menuicons/qt/icons/recompiler.ico") : + QIcon(":/menuicons/qt/icons/interpreter.ico"); + const auto tooltip_text = cpu_force_interpreter ? QString(tr("Allow recompilation")) : + QString(tr("Force interpretation")); + const auto menu_text = cpu_force_interpreter ? QString(tr("&Allow recompilation")) : + QString(tr("&Force interpretation")); + + ui->actionForce_interpretation->setIcon(fi_icon); + ui->actionForce_interpretation->setToolTip(tooltip_text); + ui->actionForce_interpretation->setText(menu_text); + ui->actionForce_interpretation->setChecked(cpu_force_interpreter); + ui->actionForce_interpretation->setEnabled(cpu_use_dynarec); + }); + connect(this, &MainWindow::hardResetCompleted, this, [this]() { ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA)); + ui_update_force_interpreter(); num_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD)); scroll_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD)); caps_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD)); @@ -968,6 +986,12 @@ MainWindow::closeEvent(QCloseEvent *event) event->accept(); } +void +ui_update_force_interpreter() +{ + emit main_window->forceInterpretationCompleted(); +} + void MainWindow::updateShortcuts() { @@ -986,6 +1010,7 @@ MainWindow::updateShortcuts() ui->actionHard_Reset->setShortcut(QKeySequence()); ui->actionPause->setShortcut(QKeySequence()); ui->actionMute_Unmute->setShortcut(QKeySequence()); + ui->actionForce_interpretation->setShortcut(QKeySequence()); int accID; QKeySequence seq; @@ -1017,6 +1042,10 @@ MainWindow::updateShortcuts() accID = FindAccelerator("mute"); seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionMute_Unmute->setShortcut(seq); + + accID = FindAccelerator("force_interpretation"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionForce_interpretation->setShortcut(seq); } void @@ -1600,6 +1629,7 @@ MainWindow::refreshMediaMenu() status->refresh(ui->statusbar); ui->actionMCA_devices->setVisible(machine_has_bus(machine, MACHINE_BUS_MCA)); ui->actionACPI_Shutdown->setEnabled(!!acpi_enabled); + ui_update_force_interpreter(); num_label->setToolTip(QShortcut::tr("Num Lock")); num_label->setVisible(machine_has_bus(machine, MACHINE_BUS_PS2_PORTS | MACHINE_BUS_AT_KBD)); @@ -1788,6 +1818,13 @@ MainWindow::on_actionInverted_VGA_monitor_triggered() video_toggle_option(ui->actionInverted_VGA_monitor, &invert_display); } +void +MainWindow::on_actionForce_interpretation_triggered() +{ + cpu_force_interpreter ^= 1; + ui_update_force_interpreter(); +} + static void update_scaled_checkboxes(Ui::MainWindow *ui, QAction *selected) { diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 1a1cf4f2037..a3190076786 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -58,6 +58,7 @@ class MainWindow : public QMainWindow { void destroyRendererMonitor(int monitor_index); void initRendererMonitorForNonQtThread(int monitor_index); void destroyRendererMonitorForNonQtThread(int monitor_index); + void forceInterpretationCompleted(); void hardResetCompleted(); void setTitle(const QString &title); @@ -79,6 +80,7 @@ public slots: void updateStatusEmptyIcons(); void updateUiPauseState(); private slots: + void on_actionForce_interpretation_triggered(); void on_actionFullscreen_triggered(); void on_actionSettings_triggered(); void on_actionExit_triggered(); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 45c4f70ae08..5b5265b4282 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -70,6 +70,8 @@ + + @@ -292,6 +294,8 @@ false + + @@ -302,6 +306,14 @@ + + + true + + + &Force interpretation + + true diff --git a/src/qt_resources.qrc b/src/qt_resources.qrc index 78153d3ff80..e68c4e2da1a 100644 --- a/src/qt_resources.qrc +++ b/src/qt_resources.qrc @@ -68,6 +68,8 @@ qt/icons/send_cad.ico qt/icons/send_cae.ico qt/icons/settings.ico + qt/icons/interpreter.ico + qt/icons/recompiler.ico qt/icons/warning.ico diff --git a/src/unix/unix.c b/src/unix/unix.c index ce644cac686..ee92bddcb1e 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -1731,3 +1731,9 @@ ui_hard_reset_completed(void) { /* No-op. */ } + +void +ui_update_force_interpreter(void) +{ + /* No-op. */ +} From 195e80c9c17dc69a78042ca2220c8dbdf2be8ede Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 5 Dec 2025 14:49:31 +0100 Subject: [PATCH 013/320] Forgot the missing icons. --- src/qt/icons/interpreter.ico | Bin 0 -> 9622 bytes src/qt/icons/recompiler.ico | Bin 0 -> 9622 bytes 2 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/qt/icons/interpreter.ico create mode 100644 src/qt/icons/recompiler.ico diff --git a/src/qt/icons/interpreter.ico b/src/qt/icons/interpreter.ico new file mode 100644 index 0000000000000000000000000000000000000000..75add61f062d24fd1686ea220ad7df99c236789b GIT binary patch literal 9622 zcmd6tv2G(b5Qaz4Ax3a6uDIelD_zO}egI#U=MY>3d58cOkRmDX5nQB5b#=;=?%et* zQaFIq_`u9B>Dx?rB$vA@2O+Q?k~{PL|4_2DFl@H6SN7(OdED6dugtzRv$t;#>)*aG z`{;Y`-W}FIe`)sJYqQPfu>RHS{_xzdy~d|bIP80{_g*(PuCK3CDM$Oi+};-N#eC%i zhVu98vD#2$FcgnwJHPAf(qF|X$Rultl9FH(BAOzG|{rR{l2n^j7?wO@+Ix%PBVIm%Uy zYV|qeA2<8Y8+~4BeDKex-cjo-o1PdUySm@mN_W5)jSdC8l4uQ6NaCzklC730{urvLh!iymq`FB#4(GGW24 z`HUK3aS~H*G3l6d6({s9g!6V{LYt30Jk~1YnpRrE+E#{{` zQ+oa>r6>Omdi3w2hxJvuvzxTF`?Rr(w6iO}6c2Ol>7H_ws~XjcA(pfR6_IX!XRF@5o03X0Mj& z(4Z#g#&+CePOz~a&yhckJIF5aw!5;Z} z9OEm$)kn_D*FAhR=tFVLH#)uiT;sps_iE5fE9y1ieBe$wr!ltfiz}w)Q475iW9KxFN4jSm=fqlH3BDVUD`glO|R9?iz z1I%1Eu3i5m?*}y14<4dUYc3C})4=m#)&CRC$Y^Qi_q=Y_IV|bB>_hhBY`7(R!h2ek3h>tV|I zOFP$;E(2|?rQhSBSKpDoKdi?hy(^D-O{cW) zWs~~O{VX{LX~Pp|O5fBG>0N8)rGDA-v_*ZROPq2J(vEdY`i4WKcdePz^U>o;`$m`8 zItR~rvA)qK(!180vsNVMC1X5?sH6Qk9`^riQ20lMPrLQi^UiLb%~qgpY<+W+%I;U69T1~UfQhX4Qo literal 0 HcmV?d00001 diff --git a/src/qt/icons/recompiler.ico b/src/qt/icons/recompiler.ico new file mode 100644 index 0000000000000000000000000000000000000000..c00853f2c31e0e00a5078a6ef260638de398e462 GIT binary patch literal 9622 zcmcIqJ#QOF5FLU>gdi$hxNs+?a~VKCK(6vT2o;8ZgJD1fQpBZyf{GNWQYT$Xb!t`k zH>6MixskD+x8x(<4R`l$`EkHuc6Mjpdo#N{9tfJv?1jC2X>J$x{)O4EX7=jU+W-3p zv%h@q_3O3&=|{77Kbb8SYyVHr`_E(Fc#aPpVLk80-g@5Hb$xxEN->!K~7%@Kj!adj%VlZAUwRo=fJoj#MICgX}hgNtM1L;K_ z%!3WQ8_KO|>S*w80XBmj9o~beHRhwQX(7b!hlrgV3f((*i|#Vn=O z+;7;;7;{)d3}TUkTs&v|ag(1ncwXW9?9ZsFS4k6c2Yr|d=5e7{lb=74LUrYy@@#I- z0^_IZ9OzOko-scoQ?Q!4h(#;su7*9Ti&(T3olRZ*91|n@1)WV@F+cj?Dd^nU$C{oJ z-UgHVo-N{tp_ch-bzR3&``|l6V-!cn8pE;R*Jz1R^En@|a{o|x#3Wv{#DR4z z-P0|WFYM@yIFV0uDJG;1&UwsJJsbyJz|gCylNhuOU5bhEsLl~x5wEGULs!Jz(dj*n zJ&!ppUv+BS80NSCQ+obAr6>Omdi3w2hxt{yvzxTE`?Ro&w6ZI|Vb^2KVGS{eMGkU- z0W5rP`75;j;y1symi{i?d*!oRNE-C5us(Gv^riS*n~J4zsypwAepckX>|4h`w_?j@ zWgqOOZer8!QOBrmV$(XulsdX}6PtEI9o@Q#OmgJ)2Cw&hR^=D_@Jrrkgy}tCnjus~r2_kL3t{?td$ux~Vn#oTm-g`T2rI)i{V3 zE%DSkwx0DZw!>HJh`2Q!qFXs2UC(Q^4%HdQK{qhb=I>bN>DFfHUz_{8*KBjo{he%<*ARnPo%64_o1f%L6a; zwFEKfcPZdVbD_USdv6<)r*-GO*Jqua+f(&nP`7f+v+5Mw&AQ1=dxAcU)=h3&*KmwJ zbk$96+9UL#yKZvR?%9Wf>Lxes9(_2tZgSI3>_b=G`26W-F#6=CozRD_x+7oo$*Z=~ zhpxJb7x|*kxM&M~=&GA|kuUm;E7?LHpkc6|r97RBe9_m~(pdVCzju&dimT0$Pi-x> zHm@3v!QYD^{P_&_^mr0&Sy)dzCaY)9Qu z$H9H*tUK}_)Q1D=jyk&gaA4h$zpD>NtUKx$?Zc7lj{MC&oUrbwW2X=P?147S$JkT& z+6TqoS3~}@LE(=I-&XUh=at<&ncY8{T|Agw-kF^(&CVD8lfueu?l){6V{Ykdh(RoJ PkP8f8+d#Vr literal 0 HcmV?d00001 From e57ab1ec6de6f6cd935c83e356146c4bd99ad471 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 5 Dec 2025 15:04:14 +0100 Subject: [PATCH 014/320] Added the key bind for the new toolbar button, defaults to Ctrl+Alt+I. --- src/86box.c | 5 +++++ src/include/86box/86box.h | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/86box.c b/src/86box.c index 020cb609022..ba42fb7486c 100644 --- a/src/86box.c +++ b/src/86box.c @@ -293,6 +293,11 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { .name="mute", .desc="Toggle mute", .seq="Ctrl+Alt+M" + }, + { + .name="force_interpretation", + .desc="Force interpretation", + .seq="Ctrl+Alt+I" } }; diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 12eb5dbb5b6..67ba5ec1bae 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -330,7 +330,7 @@ struct accelKey { char desc[64]; char seq[64]; }; -#define NUM_ACCELS 9 +#define NUM_ACCELS 10 extern struct accelKey acc_keys[NUM_ACCELS]; extern struct accelKey def_acc_keys[NUM_ACCELS]; extern int FindAccelerator(const char *name); From d9ea5b59b7e05e0070f0138295271af9fb7f8d5c Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 11:56:03 +0000 Subject: [PATCH 015/320] Translated using Weblate (Russian) Currently translated at 100.0% (1015 of 1015 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/ru/ --- src/qt/languages/ru-RU.po | 47 +++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 14 deletions(-) diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index ceaa7b4b8e9..d01f41a0964 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -1,8 +1,15 @@ msgid "" msgstr "" +"PO-Revision-Date: 2025-12-06 18:56+0000\n" +"Last-Translator: Alexander Babikov \n" +"Language-Team: Russian \n" +"Language: ru-RU\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: ru_RU\n" "X-Source-Language: en_US\n" @@ -136,7 +143,7 @@ msgid "&Integer scale" msgstr "&Целочисленное масштабирование" msgid "4:&3 Integer scale" -msgstr "4:&3 Целочисленное масштабирование" +msgstr "4:&3 целочисленное масштабирование" msgid "EGA/(S)&VGA settings" msgstr "Настройки EGA/(S)&VGA" @@ -211,7 +218,7 @@ msgid "&Preferences..." msgstr "&Параметры..." msgid "Enable &Discord integration" -msgstr "Включить интеграцию &Discord" +msgstr "Включить интеграцию с &Discord" msgid "Sound &gain..." msgstr "&Усиление звука..." @@ -238,7 +245,7 @@ msgid "&Existing image..." msgstr "&Выбрать образ..." msgid "Existing image (&Write-protected)..." -msgstr "Выбрать образ (&Защита от записи)..." +msgstr "Выбрать образ (с &защитой от записи)..." msgid "&Record" msgstr "&Запись" @@ -517,7 +524,7 @@ msgid "Parallel port 4" msgstr "Параллельный порт LPT4" msgid "FD Controller:" -msgstr "Контроллер FD:" +msgstr "Контроллер дисководов:" msgid "CD-ROM Controller:" msgstr "Контроллер CD-ROM:" @@ -547,7 +554,7 @@ msgid "Controller 4:" msgstr "Контроллер 4:" msgid "Cassette" -msgstr "Кассета" +msgstr "Кассетный магнитофон" msgid "Hard disks:" msgstr "Жёсткие диски:" @@ -706,7 +713,7 @@ msgid "Basic sector images" msgstr "Простые посекторные образы" msgid "Surface images" -msgstr "Surface образы" +msgstr "Образы поверхности" msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." msgstr "Системная плата «%hs» недоступна из-за отсутствия файла её ПЗУ в каталоге roms/machines. Переключение на доступную системную плату." @@ -1009,7 +1016,7 @@ msgid "No ROMs found" msgstr "ПЗУ не найдены" msgid "Do you want to save the settings?" -msgstr "Хотите ли вы сохранить настройки?" +msgstr "Вы хотите сохранить настройки?" msgid "This will hard reset the emulated machine." msgstr "Это приведёт к холодной перезагрузке эмулируемой машины." @@ -1021,7 +1028,19 @@ msgid "About %1" msgstr "О %1" msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." -msgstr "Эмулятор старых компьютеров\n\nАвторы: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nС предыдущими основными материалами от Sarah Walker, leilei, JohnElliott, greatpsycho и других.\n\nВыпускается под лицензией GNU General Public License версии 2 или более поздней. Дополнительную информацию см. в файле LICENSE." +msgstr "" +"Эмулятор старых компьютеров\n" +"\n" +"Авторы: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, " +"coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin " +"(elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen " +"(waltje), Tiseno100, reenigne, и другие.\n" +"\n" +"С предыдущими основными материалами от Sarah Walker, leilei, JohnElliott, " +"greatpsycho и других.\n" +"\n" +"Выпускается под лицензией GNU General Public License версии 2 или более " +"поздней. Дополнительную информацию см. в файле LICENSE." msgid "Hardware not available" msgstr "Оборудование недоступно" @@ -1195,7 +1214,7 @@ msgid "Use existing configuration" msgstr "Использовать существующую конфигурацию" msgid "Type some notes here" -msgstr "Введите здесь несколько заметок" +msgstr "Введите заметки" msgid "Paste the contents of the existing configuration file into the box below." msgstr "Вставьте содержимое существующего файла конфигурации в поле ниже." @@ -1222,13 +1241,13 @@ msgid "Directory does not exist" msgstr "Папка не существует" msgid "A new directory for the system will be created in the selected directory above" -msgstr "Новая папка для системы будет создана в выбранной папке выше" +msgstr "Новая папка для системы будет создана в указанной выше папке" msgid "System location:" msgstr "Расположение системы:" msgid "System name and location" -msgstr "Название системы и расположение" +msgstr "Название системы и её расположение" msgid "Enter the name of the system and choose the location" msgstr "Введите название системы и выберите расположение" @@ -1630,7 +1649,7 @@ msgid "Mouse sensitivity:" msgstr "Чувствительность мыши:" msgid "Select media images from program working directory" -msgstr "Выбор медиа-образов из рабочего каталога программы" +msgstr "Выбор образов медиа из рабочего каталога программы" msgid "PIT mode:" msgstr "Режим PIT:" @@ -1699,7 +1718,7 @@ msgid "&Pen" msgstr "&Ручка" msgid "&Host CD/DVD Drive (%1:)" -msgstr "CD/DVD Привод &хоста (%1:)" +msgstr "CD/DVD привод &хоста (%1:)" msgid "&Connected" msgstr "&Кабель подключен" @@ -1711,7 +1730,7 @@ msgid "Create..." msgstr "Создать..." msgid "Host CD/DVD Drive (%1)" -msgstr "CD/DVD Привод хоста (%1)" +msgstr "CD/DVD привод хоста (%1)" msgid "Unknown Bus" msgstr "Неизвестная шина" From 6237b3fc6e952c9bc762974f4114380d17198255 Mon Sep 17 00:00:00 2001 From: Daniel Gurney Date: Fri, 5 Dec 2025 18:38:23 +0000 Subject: [PATCH 016/320] Translated using Weblate (Finnish) Currently translated at 97.2% (987 of 1015 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/fi/ --- src/qt/languages/fi-FI.po | 48 ++++++++++++++++++++++----------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 0409680eca9..1a9a0cd9f9d 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -1,8 +1,14 @@ msgid "" msgstr "" +"PO-Revision-Date: 2025-12-06 18:56+0000\n" +"Last-Translator: Daniel Gurney \n" +"Language-Team: Finnish \n" +"Language: fi-FI\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: fi_FI\n" "X-Source-Language: en_US\n" @@ -28,10 +34,10 @@ msgid "&Pause" msgstr "&Tauko" msgid "Pause" -msgstr "" +msgstr "Tauko" msgid "Re&sume" -msgstr "" +msgstr "&Jatka" msgid "E&xit" msgstr "&Poistu" @@ -157,7 +163,7 @@ msgid "&RGB Grayscale" msgstr "&RGB, harmaasävy" msgid "Generic RGBI color monitor" -msgstr "" +msgstr "Yleinen RGBI-värinäyttö" msgid "&Amber monitor" msgstr "&Meripihkanvärinen" @@ -334,7 +340,7 @@ msgid "Configure" msgstr "Määritys" msgid "CPU:" -msgstr "" +msgstr "Suoritin:" msgid "CPU type:" msgstr "Suorittimen tyyppi:" @@ -409,13 +415,13 @@ msgid "Mouse:" msgstr "Hiiri:" msgid "Mouse" -msgstr "" +msgstr "Hiiri" msgid "Joystick:" msgstr "Peliohjain:" msgid "Joystick" -msgstr "" +msgstr "Peliohjain" msgid "Joystick 1..." msgstr "Peliohjain 1..." @@ -643,13 +649,13 @@ msgid "Card 4:" msgstr "Kortti 4:" msgid "Generic ISA ROM Board" -msgstr "" +msgstr "Yleinen ISA ROM-kortti" msgid "Generic Dual ISA ROM Board" -msgstr "" +msgstr "Yleinen Dual ISA ROM-kortti" msgid "Generic Quad ISA ROM Board" -msgstr "" +msgstr "Yleinen Quad ISA ROM-kortti" msgid "ISABugger device" msgstr "ISABugger-laite" @@ -1819,7 +1825,7 @@ msgid "VDE Socket:" msgstr "VDE-socket:" msgid "TAP Bridge Device:" -msgstr "" +msgstr "TAP-siltalaite:" msgid "86Box Unit Tester" msgstr "86Box Unit Tester" @@ -1870,7 +1876,7 @@ msgid "Mouse Systems Serial Mouse" msgstr "Mouse Systems-sarjahiiri" msgid "Mouse Systems Bus Mouse" -msgstr "" +msgstr "Mouse Systems Bus-hiiri" msgid "Microsoft Serial Mouse" msgstr "Microsoft-sarjahiiri" @@ -2116,7 +2122,7 @@ msgid "Serial Port" msgstr "Sarjaportti" msgid "RTS toggle" -msgstr "" +msgstr "RTS-kytkin" msgid "Revision" msgstr "Versio" @@ -2215,13 +2221,13 @@ msgid "RTC IRQ" msgstr "" msgid "RTC Port Address" -msgstr "" +msgstr "RTC-portin osoite" msgid "Onboard RTC" -msgstr "" +msgstr "Sisäänrakennettu RTC" msgid "Not installed" -msgstr "" +msgstr "Ei asennettu" msgid "Enable OPL" msgstr "OPL" @@ -2536,10 +2542,10 @@ msgid "Linear interpolation" msgstr "Lineaarinen interpolointi" msgid "Has secondary 8x8 character set" -msgstr "" +msgstr "Vaihtoehtoinen 8x8-merkistö" msgid "Has Quadcolor II daughter board" -msgstr "" +msgstr "Quadcolor II-tytärkortti" msgid "Alternate monochrome contrast" msgstr "Vaihtoehtoinen yksivärikontrasti" @@ -2596,7 +2602,7 @@ msgid "Bochs latest" msgstr "Uusin Bochs" msgid "Apply overscan deltas" -msgstr "" +msgstr "Käytä yliskannausdeltoja" msgid "Mono Interlaced" msgstr "Lomitettu yksivärinen" @@ -2845,7 +2851,7 @@ msgid "Toggle fullscreen" msgstr "Koko näyttö" msgid "Toggle UI in fullscreen" -msgstr "" +msgstr "Käyttöliittymä koko näyttö-tilassa" msgid "Screenshot" msgstr "Kuvakaappaus" @@ -3043,10 +3049,10 @@ msgid "Force interpretation" msgstr "Pakota tulkinta" msgid "Allow recompilation" -msgstr "Salli uudelleenkompilointi" +msgstr "Salli uudelleenkääntäminen" msgid "&Force interpretation" msgstr "&Pakota tulkinta" msgid "&Allow recompilation" -msgstr "&Salli uudelleenkompilointi" +msgstr "&Salli uudelleenkääntäminen" From 4ddd739fe8c43ed2c56cc1ec26137e322d65e0fe Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 7 Dec 2025 12:34:52 +0100 Subject: [PATCH 017/320] Icon updates and the "New VM" icon. --- src/qt/icons/86Box-gray.ico | Bin 145162 -> 151938 bytes src/qt/icons/86Box-green.ico | Bin 145278 -> 152054 bytes src/qt/icons/86Box-red.ico | Bin 148122 -> 154898 bytes src/qt/icons/86Box-yellow.ico | Bin 129726 -> 136502 bytes src/qt/icons/acpi_shutdown.ico | Bin 9622 -> 43006 bytes src/qt/icons/hard_reset.ico | Bin 9622 -> 43006 bytes src/qt/icons/new.ico | Bin 9622 -> 43006 bytes src/qt/icons/new_vm.ico | Bin 0 -> 37670 bytes src/qt/icons/pause.ico | Bin 9622 -> 43006 bytes src/qt/icons/run.ico | Bin 9622 -> 43006 bytes src/qt/icons/send_cad.ico | Bin 9622 -> 43006 bytes src/qt/icons/settings.ico | Bin 9622 -> 43006 bytes 12 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 src/qt/icons/new_vm.ico diff --git a/src/qt/icons/86Box-gray.ico b/src/qt/icons/86Box-gray.ico index c9cbad17d65f5d02048382355a4084816e9d7a76..68f278334a1a7b1a9573b1168928e9c858fd1192 100644 GIT binary patch delta 1530 zcmbVLUuYY39RJ3Oy)>uZ>{Tu$ttX@-jyNI|DPzPq#^|JVUDsrz=v;ekP0}u1i-?q4 zdZ-U0U|v4raB5+=Rp~?63eK^uB`_(agFNhEgFO_V_Ta;zRz!w2et&nDHpS_K2R}ad z{eC~+|G!_smOlL2KTG7JCK8{Ibh^|-G|&Hv;>zhKiQecXQdL*J{uI&TQ6f!q<#T?b z>{b z5r%E({I6i|$U&4wVt8~WfU_el_-y1YR9IIuB(#r4FgGltayfzAXc(=N3g$<(0B5R} z%jGH~hQ4Zn{mp)i8KIiJxz6tJEX#u5d>yukai*(5$iJ9D>@yX#nrefH^S05kWxIMd zh?%^C!Th%E!la6YG41?%#uvuPeAEe6r|e@zC-Rq~+_8-1sZQAM?nb2l`G#t>ii@Q- ztYkybjTqiftH|{qMCD31eorg7(SHPoGq0e1Sj9|6M$@q#tYkXRSFZUqY-S`3vf@xS z#-mW2ar!e)p+#WJb{8 zqy`eG+z#Qvgc?{~U9GdXVJ0PGVPHQFomNp9m+)Ym@iMPuS;C%+Vx@k>lM+hrNGL8g zK~C;QWl3jV2=-|OIbQAj5f%A6Tz@i*W!Bf?{FIfqYAqzA*gFx$`c1{D|i@+ArT zjz_mSIgJ;_y6-}G*vJ355ZaS6)|SE?TW;p1JM*md)7aREA>&14?}QrS@i>N(ZFMt| zn>RK#s%vX&&e`76OU^TxA^i{hnf--d*+a|4StqeD2)TwLkq{q;mZvX!Sd&?NEdSs1uHON- eB9TZ`_+R*kXaCc~O-3=9j|$V@7p8sI4}Sw7hiIn& delta 169 zcmZo#%-Qvhqn?3*k%5x|1Q;0<7?$`jFiZoo1q2}c3>F3kD_;f%5fKP~2O9&!qCf@) z2?+?l1E@7Bf`LIn0m5Ga)b}Wnfx*B4%2#Dz=qh4haBzU|HJlh2jAk$}cz8hdi-rIV fxW&NG&;V7y!N~APZ{w0*h0Sce+u3>~`+XY`V3*G;sLt`OZ1_{M>sdJ|};> zo_&f)q8t*RL>j4kiH3RYbeei#8PQ|r6vfmZWf5&|AW~IR@5?57-%O-wrhb#-+WbUr zw-uj9hd_GfmZ`wsvbdRXE)+G845!HMpibO02S)%FPcds1lTFqP1 zeil)u_o>MaGCmDCnW$ya(AKJ9ZpMq~6FZ`MIfiBw4s;@?&28fv60uke zcSjWr__yIDCuDw&#V1l2iA2yF-kG#tX!T&E-HBbj-ZXuQVd^>UrEutWRNYWfVmR^M zkTGj0=H9<;)$q5KW3aQdzpP#Ipq@7zzAp-M;A%tO(nKPGRd)(eGgiq{P%s-%@Ufv9 z+e7834=D%*ohUoF4->&H81gHa3)*2E-1FOhEM&(t>ti8Lf6=H^z#Gdj*s0`@4-W$_ z7-Kw*aTy<53zB>f^V@?OdS;xIXSt= zzYxYzJBk{;!rx~3iHh^Cg~0LL zWRdZJjI1UX);{%SEaLB?75JOffBL5vZ8mwUNn?Kn70=uY`K`ixgDdcZ^KZPUqUw2C z;pSxP4kstHxFZ?yfE|M=Lx+Zu2Rv@>a`v!Sw4c_A7-gypfi|0s$G-s;%>_&Ax(Tad zg<>*kG4u2DiK(fnq%0g+F`^wlz85N{JM3!~`v_n2Sc~E4tmeC<=8L@IIECLI!ugB& z@nm?G;zG{pD&nt>W8_UKzul9Je0*5MX3bV36=-V3-DE3kX2?87vG8>wsb+A`t!#HU4l@r5>Qx|i+VSIK#^Sr9M*!!ki_>p=cG;8^uhxl&w2l! z?|t7d|911*cJl&}i&{v0E(*}VC8AIHUzTn8Cb!EtX~CJF|fc#WtxM-&P<_HLrJ4~T|_Y&qCHOmupOXk^4zEL|j;Vk)NTI7luk zUA+F@%6uEAqzilmPw@?Dcz)80XL4`h>(4siznjI@=k0hmb_}h*Wbua)gg>U^*;p5H zu>k+e*oj3Dj)$<4b>q=^2YTXTh{hvqldu&JVkhoF^!gCW@h)s;WDL%zZmv`*6bcna z>~C}+_vIP6#UN4DNM1*fm57M~ZsP;qa$&&pS?kFah4t=Iba-X0h?2atQU2RFt$8!D9wPHrE^ zXv&9cMhJ}w1?BMwqBlqIPC~}H=yUinaS~gX6|^Kh$Vbm(G&ukxsbKFLiHA-V^y{5# z6N9*u3^5Pc>a90<4Cf}!IC&-RlY~@?`+7@8&XADj_>U$|VKfoIy_D?EX0sJ>tlk-3 zN?+jJ@5eEt4ZF=DL*3L4c2hvesdqDr@}S&tn&9jOL!0- z^PqKGLUF49$S0%nyjWN8AvMPTulca0^PTiYrw5*Pp1al0>V2A;ny_y?j{A3fym#x^ z*H6^+#M6Foa8M~0i`F@s(-YQv=%10Woe6PG6{SqQuZXc{>iAw^&T}E&AKulJWaSmP zYYy|UeZ@N~e{#O=t&06zjdAS93GChFdEav5=Up$q=~yt1jGNrza0DD4we~3XWrCuUuij)`RzY>Qgx94 delta 169 zcmbQVi*r^hXFUT0BLgP`2rx1zFqlLzFiZoo1q2}c3>F54Q$R5h5eR<=8v}z;ECYjt z1ccuK)cPu!fk8n5!e0T@SCq@ZU|;~{t1>W1)iE$QI6(LsP7Dl(7Bet-ctG`wh5!wC e%D~Xj09C-j$WUapaYTTx7(ECY~OyL zNYhOD;{!zRM2Wm!Q@+oBl^9VVVEK0tP0tV=KW^Fk{0vYe8XU9$hKcTeN0iT-azJrV z+l!6|_kPYDWDE*hg)pN~2Of_f#vie(coy?vGv4Ogb!yD z0T$i(FcC(9<+U3Mh7ua>NKh`4ds-tLEnMj7fzY_>w|;3u`d)*8tKE_bp^kTxbP(Q zHYyqAy?R#(5u$XuMz&61*kVw<-PZB->SihDhjpo?9#~FN3tCyJ?FC$bIk2XqI=g_| zz?1Q_+#waOMck+SQpUrFy6sz!^MGxQ_IjMhalcH!A-hJYQ}#@_aMOdiNbBnoFE~Pt z*fzdxugCs!q6a4@-LBc$SzXA&HgGFr-b2<|YS@f{m(qS5OKUDprEhI**>O0X@ZkH1 zitVU^N~E>jj+I^siM+8v82i+Z^+^>2DW0f^`vvKz5ceDlpLy`hQh@E9)`V$oavqrr z;XD(e%dZ+Uv0Cs6j7v&xXi2;2%8r-m8Be(By?YrXYj$FHfGZDqr zaD^PxgOw>Sx2ltm>cezI?QV8WlG7NcjSU<~A7y|0=Ti5ZN5_w2y&c>+d$J7o|2m2< zmiy`&#sfF18J93Ls^FUsR1_I;E#u|imoFyM$}bZ?L+leBS5O>P(RIBQ+e^M~`59%& zaLKZVLb%iE7%xci@6{cbCKp)jg{x`TkI%8x5Z`fMek%@VlF_xGIv;9o*a??5C7BhFPVJaNFV?rH*!fN>SjD| u=}Q*3Wfq(IH`kvtPbdjWR-jZU@?QLJ%l?nWtIVY{x5sC`9iMSrTKpGjm9=63 delta 170 zcmdnCieukb_Id^eMg~p>5fKorz_5prfngd01A~JDgnxjAfgy+qC;$Xt`5*=cA$A4^ z0Rad<11Ntkl7T@&0>ba$WMD9hV_;BFfbdrU)$L1XU@$O%@>Lla(kd7jJUpQ4#X=Yu i_~tP%G&Dd2G&mR;rhQ`Axb$jy^P@@IA5CHmX#xP%kQ~7P diff --git a/src/qt/icons/acpi_shutdown.ico b/src/qt/icons/acpi_shutdown.ico index a2493b8031b6a7b5de4dff93d43e32c184d5336c..03a7503ec4739a34ce9737667a955c4aeec9f5b1 100644 GIT binary patch literal 43006 zcmeHQJ&xtZ5$?qrUKkFfKn4T{-c1ZBGIWDo_yj(J5(5U5JJnO>(2>vJBUsr)K7vDI zjgk_fF3LPI15aRZ3rcvBv*8rGNf5r7yo+`|0?1 zA5!{2JL7-x`;`9mNAjl}6iO}9P9}YzJcHYn{JgyvzQ%k<*4sBs2gmwfDc;-Rv)~wv z@2+2eUHZcp*7kFo#jx?>e=RoE!#FnH#&RDKr)|aGth8|)cmTu3Bi8!CzwGP9bHCkZ z{ zS#Nm#;q9-qrcG|!bwY9WcoGJ&RH6_MS9h2BVlhj+7^@hE4Zn?P@r0MoS@3|BnlX396zuD|DF)}mIG5ajDR_FHfWOC2`fx80J;1S+bCtMqeXTJIFU1jmi{KyUxQK@p z-HT2?JZwe&(uM))N50?C{pm4%bA3qfm;I97UU^UH6L&{H{5h5}7>n;)^vIp)F?xA! z=FDHwv-i%8@|X2q&UeBsVFt6T6V9`o6S)u%i#b?Y^s^n+Q(iBOX>sha%{P*x#1<@E zho#lL$kWPEV(ax-;+E%o;EjB;4~oVViIx^H#J@~Dojf1Oi4zSfuh z!3`Gql#h=eWAi#wII#I=^tBxT1D5&7jy$DB z|H^#;Gjh>fvzXU!uh$>wdFy+6&iY8tS&!)rJ$t>T=dM@VPFYP|^w|1v497ACV=*RU z^K;lc+CR{apC4TK2bae;mlMIF{dk5N0oY`tnxlQ=!7)d-H7~H)+PUu?Ti=b#4jvXK z&r{B4oY&ldvGADSP_G5Z!8RI$+{bce9-|!m+%_lHyV6=8;W^8p&Mla_hL<^`bB>$i z5c@|tdhK%@%KS2BUXFDvF{YdKeSO?~GWtFxp6128F0EW|b)1i{9BjX@+pndaU-r7F z=Sv>vOJ1ELIROV4XYM&gp?q?2> zkE}tn*FZkD5q4iYR={@tntv;Q-UkjjN7UZSKT^Luhlh>4HFw2F_IeD|2RN-9<9&*o z=jJmz2JEN4wT3bMEzCN9n?sJ(&!79}di>mIjqAXeWnH4$sP9bf9)}#upBorA_~Lx@ z`8(%O-&Zm`s)syt)q3@F{OSYX3Cs1C@n9Y~7wMC{7#GbczVMky>AC_Z=K@aFDj$xy z#im^HTxg%mdHwjw@&dw-DSh)pO7Fi<>Fr1Q#m{3(Zyr*5&HIIZgn&JDHu$l9SmPfF zi!m9Sb8xQZr3lK+Kd0dR547Xw6d&katQ%}*u42w+_68}NkOd!%Ut}|`H=0`u-<4O% z!>%XZap}MDZ5Cm!)8_Cv%(MY(;Wul~mcP%DYs+|}93yVyoFcN!1GTTUk8)7JBpW8ZjFo!nVqdLcNo}cn!-QK>;`H!?Gx4z-J+{Vo1ImWT%Czu|fj~DSnJ9Olq>w#ZmZkpChF7SQ0-2D0HUmHHQ_{t6BNDcj*GyG~_%Z(Y1@oVYq*U#6{!j#(m z6#31}E59zIV^aHRZmpkJL-n&`SL5yHS7T|;oZC-<-x$YQ^S=7kIIY^*YL?e>7Dvwk zc&_Jm?Xz>Bb4@zWQi@}l_{SbU#B;592RF3Otj`{X;`p4()`+9!h2zojg}-M7qh!%O z7mofjoXv5BA8I-JvzL;w#J4$a+G*V7^R8O%vs&zN7FQ;oJnz*~bjaMa$Ci&AvsTf& zw`LJ_$qRhgxIQ@_^#}hb&(U_^`+UIzwyx>X{Il^n-?RD9D9F;vFM9IEFMjfNp%+GJ zqu;5}FID)RQu+l8S^8ZIy$wo#zett?U?1t6{!E9$>6bIcUg(^GB1_#oMflp7?$M2ag^f&%D-ki0lT$|3mz7H!h zoO^Q`{h6l21a<%foMr9mt!??WdT%YLA?zsU$PYMdZ#lOl53j%d`tJ4FG_aNvx88kP z`QrW(*}is+$5~_1f2Oot^SKQ!YI9%JUF+J$;=nlcxGOL4rdvRBgCARHskuYf5e+Tw z;4N!MlW?OGTG~4HXy|c2#=Decb@*d3qoL2e%zxH7=F~9_5r3({SzIHWSi{H|oWq?K z4BU${8*wh%_h~rBUFI-&bFI7`{q@fkj%(P@U+V?VSpQ0kezt85is@l2btvu&9{(eG z%Dmy2SPGub+Obp9h@$7(A2uu`T|p4;a?^ zcx^6wV%oI=e}0miyNCJy_vCN6&+{Ltiyf~${)qQ$HNw9=hhk2Gjr_1J9`GrxAEUhb zp8Hcy?yj~VrAV@KShIi&s;w>-|djqvwX2I2wZtXB&b%?>v8w z&oPd0hpL_i;Yr>_?s5K>cl_CA%L8H)wxt1M0erS->wSLFn3%U>O%Qfmdm503EslHq z#qajqAxAW{^Ud;ye`$GaFh0nCh85hthAlVo(4RNUG53{x?Rge^25ARF$0F7uT5)}< zwOr+xF|e?nwe&bE*4Zq_@HD^G(mK}h;MnK1sg|5$*?u19>+%i!d@JQE zi#GnFb++^Z((>ZfgS@B2FG?*hUU6#b=J$~J1uT9qiC@6t_mnu0-&^89*hfC67n>f~ z(hEL4LmzJC5T0h5L7{Mr%w>%CluQF|G` z)#DBlrc;=)2JcAM-ge+_b>N)OU;{7Mz4}JukcaJ3izljq@R)hNY0vjj{nl@*!JX%V zKC8}XYCSvIz8Oq?p1H?dm>YAeN#=>fD`)?_j6!6L#Js zd-^y0Ju(i(jLn6O-wyp_+7F31AsBNZz8?0};C9;AXEr>$Rd!EF&aXjBztnSvXRev! zTf3~G95b`EYcMkh&eN{Ct={PQ1?|>%?tXH-1}*K(PwLnk7x;vI9)`g?ru_Arm|lh|I3TF)DCtjG2IdiKVL zxyKxj>5p+E?YGc>1oK6|tbx(>f8^SV=D>5pd>Q|j@#klNm-+ACbDz_-8m%WU>woVV zpf|sJ{r|tuKS$Ptz?zILU;p^3OFP_!DUw`}g`b@s_SZ!`E`sLY& z$DX%n{&U^ibF5wGa@^WjZ5|e@jnn5;j(@8LM{|wyzK?!SdrSYBbD&+zG5u|fePhr1 zd5f-te$Ia0ejVfdm_tW-NW5tE{*CnaxwC%W+8WyYkHkv$vHYHLX=~{}qXv8Rx8ugN zEB{zO_q1wolt(*0&fSh1(=Qlp?dUyLgS|TT#>K-^p`B~c(~r58>x$!YzpQ8z z`hoBN+zQ&k&HkPb<2qwUYLMk>jLR|otQ*?ec>Yqm@`B#d#`+QKVcIsX6Y9T5V=qSV$7*1C;aIqpx^dpt4~)oe zx~T@Y-e%^4<$DYLGA5+>4!Uh!CGXr^$i|5IIy?K=nzfEIJWKA5$2u3rY9V!#>(o1L z>D9mKmt6NA^Qf$F$2Ds0AEz_$o$L~Fp&Eaz=kIG z^8E$$O%AY2IDMnT5>DUf0K0tu0ezLh;}VwMl=dMl+iTd1oWF{!bl>jZC@hp4(;I{|n^B B?)(4% delta 78 zcmex&o@tu53j+fq0}F$I0Ekv#$Y5b$aARO#5D|g!cd#)qtOJTkNI>`h%umAu6 diff --git a/src/qt/icons/hard_reset.ico b/src/qt/icons/hard_reset.ico index d0494f40bb8220eaf8babada5cc3db648f6a67cd..46642e01b8cbde4cfe1d0e3e8ac4ef8faefa5cac 100644 GIT binary patch literal 43006 zcmeI5Pp%|K5yop|#0asl7e=yJFtb7O3i$>eaRQFu4H73{%VWoq6=&cGc=uKufhBt4 z0LZMcggs4sRrTu^ogJAOSylbo2$z%-RhbdrpUCQZ?KeH`X?iuio<90$viNrT%@3yO zx6?Fz{PA-Ammf~k-)-)bPnPRH{Ail~^y6uI`*ykhv(^3VC)4!lr)&LBr|GXhpQg_~ zTi5OU7w@L&oeklC`paqh+pjI(IIPrWmU#=)JL5?nC(DaQuY9g~c$iMnaF|y(KL5)v zr_DQH2jf|bX0H7k?xY;?z(Je~+#i|;Pv@B{bMg8I7`|tk^TYST*K$rSd1Yjs{8}Whj8XpAZ%(JD*Qe9t2iDtH z%P{Na{d%yjT-B&n&l!7^&CeS>e{}rOo@s-}Rj;jHbEC(MQ~KuGz~JfOUf}RLDq{wh z97XEOedU^UYF51$TD7Kpa&=CA8GWACO1v7D5rjvXUt-qQ0bBWJ9nAR}kLTy{s_1eq zd<&by*OKq&JRX=@_w&>V)7LWZ=TyfY`nVOZwx`j4X7r(1xg3#xdg#}vjpjTS>-b-; zmkieEHTNO&if|KEsdlW*V>2iey-LxVe6Q+tb3<(o0)c^j+Hz

8SIinURr)wSF~D<^dUVA zkK@l-U$v*P%S4ak&&#~%`tXM^7#Jm?pf`;QAP23KD1XShZ1esw1sIb$Y#II5IiH%WBAQ``2=LUelA&(Bps*b^2sUyPH z+?qd2h;sb>+<{!XK^sT+WrpU@nTv5w<@f4)UV42sb+i?!EY> zv(ylIBqv(KE6O7;*WYD3~@62b;PMTpIi2vYlkD+^ATy*90T31{>*0}^SRH3uZ*t# z%*~0`bT5@PCY5Lta)Aae*)AZ&m`-`8aX?p!QO&@4H z*sl;6Q|BO0@o}wxGAv;VTO8t=KNMly`aOlluWaypig)%|tQ#EMhqZVE$|mH6j%Y9a zoFQH0H<9-(&ODx5=e5^3^JTu%yHAa)_8jnTjbN=h9n1JBSefV3s9s^O8Wo2R)$^Ph z<<92g-^2}RL|cXj54D)VaJ}sIF{=$d^q>~W>*>sD%;*y*dh8}>9?yC0_h1=)Bifpx zf<>>h*2|X0jJ9WvKtOV;$5Ydot&3!=uRs61n9rkJ&9%59eXV@arTipT*f9S$)!=T#c5V zXbn!UvBpcT^wn}Ajy-d5dVM;t@snR$-=n2g3#Zpu<0rSaUgOv^59jy##$O-m`~PGA zcz;xjBlqLc{qygmgdGj#WHd(FGS8RRGq8rq>rd-@^wsL&l{Ou{JoJ>YR#)~DzHB}D zi@I(4(AMf7_lNP6(yBi<{Of#=J`qZz*C{=IJg;BLJJ*%Hj`T?T1zpc{$;^ax)sm1%EBp^!WJ^Z3sqV zR;TC7p5w_l)%W3p`despJ=>(sn>n(V@~UC@yLFWsy-s*~dr2OVJ@ME_o`X+>w-(7G z9;qdR1#c~8Fj_f_Z@VS*K~Ej};HQoU`@pCj_IE1wmn!;9sr?0uMft`^y;@AM9E{wP?$BCz^_l@xkg^_>Z>k^*q_Nbe8(@g-?9bhjU-()BHMG zJ`ekuVSZtQzh`=|f8&4SgV%2_-dM&E{8?-5UM}Yi{aiD|bX@Y8-)rkV(^&U4FYU#1 z>l{s6qsLpl9M@%s1dpCeTebG;#NqbCvF|$-EqK3^>Aw* zs59R4QOl)gmKe&{ylPuITWe^Ez%!aK(8~25ypO%w@wLSRHCg?5aCN)-j&>rrS>db0Y(MU7(QagUzSTC|kKQt!`^)KlpbpO$gi#M z)iYX;p6~S^``XOz!}tBaPv6;}|K*BW)X#|Qpr_eb)35p3&n9XzKZAv#{OqW4 z*8HGl^x2tx|5L*+`E;$^5&bRf8WuH2>#y;R_Py7KQh)CrB44<*<4En|sNtc7-VK!#b?YeJT_YUh>ylCI3MK^Jee)=U0aM0=_>q}1D4eBH9zL)6su~w^j%ZmwvS>;C~ zNWGe>Y3OOkM^vx55&c)95)=5X-G696XDw#+AL$3qn)Yn(@dO_CAl_-Cv@^HIhibus zD~gWG(sPIRK)v)^^{kzqu%>y9-a#HXs*f}?=kTp$>`<-t)M1>pgYSL#JY$;uluW!j(5NZD4)#LIxC4Eq8{@|5>ZCRf~(g(2gxg>o6OP^Cxp+3K)LgJII?SoB^ ziuQr0GCpYDfXk?95gipD1QhT*YCh2Qq$?En*?6$Q=d>pKf3Mu}kd={fN2!NUUwCc3?xMAzSBHpt0g%~u>1p&mL|O0p@d6fx zDb9P1?oq$Jd~jVK#Ci7vUBsS`z3cEOn)$o+03CWiu-DVpde?&&?SpuEAGB5bQFZLY zOWX@^ZQXNv){9$ubL)Fy>z;eB^sg6v%}6i6J^Eh2dsd6rkER7fZ{+&NWzG0&P4!3h zV9}j_#>xAo{=VN<#wAu>#}Pdk@y?zvH7!Tm*U%%b%)Pj`2k`Z{{GM-jm#dVftgb!& zvmAKOsXs0&t8YsWve;X^ug@i(PgilILs^}pJ;>mWc=w)#-5NeO(~FE&Pe8STnx^`M85^^WeEuhDt%q`h_Y z^lSZ={)H`$QGeNd^w)Z@$A6}F$%)x-?VTRoss}CqJ;GQf_ud2Ef2&X8A@{p< z@9*{Ref9kNTza5=zxUopy3j{#d1GH&IrQ0c;ahcn{a)wzz_X7nZ`8GNN>9qwDCh5a zjSuge^OiU2S~>UhmF30c)o{-|e0blSx4co;%DJbnEH^&z>|@Itb*-GN zhI{7W!~5pE<&C;l&OLo)x$%K#A6wq2Yvp7$+%pd!-Z$qhZ`8GN?&&MTjR*XevE_~0 zR!&C4J#+9-`qp*N7q#|&F7|?rESN|B9^|^1-jg7RC|2!RYB} z>7dqoKf-^D6WvEdo<&>tpyt2T18QoV%-^~PxAcC5fAxVL9Qo`QR?oZVuH9$sV|nj$ zjrOvhI&owU<%6}S58n5JS7(Q>)b6j9V_r3?M}$M2XEy+U8J?>SJiK^4(K&gF&-Eev zc@mBYk2&Q?bJe(8DDkL;P&nlrYf)4#!~2WQ$y3Z6OJ4hZmU6P*)rJz2dg;Nt`s(L1 zT9u=k*2v<3r5>`!wTMo6%O0u$+ttt7Jr8Rmx{t{9`n;a<9DP~eJ`WBs6ia+vvu?FV zSZiX4OM|_M^f2did0Xjo&!cm2qo{TGng(_(q9@~B8qt$B93;XSd5-2B=lrbLVRtSy zNj$q|KM`j%=X3`L-FMl04_# z15PGVw_-KiY+C|T`?h7x`-bnu3=R;X4ZXxs&(smY9guR@RP++@ zk&V<5?`q}%a(rat0hB2S`$6`o|6k1fjSHVE^2GuVmtV}l7ZdPB1y6!^U%+7LbAiG% zE#Ko{-{dfVkAcOx+`iFaF1K%VAkN=^U|(hMG?z`U%lJ6W#|OlR<@!}EF3Y$3v&PH( z<3fGb`?OrYE+f9_1Cc(_H=^F$*kQjwP_QqYcvQ5Vds4K0m;v5Ae{sfKp#6MU_mO=y LhR-#>?E8NK>tmv$ delta 78 zcmex&o@tu53j+fq0}F$I0Ekv#$Y5b$aARO#5D|g!cd#)qtOJTkNI>`h%umAu6 diff --git a/src/qt/icons/new.ico b/src/qt/icons/new.ico index b3e0c16b068904a9a57b964d2a48efd413541c7d..9e04337d00d653d041e5ca75482ff8c1d3c36cd4 100644 GIT binary patch literal 43006 zcmeHQJ&xo=6n-lZD@4Esi?kwOCPA7A?G3iY2{^(gNSuIlJ0v9H3>*QnCgBK#s3k5i z;RLHO?{oR{JXe?9{%gD3^Qu+-+~ulz-}_$ux$NXoRxm7hKp`B_9>zYf3u z_)O$qO?&eu{Ql*0k>9=$xxEd)f7f!~d?j*sSC#)-+yFxk)1}=fA_t} zKR;@I)uBZ-C8Vp6o$8qw3N6n#w5me(T9z@?)2|Mc!RJpY5FpEX`qojEFAG;+W6F=# z4=ZUyu!Q*g+0R_4gOO=2oq-7q6#r?5_)Fv7MEpj2kAQJThq7|K!T5vltBz?i1&%dV zj;;Es@30R+N*RaMiE`C=RE|X$j~K_)8Px~c=c>=Tu&gsPe6^iZ_=ESzA;(wBVDB*h zGB?V`k>^}G1J1x=3=|LVisJsJD2`vAMx^8XfPi^Rm)xSu=yKf*L*DD!`vQS;jFoe# zIUS$Ecn4k60>?d$%T`X+f%4J(3D-5|f+;!{tUuM{M$fbK*n;@U`K3x7qImqIC_cW>HJ0wb#S!T^k9;En)?v3A zcN)2Wu*b&ba>1_4c)W!6pevqR!rXOf98YtaUDxrLm}JIzl#HV8#M+Ndr(Pof%M%wY zJzcJ;KcO4;+R(6nZVrrotF!I6#4@K3T>nYiU)2BTJ;n!YYu5ivo89;9xohjU97N+# zZF}$%#~&h}SAqv}L4A}wH?PKYZPaCDI;W>P1I~am;0!ne&VVzpCC(bX8&0@4TiN#8sM_e-yLrSiR z%XK>g&VV!E3^)VMfHU9>I0MeWVhrf@=;1@SD3zO1K8pUuj)spCo)CQyJT0pCW<+n` z74y<&kc0 zdt_~%-7@|j*ul3Ao&3Xxs8h<=#@Kx6TgKlL`(XZ;^1&72x9xoBaid>=8@X^FNbo-t zv(4}L2M$XK{u>;c`K*;^lc!O3rS{XnV6bJ0AMWbugF*P0;GRuw>-c;6pf~?ZazDTa zS>x~NgSNh1r(+Es_$M>VO7?{_*8(+Oj!)t0VO{KG3O4k$!{T0(cVf3Pwu4x$WFA{C zw_{>V$=t9y9%sNAa0Z+KXTTY72AlzBz!`7`oB?OR8E^(R$N=_D!}C-6VAY3m7xlh+ z!0A{$aCN92xY}0_Tv6(SMP>dXb{4Gx@ft$YZtnYcN%FC69){Z;bFy6? z!hICrk8K+ByU9cDeInRC#?EtPz=LEwE&v}s=j_n)snDlfb&oU8vGFO zA8iY|q>TBD1<%?3fwoWfe{OByIom(N_F4R&OB-oEqx;|6f2RGvZli3gk?hsKqcSITX59Wyutv6Ajs3U+X_*7MIGAjI4!-Br z*K@ajL>rjo|D1e3vJG6F{R7*;X!~>Y{fIVjmG%#816}h&@*J+Tg8#{Qo|5xH&%NNJ zt#-W-t}wS@J3Rsprt)Cz-h$t0yOm>jxCXl|2RM#-pp7ZXym1}Z@SC=E$!oCFZEyyh z0cXG&a0Z+KXTTY72AlzBz!`7`oB?OR8E^)i0cXG&a0Z+KXTTY72AlzBz!`7`1~O1S zOLYwY0jJo97bNJL7RuxYk#{(_m+ql7m%93;HCfpRb5%?gxKy?LRMcyR+NoGS6W edih2N%6+8w5aBvjc!{6(&_3E*(0&;E%)`h%umAu6 diff --git a/src/qt/icons/new_vm.ico b/src/qt/icons/new_vm.ico new file mode 100644 index 0000000000000000000000000000000000000000..ea5c2aea2f73d32cc031c435630a1540f175082c GIT binary patch literal 37670 zcmeHQO^X#t7R{oR+K4p^SK~rA1Hvr)U^Yrw?I^f%(Hq;HxNK|?7mA3=yp0GhTE>Qk z{s#lD1T7dvEI-RHaQp}L3x)wjM5S`>iOdu4X1>VG$b6Cc@>SJs!W$788F9|JH!|zJ zOkPLPOtdB1y*m=WJNnn3qUd-OMSJ!n?VtY~MgNt)ef!eme~F@>{u)I`jwJ0pN26%% zM;R~Y$P|%un|Z`V139n2V(IUqj4VGG4C3YG??}B z%wr7e!isq7eqt=rpvn3GK@9qQpSsNhM=T8QBudV`m#`oHtGU&w8w|_`u1Al4DVR@I zLMbvHZ|>8zEFQFFO~kKk{W@Hmj3owm7kSJH(|H!EPP|2H1CL(cC+CXB5Ocbg)gANu zu1~ymz19zPtjD<5Ss&*uE-uz8m|w3?9VWH@IQoa+zaI2Q?0oZ}jrdP`eP8Yvr};DY z;G5>Zp2MfE*GKN5-E@7N+oW*+!_%7Z$2lPjxuiOZa~sCBVZQ4F6~>0-j=5l%SEfg) zG~x~I^}>TF+9mBdDYH_aS(dUY4M&;zpB(!l<$LPUmNHwn$Q-jW$LyM{i|;8=ew2dm zJ77oTJB|XQc9Zl@Xl>++&Occ+;XDvuR5-?g5ct|MgN>N--+AaZ$0RsMP!c0N=7bMX zH+pFtRdwL>#Hjal-MZDyfk($G^VyMOD==#9>f*w9qgm1CIKiOJi4QmnFajG)=eKX2 z>juV$cw5u>q|@MZ`FtO9wF(>b(pIQnfritB&o{0ZSEQfT%C~Mcb>yJdukZMP6~zbV zB=ie`&&CS*o)#Tv_Bp*HzSzjX1@qBOk1-lz&XQ{%aA8`T60Ru4Rv7xQ;=~y(a8;laK(*JN=3f5-v!N;*7yv3Pf$+V*+o_ZZ0 zd>B*bJCw4qSR2M%LH*UMSMk-WS4}L@-zR*)LnG$C;Ug~kzTr!A%*MP=_z+v4|1%8a7L0qr<@=O>A@Ompvg>cvF|8l>t@c=>seYmHAp@N;u>Chkq~RcYgM zTVJ6dwtO{7^hx@4>&PzllW@AL)5u{p!ead@oLHxJyv1>ErRjLGPNXH5H~oRPxkOapm$w#3Z! zRF3z_m%tq!I(hPB+;y=!4U*5$na{248)`WOo2y;Ed^!H`;X`L-1UJ98b9oOQ7cX8k z*jHCq<8R--#oxbwmn>|@40d92;VtUpIY~Tn5s0FjH*Xpa7cN||xeo>*+ZKBfMxTE0 zDB%Fi_`3+#ZH!}^JesymZdZKQWfn{SaehZfejXe+7dedE?h3!)HMs=5!QueDDzt~* z+Di3D97oVy6sY)%dcukM^PQV?TfS^2L6Z;b)q<-WPjq{1q{{efze> zzq0Z!u3Nwp{3nI~)~#C^{K${fr%xLmsN-G@PN<(cb;{O{A3tvDyk5ERXA-YwBeO3C zvJYf^DI->eUvtUVq5Y)s|N3jW{&~!d1^WAd|F_@%Y4b<#S>V*|qI#MBnH=CfsqXc& zV*mc}$L|^Zz{BFg3|?>F{>O5gHvD-`7C-hE_F2dGFXj()ZBoF8@tQ{bdCoo@^rf_D zkC^_F>!!YtG6uL0jaw#xA6&p8RPo_ZsynVZ_)qlTzJ0s%zNPhNean_D@i=Ac)~)t@ z%fVwmXSgKD4fZo<&cxfcZS%r^<;s=#z<~o}l)ssC_wV0t=P(?2O{(IdaO1r9@88E~ z&z_BU?ATF>AJ{*C{%o)5`D^63?GYZtsy%p0*}HeIi6L?s9Cq&9>5c#X{rmCPuU}g$ zmPd+Jw;w-#9G^db-V}21!H(Rg{=k3k+_}~Yw0ZI3h1|d2npn%y(ALJC_~F4JJua@? zG=3QwA3l6Ic!4g!|MKNagBSMzKA*yx$We_S^_iKO%G?37uJEs|ty!&sUq5?x;Ri3^ ztFo@}12eA$@7}#b(-`~m`U~zx_zxXA6zh`Dr=nxJA9Z~m@(23Ae*M~VAa43l__^-F z!a|I~w)S<85kGQ^$Iy z@!E-coBKD9@z}9r20y&}*x$`@_p!s~o&wC&AD+g(komK?nB+a4>mNLL&|sr?9a~sP z;^R7oxaj=Rdw|&CL*gGd-}C1aKd`$>X#7h{_hXbij;8JPfFJn|?RnkQ9{nNnr%nCA zgV#=Yyqgmmf73iEIuH4SXKpJiE9Siu?pxqT975vPaSc@mei;6K*6$vHM@alwr>*ko z)2H~^vu7jk{eVv>{qY$_7w!X>*W+~k-o1Nfj-{og81=h%@5T=wK8&9}eHuS_@F0Hl z=u!OS$&>i`^XDd?fPEbN62IvB_3P#{Fg^!Qvgm72n!AAKW#9m9CRv~zIS6R4zyCEk zJP*5b=T0v;G{FxpH*VaRD1OBM#EBENwbyaLXUZ-M?gMz1i+41xUAyMQzAOOo-p~L* z|B<|Jg%_^SjO2x@0ld6$wG1yWT&gCcr4&$fcjKKF z{mx|{>ozt6iBVM<#?ehU*V||QBfQmf)y#7M-A{cyb?77iM!dBKsC(+5`ODQ~;%2xL zd!AF1Hs?z6A(#Exce|m5)n3NKI`0GCCOoUo!Mqh3kS{oscUOHTU#p&*r5u4NZ(f>J zXuvsf577M4-*(@m`D0^%Gk9v_erUB1aq)~j;_Nc7_#=Nxav-k(^k9JwFt*`C_0@@e z+x)2kHSSa1GseWGJ&$?$iX5N@o$Q60xj%ONJ@x?kLtkjnR;io!jIEA4>pbS|D{=t) z8`cJQi@8DUgT&t>2VDGdy+c1WsoTbRyl&#$qWDvvkbWdD8pOXY-~9Ltf86g1;vbSX z=jt2(U*cajH2-PLfA0HnJoi8Ha@z7A*mY^51Nj?Yu>VK)Dz4Y6a8GNmk9*Y{T>mt8 z)W_jpmj6}wHE-6d&KWu02mVpJe~zt*B@9U7Y42X_|4 zqbHw#5qp>`{!KaO&&%gg(S4w34{*{4A6h568=gh~w8=lO2ikQs(7ah6;i;|{ z_LwJkYSN_!edG@vr~!3u)7R0!#?%#OS06ubc;r6gPY(^cDprFU*TYgRk}Ip(U*I5| zQ0f}b>&9cBqVPXgJgfS6ZaNp^C&X*<=XsOxMuWOKICx{v;u_l|{y2x{yRO?^^o{61 zjxO(rH#vYullV`XKQ*>Gq#Rvsj@9`J&TQA+_|%T`(nFI;7}u}z_V zpU>~Wg&YID^Sl+W%rWxTJ{>F0-}=lSdXS$mGJBi)uwVOhj6Zo9iSuEcmmYJ4jIGaH zc^tY8oWMkUnm6k>E~S?Boxj#Vh;1nTh_yDx9-cAR9{SV@z6|bj{59WvUGrvrJ@QXE zW%m9?i9d2b7uyZB|G}Sm4;_#Tx=n59*IWLBKa89=8h`NCMjhZ8bM4n#{59WvUGrwW zE&h6KpTFapj?uZU*L2m%S^G`??fm_t^=}$mpYt~3KfKm!&0Te!_pGm{{7<=4zj;JnGd`}pg9*F{~&T-TZNUFLs&?{(4EoKbff zwQ%7{V~AM{~4}$6kqZ~6Ve`-j$uEKC!PXK izfXA1CqJwqzX-8v2+o`T!4Q5SA_>rZ^1~LIL zdHi@k{`LJ*{;tQKJlT)G|DcqgJ}l+(azFmL`hEIwDOXnq|4&N!TfAvKve|=T$YmDkzkL-_EDc3d5$~M(=a>raAZ{ySL+ux=#-}kJ&&HQ+KJU<7e z9{=IbX)3?eUD~XjOaEhyvwr{m=TGb5u8;FIa(MnPo|`@YPuAal4IQ5wy>l+B2Wq@c7iW&2zrb>vn2cPVDyeY0T5D9`CNBQ_CIi ztZnk{*O)qLYNN49-u>6iEj8I!-DYi)#I}c5qRxpVkg8s`b;_!9}%xT06L?)=z5(7uEV5?6_Cjy%w+itSb0t z{VM<7eO5bmZad@m`}FQKa&Pxxmvz6cJMSOdv^Or-H}0W&y6*k@Y|o$LuPx_~dNteE zyZP!iE2sLM+{?B5xh?l}WM}1A{fLWNIaWX7qE?R8kGQCnWA!60YUNn{h>Kb|RzKpR zR*uz=xTuw5^&>87&BQ9#?SpA5LS~*rf;-XfL)sMKS zm1FfIE^6gi{fLWNIaWX7qE?R8kGQCnWA!60YUNn{h>Kb|RzKpRR*uz=xTuw5^&>87 z> zJmlWqr)c|^b?1GG>-t?R#m0LHYpTF3nyfK7x9E60*sDFqw>+PY(8B{5J=L(QZ+mX; z-rwMT4zzJK44D^W54Hz`e587?Js2`C#vW`B2Kh+!V0$oRUW`519t`r4>cRG4$h;VP zuss;$Bh`cL!H{_|_F#K3$VaLN+k+wVV(h{8V33bg54HzG=Ec~9?ZF@)sUB<(hRlnx z2it=|K2kl{9t@cmV-L0mgM6fVuss+uFUB5h4+i;2^k?O(rV92}} zd$2ti1 z&221eZ|<*oyd_5Ebw8`(Gb^;k-omDEBV&wYXZ}>6uUY?oZ8$TsMkCpoKNaX}*1umH z&Wx7AYc!Ib`BQF%=da4sX-a*VI<)U;UDy4l?tD+H)c?J*VdMKh7TpkLlc^;a zd^QEzyv|q`Th{ZojBIPOmK`n7A+;@>skJ7Q9;v9xuF%qcQf&RYmN5G6nRaGjFt1(RUon_k+F2M&)5IR zouK&oMM8?Yg>naf0lgL=Q+2{I? z>`7#-?7yx8kv)lwrJH@O|Hz(1#>)QdDiGO|$XL4B=lYNANo1_-zpet2J&BB^n|-eT z$eu*T%Kqyr5ZRN+Si0Hg`j6~MWUTDJt^$!giHxP2eXjq=ouK&oMM8?Yg>naf0lgL=Q+2{I?>`7#-?7yx8kv)lwrJMbO ytbhJafmZ8Ow*Ri-#`$Y=!OoOZ?f)D64!Cwk+w2D9^r~D;({1}>4XJNq9sUJQO5i2{ delta 78 zcmex&o@tu53j+fq0}F$I0Ekv#$Y5b$aARO#5D|g!cd#)qtOJTkNI>`h%umAu6 diff --git a/src/qt/icons/run.ico b/src/qt/icons/run.ico index c088eb59dc462ab124fd36d94a6a2f7a8c2695a7..dfb43b05bcbd8d268fc25ac9277fdd8ef7506348 100644 GIT binary patch literal 43006 zcmd^Iv5q7)5cTR1D@3pt9MXw^*#zk#bbl}_zJO1-1c@&ooh5>hi1boE0kTC%q?Zw* zkuJD&5g*Xhvt2XQ-s&E^+jhHWyeieS+kW+4xw@xkx^K>yD|2n0KR4uW&37Le^Sv?V z#S6Fn+sDTILwzq_y6vAnG3J*~jk&#b+rQGhFFrHo)hj>$b7TJc(wNt;{eF7=)txbS zWWay*wK0ExOXDd9O{E^!PtM#?oPpL+KWtjNr@1hPk&c78_?wEu^M5A{SSn69U&k5F z&Cq;_V~Cftr#PqPpVAaFUvj~C$t7jJTPa>|rzK{-oaf>n^Kfc@zc!BZ_|?#S8I#9q zKAbP-gdu1;JpARtWjy`Z1Lw3B;?2b!!qah2b3KJ8 zaSi3!*)VP_9&j-h<}mf#rr=4gN8CQwDR>e$6u6g+tj>#H?3zu3^L<H8jQjqwr}dC=OF{KVjLtW00ZC?3(P# z8(yOi`}|nU8MqF+r8swF{Qbc_zPKE2{GKvAqU4@qu9x9~`1o6j2gm1gcWoYFe4R(R z3K)tnc^FzBXZd-YiVq$b19KeU^R<}xG8egdq{J`5V@iCT$Fwz>6JPQ$hx$n4kt05M z00)-JBUgNxizAQIxyT(~@`%Yrsra#LQZl~G1>(4T^w*?De0d$%k3R3S4C@>6GOp7f zMlTn?e@*c;F8Aclztqez#(b{$GVV~WH6A(Q$L2bBe5qN(j_I4CU&c+zwZTEjCQvARZ*f7TtKE0LXCv!QKXAORHc-G{n^BiCECHP66=1`wH z&n5YRC*s3~crMNF)aTuQ~j{4Z3o!Bl8J;O8#WdLYz|D zG5jR28ab0%$M`MDi#cliTHrOr58S}H_Bt}3&~yG|&cZQEZZp4@awhZ9C@yp{3P2VZNc~ z{I88S>sVpVKltZ`-h01izjZJ6?y;n9?;ca?_Wn7my?czQ+nbFYxHtAOC)#!c_r^VE zMcyKjw@BpeK=KxeyhVZs5SpFQ{UxX$fo9LA+#b{-9bXCBOp zd2VSp_QR29U3M64Z+!pGdCrR))*bS;wYxjc>wCA^eefQ?1#m}pPsYz_8T!9hA{yQU z+I$~~AU}J^{o(v}nR$Tz{(1hgYJv4n`JR4u@ihPt>QDKezXAHQDQNm-EnvSn*z9o4 z0gUO_^U$1xS%hNr%RHQ0Eu`o_$8$rfepw5cyY_mRs$b8;tV3~;$#eC~Jgl)6a_L{| zxgn>1Sqs2*^{_};M+YsTU*^H(pxw_DCH1f2m?*7Z)&gR+Ru8rG>v@PiOp6VytzYJ$ zg<4oje=FyPCH2c%0FNc=p#}YV9*Q0EJ>Zt~%RJPog%}-ofgkYzsy7IF>!ACQ=hjw zC;k2V_?J`va?RsZA4jcu{iSZ`n9|m$KZkD4)!Ot=ImTJ5=GUTMuDPaTYG3R6rEYM| z-CEUOS~ushMg6&tan`E&mh{Ut*SMDGYeB!%4L&v7()w%Gx|Y|a^vgBZc-88wtzYV{ zUF%v-Yw2%IH|L^;{-uv`)~flE`sJEyv0LaXpwQ!8OWnX&YfIICF1mTWQuMF&7-y}TkI^sJT*Fv%-8{^KgY5FfgH?O7C ze@VJS{m_nFoNJx4-q7>t!-cK+fByFZ9@+2Qi^q-k?q>^#xNaXE6@^&D3iv+)=Q1BQCkC5;P2@fRex84(y-6kaK z3Ca1L_Z#o8y}$C_?A$oB_5LRC-0#QpJjP*Mj?=ku%!7F`PtTimur4G5acP+K4bQ_dDm^0vz*f(@EpD*iGKL<2qRs>fiYOo%8=X*YUdl4=&Mn+yDRo delta 78 zcmex&o@tu53j+fq0}F$I0Ekv#$Y5b$aARO#5D|g!cd#)qtOJTkNI>`h%umAu6 diff --git a/src/qt/icons/send_cad.ico b/src/qt/icons/send_cad.ico index e3e64a74349af9f14f900b0cf1d5dcd7b37e024f..e3f27c7830b78bff355b96d00cec16b68012b18f 100644 GIT binary patch literal 43006 zcmeI5PmUxx6~?2~h!$eevlyfi3#vCrvqE!&YH<;k)rupq zL?sS@h7~Q*)5-g6|1w`VZHMDuRe{PH_jB0qeee689g*2t*)_v(GrS%?`)n}#cKFQ? zhT*rvFns=by#C7%hvDxw_r(|S`VT)EhClsy7~Z~(*MGLSpZ#PQzWg%9|8yAs`txD< z>Z`PF<6pcRhIiJ5|K%@-;cve-f6HN^HWTN~4DT$@igvOX-+LiK%s37w-yK#J$NPW# z?Qrs)wS-f|kk9FKiL;Ay6PDI%@ugVu15(2n$1!00+{9vq(HrmcZHXtR$1Bx9{O|AY z&l>VLu1m3Ogs(xV4w_TX>d!THP!9Hj7+L0hK4HbYBk|!n&R=2@Z$g7roSJk;?Gd9k zKMA&rnqO_c6tBEAjm;hdV@$qvSGw<)#>!%Cid@admenZ`R}a% z&U^;*_5Js^r<0yD_9zR_8$Ey2{%Fs%mF>KL7VpPP;ZhB!d+*K;*t59A$m$;SXOS^J ziE|ZGeu}x=%VmD}$iIc@@e~uUIY}3bUkeW(|7;RM%73sGH}M*MA8f{1u}HZ(*u0)tlpi313~Skq7_0e!9j74%mor`BU@YYiyl% zJ_j~&mDAcwm2dkj4PdLu4snv)*Yv9+G_L-Y0ij_2Bx)-+ebI(>6GeHz}MJ`Q)M55sNf z-`R^%scU_-KA7)dF-CvVzcDPmZrNMz!QMuP_sz=rwY~S=*ep-j``m7XjhLLT+`61g z^8}vY@f^)9>r3(wBMYAGf}N=A&N?wEPg9G0g+;8!#OK!gX>AU_hOPUd)N=p195sKi zU7eW<+R)L$&#|eGi<#6(xoAGt`A_!2`+$wrnmX6A;3$WWWqtx~7v4wl(wz6b@P(^< zd8f`>`J++VX(fH^fnOuGRUdpjHW<__UPlksysjKy*Z9fWWeCRVLi6;9JiE8tbLZy` zwHL0s&jluyb@m-!n>VgwiXRQb_jqpLnQ6Y_Q^E#cJR*l{e1BHRK~5~#?1`|1ttQSi z|Gq_I;)w$%x2)qIk>j6jeDn+<7dW|fxM$wv=)pJNv^Oyico!Ra$PZlX68w4{=kaUr zZImDW!k_blH&*eb7|#{_9zSrsRgPB2x85%KaHLBb;~JT-Z7FsshZcr1e*f=(vbPfpn>>C&{(zUqv!@Q{TyM?Mb>8f6mw|@I zaBF(Z{;@Ub3}g5ys-1GHP7LQ z{2nuGQ2ImjPnEx&`}@E!_d!SP2H^ZD*vAqVK+_)||Micv4`(98eE*-|;p4SGVAOJJ zz9+xAh35lYgiH5xwSDQyulH`AzvF(+mGe+;=H&0s%=tXCELkOB^-Vdq2jxN@Y}X_C(DPNz=QTc(pY-;&7B_L!y6{w=o>r=% z!w6XZy2jIToqefQZXJ%N2H&bxT)rQgqodp5UtxLQoEO(FKJZg*q$}2FoUzv&!Sxm% zx%ED!an4Ny#Y=5(j-~vqxe_-p&%M2=f{Dpp;4CoZMN z{w}K@=TztR!n21foMaW7YFDBb=C<%N0K*^8d2+6v3u8DXUe&rmcn^N6y_(Lh&tDox zA8Cru4S3Y--u(LRuNQvo&(`|a_Lcdq_*>)QQL|g|x5n3aF%Q1Zb#LPyG>mW`a__E* zheyqd-x6+cPz?OG#MgNFd2w9R!B`Wk7~)&j{kojFa3<^E9+ld=jTkL{Tu%$XwuZ`Pe7@ea>BLrTJGlx+M3`8E(YG7o5nrwfqjhA zb0F0zw9h}scWxc5q+^-rR%~@8f15G!WZu&xTBT&82Mc_z@0oTi^iI5 z#j@u1V)H)qa)&Q9tXcfvTC+Q82!GE}&RQPLYaPCJ(QFsL_F3G@KfYIK=kVN{qzj8) zN3AwnG$?ki?iUUPf}K-ydDd#^#VyfH&kz4R4C9io=32Sd@NeO<*Wh|i@YY(Xv+iRU zw{nuJ_hHn+s__>$IOCIB*5#YGR!*%Y?OhUDSe}!^4cz@&YfN0P2K>9on^P};ag?um zi*IQSPF_PTFTOqeYZxUCTjt>8`DoqKJu9Bw-trIJ*dB3b*BM|3#GuE0k!!M1QE7}qsIM>;yGx96-sn_MIl&i))eV%Uk z<4nK4hjad_!`9Z~E)C?Q_TsIk+)Fh$tQ3FV*Tph81Hz=%xpn!VKfr&B2H}#IF?{BP z;744}nQN^l-!pd&Jb&fV&zxFaIJytPty%b_oaDZ;_|OD?Yg{(Iuh@z*-%cdI4WRvhBNYgwz`5NoJ^46mkt46ioE?@ihF zuEH0u^bg|iY}&qe6~4e^-@6I{56Rw})fcd21%MsxT3?i^SzET--dL=(qs2AwwJbg| zXKOsewF#cs+jM=G?E7Rl&|f1#U$oZjQ`VqIJ6gO} zyGfdD>N|f=Jw*+AwWFmexUqPNZ$DEXvj%h8{hl|ZEm|U{u%G%~fJ=#o_-Q@*ERs0u ze8DZ(K7nR$iTjIsIO8mtu?fiz$ZR=?^!twCEqHE?-1?K|4B z;O6H*^QGqi{#*24YEaGrx7;eXdOpA98a=)Gm5Z3AHPD&&O*o|*Z_%?f7A>9^;~GC= z{vY)F{X{qRMSuBxzU=?H_d(C`{(m|Dm*+Y6J@)1P|Np=Ld6u!~-aeQ8*L#HCzSrx2 zO}l?yY<>NY-*G6PF?2|`xb*g=@27-oI{dbWaZNw|OSQ{CfByIAC*Kvp!bFWTwaje` zyM{%~bJJhrn``D89fdN6vsODt#OSdP*F~?e!X#zuYt?r|uQ><`xcn z=&xx<1bpB?Zq}upxh-{2ELh|!S(nS)w>RAb^IiKJ_k;Y>Z`p%(@zgwPnpdA|_<^JN zl4j-{zJ*j<$Ze~;TIE&^9EY=Z`1v|`zZw_$&^<wU5d*zn|kGANY#{HPE=k z)6b!;X1#A~toX#Cs$C1xttQ{SY5*2iTvP+~7UwK5%BpF+Ps zU!K3$)f)R4CuP;}srA=t;Wb{5N89)Ky0uEQ3wloaeJyHZ@ui!L?&qA7JQ=>|kFWpn z>3sb2zqYTv^X$Fs%l^Nd|H;j~;^O80f4Tp8_R01>hiZQL^XcgGwc^N6LXPHlH2y@) zii@N99gV+2@+9PFen;a^#H_g3o1dNw!c;dp!S4Bd$?;c6o`iV)!rt0)en;a^#H_f0 z-yYhj9W^jI=lwqle}&{pi1hEt&DQ|^N8(S!th`VSj_A-i0$Z5iZ?W312mO8pYj#}K z^8W+Qef-4>`b`V`pK0W%U*MqM;GkdNpx@x2U*MqM;GkdNpx@wtebBXKxRoor+v$s+1a5qYo)gc=GK6aD#=2fz9lD$n`h%umAu6 diff --git a/src/qt/icons/settings.ico b/src/qt/icons/settings.ico index ed64740b27f07f506fe0b02303f6e3fa293f9d3e..21a7371afd282f65edc84b54a329d8a178f33566 100644 GIT binary patch literal 43006 zcmeHQJ&z?v6|M0g56COe21Z)Y%CiZQBeW8U1B)5?7w{7{K_Ya72oTdoNDvYsGN=3m z!jUWy5hEgaL{2AMOQUV>xmBn7c6C*E^~dXZYx_zyx9j7cbMCF`o;NdZ-#T~ZF5J_n zPW%h^tM57YYv)CGR({MPj8&Nkp}#aK6UP2zm)aDA)zwj$HloD;hAY|SPyU8G)&X94h?a+5U=`)YcPDIubE9@`M- zxiPDT805`{zD#K2oEZyIox>cA@$eX9Ec*eo3p7_b48#!^^JDRVB8CQqFC3eSMLZ1a zZR40u7QVdsW7|HQx9#gQX|lPmU$yN)+MV>9(EcFv?_S9MUHR6Czq@YR|J}ANo-^_& z)8`GIKd?W`Gi?K7&FJSsGR}MKfosrPW}@_z+7hdZRP1F~J(FpPKimaSzE$KZ*y96}^ zF;C#Y`0TKF7$0ClPZ(E^zR{QB0avw@bmlk=9)zZt(1kJJ(x}t+F>kfyuoQ=U1~1|m zo++&Cb2h}Q7OTf!LsB$ofpIVBjmG#)H)AnAy&zr*6Z7QAYEJ>Bj~L?G*xWVNNeJ4c zDR!g81dQQP{SGLWgvp_9frq4$=SNOLHOu^#KC$vzzSn=ZV7(CCI)?q9mhM4w3hi4 z0zUAFVZ9&qxp6%1MaPxL=4gon@u3l$Uh}KL&tPZIN$onX+1D-?BLc_pr}Q_1$p##n zt^XLl)}^2UxG+9ziEptnuNbmcQtcZ0!#VDtK=rY~L407+EEncu3kymdIec;uBg-L! zmJ@4~qswnJ2doD-8hB_arX5#3$@d4u!&rNG#kA|fniN~{EVqpj^*QV@d}@UUHsW=! z;r(^22`(@Xv)Z%xesQ;_5*M+1i2Y6pKjBb~SW6u>*j|#?uSpd00G7pG!aE3LHRxWjneC z9ouQ}Sj?@%?r{tK_WYJJ#m8J2BRBmfdm#7`Pp^D_b`1RNr#{hu8qPDrpJLbcqXyJ! z?s*9OwOpljszD~BmN`|Z&;VZ8=w4ucMGcDBzzl6t!yNtz%xo?aQ_=wa*_i%b#QR)< z5ECw}FJc9Lgk;y3^H<(R=Fy-t#Yp?vTrzQq*1ds|LYQk3lgTr{fFwslg-mF$Ww8=U^WCG8&pf{-^`_RexA#^GZ3U`iiqq zgJQ4HP~yg|*NoHvyqIT`#Te@CukGt(GLM*2?STv9xw9T~y|@W(SQ#BRpTvC9T-+k_Dz+&dGYsZ#q05@~PbuC|R-BJy#5#pC>Si((S>&G;xxJ-@q z;s#HuZ!2!pAjP(OYM&CFu6-td+mWax*n&A16f?9_993opMhxRt-&T(=Le zuH=^pSM5RCoqJE(nKUPT-bS#i+_uMkp64=UB~Np-3h`Fg3eAz^_<#sHMTWCX8LEolz z6R_2L>nq;7Z^txZ&RTp9hQUF9ZT%1*YB#`6IMLO5gqYemQ^Tn<*gvO1m+~fBQms*2 zdd@3zi+QE--5nEurjQ}8a}Kt|G_oEo#COOuak{{GrMP@;8+iimRQ)t}(P!g(8fW4} zRdN9>Fk)K|URb)9gTAbT9vchXsBtC^^^Iu*7xhhP#JW@;;-ki(uNG&CzFO>T4J+!W zIfgu`4<0$fEUvv~oGy|tgS`zC7}vGDx9DrNalI8+p^sX@O`Ft+I)sLp$@N}aqRe-j zz)Kw^Pkm!tQ(Cg~$Rncpl?ZisA1HT#~(S7+hF-*?V>)!9ZO@P%~LJVm(i$6nlDrJ<c$3R9=)xS=ftwcVBLk`_efEZUXek-6(O~2#d8`wh zUc;DO?*f(rnlBg+u_Y;^J1aVaIZ=}w{}Zy)Jcut!!;ZFC2d?okF_wtTz%hC zm-XaH$H19t#M)FxF5Y4t;~Jbf%jr7?e+?$n*Xr>%rkB!QN#oy{8u>T=k8Hf(Qvb-Zs_2KWiSYc$JVUC`_Fv?+`cu;V zoO@dOc`nlGx+s3t*b130$p*6+mYwYUTAE(xmFU57^DewBe zV8igNhD8rfG(TMLOK}+Q@9Xij&(&PJe(M|rk2br`wVKVkqdaSO%Hb&5c><4|!%?*( zhoJvxXGrjc1#N57XAF*Lt@d!7qpOWO!X7Nrt~yZ9(B|a6Sq=-hRi{4({WBnA3v;MB zPs4K;_~vjL?L$0dvm^&!i?JNy&-cR6ty{w7FWeKrwqDhHz-d)rxu*NtVakOT7|=ak2Kf$H;l?4EYwKqDSrGCMt@n@jF}}lAcoCqPOnuf>YcV3`f8R!3oPZ| zst)!n4>??Tv&k?N0hXIJ;eOfot8fko=mitsXr*HiJSMsNy z!E%MepF!|?z&1H1%i&Kx(&wrtSni?JqYmHP{Ks==E#A%=)a;w)k2DAS&fGCqmwyf4 zUN?i+-09BUzg4-jHX}9gd4sFt+bho;kJrKd>+9kk&B{GfgC36NZTTMWdC||En#8L{ z)rJ$%g*-J@w?@Zr{IazVAtGD z{!5-|TkpH#?Ro$6yWpuj2OcALa|VvGp8yrBIbXY<{qOcaz6SNXRJTvL{bW3S&3>mi zJMX{$z3z(Vf6Nv4t!Z&QT+FG(ZZ!ycmuf{^%$fHQy}_Q7yJ8a8|15y>xvd#(;DgQ8 zs4>8qGFh_(A9_q}`7_fL8|TaGgPx_DG|uO3b1(Bj(TW;Gz9A=bO?~`bx=ajpt<}PP z>9AA2R8P!*vgJ+b?*0rF+Z zeo#w^4|;l9gFbLB=1Vb6A?D=I8XyPSVoinTK$8FRdk#5wd1v>YWtdxov<_=(fW78f zFuD6P5b8V|zcTMN`BO7$44bVHG0@r98uMO^+uIt=$P7n zYNp<~_d3?YfTL&WL~@5F)PAf6&`evBH)2BG-8~jCA9LT4Q{?yi(&;ldJo8_g`yl^Q z%ROvv=?tvRzqI$g`cuOr`rY!!*)sQ3JcB2gyO-+k|E1@Du>ZWbMrsgB5#7=nMSzjo zmiE1qd8GV(aic`$hym4vXHsZ77FKfIlrP}~n91kAd0?T@=H`#} zqk8(px;Eu-hCl9e5M=vUCva?i|;LQugr8j z92#LIonzyOMKg7Xd1HJm)&*WA&wRoB9{Hm>&VP zwR5Gsh>se;1b^2v&wNr(UFo>(*Vdqvdx{m-+2NDE-ZKA_PIN@vR1IqOegyvHrG@-WkmFc8wN1n>-Q#l<#18(W1ERmv|M;f;;_m!wOkXr-2XXk|1$;ySK6nBD zXN-I@fqwFVeqsVYIYB(f>A61j8Yei1fOEh{D2S5AUEa%QBz)oAj|8HQZ-T#sAg0ubD;5tX^Z4WT(7RCH0bh>UG^!S4GV$Q(eY! USGY@Y*V?d)aaRvvm;J8)A2WT^=>Px# delta 78 zcmex&o@tu53j+fq0}F$I0Ekv#$Y5b$aARO#5D|g!cd#)qtOJTkNI>`h%umAu6 From dbffaa493c6d626ef752a30aab850ba224e62326 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 7 Dec 2025 12:35:39 +0100 Subject: [PATCH 018/320] And the resources file update. --- src/qt_resources.qrc | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt_resources.qrc b/src/qt_resources.qrc index e68c4e2da1a..dda79c0b3cc 100644 --- a/src/qt_resources.qrc +++ b/src/qt_resources.qrc @@ -70,6 +70,7 @@ qt/icons/settings.ico qt/icons/interpreter.ico qt/icons/recompiler.ico + qt/icons/new_vm.ico qt/icons/warning.ico From 4b6a7ad685bbb6d85939c48e89b0df0ed77a19b8 Mon Sep 17 00:00:00 2001 From: BlueRain-debug <68976789+BlueRain-debug@users.noreply.github.com> Date: Sun, 7 Dec 2025 20:39:42 +0800 Subject: [PATCH 019/320] Update zh-CN.po Add missing translation strings. --- src/qt/languages/zh-CN.po | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 96951cdd75b..70ac91e3f72 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -559,7 +559,7 @@ msgid "&New..." msgstr "新建(&N)..." msgid "&Existing..." -msgstr "已有映像(&E)..." +msgstr "现有(&E)..." msgid "&Remove" msgstr "移除(&R)" @@ -943,10 +943,10 @@ msgid "Thrustmaster FCS + Rudder Control System" msgstr "Thrustmaster FCS + Rudder Control System" msgid "Thrustmaster Formula T1/T2 with adapter" -msgstr "带适配器 Thrustmaster Formula T1/T2" +msgstr "带适配器的 Thrustmaster Formula T1/T2" msgid "Thrustmaster Formula T1/T2 without adapter" -msgstr "不带适配器 Thrustmaster Formula T1/T2" +msgstr "不带适配器的 Thrustmaster Formula T1/T2" msgid "None" msgstr "无" @@ -3038,3 +3038,15 @@ msgstr "暗色" msgid "Search:" msgstr "搜索:" + +msgid "Force interpretation" +msgstr "强制解释执行" + +msgid "Allow recompilation" +msgstr "允许重编译" + +msgid "&Force interpretation" +msgstr "强制解释执行(&F)" + +msgid "&Allow recompilation" +msgstr "允许重编译(&A)" From 47b5b39ff37635551b1830c4410e4112d4392c65 Mon Sep 17 00:00:00 2001 From: altiereslima Date: Sun, 7 Dec 2025 15:06:57 -0300 Subject: [PATCH 020/320] Update pt-BR.po --- src/qt/languages/pt-BR.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index c263bc02bfd..ac14c221617 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -280,7 +280,7 @@ msgid "Sound Gain" msgstr "Ganho de som" msgid "New Image" -msgstr "Nova imagem de disquete" +msgstr "Nova imagem" msgid "Settings" msgstr "Configurações" @@ -358,7 +358,7 @@ msgid "Memory:" msgstr "Memória:" msgid "Time synchronization" -msgstr "Sincronização de hora" +msgstr "Sincronização de horário" msgid "Disabled" msgstr "Desativar" @@ -820,7 +820,7 @@ msgid "Generic paddle controller(s)" msgstr "Controlador(es) genérico(s) de raquete" msgid "2-axis, 1-button joystick(s)" -msgstr "Joystick(s) de 2 eixos, 1 botões" +msgstr "Joystick(s) de 2 eixos, 1 botão" msgid "2-axis, 2-button joystick(s)" msgstr "Joystick(s) de 2 eixos, 2 botões" @@ -961,7 +961,7 @@ msgid "&Floppy %1 (%2): %3" msgstr "&Disquete %1 (%2): %3" msgid "Advanced sector images" -msgstr "Imagens de setor avançado" +msgstr "Imagens de setor avançadas" msgid "Flux images" msgstr "Imagens de fluxo" @@ -1123,7 +1123,7 @@ msgid "Not running" msgstr "Parado" msgid "Running" -msgstr "Rodando" +msgstr "Executando" msgid "Paused" msgstr "Pausada" @@ -1171,7 +1171,7 @@ msgid "Use regular expressions in search box" msgstr "Usar expressões regulares na caixa de pesquisa" msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 máquina(s) estão ativas atualmente. Tem certeza que deseja encerrar o gerenciador de MV mesmo assim?" +msgstr "%1 máquina(s) está(ão) ativa(s) no momento. Tem certeza de que deseja sair do gerenciador de MVs mesmo assim?" msgid "Add new system wizard" msgstr "Assistente para novo sistema" @@ -1186,7 +1186,7 @@ msgid "New configuration" msgstr "Nova configuração" msgid "Complete" -msgstr "Completado" +msgstr "Concluído" msgid "The wizard will now launch the configuration for the new system." msgstr "O assistente vai iniciar a configuração para o novo sistema." @@ -1294,7 +1294,7 @@ msgid "Directory in use" msgstr "Diretório em uso" msgid "The selected directory is already in use. Please select a different directory." -msgstr "O diretório selecionado já está em uso. Por favor escolha um diretório diferente." +msgstr "O diretório selecionado já está em uso. Por favor, escolha um diretório diferente." msgid "Create directory failed" msgstr "Falha ao criar diretório" @@ -1309,7 +1309,7 @@ msgid "Unable to open the configuration file at %1 for writing" msgstr "Impossível abrir o arquivo de configuração %1 para escrita" msgid "Error adding system" -msgstr "Erro adicionando sistema" +msgstr "Erro ao adicionar sistema" msgid "Remove directory failed" msgstr "Falha ao remover diretório" @@ -1360,7 +1360,7 @@ msgid "Searching for VMs..." msgstr "Procurando por MVs..." msgid "Found %1" -msgstr "Encontrado %1" +msgstr "Encontrada %1" msgid "System" msgstr "Sistema" @@ -1765,7 +1765,7 @@ msgid "Error initializing OpenGL" msgstr "Erro ao inicializar o OpenGL" msgid "\nFalling back to software rendering." -msgstr "\nVoltando à renderização de software." +msgstr "\nRevertendo para renderização via software." msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" msgstr "

Ao selecionar imagens de mídia (CD-ROM, disquete, etc.), a caixa de diálogo de abertura será iniciada no mesmo diretório do arquivo de configuração do 86Box. Essa configuração provavelmente só fará diferença no macOS.

" @@ -2908,7 +2908,7 @@ msgid "%1 VM Manager" msgstr "Gerenciador de MV do %1" msgid "%n disk(s)" -msgstr "%1 disco(s)" +msgstr "%n disco(s)" msgid "Unknown Status" msgstr "Estado desconhecido" From b0c858b4f6de6ad96952593d614c6d54aed80582 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 18:58:33 +0000 Subject: [PATCH 021/320] Translated using Weblate (Russian) Currently translated at 100.0% (1015 of 1015 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/ru/ --- src/qt/languages/ru-RU.po | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index d01f41a0964..dc10f515291 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2025-12-06 18:56+0000\n" +"PO-Revision-Date: 2025-12-07 13:33+0000\n" "Last-Translator: Alexander Babikov \n" "Language-Team: Russian \n" "Language: ru-RU\n" @@ -1250,7 +1250,7 @@ msgid "System name and location" msgstr "Название системы и её расположение" msgid "Enter the name of the system and choose the location" -msgstr "Введите название системы и выберите расположение" +msgstr "Введите название системы и выберите её расположение" msgid "Enter the name of the system" msgstr "Введите название системы" @@ -1268,7 +1268,7 @@ msgid "Set display name" msgstr "Установить отображаемое имя" msgid "Enter the new display name (blank to reset)" -msgstr "Введите новое отображаемое имя (пусто, чтобы сбросить)" +msgstr "Введите новое отображаемое имя (оставьте поле пустым, чтобы сбросить)" msgid "Change &display name..." msgstr "Изменить &отображаемое имя..." @@ -1415,7 +1415,7 @@ msgid "Custom..." msgstr "Задать вручную..." msgid "Custom (large)..." -msgstr "Задать вручную (large)..." +msgstr "Задать вручную (большой размер)..." msgid "Add New Hard Disk" msgstr "Создать новый жёсткий диск" @@ -2297,7 +2297,7 @@ msgid "Line doubling type" msgstr "Тип удвоения линии" msgid "Snow emulation" -msgstr "Эмуляция снега" +msgstr "Эмуляция «снега»" msgid "Monitor type" msgstr "Тип монитора" @@ -2630,7 +2630,7 @@ msgid "Color Non-Interlaced" msgstr "Цветной без чересстрочной развёртки" msgid "3Dfx Voodoo Graphics" -msgstr "Ускоритель 3Dfx Voodoo" +msgstr "3Dfx Voodoo Graphics" msgid "3Dfx Voodoo 2" msgstr "3Dfx Voodoo 2" @@ -2654,7 +2654,7 @@ msgid "Enabled" msgstr "Включено" msgid "Standard" -msgstr "Стандарт" +msgstr "Стандартный" msgid "High-Speed" msgstr "Высокоскоростной" From d4788fc2a4b72dbe57beed2408eee7a23d6724d0 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sun, 7 Dec 2025 19:49:20 -0600 Subject: [PATCH 022/320] SB DSP: Treat mode/format 36h as an alias for 30h (16-bit stereo signed PCM), fixes PCM audio in Gloriana/Elisabeth I on SB16 and AWE64 --- src/sound/snd_sb_dsp.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/sound/snd_sb_dsp.c b/src/sound/snd_sb_dsp.c index 89039580595..bfc2847edb4 100644 --- a/src/sound/snd_sb_dsp.c +++ b/src/sound/snd_sb_dsp.c @@ -2775,6 +2775,7 @@ pollsb(void *priv) dsp->ess_dma_counter += 4; break; case 0x30: /* Stereo signed */ + case 0x36: data[0] = dsp->dma_readw(dsp->dma_priv); data[1] = dsp->dma_readw(dsp->dma_priv); if ((data[0] == DMA_NODATA) || (data[1] == DMA_NODATA)) From 75499ad251b5aac70f3308dc151e32e9bcd1fb92 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 16:11:04 +0500 Subject: [PATCH 023/320] Manager: Allow starting the currently selected VM by pressing Enter --- src/qt/qt_vmmanager_main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 54e0c619fae..f81d09b387c 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -404,7 +404,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) ui->listView->setCurrentIndex(first_index); } - connect(ui->listView, &QListView::doubleClicked, this, &VMManagerMain::startButtonPressed); + connect(ui->listView, &QListView::activated, this, &VMManagerMain::startButtonPressed); // Load and apply settings loadSettings(); From c9fb23c5b1e143bdb7fb46151a8294791114db90 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 16:12:05 +0500 Subject: [PATCH 024/320] Manager: Fix the search field placeholder not being updated on language change --- src/qt/qt_vmmanager_main.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index f81d09b387c..16e6a02add2 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -834,6 +834,7 @@ VMManagerMain::onLanguageUpdated() { vm_model->refreshConfigs(); modelDataChange(); + ui->searchBar->setPlaceholderText(tr("Search")); /* Hack to work around details widgets not being re-translatable without going through layers of abstraction */ ui->detailsArea->layout()->removeWidget(vm_details); From 50023a656cd7d8cd2a05cccfeda09e05ed7a185f Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 16:15:48 +0500 Subject: [PATCH 025/320] Manager: Disconnect previous signal connections from the process object before starting the VM Fixes crash dialog appearing more than one time under certain circumstances --- src/qt/qt_vmmanager_system.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 5038732d101..898041ba43e 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -440,6 +440,7 @@ VMManagerSystem::launchMainProcess() process->start(); updateTimestamp(); + disconnect(process, QOverload::of(&QProcess::finished), nullptr, nullptr); connect(process, QOverload::of(&QProcess::finished), [=](const int exitCode, const QProcess::ExitStatus exitStatus) { if (exitCode != 0 || exitStatus != QProcess::NormalExit) { @@ -501,6 +502,7 @@ VMManagerSystem::launchSettings() qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments(); process->start(); + disconnect(process, QOverload::of(&QProcess::finished), nullptr, nullptr); connect(process, QOverload::of(&QProcess::finished), [=](const int exitCode, const QProcess::ExitStatus exitStatus) { if (exitCode != 0 || exitStatus != QProcess::NormalExit) { From 457b5c3c7a1042d14b805de1843b68584bec7006 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 16:17:23 +0500 Subject: [PATCH 026/320] Manager: Fix exit code's hex readout only showing if a VM is invoked in settings-only mode --- src/qt/qt_vmmanager_system.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 898041ba43e..e4618e9f43b 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -446,7 +446,7 @@ VMManagerSystem::launchMainProcess() if (exitCode != 0 || exitStatus != QProcess::NormalExit) { qInfo().nospace().noquote() << "Abnormal program termination while launching main process: exit code " << exitCode << ", exit status " << exitStatus; QMessageBox::critical(this, tr("Virtual machine crash"), - tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString::number(exitCode))); + tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString("%1 (0x%2)").arg(QString::number(exitCode), QString::number(exitCode, 16)))); return; } }); From 11da4936fd381238795c69d7faf3cb24c18a91e2 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 16:18:26 +0500 Subject: [PATCH 027/320] Manager: Increase the machine status text size in the list view Should help with readability in CJK languages with 100% scale --- src/qt/qt_vmmanager_listviewdelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_listviewdelegate.cpp b/src/qt/qt_vmmanager_listviewdelegate.cpp index 88d123ce90a..2935cdbe4ec 100644 --- a/src/qt/qt_vmmanager_listviewdelegate.cpp +++ b/src/qt/qt_vmmanager_listviewdelegate.cpp @@ -246,7 +246,7 @@ VMManagerListViewDelegateStyle::statusBox(const QStyleOptionViewItem &option, qreal VMManagerListViewDelegateStyle::statusFontPointSize(const QFont &f) const { - return 0.75 * f.pointSize(); + return 0.9 * f.pointSize(); // return 1*f.pointSize(); } From fd3a79e526956de247e43e817e11f99320cef135 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 17:44:21 +0500 Subject: [PATCH 028/320] Manager: Simplify the connection chain for the configuration refresh signals This allows refreshing the config without redrawing the entire details pane Also refresh the config and screenshots on VM termination --- src/qt/qt_vmmanager_details.cpp | 11 +++++++++++ src/qt/qt_vmmanager_details.hpp | 1 + src/qt/qt_vmmanager_main.cpp | 16 ---------------- src/qt/qt_vmmanager_main.hpp | 1 - src/qt/qt_vmmanager_system.cpp | 5 ++++- src/qt/qt_vmmanager_system.hpp | 3 +-- 6 files changed, 17 insertions(+), 20 deletions(-) diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index e0cabc53c67..4d12ae1e16d 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -199,6 +199,8 @@ VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig) disconnect(configureButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::launchSettings); disconnect(cadButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::cadButtonPressed); + disconnect(sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerDetails::onConfigUpdated); + sysconfig = passed_sysconfig; connect(resetButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::restartButtonPressed); connect(stopButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::shutdownForceButtonPressed); @@ -234,9 +236,18 @@ VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig) disconnect(sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerDetails::updateProcessStatus); connect(sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerDetails::updateProcessStatus); + connect(sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerDetails::onConfigUpdated); + updateProcessStatus(); } +void +VMManagerDetails::onConfigUpdated(VMManagerSystem *passed_sysconfig) +{ + updateConfig(passed_sysconfig); + updateScreenshots(passed_sysconfig); +} + void VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig) { diff --git a/src/qt/qt_vmmanager_details.hpp b/src/qt/qt_vmmanager_details.hpp index ec71d4cd8e8..efd2ec6cdac 100644 --- a/src/qt/qt_vmmanager_details.hpp +++ b/src/qt/qt_vmmanager_details.hpp @@ -87,6 +87,7 @@ private slots: void saveNotes() const; void nextScreenshot(); void previousScreenshot(); + void onConfigUpdated(VMManagerSystem *passed_sysconfig); protected: bool eventFilter(QObject *watched, QEvent *event) override; diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 16e6a02add2..4dd0422f3ef 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -456,19 +456,9 @@ VMManagerMain::currentSelectionChanged(const QModelIndex ¤t, if (!current.isValid()) return; - /* hack to prevent strange segfaults when adding a machine after - removing all machines previously */ - if (selected_sysconfig->config_signal_connected == true) { - disconnect(selected_sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerMain::onConfigUpdated); - selected_sysconfig->config_signal_connected = false; - } const auto mapped_index = proxy_model->mapToSource(current); selected_sysconfig = vm_model->getConfigObjectForIndex(mapped_index); vm_details->updateData(selected_sysconfig); - if (selected_sysconfig->config_signal_connected == false) { - connect(selected_sysconfig, &VMManagerSystem::configurationChanged, this, &VMManagerMain::onConfigUpdated); - selected_sysconfig->config_signal_connected = true; - } // Emit that the selection changed, include with the process state emit selectionChanged(current, selected_sysconfig->process->state()); @@ -593,12 +583,6 @@ VMManagerMain::currentSelectionIsValid() const return ui->listView->currentIndex().isValid() && selected_sysconfig->isValid(); } -void -VMManagerMain::onConfigUpdated(const QString &uuid) -{ - if (selected_sysconfig->uuid == uuid) - vm_details->updateData(selected_sysconfig); -} // Used from MainWindow during app exit to obtain and persist the current selection QString VMManagerMain::getCurrentSelection() const diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index b08939d1c23..9336f8e23e9 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -83,7 +83,6 @@ public slots: #ifdef Q_OS_WINDOWS void onDarkModeUpdated(); #endif - void onConfigUpdated(const QString &uuid); int getActiveMachineCount(); QList getPaneSizes() const; diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index e4618e9f43b..362ed403f4b 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -449,6 +449,8 @@ VMManagerSystem::launchMainProcess() tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString("%1 (0x%2)").arg(QString::number(exitCode), QString::number(exitCode, 16)))); return; } + + configurationChangeReceived(); }); } @@ -1241,8 +1243,9 @@ void VMManagerSystem::configurationChangeReceived() { reloadConfig(); - emit configurationChanged(this->uuid); + emit configurationChanged(this); } + void VMManagerSystem::reloadConfig() { diff --git a/src/qt/qt_vmmanager_system.hpp b/src/qt/qt_vmmanager_system.hpp index 96c794df3f3..62789b70acf 100644 --- a/src/qt/qt_vmmanager_system.hpp +++ b/src/qt/qt_vmmanager_system.hpp @@ -138,7 +138,6 @@ public slots: QProcess *process = new QProcess(); bool window_obscured; - bool config_signal_connected = false; QString getDisplayValue(VMManager::Display::Name key); QFileInfoList getScreenshots(); @@ -158,7 +157,7 @@ public slots: void windowStatusChanged(); void itemDataChanged(); void clientProcessStatusChanged(); - void configurationChanged(const QString &uuid); + void configurationChanged(VMManagerSystem *sysconfig); void globalConfigurationChanged(); private: From d0926809e56ae87b433ea57bfd83652feb54c81e Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 5 Dec 2025 19:21:58 +0500 Subject: [PATCH 029/320] Manager: Don't add machine configuration fields to the search index --- src/qt/qt_vmmanager_system.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 362ed403f4b..748d60b850f 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -305,15 +305,13 @@ void VMManagerSystem::generateSearchTerms() { searchTerms.clear(); - for (const auto &config_key : config_hash.keys()) { - // searchTerms.append(config_hash[config_key].values()); - // brute force temporarily don't add paths - for (const auto &value : config_hash[config_key].values()) { - if (!value.startsWith("/")) - searchTerms.append(value); - } - } - searchTerms.append(display_table.values()); +#if 0 + for (const auto &value : display_table.values()) + if (value.contains(";")) + searchTerms.append(value.split(';')); + else + searchTerms.append(value); +#endif searchTerms.append(displayName); searchTerms.append(config_name); QRegularExpression whitespaceRegex("\\s+"); From 1dd681f33a1e73c04d77907d9fc4c09264135bfc Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 03:23:42 +0500 Subject: [PATCH 030/320] Manager: Initial preparation for re-enabling the toolbar: * Increase button size and display text under icons * Remove the duplicate search bar * Move the existing search bar to the top of the machine list --- src/qt/qt_vmmanager_main.ui | 26 +++++++++++------------ src/qt/qt_vmmanager_mainwindow.cpp | 32 +--------------------------- src/qt/qt_vmmanager_mainwindow.ui | 34 ++++++++++-------------------- 3 files changed, 25 insertions(+), 67 deletions(-) diff --git a/src/qt/qt_vmmanager_main.ui b/src/qt/qt_vmmanager_main.ui index 566cea862b9..a79045aac7f 100644 --- a/src/qt/qt_vmmanager_main.ui +++ b/src/qt/qt_vmmanager_main.ui @@ -60,6 +60,19 @@ 0 + + + + Qt::ClickFocus + + + Search + + + true + + + @@ -76,19 +89,6 @@ - - - - Qt::ClickFocus - - - Search - - - true - - - diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 0e44e6a8ca9..c54fff30b59 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -24,9 +24,6 @@ #include "qt_progsettings.hpp" #include "qt_util.hpp" -#include -#include -#include #include #include @@ -70,11 +67,7 @@ VMManagerMainWindow:: connect(ui->actionCheck_for_updates, &QAction::triggered, this, &VMManagerMainWindow::checkForUpdatesTriggered); #endif - // TODO: Remove all of this (all the way to END REMOVE) once certain the search will no longer be in the toolbar. - // BEGIN REMOVE - // Everything is still setup here for it but it is all hidden. None of it will be - // needed if the search stays in VMManagerMain - ui->actionStartPause->setEnabled(true); + // TODO: Unhide the toolbar once the actions are fixed to properly update on VM status change ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); ui->actionStartPause->setText(tr("Start")); ui->actionStartPause->setToolTip(tr("Start")); @@ -82,36 +75,13 @@ VMManagerMainWindow:: ui->actionForce_Shutdown->setEnabled(false); ui->actionCtrl_Alt_Del->setEnabled(false); - const auto searchBar = new QLineEdit(); - searchBar->setMinimumWidth(150); - searchBar->setPlaceholderText(tr("Search")); - searchBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - searchBar->setClearButtonEnabled(true); - // Spacer to make the search go all the way to the right - const auto spacer = new QWidget(); - spacer->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); - ui->toolBar->addWidget(spacer); - ui->toolBar->addWidget(searchBar); - // Connect signal for search - connect(searchBar, &QLineEdit::textChanged, vmm, &VMManagerMain::searchSystems); // Preferences connect(ui->actionPreferences, &QAction::triggered, this, &VMManagerMainWindow::preferencesTriggered); - // Create a completer for the search bar - auto *completer = new QCompleter(this); - completer->setCaseSensitivity(Qt::CaseInsensitive); - completer->setFilterMode(Qt::MatchContains); - // Get the completer list - const auto allStrings = vmm->getSearchCompletionList(); - // Set up the completer - auto *completerModel = new QStringListModel(allStrings, completer); - completer->setModel(completerModel); - searchBar->setCompleter(completer); #ifdef Q_OS_WINDOWS ui->toolBar->setBackgroundRole(QPalette::Light); #endif ui->toolBar->setVisible(false); - // END REMOVE // Status bar widgets statusLeft->setAlignment(Qt::AlignLeft); diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index c45e83741b2..f4168c8ad2d 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -11,7 +11,7 @@
- 86Box VM Manager + 86Box VM Manager @@ -23,6 +23,9 @@ 21 + + Qt::PreventContextMenu + &Tools @@ -56,22 +59,25 @@ true - toolBar + toolBar false + + Qt::PreventContextMenu + Qt::TopToolBarArea - 16 - 16 + 32 + 32 - Qt::ToolButtonIconOnly + Qt::ToolButtonTextUnderIcon TopToolBarArea @@ -88,9 +94,6 @@ - - true - :/menuicons/qt/icons/run.ico:/menuicons/qt/icons/run.ico @@ -206,21 +209,6 @@ QAction::PreferencesRole - - - true - - - - :/menuicons/qt/icons/run.ico:/menuicons/qt/icons/run.ico - - - &Start - - - false - - &Check for updates... From 85b26b4aed53a49c25c7f15b8206cfde8bfd17b0 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 03:31:05 +0500 Subject: [PATCH 031/320] Manager toolbar: Re-enable the Ctrl+Alt+Del button --- src/qt/qt_vmmanager_main.cpp | 9 +++++++++ src/qt/qt_vmmanager_main.hpp | 1 + src/qt/qt_vmmanager_mainwindow.cpp | 1 + src/qt/qt_vmmanager_mainwindow.ui | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 4dd0422f3ef..e9872bf96b9 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -518,6 +518,15 @@ VMManagerMain::shutdownForceButtonPressed() const selected_sysconfig->shutdownForceButtonPressed(); } +void +VMManagerMain::cadButtonPressed() const +{ + if (!currentSelectionIsValid()) + return; + + selected_sysconfig->cadButtonPressed(); +} + // This function doesn't appear to be needed any longer void VMManagerMain::refresh() diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index 9336f8e23e9..75b626959a6 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -67,6 +67,7 @@ public slots: void pauseButtonPressed() const; void shutdownRequestButtonPressed() const; void shutdownForceButtonPressed() const; + void cadButtonPressed() const; void searchSystems(const QString &text) const; void newMachineWizard(); void updateGlobalSettings(); diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index c54fff30b59..305c5b07d67 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -58,6 +58,7 @@ VMManagerMainWindow:: connect(ui->actionSettings, &QAction::triggered, vmm, &VMManagerMain::settingsButtonPressed); connect(ui->actionHard_Reset, &QAction::triggered, vmm, &VMManagerMain::restartButtonPressed); connect(ui->actionForce_Shutdown, &QAction::triggered, vmm, &VMManagerMain::shutdownForceButtonPressed); + connect(ui->actionCtrl_Alt_Del, &QAction::triggered, vmm, &VMManagerMain::cadButtonPressed); // Set up menu actions // (Disable this if the EMU_BUILD_NUM == 0) diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index f4168c8ad2d..95e5cce74af 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -159,7 +159,7 @@ Ctrl+Alt+Del - false + true false From 517a9f2c02a0e77838d49a28bc2d3ce8f4e85f03 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 03:46:03 +0500 Subject: [PATCH 032/320] Manager: Remove an unused function --- src/qt/qt_vmmanager_main.cpp | 13 ------------- src/qt/qt_vmmanager_main.hpp | 1 - 2 files changed, 14 deletions(-) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index e9872bf96b9..0a3c181f4ca 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -527,19 +527,6 @@ VMManagerMain::cadButtonPressed() const selected_sysconfig->cadButtonPressed(); } -// This function doesn't appear to be needed any longer -void -VMManagerMain::refresh() -{ - const auto current_index = ui->listView->currentIndex(); - emit selectionChanged(current_index, selected_sysconfig->process->state()); - - // if(!selected_sysconfig->config_file.path().isEmpty()) { - if (!selected_sysconfig->isValid()) { - // what was happening here? - } -} - void VMManagerMain::updateDisplayName(const QModelIndex &index) { diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index 75b626959a6..3da9e593446 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -106,7 +106,6 @@ public slots: // const QItemSelection &deselected); void currentSelectionChanged(const QModelIndex ¤t, const QModelIndex &previous); - void refresh(); void updateDisplayName(const QModelIndex &index); void loadSettings(); [[nodiscard]] bool currentSelectionIsValid() const; From b5c6ebd5897a3d41a557bdb4f76adc65bc6a0cfb Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 03:47:23 +0500 Subject: [PATCH 033/320] Manager toolbar: Improve the logic for updating the toolbar button state on VM selection change --- src/qt/qt_vmmanager_main.cpp | 8 ++++-- src/qt/qt_vmmanager_main.hpp | 2 +- src/qt/qt_vmmanager_mainwindow.cpp | 44 +++++++++++++++++++++--------- src/qt/qt_vmmanager_mainwindow.hpp | 2 +- 4 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 0a3c181f4ca..1d32bf402f0 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -423,9 +423,11 @@ VMManagerMain::VMManagerMain(QWidget *parent) completer->setModel(completerModel); ui->searchBar->setCompleter(completer); - // Set initial status bar after the event loop starts QTimer::singleShot(0, this, [this] { + // Set initial status bar after the event loop starts emit updateStatusRight(machineCountString()); + // Tell the mainwindow to enable the toolbar buttons if needed + emit selectionChanged((this->proxy_model->rowCount(QModelIndex()) > 0) ? selected_sysconfig : nullptr); }); #if EMU_BUILD_NUM != 0 @@ -461,7 +463,7 @@ VMManagerMain::currentSelectionChanged(const QModelIndex ¤t, vm_details->updateData(selected_sysconfig); // Emit that the selection changed, include with the process state - emit selectionChanged(current, selected_sysconfig->process->state()); + emit selectionChanged(selected_sysconfig); } void @@ -722,6 +724,8 @@ VMManagerMain::deleteSystem(VMManagerSystem *sysconfig) delete vm_details; vm_details = new VMManagerDetails(); ui->detailsArea->layout()->addWidget(vm_details); + /* tell the mainwindow to disable the toolbar buttons */ + emit selectionChanged(nullptr); } } } diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index 3da9e593446..54a6a4e724a 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -56,7 +56,7 @@ class VMManagerMain final : public QWidget { Settings, }; signals: - void selectionChanged(const QModelIndex ¤tSelection, QProcess::ProcessState processState); + void selectionChanged(VMManagerSystem *sysconfig); void updateStatusLeft(const QString &text); void updateStatusRight(const QString &text); diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 305c5b07d67..152b64bd741 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -69,12 +69,14 @@ VMManagerMainWindow:: #endif // TODO: Unhide the toolbar once the actions are fixed to properly update on VM status change + ui->actionStartPause->setEnabled(false); ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); ui->actionStartPause->setText(tr("Start")); ui->actionStartPause->setToolTip(tr("Start")); ui->actionHard_Reset->setEnabled(false); ui->actionForce_Shutdown->setEnabled(false); ui->actionCtrl_Alt_Del->setEnabled(false); + ui->actionSettings->setEnabled(false); // Preferences connect(ui->actionPreferences, &QAction::triggered, this, &VMManagerMainWindow::preferencesTriggered); @@ -147,29 +149,45 @@ VMManagerMainWindow::~VMManagerMainWindow() = default; void -VMManagerMainWindow::vmmSelectionChanged(const QModelIndex ¤tSelection, const QProcess::ProcessState processState) const +VMManagerMainWindow::vmmSelectionChanged(const VMManagerSystem *sysconfig) const { - if (processState == QProcess::Running) { - ui->actionStartPause->setEnabled(true); - ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/pause.ico")); - ui->actionStartPause->setText(tr("Pause")); - ui->actionStartPause->setToolTip(tr("Pause")); + if (sysconfig == nullptr) { + // This doubles both as a safety check and a way to disable + // all machine-related buttons when no machines are present + ui->actionStartPause->setEnabled(false); + ui->actionSettings->setEnabled(false); + ui->actionHard_Reset->setEnabled(false); + ui->actionForce_Shutdown->setEnabled(false); + ui->actionCtrl_Alt_Del->setEnabled(false); + return; + } + const bool running = sysconfig->process->state() == QProcess::ProcessState::Running; + + if (running) { + if (sysconfig->getProcessStatus() == VMManagerSystem::ProcessStatus::Running) { + ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/pause.ico")); + ui->actionStartPause->setText(tr("Pause")); + ui->actionStartPause->setToolTip(tr("Pause")); + } else { + ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); + ui->actionStartPause->setText(tr("Continue")); + ui->actionStartPause->setToolTip(tr("Continue")); + } disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); - ui->actionHard_Reset->setEnabled(true); - ui->actionForce_Shutdown->setEnabled(true); - ui->actionCtrl_Alt_Del->setEnabled(true); } else { - ui->actionStartPause->setEnabled(true); ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); ui->actionStartPause->setText(tr("Start")); ui->actionStartPause->setToolTip(tr("Start")); disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); - ui->actionHard_Reset->setEnabled(false); - ui->actionForce_Shutdown->setEnabled(false); - ui->actionCtrl_Alt_Del->setEnabled(false); } + + ui->actionStartPause->setEnabled(!sysconfig->window_obscured); + ui->actionSettings->setEnabled(!sysconfig->window_obscured); + ui->actionHard_Reset->setEnabled(sysconfig->window_obscured ? false : running); + ui->actionForce_Shutdown->setEnabled(sysconfig->window_obscured ? false : running); + ui->actionCtrl_Alt_Del->setEnabled(sysconfig->window_obscured ? false : running); } void VMManagerMainWindow::preferencesTriggered() diff --git a/src/qt/qt_vmmanager_mainwindow.hpp b/src/qt/qt_vmmanager_mainwindow.hpp index c0e06f551bb..38263e9ae83 100644 --- a/src/qt/qt_vmmanager_mainwindow.hpp +++ b/src/qt/qt_vmmanager_mainwindow.hpp @@ -55,7 +55,7 @@ public slots: #endif private slots: - void vmmSelectionChanged(const QModelIndex ¤tSelection, QProcess::ProcessState processState) const; + void vmmSelectionChanged(const VMManagerSystem *sysconfig) const; void preferencesTriggered(); #if EMU_BUILD_NUM != 0 void checkForUpdatesTriggered(); From c325ea0aec91716be6a5a338c3e0bf331cf49359 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 03:51:07 +0500 Subject: [PATCH 034/320] Manager toolbar: Cache run/pause icons --- src/qt/qt_vmmanager_mainwindow.cpp | 11 +++++++---- src/qt/qt_vmmanager_mainwindow.hpp | 2 ++ 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 152b64bd741..a0b514672a7 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -46,6 +46,9 @@ VMManagerMainWindow:: vmm_main_window = this; + runIcon = QIcon(":/menuicons/qt/icons/run.ico"); + pauseIcon = QIcon(":/menuicons/qt/icons/pause.ico"); + // Connect signals from the VMManagerMain widget connect(vmm, &VMManagerMain::selectionChanged, this, &VMManagerMainWindow::vmmSelectionChanged); @@ -70,7 +73,7 @@ VMManagerMainWindow:: // TODO: Unhide the toolbar once the actions are fixed to properly update on VM status change ui->actionStartPause->setEnabled(false); - ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); + ui->actionStartPause->setIcon(runIcon); ui->actionStartPause->setText(tr("Start")); ui->actionStartPause->setToolTip(tr("Start")); ui->actionHard_Reset->setEnabled(false); @@ -165,18 +168,18 @@ VMManagerMainWindow::vmmSelectionChanged(const VMManagerSystem *sysconfig) const if (running) { if (sysconfig->getProcessStatus() == VMManagerSystem::ProcessStatus::Running) { - ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/pause.ico")); + ui->actionStartPause->setIcon(pauseIcon); ui->actionStartPause->setText(tr("Pause")); ui->actionStartPause->setToolTip(tr("Pause")); } else { - ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); + ui->actionStartPause->setIcon(runIcon); ui->actionStartPause->setText(tr("Continue")); ui->actionStartPause->setToolTip(tr("Continue")); } disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); } else { - ui->actionStartPause->setIcon(QIcon(":/menuicons/qt/icons/run.ico")); + ui->actionStartPause->setIcon(runIcon); ui->actionStartPause->setText(tr("Start")); ui->actionStartPause->setToolTip(tr("Start")); disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); diff --git a/src/qt/qt_vmmanager_mainwindow.hpp b/src/qt/qt_vmmanager_mainwindow.hpp index 38263e9ae83..c619a657e04 100644 --- a/src/qt/qt_vmmanager_mainwindow.hpp +++ b/src/qt/qt_vmmanager_mainwindow.hpp @@ -45,6 +45,8 @@ class VMManagerMainWindow final : public QMainWindow { void saveSettings() const; QLabel *statusLeft; QLabel *statusRight; + QIcon runIcon; + QIcon pauseIcon; public slots: void setStatusLeft(const QString &text) const; From 26f4916c3266e14aa1644d1733508e2c6698fcf1 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 6 Dec 2025 04:03:48 +0500 Subject: [PATCH 035/320] Manager: Unhide the toolbar --- src/qt/qt_vmmanager_mainwindow.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index a0b514672a7..55677dac1f1 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -87,7 +87,6 @@ VMManagerMainWindow:: #ifdef Q_OS_WINDOWS ui->toolBar->setBackgroundRole(QPalette::Light); #endif - ui->toolBar->setVisible(false); // Status bar widgets statusLeft->setAlignment(Qt::AlignLeft); From d2379f1a66ed58c66b296b3aa67845375a39df2d Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 7 Dec 2025 09:27:46 +0500 Subject: [PATCH 036/320] Manager: Sync toolbar button state with selected VM's state --- src/qt/qt_vmmanager_main.cpp | 25 ++++++++++++++++++++++--- src/qt/qt_vmmanager_main.hpp | 3 ++- src/qt/qt_vmmanager_mainwindow.cpp | 8 +++++--- src/qt/qt_vmmanager_mainwindow.hpp | 2 +- 4 files changed, 30 insertions(+), 8 deletions(-) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 1d32bf402f0..f4b1984dc5f 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -427,7 +427,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) // Set initial status bar after the event loop starts emit updateStatusRight(machineCountString()); // Tell the mainwindow to enable the toolbar buttons if needed - emit selectionChanged((this->proxy_model->rowCount(QModelIndex()) > 0) ? selected_sysconfig : nullptr); + emit selectionOrStateChanged((this->proxy_model->rowCount(QModelIndex()) > 0) ? selected_sysconfig : nullptr); }); #if EMU_BUILD_NUM != 0 @@ -458,12 +458,21 @@ VMManagerMain::currentSelectionChanged(const QModelIndex ¤t, if (!current.isValid()) return; + disconnect(selected_sysconfig->process, &QProcess::stateChanged, this, &VMManagerMain::vmStateChange); + disconnect(selected_sysconfig, &VMManagerSystem::windowStatusChanged, this, &VMManagerMain::vmStateChange); + disconnect(selected_sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerMain::vmStateChange); + const auto mapped_index = proxy_model->mapToSource(current); selected_sysconfig = vm_model->getConfigObjectForIndex(mapped_index); vm_details->updateData(selected_sysconfig); // Emit that the selection changed, include with the process state - emit selectionChanged(selected_sysconfig); + emit selectionOrStateChanged(selected_sysconfig); + + connect(selected_sysconfig->process, &QProcess::stateChanged, this, &VMManagerMain::vmStateChange); + connect(selected_sysconfig, &VMManagerSystem::windowStatusChanged, this, &VMManagerMain::vmStateChange); + connect(selected_sysconfig, &VMManagerSystem::clientProcessStatusChanged, this, &VMManagerMain::vmStateChange); + } void @@ -719,13 +728,14 @@ VMManagerMain::deleteSystem(VMManagerSystem *sysconfig) delete sysconfig; if (vm_model->rowCount(QModelIndex()) <= 0) { + selected_sysconfig = new VMManagerSystem(); /* no machines left - get rid of the last machine's leftovers */ ui->detailsArea->layout()->removeWidget(vm_details); delete vm_details; vm_details = new VMManagerDetails(); ui->detailsArea->layout()->addWidget(vm_details); /* tell the mainwindow to disable the toolbar buttons */ - emit selectionChanged(nullptr); + emit selectionOrStateChanged(nullptr); } } } @@ -799,6 +809,15 @@ VMManagerMain::modelDataChange() emit updateStatusRight(machineCountString(states)); } +void +VMManagerMain::vmStateChange() +{ + if (!currentSelectionIsValid()) + return; + + emit selectionOrStateChanged(selected_sysconfig); +} + void VMManagerMain::onPreferencesUpdated() { diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index 54a6a4e724a..c8e8822ad00 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -56,7 +56,7 @@ class VMManagerMain final : public QWidget { Settings, }; signals: - void selectionChanged(VMManagerSystem *sysconfig); + void selectionOrStateChanged(VMManagerSystem *sysconfig); void updateStatusLeft(const QString &text); void updateStatusRight(const QString &text); @@ -115,6 +115,7 @@ public slots: #endif void showTextFileContents(const QString &title, const QString &path); private slots: + void vmStateChange(); #if EMU_BUILD_NUM != 0 void backgroundUpdateCheckComplete(const UpdateCheck::UpdateResult &result); void backgroundUpdateCheckError(const QString &errorMsg); diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 55677dac1f1..503e2d3ea57 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -50,7 +50,7 @@ VMManagerMainWindow:: pauseIcon = QIcon(":/menuicons/qt/icons/pause.ico"); // Connect signals from the VMManagerMain widget - connect(vmm, &VMManagerMain::selectionChanged, this, &VMManagerMainWindow::vmmSelectionChanged); + connect(vmm, &VMManagerMain::selectionOrStateChanged, this, &VMManagerMainWindow::vmmStateChanged); setWindowTitle(tr("%1 VM Manager").arg(EMU_NAME)); setCentralWidget(vmm); @@ -71,7 +71,7 @@ VMManagerMainWindow:: connect(ui->actionCheck_for_updates, &QAction::triggered, this, &VMManagerMainWindow::checkForUpdatesTriggered); #endif - // TODO: Unhide the toolbar once the actions are fixed to properly update on VM status change + // Set up the toolbar ui->actionStartPause->setEnabled(false); ui->actionStartPause->setIcon(runIcon); ui->actionStartPause->setText(tr("Start")); @@ -151,7 +151,7 @@ VMManagerMainWindow::~VMManagerMainWindow() = default; void -VMManagerMainWindow::vmmSelectionChanged(const VMManagerSystem *sysconfig) const +VMManagerMainWindow::vmmStateChanged(const VMManagerSystem *sysconfig) const { if (sysconfig == nullptr) { // This doubles both as a safety check and a way to disable @@ -176,12 +176,14 @@ VMManagerMainWindow::vmmSelectionChanged(const VMManagerSystem *sysconfig) const ui->actionStartPause->setToolTip(tr("Continue")); } disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); + disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); } else { ui->actionStartPause->setIcon(runIcon); ui->actionStartPause->setText(tr("Start")); ui->actionStartPause->setToolTip(tr("Start")); disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); + disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); } diff --git a/src/qt/qt_vmmanager_mainwindow.hpp b/src/qt/qt_vmmanager_mainwindow.hpp index c619a657e04..067efa4fde7 100644 --- a/src/qt/qt_vmmanager_mainwindow.hpp +++ b/src/qt/qt_vmmanager_mainwindow.hpp @@ -57,7 +57,7 @@ public slots: #endif private slots: - void vmmSelectionChanged(const VMManagerSystem *sysconfig) const; + void vmmStateChanged(const VMManagerSystem *sysconfig) const; void preferencesTriggered(); #if EMU_BUILD_NUM != 0 void checkForUpdatesTriggered(); From f3168b4187c6b8a27fa586568600c0f9b8f1475e Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 7 Dec 2025 14:40:33 +0500 Subject: [PATCH 037/320] Manager: Make the toolbar hideable --- src/qt/qt_vmmanager_mainwindow.cpp | 15 +++++++++++++++ src/qt/qt_vmmanager_mainwindow.hpp | 1 + src/qt/qt_vmmanager_mainwindow.ui | 18 ++++++++++++++++++ 3 files changed, 34 insertions(+) diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 503e2d3ea57..cee6cb2917c 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -106,6 +106,11 @@ VMManagerMainWindow:: { auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); + ui->actionHide_tool_bar->setChecked(!!config->getStringValue("hide_tool_bar").toInt()); + if (ui->actionHide_tool_bar->isChecked()) + ui->toolBar->setVisible(false); + else + config->setStringValue("hide_tool_bar", "0"); if (!!config->getStringValue("window_remember").toInt()) { QString coords = config->getStringValue("window_coordinates"); if (!coords.isEmpty()) { @@ -217,6 +222,7 @@ VMManagerMainWindow::saveSettings() const const auto currentSelection = vmm->getCurrentSelection(); const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); config->setStringValue("last_selection", currentSelection); + config->setStringValue("hide_tool_bar", (ui->toolBar->isVisible() ? "0" : "1")); if (!!config->getStringValue("window_remember").toInt()) { config->setStringValue("window_coordinates", QString::asprintf("%i, %i, %i, %i", this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height())); config->setStringValue("window_maximized", this->isMaximized() ? "1" : ""); @@ -287,6 +293,15 @@ VMManagerMainWindow::setStatusRight(const QString &text) const statusRight->setText(text); } +void +VMManagerMainWindow::on_actionHide_tool_bar_triggered() +{ + const auto config = new VMManagerConfig(VMManagerConfig::ConfigType::General); + int isHidden = config->getStringValue("hide_tool_bar").toInt(); + ui->toolBar->setVisible(!!isHidden); + config->setStringValue("hide_tool_bar", (isHidden ? "0" : "1")); +} + #if EMU_BUILD_NUM != 0 void VMManagerMainWindow::checkForUpdatesTriggered() diff --git a/src/qt/qt_vmmanager_mainwindow.hpp b/src/qt/qt_vmmanager_mainwindow.hpp index 067efa4fde7..5d96fa5b265 100644 --- a/src/qt/qt_vmmanager_mainwindow.hpp +++ b/src/qt/qt_vmmanager_mainwindow.hpp @@ -58,6 +58,7 @@ public slots: private slots: void vmmStateChanged(const VMManagerSystem *sysconfig) const; + void on_actionHide_tool_bar_triggered(); void preferencesTriggered(); #if EMU_BUILD_NUM != 0 void checkForUpdatesTriggered(); diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index 95e5cce74af..badb2e95f1e 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -41,6 +41,12 @@ + + + &View + + + &Help @@ -50,6 +56,7 @@ + @@ -198,6 +205,17 @@ New machine...
+ + + true + + + Hide &toolbar + + + Hide tool bar + + &Preferences... From d5b06c50f5b11217ae2b6febc991d7ce6bfe1da0 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Mon, 8 Dec 2025 02:50:10 +0500 Subject: [PATCH 038/320] Manager: Use the new icon for the "New machine" button --- src/qt/qt_vmmanager_mainwindow.ui | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index badb2e95f1e..99e222d169f 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -196,7 +196,7 @@ - :/settings/qt/icons/86Box-yellow.ico:/settings/qt/icons/86Box-yellow.ico + :/menuicons/qt/icons/new_vm.ico:/menuicons/qt/icons/new_vm.ico &New machine... From 2e9dec88919e75870c50396028144edf4f5660c1 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sun, 7 Dec 2025 17:04:30 +0500 Subject: [PATCH 039/320] Qt: Remove the `shortcutVisibleInContextMenu` property from menu items --- src/qt/qt_mainwindow.cpp | 8 -------- src/qt/qt_mainwindow.ui | 12 ------------ src/qt/qt_vmmanager_mainwindow.ui | 3 --- 3 files changed, 23 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index df323986e44..cd752398531 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -780,10 +780,6 @@ MainWindow::MainWindow(QWidget *parent) ui->actionUpdate_mouse_every_CPU_frame->setChecked(true); } -#ifdef Q_OS_MACOS - ui->actionCtrl_Alt_Del->setShortcutVisibleInContextMenu(true); - ui->actionTake_screenshot->setShortcutVisibleInContextMenu(true); -#endif if (!vnc_enabled) video_setblit(qt_blit); @@ -811,10 +807,6 @@ MainWindow::MainWindow(QWidget *parent) mtr_stop(); mtr_shutdown(); }; -# ifdef Q_OS_MACOS - ui->actionBegin_trace->setShortcutVisibleInContextMenu(true); - ui->actionEnd_trace->setShortcutVisibleInContextMenu(true); -# endif static bool trace = false; connect(ui->actionBegin_trace, &QAction::triggered, this, [this] { if (trace) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 5b5265b4282..46364a258c9 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -375,9 +375,6 @@ false - - false - @@ -753,9 +750,6 @@ Ctrl+F11 - - false - @@ -833,9 +827,6 @@ false - - false - @@ -847,9 +838,6 @@ false - - false - diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index 99e222d169f..2501b150177 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -171,9 +171,6 @@ false - - false - From 74eb21329b350b69756d57b77d274ad1bb3c6659 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Mon, 8 Dec 2025 02:52:40 +0500 Subject: [PATCH 040/320] Qt: Show icons in menu for actions that have them --- src/qt/qt_mainwindow.ui | 15 --------------- src/qt/qt_vmmanager_mainwindow.ui | 15 --------------- 2 files changed, 30 deletions(-) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 46364a258c9..20d625286aa 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -354,9 +354,6 @@ &Hard reset - - false - @@ -372,9 +369,6 @@ Ctrl+F12 - - false - @@ -384,9 +378,6 @@ Ctrl+Alt+&Esc - - false - @@ -396,9 +387,6 @@ &Pause - - false - @@ -419,9 +407,6 @@ QAction::NoRole - - false - diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index 2501b150177..12ef7dee2da 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -111,9 +111,6 @@ Start - - false - @@ -126,9 +123,6 @@ Hard reset - - false - @@ -147,9 +141,6 @@ true - - false - @@ -168,9 +159,6 @@ true - - false - @@ -186,9 +174,6 @@ QAction::NoRole - - false - From 4ce1c04165004d4cb1e4f995cfc2cd3ba0449a44 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 8 Dec 2025 13:52:54 +0100 Subject: [PATCH 041/320] New VM icon: add the 24x24, 20x20, and 16x16 sizes. --- src/qt/icons/new_vm.ico | Bin 37670 -> 43006 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/new_vm.ico b/src/qt/icons/new_vm.ico index ea5c2aea2f73d32cc031c435630a1540f175082c..c413c70f8c3d808b5e8baf61d8b621fc65efa39f 100644 GIT binary patch delta 1352 zcmaJ=O=}ZT6up_$%tw>SG@aOKowUFgAu3QL8bvO zanv)An;jx^BI3HS|0*T&l`+qY{RgJV<4%zvi2Wz5>(7f6i>>-Tk$1x)rBaLMdVfWv zLa6@5agk5gn9p~xRDulu6rrrrfuo0dQRo`QWNyzutyXI?+LUS=luxTxt60>A@a%G@ z)1=AkRt|ZT-4M$c3|A2w7Bx}id_MFer^yOdDf^?k(Gz06HVkOhor4Rcrrm>Ln@m)U#d#`ye$^9n?9)(-oM2+iJ#%uq9;_9qb zN>J=bkqsdprdmQA!~N_*j3)+gKeZ1}FBOp8sq5UkIu*J!ay?!$7UKX`l4;B&U5vZK z6edf~$MJp#R!1Ih^FC{{SSq-%ceq%-ZQ>M1bwlgHR4%|!&gJNKakK|pqaEXDT{Mgl zYx5$gx%6S)EZXY*Dy&T6aKj8y&ZsUP8l54&hK|-wS%wu4SLqoy%7kjTmTIETv=KIo zSruwCe52|=drNE{prMa)@YdBMEEphoQ-~^2Yr`tnbz+q{+o4W=U5-RL@FNp`IGZ2D zwAs?(^x_v2CyQf|6qC8bcym@sk;RNBWl8E%_j;0ykxG>Ua%@1KaV@VDlS2&D9 z*HP-liR&j|-{I3J;m2GWpLK4a!$BX_cw_ol(|t5}KWxjxiWO}6X%FSjzx;Nd`Q^+O zzmQ@5hTrNxZu_{-{%W6gb`-hUko&19k*0KtlOz%pNGOm{jDJyQY`q1wt}}l-tdsx6 KzR!=ZKKc!4&eq-l delta 82 zcmex&o@v=KCN~BKMg|rJ1qBeTz_3DqfdMGQprHZbXGk$HyaS3E7(nG!85qK}85kTK UAbbrc28MqD3=Es)L?287026QxIRF3v From c0c52f6e030f1ab334a1ac0df624773d403e7674 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 8 Dec 2025 13:54:04 +0100 Subject: [PATCH 042/320] Slightly correct the 16x16 icon. --- src/qt/icons/new_vm.ico | Bin 43006 -> 43006 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/new_vm.ico b/src/qt/icons/new_vm.ico index c413c70f8c3d808b5e8baf61d8b621fc65efa39f..7824c413e2a11436e6f050fca93ce1bbb2c81754 100644 GIT binary patch delta 46 zcmV+}0MY;c&jS9>00 Date: Mon, 8 Dec 2025 13:54:43 +0100 Subject: [PATCH 043/320] And 20x20. --- src/qt/icons/new_vm.ico | Bin 43006 -> 43006 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/new_vm.ico b/src/qt/icons/new_vm.ico index 7824c413e2a11436e6f050fca93ce1bbb2c81754..27e4a260609acec98023b7e6aab501b9d0a34947 100644 GIT binary patch delta 18 acmex&p6TCtrVZCPC%;k<*!+xBVjcitq6sqq delta 18 acmex&p6TCtrVZCPC);%hY<|WmF%JM=8VK(I From 6e9ba6ed8584dc6e44a064c856d7f8c8e18d0aa3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 10 Dec 2025 00:28:33 +0100 Subject: [PATCH 044/320] Windows serial passthrough: use PIPE_UNLIMITED_INSTANCES, not 1. --- src/qt/win_serial_passthrough.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/win_serial_passthrough.c b/src/qt/win_serial_passthrough.c index 58ebb7fcb0f..ab2d8a9ee3b 100644 --- a/src/qt/win_serial_passthrough.c +++ b/src/qt/win_serial_passthrough.c @@ -215,7 +215,7 @@ open_pseudo_terminal(serial_passthrough_t *dev) char ascii_pipe_name[1024] = { 0 }; strncpy(ascii_pipe_name, dev->named_pipe, sizeof(ascii_pipe_name)); ascii_pipe_name[1023] = '\0'; - dev->master_fd = (intptr_t) CreateNamedPipeA(ascii_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, 1, 65536, 65536, NMPWAIT_USE_DEFAULT_WAIT, NULL); + dev->master_fd = (intptr_t) CreateNamedPipeA(ascii_pipe_name, PIPE_ACCESS_DUPLEX, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_NOWAIT, PIPE_UNLIMITED_INSTANCES, 65536, 65536, NMPWAIT_USE_DEFAULT_WAIT, NULL); if (dev->master_fd == (intptr_t) INVALID_HANDLE_VALUE) { wchar_t errorMsg[1024] = { 0 }; wchar_t finalMsg[1024] = { 0 }; From b181d2d194814bc705756487a71c33120d2b4af9 Mon Sep 17 00:00:00 2001 From: BlueRain-debug <68976789+BlueRain-debug@users.noreply.github.com> Date: Thu, 11 Dec 2025 01:49:23 +0800 Subject: [PATCH 045/320] Update zh-TW.po 1. Missing translation fields have been added. 2. Some translations have been adjusted. --- src/qt/languages/zh-TW.po | 48 ++++++++++++++++++++++++--------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index d17f369230c..b008335e011 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -115,7 +115,7 @@ msgid "&Linear" msgstr "線性(&L)" msgid "Hi&DPI scaling" -msgstr "HiDPI 縮放(&D)" +msgstr "高 DPI 縮放(&D)" msgid "&Fullscreen" msgstr "全螢幕(&F)" @@ -265,7 +265,7 @@ msgid "&Mute" msgstr "靜音(&M)" msgid "E&mpty" -msgstr "空置光碟機(&M)" +msgstr "卸載(&M)" msgid "Reload previous image" msgstr "載入上一個影像" @@ -373,7 +373,7 @@ msgid "Dynamic Recompiler" msgstr "動態重編譯器" msgid "CPU frame size" -msgstr "CPU 執行幀大小" +msgstr "CPU 影格大小" msgid "Larger frames (less smooth)" msgstr "大執行幀 (操作欠平滑)" @@ -613,10 +613,10 @@ msgid "MO:" msgstr "磁光碟:" msgid "Removable disks:" -msgstr "可移除磁碟:" +msgstr "抽取式磁碟:" msgid "Removable disk drives:" -msgstr "可移除磁碟機:" +msgstr "抽取式磁碟機:" msgid "ZIP 250" msgstr "ZIP 250" @@ -670,13 +670,13 @@ msgid "Speed" msgstr "速度" msgid "Removable disk %1 (%2): %3" -msgstr "可移除磁碟 %1 (%2): %3" +msgstr "抽取式磁碟 %1 (%2): %3" msgid "&Removable disk %1 (%2): %3" -msgstr "可移除磁碟(&R) %1 (%2): %3" +msgstr "抽取式磁碟(&R) %1 (%2): %3" msgid "Removable disk images" -msgstr "可移除磁碟影像" +msgstr "抽取式磁碟影像" msgid "Image %1" msgstr "影像 %1" @@ -748,7 +748,7 @@ msgid "Parallel ports:" msgstr "並列埠:" msgid "Storage controllers" -msgstr "存儲控制器" +msgstr "儲存控制器" msgid "Hard disks" msgstr "硬碟" @@ -1021,7 +1021,7 @@ msgid "About %1" msgstr "關於 %1" msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." -msgstr "一個舊式電腦模擬器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\n之前的核心貢獻來自 Sarah Walker、leilei、JohnElliott、greatpsycho 等人。\n\n本軟體依據 GNU 通用公共授權第二版或更新版本發佈。詳情見 LICENSE 檔案。" +msgstr "一個舊式電腦模擬器\n\n作者: Miran Grča (OBattler)、RichardG867、Jasmine Iwanek、TC1995、coldbrewed、Teemu Korhonen (Manaatti)、Joakim L. Gilje、Adrien Moulin (elyosh)、Daniel Balsom (gloriouscow)、Cacodemon345、Fred N. van Kempen (waltje)、Tiseno100、reenigne 等人。\n\n之前的核心貢獻來自 Sarah Walker、leilei、JohnElliott、greatpsycho 等人。\n\n本軟體依據 GNU 通用公眾授權條款第二版或更新版本發佈。詳情見 LICENSE 檔案。" msgid "Hardware not available" msgstr "硬體不可用" @@ -1180,7 +1180,7 @@ msgid "Introduction" msgstr "簡介" msgid "This will help you add a new system to 86Box." -msgstr "這將有助於您在 86Box 中加入新系統。" +msgstr "這將協助您在 86Box 中加入新系統。" msgid "New configuration" msgstr "新增設定" @@ -1687,7 +1687,7 @@ msgid "Show non-&primary monitors" msgstr "顯示非主要監視器(&P)" msgid "Open screenshots &folder..." -msgstr "開啟螢幕擷圖資料夾(&F)..." +msgstr "開啟螢幕擷取畫面資料夾(&F)..." msgid "Appl&y fullscreen stretch mode when maximized" msgstr "最大化時套用全螢幕延展模式(&Y)" @@ -1720,13 +1720,13 @@ msgid "Null Driver" msgstr "空驅動程式" msgid "NIC:" -msgstr "網路卡:" +msgstr "網路介面控制器:" msgid "NIC %1 (%2) %3" -msgstr "網路卡 %1 (%2) %3" +msgstr "網路介面控制器 %1 (%2) %3" msgid "&NIC %1 (%2) %3" -msgstr "網路卡 %1 (%2) %3(&N)" +msgstr "網路介面控制器 %1 (%2) %3(&N)" msgid "Render behavior" msgstr "渲染行為" @@ -1759,7 +1759,7 @@ msgid "Couldn't switch to OpenGL context." msgstr "無法切換至 OpenGL 內容。" msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" -msgstr "需要 OpenGL 版本 3.0 或更高。目前版本為 %1.%2" +msgstr "需要 OpenGL 版本 3.0 或更高版本。目前版本為 %1.%2" msgid "Error initializing OpenGL" msgstr "初始化 OpenGL 出錯" @@ -2845,10 +2845,10 @@ msgid "Toggle fullscreen" msgstr "切換全螢幕" msgid "Toggle UI in fullscreen" -msgstr "切換使用者介面至全螢幕" +msgstr "全螢幕模式下切換使用者介面顯示" msgid "Screenshot" -msgstr "螢幕擷圖" +msgstr "螢幕擷取畫面" msgid "Release mouse pointer" msgstr "放開滑鼠游標" @@ -3038,3 +3038,15 @@ msgstr "暗色" msgid "Search:" msgstr "搜尋:" + +msgid "Force interpretation" +msgstr "強制解譯執行" + +msgid "Allow recompilation" +msgstr "允許重編譯" + +msgid "&Force interpretation" +msgstr "強制解譯執行(&F)" + +msgid "&Allow recompilation" +msgstr "允許重編譯(&A)" From a37b813db267dae62df355ce3987921513b0f0ed Mon Sep 17 00:00:00 2001 From: TC1995 Date: Thu, 11 Dec 2025 21:10:34 +0100 Subject: [PATCH 046/320] Mach64: fix wrong refresh rates based on the character width to be calculated for the crtc timer. svga->char_width should be 8 when Mach64 extended modes are enabled. --- src/video/vid_ati_mach64.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 3d244e55144..6e9c0f6d290 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -563,6 +563,7 @@ mach64_recalctimings(svga_t *svga) const mach64_t *mach64 = (mach64_t *) svga->priv; if (((mach64->crtc_gen_cntl >> 24) & 3) == 3) { + svga->char_width = 8; svga->vtotal = (mach64->crtc_v_total_disp & 2047) + 1; svga->dispend = ((mach64->crtc_v_total_disp >> 16) & 2047) + 1; svga->htotal = (mach64->crtc_h_total_disp & 255) + 1; @@ -826,7 +827,7 @@ mach64_recalc_dp_set_engine(mach64_t *mach64) mach64->src_off_pitch = 0; if (mach64->dp_set_gui_engine & (1 << 15)) mach64->src_off_pitch = mach64->dst_off_pitch; - + switch ((mach64->dp_set_gui_engine >> 16) & 3) { case 0: @@ -983,7 +984,7 @@ mach64_accel_write_fifo(mach64_t *mach64, uint32_t addr, uint8_t val) mach64_blit(0, -1, mach64); } break; - + case 0x2ec: case 0x2ed: case 0x2ee: @@ -2782,7 +2783,7 @@ mach64_ext_readb(uint32_t addr, void *priv) case 0x23: READ8(addr, mach64->dsp_config); break; - + case 0x24: case 0x25: case 0x26: @@ -2875,7 +2876,7 @@ mach64_ext_readb(uint32_t addr, void *priv) READ8(addr, mach64->gp_io); } // pclog("GPIO READ 0x%X, 0x00\n", addr & 0x3ff); - + break; case 0x80: case 0x81: @@ -3015,7 +3016,7 @@ mach64_ext_readb(uint32_t addr, void *priv) mach64_wait_fifo_idle(mach64); READ8(addr ^ 2, mach64->dst_height_width); break; - + case 0x110: case 0x111: addr += 2; @@ -3331,7 +3332,7 @@ mach64_ext_readb(uint32_t addr, void *priv) ret = FIFO_EMPTY ? 0 : 1; break; - + case 0x33a: ret = FIFO_EMPTY ? 32 : 31; break; @@ -3721,7 +3722,7 @@ mach64_ext_writeb(uint32_t addr, uint8_t val, void *priv) svga->hwcursor.yoff = (mach64->cur_horz_vert_off >> 16) & 0x3f; } break; - + case 0x78: case 0x79: case 0x7A: From d0583d62d6c9f96bd26c327c827f8f182aa73c4f Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 12 Dec 2025 15:20:11 +0100 Subject: [PATCH 047/320] XT Keyboard: Actually honor the configuration option for the keys. --- src/device/keyboard_xt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index d31d5f027d0..41f8937e51a 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -562,7 +562,7 @@ kbd_init(const device_t *info) { kbd_t *dev = (kbd_t *) calloc(1, sizeof(kbd_t)); - dev->type = info->local; + dev->type = device_get_config_int("keys"); if (dev->type == KBD_83_KEY) keyboard_set_table(scancode_xt); From 791daafceb8d954f3e7165ddd84e24c62109a55d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Dec 2025 16:45:04 -0300 Subject: [PATCH 048/320] Dynarec: Force interpreter on pages that undergo excessive invalidation, improves % on TES Daggerfall and potentially other self-modifying code --- src/86box.c | 3 +++ src/cpu/386_dynarec.c | 30 +++++++++++++++++++++--------- src/include/86box/86box.h | 1 + src/include/86box/mem.h | 6 ++++++ 4 files changed, 31 insertions(+), 9 deletions(-) diff --git a/src/86box.c b/src/86box.c index ba42fb7486c..67853bf7d6a 100644 --- a/src/86box.c +++ b/src/86box.c @@ -331,6 +331,7 @@ int scrnsz_y = SCREEN_RES_Y; /* current screen size, Y */ int config_changed; /* config has changed */ int title_update; int framecountx = 0; +int seconds_elapsed = 0; int hard_reset_pending = 0; #if 0 @@ -1974,6 +1975,8 @@ pc_onesec(void) framecount = 0; title_update = 1; + + seconds_elapsed++; } void diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 852c25427f4..865706516c1 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -404,14 +404,15 @@ exec386_dynarec_dyn(void) # endif int valid_block = 0; +# define INVALIDATION_LIMIT 100 /* amount of invalidations *per second* to kick a page to the interpreter */ + page_t *page = &pages[phys_addr >> 12]; + int can_recompile = (page->inv_count < INVALIDATION_LIMIT); # ifdef USE_NEW_DYNAREC - if (!cpu_state.abrt) + if (!cpu_state.abrt && can_recompile) # else - if (block && !cpu_state.abrt) + if (block && !cpu_state.abrt && can_recompile) # endif { - page_t *page = &pages[phys_addr >> 12]; - /* Block must match current CS, PC, code segment size, and physical address. The physical address check will also catch any page faults at this stage */ @@ -445,16 +446,26 @@ exec386_dynarec_dyn(void) if (valid_block && (block->page_mask & *block->dirty_mask)) { # ifdef USE_NEW_DYNAREC codegen_check_flush(page, page->dirty_mask, phys_addr); - if (block->pc == BLOCK_PC_INVALID) + if (block->pc == BLOCK_PC_INVALID) { valid_block = 0; - else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) + goto invalid_block; + } else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) { block->flags &= ~CODEBLOCK_WAS_RECOMPILED; +invalid_block: # else codegen_check_flush(page, page->dirty_mask[(phys_addr >> 10) & 3], phys_addr); page->dirty_mask[(phys_addr >> 10) & 3] = 0; - if (!block->valid) + if (!block->valid) { valid_block = 0; # endif + if (page->inv_timestamp != seconds_elapsed) { + page->inv_timestamp = seconds_elapsed; + page->inv_count = 1; + } else if (++page->inv_count >= INVALIDATION_LIMIT) { + pclog("Forcing interpreter on page %08X\n", phys_addr & 0xfffff000); + can_recompile = 0; + } + } } if (valid_block && block->page_mask2) { /* We don't want the second page to cause a page @@ -653,7 +664,8 @@ exec386_dynarec_dyn(void) cpu_block_end = 0; x86_was_reset = 0; - codegen_block_init(phys_addr); + if (can_recompile) + codegen_block_init(phys_addr); while (!cpu_block_end) { # ifndef USE_NEW_DYNAREC @@ -731,7 +743,7 @@ exec386_dynarec_dyn(void) cpu_end_block_after_ins = 0; - if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !new_ne && !x86_was_reset) + if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !new_ne && !x86_was_reset && can_recompile) codegen_block_end(); if (x86_was_reset) diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 67ba5ec1bae..a1406d2015a 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -320,6 +320,7 @@ extern void do_pause(int p); extern double isa_timing; extern int io_delay; extern int framecountx; +extern int seconds_elapsed; extern volatile int cpu_thread_run; extern uint8_t postcard_codes[POSTCARDS_NUM]; diff --git a/src/include/86box/mem.h b/src/include/86box/mem.h index 9051189a635..215dca438b1 100644 --- a/src/include/86box/mem.h +++ b/src/include/86box/mem.h @@ -224,6 +224,9 @@ typedef struct page_t { uint64_t *byte_dirty_mask; uint64_t *byte_code_present_mask; + + uint32_t inv_count; + uint32_t inv_timestamp; } page_t; extern uint32_t purgable_page_list_head; @@ -250,6 +253,9 @@ typedef struct _page_ { /*Head of codeblock tree associated with this page*/ struct codeblock_t *head; + + uint32_t inv_count; + uint32_t inv_timestamp; } page_t; #endif From 2ca88989c41e94ab6d1ae8eab3ec19bf807185c3 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Dec 2025 16:46:23 -0300 Subject: [PATCH 049/320] BT48x: Remove excess logging --- src/video/ramdac/vid_ramdac_bt48x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/ramdac/vid_ramdac_bt48x.c b/src/video/ramdac/vid_ramdac_bt48x.c index 2133e02a03c..52e5a7bd2d8 100644 --- a/src/video/ramdac/vid_ramdac_bt48x.c +++ b/src/video/ramdac/vid_ramdac_bt48x.c @@ -377,7 +377,9 @@ bt48x_recalctimings(void *priv, svga_t *svga) if (svga->bpp >= 15) svga->true_color_bypass = !!(ramdac->cmd_r1 & 0x10); +#if 0 pclog("CR0=%02x, CR1=%02x, CR2=%02x.\n", ramdac->cmd_r0, ramdac->cmd_r1, ramdac->cmd_r2); +#endif } void From cf78e44d34fa697419d5aac9d38f0bf45146812e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Dec 2025 16:47:41 -0300 Subject: [PATCH 050/320] Dynarec: Remove excess logging [skip ci] --- src/cpu/386_dynarec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 865706516c1..e0d59fdec9b 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -462,7 +462,7 @@ exec386_dynarec_dyn(void) page->inv_timestamp = seconds_elapsed; page->inv_count = 1; } else if (++page->inv_count >= INVALIDATION_LIMIT) { - pclog("Forcing interpreter on page %08X\n", phys_addr & 0xfffff000); + x386_dynarec_log("Forcing interpreter on page %08X\n", phys_addr & 0xfffff000); can_recompile = 0; } } From cb1bb4c861fd7d0eb4862c5034b7c33d55eab966 Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sat, 13 Dec 2025 15:17:07 -0500 Subject: [PATCH 051/320] Correct default base address for Covox voice master Key --- src/sound/snd_covox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/snd_covox.c b/src/sound/snd_covox.c index c7e32c7dc02..0d6b1dbc1b0 100644 --- a/src/sound/snd_covox.c +++ b/src/sound/snd_covox.c @@ -243,7 +243,7 @@ static const device_config_t voicemasterkey_config[] = { .description = "Address", .type = CONFIG_HEX16, .default_string = NULL, - .default_int = 0x388, + .default_int = 0x22f, .file_filter = NULL, .spinner = { 0 }, .selection = { From d2c30ea6c613dc7610cde99e15bc73c9293adc08 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 13 Dec 2025 18:06:51 -0300 Subject: [PATCH 052/320] Dynarec: Rework page interpreter override method, should fix "deleting deleted block" fatals --- src/cpu/386_dynarec.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index e0d59fdec9b..26034657275 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -392,10 +392,9 @@ static inline void __attribute__((optimize("O2"))) #else static __inline void #endif -exec386_dynarec_dyn(void) +exec386_dynarec_dyn(uint32_t phys_addr, page_t *page) { uint32_t start_pc = 0; - uint32_t phys_addr = get_phys(cs + cpu_state.pc); int hash = HASH(phys_addr); # ifdef USE_NEW_DYNAREC codeblock_t *block = &codeblock[codeblock_hash[hash]]; @@ -404,13 +403,10 @@ exec386_dynarec_dyn(void) # endif int valid_block = 0; -# define INVALIDATION_LIMIT 100 /* amount of invalidations *per second* to kick a page to the interpreter */ - page_t *page = &pages[phys_addr >> 12]; - int can_recompile = (page->inv_count < INVALIDATION_LIMIT); # ifdef USE_NEW_DYNAREC - if (!cpu_state.abrt && can_recompile) + if (!cpu_state.abrt) # else - if (block && !cpu_state.abrt && can_recompile) + if (block && !cpu_state.abrt) # endif { /* Block must match current CS, PC, code segment size, @@ -461,9 +457,13 @@ exec386_dynarec_dyn(void) if (page->inv_timestamp != seconds_elapsed) { page->inv_timestamp = seconds_elapsed; page->inv_count = 1; - } else if (++page->inv_count >= INVALIDATION_LIMIT) { - x386_dynarec_log("Forcing interpreter on page %08X\n", phys_addr & 0xfffff000); - can_recompile = 0; + } else { + page->inv_count++; +# define INVALIDATION_LIMIT 100 /* amount of invalidations *per second* to kick a page to the interpreter */ +# ifdef ENABLE_386_DYNAREC_LOG + if (page->inv_count >= INVALIDATION_LIMIT) + x386_dynarec_log("Forcing interpreter on page %08X\n", phys_addr & 0xfffff000); +# endif } } } @@ -664,8 +664,7 @@ exec386_dynarec_dyn(void) cpu_block_end = 0; x86_was_reset = 0; - if (can_recompile) - codegen_block_init(phys_addr); + codegen_block_init(phys_addr); while (!cpu_block_end) { # ifndef USE_NEW_DYNAREC @@ -743,7 +742,7 @@ exec386_dynarec_dyn(void) cpu_end_block_after_ins = 0; - if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !new_ne && !x86_was_reset && can_recompile) + if ((!cpu_state.abrt || (cpu_state.abrt & ABRT_EXPECTED)) && !new_ne && !x86_was_reset) codegen_block_end(); if (x86_was_reset) @@ -791,11 +790,14 @@ exec386_dynarec(int32_t cycs) cycles_old = cycles; oldtsc = tsc; tsc_old = tsc; - if (cpu_force_interpreter || cpu_override_dynarec || (!CACHE_ON())) /*Interpret block*/ + + uint32_t phys_addr = get_phys(cs + cpu_state.pc); + page_t *page = &pages[phys_addr >> 12]; + if (cpu_force_interpreter || cpu_override_dynarec || (page->inv_count >= INVALIDATION_LIMIT) || (!CACHE_ON())) /*Interpret block*/ { exec386_dynarec_int(); } else { - exec386_dynarec_dyn(); + exec386_dynarec_dyn(phys_addr, page); } if (cpu_init) { From 6e090318f1554ff15776e928c04f1ef2da374f0b Mon Sep 17 00:00:00 2001 From: Toni Riikonen Date: Sun, 14 Dec 2025 13:43:42 +0200 Subject: [PATCH 053/320] Setting default seek time (10ms) for fdd seeks, as 0ms seek time causes issues on some OS'ses. Also enabled to use seek-times defined for fdd audio profile "None". --- src/floppy/fdd.c | 6 +++++- src/floppy/fdd_audio.c | 4 ++-- src/include/86box/fdd.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 164c0b03701..30be0979af8 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -365,7 +365,7 @@ void fdd_seek(int drive, int track_diff) { fdd_log("fdd_seek(drive=%d, track_diff=%d)\n", drive, track_diff); - if (!track_diff) + if (track_diff == 0) return; if (fdd_seek_in_progress[drive]) { @@ -411,6 +411,10 @@ fdd_seek(int drive, int track_diff) /* Get seek timings from audio profile configuration with direction awareness */ double seek_time_us = fdd_audio_get_seek_time(drive, actual_track_diff, is_seek_down); + if (seek_time_us < 1) { + seek_time_us = DEFAULT_SEEK_TIME_MS * 1000; + } + fdd_log("Seek timing for drive %d: %.2f µs (%s)\n", drive, seek_time_us, is_seek_down ? "DOWN" : "UP"); uint64_t seek_delay_us = seek_time_us * TIMER_USEC; diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 5fe5e6358a3..9bd9aeea6ef 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -291,7 +291,7 @@ fdd_audio_load_profiles(void) void load_profile_samples(int profile_id) { - if (profile_id <= 0 || profile_id >= audio_profile_count) + if (profile_id < 0 || profile_id >= audio_profile_count) return; fdd_audio_profile_config_t *config = &audio_profiles[profile_id]; @@ -444,7 +444,7 @@ double fdd_audio_get_seek_time(int drive, int track_count, int is_seek_down) { int profile_id = fdd_get_audio_profile(drive); - if (profile_id <= 0 || profile_id >= audio_profile_count) { + if (profile_id < 0 || profile_id >= audio_profile_count) { return 0; } diff --git a/src/include/86box/fdd.h b/src/include/86box/fdd.h index b10c3485489..a173279a4d5 100644 --- a/src/include/86box/fdd.h +++ b/src/include/86box/fdd.h @@ -24,6 +24,7 @@ #define FDD_NUM 4 #define FLOPPY_IMAGE_HISTORY 10 #define SEEK_RECALIBRATE -999 +#define DEFAULT_SEEK_TIME_MS 10.0 #ifdef __cplusplus extern "C" { From 601155fdd6f45ec997dcb8e2e9f149a6d458a666 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 14 Dec 2025 23:27:18 +0600 Subject: [PATCH 054/320] Implement Voodoo alpha planes and alpha mask support Fallback to interpreter if alpha planes are used for now --- src/include/86box/vid_voodoo_codegen_x86-64.h | 18 ++++++++++ src/include/86box/vid_voodoo_regs.h | 5 +++ src/video/vid_voodoo_render.c | 34 +++++++++++++++---- 3 files changed, 50 insertions(+), 7 deletions(-) diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index e8b7299f24a..8aba3e5b55f 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -656,6 +656,7 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, int block_pos = 0; int z_skip_pos = 0; int a_skip_pos = 0; + int amask_skip_pos = 0; int chroma_skip_pos = 0; int depth_jump_pos = 0; int depth_jump_pos2 = 0; @@ -1732,6 +1733,15 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0xdb); break; } + if (params->fbzMode & FBZ_ALPHA_MASK) { + addbyte(0xf7); /*TEST EBX, 1*/ + addbyte(0xc3); + addlong(1); + addbyte(0x0f); /* JZ amask_skip_pos */ + addbyte(0x84); + amask_skip_pos = block_pos; + addlong(0); + } /*ECX = a_local*/ switch (cca_localselect) { case CCA_LOCALSELECT_ITER_A: @@ -2986,6 +2996,8 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, *(uint32_t *) &code_block[a_skip_pos] = (block_pos - a_skip_pos) - 4; if (chroma_skip_pos) *(uint32_t *) &code_block[chroma_skip_pos] = (block_pos - chroma_skip_pos) - 4; + if (amask_skip_pos) + *(uint32_t *) &code_block[amask_skip_pos] = (block_pos - amask_skip_pos) - 4; addbyte(0x4c); /*MOV RSI, R15*/ addbyte(0x89); @@ -3225,6 +3237,12 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat voodoo_x86_data_t *voodoo_x86_data = voodoo->codegen_data; voodoo_x86_data_t *data; + if (params->fbzMode & FBZ_ALPHA_ENABLE) { + // Lands of Lore III relies on the alpha buffer functionality to create its transparent textures. + // Fallback to interpreter. + return NULL; + } + for (uint8_t c = 0; c < 8; c++) { data = &voodoo_x86_data[odd_even + c * 4]; //&voodoo_x86_data[odd_even][b]; diff --git a/src/include/86box/vid_voodoo_regs.h b/src/include/86box/vid_voodoo_regs.h index 6aeb98bccfc..3340720a7ec 100644 --- a/src/include/86box/vid_voodoo_regs.h +++ b/src/include/86box/vid_voodoo_regs.h @@ -366,11 +366,14 @@ enum { FBZ_DEPTH_WMASK = (1 << 10), FBZ_DITHER_2x2 = (1 << 11), + FBZ_ALPHA_MASK = (1 << 13), + FBZ_DRAW_FRONT = 0x0000, FBZ_DRAW_BACK = 0x4000, FBZ_DRAW_MASK = 0xc000, FBZ_DEPTH_BIAS = (1 << 16), + FBZ_ALPHA_ENABLE = (1 << 18), FBZ_DITHER_SUB = (1 << 19), FBZ_DEPTH_SOURCE = (1 << 20), @@ -655,6 +658,8 @@ enum { #define src_afunc ((params->alphaMode >> 8) & 0xf) #define dest_afunc ((params->alphaMode >> 12) & 0xf) +#define src_aafunc ((params->alphaMode >> 16) & 0xf) +#define dest_aafunc ((params->alphaMode >> 20) & 0xf) #define alpha_func ((params->alphaMode >> 1) & 7) #define a_ref (params->alphaMode >> 24) #define depth_op ((params->fbzMode >> 5) & 7) diff --git a/src/video/vid_voodoo_render.c b/src/video/vid_voodoo_render.c index 9c1204bd398..97186634d6c 100644 --- a/src/video/vid_voodoo_render.c +++ b/src/video/vid_voodoo_render.c @@ -932,7 +932,7 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * state->x = x; state->x2 = x2; #ifndef NO_CODEGEN - if (voodoo->use_recompiler) { + if (voodoo->use_recompiler && voodoo_draw) { voodoo_draw(state, params, x, real_y); } else #endif @@ -1017,6 +1017,13 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * dest_b |= (dest_b >> 5); dest_a = 0xff; + if (params->fbzMode & FBZ_ALPHA_ENABLE) { + if (voodoo->params.aux_tiled) + dest_a = aux_mem[x_tiled]; + else + dest_a = aux_mem[x]; + } + if (params->fbzColorPath & FBZCP_TEXTURE_ENABLED) { if ((params->textureMode[0] & TEXTUREMODE_LOCAL_MASK) == TEXTUREMODE_LOCAL || !voodoo->dual_tmus) { /*TMU0 only sampling local colour or only one TMU, only sample TMU0*/ @@ -1032,11 +1039,6 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * } else { voodoo_tmu_fetch_and_blend(voodoo, params, state, x); } - - if ((params->fbzMode & FBZ_CHROMAKEY) && state->tex_r[0] == params->chromaKey_r && state->tex_g[0] == params->chromaKey_g && state->tex_b[0] == params->chromaKey_b) { - voodoo->fbiChromaFail++; - goto skip_pixel; - } } if (voodoo->trexInit1[0] & (1 << 18)) { @@ -1088,6 +1090,11 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * break; } + if ((params->fbzMode & FBZ_CHROMAKEY) && cother_r == params->chromaKey_r && cother_g == params->chromaKey_g && cother_b == params->chromaKey_b) { + voodoo->fbiChromaFail++; + goto skip_pixel; + } + switch (cca_localselect) { case CCA_LOCALSELECT_ITER_A: alocal = CLAMP(state->ia >> 12); @@ -1123,6 +1130,10 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * break; } + if ((params->fbzMode & FBZ_ALPHA_MASK) && !(aother & 1)) { + goto skip_pixel; + } + if (cc_zero_other) { src_r = 0; src_g = 0; @@ -1283,6 +1294,9 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * dest_b = dithersub_rb2x2[dest_b][real_y & 1][x & 1]; } ALPHA_BLEND(src_r, src_g, src_b, src_a); + + // TODO: Implement proper alpha blending support here for alpha values. + src_a = (((dest_aafunc == 4) ? dest_a * 256 : 0) + ((src_aafunc == 4) ? src_a * 256 : 0)) >> 8; } if (update) { @@ -1308,7 +1322,13 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * else fb_mem[x] = src_b | (src_g << 5) | (src_r << 11); } - if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) { + if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_ALPHA_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_ALPHA_ENABLE)) { + if (voodoo->params.aux_tiled) + aux_mem[x_tiled] = src_a; + else + aux_mem[x] = src_a; + } + else if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) { if (voodoo->params.aux_tiled) aux_mem[x_tiled] = new_depth; else From 631c1e6825fb1d65757ab766fce36ef7a9510d88 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 14 Dec 2025 20:39:23 +0100 Subject: [PATCH 055/320] KBC: Move almost all remaining global variables to the kbc struct and fix some incorrect ='s to =='s. --- src/device/kbc_at.c | 91 +++++++++++++++++++++------------------------ 1 file changed, 42 insertions(+), 49 deletions(-) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 0f3bd5600e0..36f299315f9 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -65,7 +65,6 @@ #define FLAG_CLOCK 0x01 #define FLAG_CACHE 0x02 #define FLAG_PS2 0x04 -#define FLAG_PCI 0x08 enum { STATE_RESET = 0, /* KBC reset state, only accepts command AA. */ @@ -110,6 +109,11 @@ typedef struct atkbc_t { uint8_t is_green; uint8_t kblock_switch; uint8_t is_type2; + uint8_t ami_revision; + uint8_t ami_is_amikey_2; + uint8_t ami_is_megakey; + uint8_t award_revision; + uint8_t chips_revision; uint8_t mem[0x100]; @@ -118,6 +122,8 @@ typedef struct atkbc_t { uint8_t handler_enable[2]; + uint16_t phoenix_revision; + uint16_t base_addr[2]; uint16_t irq[2]; @@ -145,15 +151,6 @@ typedef struct atkbc_t { /* Keyboard controller ports. */ kbc_at_port_t *kbc_at_ports[2] = { NULL, NULL }; -static uint8_t kbc_ami_revision = '8'; -static uint8_t kbc_ami_is_clone = 0; - -static uint8_t kbc_award_revision = 0x42; - -static uint8_t kbc_chips_revision = 0xa6; - -static uint16_t kbc_phoenix_version = 0x0416; - static void (*kbc_at_do_poll)(atkbc_t *dev); /* Non-translated to translated scan codes. */ @@ -1044,7 +1041,7 @@ write_cmd_ami(void *priv, uint8_t val) break; case 0xa0: /* copyright message */ - switch (kbc_ami_revision) { + switch (dev->ami_revision) { case 0x35: copr = "(C)1994 AMI"; coprlen = strlen(copr) + 1; @@ -1088,7 +1085,7 @@ write_cmd_ami(void *priv, uint8_t val) case 0xa1: /* get controller version */ kbc_at_log("ATkbc: AMI - get controller version\n"); - kbc_delay_to_ob(dev, kbc_ami_revision, 0, 0x00); + kbc_delay_to_ob(dev, dev->ami_revision, 0, 0x00); ret = 0; break; @@ -1160,8 +1157,7 @@ write_cmd_ami(void *priv, uint8_t val) case 0xaf: /* set extended controller RAM */ if ((kbc_ven != KBC_VEN_SIEMENS) && (kbc_ven != KBC_VEN_ALI)) { - if (((kbc_ami_revision >= 'H') && (kbc_ami_revision < 'X')) || - (kbc_ami_revision = '5')) { + if (dev->ami_is_amikey_2) { kbc_at_log("ATkbc: set extended controller RAM\n"); dev->wantdata = 1; dev->state = STATE_KBC_PARAM; @@ -1224,8 +1220,7 @@ write_cmd_ami(void *priv, uint8_t val) break; case 0xc4: - if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) || - (kbc_ami_revision = '5')) { + if (dev->ami_is_megakey) { /* set KBC line P14 low */ kbc_at_log("ATkbc: set KBC line P14 (P1 bit 4) low\n"); dev->p1 &= 0xef; @@ -1235,8 +1230,7 @@ write_cmd_ami(void *priv, uint8_t val) } break; case 0xc5: - if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) || - (kbc_ami_revision = '5')) { + if (dev->ami_is_megakey) { /* set KBC line P15 low */ kbc_at_log("ATkbc: set KBC line P15 (P1 bit 5) low\n"); dev->p1 &= 0xdf; @@ -1280,8 +1274,7 @@ write_cmd_ami(void *priv, uint8_t val) break; case 0xcc: - if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) || - (kbc_ami_revision = '5')) { + if (dev->ami_is_megakey) { /* set KBC line P14 high */ kbc_at_log("ATkbc: set KBC line P14 (P1 bit 4) high\n"); dev->p1 |= 0x10; @@ -1292,8 +1285,7 @@ write_cmd_ami(void *priv, uint8_t val) break; case 0xcd: /* set KBC line P15 high */ - if (((kbc_ami_revision >= 'P') && (kbc_ami_revision < 'X')) || - (kbc_ami_revision = '5')) { + if (dev->ami_is_megakey) { kbc_at_log("ATkbc: set KBC line P15 (P1 bit 5) high\n"); dev->p1 |= 0x20; kbc_delay_to_ob(dev, dev->ob, 0, 0x00); @@ -1512,7 +1504,7 @@ write_cmd_umc(void *priv, uint8_t val) case 0xa1: /* get controller version */ kbc_at_log("ATkbc: UMC - get controller version\n"); - kbc_delay_to_ob(dev, kbc_ami_revision, 0, 0x00); + kbc_delay_to_ob(dev, dev->ami_revision, 0, 0x00); ret = 0; break; } @@ -1567,7 +1559,7 @@ write_cmd_award(void *priv, uint8_t val) case 0xa1: /* get controller version */ kbc_at_log("ATkbc: AMI - get controller version\n"); - kbc_delay_to_ob(dev, kbc_ami_revision, 0, 0x00); + kbc_delay_to_ob(dev, dev->ami_revision, 0, 0x00); ret = 0; break; @@ -1587,7 +1579,7 @@ write_cmd_award(void *priv, uint8_t val) in Norton Commander 3.0. */ case 0xaf: /* read keyboard version */ kbc_at_log("ATkbc: read keyboard version\n"); - kbc_delay_to_ob(dev, kbc_award_revision, 0, 0x00); + kbc_delay_to_ob(dev, dev->award_revision, 0, 0x00); ret = 0; break; @@ -1701,7 +1693,7 @@ write_cmd_data_chips(void *priv, uint8_t val) break; case 0x00: /* return ID */ kbc_at_log("ATkbc: C&T - return ID\n"); - kbc_delay_to_ob(dev, kbc_chips_revision, 0, 0x00); + kbc_delay_to_ob(dev, dev->chips_revision, 0, 0x00); break; case 0x02: /* write input port */ kbc_at_log("ATkbc: C&T - write input port\n"); @@ -1967,8 +1959,8 @@ write_cmd_phoenix(void *priv, uint8_t val) revision level and proper CPU bits. */ case 0xd5: /* Read MultiKey code revision level */ kbc_at_log("ATkbc: Phoenix - Read MultiKey code revision level\n"); - kbc_at_queue_add(dev, kbc_phoenix_version >> 8); - kbc_at_queue_add(dev, kbc_phoenix_version & 0xff); + kbc_at_queue_add(dev, dev->phoenix_revision >> 8); + kbc_at_queue_add(dev, dev->phoenix_revision & 0xff); ret = 0; break; @@ -2810,7 +2802,6 @@ kbc_at_reset(void *priv) dev->sc_or = 0; dev->ami_flags = (machine_has_flags_ex(MACHINE_PS2_KBC)) ? 0x01 : 0x00; - dev->misc_flags &= FLAG_PCI; if (machine_has_flags_ex(MACHINE_PS2_KBC)) { dev->misc_flags |= FLAG_PS2; @@ -2923,9 +2914,6 @@ kbc_at_init(const device_t *info) video_reset(gfxcard[0]); kbc_at_reset(dev); - if (info->flags & DEVICE_PCI) - dev->misc_flags |= FLAG_PCI; - dev->handlers[0].read = kbc_at_port_1_read; dev->handlers[0].write = kbc_at_port_1_write; dev->handlers[1].read = kbc_at_port_2_read; @@ -2942,12 +2930,13 @@ kbc_at_init(const device_t *info) dev->write_cmd_data_ven = NULL; dev->write_cmd_ven = NULL; - kbc_ami_revision = '8'; - kbc_award_revision = 0x42; + dev->ami_revision = '8'; - kbc_chips_revision = 0xa6; + dev->award_revision = 0x42; - kbc_phoenix_version = 0x0416; + dev->chips_revision = 0xa6; + + dev->phoenix_revision = 0x0416; switch (dev->flags & KBC_VEN_MASK) { default: @@ -2957,9 +2946,9 @@ kbc_at_init(const device_t *info) case KBC_VEN_AWARD: case KBC_VEN_VIA: if ((info->local & 0xff00) != 0x0000) - kbc_ami_revision = (info->local >> 8) & 0xff; + dev->ami_revision = (info->local >> 8) & 0xff; if ((info->local & 0xff0000) != 0x000000) - kbc_award_revision = (info->local >> 16) & 0xff; + dev->award_revision = (info->local >> 16) & 0xff; dev->write_cmd_data_ven = write_cmd_data_award; dev->write_cmd_ven = write_cmd_award; break; @@ -2973,23 +2962,22 @@ kbc_at_init(const device_t *info) break; case KBC_VEN_ALI: - kbc_ami_revision = 'F'; - kbc_award_revision = 0x43; + dev->ami_revision = 'F'; + dev->award_revision = 0x43; dev->write_cmd_data_ven = write_cmd_data_ami; dev->write_cmd_ven = write_cmd_ami; break; case KBC_VEN_AMI_TRIGEM: dev->is_green = !!(info->local & KBC_FLAG_IS_GREEN); - kbc_ami_revision = 'Z'; + dev->ami_revision = 'Z'; dev->write_cmd_data_ven = write_cmd_data_ami; dev->write_cmd_ven = write_cmd_ami; break; case KBC_VEN_AMI: case KBC_VEN_HOLTEK: - kbc_ami_is_clone = !!(info->local & KBC_FLAG_IS_CLONE); - kbc_ami_revision = (info->local >> 8) & 0xff; + dev->ami_revision = (info->local >> 8) & 0xff; dev->write_cmd_data_ven = write_cmd_data_ami; dev->write_cmd_ven = write_cmd_ami; @@ -2997,18 +2985,18 @@ kbc_at_init(const device_t *info) case KBC_VEN_UMC: if ((info->local & 0xff00) != 0x0000) - kbc_ami_revision = (info->local >> 8) & 0xff; + dev->ami_revision = (info->local >> 8) & 0xff; else - kbc_ami_revision = 0x48; + dev->ami_revision = 0x48; dev->write_cmd_ven = write_cmd_umc; break; case KBC_VEN_SIS: if ((info->local & 0xff00) != 0x0000) - kbc_ami_revision = (info->local >> 8) & 0xff; + dev->ami_revision = (info->local >> 8) & 0xff; else - kbc_ami_revision = 0x48; + dev->ami_revision = 0x48; dev->write_cmd_data_ven = write_cmd_data_sis; dev->write_cmd_ven = write_cmd_sis; @@ -3016,14 +3004,14 @@ kbc_at_init(const device_t *info) case KBC_VEN_CHIPS: if ((info->local & 0xff00) != 0x0000) - kbc_chips_revision = (info->local >> 8) & 0xff; + dev->chips_revision = (info->local >> 8) & 0xff; dev->write_cmd_data_ven = write_cmd_data_chips; dev->write_cmd_ven = write_cmd_chips; break; case KBC_VEN_PHOENIX: if ((info->local & 0xffff00) != 0x000000) - kbc_phoenix_version = (info->local >> 8) & 0xffff; + dev->phoenix_revision = (info->local >> 8) & 0xffff; dev->write_cmd_data_ven = write_cmd_data_phoenix; dev->write_cmd_ven = write_cmd_phoenix; break; @@ -3039,6 +3027,11 @@ kbc_at_init(const device_t *info) break; } + dev->ami_is_amikey_2 = ((dev->ami_revision >= 'H') && (dev->ami_revision < 'X')) || + (dev->ami_revision == '5'); + dev->ami_is_megakey = ((dev->ami_revision >= 'P') && (dev->ami_revision < 'X')) || + (dev->ami_revision == '5'); + max_ports = 2; for (int i = 0; i < max_ports; i++) { From ca9eb9acb995aa89a31190cf0a13df2587a65a02 Mon Sep 17 00:00:00 2001 From: snow flurry Date: Sun, 14 Dec 2025 15:49:20 -0800 Subject: [PATCH 056/320] CPU: Restrict allowed opcodes in INC/DEC Grp4 Only FE /0 (INC r/m8) and FE /1 (DEC r/m8) are valid instructions in INC/DEC Grp 4. All other ModR/M opcode bits are reserved and should throw #UD. --- src/cpu/x86_ops_inc_dec.h | 54 ++++++++++++++++++++++++--------------- 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/src/cpu/x86_ops_inc_dec.h b/src/cpu/x86_ops_inc_dec.h index b33d02f453d..8b9711aaa62 100644 --- a/src/cpu/x86_ops_inc_dec.h +++ b/src/cpu/x86_ops_inc_dec.h @@ -56,16 +56,23 @@ opINCDEC_b_a16(uint32_t fetchdat) if (cpu_state.abrt) return 1; - if (rmdat & 0x38) { - seteab(temp - 1); - if (cpu_state.abrt) - return 1; - setsub8nc(temp, 1); - } else { - seteab(temp + 1); - if (cpu_state.abrt) - return 1; - setadd8nc(temp, 1); + switch (rmdat & 0x38) { + case 0: /* INC r/m8 */ + seteab(temp + 1); + if (cpu_state.abrt) + return 1; + setadd8nc(temp, 1); + break; + case 0x8: /* DEC r/m8 */ + seteab(temp - 1); + if (cpu_state.abrt) + return 1; + setsub8nc(temp, 1); + break; + default: + cpu_state.pc = cpu_state.oldpc; + x86illegal(); + break; } CLOCK_CYCLES((cpu_mod == 3) ? timing_rr : timing_mm); PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, (cpu_mod == 3) ? 0 : 1, 0, (cpu_mod == 3) ? 0 : 1, 0, 0); @@ -83,16 +90,23 @@ opINCDEC_b_a32(uint32_t fetchdat) if (cpu_state.abrt) return 1; - if (rmdat & 0x38) { - seteab(temp - 1); - if (cpu_state.abrt) - return 1; - setsub8nc(temp, 1); - } else { - seteab(temp + 1); - if (cpu_state.abrt) - return 1; - setadd8nc(temp, 1); + switch (rmdat & 0x38) { + case 0: /* INC r/m8 */ + seteab(temp + 1); + if (cpu_state.abrt) + return 1; + setadd8nc(temp, 1); + break; + case 0x8: /* DEC r/m8 */ + seteab(temp - 1); + if (cpu_state.abrt) + return 1; + setsub8nc(temp, 1); + break; + default: + cpu_state.pc = cpu_state.oldpc; + x86illegal(); + break; } CLOCK_CYCLES((cpu_mod == 3) ? timing_rr : timing_mm); PREFETCH_RUN((cpu_mod == 3) ? timing_rr : timing_mm, 2, rmdat, (cpu_mod == 3) ? 0 : 1, 0, (cpu_mod == 3) ? 0 : 1, 0, 1); From ee92bbed91c157fa860c9a72d21c06868575082b Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 14 Dec 2025 22:00:47 -0500 Subject: [PATCH 057/320] Update macOS runner version for macos intel --- .github/workflows/cmake_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cmake_macos.yml b/.github/workflows/cmake_macos.yml index ace5314c89e..f1e0703814b 100644 --- a/.github/workflows/cmake_macos.yml +++ b/.github/workflows/cmake_macos.yml @@ -65,7 +65,7 @@ jobs: - arch: x86_64 toolchain: ./cmake/flags-gcc-x86_64.cmake slug: -x86_64 - runner: macos-13 + runner: macos-15-intel - arch: arm64 toolchain: ./cmake/llvm-macos-aarch64.cmake slug: -arm64 From 036a0186c1033fb04e3073ca79334370aa353fea Mon Sep 17 00:00:00 2001 From: Jasmine Iwanek Date: Sun, 14 Dec 2025 22:01:25 -0500 Subject: [PATCH 058/320] Update macOS runner version in CodeQL workflow --- .github/workflows/codeql_macos.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql_macos.yml b/.github/workflows/codeql_macos.yml index 74365cd5658..e3110570922 100644 --- a/.github/workflows/codeql_macos.yml +++ b/.github/workflows/codeql_macos.yml @@ -79,7 +79,7 @@ jobs: - arch: x86_64 toolchain: ./cmake/flags-gcc-x86_64.cmake slug: -x86_64 - runner: macos-13 + runner: macos-15-intel # - arch: arm64 # toolchain: ./cmake/llvm-macos-aarch64.cmake # slug: -arm64 From 6a6ef6e652f41b261b923c1868420b38df35a0e4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 15 Dec 2025 11:23:59 +0100 Subject: [PATCH 059/320] 86box.c: Fix two static variable declarations, fixes warnings when compiled with CLang. --- src/86box.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/86box.c b/src/86box.c index 67853bf7d6a..ad79e391bc2 100644 --- a/src/86box.c +++ b/src/86box.c @@ -344,8 +344,8 @@ __thread int is_cpu_thread = 0; static wchar_t mouse_msg[3][200]; -static volatile ATOMIC_INT do_pause_ack = 0; -static volatile ATOMIC_INT pause_ack = 0; +static ATOMIC_INT do_pause_ack = 0; +static ATOMIC_INT pause_ack = 0; #define LOG_SIZE_BUFFER 8192 /* Log size buffer */ From 61864d5a534a1643b51e8b1fbfa908e245a03f21 Mon Sep 17 00:00:00 2001 From: Wil Bowen Date: Mon, 15 Dec 2025 09:43:27 -0500 Subject: [PATCH 060/320] VM Manager: prevent single-click activation from starting VM Fix regression introduced in 75499ad: activated() triggered VM start on single click. Use doubleClicked() and Enter shortcut instead. --- src/qt/qt_vmmanager_main.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index f4b1984dc5f..86c2cf90478 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -404,7 +405,12 @@ VMManagerMain::VMManagerMain(QWidget *parent) ui->listView->setCurrentIndex(first_index); } - connect(ui->listView, &QListView::activated, this, &VMManagerMain::startButtonPressed); + // Connect double-click to start VM + connect(ui->listView, &QListView::doubleClicked, this, &VMManagerMain::startButtonPressed); + + // Connect Enter key to start VM + auto enterShortcut = new QShortcut(QKeySequence(Qt::Key_Return), ui->listView); + connect(enterShortcut, &QShortcut::activated, this, &VMManagerMain::startButtonPressed); // Load and apply settings loadSettings(); From 2b3be4140eb981a52b2944b0bf7f2434963c01fc Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 15 Dec 2025 21:08:27 +0600 Subject: [PATCH 061/320] Implement alpha planes for x64 Voodoo dynarec --- src/include/86box/vid_voodoo_codegen_x86-64.h | 218 ++++++++++++++++-- 1 file changed, 202 insertions(+), 16 deletions(-) diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index 8aba3e5b55f..67a5cae2c29 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -2407,6 +2407,27 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, } if (params->alphaMode & (1 << 4)) { + if (params->fbzMode & FBZ_ALPHA_ENABLE) { + addbyte(0x8b); /*MOV EBX, state->x[EDI]*/ + addbyte(0x9f); + if (params->aux_tiled) + addlong(offsetof(voodoo_state_t, x_tiled)); + else + addlong(offsetof(voodoo_state_t, x)); + addbyte(0x48); /*MOV RCX, aux_mem[RDI]*/ + addbyte(0x8b); + addbyte(0x8f); + addlong(offsetof(voodoo_state_t, aux_mem)); + addbyte(0x0f); /*MOVZX EBX, [ECX+EBX*2]*/ + addbyte(0xb7); + addbyte(0x1c); + addbyte(0x59); + } else { + addbyte(0x48); /*MOV RBX, 0xff*/ + addbyte(0xc7); + addbyte(0xc3); + addlong(0xff); + } addbyte(0x49); /*MOV R8, rgb565*/ addbyte(0xb8); addquad((uintptr_t) rgb565); @@ -2422,6 +2443,8 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addlong(offsetof(voodoo_state_t, fb_mem)); addbyte(0x01); /*ADD EDX, EDX*/ addbyte(0xd2); + addbyte(0x01); /*ADD EBX, EBX*/ + addbyte(0xdb); addbyte(0x0f); /*MOVZX EAX, [RBP+RAX*2]*/ addbyte(0xb7); addbyte(0x44); @@ -2516,6 +2539,36 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(8); break; case AFUNC_ADST_ALPHA: + addbyte(0x66); /*PMULLW XMM4, R10(alookup)[EBX*8]*/ + addbyte(0x41); + addbyte(0x0f); + addbyte(0xd5); + addbyte(0x24); + addbyte(0xda); + addbyte(0xf3); /*MOVQ XMM5, XMM4*/ + addbyte(0x0f); + addbyte(0x7e); + addbyte(0xec); + addbyte(0x66); /*PADDW XMM4, R10(alookup)[1*8]*/ + addbyte(0x41); + addbyte(0x0f); + addbyte(0xfd); + addbyte(0x62); + addbyte(8 * 2); + addbyte(0x66); /*PSRLW XMM5, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd5); + addbyte(8); + addbyte(0x66); /*PADDW XMM4, XMM5*/ + addbyte(0x0f); + addbyte(0xfd); + addbyte(0xe5); + addbyte(0x66); /*PSRLW XMM4, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd4); + addbyte(8); break; case AFUNC_AONE: break; @@ -2591,10 +2644,36 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(8); break; case AFUNC_AOMDST_ALPHA: - addbyte(0x66); /*PXOR XMM4, XMM4*/ + addbyte(0x66); /*PMULLW XMM4, R11(aminuslookup)[EBX*8]*/ + addbyte(0x41); addbyte(0x0f); - addbyte(0xef); - addbyte(0xe4); + addbyte(0xd5); + addbyte(0x24); + addbyte(0xdb); + addbyte(0xf3); /*MOVQ XMM5, XMM4*/ + addbyte(0x0f); + addbyte(0x7e); + addbyte(0xec); + addbyte(0x66); /*PADDW XMM4, R10(alookup)[1*8]*/ + addbyte(0x41); + addbyte(0x0f); + addbyte(0xfd); + addbyte(0x62); + addbyte(8 * 2); + addbyte(0x66); /*PSRLW XMM5, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd5); + addbyte(8); + addbyte(0x66); /*PADDW XMM4, XMM5*/ + addbyte(0x0f); + addbyte(0xfd); + addbyte(0xe5); + addbyte(0x66); /*PSRLW XMM4, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd4); + addbyte(8); break; case AFUNC_ACOLORBEFOREFOG: addbyte(0x66); /*PMULLW XMM4, XMM15(colbfog)*/ @@ -2699,6 +2778,36 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(8); break; case AFUNC_ADST_ALPHA: + addbyte(0x66); /*PMULLW XMM0, R10(alookup)[EBX*8]*/ + addbyte(0x41); + addbyte(0x0f); + addbyte(0xd5); + addbyte(0x04); + addbyte(0xda); + addbyte(0xf3); /*MOVQ XMM5, XMM0*/ + addbyte(0x0f); + addbyte(0x7e); + addbyte(0xe8); + addbyte(0x66); /*PADDW XMM0, R10(alookup)[1*8]*/ + addbyte(0x41); + addbyte(0x0f); + addbyte(0xfd); + addbyte(0x42); + addbyte(8 * 2); + addbyte(0x66); /*PSRLW XMM5, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd5); + addbyte(8); + addbyte(0x66); /*PADDW XMM0, XMM5*/ + addbyte(0x0f); + addbyte(0xfd); + addbyte(0xc5); + addbyte(0x66); /*PSRLW XMM0, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd0); + addbyte(8); break; case AFUNC_AONE: break; @@ -2774,22 +2883,62 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(8); break; case AFUNC_AOMDST_ALPHA: - addbyte(0x66); /*PXOR XMM0, XMM0*/ + addbyte(0x66); /*PMULLW XMM0, R11(aminuslookup)[EBX*8]*/ + addbyte(0x41); addbyte(0x0f); - addbyte(0xef); - addbyte(0xc0); + addbyte(0xd5); + addbyte(0x04); + addbyte(0xdb); + addbyte(0xf3); /*MOVQ XMM5, XMM0*/ + addbyte(0x0f); + addbyte(0x7e); + addbyte(0xe8); + addbyte(0x66); /*PADDW XMM0, alookup[1*8]*/ + addbyte(0x41); + addbyte(0x0f); + addbyte(0xfd); + addbyte(0x42); + addbyte(8 * 2); + addbyte(0x66); /*PSRLW XMM5, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd5); + addbyte(8); + addbyte(0x66); /*PADDW XMM0, XMM5*/ + addbyte(0x0f); + addbyte(0xfd); + addbyte(0xc5); + addbyte(0x66); /*PSRLW XMM0, 8*/ + addbyte(0x0f); + addbyte(0x71); + addbyte(0xd0); + addbyte(8); break; case AFUNC_ASATURATE: - addbyte(0x66); /*PMULLW XMM0, XMM11(minus_254)*/ + addbyte(0x89); /* MOV EAX, EBX */ + addbyte(0xd8); + addbyte(0xd1); /* SHR EAX, 1 */ + addbyte(0xe8); + addbyte(0x34); /* XOR AL, 0xFF */ + addbyte(0xFF); + addbyte(0xd1); /* SHL EAX, 1 */ + addbyte(0xe0); + addbyte(0x39); /* CMP EDX, EAX */ + addbyte(0xc2); + addbyte(0x0f); /* CMOVB EAX, EDX */ + addbyte(0x42); + addbyte(0xc2); + addbyte(0x66); /*PMULLW XMM0, R10(alookup)[EAX*8]*/ addbyte(0x41); addbyte(0x0f); addbyte(0xd5); - addbyte(0xc3); + addbyte(0x04); + addbyte(0xc2); addbyte(0xf3); /*MOVQ XMM5, XMM0*/ addbyte(0x0f); addbyte(0x7e); addbyte(0xe8); - addbyte(0x66); /*PADDW XMM0, alookup[1*8]*/ + addbyte(0x66); /*PADDW XMM0, R10(alookup)[1*8]*/ addbyte(0x41); addbyte(0x0f); addbyte(0xfd); @@ -2821,6 +2970,48 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x0f); addbyte(0x67); addbyte(0xc0); + + addbyte(0x31); /*XOR EAX, EAX */ + addbyte(0xc0); + + if (dest_aafunc == 4) { + addbyte(0xc1); /*SHL EBX, 0x7*/ + addbyte(0xe3); + addbyte(0x07); + addbyte(0x01); /*ADD EAX, EBX*/ + addbyte(0xd8); + } + + if (src_aafunc == 4) { + addbyte(0xc1); /*SHL EDX, 0x7*/ + addbyte(0xe2); + addbyte(0x07); + addbyte(0x01); /*ADD EAX, EDX*/ + addbyte(0xd0); + } + + addbyte(0xc1); /* SHR EAX, 8 */ + addbyte(0xc8); + addbyte(0x08); + addbyte(0x89); /* MOV EDX, EAX */ + addbyte(0xC2); + } + + if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_ALPHA_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_ALPHA_ENABLE)) { + addbyte(0x8b); /*MOV EAX, state->x[EDI]*/ + addbyte(0x87); + if (params->aux_tiled) + addlong(offsetof(voodoo_state_t, x_tiled)); + else + addlong(offsetof(voodoo_state_t, x)); + addbyte(0x48); /*MOV RSI, aux_mem*/ + addbyte(0x8b); + addbyte(0xb7); + addlong(offsetof(voodoo_state_t, aux_mem)); + addbyte(0x66); /*MOV [ESI+EAX*2], DX*/ + addbyte(0x89); + addbyte(0x14); + addbyte(0x46); } addbyte(0x8b); /*MOV EDX, state->x[EDI]*/ @@ -2969,7 +3160,8 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addbyte(0x56); } - if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) { + + if ((params->fbzMode & (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE)) == (FBZ_DEPTH_WMASK | FBZ_DEPTH_ENABLE) && !(params->fbzMode & FBZ_ALPHA_ENABLE)) { addbyte(0x8b); /*MOV EDX, state->x[EDI]*/ addbyte(0x97); if (params->aux_tiled) @@ -3237,12 +3429,6 @@ voodoo_get_block(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *stat voodoo_x86_data_t *voodoo_x86_data = voodoo->codegen_data; voodoo_x86_data_t *data; - if (params->fbzMode & FBZ_ALPHA_ENABLE) { - // Lands of Lore III relies on the alpha buffer functionality to create its transparent textures. - // Fallback to interpreter. - return NULL; - } - for (uint8_t c = 0; c < 8; c++) { data = &voodoo_x86_data[odd_even + c * 4]; //&voodoo_x86_data[odd_even][b]; From 01a1b5f30d3022ccf4c0639178ec14b510495fa3 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 15 Dec 2025 22:05:18 +0100 Subject: [PATCH 062/320] S3 ViRGE: Get rid of atomics on x86. --- src/video/vid_s3_virge.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 7862c25acc6..5fa84e555b8 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -290,9 +290,9 @@ typedef struct virge_t { s3d_t s3d_tri; s3d_t s3d_buffer[RB_SIZE]; - atomic_int s3d_read_idx; - atomic_int s3d_write_idx; - atomic_int s3d_busy; + ATOMIC_INT s3d_read_idx; + ATOMIC_INT s3d_write_idx; + ATOMIC_INT s3d_busy; struct { uint32_t pri_ctrl; @@ -332,15 +332,15 @@ typedef struct virge_t { } streams; fifo_entry_t fifo[FIFO_SIZE]; - atomic_int fifo_read_idx, fifo_write_idx; - atomic_int fifo_thread_run, render_thread_run; + ATOMIC_INT fifo_read_idx, fifo_write_idx; + ATOMIC_INT fifo_thread_run, render_thread_run; thread_t *fifo_thread; event_t *wake_fifo_thread; event_t *fifo_not_full_event; - atomic_int virge_busy; - atomic_uint irq_pending; + ATOMIC_INT virge_busy; + ATOMIC_UINT irq_pending; uint8_t subsys_stat; uint8_t subsys_cntl; From da3b3676047d835cd52741ef7e971acd26f51328 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 15 Dec 2025 22:07:39 +0100 Subject: [PATCH 063/320] And ATi Mach64 as well. --- src/video/vid_ati_mach64.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 6e9c0f6d290..97c869668cc 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -263,20 +263,20 @@ typedef struct mach64_t { #ifdef DMA_BM struct { - atomic_int state; + ATOMIC_INT state; - atomic_uint frame_buf_offset, system_buf_addr, command, status; + ATOMIC_UINT frame_buf_offset, system_buf_addr, command, status; - atomic_bool system_triggered; + ATOMIC_BOOL system_triggered; mutex_t *lock; } dma; #endif fifo_entry_t fifo[FIFO_SIZE]; - atomic_int fifo_read_idx; - atomic_int fifo_write_idx; - atomic_int blitter_busy; + ATOMIC_INT fifo_read_idx; + ATOMIC_INT fifo_write_idx; + ATOMIC_INT blitter_busy; thread_t *fifo_thread; event_t *wake_fifo_thread; From 6e8f1204cf94ad877bd8683cbace01d5cbe8cab4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 15 Dec 2025 22:08:29 +0100 Subject: [PATCH 064/320] And non-ViRGE S3. --- src/video/vid_s3.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 453fdffb92b..175b5048fad 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -354,7 +354,7 @@ typedef struct s3_t { int input; int len, start; int odf, idf, yuv; - atomic_int busy; + ATOMIC_INT busy; } videoengine; struct @@ -390,7 +390,7 @@ typedef struct s3_t { } streams; fifo_entry_t fifo[FIFO_SIZE]; - atomic_int fifo_read_idx, fifo_write_idx; + ATOMIC_INT fifo_read_idx, fifo_write_idx; uint8_t fifo_thread_run; @@ -398,7 +398,7 @@ typedef struct s3_t { event_t *wake_fifo_thread; event_t *fifo_not_full_event; - atomic_int blitter_busy; + ATOMIC_INT blitter_busy; uint64_t blitter_time; uint64_t status_time; @@ -410,7 +410,7 @@ typedef struct s3_t { int translate; int enable_8514; int color_16bit; - atomic_int busy, force_busy; + ATOMIC_INT busy, force_busy; bool color_key_enabled; From 82728f4ebb55f72f46e3a566fc648d33df9e5080 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 16 Dec 2025 23:00:12 +0100 Subject: [PATCH 065/320] C&T KBC: Implement unknown command B3h as a dummy command that only outputs the output buffer, fixes the Atari PC4. --- src/device/kbc_at.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 36f299315f9..b2e027cd3d7 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -1751,6 +1751,13 @@ write_cmd_chips(void *priv, uint8_t val) dev->state = STATE_KBC_PARAM; ret = 0; break; + + case 0xb3: /* Unknown */ + kbc_at_log("ATkbc: C&T - Unknown\n"); + kbc_delay_to_ob(dev, dev->ob, 0, 0x00); + dev->pending++; + ret = 0; + break; } return ret; From 7e05cdcce55687d2e60588ebcc2e9ab5d9e316c1 Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Wed, 17 Dec 2025 03:51:19 +0100 Subject: [PATCH 066/320] Voodoo 1: Change cmdfifo_depth threshold from >300 to <80 --- src/video/vid_voodoo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index b070e7aba63..62f7159ef9b 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -432,7 +432,7 @@ voodoo_writel(uint32_t addr, uint32_t val, void *priv) /* Voodoo1: use higher CMDFIFO threshold to reduce wake frequency */ if (voodoo->type == VOODOO_1) { - if ((voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd) > 300) + if ((voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd) < 80) voodoo_wake_fifo_thread(voodoo); } /* Other cards (Voodoo2, Banshee, Voodoo3, ...) keep the original behavior */ From df3fa897985d113882c62e2c70a6417f93be2e2f Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Wed, 17 Dec 2025 03:53:05 +0100 Subject: [PATCH 067/320] Voodoo 1: Reduce FIFO wake delay from 2000 to 500 --- src/video/vid_voodoo_fifo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_voodoo_fifo.c b/src/video/vid_voodoo_fifo.c index 4530e6b01e6..a7ce0850ea5 100644 --- a/src/video/vid_voodoo_fifo.c +++ b/src/video/vid_voodoo_fifo.c @@ -63,7 +63,7 @@ voodoo_fifo_log(const char *fmt, ...) #define WAKE_DELAY_DEFAULT (TIMER_USEC * 100) /* Per-card wake delay: Voodoo1 uses a larger delay to reduce FIFO wake frequency */ -#define WAKE_DELAY_OF(v) ((v)->type == VOODOO_1 ? (TIMER_USEC * 2000) : WAKE_DELAY_DEFAULT) +#define WAKE_DELAY_OF(v) ((v)->type == VOODOO_1 ? (TIMER_USEC * 500) : WAKE_DELAY_DEFAULT) void voodoo_wake_fifo_thread(voodoo_t *voodoo) { From bd29eadfd80913317dd8f861543b730a4877e21e Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Wed, 17 Dec 2025 10:00:19 +0100 Subject: [PATCH 068/320] Reduce cmdfifo_depth to 20 --- src/video/vid_voodoo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 62f7159ef9b..960b913a9ce 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -432,7 +432,7 @@ voodoo_writel(uint32_t addr, uint32_t val, void *priv) /* Voodoo1: use higher CMDFIFO threshold to reduce wake frequency */ if (voodoo->type == VOODOO_1) { - if ((voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd) < 80) + if ((voodoo->cmdfifo_depth_wr - voodoo->cmdfifo_depth_rd) < 20) voodoo_wake_fifo_thread(voodoo); } /* Other cards (Voodoo2, Banshee, Voodoo3, ...) keep the original behavior */ From ada50dade313abcb7a6838d6edfa6324bfeabbbb Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 23 Aug 2025 01:21:42 +0600 Subject: [PATCH 069/320] NDR: Implement and use doubly-linked lists for freeing up memory blocks --- src/codegen_new/codegen_allocator.c | 88 ++++++++++++++++++++++++++--- src/codegen_new/codegen_block.c | 4 ++ 2 files changed, 84 insertions(+), 8 deletions(-) diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index 4719dfc399f..e5f31817fd4 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -7,6 +7,7 @@ # include #endif +#include #include #include #include @@ -18,6 +19,59 @@ #include "codegen.h" #include "codegen_allocator.h" +#include "codegen_backend.h" + +struct mem_code_block_t; + +typedef struct mem_code_block_t +{ + struct mem_code_block_t* prev; + struct mem_code_block_t* next; + + int number; +} mem_code_block_t; + +static bool valid_code_blocks[BLOCK_SIZE]; +static mem_code_block_t mem_code_blocks[BLOCK_SIZE]; +static mem_code_block_t* mem_code_block_head = NULL; +static mem_code_block_t* mem_code_block_tail = NULL; + +static void +remove_from_block_list(mem_code_block_t* block) +{ + valid_code_blocks[block->number] = 0; + if (block->prev) { + block->prev->next = block->next; + if (block->next) { + block->next->prev = block->prev; + } else { + mem_code_block_tail = block->prev; + } + } else if (block->next) { + mem_code_block_head = block->next; + if (mem_code_block_head && mem_code_block_head->next) { + mem_code_block_head->next->prev = mem_code_block_head; + } + } else if (block == mem_code_block_head) { + mem_code_block_head = mem_code_block_tail = NULL; + } + block->next = block->prev = NULL; +} + +static void +add_to_block_list(int code_block) +{ + if (!mem_code_block_head) { + mem_code_block_head = &mem_code_blocks[code_block]; + mem_code_block_head->number = code_block; + mem_code_block_tail = mem_code_block_head; + } else { + mem_code_block_tail->next = &mem_code_blocks[code_block]; + mem_code_blocks[code_block].prev = mem_code_block_tail; + mem_code_block_tail = &mem_code_blocks[code_block]; + mem_code_blocks[code_block].number = code_block; + } +} typedef struct mem_block_t { uint32_t offset; /*Offset into mem_block_alloc*/ @@ -53,15 +107,24 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) mem_block_t *block; uint32_t block_nr; - while (!mem_block_free_list) { - /*Pick a random memory block and free the owning code block*/ - block_nr = rand() & MEM_BLOCK_MASK; - block = &mem_blocks[block_nr]; - - if (block->code_block && block->code_block != code_block) - codegen_delete_block(&codeblock[block->code_block]); + if (!mem_block_free_list) { + if (mem_code_block_head == mem_code_block_tail) { + fatal("Out of memory blocks!\n"); + } else { + mem_code_block_t* mem_code_block = mem_code_block_head; + while (mem_code_block) { + if (code_block != block->code_block) { + codegen_delete_block(&codeblock[mem_code_block->number]); + if (mem_block_free_list) + goto block_allocate; + } + mem_code_block = mem_code_block->next; + } + fatal("Out of memory blocks!\n"); + } } +block_allocate: /*Remove from free list*/ block_nr = mem_block_free_list; block = &mem_blocks[block_nr - 1]; @@ -72,8 +135,14 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) /*Add to parent list*/ block->next = parent->next; parent->next = block_nr; - } else + } else { block->next = 0; + + if (!valid_code_blocks[code_block]) { + valid_code_blocks[code_block] = 1; + add_to_block_list(code_block); + } + } codegen_allocator_usage++; return block; @@ -83,6 +152,9 @@ codegen_allocator_free(mem_block_t *block) { int block_nr = (((uintptr_t) block - (uintptr_t) mem_blocks) / sizeof(mem_block_t)) + 1; + if (valid_code_blocks[block->code_block]) + remove_from_block_list(&mem_code_blocks[block->code_block]); + while (1) { int next_block_nr = block->next; codegen_allocator_usage--; diff --git a/src/codegen_new/codegen_block.c b/src/codegen_new/codegen_block.c index ff82384bedd..97dd4927bf2 100644 --- a/src/codegen_new/codegen_block.c +++ b/src/codegen_new/codegen_block.c @@ -559,6 +559,10 @@ codegen_block_start_recompile(codeblock_t *block) fatal("Recompile to used block!\n"); #endif + if (block->head_mem_block) { + codegen_allocator_free(block->head_mem_block); + block->head_mem_block = NULL; + } block->head_mem_block = codegen_allocator_allocate(NULL, block_current); block->data = codeblock_allocator_get_ptr(block->head_mem_block); From 3e8843e6ec4e300c868ea0db35acb8e0b43b26db Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 23 Aug 2025 01:50:34 +0600 Subject: [PATCH 070/320] Fix warnings --- src/codegen_new/codegen_allocator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index e5f31817fd4..3440a79aa07 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -113,7 +113,7 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) } else { mem_code_block_t* mem_code_block = mem_code_block_head; while (mem_code_block) { - if (code_block != block->code_block) { + if (code_block != mem_code_block->number) { codegen_delete_block(&codeblock[mem_code_block->number]); if (mem_block_free_list) goto block_allocate; From 48973677f3f4ce955759ef8f5507f61b7bba646d Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 23 Aug 2025 16:56:51 +0600 Subject: [PATCH 071/320] Purge all codeblocks if running out of memory blocks except the one being recompiled --- src/codegen_new/codegen_allocator.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index 3440a79aa07..ac19038694d 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -115,11 +115,13 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) while (mem_code_block) { if (code_block != mem_code_block->number) { codegen_delete_block(&codeblock[mem_code_block->number]); - if (mem_block_free_list) - goto block_allocate; } mem_code_block = mem_code_block->next; } + + if (mem_block_free_list) + goto block_allocate; + fatal("Out of memory blocks!\n"); } } From b8d3714edb5c53e050ace582a31044c86bdc8e08 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Wed, 17 Dec 2025 00:30:29 +0500 Subject: [PATCH 072/320] Manager: Implement defaults for manager config Enable update checker by default --- src/qt/qt_vmmanager_config.cpp | 17 ++++++++++++++++- src/qt/qt_vmmanager_config.hpp | 2 ++ src/qt/qt_vmmanager_mainwindow.cpp | 2 -- src/qt/qt_vmmanager_preferences.cpp | 1 - 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_vmmanager_config.cpp b/src/qt/qt_vmmanager_config.cpp index 70fcdcc6c56..b49446dbb95 100644 --- a/src/qt/qt_vmmanager_config.cpp +++ b/src/qt/qt_vmmanager_config.cpp @@ -18,8 +18,18 @@ extern "C" { #include <86box/plat.h> +#include <86box/version.h> } +QVariantHash VMManagerConfig::generalDefaults = { + { "hide_tool_bar", 0 }, + { "regex_search", 0 }, +#if EMU_BUILD_NUM != 0 + { "update_check", 1 }, +#endif + { "window_remember", 0 } +}; + VMManagerConfig::VMManagerConfig(const ConfigType type, const QString §ion) { char BUF[256]; @@ -36,6 +46,8 @@ VMManagerConfig::VMManagerConfig(const ConfigType type, const QString §ion) settings->setFallbacksEnabled(false); if (type == ConfigType::System && !section.isEmpty()) { settings->beginGroup(section); + } else { + settings->beginGroup(""); } } @@ -47,7 +59,10 @@ VMManagerConfig::~VMManagerConfig() QString VMManagerConfig::getStringValue(const QString &key) const { - const auto value = settings->value(key); + auto defaultValue = QVariant(); + if ((config_type == ConfigType::General) && (generalDefaults.contains(key))) + defaultValue = generalDefaults[key]; + const auto value = settings->value(key, defaultValue); // An invalid QVariant with toString will give a default QString value which is blank. // Therefore any variables that do not exist will return blank strings return value.toString(); diff --git a/src/qt/qt_vmmanager_config.hpp b/src/qt/qt_vmmanager_config.hpp index 814b3c70f75..e9c804a7e3f 100644 --- a/src/qt/qt_vmmanager_config.hpp +++ b/src/qt/qt_vmmanager_config.hpp @@ -35,6 +35,8 @@ class VMManagerConfig : QObject { void sync() const; + static QVariantHash generalDefaults; + QSettings *settings; ConfigType config_type; QString system_name; diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index cee6cb2917c..7efca83f3f2 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -109,8 +109,6 @@ VMManagerMainWindow:: ui->actionHide_tool_bar->setChecked(!!config->getStringValue("hide_tool_bar").toInt()); if (ui->actionHide_tool_bar->isChecked()) ui->toolBar->setVisible(false); - else - config->setStringValue("hide_tool_bar", "0"); if (!!config->getStringValue("window_remember").toInt()) { QString coords = config->getStringValue("window_coordinates"); if (!coords.isEmpty()) { diff --git a/src/qt/qt_vmmanager_preferences.cpp b/src/qt/qt_vmmanager_preferences.cpp index eb4f20d3362..2de133254c0 100644 --- a/src/qt/qt_vmmanager_preferences.cpp +++ b/src/qt/qt_vmmanager_preferences.cpp @@ -59,7 +59,6 @@ VMManagerPreferences:: } ui->comboBoxLanguage->model()->sort(Qt::AscendingOrder); - // TODO: Defaults #if EMU_BUILD_NUM != 0 const auto configUpdateCheck = config->getStringValue("update_check").toInt(); ui->updateCheckBox->setChecked(configUpdateCheck); From 7800bcd0bdb5fd36c0f3195bdb0a8b38a7815638 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Wed, 17 Dec 2025 21:53:48 +0500 Subject: [PATCH 073/320] Manager: Pass asset path to VMs if specified on command line (#6569) * Manager: Pass asset path to VMs if specified on command line * Manager: Merge `VMManagerSystem::launchSettings` into `VMManagerSystem::launchMainProcess` --- src/include/86box/86box.h | 7 ++-- src/qt/qt_vmmanager_system.cpp | 72 +++++++--------------------------- src/qt/qt_vmmanager_system.hpp | 2 +- 3 files changed, 19 insertions(+), 62 deletions(-) diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index a1406d2015a..f8765aecbef 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -159,9 +159,10 @@ extern int confirm_exit_cmdl; /* (O) do not ask for confirmation on quit if set extern uint64_t unique_id; extern uint64_t source_hwnd; #endif -extern char rom_path[1024]; /* (O) full path to ROMs */ -extern char log_path[1024]; /* (O) full path of logfile */ -extern char vm_name[1024]; /* (O) display name of the VM */ +extern char rom_path[1024]; /* (O) full path to ROMs */ +extern char asset_path[1024]; /* (O) full path to assets */ +extern char log_path[1024]; /* (O) full path of logfile */ +extern char vm_name[1024]; /* (O) display name of the VM */ #ifdef USE_INSTRUMENT extern uint8_t instru_enabled; extern uint64_t instru_run_ms; diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 748d60b850f..46d0451e89e 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -392,9 +392,8 @@ VMManagerSystem::has86BoxBinary() } void -VMManagerSystem::launchMainProcess() +VMManagerSystem::launch86Box(bool settings) { - if (!has86BoxBinary()) { qWarning("No binary found! returning"); return; @@ -408,22 +407,31 @@ VMManagerSystem::launchMainProcess() return; } } - // If the system is already running, bring it to front + // If the system is already running, bring it to front or instruct it to show settings if (process->processId() != 0) { #ifdef Q_OS_WINDOWS if (this->id) { SetForegroundWindow((HWND) this->id); } #endif + if (settings) + socket_server->serverSendMessage(VMManagerProtocol::ManagerMessage::ShowSettings); return; } + + // Otherwise, launch the system setProcessEnvVars(); + window_obscured = settings; QString program = main_binary.filePath(); QStringList args; args << "--vmpath" << config_dir; args << "--vmname" << displayName; + if (settings) + args << "--settings"; if (rom_path[0] != '\0') args << "--rompath" << QString(rom_path); + if (asset_path[0] != '\0') + args << "--assetpath" << QString(asset_path); if (global_cfg_overridden) args << "--global" << QString(global_cfg_path); if (!hook_enabled) @@ -442,7 +450,7 @@ VMManagerSystem::launchMainProcess() connect(process, QOverload::of(&QProcess::finished), [=](const int exitCode, const QProcess::ExitStatus exitStatus) { if (exitCode != 0 || exitStatus != QProcess::NormalExit) { - qInfo().nospace().noquote() << "Abnormal program termination while launching main process: exit code " << exitCode << ", exit status " << exitStatus; + qInfo().nospace().noquote() << "Abnormal program termination while launching system: exit code " << exitCode << ", exit status " << exitStatus; QMessageBox::critical(this, tr("Virtual machine crash"), tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString("%1 (0x%2)").arg(QString::number(exitCode), QString::number(exitCode, 16)))); return; @@ -455,65 +463,13 @@ VMManagerSystem::launchMainProcess() void VMManagerSystem::startButtonPressed() { - launchMainProcess(); + launch86Box(false); } void VMManagerSystem::launchSettings() { - if (!has86BoxBinary()) { - qWarning("No binary found! returning"); - return; - } - - // start the server first to get the socket name - if (!serverIsRunning) { - if (!startServer()) { - // FIXME: Better error handling - qInfo("Failed to start VM Manager server"); - return; - } - } - - // If the system is already running, instruct it to show settings - if (process->processId() != 0) { -#ifdef Q_OS_WINDOWS - if (this->id) { - SetForegroundWindow((HWND) this->id); - } -#endif - socket_server->serverSendMessage(VMManagerProtocol::ManagerMessage::ShowSettings); - return; - } - - // Otherwise, launch the system with the settings parameter - setProcessEnvVars(); - window_obscured = true; - QString program = main_binary.filePath(); - QStringList open_command_args; - QStringList args; - args << "--vmpath" << config_dir << "--settings"; - if (rom_path[0] != '\0') - args << "--rompath" << QString(rom_path); - if (global_cfg_overridden) - args << "--global" << QString(global_cfg_path); - process->setProgram(program); - process->setArguments(args); - qDebug() << Q_FUNC_INFO << " Full Command:" << process->program() << " " << process->arguments(); - process->start(); - - disconnect(process, QOverload::of(&QProcess::finished), nullptr, nullptr); - connect(process, QOverload::of(&QProcess::finished), - [=](const int exitCode, const QProcess::ExitStatus exitStatus) { - if (exitCode != 0 || exitStatus != QProcess::NormalExit) { - qInfo().nospace().noquote() << "Abnormal program termination while launching settings: exit code " << exitCode << ", exit status " << exitStatus; - QMessageBox::critical(this, tr("Virtual machine crash"), - tr("The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2.").arg(displayName, QString("%1 (0x%2)").arg(QString::number(exitCode), QString::number(exitCode, 16)))); - return; - } - - configurationChangeReceived(); - }); + launch86Box(true); } void diff --git a/src/qt/qt_vmmanager_system.hpp b/src/qt/qt_vmmanager_system.hpp index 62789b70acf..ca79f4e3ce9 100644 --- a/src/qt/qt_vmmanager_system.hpp +++ b/src/qt/qt_vmmanager_system.hpp @@ -120,7 +120,7 @@ class VMManagerSystem : public QWidget { [[nodiscard]] bool isProcessRunning() const; [[nodiscard]] qint64 processId() const; public slots: - void launchMainProcess(); + void launch86Box(bool settings = false); void launchSettings(); void startButtonPressed(); void restartButtonPressed(); From 0dc8509220a5fd15383d6dc4a88cda601bf38b41 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Wed, 17 Dec 2025 22:29:51 +0500 Subject: [PATCH 074/320] More string and translation improvements (#6570) * Qt: Minor rewording on the storage controllers settings page All translations updated accordingly (the "Hard disk" string is still used in the PC5086 config and therefore has been moved to a suitable place) Also fix broken translations for ter/qua IDE controllers * Qt: Don't attempt to translate storage bus names * Qt: Remove translations for non-generic joystick names These weren't actually supposed to be translated Thrustmaster Formulas were left in because of "with/out adapter" * Qt: Tooltip and icon text fixing * Restore unused strings that were to be used as tooltips for Ctrl+Alt+Del/Esc buttons * Consistently define tooltips and iconText to avoid mnemonics showing in CJK languages * Remove tooltips from actions that only show up in menus * Qt: Add ACPI shutdown to menu * Qt: Drop "SoundFont" string from translations This is a brand name that shouldn't be translated * Qt: Replace three-dot ellipsis with a single-character one * Manager: workaround for font mismatch on language change --- src/qt/languages/86box.pot | 161 +++++---------- src/qt/languages/cs-CZ.po | 243 +++++++++-------------- src/qt/languages/de-DE.po | 243 +++++++++-------------- src/qt/languages/es-ES.po | 245 +++++++++-------------- src/qt/languages/fi-FI.po | 245 +++++++++-------------- src/qt/languages/fr-FR.po | 245 +++++++++-------------- src/qt/languages/hr-HR.po | 243 +++++++++-------------- src/qt/languages/it-IT.po | 245 +++++++++-------------- src/qt/languages/ja-JP.po | 247 +++++++++--------------- src/qt/languages/ko-KR.po | 247 +++++++++--------------- src/qt/languages/nb-NO.po | 245 +++++++++-------------- src/qt/languages/nl-NL.po | 245 +++++++++-------------- src/qt/languages/pl-PL.po | 243 +++++++++-------------- src/qt/languages/pt-BR.po | 243 +++++++++-------------- src/qt/languages/pt-PT.po | 245 +++++++++-------------- src/qt/languages/ru-RU.po | 245 +++++++++-------------- src/qt/languages/sk-SK.po | 243 +++++++++-------------- src/qt/languages/sl-SI.po | 243 +++++++++-------------- src/qt/languages/sv-SE.po | 243 +++++++++-------------- src/qt/languages/tr-TR.po | 247 +++++++++--------------- src/qt/languages/uk-UA.po | 245 +++++++++-------------- src/qt/languages/vi-VN.po | 243 +++++++++-------------- src/qt/languages/zh-CN.po | 245 +++++++++-------------- src/qt/languages/zh-TW.po | 245 +++++++++-------------- src/qt/qt_filefield.ui | 2 +- src/qt/qt_harddiskdialog.cpp | 4 +- src/qt/qt_harddrive_common.cpp | 14 +- src/qt/qt_mainwindow.ui | 37 ++-- src/qt/qt_mediamenu.cpp | 34 ++-- src/qt/qt_settingsdisplay.ui | 4 +- src/qt/qt_settingsharddisks.ui | 4 +- src/qt/qt_settingsinput.ui | 8 +- src/qt/qt_settingsstoragecontrollers.ui | 8 +- src/qt/qt_updatecheckdialog.ui | 2 +- src/qt/qt_vmmanager_details.cpp | 9 +- src/qt/qt_vmmanager_details.ui | 4 +- src/qt/qt_vmmanager_main.cpp | 16 +- src/qt/qt_vmmanager_mainwindow.cpp | 9 +- src/qt/qt_vmmanager_mainwindow.ui | 40 ++-- src/qt/qt_vmmanager_system.cpp | 2 +- 40 files changed, 2321 insertions(+), 3660 deletions(-) diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index f2689b6e148..1eeb6bfc75b 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -66,7 +66,7 @@ msgstr "" msgid "&VNC" msgstr "" -msgid "Specify &dimensions..." +msgid "Specify &dimensions…" msgstr "" msgid "Force &4:3 display ratio" @@ -192,10 +192,10 @@ msgstr "" msgid "&Tools" msgstr "" -msgid "&Settings..." +msgid "&Settings…" msgstr "" -msgid "Settings..." +msgid "Settings…" msgstr "" msgid "&Update status bar icons" @@ -207,13 +207,13 @@ msgstr "" msgid "S&ound" msgstr "" -msgid "&Preferences..." +msgid "&Preferences…" msgstr "" msgid "Enable &Discord integration" msgstr "" -msgid "Sound &gain..." +msgid "Sound &gain…" msgstr "" msgid "Begin trace" @@ -225,19 +225,19 @@ msgstr "" msgid "&Help" msgstr "" -msgid "&Documentation..." +msgid "&Documentation…" msgstr "" -msgid "&About 86Box..." +msgid "&About 86Box…" msgstr "" -msgid "&New image..." +msgid "&New image…" msgstr "" -msgid "&Existing image..." +msgid "&Existing image…" msgstr "" -msgid "Existing image (&Write-protected)..." +msgid "Existing image (&Write-protected)…" msgstr "" msgid "&Record" @@ -255,10 +255,10 @@ msgstr "" msgid "E&ject" msgstr "" -msgid "&Image..." +msgid "&Image…" msgstr "" -msgid "E&xport to 86F..." +msgid "E&xport to 86F…" msgstr "" msgid "&Mute" @@ -270,7 +270,7 @@ msgstr "" msgid "Reload previous image" msgstr "" -msgid "&Folder..." +msgid "&Folder…" msgstr "" msgid "Preferences" @@ -417,16 +417,16 @@ msgstr "" msgid "Joystick" msgstr "" -msgid "Joystick 1..." +msgid "Joystick 1…" msgstr "" -msgid "Joystick 2..." +msgid "Joystick 2…" msgstr "" -msgid "Joystick 3..." +msgid "Joystick 3…" msgstr "" -msgid "Joystick 4..." +msgid "Joystick 4…" msgstr "" msgid "Sound card #1:" @@ -516,22 +516,22 @@ msgstr "" msgid "Parallel port 4" msgstr "" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "" -msgid "Tertiary IDE Controller" +msgid "[ISA16] Tertiary IDE Controller" msgstr "" -msgid "Quaternary IDE Controller" +msgid "[ISA16] Quaternary IDE Controller" msgstr "" -msgid "Hard disk" +msgid "Hard disk controllers" msgstr "" -msgid "SCSI" +msgid "SCSI controllers" msgstr "" msgid "Controller 1:" @@ -555,10 +555,10 @@ msgstr "" msgid "Firmware Version" msgstr "" -msgid "&New..." +msgid "&New…" msgstr "" -msgid "&Existing..." +msgid "&Existing…" msgstr "" msgid "&Remove" @@ -867,9 +867,6 @@ msgstr "" msgid "6-button gamepad" msgstr "" -msgid "Gravis PC GamePad" -msgstr "" - msgid "2-button flight yoke" msgstr "" @@ -897,51 +894,6 @@ msgstr "" msgid "Steering wheel (3-axis, 4-button)" msgstr "" -msgid "CH Flightstick" -msgstr "" - -msgid "CH Flightstick + CH Pedals" -msgstr "" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "" - -msgid "CH Flightstick Pro" -msgstr "" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "" - -msgid "CH Virtual Pilot" -msgstr "" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "" - -msgid "CH Virtual Pilot Pro" -msgstr "" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "" - -msgid "Microsoft SideWinder Pad" -msgstr "" - -msgid "Thrustmaster Flight Control System" -msgstr "" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "" @@ -996,10 +948,16 @@ msgstr "" msgid "&File" msgstr "" -msgid "&New machine..." +msgid "&New machine…" msgstr "" -msgid "&Check for updates..." +msgid "New machine…" +msgstr "" + +msgid "New machine" +msgstr "" + +msgid "&Check for updates…" msgstr "" msgid "Exit" @@ -1251,25 +1209,25 @@ msgstr "" msgid "Enter the new display name (blank to reset)" msgstr "" -msgid "Change &display name..." +msgid "Change &display name…" msgstr "" msgid "Context Menu" msgstr "" -msgid "&Open folder..." +msgid "&Open folder…" msgstr "" -msgid "Open p&rinter tray..." +msgid "Open p&rinter tray…" msgstr "" -msgid "Set &icon..." +msgid "Set &icon…" msgstr "" msgid "Select an icon" msgstr "" -msgid "C&lone..." +msgid "C&lone…" msgstr "" msgid "Virtual machine \"%1\" (%2) will be cloned into:" @@ -1356,7 +1314,7 @@ msgstr "" msgid "Search" msgstr "" -msgid "Searching for VMs..." +msgid "Searching for VMs…" msgstr "" msgid "Found %1" @@ -1392,10 +1350,10 @@ msgstr "" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "" -msgid "Custom..." +msgid "Custom…" msgstr "" -msgid "Custom (large)..." +msgid "Custom (large)…" msgstr "" msgid "Add New Hard Disk" @@ -1515,21 +1473,6 @@ msgstr "" msgid "Could not fix VHD timestamp." msgstr "" -msgid "MFM/RLL" -msgstr "" - -msgid "XTA" -msgstr "" - -msgid "ESDI" -msgstr "" - -msgid "IDE" -msgstr "" - -msgid "ATAPI" -msgstr "" - msgid "CD-ROM %1 (%2): %3" msgstr "" @@ -1680,13 +1623,13 @@ msgstr "" msgid "About &Qt" msgstr "" -msgid "&MCA devices..." +msgid "&MCA devices…" msgstr "" msgid "Show non-&primary monitors" msgstr "" -msgid "Open screenshots &folder..." +msgid "Open screenshots &folder…" msgstr "" msgid "Appl&y fullscreen stretch mode when maximized" @@ -1707,7 +1650,7 @@ msgstr "" msgid "Clear image &history" msgstr "" -msgid "Create..." +msgid "Create…" msgstr "" msgid "Host CD/DVD Drive (%1)" @@ -1749,7 +1692,7 @@ msgstr "" msgid "Remove" msgstr "" -msgid "Browse..." +msgid "Browse…" msgstr "" msgid "Couldn't create OpenGL context." @@ -1839,7 +1782,7 @@ msgstr "" msgid "Serial port passthrough 4" msgstr "" -msgid "Renderer &options..." +msgid "Renderer &options…" msgstr "" msgid "PC/XT Keyboard" @@ -1977,6 +1920,9 @@ msgstr "" msgid "Parallel port IRQ" msgstr "" +msgid "Hard disk" +msgstr "" + msgid "BIOS Revision" msgstr "" @@ -2052,9 +1998,6 @@ msgstr "" msgid "MIDI Clockout" msgstr "" -msgid "SoundFont" -msgstr "" - msgid "Output Gain" msgstr "" @@ -2964,7 +2907,7 @@ msgstr "" msgid "Update check" msgstr "" -msgid "Checking for updates..." +msgid "Checking for updates…" msgstr "" msgid "86Box Update" @@ -3003,7 +2946,7 @@ msgstr "" msgid "Sharpness" msgstr "" -msgid "&CGA composite settings..." +msgid "&CGA composite settings…" msgstr "" msgid "CGA composite settings" @@ -3012,7 +2955,7 @@ msgstr "" msgid "Monitor EDID" msgstr "" -msgid "Export..." +msgid "Export…" msgstr "" msgid "Export EDID" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 4b5c1648182..ea74d59f93d 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Zadat velikost..." +msgid "Specify &dimensions…" +msgstr "&Zadat velikost…" msgid "Force &4:3 display ratio" msgstr "Dodržovat poměr stran &4:3" @@ -198,11 +198,11 @@ msgstr "&Média" msgid "&Tools" msgstr "&Nástroje" -msgid "&Settings..." -msgstr "&Nastavení..." +msgid "&Settings…" +msgstr "&Nastavení…" -msgid "Settings..." -msgstr "Nastavení..." +msgid "Settings…" +msgstr "Nastavení…" msgid "&Update status bar icons" msgstr "&Aktualizovat ikony stavového řádku" @@ -213,14 +213,14 @@ msgstr "Pořídit &screenshot" msgid "S&ound" msgstr "&Zvuk" -msgid "&Preferences..." -msgstr "&Předvolby..." +msgid "&Preferences…" +msgstr "&Předvolby…" msgid "Enable &Discord integration" msgstr "Povolit integraci s &Discordem" -msgid "Sound &gain..." -msgstr "&Zesílení zvuku..." +msgid "Sound &gain…" +msgstr "&Zesílení zvuku…" msgid "Begin trace" msgstr "Začít trace" @@ -231,20 +231,20 @@ msgstr "Zastavit trace" msgid "&Help" msgstr "Ná&pověda" -msgid "&Documentation..." -msgstr "&Dokumentace..." +msgid "&Documentation…" +msgstr "&Dokumentace…" -msgid "&About 86Box..." -msgstr "&O programu 86Box..." +msgid "&About 86Box…" +msgstr "&O programu 86Box…" -msgid "&New image..." -msgstr "&Nový obraz..." +msgid "&New image…" +msgstr "&Nový obraz…" -msgid "&Existing image..." -msgstr "&Existující obraz..." +msgid "&Existing image…" +msgstr "&Existující obraz…" -msgid "Existing image (&Write-protected)..." -msgstr "Existující obraz (&ochrana proti zápisu)..." +msgid "Existing image (&Write-protected)…" +msgstr "Existující obraz (&ochrana proti zápisu)…" msgid "&Record" msgstr "&Nahrávat" @@ -261,11 +261,11 @@ msgstr "Přetočit na &konec" msgid "E&ject" msgstr "&Vyjmout" -msgid "&Image..." -msgstr "&Obraz..." +msgid "&Image…" +msgstr "&Obraz…" -msgid "E&xport to 86F..." -msgstr "E&xportovat do 86F..." +msgid "E&xport to 86F…" +msgstr "E&xportovat do 86F…" msgid "&Mute" msgstr "&Ztišit" @@ -276,8 +276,8 @@ msgstr "&Vyjmout" msgid "Reload previous image" msgstr "Načíst znova předchozí obraz" -msgid "&Folder..." -msgstr "&Složka..." +msgid "&Folder…" +msgstr "&Složka…" msgid "Preferences" msgstr "Předvolby" @@ -423,17 +423,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Zvuková karta 1:" @@ -522,23 +522,23 @@ msgstr "Povolit port LPT3" msgid "Parallel port 4" msgstr "Povolit port LPT4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Disketový řadič:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Řadič CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Třetí řadič IDE" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Třetí řadič IDE" -msgid "Quaternary IDE Controller" -msgstr "Čtvrtý řadič IDE" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Čtvrtý řadič IDE" -msgid "Hard disk" -msgstr "Pevný disk" +msgid "Hard disk controllers" +msgstr "Řadiče pevných disků" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Řadiče SCSI" msgid "Controller 1:" msgstr "Řadič 1:" @@ -561,11 +561,11 @@ msgstr "Pevné disky:" msgid "Firmware Version" msgstr "Verze firmware" -msgid "&New..." -msgstr "&Nový..." +msgid "&New…" +msgstr "&Nový…" -msgid "&Existing..." -msgstr "&Existující..." +msgid "&Existing…" +msgstr "&Existující…" msgid "&Remove" msgstr "&Odebrat" @@ -873,9 +873,6 @@ msgstr "Ovladač se 4 tlačítky" msgid "6-button gamepad" msgstr "Ovladač se 6 tlačítky" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Letecký knipl s 2 tlačítky" @@ -903,51 +900,6 @@ msgstr "Volant (3 osy, 3 tlačítka)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volant (3 osy, 4 tlačítka)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 s adaptérem" @@ -1002,11 +954,17 @@ msgstr "Vestavěné zařízení" msgid "&File" msgstr "&Soubor" -msgid "&New machine..." -msgstr "&Nový počítač..." +msgid "&New machine…" +msgstr "&Nový počítač…" + +msgid "New machine…" +msgstr "Nový počítač…" -msgid "&Check for updates..." -msgstr "&Zkontrolovat aktualizace..." +msgid "New machine" +msgstr "Nový počítač" + +msgid "&Check for updates…" +msgstr "&Zkontrolovat aktualizace…" msgid "Exit" msgstr "Ukončit" @@ -1257,26 +1215,26 @@ msgstr "Nastavit zobrazované jméno" msgid "Enter the new display name (blank to reset)" msgstr "Zadejte nové zobrazované jméno (prázdné pole pro vymazání)" -msgid "Change &display name..." -msgstr "Změnit &zobrazované jméno..." +msgid "Change &display name…" +msgstr "Změnit &zobrazované jméno…" msgid "Context Menu" msgstr "Kontextová nabídka" -msgid "&Open folder..." -msgstr "&Otevřít složku..." +msgid "&Open folder…" +msgstr "&Otevřít složku…" -msgid "Open p&rinter tray..." -msgstr "Otevřít zásobník &tiskárny..." +msgid "Open p&rinter tray…" +msgstr "Otevřít zásobník &tiskárny…" -msgid "Set &icon..." -msgstr "Nastavit &ikonu..." +msgid "Set &icon…" +msgstr "Nastavit &ikonu…" msgid "Select an icon" msgstr "Vyberte ikonu" -msgid "C&lone..." -msgstr "K&lonovat..." +msgid "C&lone…" +msgstr "K&lonovat…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuální počítač \"%1\" (%2) bude naklonován do:" @@ -1362,8 +1320,8 @@ msgstr "Žádný snímek obrazovky" msgid "Search" msgstr "Hledat" -msgid "Searching for VMs..." -msgstr "Hledání virtuálních počítačů..." +msgid "Searching for VMs…" +msgstr "Hledání virtuálních počítačů…" msgid "Found %1" msgstr "Nalezeno %1" @@ -1398,11 +1356,11 @@ msgstr "Pevný disk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "CD-ROM mechaniky pro rozhraní MFM/RLL nebo ESDI nikdy neexistovaly" -msgid "Custom..." -msgstr "Vlastní..." +msgid "Custom…" +msgstr "Vlastní…" -msgid "Custom (large)..." -msgstr "Vlastní (velký)..." +msgid "Custom (large)…" +msgstr "Vlastní (velký)…" msgid "Add New Hard Disk" msgstr "Přidat nový pevný disk" @@ -1521,21 +1479,6 @@ msgstr "Časová razítka nadřazeného a podřazeného disku nesouhlasí" msgid "Could not fix VHD timestamp." msgstr "Nebylo možné opravit časové razítko VHD disku." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1686,14 +1629,14 @@ msgstr "Nástroj pro tablety" msgid "About &Qt" msgstr "O platformě &Qt" -msgid "&MCA devices..." -msgstr "Zařízení MCA ..." +msgid "&MCA devices…" +msgstr "Zařízení MCA …" msgid "Show non-&primary monitors" msgstr "Zobrazit neprimární monitory" -msgid "Open screenshots &folder..." -msgstr "Otevřít složku se snímky obrazovky..." +msgid "Open screenshots &folder…" +msgstr "Otevřít složku se snímky obrazovky…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Použít režim roztá&hnutí při celé obrazovce pro maximalizované okno" @@ -1713,8 +1656,8 @@ msgstr "&Připojeno" msgid "Clear image &history" msgstr "Vymaž &historie snímků" -msgid "Create..." -msgstr "Vytvořit..." +msgid "Create…" +msgstr "Vytvořit…" msgid "Host CD/DVD Drive (%1)" msgstr "Jednotka CD/DVD hostitele (%1)" @@ -1755,8 +1698,8 @@ msgstr "Shadery" msgid "Remove" msgstr "Odstranit" -msgid "Browse..." -msgstr "Procházet..." +msgid "Browse…" +msgstr "Procházet…" msgid "Couldn't create OpenGL context." msgstr "Nepodařilo se vytvořit kontext OpenGL." @@ -1845,8 +1788,8 @@ msgstr "Průchod sériového portu 3" msgid "Serial port passthrough 4" msgstr "Průchod sériového portu 4" -msgid "Renderer &options..." -msgstr "Možnosti rendereru..." +msgid "Renderer &options…" +msgstr "Možnosti rendereru…" msgid "PC/XT Keyboard" msgstr "PC/XT klávesnice" @@ -1983,6 +1926,9 @@ msgstr "Přerušení sériového portu" msgid "Parallel port IRQ" msgstr "Přerušení paralelního portu" +msgid "Hard disk" +msgstr "Pevný disk" + msgid "BIOS Revision" msgstr "Revize BIOS" @@ -2058,9 +2004,6 @@ msgstr "Průchod vstupu MIDI" msgid "MIDI Clockout" msgstr "Výstup MIDI hodin" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Zesílení výstupu" @@ -2970,8 +2913,8 @@ msgstr "Navštívit stránku pro stažení" msgid "Update check" msgstr "Kontrola aktualizací" -msgid "Checking for updates..." -msgstr "Probíhá kontrola aktualizací..." +msgid "Checking for updates…" +msgstr "Probíhá kontrola aktualizací…" msgid "86Box Update" msgstr "Aktualizace 86Box" @@ -3009,8 +2952,8 @@ msgstr "Jas" msgid "Sharpness" msgstr "Ostrost" -msgid "&CGA composite settings..." -msgstr "Nastavení kompozitního výstupu &CGA..." +msgid "&CGA composite settings…" +msgstr "Nastavení kompozitního výstupu &CGA…" msgid "CGA composite settings" msgstr "Nastavení kompozitního výstupu CGA" @@ -3018,8 +2961,8 @@ msgstr "Nastavení kompozitního výstupu CGA" msgid "Monitor EDID" msgstr "EDID monitoru" -msgid "Export..." -msgstr "Exportovat..." +msgid "Export…" +msgstr "Exportovat…" msgid "Export EDID" msgstr "Exportovat EDID" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 69b778eda03..05259fb82ae 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Fenstergröße &einstellen..." +msgid "Specify &dimensions…" +msgstr "Fenstergröße &einstellen…" msgid "Force &4:3 display ratio" msgstr "&4:3-Seitenverhältnis erzwingen" @@ -198,11 +198,11 @@ msgstr "&Medien" msgid "&Tools" msgstr "&Werkzeuge" -msgid "&Settings..." -msgstr "&Optionen..." +msgid "&Settings…" +msgstr "&Optionen…" -msgid "Settings..." -msgstr "Einstellungen..." +msgid "Settings…" +msgstr "Optionen…" msgid "&Update status bar icons" msgstr "&Statusleistenicons aktualisieren" @@ -213,14 +213,14 @@ msgstr "S&creenshot aufnehmen" msgid "S&ound" msgstr "&Ton" -msgid "&Preferences..." -msgstr "&Einstellungen..." +msgid "&Preferences…" +msgstr "&Einstellungen…" msgid "Enable &Discord integration" msgstr "&Discord-Integration einschalten" -msgid "Sound &gain..." -msgstr "&Klangverstärkung..." +msgid "Sound &gain…" +msgstr "&Klangverstärkung…" msgid "Begin trace" msgstr "Tracing starten" @@ -231,20 +231,20 @@ msgstr "Tracing beenden" msgid "&Help" msgstr "&Hilfe" -msgid "&Documentation..." -msgstr "&Dokumentation..." +msgid "&Documentation…" +msgstr "&Dokumentation…" -msgid "&About 86Box..." -msgstr "&Über 86Box..." +msgid "&About 86Box…" +msgstr "&Über 86Box…" -msgid "&New image..." -msgstr "&Neues Abbild..." +msgid "&New image…" +msgstr "&Neues Abbild…" -msgid "&Existing image..." -msgstr "&Bestehendes Abbild..." +msgid "&Existing image…" +msgstr "&Bestehendes Abbild…" -msgid "Existing image (&Write-protected)..." -msgstr "Bestehendes Abbild (&schreibgeschützt)..." +msgid "Existing image (&Write-protected)…" +msgstr "Bestehendes Abbild (&schreibgeschützt)…" msgid "&Record" msgstr "&Aufnehmen" @@ -261,11 +261,11 @@ msgstr "&An das Ende vorspulen" msgid "E&ject" msgstr "A&uswerfen" -msgid "&Image..." -msgstr "&Abbild..." +msgid "&Image…" +msgstr "&Abbild…" -msgid "E&xport to 86F..." -msgstr "&In das 86F-Format e&xportieren..." +msgid "E&xport to 86F…" +msgstr "&In das 86F-Format e&xportieren…" msgid "&Mute" msgstr "&Stummschalten" @@ -276,8 +276,8 @@ msgstr "L&eer" msgid "Reload previous image" msgstr "Voriges Abbild neu laden" -msgid "&Folder..." -msgstr "&Verzeichnis..." +msgid "&Folder…" +msgstr "&Verzeichnis…" msgid "Preferences" msgstr "Einstellungen" @@ -423,17 +423,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Soundkarte 1:" @@ -522,23 +522,23 @@ msgstr "Parallelport 3" msgid "Parallel port 4" msgstr "Parallelport 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Disketten-Controller:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROM-Controller:" -msgid "Tertiary IDE Controller" -msgstr "Tertiärer IDE-Controller" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tertiärer IDE-Controller" -msgid "Quaternary IDE Controller" -msgstr "Quartärer IDE-Controller" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Quartärer IDE-Controller" -msgid "Hard disk" -msgstr "Festplatte" +msgid "Hard disk controllers" +msgstr "Festplattencontroller" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI-Controller" msgid "Controller 1:" msgstr "Controller 1:" @@ -561,11 +561,11 @@ msgstr "Festplatten:" msgid "Firmware Version" msgstr "Firmware-Version" -msgid "&New..." -msgstr "&Neu..." +msgid "&New…" +msgstr "&Neu…" -msgid "&Existing..." -msgstr "&Vorhanden..." +msgid "&Existing…" +msgstr "&Vorhanden…" msgid "&Remove" msgstr "&Entfernen" @@ -873,9 +873,6 @@ msgstr "4-Tasten-Gamepad" msgid "6-button gamepad" msgstr "6-Tasten-Gamepad" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2-Tasten-Steuerhorn" @@ -903,51 +900,6 @@ msgstr "Lenkrad (3-Achsen, 3-Tasten)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Lenkrad (3-Achsen, 4-Tasten)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedale" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedale Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedale" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedale Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedale" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedale Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 mit Adapter" @@ -1002,11 +954,17 @@ msgstr "Internes Gerät" msgid "&File" msgstr "&Datei" -msgid "&New machine..." -msgstr "&Neue Maschine..." +msgid "&New machine…" +msgstr "&Neue Maschine…" + +msgid "New machine…" +msgstr "Neue Maschine…" -msgid "&Check for updates..." -msgstr "&Auf Aktualisierungen prüfen..." +msgid "New machine" +msgstr "Neue Maschine" + +msgid "&Check for updates…" +msgstr "&Auf Aktualisierungen prüfen…" msgid "Exit" msgstr "Beenden" @@ -1257,26 +1215,26 @@ msgstr "Anzeigename festlegen" msgid "Enter the new display name (blank to reset)" msgstr "Gebe den neuen Anzeigenamen ein (leer lassen zum Zurücksetzen)" -msgid "Change &display name..." -msgstr "&Anzeigename ändern..." +msgid "Change &display name…" +msgstr "&Anzeigename ändern…" msgid "Context Menu" msgstr "Kontextmenü" -msgid "&Open folder..." -msgstr "&Ordner öffnen..." +msgid "&Open folder…" +msgstr "&Ordner öffnen…" -msgid "Open p&rinter tray..." -msgstr "D&ruckerausgabe öffnen..." +msgid "Open p&rinter tray…" +msgstr "D&ruckerausgabe öffnen…" -msgid "Set &icon..." -msgstr "&Symbol setzen..." +msgid "Set &icon…" +msgstr "&Symbol setzen…" msgid "Select an icon" msgstr "Wähle ein Symbol aus" -msgid "C&lone..." -msgstr "K&lonen..." +msgid "C&lone…" +msgstr "K&lonen…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuelle Maschine \"%1\" (%2) wird geklont werden nach:" @@ -1362,8 +1320,8 @@ msgstr "Keine Bildschirmaufnahme" msgid "Search" msgstr "Suche" -msgid "Searching for VMs..." -msgstr "Suche nach VMs..." +msgid "Searching for VMs…" +msgstr "Suche nach VMs…" msgid "Found %1" msgstr "Gefunden %1" @@ -1398,11 +1356,11 @@ msgstr "Festplatte (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL- oder ESDI-CD-ROM-Laufwerke existieren nicht" -msgid "Custom..." -msgstr "Angepasst..." +msgid "Custom…" +msgstr "Angepasst…" -msgid "Custom (large)..." -msgstr "Angepasst (groß)..." +msgid "Custom (large)…" +msgstr "Angepasst (groß)…" msgid "Add New Hard Disk" msgstr "Neue Festplatte hinzufügen" @@ -1521,21 +1479,6 @@ msgstr "Die Zeitstempel der Eltern- und der Kindesplatte stimmen nicht überein" msgid "Could not fix VHD timestamp." msgstr "Der Zeitstempel der VHD konnte nicht korrigiert werden." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1686,14 +1629,14 @@ msgstr "Tablet-Werkzeug" msgid "About &Qt" msgstr "Über &Qt" -msgid "&MCA devices..." -msgstr "MCA-Geräte..." +msgid "&MCA devices…" +msgstr "MCA-Geräte…" msgid "Show non-&primary monitors" msgstr "Nicht-primäre Monitore anzeigen" -msgid "Open screenshots &folder..." -msgstr "Ordner „screenshots“ ö&ffnen..." +msgid "Open screenshots &folder…" +msgstr "Ordner „screenshots“ ö&ffnen…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Vollbild-S&treckmodus aktivieren, wenn das Fenster maximiert ist" @@ -1713,8 +1656,8 @@ msgstr "&Verbunden" msgid "Clear image &history" msgstr "&Abbildverlauf löschen" -msgid "Create..." -msgstr "Erstellen..." +msgid "Create…" +msgstr "Erstellen…" msgid "Host CD/DVD Drive (%1)" msgstr "Host-CD/DVD-Laufwerk (%1)" @@ -1755,8 +1698,8 @@ msgstr "Shader" msgid "Remove" msgstr "Entfernen" -msgid "Browse..." -msgstr "Durchsuchen..." +msgid "Browse…" +msgstr "Durchsuchen…" msgid "Couldn't create OpenGL context." msgstr "OpenGL-Kontext konnte nicht erstellt werden." @@ -1845,8 +1788,8 @@ msgstr "Serielle Schnittstelle 3 durchreichen" msgid "Serial port passthrough 4" msgstr "Serielle Schnittstelle 4 durchreichen" -msgid "Renderer &options..." -msgstr "Renderer-&Optionen..." +msgid "Renderer &options…" +msgstr "Renderer-&Optionen…" msgid "PC/XT Keyboard" msgstr "PC/XT-Tastatur" @@ -1983,6 +1926,9 @@ msgstr "IRQ des seriellen Ports" msgid "Parallel port IRQ" msgstr "IRQ des parallelen Ports" +msgid "Hard disk" +msgstr "Festplatte" + msgid "BIOS Revision" msgstr "BIOS-Revision" @@ -2058,9 +2004,6 @@ msgstr "MIDI-Durchgang" msgid "MIDI Clockout" msgstr "MIDI-Taktausgabe" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Ausgangsverstärkung" @@ -2970,8 +2913,8 @@ msgstr "Download-Webseite besuchen" msgid "Update check" msgstr "Aktualisierungsprüfung" -msgid "Checking for updates..." -msgstr "Prüfe auf Aktualisierungen..." +msgid "Checking for updates…" +msgstr "Prüfe auf Aktualisierungen…" msgid "86Box Update" msgstr "86Box Aktualisierung" @@ -3009,8 +2952,8 @@ msgstr "Helligkeit" msgid "Sharpness" msgstr "Schärfe" -msgid "&CGA composite settings..." -msgstr "Optionen des &CGA-Composite-Modus..." +msgid "&CGA composite settings…" +msgstr "Optionen des &CGA-Composite-Modus…" msgid "CGA composite settings" msgstr "Optionen des CGA-Composite-Modus" @@ -3018,8 +2961,8 @@ msgstr "Optionen des CGA-Composite-Modus" msgid "Monitor EDID" msgstr "EDID des Monitors" -msgid "Export..." -msgstr "Exportieren..." +msgid "Export…" +msgstr "Exportieren…" msgid "Export EDID" msgstr "EDID exportieren" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index b99343d593b..c42e3ec6c81 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "E&specificar dimensiones..." +msgid "Specify &dimensions…" +msgstr "E&specificar dimensiones…" msgid "Force &4:3 display ratio" msgstr "Forzar ratio &4:3" @@ -198,11 +198,11 @@ msgstr "&Medios" msgid "&Tools" msgstr "&Herramientas" -msgid "&Settings..." -msgstr "&Configuraciones..." +msgid "&Settings…" +msgstr "&Configuraciones…" -msgid "Settings..." -msgstr "Configuraciones..." +msgid "Settings…" +msgstr "Configuraciones…" msgid "&Update status bar icons" msgstr "&Actualizar iconos en barra de estado" @@ -213,14 +213,14 @@ msgstr "Tomar cap&tura" msgid "S&ound" msgstr "S&onido" -msgid "&Preferences..." -msgstr "&Preferencias..." +msgid "&Preferences…" +msgstr "&Preferencias…" msgid "Enable &Discord integration" msgstr "Habilitar integración con &Discord" -msgid "Sound &gain..." -msgstr "&Ganancia de sonido..." +msgid "Sound &gain…" +msgstr "&Ganancia de sonido…" msgid "Begin trace" msgstr "Comenzar traza" @@ -231,20 +231,20 @@ msgstr "Terminar traza" msgid "&Help" msgstr "Ay&uda" -msgid "&Documentation..." -msgstr "&Documentación..." +msgid "&Documentation…" +msgstr "&Documentación…" -msgid "&About 86Box..." -msgstr "&Acerca de 86Box..." +msgid "&About 86Box…" +msgstr "&Acerca de 86Box…" -msgid "&New image..." -msgstr "&Nueva imagen..." +msgid "&New image…" +msgstr "&Nueva imagen…" -msgid "&Existing image..." -msgstr "Imagen &Existente..." +msgid "&Existing image…" +msgstr "Imagen &Existente…" -msgid "Existing image (&Write-protected)..." -msgstr "Imagen Existente (&Sólo-lectura)..." +msgid "Existing image (&Write-protected)…" +msgstr "Imagen Existente (&Sólo-lectura)…" msgid "&Record" msgstr "&Grabar" @@ -261,11 +261,11 @@ msgstr "&Avance rápido al final" msgid "E&ject" msgstr "E&xtraer" -msgid "&Image..." -msgstr "&Imagen..." +msgid "&Image…" +msgstr "&Imagen…" -msgid "E&xport to 86F..." -msgstr "E&xportar a 86F..." +msgid "E&xport to 86F…" +msgstr "E&xportar a 86F…" msgid "&Mute" msgstr "&Silenciar" @@ -276,8 +276,8 @@ msgstr "E&xtraer disco" msgid "Reload previous image" msgstr "Recargar imagen previa" -msgid "&Folder..." -msgstr "&Carpeta..." +msgid "&Folder…" +msgstr "&Carpeta…" msgid "Preferences" msgstr "Preferencias" @@ -423,17 +423,17 @@ msgstr "Mando:" msgid "Joystick" msgstr "Mando" -msgid "Joystick 1..." -msgstr "Mando 1..." +msgid "Joystick 1…" +msgstr "Mando 1…" -msgid "Joystick 2..." -msgstr "Mando 2..." +msgid "Joystick 2…" +msgstr "Mando 2…" -msgid "Joystick 3..." -msgstr "Mando 3..." +msgid "Joystick 3…" +msgstr "Mando 3…" -msgid "Joystick 4..." -msgstr "Mando 4..." +msgid "Joystick 4…" +msgstr "Mando 4…" msgid "Sound card #1:" msgstr "Tarjeta de sonido 1:" @@ -522,23 +522,23 @@ msgstr "Puerto paralelo 3" msgid "Parallel port 4" msgstr "Puerto paralelo 4" -msgid "FD Controller:" -msgstr "Controladora FD:" +msgid "Floppy disk controller:" +msgstr "Controladora de disquetes:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Controladora CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Tercera controladora IDE" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tercera controladora IDE" -msgid "Quaternary IDE Controller" -msgstr "Cuarta controladora IDE" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Cuarta controladora IDE" -msgid "Hard disk" -msgstr "Disco duro" +msgid "Hard disk controllers" +msgstr "Controladores de disco duro" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Controladores SCSI" msgid "Controller 1:" msgstr "Controladora 1:" @@ -561,11 +561,11 @@ msgstr "Discos duros:" msgid "Firmware Version" msgstr "Versión de firmware" -msgid "&New..." -msgstr "&Nuevo..." +msgid "&New…" +msgstr "&Nuevo…" -msgid "&Existing..." -msgstr "&Existente..." +msgid "&Existing…" +msgstr "&Existente…" msgid "&Remove" msgstr "E&liminar" @@ -873,9 +873,6 @@ msgstr "Mando de juegos de 4 botones" msgid "6-button gamepad" msgstr "Mando de juegos de 6 botones" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Yugo de vuelo de 2 botones" @@ -903,51 +900,6 @@ msgstr "Volante (de 3 ejes, 3 botones)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volante (de 3 ejes, 4 botones)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 con adaptador" @@ -1002,11 +954,17 @@ msgstr "Dispositivo interno" msgid "&File" msgstr "&Archivo" -msgid "&New machine..." -msgstr "&Nueva máquina..." +msgid "&New machine…" +msgstr "&Nueva máquina…" + +msgid "New machine…" +msgstr "Nueva máquina…" -msgid "&Check for updates..." -msgstr "&Verifica actualizaciones..." +msgid "New machine" +msgstr "Nueva máquina" + +msgid "&Check for updates…" +msgstr "&Verifica actualizaciones…" msgid "Exit" msgstr "Salir" @@ -1257,26 +1215,26 @@ msgstr "Establecer nombre mostrado" msgid "Enter the new display name (blank to reset)" msgstr "Escribir el nuevo nombre mostrado (vacío para restablecer)" -msgid "Change &display name..." -msgstr "Cambiar nombre &mostrado..." +msgid "Change &display name…" +msgstr "Cambiar nombre &mostrado…" msgid "Context Menu" msgstr "Menú de contexto" -msgid "&Open folder..." -msgstr "&Abrir carpeta..." +msgid "&Open folder…" +msgstr "&Abrir carpeta…" -msgid "Open p&rinter tray..." -msgstr "Abrir bandeja de la &impresora..." +msgid "Open p&rinter tray…" +msgstr "Abrir bandeja de la &impresora…" -msgid "Set &icon..." -msgstr "Establecer &icono..." +msgid "Set &icon…" +msgstr "Establecer &icono…" msgid "Select an icon" msgstr "Escoger un icono" -msgid "C&lone..." -msgstr "C&lonar..." +msgid "C&lone…" +msgstr "C&lonar…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "La máquina virtual \"%1\" (%2) será clonada para:" @@ -1362,8 +1320,8 @@ msgstr "Sin captura de pantalla" msgid "Search" msgstr "Buscar" -msgid "Searching for VMs..." -msgstr "Buscar para MV..." +msgid "Searching for VMs…" +msgstr "Buscar para MV…" msgid "Found %1" msgstr "%1 encontrada" @@ -1398,11 +1356,11 @@ msgstr "Disco duro (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "Nunca existieron unidades de CD-ROM MFM/RLL o ESDI" -msgid "Custom..." -msgstr "A medida..." +msgid "Custom…" +msgstr "A medida…" -msgid "Custom (large)..." -msgstr "A medida (grande)..." +msgid "Custom (large)…" +msgstr "A medida (grande)…" msgid "Add New Hard Disk" msgstr "Añadir Nuevo Disco Duro" @@ -1521,21 +1479,6 @@ msgstr "Las marcas de tiempo del padre e hijo no coinciden" msgid "Could not fix VHD timestamp." msgstr "No fué posible corregir la marca de tiempo del VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1686,14 +1629,14 @@ msgstr "Herramienta de tableta" msgid "About &Qt" msgstr "Acerca de &Qt" -msgid "&MCA devices..." -msgstr "Dispositivos MCA ..." +msgid "&MCA devices…" +msgstr "Dispositivos MCA …" msgid "Show non-&primary monitors" msgstr "Mostrar monitores no prim&arios" -msgid "Open screenshots &folder..." -msgstr "Abrir la ca&rpeta screenshots..." +msgid "Open screenshots &folder…" +msgstr "Abrir la ca&rpeta screenshots…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "&Usar escalado pantalla completa en modalidad maximizada" @@ -1713,8 +1656,8 @@ msgstr "&Conectrado" msgid "Clear image &history" msgstr "Eliminar &historia de imágenes" -msgid "Create..." -msgstr "Crear..." +msgid "Create…" +msgstr "Crear…" msgid "Host CD/DVD Drive (%1)" msgstr "Unidad de CD/DVD anfitriona (%1)" @@ -1755,8 +1698,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Eliminar" -msgid "Browse..." -msgstr "Buscar..." +msgid "Browse…" +msgstr "Buscar…" msgid "Couldn't create OpenGL context." msgstr "No ha sido posible crear el contexto OpenGL." @@ -1845,8 +1788,8 @@ msgstr "Paso de puerto serie 3" msgid "Serial port passthrough 4" msgstr "Paso de puerto serie 4" -msgid "Renderer &options..." -msgstr "Opc&iones del renderizador..." +msgid "Renderer &options…" +msgstr "Opc&iones del renderizador…" msgid "PC/XT Keyboard" msgstr "Teclado PC/XT" @@ -1983,6 +1926,9 @@ msgstr "IRQ del puerto serie" msgid "Parallel port IRQ" msgstr "IRQ del puerto paralelo" +msgid "Hard disk" +msgstr "Disco duro" + msgid "BIOS Revision" msgstr "Revisión de BIOS" @@ -2058,9 +2004,6 @@ msgstr "Atravesar la entrada MIDI" msgid "MIDI Clockout" msgstr "Salida de reloj MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Ganancia de salida" @@ -2970,8 +2913,8 @@ msgstr "Visitar a la página de descargas" msgid "Update check" msgstr "Verificación de actualizaciones" -msgid "Checking for updates..." -msgstr "Verificando las actualizaciones..." +msgid "Checking for updates…" +msgstr "Verificando las actualizaciones…" msgid "86Box Update" msgstr "Actualización de 86Box" @@ -3009,8 +2952,8 @@ msgstr "Brillo" msgid "Sharpness" msgstr "Nitidez" -msgid "&CGA composite settings..." -msgstr "Configuración del modo compuesto &CGA..." +msgid "&CGA composite settings…" +msgstr "Configuración del modo compuesto &CGA…" msgid "CGA composite settings" msgstr "Configuración del modo compuesto CGA" @@ -3018,8 +2961,8 @@ msgstr "Configuración del modo compuesto CGA" msgid "Monitor EDID" msgstr "EDID du moniteur" -msgid "Export..." -msgstr "Exporter..." +msgid "Export…" +msgstr "Exporter…" msgid "Export EDID" msgstr "EDID exportieren" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 1a9a0cd9f9d..0db30bede46 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Määritä koko..." +msgid "Specify &dimensions…" +msgstr "&Määritä koko…" msgid "Force &4:3 display ratio" msgstr "Pakota &4:3-kuvasuhde" @@ -198,11 +198,11 @@ msgstr "&Media" msgid "&Tools" msgstr "Työ&kalut" -msgid "&Settings..." -msgstr "&Asetukset..." +msgid "&Settings…" +msgstr "&Asetukset…" -msgid "Settings..." -msgstr "Asetukset..." +msgid "Settings…" +msgstr "Asetukset…" msgid "&Update status bar icons" msgstr "&Päivitä tilapalkin kuvakkeita" @@ -213,14 +213,14 @@ msgstr "Ota &kuvakaappaus" msgid "S&ound" msgstr "&Ääni" -msgid "&Preferences..." -msgstr "&Sovellusasetukset..." +msgid "&Preferences…" +msgstr "&Sovellusasetukset…" msgid "Enable &Discord integration" msgstr "&Discord-integraatio" -msgid "Sound &gain..." -msgstr "&Äänitasot..." +msgid "Sound &gain…" +msgstr "&Äänitasot…" msgid "Begin trace" msgstr "Aloita jäljitys" @@ -231,20 +231,20 @@ msgstr "Lopeta jäljitys" msgid "&Help" msgstr "&Ohje" -msgid "&Documentation..." -msgstr "&Ohjekirja..." +msgid "&Documentation…" +msgstr "&Ohjekirja…" -msgid "&About 86Box..." -msgstr "&Tietoja 86Boxista..." +msgid "&About 86Box…" +msgstr "&Tietoja 86Boxista…" -msgid "&New image..." -msgstr "&Uusi levykuva..." +msgid "&New image…" +msgstr "&Uusi levykuva…" -msgid "&Existing image..." -msgstr "&Olemassaoleva levykuva..." +msgid "&Existing image…" +msgstr "&Olemassaoleva levykuva…" -msgid "Existing image (&Write-protected)..." -msgstr "Olemassaoleva levykuva (&kirjoitussuojattu)..." +msgid "Existing image (&Write-protected)…" +msgstr "Olemassaoleva levykuva (&kirjoitussuojattu)…" msgid "&Record" msgstr "&Nauhoita" @@ -261,11 +261,11 @@ msgstr "Kelaa &loppuun" msgid "E&ject" msgstr "&Irrota" -msgid "&Image..." -msgstr "&Levykuva..." +msgid "&Image…" +msgstr "&Levykuva…" -msgid "E&xport to 86F..." -msgstr "&Vie 86F-tiedostoon..." +msgid "E&xport to 86F…" +msgstr "&Vie 86F-tiedostoon…" msgid "&Mute" msgstr "&Mykistä" @@ -276,8 +276,8 @@ msgstr "&Tyhjä" msgid "Reload previous image" msgstr "Lataa edellinen levykuva uudelleen" -msgid "&Folder..." -msgstr "&Kansio..." +msgid "&Folder…" +msgstr "&Kansio…" msgid "Preferences" msgstr "Sovellusasetukset" @@ -289,7 +289,7 @@ msgid "New Image" msgstr "Uusi levykuva" msgid "Settings" -msgstr "Kokoonpano" +msgstr "Asetukset" msgid "Specify Main Window Dimensions" msgstr "Määritä pääikkunan koko" @@ -423,17 +423,17 @@ msgstr "Peliohjain:" msgid "Joystick" msgstr "Peliohjain" -msgid "Joystick 1..." -msgstr "Peliohjain 1..." +msgid "Joystick 1…" +msgstr "Peliohjain 1…" -msgid "Joystick 2..." -msgstr "Peliohjain 2..." +msgid "Joystick 2…" +msgstr "Peliohjain 2…" -msgid "Joystick 3..." -msgstr "Peliohjain 3..." +msgid "Joystick 3…" +msgstr "Peliohjain 3…" -msgid "Joystick 4..." -msgstr "Peliohjain 4..." +msgid "Joystick 4…" +msgstr "Peliohjain 4…" msgid "Sound card #1:" msgstr "Äänikortti 1:" @@ -522,23 +522,23 @@ msgstr "Rinnakkaisportti 3" msgid "Parallel port 4" msgstr "Rinnakkaisportti 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Levykeohjain:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ohjain:" -msgid "Tertiary IDE Controller" -msgstr "Kolmas IDE-ohjain" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Kolmas IDE-ohjain" -msgid "Quaternary IDE Controller" -msgstr "Neljäs IDE-ohjain" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Neljäs IDE-ohjain" -msgid "Hard disk" -msgstr "Kiintolevy" +msgid "Hard disk controllers" +msgstr "Kiintolevyohjaimet" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI-ohjaimet" msgid "Controller 1:" msgstr "Ohjain 1:" @@ -561,11 +561,11 @@ msgstr "Kiintolevyt:" msgid "Firmware Version" msgstr "Laiteohjelmiston versio" -msgid "&New..." -msgstr "&Uusi..." +msgid "&New…" +msgstr "&Uusi…" -msgid "&Existing..." -msgstr "&Olemassaoleva..." +msgid "&Existing…" +msgstr "&Olemassaoleva…" msgid "&Remove" msgstr "&Poista" @@ -873,9 +873,6 @@ msgstr "4-painikkeinen peliohjain" msgid "6-button gamepad" msgstr "6-painikkeinen peliohjain" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2-painikkeinen lento-ohjain" @@ -903,51 +900,6 @@ msgstr "ratti (3-akselinen, 3-painikkeinen)" msgid "Steering wheel (3-axis, 4-button)" msgstr "ratti (3-akselinen, 4-painikkeinen)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 adapterilla" @@ -1002,11 +954,17 @@ msgstr "Sisäinen laite" msgid "&File" msgstr "&Tiedosto" -msgid "&New machine..." -msgstr "&Uusi kone..." +msgid "&New machine…" +msgstr "&Uusi kone…" -msgid "&Check for updates..." -msgstr "T&arkista päivitykset..." +msgid "New machine…" +msgstr "Uusi kone…" + +msgid "New machine" +msgstr "Uusi kone" + +msgid "&Check for updates…" +msgstr "T&arkista päivitykset…" msgid "Exit" msgstr "Poistu" @@ -1257,26 +1215,26 @@ msgstr "Aseta näyttönimi" msgid "Enter the new display name (blank to reset)" msgstr "Anna uusi näyttönimi tai poista se" -msgid "Change &display name..." -msgstr "Vaihda &näyttönimi..." +msgid "Change &display name…" +msgstr "Vaihda &näyttönimi…" msgid "Context Menu" msgstr "Kontekstivalikko" -msgid "&Open folder..." -msgstr "&Avaa kansio..." +msgid "&Open folder…" +msgstr "&Avaa kansio…" -msgid "Open p&rinter tray..." -msgstr "Avaa &tulostimen lokero..." +msgid "Open p&rinter tray…" +msgstr "Avaa &tulostimen lokero…" -msgid "Set &icon..." -msgstr "Aseta &kuvake..." +msgid "Set &icon…" +msgstr "Aseta &kuvake…" msgid "Select an icon" msgstr "Valitse kuvake" -msgid "C&lone..." -msgstr "K&loonaa..." +msgid "C&lone…" +msgstr "K&loonaa…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuaalikone \"%1\" (%2) kloonataan tänne:" @@ -1362,8 +1320,8 @@ msgstr "Ei kuvakaappausta" msgid "Search" msgstr "Hae" -msgid "Searching for VMs..." -msgstr "Haetaan virtuaalikoneita..." +msgid "Searching for VMs…" +msgstr "Haetaan virtuaalikoneita…" msgid "Found %1" msgstr "%1 löydetty" @@ -1398,11 +1356,11 @@ msgstr "Kiintolevy (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL- tai ESDI-CD-ROM-asemia ei ole koskaan ollut olemassa" -msgid "Custom..." -msgstr "Mukautettu..." +msgid "Custom…" +msgstr "Mukautettu…" -msgid "Custom (large)..." -msgstr "Mukautettu (suuri)..." +msgid "Custom (large)…" +msgstr "Mukautettu (suuri)…" msgid "Add New Hard Disk" msgstr "Lisää uusi kiintolevy" @@ -1521,21 +1479,6 @@ msgstr "Ylä- ja alatason levyjen aikaleimat eivät täsmää" msgid "Could not fix VHD timestamp." msgstr "VHD:n aikaleimaa ei pystytty korjaamaan." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1686,14 +1629,14 @@ msgstr "Tablettityökalu" msgid "About &Qt" msgstr "Tietoja &Qt:sta" -msgid "&MCA devices..." -msgstr "MCA-laitteet..." +msgid "&MCA devices…" +msgstr "MCA-laitteet…" msgid "Show non-&primary monitors" msgstr "Näytä muut kuin ensisijaiset näytöt" -msgid "Open screenshots &folder..." -msgstr "Avaa kuvakaappaukset-kansio..." +msgid "Open screenshots &folder…" +msgstr "Avaa kuvakaappaukset-kansio…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Sovella koko näytön venytystilaa maksimoidessa" @@ -1713,8 +1656,8 @@ msgstr "&Yhdistetty" msgid "Clear image &history" msgstr "Tyhjennä levykuva&historia" -msgid "Create..." -msgstr "Luo..." +msgid "Create…" +msgstr "Luo…" msgid "Host CD/DVD Drive (%1)" msgstr "Isännän CD/DVD-asema (%1)" @@ -1755,8 +1698,8 @@ msgstr "Varjostinohjelmat" msgid "Remove" msgstr "Poista" -msgid "Browse..." -msgstr "Selaa..." +msgid "Browse…" +msgstr "Selaa…" msgid "Couldn't create OpenGL context." msgstr "OpenGL-kontekstia ei voitu luoda." @@ -1845,8 +1788,8 @@ msgstr "Sarjaportin läpivienti 3" msgid "Serial port passthrough 4" msgstr "Sarjaportin läpivienti 4" -msgid "Renderer &options..." -msgstr "Renderöijän &asetukset..." +msgid "Renderer &options…" +msgstr "Renderöijän &asetukset…" msgid "PC/XT Keyboard" msgstr "PC/XT-näppäimistö" @@ -1983,6 +1926,9 @@ msgstr "Sarjaportin IRQ" msgid "Parallel port IRQ" msgstr "Rinnakkaisportin IRQ" +msgid "Hard disk" +msgstr "Kiintolevy" + msgid "BIOS Revision" msgstr "BIOS-versio" @@ -2058,9 +2004,6 @@ msgstr "MIDI-läpivienti" msgid "MIDI Clockout" msgstr "MIDI-kellon ulostulo" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Lähtötaso" @@ -2970,8 +2913,8 @@ msgstr "Siirry lataussivulle" msgid "Update check" msgstr "Päivitystarkistus" -msgid "Checking for updates..." -msgstr "Tarkistetaan päivityksiä..." +msgid "Checking for updates…" +msgstr "Tarkistetaan päivityksiä…" msgid "86Box Update" msgstr "86Box-päivitys" @@ -3009,8 +2952,8 @@ msgstr "Kirkkaus" msgid "Sharpness" msgstr "Terävyys" -msgid "&CGA composite settings..." -msgstr "&CGA:n komposiittiasetukset..." +msgid "&CGA composite settings…" +msgstr "&CGA:n komposiittiasetukset…" msgid "CGA composite settings" msgstr "CGA:n komposiittiasetukset" @@ -3018,8 +2961,8 @@ msgstr "CGA:n komposiittiasetukset" msgid "Monitor EDID" msgstr "Näytön EDID" -msgid "Export..." -msgstr "Vie..." +msgid "Export…" +msgstr "Vie…" msgid "Export EDID" msgstr "Vie EDID" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 6c9175ec9c7..cba81ff673f 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Spécifier dimen&sions..." +msgid "Specify &dimensions…" +msgstr "Spécifier dimen&sions…" msgid "Force &4:3 display ratio" msgstr "Forcer le ratio &4:3" @@ -198,11 +198,11 @@ msgstr "&Média" msgid "&Tools" msgstr "Ou&tils" -msgid "&Settings..." -msgstr "&Réglages..." +msgid "&Settings…" +msgstr "&Réglages…" -msgid "Settings..." -msgstr "Réglages..." +msgid "Settings…" +msgstr "Réglages…" msgid "&Update status bar icons" msgstr "Mettre à jour la barre de stat&us" @@ -213,14 +213,14 @@ msgstr "Copie d'é&cran" msgid "S&ound" msgstr "S&on" -msgid "&Preferences..." -msgstr "&Préférences..." +msgid "&Preferences…" +msgstr "&Préférences…" msgid "Enable &Discord integration" msgstr "Activer l'intégration &Discord" -msgid "Sound &gain..." -msgstr "&Gain Son..." +msgid "Sound &gain…" +msgstr "&Gain Son…" msgid "Begin trace" msgstr "Démarrer traces" @@ -231,20 +231,20 @@ msgstr "Arrêter traces" msgid "&Help" msgstr "Ai&de" -msgid "&Documentation..." -msgstr "&Documentation..." +msgid "&Documentation…" +msgstr "&Documentation…" -msgid "&About 86Box..." -msgstr "&A Propos de 86Box..." +msgid "&About 86Box…" +msgstr "&A Propos de 86Box…" -msgid "&New image..." -msgstr "&Nouvelle image..." +msgid "&New image…" +msgstr "&Nouvelle image…" -msgid "&Existing image..." -msgstr "Image &Existante..." +msgid "&Existing image…" +msgstr "Image &Existante…" -msgid "Existing image (&Write-protected)..." -msgstr "Image Existante (&Lecture seule)..." +msgid "Existing image (&Write-protected)…" +msgstr "Image Existante (&Lecture seule)…" msgid "&Record" msgstr "En®istrer" @@ -261,11 +261,11 @@ msgstr "Avance rapide jusqu'à la &Fin" msgid "E&ject" msgstr "É&jecter" -msgid "&Image..." -msgstr "&Image..." +msgid "&Image…" +msgstr "&Image…" -msgid "E&xport to 86F..." -msgstr "E&xport vers 86F..." +msgid "E&xport to 86F…" +msgstr "E&xport vers 86F…" msgid "&Mute" msgstr "&Couper" @@ -276,8 +276,8 @@ msgstr "V&ide" msgid "Reload previous image" msgstr "Recharger image précedente" -msgid "&Folder..." -msgstr "&Dossier..." +msgid "&Folder…" +msgstr "&Dossier…" msgid "Preferences" msgstr "Préférences" @@ -423,17 +423,17 @@ msgstr "Manette :" msgid "Joystick" msgstr "Manette" -msgid "Joystick 1..." -msgstr "Manette 1..." +msgid "Joystick 1…" +msgstr "Manette 1…" -msgid "Joystick 2..." -msgstr "Manette 2..." +msgid "Joystick 2…" +msgstr "Manette 2…" -msgid "Joystick 3..." -msgstr "Manette 3..." +msgid "Joystick 3…" +msgstr "Manette 3…" -msgid "Joystick 4..." -msgstr "Manette 4..." +msgid "Joystick 4…" +msgstr "Manette 4…" msgid "Sound card #1:" msgstr "Carte son 1 :" @@ -522,23 +522,23 @@ msgstr "Port parallèle 3" msgid "Parallel port 4" msgstr "Port parallèle 4" -msgid "FD Controller:" -msgstr "Contrôleur FD :" +msgid "Floppy disk controller:" +msgstr "Contrôleur de disquette :" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Contrôleur CD-ROM :" -msgid "Tertiary IDE Controller" -msgstr "Troisième contrôleur IDE" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Troisième contrôleur IDE" -msgid "Quaternary IDE Controller" -msgstr "Quatrième contrôleur IDE" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Quatrième contrôleur IDE" -msgid "Hard disk" -msgstr "Disque dur" +msgid "Hard disk controllers" +msgstr "Contrôleurs de disque dur" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Contrôleurs SCSI" msgid "Controller 1:" msgstr "Contrôleur 1 :" @@ -561,11 +561,11 @@ msgstr "Disques durs :" msgid "Firmware Version" msgstr "Version du micrologiciel" -msgid "&New..." -msgstr "&Nouveau..." +msgid "&New…" +msgstr "&Nouveau…" -msgid "&Existing..." -msgstr "&Existant..." +msgid "&Existing…" +msgstr "&Existant…" msgid "&Remove" msgstr "&Supprimer" @@ -873,9 +873,6 @@ msgstr "Manette de jeu à 4 boutons" msgid "6-button gamepad" msgstr "Manette de jeu à 6 boutons" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Manette de vol à 2 boutons" @@ -903,51 +900,6 @@ msgstr "Volant (3 axes, 3 boutons)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volant (3 axes, 4 boutons)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Système de contrôle de vol Thrustmaster" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "SCV Thrustmaster + Système de commande de gouvernail" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 avec adaptateur" @@ -1002,11 +954,17 @@ msgstr "Dispositif interne" msgid "&File" msgstr "&Fichier" -msgid "&New machine..." -msgstr "&Nouvelle machine..." +msgid "&New machine…" +msgstr "&Nouvelle machine…" + +msgid "New machine…" +msgstr "Nouvelle machine…" -msgid "&Check for updates..." -msgstr "&Vérifier les mises à jour..." +msgid "New machine" +msgstr "Nouvelle machine" + +msgid "&Check for updates…" +msgstr "&Vérifier les mises à jour…" msgid "Exit" msgstr "Sortir" @@ -1257,26 +1215,26 @@ msgstr "Définir le nom d'affichage" msgid "Enter the new display name (blank to reset)" msgstr "Entrez le nouveau nom d'affichage (laissez vide pour réinitialiser)" -msgid "Change &display name..." -msgstr "Modifier le nom &d'affichage..." +msgid "Change &display name…" +msgstr "Modifier le nom &d'affichage…" msgid "Context Menu" msgstr "Menu contextuel" -msgid "&Open folder..." -msgstr "&Ouvrir le dossier..." +msgid "&Open folder…" +msgstr "&Ouvrir le dossier…" -msgid "Open p&rinter tray..." -msgstr "Ouvrez le bac de l'&imprimante..." +msgid "Open p&rinter tray…" +msgstr "Ouvrez le bac de l'&imprimante…" -msgid "Set &icon..." -msgstr "Définir l'&icône..." +msgid "Set &icon…" +msgstr "Définir l'&icône…" msgid "Select an icon" msgstr "Sélectionnez une icône" -msgid "C&lone..." -msgstr "C&loner..." +msgid "C&lone…" +msgstr "C&loner…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "La machine virtuelle « %1 » (%2) sera clonée dans :" @@ -1362,8 +1320,8 @@ msgstr "Pas de capture d'écran" msgid "Search" msgstr "Rechercher" -msgid "Searching for VMs..." -msgstr "Recherche de machines virtuelles..." +msgid "Searching for VMs…" +msgstr "Recherche de machines virtuelles…" msgid "Found %1" msgstr "Trouvé %1" @@ -1398,11 +1356,11 @@ msgstr "Disque dur (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "Les lecteurs de CD-ROM MFM/RLL ou ESDI n'ont jamais existé" -msgid "Custom..." -msgstr "Personnalisé..." +msgid "Custom…" +msgstr "Personnalisé…" -msgid "Custom (large)..." -msgstr "Personnalisé (grand)..." +msgid "Custom (large)…" +msgstr "Personnalisé (grand)…" msgid "Add New Hard Disk" msgstr "Ajouter un nouveau disque dur" @@ -1521,21 +1479,6 @@ msgstr "Les horodatages des disques parents et enfants ne correspondent pas" msgid "Could not fix VHD timestamp." msgstr "Impossible de réparer l'horodatage du VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2) : %3" @@ -1686,14 +1629,14 @@ msgstr "Outil Tablette" msgid "About &Qt" msgstr "A propos de &Qt" -msgid "&MCA devices..." -msgstr "Dispositifs MCA..." +msgid "&MCA devices…" +msgstr "Dispositifs MCA…" msgid "Show non-&primary monitors" msgstr "Afficher les moniteurs non pr&imaires" -msgid "Open screenshots &folder..." -msgstr "Ouvrir le do&ssier des captures d'écran..." +msgid "Open screenshots &folder…" +msgstr "Ouvrir le do&ssier des captures d'écran…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Appli&quer le mode élargi plein écran lorsque la fenêtre est maximisée" @@ -1713,8 +1656,8 @@ msgstr "&Connecté" msgid "Clear image &history" msgstr "Effacer l'&historique de l'image" -msgid "Create..." -msgstr "Créer..." +msgid "Create…" +msgstr "Créer…" msgid "Host CD/DVD Drive (%1)" msgstr "Lecteur CD/DVD hôte (%1)" @@ -1755,8 +1698,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Retirer" -msgid "Browse..." -msgstr "Parcourir..." +msgid "Browse…" +msgstr "Parcourir…" msgid "Couldn't create OpenGL context." msgstr "Impossible de créer un contexte OpenGL." @@ -1845,8 +1788,8 @@ msgstr "Transfert du port série 3" msgid "Serial port passthrough 4" msgstr "Transfert du port série 4" -msgid "Renderer &options..." -msgstr "&Options du rendu..." +msgid "Renderer &options…" +msgstr "&Options du rendu…" msgid "PC/XT Keyboard" msgstr "Clavier PC/XT" @@ -1983,6 +1926,9 @@ msgstr "IRQ du port série" msgid "Parallel port IRQ" msgstr "IRQ du port parallèle" +msgid "Hard disk" +msgstr "Disque dur" + msgid "BIOS Revision" msgstr "Révision du BIOS" @@ -2058,9 +2004,6 @@ msgstr "Transfert MIDI" msgid "MIDI Clockout" msgstr "Horloge MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Gain sortie" @@ -2970,8 +2913,8 @@ msgstr "Visiter la page de téléchargement" msgid "Update check" msgstr "Vérification des mises à jour" -msgid "Checking for updates..." -msgstr "Recherche de mises à jour..." +msgid "Checking for updates…" +msgstr "Recherche de mises à jour…" msgid "86Box Update" msgstr "Mise à jour de 86Box" @@ -3009,8 +2952,8 @@ msgstr "Luminosité" msgid "Sharpness" msgstr "Netteté" -msgid "&CGA composite settings..." -msgstr "Réglages du mode composite &CGA..." +msgid "&CGA composite settings…" +msgstr "Réglages du mode composite &CGA…" msgid "CGA composite settings" msgstr "Réglages du mode composite CGA" @@ -3018,8 +2961,8 @@ msgstr "Réglages du mode composite CGA" msgid "Monitor EDID" msgstr "Écran EDID" -msgid "Export..." -msgstr "Exporter..." +msgid "Export…" +msgstr "Exporter…" msgid "Export EDID" msgstr "Exporter l'EDID" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 3f14ed6e802..90af3df85e9 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -74,8 +74,8 @@ msgstr "Open&GL (3.0 jezgra)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Odrediti veličinu..." +msgid "Specify &dimensions…" +msgstr "Odrediti veličinu…" msgid "Force &4:3 display ratio" msgstr "&4:3 omjer prikaza" @@ -200,11 +200,11 @@ msgstr "&Mediji" msgid "&Tools" msgstr "&Alati" -msgid "&Settings..." -msgstr "&Opcije..." +msgid "&Settings…" +msgstr "&Opcije…" -msgid "Settings..." -msgstr "Opcije..." +msgid "Settings…" +msgstr "Opcije…" msgid "&Update status bar icons" msgstr "&Ažuriraj ikone statusnog redka" @@ -215,14 +215,14 @@ msgstr "Napravi &snimku zaslona" msgid "S&ound" msgstr "&Zvuk" -msgid "&Preferences..." -msgstr "&Postavke..." +msgid "&Preferences…" +msgstr "&Postavke…" msgid "Enable &Discord integration" msgstr "Omogući integraciju sa programom &Discord" -msgid "Sound &gain..." -msgstr "&Pojačavanje zvuka..." +msgid "Sound &gain…" +msgstr "&Pojačavanje zvuka…" msgid "Begin trace" msgstr "Z&apočni praćenje" @@ -233,20 +233,20 @@ msgstr "&Svrši praćenje" msgid "&Help" msgstr "P&omoć" -msgid "&Documentation..." -msgstr "&Dokumentacija..." +msgid "&Documentation…" +msgstr "&Dokumentacija…" -msgid "&About 86Box..." -msgstr "&O programu 86Box..." +msgid "&About 86Box…" +msgstr "&O programu 86Box…" -msgid "&New image..." -msgstr "&Nova slika..." +msgid "&New image…" +msgstr "&Nova slika…" -msgid "&Existing image..." -msgstr "&Postojeća slika..." +msgid "&Existing image…" +msgstr "&Postojeća slika…" -msgid "Existing image (&Write-protected)..." -msgstr "Postojeća slika (&zaštićena od pisanja)..." +msgid "Existing image (&Write-protected)…" +msgstr "Postojeća slika (&zaštićena od pisanja)…" msgid "&Record" msgstr "&Snimi" @@ -263,11 +263,11 @@ msgstr "&Preskoči do kraja" msgid "E&ject" msgstr "&Izbaci" -msgid "&Image..." -msgstr "&Slika..." +msgid "&Image…" +msgstr "&Slika…" -msgid "E&xport to 86F..." -msgstr "&Izvozi u 86F..." +msgid "E&xport to 86F…" +msgstr "&Izvozi u 86F…" msgid "&Mute" msgstr "&Isključi zvuk" @@ -278,8 +278,8 @@ msgstr "&Prazno" msgid "Reload previous image" msgstr "Ponovo učitaj prethodnu sliku" -msgid "&Folder..." -msgstr "&Mapa..." +msgid "&Folder…" +msgstr "&Mapa…" msgid "Preferences" msgstr "Postavke" @@ -425,17 +425,17 @@ msgstr "Palica za igru:" msgid "Joystick" msgstr "Palica za igru" -msgid "Joystick 1..." -msgstr "Palica za igru 1..." +msgid "Joystick 1…" +msgstr "Palica za igru 1…" -msgid "Joystick 2..." -msgstr "Palica za igru 2..." +msgid "Joystick 2…" +msgstr "Palica za igru 2…" -msgid "Joystick 3..." -msgstr "Palica za igru 3..." +msgid "Joystick 3…" +msgstr "Palica za igru 3…" -msgid "Joystick 4..." -msgstr "Palica za igru 4..." +msgid "Joystick 4…" +msgstr "Palica za igru 4…" msgid "Sound card #1:" msgstr "Zvučna kartica 1:" @@ -524,23 +524,23 @@ msgstr "Paralelna vrata 3" msgid "Parallel port 4" msgstr "Paralelna vrata 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Kontroler diskete:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Kontroler CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Tercijarni IDE kontroler" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tercijarni IDE kontroler" -msgid "Quaternary IDE Controller" -msgstr "Kvaternarni IDE kontroler" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Kvaternarni IDE kontroler" -msgid "Hard disk" -msgstr "Tvrdi disk" +msgid "Hard disk controllers" +msgstr "Kontroleri tvrdih diskova" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Kontroleri SCSI" msgid "Controller 1:" msgstr "Kontroler 1:" @@ -563,11 +563,11 @@ msgstr "Tvrdi diskovi:" msgid "Firmware Version" msgstr "Verzija firmvera" -msgid "&New..." -msgstr "&Novi..." +msgid "&New…" +msgstr "&Novi…" -msgid "&Existing..." -msgstr "&Postojeći..." +msgid "&Existing…" +msgstr "&Postojeći…" msgid "&Remove" msgstr "&Ukloni" @@ -875,9 +875,6 @@ msgstr "Gamepad s 4 tipke" msgid "6-button gamepad" msgstr "Gamepad s 6 tipke" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Jaram za letenje s 2 tipke" @@ -905,51 +902,6 @@ msgstr "Volan (3 osi, 3 tipke)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volan (3 osi, 4 tipke)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 s adapterom" @@ -1004,11 +956,17 @@ msgstr "Uunutarnji uređaj" msgid "&File" msgstr "&Datoteka" -msgid "&New machine..." -msgstr "&Novi sistem..." +msgid "&New machine…" +msgstr "&Novi sistem…" + +msgid "New machine…" +msgstr "Novi sistem…" -msgid "&Check for updates..." -msgstr "&Provjeri ažuriranja..." +msgid "New machine" +msgstr "Novi sistem" + +msgid "&Check for updates…" +msgstr "&Provjeri ažuriranja…" msgid "Exit" msgstr "Izlazi" @@ -1259,26 +1217,26 @@ msgstr "Postavi prikazno ime" msgid "Enter the new display name (blank to reset)" msgstr "Unesite novo prikazno ime (prazno za ponovo postaviti)" -msgid "Change &display name..." -msgstr "Promijeni &prikazno ime..." +msgid "Change &display name…" +msgstr "Promijeni &prikazno ime…" msgid "Context Menu" msgstr "Kontekstni izbornik" -msgid "&Open folder..." -msgstr "&Otvori mapu..." +msgid "&Open folder…" +msgstr "&Otvori mapu…" -msgid "Open p&rinter tray..." -msgstr "Otvori ladicu &pisača..." +msgid "Open p&rinter tray…" +msgstr "Otvori ladicu &pisača…" -msgid "Set &icon..." -msgstr "Postavi &ikonu..." +msgid "Set &icon…" +msgstr "Postavi &ikonu…" msgid "Select an icon" msgstr "Odaberite ikonu" -msgid "C&lone..." -msgstr "K&loniraj..." +msgid "C&lone…" +msgstr "K&loniraj…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtualni sistem \"%1\" (%2) bit će kloniran u:" @@ -1364,8 +1322,8 @@ msgstr "Nema snimke zaslona" msgid "Search" msgstr "Pretraživanje" -msgid "Searching for VMs..." -msgstr "Traženje virtualnih sistema..." +msgid "Searching for VMs…" +msgstr "Traženje virtualnih sistema…" msgid "Found %1" msgstr "Pronađeno %1" @@ -1400,11 +1358,11 @@ msgstr "Tvrdi disk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL ili ESDI CD-ROM pogoni nisu nikada postojali" -msgid "Custom..." -msgstr "Prilagođeno..." +msgid "Custom…" +msgstr "Prilagođeno…" -msgid "Custom (large)..." -msgstr "Prilagođeno (veliko)..." +msgid "Custom (large)…" +msgstr "Prilagođeno (veliko)…" msgid "Add New Hard Disk" msgstr "Dodajte novi tvrdi disk" @@ -1523,21 +1481,6 @@ msgstr "Vremenske ozanke matične i poređenog diska ne odgovaraju" msgid "Could not fix VHD timestamp." msgstr "Ne mogu popraviti vremensku oznaku slike VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1688,14 +1631,14 @@ msgstr "Alat za tablet" msgid "About &Qt" msgstr "O programu &Qt" -msgid "&MCA devices..." -msgstr "Uređaji MCA ..." +msgid "&MCA devices…" +msgstr "Uređaji MCA …" msgid "Show non-&primary monitors" msgstr "Prikaži neprimarne monitore" -msgid "Open screenshots &folder..." -msgstr "Otvori mapu snimaka zaslona..." +msgid "Open screenshots &folder…" +msgstr "Otvori mapu snimaka zaslona…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Primijeni način cijelozaslonskog rastezanja u maksimiziranom načinu" @@ -1715,8 +1658,8 @@ msgstr "&Povezan" msgid "Clear image &history" msgstr "Očisti &povijest slika" -msgid "Create..." -msgstr "Stvori..." +msgid "Create…" +msgstr "Stvori…" msgid "Host CD/DVD Drive (%1)" msgstr "CD/DVD pogon nositelja (%1)" @@ -1757,8 +1700,8 @@ msgstr "Shaderi" msgid "Remove" msgstr "Ukloni" -msgid "Browse..." -msgstr "Pretraži..." +msgid "Browse…" +msgstr "Pretraži…" msgid "Couldn't create OpenGL context." msgstr "Nije moguće stvoriti kontekst OpenGL." @@ -1847,8 +1790,8 @@ msgstr "Prolaz serijskih vrata 3" msgid "Serial port passthrough 4" msgstr "Prolaz serijskih vrata 4" -msgid "Renderer &options..." -msgstr "Opcije rendera..." +msgid "Renderer &options…" +msgstr "Opcije rendera…" msgid "PC/XT Keyboard" msgstr "Tipkovnica PC/XT" @@ -1985,6 +1928,9 @@ msgstr "IRQ serijskih vrata" msgid "Parallel port IRQ" msgstr "IRQ paralelnih vrata" +msgid "Hard disk" +msgstr "Tvrdi disk" + msgid "BIOS Revision" msgstr "Revizija BIOS-a" @@ -2060,9 +2006,6 @@ msgstr "Prolaz ulaza MIDI" msgid "MIDI Clockout" msgstr "Taktovit MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Pojačavanje izlaza" @@ -2972,8 +2915,8 @@ msgstr "Posjetiti stranicu za preuzimanje" msgid "Update check" msgstr "Provjera ažuriranja" -msgid "Checking for updates..." -msgstr "Provjera ažuriranja..." +msgid "Checking for updates…" +msgstr "Provjera ažuriranja…" msgid "86Box Update" msgstr "Ažuriranje programa 86Box" @@ -3011,8 +2954,8 @@ msgstr "Svjetlina" msgid "Sharpness" msgstr "Oštrina" -msgid "&CGA composite settings..." -msgstr "Opcije kompozitnog načina &CGA..." +msgid "&CGA composite settings…" +msgstr "Opcije kompozitnog načina &CGA…" msgid "CGA composite settings" msgstr "Opcije kompozitnog načina CGA" @@ -3020,8 +2963,8 @@ msgstr "Opcije kompozitnog načina CGA" msgid "Monitor EDID" msgstr "EDID monitora" -msgid "Export..." -msgstr "Izvoz..." +msgid "Export…" +msgstr "Izvoz…" msgid "Export EDID" msgstr "Izvoz EDID-a" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 2e9e34d6128..67937b08991 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Specifica dim&ensioni..." +msgid "Specify &dimensions…" +msgstr "Specifica dim&ensioni…" msgid "Force &4:3 display ratio" msgstr "Forza rapporto d'aspetto &4:3" @@ -198,11 +198,11 @@ msgstr "&Dispositivi" msgid "&Tools" msgstr "&Strumenti" -msgid "&Settings..." -msgstr "&Impostazioni..." +msgid "&Settings…" +msgstr "&Impostazioni…" -msgid "Settings..." -msgstr "Impostazioni..." +msgid "Settings…" +msgstr "Impostazioni…" msgid "&Update status bar icons" msgstr "&Aggiorna icone della barra di stato" @@ -213,14 +213,14 @@ msgstr "&Cattura schermata" msgid "S&ound" msgstr "A&udio" -msgid "&Preferences..." -msgstr "&Preferenze..." +msgid "&Preferences…" +msgstr "&Preferenze…" msgid "Enable &Discord integration" msgstr "Abilita integrazione &Discord" -msgid "Sound &gain..." -msgstr "Guadagno &suono..." +msgid "Sound &gain…" +msgstr "Guadagno &suono…" msgid "Begin trace" msgstr "Inizio traccia" @@ -231,20 +231,20 @@ msgstr "Fine traccia" msgid "&Help" msgstr "Ai&uto" -msgid "&Documentation..." -msgstr "&Documentazione..." +msgid "&Documentation…" +msgstr "&Documentazione…" -msgid "&About 86Box..." -msgstr "&Informazioni su 86Box..." +msgid "&About 86Box…" +msgstr "&Informazioni su 86Box…" -msgid "&New image..." -msgstr "&Nuova immagine..." +msgid "&New image…" +msgstr "&Nuova immagine…" -msgid "&Existing image..." -msgstr "&Immagine esistente..." +msgid "&Existing image…" +msgstr "&Immagine esistente…" -msgid "Existing image (&Write-protected)..." -msgstr "Immagine esistente (&protezione contro scrittura)..." +msgid "Existing image (&Write-protected)…" +msgstr "Immagine esistente (&protezione contro scrittura)…" msgid "&Record" msgstr "&Registra" @@ -261,11 +261,11 @@ msgstr "A&vanti veloce fino alla fine" msgid "E&ject" msgstr "&Espelli" -msgid "&Image..." -msgstr "&Immagine..." +msgid "&Image…" +msgstr "&Immagine…" -msgid "E&xport to 86F..." -msgstr "E&sporta in 86F..." +msgid "E&xport to 86F…" +msgstr "E&sporta in 86F…" msgid "&Mute" msgstr "&Muto" @@ -276,8 +276,8 @@ msgstr "&Espelli" msgid "Reload previous image" msgstr "Ricarica l'immagine precedente" -msgid "&Folder..." -msgstr "&Cartella..." +msgid "&Folder…" +msgstr "&Cartella…" msgid "Preferences" msgstr "Preferenze" @@ -423,17 +423,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Scheda audio #1:" @@ -522,23 +522,23 @@ msgstr "Porta parallela 3" msgid "Parallel port 4" msgstr "Porta parallela 4" -msgid "FD Controller:" -msgstr "Controller FD:" +msgid "Floppy disk controller:" +msgstr "Controller del floppy disk:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Controller CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Controller IDE terziario" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Controller IDE terziario" -msgid "Quaternary IDE Controller" -msgstr "Controller IDE quaternario" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Controller IDE quaternario" -msgid "Hard disk" -msgstr "Disco rigido" +msgid "Hard disk controllers" +msgstr "Controller del disco rigido" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Controller SCSI" msgid "Controller 1:" msgstr "Controller 1:" @@ -561,11 +561,11 @@ msgstr "Dischi rigidi:" msgid "Firmware Version" msgstr "Versione firmware" -msgid "&New..." -msgstr "&Nuovo..." +msgid "&New…" +msgstr "&Nuovo…" -msgid "&Existing..." -msgstr "&Esistente..." +msgid "&Existing…" +msgstr "&Esistente…" msgid "&Remove" msgstr "&Rimuovi" @@ -873,9 +873,6 @@ msgstr "Gamepad a 4 pulsanti" msgid "6-button gamepad" msgstr "Gamepad a 6 pulsanti" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Barra di comando a 2 pulsanti" @@ -903,51 +900,6 @@ msgstr "Volante (3 assi, 3 pulsanti)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volante (3 assi, 4 pulsanti)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + Pedali CH" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedali Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedali" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedali Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedali" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedali Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder" - -msgid "Thrustmaster Flight Control System" -msgstr "Sistema di controllo Thrustmaster Flight" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Sistema di controllo timone" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 con adattatore" @@ -1002,11 +954,17 @@ msgstr "Dispositivo integrato" msgid "&File" msgstr "&File" -msgid "&New machine..." -msgstr "&Nuova macchina..." +msgid "&New machine…" +msgstr "&Nuova macchina…" + +msgid "New machine…" +msgstr "Nuova macchina…" -msgid "&Check for updates..." -msgstr "&Controlla gli aggiornamenti..." +msgid "New machine" +msgstr "Nuova macchina" + +msgid "&Check for updates…" +msgstr "&Controlla gli aggiornamenti…" msgid "Exit" msgstr "Esci" @@ -1257,26 +1215,26 @@ msgstr "Imposta il nome da visualizzare" msgid "Enter the new display name (blank to reset)" msgstr "Inserisci il nuovo nome da visualizzare (vuoto per reimpostarlo)" -msgid "Change &display name..." -msgstr "Modifica &nome visualizzato..." +msgid "Change &display name…" +msgstr "Modifica &nome visualizzato…" msgid "Context Menu" msgstr "Menu contestuale" -msgid "&Open folder..." -msgstr "&Apri cartella..." +msgid "&Open folder…" +msgstr "&Apri cartella…" -msgid "Open p&rinter tray..." -msgstr "Apri vassoio &stampante..." +msgid "Open p&rinter tray…" +msgstr "Apri vassoio &stampante…" -msgid "Set &icon..." -msgstr "Imposta &icona..." +msgid "Set &icon…" +msgstr "Imposta &icona…" msgid "Select an icon" msgstr "Seleziona un'icona" -msgid "C&lone..." -msgstr "C&lona..." +msgid "C&lone…" +msgstr "C&lona…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "La macchina virtuale \"%1\" (%2) sarà clonata in:" @@ -1362,8 +1320,8 @@ msgstr "Nessuna istantanea dello schermo" msgid "Search" msgstr "Cerca" -msgid "Searching for VMs..." -msgstr "Ricerca delle macchine virtuali..." +msgid "Searching for VMs…" +msgstr "Ricerca delle macchine virtuali…" msgid "Found %1" msgstr "Trovato %1" @@ -1398,11 +1356,11 @@ msgstr "Disco rigido (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "Le unità CD-ROM MFM/RLL o ESDI non sono mai esistite" -msgid "Custom..." -msgstr "Personalizzata..." +msgid "Custom…" +msgstr "Personalizzata…" -msgid "Custom (large)..." -msgstr "Personalizzata (grande)..." +msgid "Custom (large)…" +msgstr "Personalizzata (grande)…" msgid "Add New Hard Disk" msgstr "Aggiungi un nuovo disco rigido" @@ -1521,21 +1479,6 @@ msgstr "Le marche temporali del disco padre e figlio non corrispondono" msgid "Could not fix VHD timestamp." msgstr "Impossibile correggere la marca temporale VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1686,14 +1629,14 @@ msgstr "Strumento tablet" msgid "About &Qt" msgstr "Informazioni su &Qt" -msgid "&MCA devices..." -msgstr "Dispositivi MCA..." +msgid "&MCA devices…" +msgstr "Dispositivi MCA…" msgid "Show non-&primary monitors" msgstr "Mostra i monitor non &primari" -msgid "Open screenshots &folder..." -msgstr "Apri la ca&rtella screenshots..." +msgid "Open screenshots &folder…" +msgstr "Apri la ca&rtella screenshots…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Applica adattamento sc&hermo intero in modalità massimizzata" @@ -1713,8 +1656,8 @@ msgstr "&Connesso" msgid "Clear image &history" msgstr "Cancella la cr&onologia delle immagini" -msgid "Create..." -msgstr "Crea..." +msgid "Create…" +msgstr "Crea…" msgid "Host CD/DVD Drive (%1)" msgstr "Unità CD/DVD host (%1)" @@ -1755,8 +1698,8 @@ msgstr "Shader" msgid "Remove" msgstr "Rimuovi" -msgid "Browse..." -msgstr "Sfoglia..." +msgid "Browse…" +msgstr "Sfoglia…" msgid "Couldn't create OpenGL context." msgstr "Impossibile creare il contesto OpenGL." @@ -1845,8 +1788,8 @@ msgstr "Porta seriale passante 3" msgid "Serial port passthrough 4" msgstr "Porta seriale passante 4" -msgid "Renderer &options..." -msgstr "&Opzioni renderizzatore..." +msgid "Renderer &options…" +msgstr "&Opzioni renderizzatore…" msgid "PC/XT Keyboard" msgstr "Tastiera PC/XT" @@ -1983,6 +1926,9 @@ msgstr "IRQ porta seriale" msgid "Parallel port IRQ" msgstr "IRQ porta parallela" +msgid "Hard disk" +msgstr "Disco rigido" + msgid "BIOS Revision" msgstr "Revisione BIOS" @@ -2058,9 +2004,6 @@ msgstr "Ingresso passante MIDI" msgid "MIDI Clockout" msgstr "Sincronizzazione MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Guadagno uscita" @@ -2970,8 +2913,8 @@ msgstr "Visita la pagina" msgid "Update check" msgstr "Verifica disponibilità degli aggiornamenti" -msgid "Checking for updates..." -msgstr "Ricerca degli aggiornamenti..." +msgid "Checking for updates…" +msgstr "Ricerca degli aggiornamenti…" msgid "86Box Update" msgstr "Aggiornamento di 86Box" @@ -3009,8 +2952,8 @@ msgstr "Luminosità" msgid "Sharpness" msgstr "Nitidezza" -msgid "&CGA composite settings..." -msgstr "Impostazioni video composito &CGA..." +msgid "&CGA composite settings…" +msgstr "Impostazioni video composito &CGA…" msgid "CGA composite settings" msgstr "Impostazioni video composito CGA" @@ -3018,8 +2961,8 @@ msgstr "Impostazioni video composito CGA" msgid "Monitor EDID" msgstr "EDID del monitor" -msgid "Export..." -msgstr "Esporta..." +msgid "Export…" +msgstr "Esporta…" msgid "Export EDID" msgstr "Esporta EDID" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index ef3edd21dbb..967316e991c 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -73,8 +73,8 @@ msgstr "OpenGL (3.0 Core)(&G)" msgid "&VNC" msgstr "VNC(&V)" -msgid "Specify &dimensions..." -msgstr "ディメンションを指定(&D)..." +msgid "Specify &dimensions…" +msgstr "ディメンションを指定(&D)…" msgid "Force &4:3 display ratio" msgstr "4:3の縦横比を強制表示(&4)" @@ -199,11 +199,11 @@ msgstr "メディア(&M)" msgid "&Tools" msgstr "ツール(&T)" -msgid "&Settings..." -msgstr "設定(&S)..." +msgid "&Settings…" +msgstr "設定(&S)…" -msgid "Settings..." -msgstr "設定..." +msgid "Settings…" +msgstr "設定…" msgid "&Update status bar icons" msgstr "ステータスバーのアイコンを更新(&U)" @@ -214,14 +214,14 @@ msgstr "スクリーンショットを撮る(&C)" msgid "S&ound" msgstr "サウンド(&O)" -msgid "&Preferences..." -msgstr "環境設定(&P)..." +msgid "&Preferences…" +msgstr "環境設定(&P)…" msgid "Enable &Discord integration" msgstr "Discord連携機能(&D)" -msgid "Sound &gain..." -msgstr "音量調整(&G)..." +msgid "Sound &gain…" +msgstr "音量調整(&G)…" msgid "Begin trace" msgstr "トレース開始" @@ -232,20 +232,20 @@ msgstr "トレース終了" msgid "&Help" msgstr "ヘルプ(&H)" -msgid "&Documentation..." -msgstr "文書(&D)..." +msgid "&Documentation…" +msgstr "文書(&D)…" -msgid "&About 86Box..." -msgstr "86Boxのバージョン情報(&A)..." +msgid "&About 86Box…" +msgstr "86Boxのバージョン情報(&A)…" -msgid "&New image..." -msgstr "新規イメージ(&N)..." +msgid "&New image…" +msgstr "新規イメージ(&N)…" -msgid "&Existing image..." -msgstr "既存のイメージを開く(&E)..." +msgid "&Existing image…" +msgstr "既存のイメージを開く(&E)…" -msgid "Existing image (&Write-protected)..." -msgstr "既存のイメージを開く(書き込み禁止)(&W)..." +msgid "Existing image (&Write-protected)…" +msgstr "既存のイメージを開く(書き込み禁止)(&W)…" msgid "&Record" msgstr "録音(&R)" @@ -262,11 +262,11 @@ msgstr "最後まで早送り(&F)" msgid "E&ject" msgstr "取り出す(&J)" -msgid "&Image..." -msgstr "イメージ(&I)..." +msgid "&Image…" +msgstr "イメージ(&I)…" -msgid "E&xport to 86F..." -msgstr "86Fイメージにエクスポート(&X)..." +msgid "E&xport to 86F…" +msgstr "86Fイメージにエクスポート(&X)…" msgid "&Mute" msgstr "ミュート(&M)" @@ -277,8 +277,8 @@ msgstr "なし(&M)" msgid "Reload previous image" msgstr "前のイメージを再読み込み" -msgid "&Folder..." -msgstr "フォルダ(&F)..." +msgid "&Folder…" +msgstr "フォルダ(&F)…" msgid "Preferences" msgstr "環境設定" @@ -424,17 +424,17 @@ msgstr "ジョイスティック:" msgid "Joystick" msgstr "ジョイスティック" -msgid "Joystick 1..." -msgstr "ジョイスティック1..." +msgid "Joystick 1…" +msgstr "ジョイスティック1…" -msgid "Joystick 2..." -msgstr "ジョイスティック2..." +msgid "Joystick 2…" +msgstr "ジョイスティック2…" -msgid "Joystick 3..." -msgstr "ジョイスティック3..." +msgid "Joystick 3…" +msgstr "ジョイスティック3…" -msgid "Joystick 4..." -msgstr "ジョイスティック4..." +msgid "Joystick 4…" +msgstr "ジョイスティック4…" msgid "Sound card #1:" msgstr "サウンドカード1:" @@ -523,23 +523,23 @@ msgstr "パラレルポート3" msgid "Parallel port 4" msgstr "パラレルポート4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "FDDコントローラー:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROMコントローラー:" -msgid "Tertiary IDE Controller" -msgstr "第三IDEコントローラー" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] 第三IDEコントローラー" -msgid "Quaternary IDE Controller" -msgstr "第四IDEコントローラー" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] 第四IDEコントローラー" -msgid "Hard disk" -msgstr "ハードディスク" +msgid "Hard disk controllers" +msgstr "ハードディスクコントローラー" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSIコントローラー" msgid "Controller 1:" msgstr "コントローラー1:" @@ -562,11 +562,11 @@ msgstr "ハード ディスク:" msgid "Firmware Version" msgstr "ファームウェアバージョン" -msgid "&New..." -msgstr "新規(&N)..." +msgid "&New…" +msgstr "新規(&N)…" -msgid "&Existing..." -msgstr "既定(&E)..." +msgid "&Existing…" +msgstr "既定(&E)…" msgid "&Remove" msgstr "削除(&R)" @@ -874,9 +874,6 @@ msgstr "4ボタン式ゲームパッド" msgid "6-button gamepad" msgstr "6ボタン式ゲームパッド" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2ボタン式操縦桿" @@ -904,51 +901,6 @@ msgstr "ステアリングホイール(3軸、3ボタン)" msgid "Steering wheel (3-axis, 4-button)" msgstr "ステアリングホイール(3軸、4ボタン)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinderパッド" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "アダプター付き Thrustmaster Formula T1/T2" @@ -1003,11 +955,17 @@ msgstr "内蔵デバイス" msgid "&File" msgstr "ファイル(&F)" -msgid "&New machine..." -msgstr "新しいマシン(&N)..." +msgid "&New machine…" +msgstr "新しいマシン(&N)…" + +msgid "New machine…" +msgstr "新しいマシン…" -msgid "&Check for updates..." -msgstr "アップデートを確認中(&C)..." +msgid "New machine" +msgstr "新しいマシン" + +msgid "&Check for updates…" +msgstr "アップデートを確認中(&C)…" msgid "Exit" msgstr "終了" @@ -1106,7 +1064,7 @@ msgid "Ctrl+Alt+Del" msgstr "Ctrl+Alt+Del" msgid "Press Ctrl+Alt+Del" -msgstr "Ctrl+Alt+DELを押す" +msgstr "Ctrl+Alt+Delを押す" msgid "Press Ctrl+Alt+Esc" msgstr "Ctrl+Alt+Escを押す" @@ -1258,26 +1216,26 @@ msgstr "表示名を設定する" msgid "Enter the new display name (blank to reset)" msgstr "新しい表示名を入力してください(空白にするとリセットされます)" -msgid "Change &display name..." -msgstr "表示名を変更(&D)..." +msgid "Change &display name…" +msgstr "表示名を変更(&D)…" msgid "Context Menu" msgstr "コンテキストメニュー" -msgid "&Open folder..." -msgstr "フォルダーを開く(&O)..." +msgid "&Open folder…" +msgstr "フォルダーを開く(&O)…" -msgid "Open p&rinter tray..." -msgstr "プリンタートレイを開く(&R)..." +msgid "Open p&rinter tray…" +msgstr "プリンタートレイを開く(&R)…" -msgid "Set &icon..." -msgstr "アイコンを設定(&I)..." +msgid "Set &icon…" +msgstr "アイコンを設定(&I)…" msgid "Select an icon" msgstr "アイコンを選択してください" -msgid "C&lone..." -msgstr "クローン(&L)..." +msgid "C&lone…" +msgstr "クローン(&L)…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "仮想マシン「%1」 (%2)は、以下の場所にクローンされます:" @@ -1363,8 +1321,8 @@ msgstr "スクリーンショットなし" msgid "Search" msgstr "検索" -msgid "Searching for VMs..." -msgstr "仮想マシンを検索中..." +msgid "Searching for VMs…" +msgstr "仮想マシンを検索中…" msgid "Found %1" msgstr "%1が見つかりました" @@ -1391,7 +1349,7 @@ msgid "ACPI shutdown" msgstr "ACPIシャットダウン" msgid "ACP&I shutdown" -msgstr "ACP&Iシャットダウン" +msgstr "ACPIシャットダウン(&I)" msgid "Hard disk (%1)" msgstr "ハードディスク (%1)" @@ -1399,11 +1357,11 @@ msgstr "ハードディスク (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLLやESDI CD-ROMドライブが存在しません" -msgid "Custom..." -msgstr "カスタム..." +msgid "Custom…" +msgstr "カスタム…" -msgid "Custom (large)..." -msgstr "カスタム (大容量)..." +msgid "Custom (large)…" +msgstr "カスタム (大容量)…" msgid "Add New Hard Disk" msgstr "新規のディスクを追加" @@ -1522,21 +1480,6 @@ msgstr "親ディスクと子ディスクのタイムス タンプが一致し msgid "Could not fix VHD timestamp." msgstr "VHD のタイムスタンプを修正できません。" -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1687,14 +1630,14 @@ msgstr "タブレットツール(&T)" msgid "About &Qt" msgstr "&Qtについて" -msgid "&MCA devices..." -msgstr "&MCAデバイス..." +msgid "&MCA devices…" +msgstr "&MCAデバイス…" msgid "Show non-&primary monitors" msgstr "プライマリーモニター以外のモニターを表示する(&P)" -msgid "Open screenshots &folder..." -msgstr "スクリーンショットフォルダを開く(&F)..." +msgid "Open screenshots &folder…" +msgstr "スクリーンショットフォルダを開く(&F)…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "最大化時にフルスクリーンストレッチモードを適用(&Y)" @@ -1714,8 +1657,8 @@ msgstr "コネクテッド" msgid "Clear image &history" msgstr "クリア画像履歴(&H)" -msgid "Create..." -msgstr "作成..." +msgid "Create…" +msgstr "作成…" msgid "Host CD/DVD Drive (%1)" msgstr "ホスト CD/DVD ドライブ (%1)" @@ -1756,8 +1699,8 @@ msgstr "シェーダー" msgid "Remove" msgstr "削除" -msgid "Browse..." -msgstr "参照..." +msgid "Browse…" +msgstr "参照…" msgid "Couldn't create OpenGL context." msgstr "OpenGLコンテキストを作成できませんでした。" @@ -1846,8 +1789,8 @@ msgstr "シリアル・ポート・パススルー 3" msgid "Serial port passthrough 4" msgstr "シリアル・ポート・パススルー 4" -msgid "Renderer &options..." -msgstr "レンダラー設定(&O)..." +msgid "Renderer &options…" +msgstr "レンダラー設定(&O)…" msgid "PC/XT Keyboard" msgstr "PC/XT キーボード" @@ -1984,6 +1927,9 @@ msgstr "シリアルポートのIRQ" msgid "Parallel port IRQ" msgstr "パラレルポートのIRQ" +msgid "Hard disk" +msgstr "ハードディスク" + msgid "BIOS Revision" msgstr "BIOSリビジョン" @@ -2059,9 +2005,6 @@ msgstr "MIDI入力のパススルー" msgid "MIDI Clockout" msgstr "MIDIクロックの出力" -msgid "SoundFont" -msgstr "サウンドフォント" - msgid "Output Gain" msgstr "出力ゲイン" @@ -2971,8 +2914,8 @@ msgstr "ダウンロードページをご覧ください" msgid "Update check" msgstr "アップデートチェック" -msgid "Checking for updates..." -msgstr "アップデートを確認中..." +msgid "Checking for updates…" +msgstr "アップデートを確認中…" msgid "86Box Update" msgstr "86Box アップデート" @@ -3010,8 +2953,8 @@ msgstr "明るさ" msgid "Sharpness" msgstr "シャープネス" -msgid "&CGA composite settings..." -msgstr "CGA複合モードの設定(&C)..." +msgid "&CGA composite settings…" +msgstr "CGA複合モードの設定(&C)…" msgid "CGA composite settings" msgstr "CGA複合モードの設定" @@ -3019,8 +2962,8 @@ msgstr "CGA複合モードの設定" msgid "Monitor EDID" msgstr "モニターのEDID" -msgid "Export..." -msgstr "エクスポート..." +msgid "Export…" +msgstr "エクスポート…" msgid "Export EDID" msgstr "EDIDのエクスポート" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index ab068684242..b5f49554706 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -66,8 +66,8 @@ msgstr "OpenGL (3.0 Core)(&G)" msgid "&VNC" msgstr "VNC(&V)" -msgid "Specify &dimensions..." -msgstr "창 크기 지정하기(&D)..." +msgid "Specify &dimensions…" +msgstr "창 크기 지정하기(&D)…" msgid "Force &4:3 display ratio" msgstr "화면 비율을 4:3으로 맞추기(&4)" @@ -192,11 +192,11 @@ msgstr "미디어(&M)" msgid "&Tools" msgstr "도구(&T)" -msgid "&Settings..." -msgstr "설정(&S)..." +msgid "&Settings…" +msgstr "설정(&S)…" -msgid "Settings..." -msgstr "설정..." +msgid "Settings…" +msgstr "설정…" msgid "&Update status bar icons" msgstr "상태 바 아이콘 갱신하기(&U)" @@ -207,14 +207,14 @@ msgstr "스크린샷 찍기(&C)" msgid "S&ound" msgstr "사운드(&O)" -msgid "&Preferences..." -msgstr "환경설정(&P)..." +msgid "&Preferences…" +msgstr "환경설정(&P)…" msgid "Enable &Discord integration" msgstr "디스코드 연동 활성화하기(&D)" -msgid "Sound &gain..." -msgstr "음량 증폭(&G)..." +msgid "Sound &gain…" +msgstr "음량 증폭(&G)…" msgid "Begin trace" msgstr "추적 시작하기" @@ -225,20 +225,20 @@ msgstr "추적 끝내기" msgid "&Help" msgstr "도움말(&H)" -msgid "&Documentation..." -msgstr "문서(&D)..." +msgid "&Documentation…" +msgstr "문서(&D)…" -msgid "&About 86Box..." -msgstr "86Box에 대해(&A)..." +msgid "&About 86Box…" +msgstr "86Box에 대해(&A)…" -msgid "&New image..." -msgstr "새 이미지(&N)..." +msgid "&New image…" +msgstr "새 이미지(&N)…" -msgid "&Existing image..." -msgstr "이미지 불러오기(&E)..." +msgid "&Existing image…" +msgstr "이미지 불러오기(&E)…" -msgid "Existing image (&Write-protected)..." -msgstr "이미지 불러오기 (쓰기방지)(&W)..." +msgid "Existing image (&Write-protected)…" +msgstr "이미지 불러오기 (쓰기방지)(&W)…" msgid "&Record" msgstr "녹음하기(&R)" @@ -255,11 +255,11 @@ msgstr "맨끝으로 빨리감기(&F)" msgid "E&ject" msgstr "꺼내기(&J)" -msgid "&Image..." -msgstr "이미지(&I)..." +msgid "&Image…" +msgstr "이미지(&I)…" -msgid "E&xport to 86F..." -msgstr "86F로 보내기(&X)..." +msgid "E&xport to 86F…" +msgstr "86F로 보내기(&X)…" msgid "&Mute" msgstr "음소거(&M)" @@ -270,8 +270,8 @@ msgstr "비었음(&M)" msgid "Reload previous image" msgstr "이전 이미지 다시 불러오기" -msgid "&Folder..." -msgstr "폴더(&F)..." +msgid "&Folder…" +msgstr "폴더(&F)…" msgid "Preferences" msgstr "환경설정" @@ -417,17 +417,17 @@ msgstr "조이스틱:" msgid "Joystick" msgstr "조이스틱" -msgid "Joystick 1..." -msgstr "조이스틱 1..." +msgid "Joystick 1…" +msgstr "조이스틱 1…" -msgid "Joystick 2..." -msgstr "조이스틱 2..." +msgid "Joystick 2…" +msgstr "조이스틱 2…" -msgid "Joystick 3..." -msgstr "조이스틱 3..." +msgid "Joystick 3…" +msgstr "조이스틱 3…" -msgid "Joystick 4..." -msgstr "조이스틱 4..." +msgid "Joystick 4…" +msgstr "조이스틱 4…" msgid "Sound card #1:" msgstr "사운드 카드 1:" @@ -516,23 +516,23 @@ msgstr "병렬 포트 3" msgid "Parallel port 4" msgstr "병렬 포트 4" -msgid "FD Controller:" -msgstr "FD 컨트롤러:" +msgid "FD controller:" +msgstr "플로피 디스크 컨트롤러:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROM 컨트롤러:" -msgid "Tertiary IDE Controller" -msgstr "제3의 IDE 컨트롤러" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] 제3의 IDE 컨트롤러" -msgid "Quaternary IDE Controller" -msgstr "제4의 IDE 컨트롤러" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] 제4의 IDE 컨트롤러" -msgid "Hard disk" -msgstr "하드 디스크" +msgid "Hard disk controllers" +msgstr "하드 디스크 컨트롤러" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI 컨트롤러" msgid "Controller 1:" msgstr "컨트롤러 1:" @@ -555,11 +555,11 @@ msgstr "하드 디스크:" msgid "Firmware Version" msgstr "펌웨어 버전" -msgid "&New..." -msgstr "새로 만들기(&N)..." +msgid "&New…" +msgstr "새로 만들기(&N)…" -msgid "&Existing..." -msgstr "불러오기(&E)..." +msgid "&Existing…" +msgstr "불러오기(&E)…" msgid "&Remove" msgstr "목록에서 제거(&R)" @@ -867,9 +867,6 @@ msgstr "4버튼 게임패드" msgid "6-button gamepad" msgstr "6버튼 게임패드" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2버튼 비행 조종간" @@ -897,51 +894,6 @@ msgstr "조타륜 (3축, 3버튼)" msgid "Steering wheel (3-axis, 4-button)" msgstr "조타륜 (3축, 4버튼)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "어댑터 포함 Thrustmaster Formula T1/T2" @@ -996,11 +948,17 @@ msgstr "내부 장치" msgid "&File" msgstr "파일(&F)" -msgid "&New machine..." -msgstr "새로운 기계(&N)..." +msgid "&New machine…" +msgstr "새로운 기계(&N)…" + +msgid "New machine…" +msgstr "새로운 기계…" -msgid "&Check for updates..." -msgstr "업데이트 확인 중(&C)..." +msgid "New machine" +msgstr "새로운 기계" + +msgid "&Check for updates…" +msgstr "업데이트 확인 중(&C)…" msgid "Exit" msgstr "끝내기" @@ -1251,26 +1209,26 @@ msgstr "표시 이름 설정" msgid "Enter the new display name (blank to reset)" msgstr "새 표시 이름을 입력하세요 (비워두면 초기화됩니다)" -msgid "Change &display name..." -msgstr "표시 이름 변경(&D)..." +msgid "Change &display name…" +msgstr "표시 이름 변경(&D)…" msgid "Context Menu" msgstr "컨텍스트 메뉴" -msgid "&Open folder..." -msgstr "폴더 열기(&O)..." +msgid "&Open folder…" +msgstr "폴더 열기(&O)…" -msgid "Open p&rinter tray..." -msgstr "프린터 트레이를 열기(&R)..." +msgid "Open p&rinter tray…" +msgstr "프린터 트레이를 열기(&R)…" -msgid "Set &icon..." -msgstr "아이콘 설정(&I)..." +msgid "Set &icon…" +msgstr "아이콘 설정(&I)…" msgid "Select an icon" msgstr "아이콘을 선택하세요" -msgid "C&lone..." -msgstr "클론(&L)..." +msgid "C&lone…" +msgstr "클론(&L)…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "가상 머신 \"%1\" (%2)는 다음으로 복제됩니다:" @@ -1356,8 +1314,8 @@ msgstr "스크린샷 없음" msgid "Search" msgstr "검색" -msgid "Searching for VMs..." -msgstr "가상 머신을 검색 중입니다..." +msgid "Searching for VMs…" +msgstr "가상 머신을 검색 중입니다…" msgid "Found %1" msgstr "%1 발견됨" @@ -1384,7 +1342,7 @@ msgid "ACPI shutdown" msgstr "ACPI 종료" msgid "ACP&I shutdown" -msgstr "ACP&I 종료" +msgstr "ACPI 종료(&I)" msgid "Hard disk (%1)" msgstr "하드 디스크 (%1)" @@ -1392,11 +1350,11 @@ msgstr "하드 디스크 (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL 또는 ESDI CD-ROM 드라이브가 존재하지 않습니다" -msgid "Custom..." -msgstr "사용자 설정..." +msgid "Custom…" +msgstr "사용자 설정…" -msgid "Custom (large)..." -msgstr "사용자 설정 (대용량)..." +msgid "Custom (large)…" +msgstr "사용자 설정 (대용량)…" msgid "Add New Hard Disk" msgstr "새로 생성" @@ -1515,21 +1473,6 @@ msgstr "부모 디스크와 자식 디스크의 타임스탬프가 일치하지 msgid "Could not fix VHD timestamp." msgstr "VHD 타임스탬프를 고칠 수 없습니다." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "태블릿 도구(&T)" msgid "About &Qt" msgstr "&Qt 소개" -msgid "&MCA devices..." -msgstr "&MCA 장치..." +msgid "&MCA devices…" +msgstr "&MCA 장치…" msgid "Show non-&primary monitors" msgstr "기본 모니터가 아닌 모니터 표시(&P)" -msgid "Open screenshots &folder..." -msgstr "스크린샷 폴더 열기(&F)..." +msgid "Open screenshots &folder…" +msgstr "스크린샷 폴더 열기(&F)…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "최대화 시 전체 화면 비율 적용(&Y)" @@ -1707,8 +1650,8 @@ msgstr "&커넥티드" msgid "Clear image &history" msgstr "이미지 기록 지우기(&H)" -msgid "Create..." -msgstr "만들기..." +msgid "Create…" +msgstr "만들기…" msgid "Host CD/DVD Drive (%1)" msgstr "호스트 CD/DVD 드라이브 (%1)" @@ -1749,8 +1692,8 @@ msgstr "셰이더" msgid "Remove" msgstr "제거" -msgid "Browse..." -msgstr "찾아보기..." +msgid "Browse…" +msgstr "찾아보기…" msgid "Couldn't create OpenGL context." msgstr "OpenGL 컨텍스트를 만들 수 없습니다." @@ -1839,8 +1782,8 @@ msgstr "직렬 포트 패스스루 3" msgid "Serial port passthrough 4" msgstr "직렬 포트 패스스루 4" -msgid "Renderer &options..." -msgstr "렌더러 옵션(&O)..." +msgid "Renderer &options…" +msgstr "렌더러 옵션(&O)…" msgid "PC/XT Keyboard" msgstr "PC/XT 키보드" @@ -1977,6 +1920,9 @@ msgstr "시리얼 포트 IRQ" msgid "Parallel port IRQ" msgstr "병렬 포트 IRQ" +msgid "Hard disk" +msgstr "하드 디스크" + msgid "BIOS Revision" msgstr "BIOS 개정" @@ -2052,9 +1998,6 @@ msgstr "미디 입력 패스스루" msgid "MIDI Clockout" msgstr "미디 클럭 출력" -msgid "SoundFont" -msgstr "사운드 글꼴" - msgid "Output Gain" msgstr "출력 게인" @@ -2964,8 +2907,8 @@ msgstr "다운로드 페이지 방문" msgid "Update check" msgstr "업데이트 확인" -msgid "Checking for updates..." -msgstr "업데이트 확인 중..." +msgid "Checking for updates…" +msgstr "업데이트 확인 중…" msgid "86Box Update" msgstr "86Box 업데이트" @@ -3003,8 +2946,8 @@ msgstr "밝기" msgid "Sharpness" msgstr "선명도" -msgid "&CGA composite settings..." -msgstr "CGA 복합 모드의 설정(&C)..." +msgid "&CGA composite settings…" +msgstr "CGA 복합 모드의 설정(&C)…" msgid "CGA composite settings" msgstr "CGA 복합 모드의 설정" @@ -3012,8 +2955,8 @@ msgstr "CGA 복합 모드의 설정" msgid "Monitor EDID" msgstr "모니터의 EDID" -msgid "Export..." -msgstr "수출..." +msgid "Export…" +msgstr "수출…" msgid "Export EDID" msgstr "EDID 내보내기" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index 04f605d2805..5b2748210a6 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -66,8 +66,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Angi &dimensjoner..." +msgid "Specify &dimensions…" +msgstr "Angi &dimensjoner…" msgid "Force &4:3 display ratio" msgstr "Tving &4:3-bildeforhold" @@ -192,11 +192,11 @@ msgstr "&Medie" msgid "&Tools" msgstr "&Verktøy" -msgid "&Settings..." -msgstr "&Innstillinger..." +msgid "&Settings…" +msgstr "&Innstillinger…" -msgid "Settings..." -msgstr "Innstillinger..." +msgid "Settings…" +msgstr "Innstillinger…" msgid "&Update status bar icons" msgstr "&Oppdater statuslinjeikoner" @@ -207,14 +207,14 @@ msgstr "Ta s&kjermbilde" msgid "S&ound" msgstr "L&yd" -msgid "&Preferences..." -msgstr "&Valg..." +msgid "&Preferences…" +msgstr "&Valg…" msgid "Enable &Discord integration" msgstr "Aktiver &Discord-integrasjon" -msgid "Sound &gain..." -msgstr "Lyd&forsterkning..." +msgid "Sound &gain…" +msgstr "Lyd&forsterkning…" msgid "Begin trace" msgstr "Start sporing" @@ -225,20 +225,20 @@ msgstr "Stopp sporing" msgid "&Help" msgstr "&Hjelp" -msgid "&Documentation..." -msgstr "&Dokumentasjon..." +msgid "&Documentation…" +msgstr "&Dokumentasjon…" -msgid "&About 86Box..." -msgstr "&Om 86Box..." +msgid "&About 86Box…" +msgstr "&Om 86Box…" -msgid "&New image..." -msgstr "&Ny diskfil..." +msgid "&New image…" +msgstr "&Ny diskfil…" -msgid "&Existing image..." -msgstr "&Eksisterende diskfil..." +msgid "&Existing image…" +msgstr "&Eksisterende diskfil…" -msgid "Existing image (&Write-protected)..." -msgstr "Eksisterende diskfil (&skrivbeskyttet)..." +msgid "Existing image (&Write-protected)…" +msgstr "Eksisterende diskfil (&skrivbeskyttet)…" msgid "&Record" msgstr "&Spill inn" @@ -255,11 +255,11 @@ msgstr "&Spol frem til slutten" msgid "E&ject" msgstr "M&at ut" -msgid "&Image..." -msgstr "&Diskfil..." +msgid "&Image…" +msgstr "&Diskfil…" -msgid "E&xport to 86F..." -msgstr "E&ksporter til 86F..." +msgid "E&xport to 86F…" +msgstr "E&ksporter til 86F…" msgid "&Mute" msgstr "&Demp" @@ -270,8 +270,8 @@ msgstr "T&øm" msgid "Reload previous image" msgstr "Last inn forrige diskfil" -msgid "&Folder..." -msgstr "&Mappe..." +msgid "&Folder…" +msgstr "&Mappe…" msgid "Preferences" msgstr "Valg" @@ -417,17 +417,17 @@ msgstr "Styrespak:" msgid "Joystick" msgstr "Styrespak" -msgid "Joystick 1..." -msgstr "Styrespak 1..." +msgid "Joystick 1…" +msgstr "Styrespak 1…" -msgid "Joystick 2..." -msgstr "Styrespak 2..." +msgid "Joystick 2…" +msgstr "Styrespak 2…" -msgid "Joystick 3..." -msgstr "Styrespak 3..." +msgid "Joystick 3…" +msgstr "Styrespak 3…" -msgid "Joystick 4..." -msgstr "Styrespak 4..." +msgid "Joystick 4…" +msgstr "Styrespak 4…" msgid "Sound card #1:" msgstr "Lydkort #1:" @@ -516,23 +516,23 @@ msgstr "Parallellport 3" msgid "Parallel port 4" msgstr "Parallellport 4" -msgid "FD Controller:" -msgstr "FD-kontroller:" +msgid "Floppy disk controller:" +msgstr "Diskettkontroller:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROM-kontroller:" -msgid "Tertiary IDE Controller" -msgstr "Tertiær IDE-kontroller" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tertiær IDE-kontroller" -msgid "Quaternary IDE Controller" -msgstr "Kvartær IDE-kontroller" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Kvartær IDE-kontroller" -msgid "Hard disk" -msgstr "Harddisk" +msgid "Hard disk controllers" +msgstr "Harddiskkontrollere" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI-kontrollere" msgid "Controller 1:" msgstr "Kontroller 1:" @@ -555,11 +555,11 @@ msgstr "Harddisker:" msgid "Firmware Version" msgstr "Firmware-versjon" -msgid "&New..." -msgstr "&Ny..." +msgid "&New…" +msgstr "&Ny…" -msgid "&Existing..." -msgstr "&Eksisterende..." +msgid "&Existing…" +msgstr "&Eksisterende…" msgid "&Remove" msgstr "&Fjern" @@ -867,9 +867,6 @@ msgstr "4-knapps gamepad" msgid "6-button gamepad" msgstr "6-knapps gamepad" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2-knapps flystyre" @@ -897,51 +894,6 @@ msgstr "Ratt (3-akset, 3-knapps)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Ratt (3-akset, 4-knapps)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedaler" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedaler Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedaler" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedaler Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedaler" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedaler Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedaler" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedaler Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Ror-kontrollsystem" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 med adapter" @@ -996,11 +948,17 @@ msgstr "Intern enhet" msgid "&File" msgstr "&Fil" -msgid "&New machine..." -msgstr "&Ny maskin..." +msgid "&New machine…" +msgstr "&Ny maskin…" + +msgid "New machine…" +msgstr "Ny maskin…" -msgid "&Check for updates..." -msgstr "&Sjekk etter oppdateringer..." +msgid "New machine" +msgstr "Ny maskin" + +msgid "&Check for updates…" +msgstr "&Sjekk etter oppdateringer…" msgid "Exit" msgstr "Avslutt" @@ -1251,26 +1209,26 @@ msgstr "Angi visningsnavn" msgid "Enter the new display name (blank to reset)" msgstr "Skriv inn nytt visningsnavn (tomt for å tilbakestille)" -msgid "Change &display name..." -msgstr "Endre &visningsnavn..." +msgid "Change &display name…" +msgstr "Endre &visningsnavn…" msgid "Context Menu" msgstr "Kontekstmeny" -msgid "&Open folder..." -msgstr "&Åpne mappe..." +msgid "&Open folder…" +msgstr "&Åpne mappe…" -msgid "Open p&rinter tray..." -msgstr "Åpne p&rinter-skuff..." +msgid "Open p&rinter tray…" +msgstr "Åpne p&rinter-skuff…" -msgid "Set &icon..." -msgstr "Angi &ikon..." +msgid "Set &icon…" +msgstr "Angi &ikon…" msgid "Select an icon" msgstr "Velg et ikon" -msgid "C&lone..." -msgstr "K&lon..." +msgid "C&lone…" +msgstr "K&lon…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuell maskin \"%1\" (%2) vil bli klonet til:" @@ -1356,8 +1314,8 @@ msgstr "Ingen skjermbilde" msgid "Search" msgstr "Søk" -msgid "Searching for VMs..." -msgstr "Søker etter VMer..." +msgid "Searching for VMs…" +msgstr "Søker etter VMer…" msgid "Found %1" msgstr "Fant %1" @@ -1392,11 +1350,11 @@ msgstr "Harddisk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL eller ESDI CD-ROM-stasjoner eksisterte aldri" -msgid "Custom..." -msgstr "Tilpasset..." +msgid "Custom…" +msgstr "Tilpasset…" -msgid "Custom (large)..." -msgstr "Tilpasset (stor)..." +msgid "Custom (large)…" +msgstr "Tilpasset (stor)…" msgid "Add New Hard Disk" msgstr "Legg til ny harddisk" @@ -1515,21 +1473,6 @@ msgstr "Tidsstemplene til overordnet og underordnet disk samsvarer ikke" msgid "Could not fix VHD timestamp." msgstr "Kunne ikke rette VHD-tidsstempel." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "&Tegnebrettverktøy" msgid "About &Qt" msgstr "Om &Qt" -msgid "&MCA devices..." -msgstr "&MCA-enheter..." +msgid "&MCA devices…" +msgstr "&MCA-enheter…" msgid "Show non-&primary monitors" msgstr "Vis ikke-&primære skjermer" -msgid "Open screenshots &folder..." -msgstr "Åpne skjermbilde&mappe..." +msgid "Open screenshots &folder…" +msgstr "Åpne skjermbilde&mappe…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Bruk fullskjerms&strekkmodus ved maksimering" @@ -1707,8 +1650,8 @@ msgstr "&Koblet til" msgid "Clear image &history" msgstr "Tøm bilde&historikk" -msgid "Create..." -msgstr "Opprett..." +msgid "Create…" +msgstr "Opprett…" msgid "Host CD/DVD Drive (%1)" msgstr "Vert CD/DVD-stasjon (%1)" @@ -1749,8 +1692,8 @@ msgstr "Shader-programmer" msgid "Remove" msgstr "Fjern" -msgid "Browse..." -msgstr "Bla gjennom..." +msgid "Browse…" +msgstr "Bla gjennom…" msgid "Couldn't create OpenGL context." msgstr "Kunne ikke opprette OpenGL-kontekst." @@ -1839,8 +1782,8 @@ msgstr "Seriell port-gjennomkobling 3" msgid "Serial port passthrough 4" msgstr "Seriell port-gjennomkobling 4" -msgid "Renderer &options..." -msgstr "Gjengivelses&alternativer..." +msgid "Renderer &options…" +msgstr "Gjengivelses&alternativer…" msgid "PC/XT Keyboard" msgstr "PC/XT-tastatur" @@ -1977,6 +1920,9 @@ msgstr "Serieport-IRQ" msgid "Parallel port IRQ" msgstr "Parallellport-IRQ" +msgid "Hard disk" +msgstr "Harddisk" + msgid "BIOS Revision" msgstr "BIOS-revisjon" @@ -2052,9 +1998,6 @@ msgstr "MIDI gjennom" msgid "MIDI Clockout" msgstr "MIDI-klokkeutgang" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Utgangsforsterkning" @@ -2964,8 +2907,8 @@ msgstr "Besøk nedlastingssiden" msgid "Update check" msgstr "Oppdateringssjekk" -msgid "Checking for updates..." -msgstr "Ser etter oppdateringer..." +msgid "Checking for updates…" +msgstr "Ser etter oppdateringer…" msgid "86Box Update" msgstr "86Box-oppdatering" @@ -3003,8 +2946,8 @@ msgstr "Lysstyrke" msgid "Sharpness" msgstr "Skarphet" -msgid "&CGA composite settings..." -msgstr "&CGA-komposittinnstillinger..." +msgid "&CGA composite settings…" +msgstr "&CGA-komposittinnstillinger…" msgid "CGA composite settings" msgstr "CGA-komposittinnstillinger" @@ -3012,8 +2955,8 @@ msgstr "CGA-komposittinnstillinger" msgid "Monitor EDID" msgstr "EDID for skjerm" -msgid "Export..." -msgstr "Eksporter..." +msgid "Export…" +msgstr "Eksporter…" msgid "Export EDID" msgstr "Eksporter EDID" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 1c536976889..88a0964eceb 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -66,8 +66,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Afmetingen opgeven..." +msgid "Specify &dimensions…" +msgstr "Afmetingen opgeven…" msgid "Force &4:3 display ratio" msgstr "Forceer &4:3 beeldverhouding" @@ -192,11 +192,11 @@ msgstr "&Media" msgid "&Tools" msgstr "&Tools" -msgid "&Settings..." -msgstr "&Instellingen..." +msgid "&Settings…" +msgstr "&Instellingen…" -msgid "Settings..." -msgstr "Instellingen..." +msgid "Settings…" +msgstr "Instellingen…" msgid "&Update status bar icons" msgstr "&Statusbalkpictogrammen bijwerken" @@ -207,14 +207,14 @@ msgstr "Maak een schermafbeelding" msgid "S&ound" msgstr "&Geluid" -msgid "&Preferences..." -msgstr "&Voorkeuren..." +msgid "&Preferences…" +msgstr "&Voorkeuren…" msgid "Enable &Discord integration" msgstr "&Discord integratie inschakelen" -msgid "Sound &gain..." -msgstr "&Geluidsversterking..." +msgid "Sound &gain…" +msgstr "&Geluidsversterking…" msgid "Begin trace" msgstr "Begin traceren" @@ -225,20 +225,20 @@ msgstr "Beëindig traceren" msgid "&Help" msgstr "&Help" -msgid "&Documentation..." -msgstr "&Documentatie..." +msgid "&Documentation…" +msgstr "&Documentatie…" -msgid "&About 86Box..." -msgstr "&Over 86Box..." +msgid "&About 86Box…" +msgstr "&Over 86Box…" -msgid "&New image..." -msgstr "&Nieuw imagebestand..." +msgid "&New image…" +msgstr "&Nieuw imagebestand…" -msgid "&Existing image..." -msgstr "&Bestaand imagebestand..." +msgid "&Existing image…" +msgstr "&Bestaand imagebestand…" -msgid "Existing image (&Write-protected)..." -msgstr "Bestaand imagebestand (&Schrijfbeveiligd)..." +msgid "Existing image (&Write-protected)…" +msgstr "Bestaand imagebestand (&Schrijfbeveiligd)…" msgid "&Record" msgstr "&Opnemen" @@ -255,11 +255,11 @@ msgstr "&Snel vooruit naar het einde" msgid "E&ject" msgstr "&Uitwerpen" -msgid "&Image..." -msgstr "&Imagebestand..." +msgid "&Image…" +msgstr "&Imagebestand…" -msgid "E&xport to 86F..." -msgstr "E&xporteer naar 86F..." +msgid "E&xport to 86F…" +msgstr "E&xporteer naar 86F…" msgid "&Mute" msgstr "&Dempen" @@ -270,8 +270,8 @@ msgstr "&Leeg" msgid "Reload previous image" msgstr "Herlaad vorig imagebestand" -msgid "&Folder..." -msgstr "&Map..." +msgid "&Folder…" +msgstr "&Map…" msgid "Preferences" msgstr "Voorkeuren" @@ -417,17 +417,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Geluidskaart #1:" @@ -516,23 +516,23 @@ msgstr "Parallelle poort 3" msgid "Parallel port 4" msgstr "Parallelle poort 4" -msgid "FD Controller:" -msgstr "FD-Controller:" +msgid "Floppy disk controller:" +msgstr "Floppy disk controller:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROM controller:" -msgid "Tertiary IDE Controller" -msgstr "Tertiaire IDE-controller" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tertiaire IDE-controller" -msgid "Quaternary IDE Controller" -msgstr "Quaternaire IDE-controller" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Quaternaire IDE-controller" -msgid "Hard disk" -msgstr "Harde schijf" +msgid "Hard disk controllers" +msgstr "Harde schijfcontrollers" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI-controllers" msgid "Controller 1:" msgstr "Controller 1:" @@ -555,11 +555,11 @@ msgstr "Harde schijven:" msgid "Firmware Version" msgstr "Firmware Versie" -msgid "&New..." -msgstr "&Nieuw..." +msgid "&New…" +msgstr "&Nieuw…" -msgid "&Existing..." -msgstr "&Bestaande..." +msgid "&Existing…" +msgstr "&Bestaande…" msgid "&Remove" msgstr "&Verwijderen" @@ -867,9 +867,6 @@ msgstr "4-knops gamepad" msgid "6-button gamepad" msgstr "6-knops gamepad" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2-knops stuurknuppel" @@ -897,51 +894,6 @@ msgstr "Stuurwiel (3 assen, 3 knoppen)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Stuurwiel (3 assen, 4 knoppen)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedalen" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedalen Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedalen" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedalen Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedalen" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedalen Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedalen" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedalen Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control systeem" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Roer Control Systeem" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 met adapter" @@ -996,11 +948,17 @@ msgstr "Intern apparaat" msgid "&File" msgstr "&Bestand" -msgid "&New machine..." -msgstr "&Nieuwe machine..." +msgid "&New machine…" +msgstr "&Nieuwe machine…" + +msgid "New machine…" +msgstr "Nieuwe machine…" -msgid "&Check for updates..." -msgstr "&Controleren op updates..." +msgid "New machine" +msgstr "Nieuwe machine" + +msgid "&Check for updates…" +msgstr "&Controleren op updates…" msgid "Exit" msgstr "&Afsluiten" @@ -1251,26 +1209,26 @@ msgstr "Weergavenaam instellen" msgid "Enter the new display name (blank to reset)" msgstr "Voer een nieuwe weergavenaam in (laat leeg om te herstellen)" -msgid "Change &display name..." -msgstr "Pas &weergavenaam aan..." +msgid "Change &display name…" +msgstr "Pas &weergavenaam aan…" msgid "Context Menu" msgstr "Contextmenu" -msgid "&Open folder..." -msgstr "&Open map..." +msgid "&Open folder…" +msgstr "&Open map…" -msgid "Open p&rinter tray..." -msgstr "Open &papierlade..." +msgid "Open p&rinter tray…" +msgstr "Open &papierlade…" -msgid "Set &icon..." -msgstr "Stel &icoon in..." +msgid "Set &icon…" +msgstr "Stel &icoon in…" msgid "Select an icon" msgstr "Selecteer een icoon" -msgid "C&lone..." -msgstr "K&lonen..." +msgid "C&lone…" +msgstr "K&lonen…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuele machine \"%1\" (%2) zal gekloond worden naar:" @@ -1356,8 +1314,8 @@ msgstr "Geen schermafbeelding" msgid "Search" msgstr "Zoeken" -msgid "Searching for VMs..." -msgstr "Zoeken naar VMs..." +msgid "Searching for VMs…" +msgstr "Zoeken naar VMs…" msgid "Found %1" msgstr "Gevonden %1" @@ -1392,11 +1350,11 @@ msgstr "Harde schijf (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL of ESDI CD-ROM-stations hebben nooit bestaan" -msgid "Custom..." -msgstr "Aangepast..." +msgid "Custom…" +msgstr "Aangepast…" -msgid "Custom (large)..." -msgstr "Aangepast (groot)..." +msgid "Custom (large)…" +msgstr "Aangepast (groot)…" msgid "Add New Hard Disk" msgstr "Nieuwe harde schijf toevoegen" @@ -1515,21 +1473,6 @@ msgstr "Bovenliggende en onderliggende schijftijdstempels komen niet overeen" msgid "Could not fix VHD timestamp." msgstr "Kan VHD tijdstempel niet herstellen." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "&Tablet-hulpmiddel" msgid "About &Qt" msgstr "Over &Qt" -msgid "&MCA devices..." -msgstr "MCA-apparaten..." +msgid "&MCA devices…" +msgstr "MCA-apparaten…" msgid "Show non-&primary monitors" msgstr "Toon niet-primaire beeldschermen" -msgid "Open screenshots &folder..." -msgstr "&Map met schermafbeeldingen openen..." +msgid "Open screenshots &folder…" +msgstr "&Map met schermafbeeldingen openen…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Schakel de volledig scherm-uitrekmodus in bij maximaliseren" @@ -1707,8 +1650,8 @@ msgstr "&Verbonden" msgid "Clear image &history" msgstr "Imagegeschiedenis verwijderen(&H)" -msgid "Create..." -msgstr "Aanmaken..." +msgid "Create…" +msgstr "Aanmaken…" msgid "Host CD/DVD Drive (%1)" msgstr "Host CD/DVD-station (%1)" @@ -1749,8 +1692,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Verwijderen" -msgid "Browse..." -msgstr "Bladeren..." +msgid "Browse…" +msgstr "Bladeren…" msgid "Couldn't create OpenGL context." msgstr "Kan OpenGL-context niet aanmaken." @@ -1839,8 +1782,8 @@ msgstr "Seriële poort doorvoer 3" msgid "Serial port passthrough 4" msgstr "Seriële poort doorvoer 4" -msgid "Renderer &options..." -msgstr "Renderer-opties..." +msgid "Renderer &options…" +msgstr "Renderer-opties…" msgid "PC/XT Keyboard" msgstr "PC/XT Toetsenbord" @@ -1977,6 +1920,9 @@ msgstr "Seriële poort IRQ" msgid "Parallel port IRQ" msgstr "Parallelle poort IRQ" +msgid "Hard disk" +msgstr "Harde schijf" + msgid "BIOS Revision" msgstr "BIOS-Revisie" @@ -2052,9 +1998,6 @@ msgstr "MIDI doorvoer" msgid "MIDI Clockout" msgstr "MIDI Clockout" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Output Gain" @@ -2964,8 +2907,8 @@ msgstr "Bezoek downloadpagina" msgid "Update check" msgstr "Updatecontrole" -msgid "Checking for updates..." -msgstr "Controleren op updates..." +msgid "Checking for updates…" +msgstr "Controleren op updates…" msgid "86Box Update" msgstr "86Box Update" @@ -3003,8 +2946,8 @@ msgstr "Helderheid" msgid "Sharpness" msgstr "Scherpte" -msgid "&CGA composite settings..." -msgstr "Instellingen van de &CGA-compositemodus..." +msgid "&CGA composite settings…" +msgstr "Instellingen van de &CGA-compositemodus…" msgid "CGA composite settings" msgstr "Instellingen van de CGA-compositemodus" @@ -3012,8 +2955,8 @@ msgstr "Instellingen van de CGA-compositemodus" msgid "Monitor EDID" msgstr "EDID-monitor" -msgid "Export..." -msgstr "Exporteren..." +msgid "Export…" +msgstr "Exporteren…" msgid "Export EDID" msgstr "EDID exporteren" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index f861392aeb6..43b89a8da86 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -73,8 +73,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Określ wymiary..." +msgid "Specify &dimensions…" +msgstr "Określ wymiary…" msgid "Force &4:3 display ratio" msgstr "Wymuś proporcje wyświetlania &4:3" @@ -199,11 +199,11 @@ msgstr "N&ośnik" msgid "&Tools" msgstr "&Narzędzia" -msgid "&Settings..." -msgstr "&Ustawienia..." +msgid "&Settings…" +msgstr "&Ustawienia…" -msgid "Settings..." -msgstr "Ustawienia..." +msgid "Settings…" +msgstr "Ustawienia…" msgid "&Update status bar icons" msgstr "&Aktualizuj ikony na pasku statusu" @@ -214,14 +214,14 @@ msgstr "Zrób &zrzut ekranu" msgid "S&ound" msgstr "Dź&więk" -msgid "&Preferences..." -msgstr "&Preferencje..." +msgid "&Preferences…" +msgstr "&Preferencje…" msgid "Enable &Discord integration" msgstr "Włącz integrację z &Discordem" -msgid "Sound &gain..." -msgstr "Wzmocnienie &dźwięku..." +msgid "Sound &gain…" +msgstr "Wzmocnienie &dźwięku…" msgid "Begin trace" msgstr "Rozpocznij śledzenie" @@ -232,20 +232,20 @@ msgstr "Zakończ śledzenie" msgid "&Help" msgstr "Pomo&c" -msgid "&Documentation..." -msgstr "&Dokumentacja..." +msgid "&Documentation…" +msgstr "&Dokumentacja…" -msgid "&About 86Box..." -msgstr "&O 86Boxie..." +msgid "&About 86Box…" +msgstr "&O 86Boxie…" -msgid "&New image..." -msgstr "&Nowy obraz..." +msgid "&New image…" +msgstr "&Nowy obraz…" -msgid "&Existing image..." -msgstr "&Istniejący obraz..." +msgid "&Existing image…" +msgstr "&Istniejący obraz…" -msgid "Existing image (&Write-protected)..." -msgstr "Istniejący obraz (&Chroniony przed zapisem)..." +msgid "Existing image (&Write-protected)…" +msgstr "Istniejący obraz (&Chroniony przed zapisem)…" msgid "&Record" msgstr "&Nagraj" @@ -262,11 +262,11 @@ msgstr "&Przewiń do końca" msgid "E&ject" msgstr "W&yjmij" -msgid "&Image..." -msgstr "&Obraz..." +msgid "&Image…" +msgstr "&Obraz…" -msgid "E&xport to 86F..." -msgstr "E&ksportuj do 86F..." +msgid "E&xport to 86F…" +msgstr "E&ksportuj do 86F…" msgid "&Mute" msgstr "&Wycisz" @@ -277,8 +277,8 @@ msgstr "P&usty" msgid "Reload previous image" msgstr "Przeładuj poprzedni obraz" -msgid "&Folder..." -msgstr "&Folder..." +msgid "&Folder…" +msgstr "&Folder…" msgid "Preferences" msgstr "Preferencje" @@ -424,17 +424,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Karta dźwiękowa nr 1:" @@ -523,23 +523,23 @@ msgstr "Port równoległy 3" msgid "Parallel port 4" msgstr "Port równoległy 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Kontroler dyskietek:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Kontroler CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Trzeciorzędny kontroler IDE" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Trzeciorzędny kontroler IDE" -msgid "Quaternary IDE Controller" -msgstr "Czwartorzędny kontroler IDE" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Czwartorzędny kontroler IDE" -msgid "Hard disk" -msgstr "Dysk twardy" +msgid "Hard disk controllers" +msgstr "Kontrolery dysków twardych" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Kontrolery SCSI" msgid "Controller 1:" msgstr "Kontroler 1:" @@ -562,11 +562,11 @@ msgstr "Dyski twarde:" msgid "Firmware Version" msgstr "Wersja firmware'u" -msgid "&New..." -msgstr "&Nowy..." +msgid "&New…" +msgstr "&Nowy…" -msgid "&Existing..." -msgstr "&Istniejący..." +msgid "&Existing…" +msgstr "&Istniejący…" msgid "&Remove" msgstr "&Usuń" @@ -874,9 +874,6 @@ msgstr "Pad z czterema przyciskami" msgid "6-button gamepad" msgstr "Pad z sześcioma przyciskami" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Wolant z dwoma przyciskami" @@ -904,51 +901,6 @@ msgstr "Kierownica (3 osie, 3 przyciski)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Kierownica (3 osie, 4 przyciski)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 z adapterem" @@ -1003,11 +955,17 @@ msgstr "Urządzenie wewnętrzne" msgid "&File" msgstr "&Plik" -msgid "&New machine..." -msgstr "&Nowa maszyna..." +msgid "&New machine…" +msgstr "&Nowa maszyna…" + +msgid "New machine…" +msgstr "Nowa maszyna…" -msgid "&Check for updates..." -msgstr "&Sprawdź aktualizacje..." +msgid "New machine" +msgstr "Nowa maszyna" + +msgid "&Check for updates…" +msgstr "&Sprawdź aktualizacje…" msgid "Exit" msgstr "Za&kończ" @@ -1258,26 +1216,26 @@ msgstr "Ustaw nazwę wyświetlaną" msgid "Enter the new display name (blank to reset)" msgstr "Podaj nową nazwę wyświetlaną (wyczyść, by zresetować)" -msgid "Change &display name..." -msgstr "Zmień wyświetlaną &nazwę..." +msgid "Change &display name…" +msgstr "Zmień wyświetlaną &nazwę…" msgid "Context Menu" msgstr "Menu kontekstowe" -msgid "&Open folder..." -msgstr "&Otwórz folder..." +msgid "&Open folder…" +msgstr "&Otwórz folder…" -msgid "Open p&rinter tray..." -msgstr "Otwórz &tackę drukarki..." +msgid "Open p&rinter tray…" +msgstr "Otwórz &tackę drukarki…" -msgid "Set &icon..." -msgstr "&Ustaw ikonę..." +msgid "Set &icon…" +msgstr "&Ustaw ikonę…" msgid "Select an icon" msgstr "Wybierz ikonę" -msgid "C&lone..." -msgstr "&Klonuj..." +msgid "C&lone…" +msgstr "&Klonuj…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Maszyna wirtualna „%1” (%2) zostanie sklonowana jako:" @@ -1363,8 +1321,8 @@ msgstr "Brak zrzutów ekranu" msgid "Search" msgstr "Szukanie" -msgid "Searching for VMs..." -msgstr "Szukanie maszyn wirtualnych..." +msgid "Searching for VMs…" +msgstr "Szukanie maszyn wirtualnych…" msgid "Found %1" msgstr "Znaleziono %1" @@ -1399,11 +1357,11 @@ msgstr "Dysk twardy (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "Napędy CD-ROM MFM/RLL lub ESDI nigdy nie istniały" -msgid "Custom..." -msgstr "Niestandardowy..." +msgid "Custom…" +msgstr "Niestandardowy…" -msgid "Custom (large)..." -msgstr "Niestandardowy (duży)..." +msgid "Custom (large)…" +msgstr "Niestandardowy (duży)…" msgid "Add New Hard Disk" msgstr "Dodaj nowy dysk twardy" @@ -1522,21 +1480,6 @@ msgstr "Sygnatury czasowe dysku nadrzędnego i podrzędnego nie zgadzają się" msgid "Could not fix VHD timestamp." msgstr "Nie można naprawić sygnatury czasowej VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1687,14 +1630,14 @@ msgstr "Narzędzie do tabletów" msgid "About &Qt" msgstr "O &Qt" -msgid "&MCA devices..." -msgstr "Urządzenia MCA..." +msgid "&MCA devices…" +msgstr "Urządzenia MCA…" msgid "Show non-&primary monitors" msgstr "Pokaż monitory &inne niż podstawowe" -msgid "Open screenshots &folder..." -msgstr "Otwórz folder zrzutów &ekranu..." +msgid "Open screenshots &folder…" +msgstr "Otwórz folder zrzutów &ekranu…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Zastosowanie trybu rozciągania na pełnym ekranie w stanie zmaksymalizowanym" @@ -1714,8 +1657,8 @@ msgstr "&Podłączone" msgid "Clear image &history" msgstr "Wyczyść historię obrazów(&H)" -msgid "Create..." -msgstr "Stwórz..." +msgid "Create…" +msgstr "Stwórz…" msgid "Host CD/DVD Drive (%1)" msgstr "Napęd CD/DVD hosta (%1)" @@ -1756,8 +1699,8 @@ msgstr "Shadery" msgid "Remove" msgstr "Usuń" -msgid "Browse..." -msgstr "Przeglądaj..." +msgid "Browse…" +msgstr "Przeglądaj…" msgid "Couldn't create OpenGL context." msgstr "Nie można utworzyć kontekstu OpenGL." @@ -1846,8 +1789,8 @@ msgstr "Przelotka portu szeregowego 3" msgid "Serial port passthrough 4" msgstr "Przelotka portu szeregowego 4" -msgid "Renderer &options..." -msgstr "Opcje renderowania..." +msgid "Renderer &options…" +msgstr "Opcje renderowania…" msgid "PC/XT Keyboard" msgstr "Klawiatura PC/XT" @@ -1984,6 +1927,9 @@ msgstr "IRQ portu szeregowego" msgid "Parallel port IRQ" msgstr "IRQ portu równoległego" +msgid "Hard disk" +msgstr "Dysk twardy" + msgid "BIOS Revision" msgstr "Rewizja BIOS-u" @@ -2059,9 +2005,6 @@ msgstr "Przejście wejścia MIDI" msgid "MIDI Clockout" msgstr "Wyjście zegara MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Wzmocnienie wyjściowe" @@ -2971,8 +2914,8 @@ msgstr "Odwiedź stronę pobierania" msgid "Update check" msgstr "Sprawdzanie aktualizacji" -msgid "Checking for updates..." -msgstr "Sprawdzanie aktualizacji..." +msgid "Checking for updates…" +msgstr "Sprawdzanie aktualizacji…" msgid "86Box Update" msgstr "Aktualizacja 86Boxa" @@ -3010,8 +2953,8 @@ msgstr "Jasność" msgid "Sharpness" msgstr "Ostrość" -msgid "&CGA composite settings..." -msgstr "Ustawienia trybu kompozytowego &CGA..." +msgid "&CGA composite settings…" +msgstr "Ustawienia trybu kompozytowego &CGA…" msgid "CGA composite settings" msgstr "Ustawienia trybu kompozytowego CGA" @@ -3019,8 +2962,8 @@ msgstr "Ustawienia trybu kompozytowego CGA" msgid "Monitor EDID" msgstr "EDID monitora" -msgid "Export..." -msgstr "Eksportuj..." +msgid "Export…" +msgstr "Eksportuj…" msgid "Export EDID" msgstr "Eksportuj EDID" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index ac14c221617..04b96c62de9 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -66,8 +66,8 @@ msgstr "Open&GL (Núcleo 3.0)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Especificar as dime&nsões..." +msgid "Specify &dimensions…" +msgstr "Especificar as dime&nsões…" msgid "Force &4:3 display ratio" msgstr "Forçar proporção de tela em &4:3" @@ -192,11 +192,11 @@ msgstr "&Mídia" msgid "&Tools" msgstr "&Ferramentas" -msgid "&Settings..." -msgstr "&Configurações..." +msgid "&Settings…" +msgstr "&Configurações…" -msgid "Settings..." -msgstr "Configurações..." +msgid "Settings…" +msgstr "Configurações…" msgid "&Update status bar icons" msgstr "&Atualizar ícones da barra de status" @@ -207,14 +207,14 @@ msgstr "Capturar &tela" msgid "S&ound" msgstr "&Som" -msgid "&Preferences..." -msgstr "&Preferências..." +msgid "&Preferences…" +msgstr "&Preferências…" msgid "Enable &Discord integration" msgstr "Ativar integração com o &Discord" -msgid "Sound &gain..." -msgstr "&Ganho de som..." +msgid "Sound &gain…" +msgstr "&Ganho de som…" msgid "Begin trace" msgstr "Inicio do rastreamento" @@ -225,20 +225,20 @@ msgstr "Finalizar rastreamento" msgid "&Help" msgstr "Aj&uda" -msgid "&Documentation..." -msgstr "&Documentação..." +msgid "&Documentation…" +msgstr "&Documentação…" -msgid "&About 86Box..." -msgstr "&Sobre o 86Box..." +msgid "&About 86Box…" +msgstr "&Sobre o 86Box…" -msgid "&New image..." -msgstr "&Nova imagem..." +msgid "&New image…" +msgstr "&Nova imagem…" -msgid "&Existing image..." -msgstr "&Imagem existente..." +msgid "&Existing image…" +msgstr "&Imagem existente…" -msgid "Existing image (&Write-protected)..." -msgstr "Imagem existente (&protegida contra gravação)..." +msgid "Existing image (&Write-protected)…" +msgstr "Imagem existente (&protegida contra gravação)…" msgid "&Record" msgstr "&Gravar" @@ -255,11 +255,11 @@ msgstr "&Avançar até o fim" msgid "E&ject" msgstr "E&jetar" -msgid "&Image..." -msgstr "&Imagem..." +msgid "&Image…" +msgstr "&Imagem…" -msgid "E&xport to 86F..." -msgstr "E&xportar para 86F..." +msgid "E&xport to 86F…" +msgstr "E&xportar para 86F…" msgid "&Mute" msgstr "&Silenciar" @@ -270,8 +270,8 @@ msgstr "&Vazio" msgid "Reload previous image" msgstr "Recarregar imagem anterior" -msgid "&Folder..." -msgstr "&Pasta..." +msgid "&Folder…" +msgstr "&Pasta…" msgid "Preferences" msgstr "Preferências" @@ -417,17 +417,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Placa de som nº 1:" @@ -516,23 +516,23 @@ msgstr "Porta paralela 3" msgid "Parallel port 4" msgstr "Porta paralela 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Controlador de disquete:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Controlador de CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Controlador IDE terciário" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Controlador IDE terciário" -msgid "Quaternary IDE Controller" -msgstr "Controlador IDE quaternário" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Controlador IDE quaternário" -msgid "Hard disk" -msgstr "Disco rígido" +msgid "Hard disk controllers" +msgstr "Controladores de disco rígido" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Controladores SCSI" msgid "Controller 1:" msgstr "Controlador 1:" @@ -555,11 +555,11 @@ msgstr "Discos rígidos:" msgid "Firmware Version" msgstr "Versão do Firmware" -msgid "&New..." -msgstr "&Novo..." +msgid "&New…" +msgstr "&Novo…" -msgid "&Existing..." -msgstr "&Existente..." +msgid "&Existing…" +msgstr "&Existente…" msgid "&Remove" msgstr "&Remover" @@ -867,9 +867,6 @@ msgstr "Gamepad de 4 botões" msgid "6-button gamepad" msgstr "Gamepad de 6 botões" -msgid "Gravis PC GamePad" -msgstr "GamePad Gravis PC" - msgid "2-button flight yoke" msgstr "Manche de voo de 2 botões" @@ -897,51 +894,6 @@ msgstr "Volante (3 eixos, 3 botões)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volante (3 eixos, 4 botões)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + Pedais CH" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + Pedais CH Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + Pedais CH" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + Pedais CH Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + Pedais CH" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + Pedais CH Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + Pedais CH" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + Pedais CH Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Sistema de Controle de Voo Thrustmaster" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "SCV Thrustmaster + Sistema de Controle de Leme" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 com adaptador" @@ -996,11 +948,17 @@ msgstr "Dispositivo interno" msgid "&File" msgstr "&Arquivo" -msgid "&New machine..." -msgstr "&Nova máquina..." +msgid "&New machine…" +msgstr "&Nova máquina…" + +msgid "New machine…" +msgstr "Nova máquina…" -msgid "&Check for updates..." -msgstr "&Verificar por atualizações..." +msgid "New machine" +msgstr "Nova máquina" + +msgid "&Check for updates…" +msgstr "&Verificar por atualizações…" msgid "Exit" msgstr "Sair" @@ -1251,26 +1209,26 @@ msgstr "Defina o nome de exibição" msgid "Enter the new display name (blank to reset)" msgstr "Digite o novo nome de exibição (em branco para restaurar)" -msgid "Change &display name..." -msgstr "Mudar o &nome de exibição..." +msgid "Change &display name…" +msgstr "Mudar o &nome de exibição…" msgid "Context Menu" msgstr "Menu de contexto" -msgid "&Open folder..." -msgstr "Abrir &pasta..." +msgid "&Open folder…" +msgstr "Abrir &pasta…" -msgid "Open p&rinter tray..." -msgstr "Abrir fila da &impressora..." +msgid "Open p&rinter tray…" +msgstr "Abrir fila da &impressora…" -msgid "Set &icon..." -msgstr "&Definir ícone..." +msgid "Set &icon…" +msgstr "&Definir ícone…" msgid "Select an icon" msgstr "Selecione um ícone" -msgid "C&lone..." -msgstr "&Clonar..." +msgid "C&lone…" +msgstr "&Clonar…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "A máquina virtual \"%1\" (%2) será clonada em:" @@ -1356,8 +1314,8 @@ msgstr "Nenhuma captura de tela" msgid "Search" msgstr "Pesquisar" -msgid "Searching for VMs..." -msgstr "Procurando por MVs..." +msgid "Searching for VMs…" +msgstr "Procurando por MVs…" msgid "Found %1" msgstr "Encontrada %1" @@ -1392,11 +1350,11 @@ msgstr "Disco rígido (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "As unidades de CD-ROM MFM/RLL ou ESDI nunca existiram" -msgid "Custom..." -msgstr "Personalizado..." +msgid "Custom…" +msgstr "Personalizado…" -msgid "Custom (large)..." -msgstr "Personalizado (grande)..." +msgid "Custom (large)…" +msgstr "Personalizado (grande)…" msgid "Add New Hard Disk" msgstr "Adicionar novo disco rígido" @@ -1515,21 +1473,6 @@ msgstr "Os marcadores de tempo do disco pai e do disco filho não coincidem" msgid "Could not fix VHD timestamp." msgstr "Não foi possível corrigir o marcador de tempo do VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "Ferramenta para &tablet" msgid "About &Qt" msgstr "Sobre o &Qt" -msgid "&MCA devices..." -msgstr "Dispositivos &MCA..." +msgid "&MCA devices…" +msgstr "Dispositivos &MCA…" msgid "Show non-&primary monitors" msgstr "Mostrar monitores não &primários" -msgid "Open screenshots &folder..." -msgstr "Ab&rir pasta de capturas de tela..." +msgid "Open screenshots &folder…" +msgstr "Ab&rir pasta de capturas de tela…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Apl&icar modo de ampliação em tela cheia quando maximizado" @@ -1707,8 +1650,8 @@ msgstr "&Conectado" msgid "Clear image &history" msgstr "Limpar &histórico de imagens" -msgid "Create..." -msgstr "Criar..." +msgid "Create…" +msgstr "Criar…" msgid "Host CD/DVD Drive (%1)" msgstr "Unidade de CD/DVD do anfitrião (%1)" @@ -1749,8 +1692,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Remover" -msgid "Browse..." -msgstr "Procurar..." +msgid "Browse…" +msgstr "Procurar…" msgid "Couldn't create OpenGL context." msgstr "Não foi possível criar o contexto OpenGL." @@ -1839,8 +1782,8 @@ msgstr "Passagem de porta serial 3" msgid "Serial port passthrough 4" msgstr "Passagem de porta serial 4" -msgid "Renderer &options..." -msgstr "&Opções do renderizador..." +msgid "Renderer &options…" +msgstr "&Opções do renderizador…" msgid "PC/XT Keyboard" msgstr "Teclado PC/XT" @@ -1977,6 +1920,9 @@ msgstr "IRQ da porta serial" msgid "Parallel port IRQ" msgstr "IRQ da porta paralela" +msgid "Hard disk" +msgstr "Disco rígido" + msgid "BIOS Revision" msgstr "Revisão do BIOS" @@ -2052,9 +1998,6 @@ msgstr "Passagem da entrada MIDI" msgid "MIDI Clockout" msgstr "Saída do relógio MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Ganho de saída" @@ -2964,8 +2907,8 @@ msgstr "Visitar página de download" msgid "Update check" msgstr "Verificação de atualização" -msgid "Checking for updates..." -msgstr "Verificando por atualizações..." +msgid "Checking for updates…" +msgstr "Verificando por atualizações…" msgid "86Box Update" msgstr "Atualização do 86Box" @@ -3003,8 +2946,8 @@ msgstr "Brilho" msgid "Sharpness" msgstr "Nitidez" -msgid "&CGA composite settings..." -msgstr "Configurações do modo composto &CGA..." +msgid "&CGA composite settings…" +msgstr "Configurações do modo composto &CGA…" msgid "CGA composite settings" msgstr "Configurações do modo composto CGA" @@ -3012,8 +2955,8 @@ msgstr "Configurações do modo composto CGA" msgid "Monitor EDID" msgstr "EDID do monitor" -msgid "Export..." -msgstr "Exportar..." +msgid "Export…" +msgstr "Exportar…" msgid "Export EDID" msgstr "Exportar EDID" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index de0623bec43..f81d1ec94e0 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -73,8 +73,8 @@ msgstr "Open&GL (Núcleo 3.0)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Especificar dimensões..." +msgid "Specify &dimensions…" +msgstr "&Especificar dimensões…" msgid "Force &4:3 display ratio" msgstr "Forçar rácio de visualização &4:3" @@ -199,11 +199,11 @@ msgstr "&Media" msgid "&Tools" msgstr "&Ferramentas" -msgid "&Settings..." -msgstr "&Definições..." +msgid "&Settings…" +msgstr "&Definições…" -msgid "Settings..." -msgstr "Definições..." +msgid "Settings…" +msgstr "Definições…" msgid "&Update status bar icons" msgstr "&Atualizar ícones da barra de estado" @@ -214,14 +214,14 @@ msgstr "Gravar imagem de &ecrã" msgid "S&ound" msgstr "&Som" -msgid "&Preferences..." -msgstr "&Preferências..." +msgid "&Preferences…" +msgstr "&Preferências…" msgid "Enable &Discord integration" msgstr "Ativar integração com D&iscord" -msgid "Sound &gain..." -msgstr "&Ganho de som..." +msgid "Sound &gain…" +msgstr "&Ganho de som…" msgid "Begin trace" msgstr "Iniciar o rastreio" @@ -232,20 +232,20 @@ msgstr "Terminar o rastreio" msgid "&Help" msgstr "Aj&uda" -msgid "&Documentation..." -msgstr "&Documentação..." +msgid "&Documentation…" +msgstr "&Documentação…" -msgid "&About 86Box..." -msgstr "&Acerca do 86Box..." +msgid "&About 86Box…" +msgstr "&Acerca do 86Box…" -msgid "&New image..." -msgstr "&Nova imagem..." +msgid "&New image…" +msgstr "&Nova imagem…" -msgid "&Existing image..." -msgstr "Imagem &existente..." +msgid "&Existing image…" +msgstr "Imagem &existente…" -msgid "Existing image (&Write-protected)..." -msgstr "Imagem existente (&Proteção contra escrita)..." +msgid "Existing image (&Write-protected)…" +msgstr "Imagem existente (&Proteção contra escrita)…" msgid "&Record" msgstr "&Gravar" @@ -262,11 +262,11 @@ msgstr "&Avanço rápido para o fim" msgid "E&ject" msgstr "E&jetar" -msgid "&Image..." -msgstr "&Imagem..." +msgid "&Image…" +msgstr "&Imagem…" -msgid "E&xport to 86F..." -msgstr "E&xportar para 86F..." +msgid "E&xport to 86F…" +msgstr "E&xportar para 86F…" msgid "&Mute" msgstr "&Desativar som" @@ -277,8 +277,8 @@ msgstr "&CDROM vazio" msgid "Reload previous image" msgstr "Recarregar imagem anterior" -msgid "&Folder..." -msgstr "&Pasta..." +msgid "&Folder…" +msgstr "&Pasta…" msgid "Preferences" msgstr "Preferências" @@ -424,17 +424,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Placa de som 1:" @@ -523,23 +523,23 @@ msgstr "Porta paralela 3" msgid "Parallel port 4" msgstr "Porta paralela 4" -msgid "FD Controller:" -msgstr "Controlador FD:" +msgid "Floppy disk controller:" +msgstr "Controlador de disquetes:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Controlador CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Controlador IDE terciário" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Controlador IDE terciário" -msgid "Quaternary IDE Controller" -msgstr "Controlador IDE quaternário" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Controlador IDE quaternário" -msgid "Hard disk" -msgstr "Disco rígido" +msgid "Hard disk controllers" +msgstr "Controladores de disco rígido" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Controladores SCSI" msgid "Controller 1:" msgstr "Controlador 1:" @@ -562,11 +562,11 @@ msgstr "Discos rígidos:" msgid "Firmware Version" msgstr "Versão de firmware" -msgid "&New..." -msgstr "&Novo..." +msgid "&New…" +msgstr "&Novo…" -msgid "&Existing..." -msgstr "&Existente..." +msgid "&Existing…" +msgstr "&Existente…" msgid "&Remove" msgstr "&Remover" @@ -874,9 +874,6 @@ msgstr "Manípulo(s) de jogos de 4 botões" msgid "6-button gamepad" msgstr "Manípulo(s) de jogos de 6 botões" -msgid "Gravis PC GamePad" -msgstr "GamePad Gravis PC" - msgid "2-button flight yoke" msgstr "Manípulo de voo de 2 botões" @@ -904,51 +901,6 @@ msgstr "Volante (de 3 eixos, 3 botões)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volante (de 3 eixos, 4 botões)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + Pedais CH" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + Pedais CH Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + Pedais CH" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + Pedais CH Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + Pedais CH" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + Pedais CH Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Sistema de controlo de voo Thrustmaster" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "SCV Thrustmaster + Sistema de controlo do leme" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 com adaptador" @@ -1003,11 +955,17 @@ msgstr "Dispositivo integrado" msgid "&File" msgstr "F&icheiro" -msgid "&New machine..." -msgstr "&Nova máquina..." +msgid "&New machine…" +msgstr "&Nova máquina…" + +msgid "New machine…" +msgstr "Nova máquina…" -msgid "&Check for updates..." -msgstr "&Verificar para atualizações..." +msgid "New machine" +msgstr "Nova máquina" + +msgid "&Check for updates…" +msgstr "&Verificar para atualizações…" msgid "Exit" msgstr "Sair" @@ -1258,26 +1216,26 @@ msgstr "Definir o nome apresentado" msgid "Enter the new display name (blank to reset)" msgstr "Escreve o nome apresentado (vazio para repor)" -msgid "Change &display name..." -msgstr "Alterar o nome &apresentado..." +msgid "Change &display name…" +msgstr "Alterar o nome &apresentado…" msgid "Context Menu" msgstr "Menu de contexto" -msgid "&Open folder..." -msgstr "&Abrir pasta..." +msgid "&Open folder…" +msgstr "&Abrir pasta…" -msgid "Open p&rinter tray..." -msgstr "Abrir &bandeja de impressora..." +msgid "Open p&rinter tray…" +msgstr "Abrir &bandeja de impressora…" -msgid "Set &icon..." -msgstr "Definir &ícone..." +msgid "Set &icon…" +msgstr "Definir &ícone…" msgid "Select an icon" msgstr "Seleccionar um ícone" -msgid "C&lone..." -msgstr "C&lonar..." +msgid "C&lone…" +msgstr "C&lonar…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "A máquina virtual \"%1\" (%2) será clonada para:" @@ -1363,8 +1321,8 @@ msgstr "Sem capturas de ecrã" msgid "Search" msgstr "Procurar" -msgid "Searching for VMs..." -msgstr "A procurar para MVs..." +msgid "Searching for VMs…" +msgstr "A procurar para MVs…" msgid "Found %1" msgstr "%1 encontrado" @@ -1399,11 +1357,11 @@ msgstr "Disco rígido (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "Unidades CD-ROM com barramento MFM/RLL ou ESDI nunca existiram" -msgid "Custom..." -msgstr "Personalizado..." +msgid "Custom…" +msgstr "Personalizado…" -msgid "Custom (large)..." -msgstr "Personalizado (grande)..." +msgid "Custom (large)…" +msgstr "Personalizado (grande)…" msgid "Add New Hard Disk" msgstr "Adicionar novo disco rígido" @@ -1522,21 +1480,6 @@ msgstr "Os carimbos de data/hora dos discos pai e filho não correspondem" msgid "Could not fix VHD timestamp." msgstr "Não foi possível corrigir o carimbo de data/hora do VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1687,14 +1630,14 @@ msgstr "Ferramenta para tablet" msgid "About &Qt" msgstr "Acerca do &Qt" -msgid "&MCA devices..." -msgstr "Dispositivos MCA..." +msgid "&MCA devices…" +msgstr "Dispositivos MCA…" msgid "Show non-&primary monitors" msgstr "Mostrar monitores não &primários" -msgid "Open screenshots &folder..." -msgstr "Abrir a pas&ta de capturas de ecrã..." +msgid "Open screenshots &folder…" +msgstr "Abrir a pas&ta de capturas de ecrã…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Apl&icar o modo de estiramento na tela cheia quando maximizado" @@ -1714,8 +1657,8 @@ msgstr "&Conectado" msgid "Clear image &history" msgstr "Limpar o histórico de imagens(&H)" -msgid "Create..." -msgstr "Criar..." +msgid "Create…" +msgstr "Criar…" msgid "Host CD/DVD Drive (%1)" msgstr "Unidade de CD/DVD do anfitrião (%1)" @@ -1756,8 +1699,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Remover" -msgid "Browse..." -msgstr "Navegar..." +msgid "Browse…" +msgstr "Navegar…" msgid "Couldn't create OpenGL context." msgstr "Não foi possível criar o contexto OpenGL." @@ -1846,8 +1789,8 @@ msgstr "Passagem da porta de série 3" msgid "Serial port passthrough 4" msgstr "Passagem da porta de série 4" -msgid "Renderer &options..." -msgstr "Opções do re&nderizador..." +msgid "Renderer &options…" +msgstr "Opções do re&nderizador…" msgid "PC/XT Keyboard" msgstr "Teclado PC/XT" @@ -1984,6 +1927,9 @@ msgstr "IRQ da porta série" msgid "Parallel port IRQ" msgstr "IRQ da porta paralela" +msgid "Hard disk" +msgstr "Disco rígido" + msgid "BIOS Revision" msgstr "Revisão da BIOS" @@ -2059,9 +2005,6 @@ msgstr "Passagem da entrada MIDI" msgid "MIDI Clockout" msgstr "Saída do relógio MIDI" -msgid "SoundFont" -msgstr "Fonte de som" - msgid "Output Gain" msgstr "Ganho de saída" @@ -2971,8 +2914,8 @@ msgstr "Visitar a pagina de transferências" msgid "Update check" msgstr "Verificar atualizações" -msgid "Checking for updates..." -msgstr "A verificar para atualizações..." +msgid "Checking for updates…" +msgstr "A verificar para atualizações…" msgid "86Box Update" msgstr "Atualização do 86Box" @@ -3010,8 +2953,8 @@ msgstr "Brilho" msgid "Sharpness" msgstr "Nitidez" -msgid "&CGA composite settings..." -msgstr "Definições do modo compósito &CGA..." +msgid "&CGA composite settings…" +msgstr "Definições do modo compósito &CGA…" msgid "CGA composite settings" msgstr "Definições do modo compósito CGA" @@ -3019,8 +2962,8 @@ msgstr "Definições do modo compósito CGA" msgid "Monitor EDID" msgstr "EDID do monitor" -msgid "Export..." -msgstr "Exportar..." +msgid "Export…" +msgstr "Exportar…" msgid "Export EDID" msgstr "Exportar EDID" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index dc10f515291..ce3fe75a333 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -73,8 +73,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Указать размеры главного окна..." +msgid "Specify &dimensions…" +msgstr "&Указать размеры главного окна…" msgid "Force &4:3 display ratio" msgstr "Установить соотношение сторон &4:3" @@ -199,11 +199,11 @@ msgstr "&Носители" msgid "&Tools" msgstr "&Инструменты" -msgid "&Settings..." -msgstr "&Настройки машины..." +msgid "&Settings…" +msgstr "&Настройки машины…" -msgid "Settings..." -msgstr "Настройки машины..." +msgid "Settings…" +msgstr "Настройки машины…" msgid "&Update status bar icons" msgstr "&Обновление значков строки состояния" @@ -214,14 +214,14 @@ msgstr "Сделать с&криншот" msgid "S&ound" msgstr "&Звук" -msgid "&Preferences..." -msgstr "&Параметры..." +msgid "&Preferences…" +msgstr "&Параметры…" msgid "Enable &Discord integration" msgstr "Включить интеграцию с &Discord" -msgid "Sound &gain..." -msgstr "&Усиление звука..." +msgid "Sound &gain…" +msgstr "&Усиление звука…" msgid "Begin trace" msgstr "Начать трассировку" @@ -232,20 +232,20 @@ msgstr "Завершить трассировку" msgid "&Help" msgstr "&Справка" -msgid "&Documentation..." -msgstr "&Документация..." +msgid "&Documentation…" +msgstr "&Документация…" -msgid "&About 86Box..." -msgstr "&О 86Box..." +msgid "&About 86Box…" +msgstr "&О 86Box…" -msgid "&New image..." -msgstr "&Новый образ..." +msgid "&New image…" +msgstr "&Новый образ…" -msgid "&Existing image..." -msgstr "&Выбрать образ..." +msgid "&Existing image…" +msgstr "&Выбрать образ…" -msgid "Existing image (&Write-protected)..." -msgstr "Выбрать образ (с &защитой от записи)..." +msgid "Existing image (&Write-protected)…" +msgstr "Выбрать образ (с &защитой от записи)…" msgid "&Record" msgstr "&Запись" @@ -262,11 +262,11 @@ msgstr "&Перемотка в конец" msgid "E&ject" msgstr "И&звлечь" -msgid "&Image..." -msgstr "&Образ..." +msgid "&Image…" +msgstr "&Образ…" -msgid "E&xport to 86F..." -msgstr "Э&кспорт в 86F..." +msgid "E&xport to 86F…" +msgstr "Э&кспорт в 86F…" msgid "&Mute" msgstr "О&тключить звук" @@ -277,8 +277,8 @@ msgstr "П&устой" msgid "Reload previous image" msgstr "Перезагрузить предыдущий образ" -msgid "&Folder..." -msgstr "&Папка..." +msgid "&Folder…" +msgstr "&Папка…" msgid "Preferences" msgstr "Параметры" @@ -424,17 +424,17 @@ msgstr "Джойстик:" msgid "Joystick" msgstr "Джойстик" -msgid "Joystick 1..." -msgstr "Джойстик 1..." +msgid "Joystick 1…" +msgstr "Джойстик 1…" -msgid "Joystick 2..." -msgstr "Джойстик 2..." +msgid "Joystick 2…" +msgstr "Джойстик 2…" -msgid "Joystick 3..." -msgstr "Джойстик 3..." +msgid "Joystick 3…" +msgstr "Джойстик 3…" -msgid "Joystick 4..." -msgstr "Джойстик 4..." +msgid "Joystick 4…" +msgstr "Джойстик 4…" msgid "Sound card #1:" msgstr "Звуковая карта № 1:" @@ -523,23 +523,23 @@ msgstr "Параллельный порт LPT3" msgid "Parallel port 4" msgstr "Параллельный порт LPT4" -msgid "FD Controller:" -msgstr "Контроллер дисководов:" +msgid "Floppy disk controller:" +msgstr "Контроллер гибких дисков:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Контроллер CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Третичный IDE контроллер" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Третичный контроллер IDE" -msgid "Quaternary IDE Controller" -msgstr "Четвертичный IDE контроллер" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Четвертичный контроллер IDE" -msgid "Hard disk" -msgstr "Жёсткий диск" +msgid "Hard disk controllers" +msgstr "Контроллеры жёстких дисков" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Контроллеры SCSI" msgid "Controller 1:" msgstr "Контроллер 1:" @@ -562,11 +562,11 @@ msgstr "Жёсткие диски:" msgid "Firmware Version" msgstr "Версия прошивки" -msgid "&New..." -msgstr "&Создать..." +msgid "&New…" +msgstr "&Создать…" -msgid "&Existing..." -msgstr "&Выбрать..." +msgid "&Existing…" +msgstr "&Выбрать…" msgid "&Remove" msgstr "&Удалить" @@ -874,9 +874,6 @@ msgstr "4-кнопочный геймпад" msgid "6-button gamepad" msgstr "6-кнопочный геймпад" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2-кнопочный штурвал" @@ -904,51 +901,6 @@ msgstr "Руль (3-осевой, 3-кнопочный)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Руль (3-осевой, 4-кнопочный)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Педали" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Педали Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Педали" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Педали Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Педали" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Педали Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Педали" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Педали Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Система управления полётом Thrustmaster" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Система управления рулём" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 с адаптером" @@ -1003,11 +955,17 @@ msgstr "Встроенное устройство" msgid "&File" msgstr "&Файл" -msgid "&New machine..." -msgstr "&Новая машина..." +msgid "&New machine…" +msgstr "&Новая машина…" + +msgid "New machine…" +msgstr "Новая машина…" -msgid "&Check for updates..." -msgstr "&Проверить обновления..." +msgid "New machine" +msgstr "Новая машина" + +msgid "&Check for updates…" +msgstr "&Проверить обновления…" msgid "Exit" msgstr "Выход" @@ -1270,26 +1228,26 @@ msgstr "Установить отображаемое имя" msgid "Enter the new display name (blank to reset)" msgstr "Введите новое отображаемое имя (оставьте поле пустым, чтобы сбросить)" -msgid "Change &display name..." -msgstr "Изменить &отображаемое имя..." +msgid "Change &display name…" +msgstr "Изменить &отображаемое имя…" msgid "Context Menu" msgstr "Контекстное меню" -msgid "&Open folder..." -msgstr "&Открыть папку..." +msgid "&Open folder…" +msgstr "&Открыть папку…" -msgid "Open p&rinter tray..." -msgstr "Открыть папку &принтера..." +msgid "Open p&rinter tray…" +msgstr "Открыть папку &принтера…" -msgid "Set &icon..." -msgstr "Установить &значок..." +msgid "Set &icon…" +msgstr "Установить &значок…" msgid "Select an icon" msgstr "Выберите значок" -msgid "C&lone..." -msgstr "К&лонировать..." +msgid "C&lone…" +msgstr "К&лонировать…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Виртуальная машина «%1» (%2) будет клонирована в:" @@ -1375,8 +1333,8 @@ msgstr "Нет скриншота" msgid "Search" msgstr "Поиск" -msgid "Searching for VMs..." -msgstr "Поиск виртуальных машин..." +msgid "Searching for VMs…" +msgstr "Поиск виртуальных машин…" msgid "Found %1" msgstr "Найдено %1" @@ -1411,11 +1369,11 @@ msgstr "Жёсткий диск (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL или ESDI дисководов CD-ROM никогда не существовало" -msgid "Custom..." -msgstr "Задать вручную..." +msgid "Custom…" +msgstr "Задать вручную…" -msgid "Custom (large)..." -msgstr "Задать вручную (большой размер)..." +msgid "Custom (large)…" +msgstr "Задать вручную (большой размер)…" msgid "Add New Hard Disk" msgstr "Создать новый жёсткий диск" @@ -1534,21 +1492,6 @@ msgstr "Временные метки родительского и дочерн msgid "Could not fix VHD timestamp." msgstr "Не удалось исправить временную метку VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1699,14 +1642,14 @@ msgstr "Планшетный &инструмент" msgid "About &Qt" msgstr "О &Qt" -msgid "&MCA devices..." -msgstr "Устройства &MCA..." +msgid "&MCA devices…" +msgstr "Устройства &MCA…" msgid "Show non-&primary monitors" msgstr "&Показывать неосновные мониторы" -msgid "Open screenshots &folder..." -msgstr "Открыть папку &скриншотов..." +msgid "Open screenshots &folder…" +msgstr "Открыть папку &скриншотов…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Применить полно&экранный режим растяжения при разворачивании окна" @@ -1726,8 +1669,8 @@ msgstr "&Кабель подключен" msgid "Clear image &history" msgstr "Очистить &историю образов" -msgid "Create..." -msgstr "Создать..." +msgid "Create…" +msgstr "Создать…" msgid "Host CD/DVD Drive (%1)" msgstr "CD/DVD привод хоста (%1)" @@ -1768,8 +1711,8 @@ msgstr "Шейдеры" msgid "Remove" msgstr "Удалить" -msgid "Browse..." -msgstr "Обзор..." +msgid "Browse…" +msgstr "Обзор…" msgid "Couldn't create OpenGL context." msgstr "Не удалось создать контекст OpenGL." @@ -1858,8 +1801,8 @@ msgstr "Сквозной последовательный порт COM3" msgid "Serial port passthrough 4" msgstr "Сквозной последовательный порт COM4" -msgid "Renderer &options..." -msgstr "Параметры &рендеринга..." +msgid "Renderer &options…" +msgstr "Параметры &рендеринга…" msgid "PC/XT Keyboard" msgstr "Клавиатура PC/XT" @@ -1996,6 +1939,9 @@ msgstr "IRQ последовательного порта" msgid "Parallel port IRQ" msgstr "IRQ параллельного порта" +msgid "Hard disk" +msgstr "Жёсткий диск" + msgid "BIOS Revision" msgstr "Версия BIOS" @@ -2071,9 +2017,6 @@ msgstr "Пропускание MIDI-входа" msgid "MIDI Clockout" msgstr "MIDI Clockout" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Усиление выхода" @@ -2983,8 +2926,8 @@ msgstr "Открыть страницу загрузки" msgid "Update check" msgstr "Проверка обновлений" -msgid "Checking for updates..." -msgstr "Проверка обновлений..." +msgid "Checking for updates…" +msgstr "Проверка обновлений…" msgid "86Box Update" msgstr "Обновление 86Box" @@ -3022,8 +2965,8 @@ msgstr "Яркость" msgid "Sharpness" msgstr "Резкость" -msgid "&CGA composite settings..." -msgstr "Настройки композитного видео &CGA..." +msgid "&CGA composite settings…" +msgstr "Настройки композитного видео &CGA…" msgid "CGA composite settings" msgstr "Настройки композитного видео CGA" @@ -3031,8 +2974,8 @@ msgstr "Настройки композитного видео CGA" msgid "Monitor EDID" msgstr "EDID монитора" -msgid "Export..." -msgstr "Экспорт..." +msgid "Export…" +msgstr "Экспорт…" msgid "Export EDID" msgstr "Экспорт EDID" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 8e41931ee6b..f049c3f4828 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -72,8 +72,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Zadať veľkosť..." +msgid "Specify &dimensions…" +msgstr "&Zadať veľkosť…" msgid "Force &4:3 display ratio" msgstr "Zachovať pomer strán &4:3" @@ -198,11 +198,11 @@ msgstr "&Média" msgid "&Tools" msgstr "&Nástroje" -msgid "&Settings..." -msgstr "&Nastavenia..." +msgid "&Settings…" +msgstr "&Nastavenia…" -msgid "Settings..." -msgstr "Nastavenia..." +msgid "Settings…" +msgstr "Nastavenia…" msgid "&Update status bar icons" msgstr "&Aktualizovať ikony na stavovom riadku" @@ -213,14 +213,14 @@ msgstr "Urobiť snímku &obrazovky" msgid "S&ound" msgstr "&Zvuk" -msgid "&Preferences..." -msgstr "&Predvoľby..." +msgid "&Preferences…" +msgstr "&Predvoľby…" msgid "Enable &Discord integration" msgstr "Povolenie integrácie s &Discordem" -msgid "Sound &gain..." -msgstr "&Zosilnenie zvuku..." +msgid "Sound &gain…" +msgstr "&Zosilnenie zvuku…" msgid "Begin trace" msgstr "Začať trace" @@ -231,20 +231,20 @@ msgstr "Zastaviť trace" msgid "&Help" msgstr "&Pomoc" -msgid "&Documentation..." -msgstr "&Dokumentácia..." +msgid "&Documentation…" +msgstr "&Dokumentácia…" -msgid "&About 86Box..." -msgstr "&O programu 86Box..." +msgid "&About 86Box…" +msgstr "&O programu 86Box…" -msgid "&New image..." -msgstr "&Nový obraz..." +msgid "&New image…" +msgstr "&Nový obraz…" -msgid "&Existing image..." -msgstr "&Existujúci obraz..." +msgid "&Existing image…" +msgstr "&Existujúci obraz…" -msgid "Existing image (&Write-protected)..." -msgstr "Existujúci obraz (&ochrana proti zápisu)..." +msgid "Existing image (&Write-protected)…" +msgstr "Existujúci obraz (&ochrana proti zápisu)…" msgid "&Record" msgstr "&Nahrávať" @@ -261,11 +261,11 @@ msgstr "Previnuť na &koniec" msgid "E&ject" msgstr "&Vystrihnúť" -msgid "&Image..." -msgstr "&Obraz..." +msgid "&Image…" +msgstr "&Obraz…" -msgid "E&xport to 86F..." -msgstr "E&xportovať do 86F..." +msgid "E&xport to 86F…" +msgstr "E&xportovať do 86F…" msgid "&Mute" msgstr "&Stíšiť" @@ -276,8 +276,8 @@ msgstr "&Vystrihnúť" msgid "Reload previous image" msgstr "Načítať znova predchádzajúci obraz" -msgid "&Folder..." -msgstr "&Zložka..." +msgid "&Folder…" +msgstr "&Zložka…" msgid "Preferences" msgstr "Predvoľby" @@ -423,17 +423,17 @@ msgstr "Joystick:" msgid "Joystick" msgstr "Joystick" -msgid "Joystick 1..." -msgstr "Joystick 1..." +msgid "Joystick 1…" +msgstr "Joystick 1…" -msgid "Joystick 2..." -msgstr "Joystick 2..." +msgid "Joystick 2…" +msgstr "Joystick 2…" -msgid "Joystick 3..." -msgstr "Joystick 3..." +msgid "Joystick 3…" +msgstr "Joystick 3…" -msgid "Joystick 4..." -msgstr "Joystick 4..." +msgid "Joystick 4…" +msgstr "Joystick 4…" msgid "Sound card #1:" msgstr "Zvuková karta 1:" @@ -522,23 +522,23 @@ msgstr "Povoliť port LPT3" msgid "Parallel port 4" msgstr "Povoliť port LPT4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Disketový radič:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Radič CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Tretí radič IDE" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tretí radič IDE" -msgid "Quaternary IDE Controller" -msgstr "Štvrtý radič IDE" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Štvrtý radič IDE" -msgid "Hard disk" -msgstr "Pevný disk" +msgid "Hard disk controllers" +msgstr "Radiče pevných diskov" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Radiče SCSI" msgid "Controller 1:" msgstr "Radič 1:" @@ -561,11 +561,11 @@ msgstr "Pevné disky:" msgid "Firmware Version" msgstr "Verzia firmvéru" -msgid "&New..." -msgstr "&Nový..." +msgid "&New…" +msgstr "&Nový…" -msgid "&Existing..." -msgstr "&Existujúcý..." +msgid "&Existing…" +msgstr "&Existujúcý…" msgid "&Remove" msgstr "&Odobrať" @@ -873,9 +873,6 @@ msgstr "Ovládač so 4 tlačidlami" msgid "6-button gamepad" msgstr "Ovládač so 6 tlačidlami" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Letecký knipl s 2 tlačidlami" @@ -903,51 +900,6 @@ msgstr "Volant (3 osy, 3 tlačítka)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volant (3 osy, 4 tlačítka)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 s adaptérom" @@ -1002,11 +954,17 @@ msgstr "Vstavané zariadenie" msgid "&File" msgstr "&Súbor" -msgid "&New machine..." -msgstr "&Nový počítač..." +msgid "&New machine…" +msgstr "&Nový počítač…" + +msgid "New machine…" +msgstr "Nový počítač…" -msgid "&Check for updates..." -msgstr "&Skontroluj aktualizácie..." +msgid "New machine" +msgstr "Nový počítač" + +msgid "&Check for updates…" +msgstr "&Skontroluj aktualizácie…" msgid "Exit" msgstr "Ukončiť" @@ -1257,26 +1215,26 @@ msgstr "Nastaviť zobrazené meno" msgid "Enter the new display name (blank to reset)" msgstr "Zadajte nové zobrazené meno (prázdne pole pre vymazanie)" -msgid "Change &display name..." -msgstr "Zmeniť &zobrazené meno..." +msgid "Change &display name…" +msgstr "Zmeniť &zobrazené meno…" msgid "Context Menu" msgstr "Kontextové menu" -msgid "&Open folder..." -msgstr "&Otvoriť priečinok..." +msgid "&Open folder…" +msgstr "&Otvoriť priečinok…" -msgid "Open p&rinter tray..." -msgstr "Otvoriť zásobník &tlačiarne..." +msgid "Open p&rinter tray…" +msgstr "Otvoriť zásobník &tlačiarne…" -msgid "Set &icon..." -msgstr "Nastaviť &ikonu..." +msgid "Set &icon…" +msgstr "Nastaviť &ikonu…" msgid "Select an icon" msgstr "Vyberte ikonu" -msgid "C&lone..." -msgstr "K&lonovať..." +msgid "C&lone…" +msgstr "K&lonovať…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuálny počítač \"%1\" (%2) bude klonovaný do:" @@ -1362,8 +1320,8 @@ msgstr "Žiadny snímok obrazovky" msgid "Search" msgstr "Hľadať" -msgid "Searching for VMs..." -msgstr "Hľadanie virtuálnych počítačov..." +msgid "Searching for VMs…" +msgstr "Hľadanie virtuálnych počítačov…" msgid "Found %1" msgstr "Nájdené %1" @@ -1398,11 +1356,11 @@ msgstr "Pevný disk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "CD-ROM mechaniky pre rozhranie MFM/RLL alebo ESDI nikdy neexistovali" -msgid "Custom..." -msgstr "Vlastná..." +msgid "Custom…" +msgstr "Vlastná…" -msgid "Custom (large)..." -msgstr "Vlastná (veľká)..." +msgid "Custom (large)…" +msgstr "Vlastná (veľká)…" msgid "Add New Hard Disk" msgstr "Pridať nový pevný disk" @@ -1521,21 +1479,6 @@ msgstr "Časové pečiatky nadradeného a podradeného disku nesúhlasia" msgid "Could not fix VHD timestamp." msgstr "Nebolo možné opraviť časovú pečiatku VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1686,14 +1629,14 @@ msgstr "Nástroj pre tablety" msgid "About &Qt" msgstr "O &Qt" -msgid "&MCA devices..." -msgstr "Zariadenia MCA..." +msgid "&MCA devices…" +msgstr "Zariadenia MCA…" msgid "Show non-&primary monitors" msgstr "Zobrazenie iných ako primárnych monitorov" -msgid "Open screenshots &folder..." -msgstr "Otvorte priečinok so snímkami obrazovky..." +msgid "Open screenshots &folder…" +msgstr "Otvorte priečinok so snímkami obrazovky…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Použitie režimu roztiahnutia na celú obrazovku pri maximalizácii" @@ -1713,8 +1656,8 @@ msgstr "&Pripojené" msgid "Clear image &history" msgstr "Vymazanie histórie obrázkov" -msgid "Create..." -msgstr "Vytvorte..." +msgid "Create…" +msgstr "Vytvorte…" msgid "Host CD/DVD Drive (%1)" msgstr "Jednotka CD/DVD hostiteľa (%1)" @@ -1755,8 +1698,8 @@ msgstr "Shadery" msgid "Remove" msgstr "Odstránenie stránky" -msgid "Browse..." -msgstr "Prehľadávať..." +msgid "Browse…" +msgstr "Prehľadávať…" msgid "Couldn't create OpenGL context." msgstr "Nepodarilo sa vytvoriť kontext OpenGL." @@ -1845,8 +1788,8 @@ msgstr "Priechod sériového portu 3" msgid "Serial port passthrough 4" msgstr "Priechod cez sériový port 4" -msgid "Renderer &options..." -msgstr "Možnosti vykresľovača..." +msgid "Renderer &options…" +msgstr "Možnosti vykresľovača…" msgid "PC/XT Keyboard" msgstr "Klávesnica PC/XT" @@ -1983,6 +1926,9 @@ msgstr "Prerušenie sériového portu" msgid "Parallel port IRQ" msgstr "Prerušenie paralelného portu" +msgid "Hard disk" +msgstr "Pevný disk" + msgid "BIOS Revision" msgstr "Revízia BIOS" @@ -2058,9 +2004,6 @@ msgstr "Priechodnosť vstupu MIDI" msgid "MIDI Clockout" msgstr "Výstup hodín MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Zosilnenie výstupu" @@ -2970,8 +2913,8 @@ msgstr "Navštíviť stránku na stiahnutie" msgid "Update check" msgstr "Kontrola aktualizácií" -msgid "Checking for updates..." -msgstr "Prebieha kontrola aktualizácií..." +msgid "Checking for updates…" +msgstr "Prebieha kontrola aktualizácií…" msgid "86Box Update" msgstr "Aktualizácia 86Box" @@ -3009,8 +2952,8 @@ msgstr "Jas" msgid "Sharpness" msgstr "Ostrota" -msgid "&CGA composite settings..." -msgstr "Nastavenia kompozitného režimu &CGA..." +msgid "&CGA composite settings…" +msgstr "Nastavenia kompozitného režimu &CGA…" msgid "CGA composite settings" msgstr "Nastavenia kompozitného režimu CGA" @@ -3018,8 +2961,8 @@ msgstr "Nastavenia kompozitného režimu CGA" msgid "Monitor EDID" msgstr "EDID monitora" -msgid "Export..." -msgstr "Exportovať..." +msgid "Export…" +msgstr "Exportovať…" msgid "Export EDID" msgstr "Exportovať EDID" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index ca7a3e17b6f..d6a4c20ea22 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -74,8 +74,8 @@ msgstr "Open&GL (jedro 3.0)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Določi velikost..." +msgid "Specify &dimensions…" +msgstr "&Določi velikost…" msgid "Force &4:3 display ratio" msgstr "Vsili razmerje zaslona &4:3" @@ -200,11 +200,11 @@ msgstr "&Mediji" msgid "&Tools" msgstr "&Orodja" -msgid "&Settings..." -msgstr "&Nastavitve..." +msgid "&Settings…" +msgstr "&Nastavitve…" -msgid "Settings..." -msgstr "Nastavitve..." +msgid "Settings…" +msgstr "Nastavitve…" msgid "&Update status bar icons" msgstr "&Posodabljaj ikone statusne vrstice" @@ -215,14 +215,14 @@ msgstr "&Zajemi posnetek zaslona" msgid "S&ound" msgstr "Z&vok" -msgid "&Preferences..." -msgstr "&Možnosti..." +msgid "&Preferences…" +msgstr "&Možnosti…" msgid "Enable &Discord integration" msgstr "Omogoči integracijo s programom &Discord" -msgid "Sound &gain..." -msgstr "&Ojačanje zvoka..." +msgid "Sound &gain…" +msgstr "&Ojačanje zvoka…" msgid "Begin trace" msgstr "Z&ačni sledenje" @@ -233,20 +233,20 @@ msgstr "&Končaj sledenje" msgid "&Help" msgstr "&Pomoč" -msgid "&Documentation..." -msgstr "&Dokumentacija..." +msgid "&Documentation…" +msgstr "&Dokumentacija…" -msgid "&About 86Box..." -msgstr "&O programu 86Box..." +msgid "&About 86Box…" +msgstr "&O programu 86Box…" -msgid "&New image..." -msgstr "&Nova slika..." +msgid "&New image…" +msgstr "&Nova slika…" -msgid "&Existing image..." -msgstr "&Obstoječa slika..." +msgid "&Existing image…" +msgstr "&Obstoječa slika…" -msgid "Existing image (&Write-protected)..." -msgstr "Obstoječa slika (&samo za branje)..." +msgid "Existing image (&Write-protected)…" +msgstr "Obstoječa slika (&samo za branje)…" msgid "&Record" msgstr "Snemaj" @@ -263,11 +263,11 @@ msgstr "Preskoči na konec" msgid "E&ject" msgstr "I&zvrzi" -msgid "&Image..." -msgstr "S&lika..." +msgid "&Image…" +msgstr "S&lika…" -msgid "E&xport to 86F..." -msgstr "&Izvozi v 86F..." +msgid "E&xport to 86F…" +msgstr "&Izvozi v 86F…" msgid "&Mute" msgstr "&Utišaj" @@ -278,8 +278,8 @@ msgstr "&Prazen" msgid "Reload previous image" msgstr "Naloži zadnjo sliko" -msgid "&Folder..." -msgstr "&Mapa..." +msgid "&Folder…" +msgstr "&Mapa…" msgid "Preferences" msgstr "Možnosti" @@ -425,17 +425,17 @@ msgstr "Igralna palica:" msgid "Joystick" msgstr "Igralna palica" -msgid "Joystick 1..." -msgstr "Igralna palica 1..." +msgid "Joystick 1…" +msgstr "Igralna palica 1…" -msgid "Joystick 2..." -msgstr "Igralna palica 2..." +msgid "Joystick 2…" +msgstr "Igralna palica 2…" -msgid "Joystick 3..." -msgstr "Igralna palica 3..." +msgid "Joystick 3…" +msgstr "Igralna palica 3…" -msgid "Joystick 4..." -msgstr "Igralna palica 4..." +msgid "Joystick 4…" +msgstr "Igralna palica 4…" msgid "Sound card #1:" msgstr "Zvočna kartica 1:" @@ -524,23 +524,23 @@ msgstr "Vzporedna vrata 3" msgid "Parallel port 4" msgstr "Vzporedna vrata 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Disketni krmilnik:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Krmilnik CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Terciarni krmilnik IDE" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Terciarni krmilnik IDE" -msgid "Quaternary IDE Controller" -msgstr "Kvartarni krmilnik IDE" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Kvartarni krmilnik IDE" -msgid "Hard disk" -msgstr "Trdi disk" +msgid "Hard disk controllers" +msgstr "Krmilniki trdih diskov" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Krmilniki SCSI" msgid "Controller 1:" msgstr "Krmilnik 1:" @@ -563,11 +563,11 @@ msgstr "Trdi diski:" msgid "Firmware Version" msgstr "Različica programske opreme" -msgid "&New..." -msgstr "Nov..." +msgid "&New…" +msgstr "Nov…" -msgid "&Existing..." -msgstr "Obstoječ..." +msgid "&Existing…" +msgstr "Obstoječ…" msgid "&Remove" msgstr "Odstrani" @@ -875,9 +875,6 @@ msgstr "Igralna ploščica s 4 gumbi" msgid "6-button gamepad" msgstr "Igralna ploščica s 6 gumbi" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Letalski krmilni drog z 2 gumbi" @@ -905,51 +902,6 @@ msgstr "Volan s 3 osmi, 3 gumbi" msgid "Steering wheel (3-axis, 4-button)" msgstr "Volan s 3 osmi, 4 gumbi" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 s pretvornikom" @@ -1004,11 +956,17 @@ msgstr "Vgrajena naprava" msgid "&File" msgstr "&Datoteka" -msgid "&New machine..." -msgstr "&Nova naprava..." +msgid "&New machine…" +msgstr "&Nova naprava…" + +msgid "New machine…" +msgstr "Nova naprava…" -msgid "&Check for updates..." -msgstr "&Preveri obstoj posodobitev..." +msgid "New machine" +msgstr "Nova naprava" + +msgid "&Check for updates…" +msgstr "&Preveri obstoj posodobitev…" msgid "Exit" msgstr "Izhod" @@ -1259,26 +1217,26 @@ msgstr "Nastavi prikazano ime" msgid "Enter the new display name (blank to reset)" msgstr "Vstavi novo prikazano ime (prazno za ponastavitev)" -msgid "Change &display name..." -msgstr "Spremeni &prikazano ime..." +msgid "Change &display name…" +msgstr "Spremeni &prikazano ime…" msgid "Context Menu" msgstr "Kontekstni meni" -msgid "&Open folder..." -msgstr "&Odpri mapo..." +msgid "&Open folder…" +msgstr "&Odpri mapo…" -msgid "Open p&rinter tray..." -msgstr "Odpri pladenj &tiskalnika..." +msgid "Open p&rinter tray…" +msgstr "Odpri pladenj &tiskalnika…" -msgid "Set &icon..." -msgstr "Izberi &ikono..." +msgid "Set &icon…" +msgstr "Izberi &ikono…" msgid "Select an icon" msgstr "Izberi ikono" -msgid "C&lone..." -msgstr "K&loniraj..." +msgid "C&lone…" +msgstr "K&loniraj…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Navidezna naprava \"%1\" (%2) bo klonirana v:" @@ -1364,8 +1322,8 @@ msgstr "Ni zajemov zaslona" msgid "Search" msgstr "Išči" -msgid "Searching for VMs..." -msgstr "Iskanje navideznih naprav..." +msgid "Searching for VMs…" +msgstr "Iskanje navideznih naprav…" msgid "Found %1" msgstr "%1 najden" @@ -1400,11 +1358,11 @@ msgstr "Trdi disk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL ali ESDI pogoni CD-ROM niso nikoli obstajali" -msgid "Custom..." -msgstr "Po meri..." +msgid "Custom…" +msgstr "Po meri…" -msgid "Custom (large)..." -msgstr "Po meri (velik)..." +msgid "Custom (large)…" +msgstr "Po meri (velik)…" msgid "Add New Hard Disk" msgstr "Dodaj nov trdi disk" @@ -1523,21 +1481,6 @@ msgstr "Časovna žiga nadrejene in podrejene slike diska se ne ujemata" msgid "Could not fix VHD timestamp." msgstr "Ne morem popraviti časovnega žiga slike VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1688,14 +1631,14 @@ msgstr "Orodje za tablico" msgid "About &Qt" msgstr "O programu &Qt" -msgid "&MCA devices..." -msgstr "Naprave MCA..." +msgid "&MCA devices…" +msgstr "Naprave MCA…" msgid "Show non-&primary monitors" msgstr "Prikaži neprimarne monitorje" -msgid "Open screenshots &folder..." -msgstr "Odprite mapo s posnetki zaslona..." +msgid "Open screenshots &folder…" +msgstr "Odprite mapo s posnetki zaslona…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Uporabi način celozaslonskega raztezanja v maksimiranem stanju" @@ -1715,8 +1658,8 @@ msgstr "&Povezan" msgid "Clear image &history" msgstr "Počisti zgodovino slik" -msgid "Create..." -msgstr "Ustvari..." +msgid "Create…" +msgstr "Ustvari…" msgid "Host CD/DVD Drive (%1)" msgstr "Gostiteljski pogon CD/DVD (%1)" @@ -1757,8 +1700,8 @@ msgstr "Senčilniki" msgid "Remove" msgstr "Odstrani" -msgid "Browse..." -msgstr "Prerskaj..." +msgid "Browse…" +msgstr "Prerskaj…" msgid "Couldn't create OpenGL context." msgstr "Ni bilo mogoče ustvariti konteksta OpenGL." @@ -1847,8 +1790,8 @@ msgstr "Prepust za serijska vrata 3" msgid "Serial port passthrough 4" msgstr "Prepust za serijska vrata 4" -msgid "Renderer &options..." -msgstr "Možnosti sistema za upodabljanje..." +msgid "Renderer &options…" +msgstr "Možnosti sistema za upodabljanje…" msgid "PC/XT Keyboard" msgstr "Tipkovnica PC/XT" @@ -1985,6 +1928,9 @@ msgstr "IRQ serijskih vrat" msgid "Parallel port IRQ" msgstr "IRQ paralelnih vrat" +msgid "Hard disk" +msgstr "Trdi disk" + msgid "BIOS Revision" msgstr "Revizija BIOS-a" @@ -2060,9 +2006,6 @@ msgstr "Prepust vhoda MIDI" msgid "MIDI Clockout" msgstr "Izhod ure MIDI" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Ojačanje izhoda" @@ -2972,8 +2915,8 @@ msgstr "Obišči stran s prenosi" msgid "Update check" msgstr "Preveri obstoj posodobitev" -msgid "Checking for updates..." -msgstr "Poteka preverjanje obstoja posodobitev..." +msgid "Checking for updates…" +msgstr "Poteka preverjanje obstoja posodobitev…" msgid "86Box Update" msgstr "Posodobitev programa 86Box" @@ -3011,8 +2954,8 @@ msgstr "Svetlost" msgid "Sharpness" msgstr "Ostrina" -msgid "&CGA composite settings..." -msgstr "Nastavitve kompozitnega načina &CGA..." +msgid "&CGA composite settings…" +msgstr "Nastavitve kompozitnega načina &CGA…" msgid "CGA composite settings" msgstr "Nastavitve kompozitnega načina CGA" @@ -3020,8 +2963,8 @@ msgstr "Nastavitve kompozitnega načina CGA" msgid "Monitor EDID" msgstr "EDID monitorja" -msgid "Export..." -msgstr "Izvoz..." +msgid "Export…" +msgstr "Izvoz…" msgid "Export EDID" msgstr "Izvoz EDID" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index a153443f20f..4e626a47bb5 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -66,8 +66,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Ange &mått..." +msgid "Specify &dimensions…" +msgstr "Ange &mått…" msgid "Force &4:3 display ratio" msgstr "Tvinga &4:3 bildförhållande" @@ -192,11 +192,11 @@ msgstr "&Media" msgid "&Tools" msgstr "&Verktyg" -msgid "&Settings..." -msgstr "&Inställningar..." +msgid "&Settings…" +msgstr "&Inställningar…" -msgid "Settings..." -msgstr "Inställningar..." +msgid "Settings…" +msgstr "Inställningar…" msgid "&Update status bar icons" msgstr "&Uppdatera statusfältets ikoner" @@ -207,14 +207,14 @@ msgstr "Tag s&kärmbild" msgid "S&ound" msgstr "L&jud" -msgid "&Preferences..." -msgstr "&Preferenser..." +msgid "&Preferences…" +msgstr "&Preferenser…" msgid "Enable &Discord integration" msgstr "Aktivera &integration med Discord" -msgid "Sound &gain..." -msgstr "Ljud&förstärkning..." +msgid "Sound &gain…" +msgstr "Ljud&förstärkning…" msgid "Begin trace" msgstr "Börja spårning" @@ -225,20 +225,20 @@ msgstr "Avsluta spårning" msgid "&Help" msgstr "&Hjälp" -msgid "&Documentation..." -msgstr "&Dokumentation..." +msgid "&Documentation…" +msgstr "&Dokumentation…" -msgid "&About 86Box..." -msgstr "&Om 86Box..." +msgid "&About 86Box…" +msgstr "&Om 86Box…" -msgid "&New image..." -msgstr "&Ny avbildning..." +msgid "&New image…" +msgstr "&Ny avbildning…" -msgid "&Existing image..." -msgstr "&Befintlig avbildning..." +msgid "&Existing image…" +msgstr "&Befintlig avbildning…" -msgid "Existing image (&Write-protected)..." -msgstr "Befintlig avbildning (&skrivskyddad)..." +msgid "Existing image (&Write-protected)…" +msgstr "Befintlig avbildning (&skrivskyddad)…" msgid "&Record" msgstr "&Spela in" @@ -255,11 +255,11 @@ msgstr "&Spola fram till slutet" msgid "E&ject" msgstr "M&ata ut" -msgid "&Image..." -msgstr "&Avbildning..." +msgid "&Image…" +msgstr "&Avbildning…" -msgid "E&xport to 86F..." -msgstr "E&xportera till 86F..." +msgid "E&xport to 86F…" +msgstr "E&xportera till 86F…" msgid "&Mute" msgstr "&Tysta" @@ -270,8 +270,8 @@ msgstr "T&om" msgid "Reload previous image" msgstr "Ladda om föregående avbildning" -msgid "&Folder..." -msgstr "&Mapp..." +msgid "&Folder…" +msgstr "&Mapp…" msgid "Preferences" msgstr "Preferenser" @@ -417,17 +417,17 @@ msgstr "Styrspak:" msgid "Joystick" msgstr "Styrspak" -msgid "Joystick 1..." -msgstr "Styrspak 1..." +msgid "Joystick 1…" +msgstr "Styrspak 1…" -msgid "Joystick 2..." -msgstr "Styrspak 2..." +msgid "Joystick 2…" +msgstr "Styrspak 2…" -msgid "Joystick 3..." -msgstr "Styrspak 3..." +msgid "Joystick 3…" +msgstr "Styrspak 3…" -msgid "Joystick 4..." -msgstr "Styrspak 4..." +msgid "Joystick 4…" +msgstr "Styrspak 4…" msgid "Sound card #1:" msgstr "Ljudkort #1:" @@ -516,23 +516,23 @@ msgstr "Parallellport 3" msgid "Parallel port 4" msgstr "Parallellport 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Styrenhet för diskett:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Styrenhet för CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Tertiär IDE-kontroller" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Tertiär IDE-kontroller" -msgid "Quaternary IDE Controller" -msgstr "Kvartär IDE-kontroller" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Kvartär IDE-kontroller" -msgid "Hard disk" -msgstr "Hårddisk" +msgid "Hard disk controllers" +msgstr "Hårddiskkontroller" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI-styrenheter" msgid "Controller 1:" msgstr "Styrenhet 1:" @@ -555,11 +555,11 @@ msgstr "Hårddiskar:" msgid "Firmware Version" msgstr "Firmware-version" -msgid "&New..." -msgstr "&Ny..." +msgid "&New…" +msgstr "&Ny…" -msgid "&Existing..." -msgstr "&Befintlig..." +msgid "&Existing…" +msgstr "&Befintlig…" msgid "&Remove" msgstr "&Ta bort" @@ -867,9 +867,6 @@ msgstr "Handkontroll med fyra knappar" msgid "6-button gamepad" msgstr "Handkontroll med sex knappar" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Styrspak med två knappar" @@ -897,51 +894,6 @@ msgstr "ratt (tre axlar, tre knappar)" msgid "Steering wheel (3-axis, 4-button)" msgstr "ratt (tre axlar, fyra knappar)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH-pedaler" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH-pedaler Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH-pedaler" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH-pedaler Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH-pedaler" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH-pedaler Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH-pedaler" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH-pedaler Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 med adapter" @@ -996,11 +948,17 @@ msgstr "Intern enhet" msgid "&File" msgstr "&Fil" -msgid "&New machine..." -msgstr "&Ny maskin..." +msgid "&New machine…" +msgstr "&Ny maskin…" + +msgid "New machine…" +msgstr "Ny maskin…" -msgid "&Check for updates..." -msgstr "&Leta efter uppdateringar..." +msgid "New machine" +msgstr "Ny maskin" + +msgid "&Check for updates…" +msgstr "&Leta efter uppdateringar…" msgid "Exit" msgstr "Avsluta" @@ -1251,26 +1209,26 @@ msgstr "Ställ in visningsnamn" msgid "Enter the new display name (blank to reset)" msgstr "Ange nytt visningsnamn (tom för att återställa)" -msgid "Change &display name..." -msgstr "Ändra &visningsnamn..." +msgid "Change &display name…" +msgstr "Ändra &visningsnamn…" msgid "Context Menu" msgstr "Innehållsmeny" -msgid "&Open folder..." -msgstr "&Öppna mapp..." +msgid "&Open folder…" +msgstr "&Öppna mapp…" -msgid "Open p&rinter tray..." -msgstr "Öppna &skrivarfack..." +msgid "Open p&rinter tray…" +msgstr "Öppna &skrivarfack…" -msgid "Set &icon..." -msgstr "Ställ in &ikon..." +msgid "Set &icon…" +msgstr "Ställ in &ikon…" msgid "Select an icon" msgstr "Välj en ikon" -msgid "C&lone..." -msgstr "K&lona..." +msgid "C&lone…" +msgstr "K&lona…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Virtuell maskin \"%1\" (%2) kommer att klonas till:" @@ -1356,8 +1314,8 @@ msgstr "Inga skärmbilder" msgid "Search" msgstr "Sök" -msgid "Searching for VMs..." -msgstr "Söker efter VM..." +msgid "Searching for VMs…" +msgstr "Söker efter VM…" msgid "Found %1" msgstr "Hittade %1" @@ -1392,11 +1350,11 @@ msgstr "Hårddisk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL eller ESDI CD-ROM-enheter fanns aldrig" -msgid "Custom..." -msgstr "Egen..." +msgid "Custom…" +msgstr "Egen…" -msgid "Custom (large)..." -msgstr "Egen (stor)..." +msgid "Custom (large)…" +msgstr "Egen (stor)…" msgid "Add New Hard Disk" msgstr "Lägg till ny hårddisk" @@ -1515,21 +1473,6 @@ msgstr "Tidsstämpeln på moders- och dotterdisken stämmer inte överens" msgid "Could not fix VHD timestamp." msgstr "Kunde inte laga tidsstämpeln på VHDn." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "Plattverktyg" msgid "About &Qt" msgstr "Om &Qt" -msgid "&MCA devices..." -msgstr "MCA-enheter..." +msgid "&MCA devices…" +msgstr "MCA-enheter…" msgid "Show non-&primary monitors" msgstr "Visa icke-primära skärmar" -msgid "Open screenshots &folder..." -msgstr "Öppna skärmbildsmappen..." +msgid "Open screenshots &folder…" +msgstr "Öppna skärmbildsmappen…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Tillämpa sträckläge för helskärm när den är maximerad" @@ -1707,8 +1650,8 @@ msgstr "&Ansluten" msgid "Clear image &history" msgstr "Rensa historik för avbildningar" -msgid "Create..." -msgstr "Skapa..." +msgid "Create…" +msgstr "Skapa…" msgid "Host CD/DVD Drive (%1)" msgstr "Värdenhet för CD/DVD (%1)" @@ -1749,8 +1692,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Ta bort" -msgid "Browse..." -msgstr "Bläddra..." +msgid "Browse…" +msgstr "Bläddra…" msgid "Couldn't create OpenGL context." msgstr "Kunde inte skapa OpenGL-sammanhang." @@ -1839,8 +1782,8 @@ msgstr "Serieport passthrough 3" msgid "Serial port passthrough 4" msgstr "Serieport passthrough 4" -msgid "Renderer &options..." -msgstr "Renderingsalternativ..." +msgid "Renderer &options…" +msgstr "Renderingsalternativ…" msgid "PC/XT Keyboard" msgstr "PC/XT-tangentbord" @@ -1977,6 +1920,9 @@ msgstr "IRQ för serieport" msgid "Parallel port IRQ" msgstr "IRQ för parallelport" +msgid "Hard disk" +msgstr "Hårddisk" + msgid "BIOS Revision" msgstr "BIOS-revision" @@ -2052,9 +1998,6 @@ msgstr "MIDI genom" msgid "MIDI Clockout" msgstr "MIDI utklockning" -msgid "SoundFont" -msgstr "Ljudsnitt" - msgid "Output Gain" msgstr "Förstärkning av utmatning" @@ -2964,8 +2907,8 @@ msgstr "Besök nedladdningssida" msgid "Update check" msgstr "Leta efter uppdateringar" -msgid "Checking for updates..." -msgstr "Letar efter uppdateringar..." +msgid "Checking for updates…" +msgstr "Letar efter uppdateringar…" msgid "86Box Update" msgstr "86Box-uppdatering" @@ -3003,8 +2946,8 @@ msgstr "Ljusstyrka" msgid "Sharpness" msgstr "Skärpa" -msgid "&CGA composite settings..." -msgstr "Inställningar för &CGA-kompositläget..." +msgid "&CGA composite settings…" +msgstr "Inställningar för &CGA-kompositläget…" msgid "CGA composite settings" msgstr "Inställningar för CGA-kompositläget" @@ -3012,8 +2955,8 @@ msgstr "Inställningar för CGA-kompositläget" msgid "Monitor EDID" msgstr "EDID för bildskärm" -msgid "Export..." -msgstr "Exportera..." +msgid "Export…" +msgstr "Exportera…" msgid "Export EDID" msgstr "Exportera EDID" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index ac4f83acfec..91301e0b3c1 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -66,8 +66,8 @@ msgstr "OpenG&L (Sürüm 3.0)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Pencere &boyutunu belirle..." +msgid "Specify &dimensions…" +msgstr "Pencere &boyutunu belirle…" msgid "Force &4:3 display ratio" msgstr "&4:3 görüntü oranına zorla" @@ -192,11 +192,11 @@ msgstr "&Ortam" msgid "&Tools" msgstr "&Araçlar" -msgid "&Settings..." -msgstr "&Ayarlar..." +msgid "&Settings…" +msgstr "&Ayarlar…" -msgid "Settings..." -msgstr "Ayarlar..." +msgid "Settings…" +msgstr "Ayarlar…" msgid "&Update status bar icons" msgstr "Durum &çubuğu simgelerini güncelle" @@ -207,14 +207,14 @@ msgstr "&Ekran görüntüsü al" msgid "S&ound" msgstr "&Ses" -msgid "&Preferences..." -msgstr "&Tercihler..." +msgid "&Preferences…" +msgstr "&Tercihler…" msgid "Enable &Discord integration" msgstr "&Discord entegrasyonunu etkinleştir" -msgid "Sound &gain..." -msgstr "&Sesi artır..." +msgid "Sound &gain…" +msgstr "&Sesi artır…" msgid "Begin trace" msgstr "İzlemeyi başlat" @@ -225,20 +225,20 @@ msgstr "İzlemeyi bitir" msgid "&Help" msgstr "&Yardım" -msgid "&Documentation..." -msgstr "&Belgeler..." +msgid "&Documentation…" +msgstr "&Belgeler…" -msgid "&About 86Box..." -msgstr "&86Box hakkında..." +msgid "&About 86Box…" +msgstr "&86Box hakkında…" -msgid "&New image..." -msgstr "&Yeni görüntü oluştur..." +msgid "&New image…" +msgstr "&Yeni görüntü oluştur…" -msgid "&Existing image..." -msgstr "&Görüntü seç..." +msgid "&Existing image…" +msgstr "&Görüntü seç…" -msgid "Existing image (&Write-protected)..." -msgstr "Görüntü &seç (Yazma korumalı)..." +msgid "Existing image (&Write-protected)…" +msgstr "Görüntü &seç (Yazma korumalı)…" msgid "&Record" msgstr "&Kaydet" @@ -255,11 +255,11 @@ msgstr "Sona &doğru sar" msgid "E&ject" msgstr "&Çıkar" -msgid "&Image..." -msgstr "&Görüntü seç..." +msgid "&Image…" +msgstr "&Görüntü seç…" -msgid "E&xport to 86F..." -msgstr "&86F olarak kaydet..." +msgid "E&xport to 86F…" +msgstr "&86F olarak kaydet…" msgid "&Mute" msgstr "&Sessize al" @@ -270,8 +270,8 @@ msgstr "Görüntüyü &çıkar" msgid "Reload previous image" msgstr "Önceki görüntüyü yeniden seç" -msgid "&Folder..." -msgstr "&Klasör seç..." +msgid "&Folder…" +msgstr "&Klasör seç…" msgid "Preferences" msgstr "Tercihler" @@ -417,17 +417,17 @@ msgstr "Oyun Kolu:" msgid "Joystick" msgstr "Oyun Kolu" -msgid "Joystick 1..." -msgstr "1. Oyun Kolu..." +msgid "Joystick 1…" +msgstr "1. Oyun Kolu…" -msgid "Joystick 2..." -msgstr "2. Oyun Kolu..." +msgid "Joystick 2…" +msgstr "2. Oyun Kolu…" -msgid "Joystick 3..." -msgstr "3. Oyun Kolu..." +msgid "Joystick 3…" +msgstr "3. Oyun Kolu…" -msgid "Joystick 4..." -msgstr "4. Oyun Kolu..." +msgid "Joystick 4…" +msgstr "4. Oyun Kolu…" msgid "Sound card #1:" msgstr "1. Ses Kartı:" @@ -516,23 +516,23 @@ msgstr "3. Paralel bağlantı noktası" msgid "Parallel port 4" msgstr "4. Paralel bağlantı noktası" -msgid "FD Controller:" -msgstr "Disket Denetleyicisi:" +msgid "Floppy disk controller:" +msgstr "Disket denetleyicisi:" -msgid "CD-ROM Controller:" -msgstr "CD-ROM Denetleyicisi:" +msgid "CD-ROM controller:" +msgstr "CD-ROM denetleyicisi:" -msgid "Tertiary IDE Controller" -msgstr "Üçüncül IDE Denetleyicisi" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Üçüncül IDE denetleyicisi" -msgid "Quaternary IDE Controller" -msgstr "Dördüncül IDE Denetleyicisi" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Dördüncül IDE denetleyicisi" -msgid "Hard disk" -msgstr "Sabit disk" +msgid "Hard disk controllers" +msgstr "Sabit disk denetleyicileri" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI denetleyicileri" msgid "Controller 1:" msgstr "1. Denetleyici:" @@ -555,11 +555,11 @@ msgstr "Sabit diskler:" msgid "Firmware Version" msgstr "Bellenim Sürümü" -msgid "&New..." -msgstr "&Yeni görüntü oluştur..." +msgid "&New…" +msgstr "&Yeni görüntü oluştur…" -msgid "&Existing..." -msgstr "&Görüntü dosyası seç..." +msgid "&Existing…" +msgstr "&Görüntü dosyası seç…" msgid "&Remove" msgstr "&Kaldır" @@ -867,9 +867,6 @@ msgstr "4 düğmeli oyun tablası" msgid "6-button gamepad" msgstr "6 düğmeli oyun tablası" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2 düğmeli uçuş dümeni" @@ -897,51 +894,6 @@ msgstr "direksiyonu (3 eksenli, 3 düğmeli)" msgid "Steering wheel (3-axis, 4-button)" msgstr "direksiyonu (3 eksenli, 4 düğmeli)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Adaptörlü Thrustmaster Formula T1/T2" @@ -996,11 +948,17 @@ msgstr "Dahili cihaz" msgid "&File" msgstr "&Dosya" -msgid "&New machine..." -msgstr "&Yeni makine..." +msgid "&New machine…" +msgstr "&Yeni makine…" + +msgid "New machine…" +msgstr "Yeni makine…" -msgid "&Check for updates..." -msgstr "&Güncelleştirmeleri kontrol et..." +msgid "New machine" +msgstr "Yeni makine" + +msgid "&Check for updates…" +msgstr "&Güncelleştirmeleri kontrol et…" msgid "Exit" msgstr "Çıkış yap" @@ -1251,26 +1209,26 @@ msgstr "Görüntü adını ayarla" msgid "Enter the new display name (blank to reset)" msgstr "Yeni görünü adını girin (sıfırlamak için boş bırakın)" -msgid "Change &display name..." -msgstr "Görüntü adını &değiştirin..." +msgid "Change &display name…" +msgstr "Görüntü adını &değiştirin…" msgid "Context Menu" msgstr "Bağlam Menüsü" -msgid "&Open folder..." -msgstr "Klas&örü aç..." +msgid "&Open folder…" +msgstr "Klas&örü aç…" -msgid "Open p&rinter tray..." -msgstr "Yazıcı te&psisini aç..." +msgid "Open p&rinter tray…" +msgstr "Yazıcı te&psisini aç…" -msgid "Set &icon..." -msgstr "S&imge seç..." +msgid "Set &icon…" +msgstr "S&imge seç…" msgid "Select an icon" msgstr "Bir simge seç" -msgid "C&lone..." -msgstr "K&lonla..." +msgid "C&lone…" +msgstr "K&lonla…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Sanal makine \"%1\" (%2) şuraya klonlanacaktır:" @@ -1356,8 +1314,8 @@ msgstr "Ekran görüntüsü yok" msgid "Search" msgstr "Ara" -msgid "Searching for VMs..." -msgstr "VM'ler aranıyor..." +msgid "Searching for VMs…" +msgstr "VM'ler aranıyor…" msgid "Found %1" msgstr "%1 bulundu" @@ -1392,11 +1350,11 @@ msgstr "Sabit disk (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL veya ESDI CD-ROM sürücüleri hiçbir zaman kullanılmamıştır" -msgid "Custom..." -msgstr "Diğer..." +msgid "Custom…" +msgstr "Diğer…" -msgid "Custom (large)..." -msgstr "Diğer (büyük)..." +msgid "Custom (large)…" +msgstr "Diğer (büyük)…" msgid "Add New Hard Disk" msgstr "Yeni Sabit Disk Görüntüsü Oluştur" @@ -1515,21 +1473,6 @@ msgstr "Ana ve ek disklerin zaman damgaları uyuşmuyor" msgid "Could not fix VHD timestamp." msgstr "VHD'nin zaman damgası düzeltilemedi." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "Tablet aracı" msgid "About &Qt" msgstr "&Qt hakkında" -msgid "&MCA devices..." -msgstr "MCA cihazları..." +msgid "&MCA devices…" +msgstr "MCA cihazları…" msgid "Show non-&primary monitors" msgstr "Birincil olmayan monitörleri göster" -msgid "Open screenshots &folder..." -msgstr "Ekran görüntüsü klasörünü aç..." +msgid "Open screenshots &folder…" +msgstr "Ekran görüntüsü klasörünü aç…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Büyütüldüğünde tam ekran germe modunu uygula" @@ -1707,8 +1650,8 @@ msgstr "&Bağlı" msgid "Clear image &history" msgstr "Görüntü geçmişini temizle" -msgid "Create..." -msgstr "Oluştur..." +msgid "Create…" +msgstr "Oluştur…" msgid "Host CD/DVD Drive (%1)" msgstr "Ana bilgisayar CD/DVD sürücüsü (%1)" @@ -1749,8 +1692,8 @@ msgstr "Gölgelendiriciler" msgid "Remove" msgstr "Kaldır" -msgid "Browse..." -msgstr "Göz at..." +msgid "Browse…" +msgstr "Göz at…" msgid "Couldn't create OpenGL context." msgstr "OpenGL bağlamı oluşturulamadı." @@ -1839,8 +1782,8 @@ msgstr "3. Seri bağlantı noktası geçişi" msgid "Serial port passthrough 4" msgstr "4. Seri bağlantı noktası geçişi" -msgid "Renderer &options..." -msgstr "Derleyici seçenekleri..." +msgid "Renderer &options…" +msgstr "Derleyici seçenekleri…" msgid "PC/XT Keyboard" msgstr "PC/XT Klavyesi" @@ -1977,6 +1920,9 @@ msgstr "Seri bağlantı noktası IRQ'su" msgid "Parallel port IRQ" msgstr "Paralel bağlantı noktası IRQ'su" +msgid "Hard disk" +msgstr "Sabit disk" + msgid "BIOS Revision" msgstr "BIOS Revizyonu" @@ -2052,9 +1998,6 @@ msgstr "MIDI Geçişi" msgid "MIDI Clockout" msgstr "MIDI Saat Çıkışı" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Çıkış Sesi Artışı" @@ -2964,8 +2907,8 @@ msgstr "İndirme sayfasını ziyaret et" msgid "Update check" msgstr "Güncelleme kontrolü" -msgid "Checking for updates..." -msgstr "Güncellemeler kontrol ediliyor..." +msgid "Checking for updates…" +msgstr "Güncellemeler kontrol ediliyor…" msgid "86Box Update" msgstr "86Box Güncellemesi" @@ -3003,8 +2946,8 @@ msgstr "Parlaklık" msgid "Sharpness" msgstr "Keskinlik" -msgid "&CGA composite settings..." -msgstr "&CGA kompozit modunun ayarları..." +msgid "&CGA composite settings…" +msgstr "&CGA kompozit modunun ayarları…" msgid "CGA composite settings" msgstr "CGA kompozit modunun ayarları" @@ -3012,8 +2955,8 @@ msgstr "CGA kompozit modunun ayarları" msgid "Monitor EDID" msgstr "Monitörün EDID'si" -msgid "Export..." -msgstr "Dışa aktar..." +msgid "Export…" +msgstr "Dışa aktar…" msgid "Export EDID" msgstr "EDID'i dışa aktar" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index b29619ae136..49eac891c6d 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -74,8 +74,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "&Вказати розміри..." +msgid "Specify &dimensions…" +msgstr "&Вказати розміри…" msgid "Force &4:3 display ratio" msgstr "Встановити відношення сторін &4:3" @@ -200,11 +200,11 @@ msgstr "&Носії" msgid "&Tools" msgstr "&Інструменти" -msgid "&Settings..." -msgstr "&Налаштування машини..." +msgid "&Settings…" +msgstr "&Налаштування машини…" -msgid "Settings..." -msgstr "Налаштування машини..." +msgid "Settings…" +msgstr "Налаштування машини…" msgid "&Update status bar icons" msgstr "&Обновлення значків рядка стану" @@ -215,14 +215,14 @@ msgstr "Зробити &знімок" msgid "S&ound" msgstr "&Звук" -msgid "&Preferences..." -msgstr "&Параметри..." +msgid "&Preferences…" +msgstr "&Параметри…" msgid "Enable &Discord integration" msgstr "Увімкнути інтеграцію &Discord" -msgid "Sound &gain..." -msgstr "&Посилення звуку..." +msgid "Sound &gain…" +msgstr "&Посилення звуку…" msgid "Begin trace" msgstr "Почати трасування" @@ -233,20 +233,20 @@ msgstr "Завершити трасування" msgid "&Help" msgstr "&Допомога" -msgid "&Documentation..." -msgstr "&Документація..." +msgid "&Documentation…" +msgstr "&Документація…" -msgid "&About 86Box..." -msgstr "&Про програму 86Box..." +msgid "&About 86Box…" +msgstr "&Про програму 86Box…" -msgid "&New image..." -msgstr "&Новий образ..." +msgid "&New image…" +msgstr "&Новий образ…" -msgid "&Existing image..." -msgstr "&Вибрати образ..." +msgid "&Existing image…" +msgstr "&Вибрати образ…" -msgid "Existing image (&Write-protected)..." -msgstr "Вибрати образ (&Захист від запису)..." +msgid "Existing image (&Write-protected)…" +msgstr "Вибрати образ (&Захист від запису)…" msgid "&Record" msgstr "&Запис" @@ -263,11 +263,11 @@ msgstr "&Перемотування у кінець" msgid "E&ject" msgstr "&Вилучити" -msgid "&Image..." -msgstr "&Образ..." +msgid "&Image…" +msgstr "&Образ…" -msgid "E&xport to 86F..." -msgstr "&Експорт в 86F..." +msgid "E&xport to 86F…" +msgstr "&Експорт в 86F…" msgid "&Mute" msgstr "&Відключити звук" @@ -278,8 +278,8 @@ msgstr "&Пустий" msgid "Reload previous image" msgstr "Знову завантажити попередній образ" -msgid "&Folder..." -msgstr "&Тека..." +msgid "&Folder…" +msgstr "&Тека…" msgid "Preferences" msgstr "Параметри" @@ -425,17 +425,17 @@ msgstr "Джойстик:" msgid "Joystick" msgstr "Джойстик" -msgid "Joystick 1..." -msgstr "Джойстик 1..." +msgid "Joystick 1…" +msgstr "Джойстик 1…" -msgid "Joystick 2..." -msgstr "Джойстик 2..." +msgid "Joystick 2…" +msgstr "Джойстик 2…" -msgid "Joystick 3..." -msgstr "Джойстик 3..." +msgid "Joystick 3…" +msgstr "Джойстик 3…" -msgid "Joystick 4..." -msgstr "Джойстик 4..." +msgid "Joystick 4…" +msgstr "Джойстик 4…" msgid "Sound card #1:" msgstr "Звукова карта 1:" @@ -524,23 +524,23 @@ msgstr "Паралельний порт LPT3" msgid "Parallel port 4" msgstr "Паралельний порт LPT4" -msgid "FD Controller:" -msgstr "Контролер FD:" +msgid "Floppy disk controller:" +msgstr "Контролер гнучких дисків:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Контролер CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Третинний IDE контролер" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Третинний контролер IDE" -msgid "Quaternary IDE Controller" -msgstr "Четвертинний IDE контролер" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Четвертинний контролер IDE" -msgid "Hard disk" -msgstr "Жорсткий диск" +msgid "Hard disk controllers" +msgstr "Контролери жорстких дисків" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Контролери SCSI" msgid "Controller 1:" msgstr "Контролер 1:" @@ -563,11 +563,11 @@ msgstr "Жорсткі диски:" msgid "Firmware Version" msgstr "Версія прошивки" -msgid "&New..." -msgstr "&Створити..." +msgid "&New…" +msgstr "&Створити…" -msgid "&Existing..." -msgstr "&Вибрати..." +msgid "&Existing…" +msgstr "&Вибрати…" msgid "&Remove" msgstr "&Прибрати" @@ -875,9 +875,6 @@ msgstr "4-кнопковий геймпад" msgid "6-button gamepad" msgstr "6-кнопковий геймпад" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2-кнопковий flight yoke" @@ -905,51 +902,6 @@ msgstr "Кермо (3-осьове, 3-кнопкове)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Кермо (3-осьове, 4-кнопкове)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Педалі" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Педалі Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Педалі" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Педалі Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Педалі" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Педалі Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Педалі" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Педалі Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Система управління польотом Thrustmaster" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Система управління кермом" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 з адаптером" @@ -1004,11 +956,17 @@ msgstr "Вбудований пристрій" msgid "&File" msgstr "&Файл" -msgid "&New machine..." -msgstr "&Нова машина..." +msgid "&New machine…" +msgstr "&Нова машина…" + +msgid "New machine…" +msgstr "Нова машина…" -msgid "&Check for updates..." -msgstr "&Перевірити оновлення..." +msgid "New machine" +msgstr "Нова машина" + +msgid "&Check for updates…" +msgstr "&Перевірити оновлення…" msgid "Exit" msgstr "Вихід" @@ -1259,26 +1217,26 @@ msgstr "Встановити відображуване ім'я" msgid "Enter the new display name (blank to reset)" msgstr "Введіть нове відображуване ім'я (порожнє, щоб скинути)" -msgid "Change &display name..." -msgstr "Змінити &відображуване ім'я..." +msgid "Change &display name…" +msgstr "Змінити &відображуване ім'я…" msgid "Context Menu" msgstr "Контекстне меню" -msgid "&Open folder..." -msgstr "&Відкрити папку..." +msgid "&Open folder…" +msgstr "&Відкрити папку…" -msgid "Open p&rinter tray..." -msgstr "Відкрити папку &принтера..." +msgid "Open p&rinter tray…" +msgstr "Відкрити папку &принтера…" -msgid "Set &icon..." -msgstr "Встановити &значок..." +msgid "Set &icon…" +msgstr "Встановити &значок…" msgid "Select an icon" msgstr "Виберіть значок" -msgid "C&lone..." -msgstr "К&лонувати..." +msgid "C&lone…" +msgstr "К&лонувати…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Віртуальна машина «%1» (%2) буде клонована в:" @@ -1364,8 +1322,8 @@ msgstr "Немає скріншоту" msgid "Search" msgstr "Пошук" -msgid "Searching for VMs..." -msgstr "Пошук віртуальних машин..." +msgid "Searching for VMs…" +msgstr "Пошук віртуальних машин…" msgid "Found %1" msgstr "Знайдено %1" @@ -1400,11 +1358,11 @@ msgstr "Жорсткий диск (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL або ESDI дисководів CD-ROM ніколи не існувало" -msgid "Custom..." -msgstr "Задати вручну..." +msgid "Custom…" +msgstr "Задати вручну…" -msgid "Custom (large)..." -msgstr "Задати вручну (large)..." +msgid "Custom (large)…" +msgstr "Задати вручну (large)…" msgid "Add New Hard Disk" msgstr "Створити новий жорсткий диск" @@ -1523,21 +1481,6 @@ msgstr "Тимчасові мітки батьківського та дочір msgid "Could not fix VHD timestamp." msgstr "Не вдалося виправити тимчасову позначку VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1688,14 +1631,14 @@ msgstr "Інструмент для планшета" msgid "About &Qt" msgstr "Про &Qt" -msgid "&MCA devices..." -msgstr "Пристрої &MCA..." +msgid "&MCA devices…" +msgstr "Пристрої &MCA…" msgid "Show non-&primary monitors" msgstr "Показати неосновні монітори" -msgid "Open screenshots &folder..." -msgstr "Відкрийте папку скріншотів..." +msgid "Open screenshots &folder…" +msgstr "Відкрийте папку скріншотів…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Застосовувати розстягування у повноекранному режимі у максимізованому стані" @@ -1715,8 +1658,8 @@ msgstr "&Підключено" msgid "Clear image &history" msgstr "Очистити історію образів" -msgid "Create..." -msgstr "Створити..." +msgid "Create…" +msgstr "Створити…" msgid "Host CD/DVD Drive (%1)" msgstr "CD/DVD привід хоста (%1)" @@ -1757,8 +1700,8 @@ msgstr "Шейдери" msgid "Remove" msgstr "Видалити" -msgid "Browse..." -msgstr "Огляд..." +msgid "Browse…" +msgstr "Огляд…" msgid "Couldn't create OpenGL context." msgstr "Не вдалося створити контекст OpenGL." @@ -1847,8 +1790,8 @@ msgstr "Пропуск послідовного порту 3" msgid "Serial port passthrough 4" msgstr "Пропуск послідовного порту 4" -msgid "Renderer &options..." -msgstr "Параметри рендерингу..." +msgid "Renderer &options…" +msgstr "Параметри рендерингу…" msgid "PC/XT Keyboard" msgstr "Клавіатура PC/XT" @@ -1985,6 +1928,9 @@ msgstr "IRQ послідовного порту" msgid "Parallel port IRQ" msgstr "IRQ паралельного порту" +msgid "Hard disk" +msgstr "Жорсткий диск" + msgid "BIOS Revision" msgstr "Ревізія BIOS" @@ -2060,9 +2006,6 @@ msgstr "Прохід MIDI-вхіду" msgid "MIDI Clockout" msgstr "Вихід MIDI-годинника" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "Вихідний коефіцієнт підсилення" @@ -2972,8 +2915,8 @@ msgstr "Відкрити сторінку завантаження" msgid "Update check" msgstr "Перевірка оновлень" -msgid "Checking for updates..." -msgstr "Перевірка оновлень..." +msgid "Checking for updates…" +msgstr "Перевірка оновлень…" msgid "86Box Update" msgstr "Оновлення 86Box" @@ -3011,8 +2954,8 @@ msgstr "Яскравість" msgid "Sharpness" msgstr "Гострота" -msgid "&CGA composite settings..." -msgstr "Налаштування композитного відео &CGA..." +msgid "&CGA composite settings…" +msgstr "Налаштування композитного відео &CGA…" msgid "CGA composite settings" msgstr "Налаштування композитного відео CGA" @@ -3020,8 +2963,8 @@ msgstr "Налаштування композитного відео CGA" msgid "Monitor EDID" msgstr "EDID монітора" -msgid "Export..." -msgstr "Експорт..." +msgid "Export…" +msgstr "Експорт…" msgid "Export EDID" msgstr "Експорт EDID" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index ac374e389be..8cecc1a1278 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -66,8 +66,8 @@ msgstr "Open&GL (3.0 Core)" msgid "&VNC" msgstr "&VNC" -msgid "Specify &dimensions..." -msgstr "Tự nhập độ &phân giải..." +msgid "Specify &dimensions…" +msgstr "Tự nhập độ &phân giải…" msgid "Force &4:3 display ratio" msgstr "Giữ nguyên khung hình &4:3" @@ -192,11 +192,11 @@ msgstr "&Phương tiện" msgid "&Tools" msgstr "&Công cụ" -msgid "&Settings..." -msgstr "&Cài đặt..." +msgid "&Settings…" +msgstr "&Cài đặt…" -msgid "Settings..." -msgstr "Cài đặt..." +msgid "Settings…" +msgstr "Cài đặt…" msgid "&Update status bar icons" msgstr "Cậ&p nhật biểu tượng thanh trạng thái" @@ -207,14 +207,14 @@ msgstr "Chụp &màn hình" msgid "S&ound" msgstr "&Âm thanh" -msgid "&Preferences..." -msgstr "&Tùy biến..." +msgid "&Preferences…" +msgstr "&Tùy biến…" msgid "Enable &Discord integration" msgstr "Bật trình trạng thái cho Discord" -msgid "Sound &gain..." -msgstr "Bộ &tăng âm..." +msgid "Sound &gain…" +msgstr "Bộ &tăng âm…" msgid "Begin trace" msgstr "Bắt đầu dò" @@ -225,20 +225,20 @@ msgstr "Ngưng dò" msgid "&Help" msgstr "&Trợ giúp" -msgid "&Documentation..." -msgstr "&Trợ giúp..." +msgid "&Documentation…" +msgstr "&Trợ giúp…" -msgid "&About 86Box..." -msgstr "&Về 86Box..." +msgid "&About 86Box…" +msgstr "&Về 86Box…" -msgid "&New image..." -msgstr "Tạo file ảnh đĩa mới..." +msgid "&New image…" +msgstr "Tạo file ảnh đĩa mới…" -msgid "&Existing image..." -msgstr "Ảnh đĩa có sẵn..." +msgid "&Existing image…" +msgstr "Ảnh đĩa có sẵn…" -msgid "Existing image (&Write-protected)..." -msgstr "Ảnh đĩa có sẵn (chống ghi đè)..." +msgid "Existing image (&Write-protected)…" +msgstr "Ảnh đĩa có sẵn (chống ghi đè)…" msgid "&Record" msgstr "&Ghi lại" @@ -255,11 +255,11 @@ msgstr "T&iến về cuối" msgid "E&ject" msgstr "Đẩy đĩ&a ra" -msgid "&Image..." -msgstr "&Ảnh đĩa..." +msgid "&Image…" +msgstr "&Ảnh đĩa…" -msgid "E&xport to 86F..." -msgstr "Xuất ra f&ile 86F..." +msgid "E&xport to 86F…" +msgstr "Xuất ra f&ile 86F…" msgid "&Mute" msgstr "Tắt tiến&g" @@ -270,8 +270,8 @@ msgstr "Làm trố&ng đĩa" msgid "Reload previous image" msgstr "Load đĩa trước đó" -msgid "&Folder..." -msgstr "Thư mụ&c..." +msgid "&Folder…" +msgstr "Thư mụ&c…" msgid "Preferences" msgstr "Tùy biến" @@ -417,17 +417,17 @@ msgstr "Cần điều khiển:" msgid "Joystick" msgstr "Cần điều khiển" -msgid "Joystick 1..." -msgstr "Cần điều khiển 1..." +msgid "Joystick 1…" +msgstr "Cần điều khiển 1…" -msgid "Joystick 2..." -msgstr "Cần điều khiển 2..." +msgid "Joystick 2…" +msgstr "Cần điều khiển 2…" -msgid "Joystick 3..." -msgstr "Cần điều khiển 3..." +msgid "Joystick 3…" +msgstr "Cần điều khiển 3…" -msgid "Joystick 4..." -msgstr "Cần điều khiển 4..." +msgid "Joystick 4…" +msgstr "Cần điều khiển 4…" msgid "Sound card #1:" msgstr "Card âm thanh 1:" @@ -516,23 +516,23 @@ msgstr "Cổng parallel 3" msgid "Parallel port 4" msgstr "Cổng parallel 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "Bộ điều khiển ổ mềm:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "Bộ điều khiển CD-ROM:" -msgid "Tertiary IDE Controller" -msgstr "Bộ điều khiển IDE thứ ba" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Bộ điều khiển IDE thứ ba" -msgid "Quaternary IDE Controller" -msgstr "Bộ điều khiển IDE thứ tư" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Bộ điều khiển IDE thứ tư" -msgid "Hard disk" -msgstr "Ổ cứng" +msgid "Hard disk controllers" +msgstr "Bộ điều khiển ổ cứng" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "Bộ điều khiển SCSI" msgid "Controller 1:" msgstr "Bộ điều khiển 1:" @@ -555,11 +555,11 @@ msgstr "Đĩa cứng:" msgid "Firmware Version" msgstr "Phiên bản firmware" -msgid "&New..." -msgstr "Tạ&o mới..." +msgid "&New…" +msgstr "Tạ&o mới…" -msgid "&Existing..." -msgstr "&Có sẵn..." +msgid "&Existing…" +msgstr "&Có sẵn…" msgid "&Remove" msgstr "Loạ&i bỏ" @@ -867,9 +867,6 @@ msgstr "Tay cầm game bốn nút" msgid "6-button gamepad" msgstr "Tay cầm game sáu nút" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "Vô lăng máy bay hai nút" @@ -897,51 +894,6 @@ msgstr "Vô lăng (ba trục, ba nút)" msgid "Steering wheel (3-axis, 4-button)" msgstr "Vô lăng (ba trục, bốn nút)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + bàn giậm CH" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + bàn giậm CH Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + bàn giậm CH" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + bàn giậm CH Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + bàn giậm CH" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + bàn giậm CH Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + bàn giậm CH" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + bàn giậm CH Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Hệ thống bánh lái" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 kèm bộ chuyển đổi" @@ -996,11 +948,17 @@ msgstr "Thiết bị nội bộ" msgid "&File" msgstr "&Tập tin" -msgid "&New machine..." -msgstr "Máy &mới..." +msgid "&New machine…" +msgstr "Máy &mới…" + +msgid "New machine…" +msgstr "Máy mới…" -msgid "&Check for updates..." -msgstr "Kiểm tra &cập nhật..." +msgid "New machine" +msgstr "Máy mới" + +msgid "&Check for updates…" +msgstr "Kiểm tra &cập nhật…" msgid "Exit" msgstr "Thoát" @@ -1251,26 +1209,26 @@ msgstr "Đặt tên hiển thị" msgid "Enter the new display name (blank to reset)" msgstr "Điền tên hiển thị mới (để trống để đặt lại)" -msgid "Change &display name..." -msgstr "Thay đổi tên hiển thị..." +msgid "Change &display name…" +msgstr "Thay đổi tên hiển thị…" msgid "Context Menu" msgstr "Menu ngữ cảnh" -msgid "&Open folder..." -msgstr "Mở thư mục..." +msgid "&Open folder…" +msgstr "Mở thư mục…" -msgid "Open p&rinter tray..." -msgstr "Mở khay máy in..." +msgid "Open p&rinter tray…" +msgstr "Mở khay máy in…" -msgid "Set &icon..." -msgstr "Đặt biểu trưng..." +msgid "Set &icon…" +msgstr "Đặt biểu trưng…" msgid "Select an icon" msgstr "Chọn một biểu trưng" -msgid "C&lone..." -msgstr "Tạo bản sao..." +msgid "C&lone…" +msgstr "Tạo bản sao…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "Máy ảo \"%1\" (%2) sẽ được sao chép vào:" @@ -1356,8 +1314,8 @@ msgstr "Không có ảnh chụp màn hình" msgid "Search" msgstr "Tìm" -msgid "Searching for VMs..." -msgstr "Đang tìm máy ảo..." +msgid "Searching for VMs…" +msgstr "Đang tìm máy ảo…" msgid "Found %1" msgstr "Đã thấy %1" @@ -1392,11 +1350,11 @@ msgstr "Ổ cứng (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "Không hề có ổ CD-ROM MFM/RLL hay ESDI nào tồn tại" -msgid "Custom..." -msgstr "Tùy chỉnh..." +msgid "Custom…" +msgstr "Tùy chỉnh…" -msgid "Custom (large)..." -msgstr "Tùy chỉnh (dung tích lớn)..." +msgid "Custom (large)…" +msgstr "Tùy chỉnh (dung tích lớn)…" msgid "Add New Hard Disk" msgstr "Thêm ổ cứng mới" @@ -1515,21 +1473,6 @@ msgstr "Mốc timestamp của đĩa con (child) và đĩa cha (parent) không tr msgid "Could not fix VHD timestamp." msgstr "Không thể sửa mốc timestamp cho VHD." -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "Công cụ bảng nhập liệu" msgid "About &Qt" msgstr "Về &qt" -msgid "&MCA devices..." -msgstr "Thiết bị MCA..." +msgid "&MCA devices…" +msgstr "Thiết bị MCA…" msgid "Show non-&primary monitors" msgstr "Hiển thị các màn hình phụ" -msgid "Open screenshots &folder..." -msgstr "Mở thư mục ảnh chụp màn hình..." +msgid "Open screenshots &folder…" +msgstr "Mở thư mục ảnh chụp màn hình…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Co giãn toàn màn hình khi cực đại hóa cửa sổ" @@ -1707,8 +1650,8 @@ msgstr "&Đã kết nối" msgid "Clear image &history" msgstr "Xóa lịch sử ảnh đĩa" -msgid "Create..." -msgstr "Tạo..." +msgid "Create…" +msgstr "Tạo…" msgid "Host CD/DVD Drive (%1)" msgstr "Máy chủ CD/DVD Drive (%1)" @@ -1749,8 +1692,8 @@ msgstr "Shaders" msgid "Remove" msgstr "Loại bỏ" -msgid "Browse..." -msgstr "Duyệt..." +msgid "Browse…" +msgstr "Duyệt…" msgid "Couldn't create OpenGL context." msgstr "Không thể tạo bối cảnh OpenGL." @@ -1839,8 +1782,8 @@ msgstr "Thông qua cổng serial 3" msgid "Serial port passthrough 4" msgstr "Thông qua cổng serial 4" -msgid "Renderer &options..." -msgstr "Tùy chọn kết xuất ..." +msgid "Renderer &options…" +msgstr "Tùy chọn kết xuất …" msgid "PC/XT Keyboard" msgstr "Bàn phím PC/XT" @@ -1977,6 +1920,9 @@ msgstr "IRQ cổng serial" msgid "Parallel port IRQ" msgstr "IRQ cổng parallel" +msgid "Hard disk" +msgstr "Ổ cứng" + msgid "BIOS Revision" msgstr "Sửa đổi BIOS" @@ -2052,9 +1998,6 @@ msgstr "Thông qua đầu vào MIDI" msgid "MIDI Clockout" msgstr "MIDI Clockout" -msgid "SoundFont" -msgstr "Font âm thanh" - msgid "Output Gain" msgstr "Tăng đầu ra" @@ -2964,8 +2907,8 @@ msgstr "Truy cập trang tải xuống" msgid "Update check" msgstr "Kiểm tra cập nhật" -msgid "Checking for updates..." -msgstr "Đang kiểm tra cập nhật..." +msgid "Checking for updates…" +msgstr "Đang kiểm tra cập nhật…" msgid "86Box Update" msgstr "Cập nhật 86Box" @@ -3003,8 +2946,8 @@ msgstr "Độ sáng" msgid "Sharpness" msgstr "Độ sắc nét" -msgid "&CGA composite settings..." -msgstr "Cài đặt chế độ tổng hợp &CGA..." +msgid "&CGA composite settings…" +msgstr "Cài đặt chế độ tổng hợp &CGA…" msgid "CGA composite settings" msgstr "Cài đặt chế độ tổng hợp CGA" @@ -3012,8 +2955,8 @@ msgstr "Cài đặt chế độ tổng hợp CGA" msgid "Monitor EDID" msgstr "EDID của màn hình" -msgid "Export..." -msgstr "Xuất khẩu..." +msgid "Export…" +msgstr "Xuất khẩu…" msgid "Export EDID" msgstr "Xuất khẩu EDID" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 70ac91e3f72..cf31d697500 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -66,8 +66,8 @@ msgstr "OpenGL (3.0 Core)(&G)" msgid "&VNC" msgstr "VNC(&V)" -msgid "Specify &dimensions..." -msgstr "指定窗口大小(&D)..." +msgid "Specify &dimensions…" +msgstr "指定窗口大小(&D)…" msgid "Force &4:3 display ratio" msgstr "强制 4:3 显示比例(&4)" @@ -192,11 +192,11 @@ msgstr "介质(&M)" msgid "&Tools" msgstr "工具(&T)" -msgid "&Settings..." -msgstr "设置(&S)..." +msgid "&Settings…" +msgstr "设置(&S)…" -msgid "Settings..." -msgstr "设置..." +msgid "Settings…" +msgstr "设置…" msgid "&Update status bar icons" msgstr "更新状态栏图标(&U)" @@ -207,14 +207,14 @@ msgstr "截图(&C)" msgid "S&ound" msgstr "声音(&O)" -msgid "&Preferences..." -msgstr "首选项(&P)..." +msgid "&Preferences…" +msgstr "首选项(&P)…" msgid "Enable &Discord integration" msgstr "启用 Discord 集成(&D)" -msgid "Sound &gain..." -msgstr "音量增益(&G)..." +msgid "Sound &gain…" +msgstr "音量增益(&G)…" msgid "Begin trace" msgstr "开始追踪" @@ -225,20 +225,20 @@ msgstr "结束追踪" msgid "&Help" msgstr "帮助(&H)" -msgid "&Documentation..." -msgstr "文档(&D)..." +msgid "&Documentation…" +msgstr "文档(&D)…" -msgid "&About 86Box..." -msgstr "关于 86Box(&A)..." +msgid "&About 86Box…" +msgstr "关于 86Box(&A)…" -msgid "&New image..." -msgstr "新建映像(&N)..." +msgid "&New image…" +msgstr "新建映像(&N)…" -msgid "&Existing image..." -msgstr "打开已存在的映像(&E)..." +msgid "&Existing image…" +msgstr "打开已存在的映像(&E)…" -msgid "Existing image (&Write-protected)..." -msgstr "打开已存在的映像并写保护(&W)..." +msgid "Existing image (&Write-protected)…" +msgstr "打开已存在的映像并写保护(&W)…" msgid "&Record" msgstr "录制(&R)" @@ -255,11 +255,11 @@ msgstr "快进至终点(&F)" msgid "E&ject" msgstr "弹出(&J)" -msgid "&Image..." -msgstr "映像(&I)..." +msgid "&Image…" +msgstr "映像(&I)…" -msgid "E&xport to 86F..." -msgstr "导出为 86F 格式(&x)..." +msgid "E&xport to 86F…" +msgstr "导出为 86F 格式(&x)…" msgid "&Mute" msgstr "静音(&M)" @@ -270,8 +270,8 @@ msgstr "空置驱动器(&M)" msgid "Reload previous image" msgstr "载入上一个映像" -msgid "&Folder..." -msgstr "文件夹(&F)..." +msgid "&Folder…" +msgstr "文件夹(&F)…" msgid "Preferences" msgstr "首选项" @@ -417,17 +417,17 @@ msgstr "操纵杆:" msgid "Joystick" msgstr "操纵杆" -msgid "Joystick 1..." -msgstr "操纵杆 1..." +msgid "Joystick 1…" +msgstr "操纵杆 1…" -msgid "Joystick 2..." -msgstr "操纵杆 2..." +msgid "Joystick 2…" +msgstr "操纵杆 2…" -msgid "Joystick 3..." -msgstr "操纵杆 3..." +msgid "Joystick 3…" +msgstr "操纵杆 3…" -msgid "Joystick 4..." -msgstr "操纵杆 4..." +msgid "Joystick 4…" +msgstr "操纵杆 4…" msgid "Sound card #1:" msgstr "声卡 1:" @@ -516,23 +516,23 @@ msgstr "并口 3" msgid "Parallel port 4" msgstr "并口 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "软盘控制器:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROM 控制器:" -msgid "Tertiary IDE Controller" -msgstr "第三 IDE 控制器" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] 第三 IDE 控制器" -msgid "Quaternary IDE Controller" -msgstr "第四 IDE 控制器" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] 第四 IDE 控制器" -msgid "Hard disk" -msgstr "硬盘" +msgid "Hard disk controllers" +msgstr "硬盘控制器" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI 控制器" msgid "Controller 1:" msgstr "控制器 1:" @@ -555,11 +555,11 @@ msgstr "硬盘:" msgid "Firmware Version" msgstr "固件版本" -msgid "&New..." -msgstr "新建(&N)..." +msgid "&New…" +msgstr "新建(&N)…" -msgid "&Existing..." -msgstr "现有(&E)..." +msgid "&Existing…" +msgstr "现有(&E)…" msgid "&Remove" msgstr "移除(&R)" @@ -867,9 +867,6 @@ msgstr "4 按钮游戏手柄" msgid "6-button gamepad" msgstr "6 按钮游戏手柄" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2 按钮飞行摇杆" @@ -897,51 +894,6 @@ msgstr "方向盘 (3 轴, 3 键)" msgid "Steering wheel (3-axis, 4-button)" msgstr "方向盘 (3 轴, 4 键)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "带适配器的 Thrustmaster Formula T1/T2" @@ -996,11 +948,17 @@ msgstr "内部设备" msgid "&File" msgstr "文件(&F)" -msgid "&New machine..." -msgstr "新建计算机(&N)..." +msgid "&New machine…" +msgstr "新建计算机(&N)…" + +msgid "New machine…" +msgstr "新建计算机…" -msgid "&Check for updates..." -msgstr "检查更新(&C)..." +msgid "New machine" +msgstr "新建计算机" + +msgid "&Check for updates…" +msgstr "检查更新(&C)…" msgid "Exit" msgstr "退出" @@ -1251,26 +1209,26 @@ msgstr "设置显示名称" msgid "Enter the new display name (blank to reset)" msgstr "输入新的显示名称 (留空以重置)" -msgid "Change &display name..." -msgstr "更改显示名称(&D)..." +msgid "Change &display name…" +msgstr "更改显示名称(&D)…" msgid "Context Menu" msgstr "上下文菜单" -msgid "&Open folder..." -msgstr "打开文件夹(&O)..." +msgid "&Open folder…" +msgstr "打开文件夹(&O)…" -msgid "Open p&rinter tray..." -msgstr "打开打印机托盘(&R)..." +msgid "Open p&rinter tray…" +msgstr "打开打印机托盘(&R)…" -msgid "Set &icon..." -msgstr "设置图标(&I)..." +msgid "Set &icon…" +msgstr "设置图标(&I)…" msgid "Select an icon" msgstr "选择一个图标" -msgid "C&lone..." -msgstr "克隆(&L)..." +msgid "C&lone…" +msgstr "克隆(&L)…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "虚拟机 \"%1\" (%2) 将被克隆到:" @@ -1356,8 +1314,8 @@ msgstr "无截图" msgid "Search" msgstr "搜索" -msgid "Searching for VMs..." -msgstr "正在搜索虚拟机..." +msgid "Searching for VMs…" +msgstr "正在搜索虚拟机…" msgid "Found %1" msgstr "已找到 %1" @@ -1384,7 +1342,7 @@ msgid "ACPI shutdown" msgstr "ACPI 关机" msgid "ACP&I shutdown" -msgstr "ACP&I 关机" +msgstr "ACPI 关机(&I)" msgid "Hard disk (%1)" msgstr "硬盘 (%1)" @@ -1392,11 +1350,11 @@ msgstr "硬盘 (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "不存在 MFM/RLL 或 ESDI CD-ROM 驱动器" -msgid "Custom..." -msgstr "自定义..." +msgid "Custom…" +msgstr "自定义…" -msgid "Custom (large)..." -msgstr "自定义 (大容量)..." +msgid "Custom (large)…" +msgstr "自定义 (大容量)…" msgid "Add New Hard Disk" msgstr "添加新硬盘" @@ -1515,21 +1473,6 @@ msgstr "父盘与子盘的时间戳不匹配" msgid "Could not fix VHD timestamp." msgstr "无法修复 VHD 时间戳。" -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "光盘 %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "平板工具(&T)" msgid "About &Qt" msgstr "关于 &Qt" -msgid "&MCA devices..." -msgstr "&MCA 设备..." +msgid "&MCA devices…" +msgstr "&MCA 设备…" msgid "Show non-&primary monitors" msgstr "显示非主要显示器(&P)" -msgid "Open screenshots &folder..." -msgstr "打开屏幕截图文件夹(&F)..." +msgid "Open screenshots &folder…" +msgstr "打开屏幕截图文件夹(&F)…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "最大化时应用全屏拉伸模式(&Y)" @@ -1707,8 +1650,8 @@ msgstr "已连接(&C)" msgid "Clear image &history" msgstr "清除映像历史记录(&H)" -msgid "Create..." -msgstr "创建..." +msgid "Create…" +msgstr "创建…" msgid "Host CD/DVD Drive (%1)" msgstr "主机 CD/DVD 驱动器 (%1)" @@ -1749,8 +1692,8 @@ msgstr "着色器" msgid "Remove" msgstr "移除" -msgid "Browse..." -msgstr "浏览..." +msgid "Browse…" +msgstr "浏览…" msgid "Couldn't create OpenGL context." msgstr "无法创建 OpenGL 上下文。" @@ -1839,8 +1782,8 @@ msgstr "串口直通 3" msgid "Serial port passthrough 4" msgstr "串口直通 4" -msgid "Renderer &options..." -msgstr "渲染器选项(&O)..." +msgid "Renderer &options…" +msgstr "渲染器选项(&O)…" msgid "PC/XT Keyboard" msgstr "PC/XT 键盘" @@ -1977,6 +1920,9 @@ msgstr "串口的 IRQ" msgid "Parallel port IRQ" msgstr "并口的 IRQ" +msgid "Hard disk" +msgstr "硬盘" + msgid "BIOS Revision" msgstr "BIOS 修订版" @@ -2052,9 +1998,6 @@ msgstr "MIDI 输入直通" msgid "MIDI Clockout" msgstr "MIDI 时钟输出" -msgid "SoundFont" -msgstr "声音字体" - msgid "Output Gain" msgstr "输出增益" @@ -2964,8 +2907,8 @@ msgstr "访问下载页面" msgid "Update check" msgstr "更新检查" -msgid "Checking for updates..." -msgstr "正在检查更新..." +msgid "Checking for updates…" +msgstr "正在检查更新…" msgid "86Box Update" msgstr "86Box 更新" @@ -3003,8 +2946,8 @@ msgstr "亮度" msgid "Sharpness" msgstr "锐度" -msgid "&CGA composite settings..." -msgstr "CGA 复合模式设置(&C)..." +msgid "&CGA composite settings…" +msgstr "CGA 复合模式设置(&C)…" msgid "CGA composite settings" msgstr "CGA 复合模式设置" @@ -3012,8 +2955,8 @@ msgstr "CGA 复合模式设置" msgid "Monitor EDID" msgstr "显示器的EDID" -msgid "Export..." -msgstr "导出..." +msgid "Export…" +msgstr "导出…" msgid "Export EDID" msgstr "导出EDID" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index b008335e011..0247c6148fc 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -66,8 +66,8 @@ msgstr "OpenGL (3.0 Core)(&G)" msgid "&VNC" msgstr "VNC(&V)" -msgid "Specify &dimensions..." -msgstr "指定視窗大小(&D)..." +msgid "Specify &dimensions…" +msgstr "指定視窗大小(&D)…" msgid "Force &4:3 display ratio" msgstr "強制 4:3 顯示比例(&4)" @@ -192,11 +192,11 @@ msgstr "媒體(&M)" msgid "&Tools" msgstr "工具(&T)" -msgid "&Settings..." -msgstr "設定(&S)..." +msgid "&Settings…" +msgstr "設定(&S)…" -msgid "Settings..." -msgstr "設定..." +msgid "Settings…" +msgstr "設定…" msgid "&Update status bar icons" msgstr "更新狀態列圖示(&U)" @@ -207,14 +207,14 @@ msgstr "擷圖(&C)" msgid "S&ound" msgstr "聲音(&O)" -msgid "&Preferences..." -msgstr "偏好設定(&P)..." +msgid "&Preferences…" +msgstr "偏好設定(&P)…" msgid "Enable &Discord integration" msgstr "啟用 Discord 整合(&D)" -msgid "Sound &gain..." -msgstr "音量增益(&G)..." +msgid "Sound &gain…" +msgstr "音量增益(&G)…" msgid "Begin trace" msgstr "開始追踪" @@ -225,20 +225,20 @@ msgstr "結束追踪" msgid "&Help" msgstr "說明(&H)" -msgid "&Documentation..." -msgstr "文件(&D)..." +msgid "&Documentation…" +msgstr "文件(&D)…" -msgid "&About 86Box..." -msgstr "關於 86Box(&A)..." +msgid "&About 86Box…" +msgstr "關於 86Box(&A)…" -msgid "&New image..." -msgstr "新增影像(&N)..." +msgid "&New image…" +msgstr "新增影像(&N)…" -msgid "&Existing image..." -msgstr "開啟已存在的影像(&E)..." +msgid "&Existing image…" +msgstr "開啟已存在的影像(&E)…" -msgid "Existing image (&Write-protected)..." -msgstr "以防寫保護開啟已存在的影像(&W)..." +msgid "Existing image (&Write-protected)…" +msgstr "以防寫保護開啟已存在的影像(&W)…" msgid "&Record" msgstr "錄製(&R)" @@ -255,11 +255,11 @@ msgstr "快進至終點(&F)" msgid "E&ject" msgstr "退出(&J)" -msgid "&Image..." -msgstr "影像(&I)..." +msgid "&Image…" +msgstr "影像(&I)…" -msgid "E&xport to 86F..." -msgstr "匯出為 86F 格式(&x)..." +msgid "E&xport to 86F…" +msgstr "匯出為 86F 格式(&x)…" msgid "&Mute" msgstr "靜音(&M)" @@ -270,8 +270,8 @@ msgstr "卸載(&M)" msgid "Reload previous image" msgstr "載入上一個影像" -msgid "&Folder..." -msgstr "資料夾(&F)..." +msgid "&Folder…" +msgstr "資料夾(&F)…" msgid "Preferences" msgstr "偏好設定" @@ -417,17 +417,17 @@ msgstr "搖桿:" msgid "Joystick" msgstr "搖桿" -msgid "Joystick 1..." -msgstr "搖桿 1..." +msgid "Joystick 1…" +msgstr "搖桿 1…" -msgid "Joystick 2..." -msgstr "搖桿 2..." +msgid "Joystick 2…" +msgstr "搖桿 2…" -msgid "Joystick 3..." -msgstr "搖桿 3..." +msgid "Joystick 3…" +msgstr "搖桿 3…" -msgid "Joystick 4..." -msgstr "搖桿 4..." +msgid "Joystick 4…" +msgstr "搖桿 4…" msgid "Sound card #1:" msgstr "音效卡 1:" @@ -516,23 +516,23 @@ msgstr "並列埠 3" msgid "Parallel port 4" msgstr "並列埠 4" -msgid "FD Controller:" +msgid "Floppy disk controller:" msgstr "軟碟控制器:" -msgid "CD-ROM Controller:" +msgid "CD-ROM controller:" msgstr "CD-ROM 控制器:" -msgid "Tertiary IDE Controller" -msgstr "第三 IDE 控制器" +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] 第三 IDE 控制器" -msgid "Quaternary IDE Controller" -msgstr "第四 IDE 控制器" +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] 第四 IDE 控制器" -msgid "Hard disk" -msgstr "硬碟" +msgid "Hard disk controllers" +msgstr "硬碟控制器" -msgid "SCSI" -msgstr "SCSI" +msgid "SCSI controllers" +msgstr "SCSI 控制器" msgid "Controller 1:" msgstr "控制器 1:" @@ -555,11 +555,11 @@ msgstr "硬碟:" msgid "Firmware Version" msgstr "韌體版本" -msgid "&New..." -msgstr "新增(&N)..." +msgid "&New…" +msgstr "新增(&N)…" -msgid "&Existing..." -msgstr "已有影像(&E)..." +msgid "&Existing…" +msgstr "已有影像(&E)…" msgid "&Remove" msgstr "移除(&R)" @@ -867,9 +867,6 @@ msgstr "4 鍵遊戲手柄" msgid "6-button gamepad" msgstr "6 鍵遊戲手柄" -msgid "Gravis PC GamePad" -msgstr "Gravis PC GamePad" - msgid "2-button flight yoke" msgstr "2 按鈕飛行搖桿" @@ -897,51 +894,6 @@ msgstr "方向盤 (3 軸, 3 鍵搖桿)" msgid "Steering wheel (3-axis, 4-button)" msgstr "方向盤 (3 軸, 4 鍵搖桿)" -msgid "CH Flightstick" -msgstr "CH Flightstick" - -msgid "CH Flightstick + CH Pedals" -msgstr "CH Flightstick + CH Pedals" - -msgid "CH Flightstick + CH Pedals Pro" -msgstr "CH Flightstick + CH Pedals Pro" - -msgid "CH Flightstick Pro" -msgstr "CH Flightstick Pro" - -msgid "CH Flightstick Pro + CH Pedals" -msgstr "CH Flightstick Pro + CH Pedals" - -msgid "CH Flightstick Pro + CH Pedals Pro" -msgstr "CH Flightstick Pro + CH Pedals Pro" - -msgid "CH Virtual Pilot" -msgstr "CH Virtual Pilot" - -msgid "CH Virtual Pilot + CH Pedals" -msgstr "CH Virtual Pilot + CH Pedals" - -msgid "CH Virtual Pilot + CH Pedals Pro" -msgstr "CH Virtual Pilot + CH Pedals Pro" - -msgid "CH Virtual Pilot Pro" -msgstr "CH Virtual Pilot Pro" - -msgid "CH Virtual Pilot Pro + CH Pedals" -msgstr "CH Virtual Pilot Pro + CH Pedals" - -msgid "CH Virtual Pilot Pro + CH Pedals Pro" -msgstr "CH Virtual Pilot Pro + CH Pedals Pro" - -msgid "Microsoft SideWinder Pad" -msgstr "Microsoft SideWinder Pad" - -msgid "Thrustmaster Flight Control System" -msgstr "Thrustmaster Flight Control System" - -msgid "Thrustmaster FCS + Rudder Control System" -msgstr "Thrustmaster FCS + Rudder Control System" - msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "附轉接器 Thrustmaster Formula T1/T2" @@ -996,11 +948,17 @@ msgstr "內部裝置" msgid "&File" msgstr "檔案(&F)" -msgid "&New machine..." -msgstr "新機器(&N)..." +msgid "&New machine…" +msgstr "新機器(&N)…" + +msgid "New machine…" +msgstr "新機器…" -msgid "&Check for updates..." -msgstr "檢查更新(&C)..." +msgid "New machine" +msgstr "新機器" + +msgid "&Check for updates…" +msgstr "檢查更新(&C)…" msgid "Exit" msgstr "退出" @@ -1251,26 +1209,26 @@ msgstr "設定顯示名稱" msgid "Enter the new display name (blank to reset)" msgstr "輸入新的顯示名稱 (留空以重設)" -msgid "Change &display name..." -msgstr "變更顯示名稱(&D)..." +msgid "Change &display name…" +msgstr "變更顯示名稱(&D)…" msgid "Context Menu" msgstr "內容選單" -msgid "&Open folder..." -msgstr "開啟資料夾(&O)..." +msgid "&Open folder…" +msgstr "開啟資料夾(&O)…" -msgid "Open p&rinter tray..." -msgstr "開啟印表機托盤(&R)..." +msgid "Open p&rinter tray…" +msgstr "開啟印表機托盤(&R)…" -msgid "Set &icon..." -msgstr "設定圖示(&I)..." +msgid "Set &icon…" +msgstr "設定圖示(&I)…" msgid "Select an icon" msgstr "選擇圖示" -msgid "C&lone..." -msgstr "複製(&L)..." +msgid "C&lone…" +msgstr "複製(&L)…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "虛擬機器 \"%1\" (%2) 將被複製到:" @@ -1356,8 +1314,8 @@ msgstr "沒有擷圖" msgid "Search" msgstr "搜尋" -msgid "Searching for VMs..." -msgstr "搜尋虛擬機器..." +msgid "Searching for VMs…" +msgstr "搜尋虛擬機器…" msgid "Found %1" msgstr "找到 %1" @@ -1384,7 +1342,7 @@ msgid "ACPI shutdown" msgstr "ACPI 關機" msgid "ACP&I shutdown" -msgstr "ACP&I 關機" +msgstr "ACPI 關機(&I)" msgid "Hard disk (%1)" msgstr "硬碟 (%1)" @@ -1392,11 +1350,11 @@ msgstr "硬碟 (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" msgstr "MFM/RLL 或 ESDI CD-ROM 光碟機從未存在" -msgid "Custom..." -msgstr "自訂..." +msgid "Custom…" +msgstr "自訂…" -msgid "Custom (large)..." -msgstr "自訂 (大容量)..." +msgid "Custom (large)…" +msgstr "自訂 (大容量)…" msgid "Add New Hard Disk" msgstr "增加新硬碟" @@ -1515,21 +1473,6 @@ msgstr "父碟與子碟的時間戳不匹配" msgid "Could not fix VHD timestamp." msgstr "無法修復 VHD 時間戳。" -msgid "MFM/RLL" -msgstr "MFM/RLL" - -msgid "XTA" -msgstr "XTA" - -msgid "ESDI" -msgstr "ESDI" - -msgid "IDE" -msgstr "IDE" - -msgid "ATAPI" -msgstr "ATAPI" - msgid "CD-ROM %1 (%2): %3" msgstr "光碟 %1 (%2): %3" @@ -1680,14 +1623,14 @@ msgstr "平板工具(&T)" msgid "About &Qt" msgstr "關於 &Qt" -msgid "&MCA devices..." -msgstr "&MCA 裝置..." +msgid "&MCA devices…" +msgstr "&MCA 裝置…" msgid "Show non-&primary monitors" msgstr "顯示非主要監視器(&P)" -msgid "Open screenshots &folder..." -msgstr "開啟螢幕擷取畫面資料夾(&F)..." +msgid "Open screenshots &folder…" +msgstr "開啟螢幕擷取畫面資料夾(&F)…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "最大化時套用全螢幕延展模式(&Y)" @@ -1707,8 +1650,8 @@ msgstr "已連線(&C)" msgid "Clear image &history" msgstr "清除影像歷史記錄(&H)" -msgid "Create..." -msgstr "建立..." +msgid "Create…" +msgstr "建立…" msgid "Host CD/DVD Drive (%1)" msgstr "主機 CD/DVD 光碟機 (%1)" @@ -1749,8 +1692,8 @@ msgstr "著色器" msgid "Remove" msgstr "移除" -msgid "Browse..." -msgstr "瀏覽..." +msgid "Browse…" +msgstr "瀏覽…" msgid "Couldn't create OpenGL context." msgstr "無法建立 OpenGL 內容。" @@ -1839,8 +1782,8 @@ msgstr "序列埠的直通 3" msgid "Serial port passthrough 4" msgstr "序列埠的直通 4" -msgid "Renderer &options..." -msgstr "渲染器選項(&O)..." +msgid "Renderer &options…" +msgstr "渲染器選項(&O)…" msgid "PC/XT Keyboard" msgstr "PC/XT 鍵盤" @@ -1977,6 +1920,9 @@ msgstr "序列埠的 IRQ" msgid "Parallel port IRQ" msgstr "並列埠的 IRQ" +msgid "Hard disk" +msgstr "硬碟" + msgid "BIOS Revision" msgstr "BIOS 修訂版號" @@ -2052,9 +1998,6 @@ msgstr "MIDI 輸入直通" msgid "MIDI Clockout" msgstr "MIDI 時鐘輸出" -msgid "SoundFont" -msgstr "SoundFont" - msgid "Output Gain" msgstr "輸出增益" @@ -2964,8 +2907,8 @@ msgstr "造訪下載頁面" msgid "Update check" msgstr "更新檢查" -msgid "Checking for updates..." -msgstr "正在檢查更新..." +msgid "Checking for updates…" +msgstr "正在檢查更新…" msgid "86Box Update" msgstr "86Box 更新" @@ -3003,8 +2946,8 @@ msgstr "亮度" msgid "Sharpness" msgstr "銳利度" -msgid "&CGA composite settings..." -msgstr "CGA 複合視訊的設定(&C)..." +msgid "&CGA composite settings…" +msgstr "CGA 複合視訊的設定(&C)…" msgid "CGA composite settings" msgstr "CGA 複合視訊的設定" @@ -3012,8 +2955,8 @@ msgstr "CGA 複合視訊的設定" msgid "Monitor EDID" msgstr "監視器的 EDID" -msgid "Export..." -msgstr "匯出..." +msgid "Export…" +msgstr "匯出…" msgid "Export EDID" msgstr "匯出 EDID" diff --git a/src/qt/qt_filefield.ui b/src/qt/qt_filefield.ui index 91000af50d1..33e8a7b21be 100644 --- a/src/qt/qt_filefield.ui +++ b/src/qt/qt_filefield.ui @@ -51,7 +51,7 @@ - Browse... + Browse… diff --git a/src/qt/qt_harddiskdialog.cpp b/src/qt/qt_harddiskdialog.cpp index fbb6a476897..1c6345f26c9 100644 --- a/src/qt/qt_harddiskdialog.cpp +++ b/src/qt/qt_harddiskdialog.cpp @@ -78,8 +78,8 @@ HarddiskDialog::HarddiskDialog(bool existing, QWidget *parent) QString text = tr("%1 MB (CHS: %2, %3, %4)").arg(size_mb).arg(hdd_table[i][0]).arg(hdd_table[i][1]).arg(hdd_table[i][2]); Models::AddEntry(model, text, i); } - Models::AddEntry(model, tr("Custom..."), 127); - Models::AddEntry(model, tr("Custom (large)..."), 128); + Models::AddEntry(model, tr("Custom…"), 127); + Models::AddEntry(model, tr("Custom (large)…"), 128); ui->lineEditSize->setValidator(new QIntValidator()); ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false); diff --git a/src/qt/qt_harddrive_common.cpp b/src/qt/qt_harddrive_common.cpp index 1c07e5f3ff5..eb814ebfdd3 100644 --- a/src/qt/qt_harddrive_common.cpp +++ b/src/qt/qt_harddrive_common.cpp @@ -57,13 +57,13 @@ Harddrives::populateCDROMBuses(QAbstractItemModel *model) #endif model->setData(model->index(0, 0), QObject::tr("Disabled")); - model->setData(model->index(1, 0), QObject::tr("ATAPI")); - model->setData(model->index(2, 0), QObject::tr("SCSI")); + model->setData(model->index(1, 0), "ATAPI"); + model->setData(model->index(2, 0), "SCSI"); #ifdef USE_CDROM_MITSUMI - model->setData(model->index(3, 0), QObject::tr("Mitsumi")); - model->setData(model->index(4, 0), QObject::tr("Panasonic/MKE")); + model->setData(model->index(3, 0), "Mitsumi"); + model->setData(model->index(4, 0), "Panasonic/MKE"); #else - model->setData(model->index(3, 0), QObject::tr("Panasonic/MKE")); + model->setData(model->index(3, 0), "Panasonic/MKE"); #endif model->setData(model->index(0, 0), HDD_BUS_DISABLED, Qt::UserRole); @@ -84,8 +84,8 @@ Harddrives::populateRemovableBuses(QAbstractItemModel *model) model->insertRows(0, 3); model->setData(model->index(0, 0), QObject::tr("Disabled")); - model->setData(model->index(1, 0), QObject::tr("ATAPI")); - model->setData(model->index(2, 0), QObject::tr("SCSI")); + model->setData(model->index(1, 0), "ATAPI"); + model->setData(model->index(2, 0), "SCSI"); model->setData(model->index(0, 0), HDD_BUS_DISABLED, Qt::UserRole); model->setData(model->index(1, 0), HDD_BUS_ATAPI, Qt::UserRole); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 20d625286aa..dee2c338cf5 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -85,6 +85,7 @@ + @@ -354,6 +355,9 @@ &Hard reset + + Hard reset + @@ -364,7 +368,7 @@ &Ctrl+Alt+Del - Ctrl+Alt+Del + Press Ctrl+Alt+Del Ctrl+F12 @@ -378,6 +382,9 @@ Ctrl+Alt+&Esc + + Press Ctrl+Alt+Esc + @@ -402,7 +409,10 @@ :/menuicons/qt/icons/settings.ico:/menuicons/qt/icons/settings.ico - &Settings... + &Settings… + + + Settings… QAction::NoRole @@ -453,7 +463,7 @@ - Specify &dimensions... + Specify &dimensions… @@ -709,7 +719,7 @@ - &About 86Box... + &About 86Box… QAction::AboutRole @@ -717,7 +727,7 @@ - &Documentation... + &Documentation… @@ -743,7 +753,7 @@ - Sound &gain... + Sound &gain… @@ -759,7 +769,7 @@ - &Preferences... + &Preferences… QAction::PreferencesRole @@ -780,9 +790,6 @@ Hide &toolbar - - Hide tool bar - @@ -826,7 +833,7 @@ - Renderer &options... + Renderer &options… QAction::NoRole @@ -845,7 +852,7 @@ - &MCA devices... + &MCA devices… @@ -869,12 +876,12 @@ - Open p&rinter tray... + Open p&rinter tray… - Open screenshots &folder... + Open screenshots &folder… @@ -903,7 +910,7 @@ - &CGA composite settings... + &CGA composite settings… diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index 75b2e2b978a..b2dcf9c40af 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -87,10 +87,10 @@ MediaMenu::refresh(QMenu *parentMenu) if (MachineStatus::hasCassette()) { cassetteMenu = parentMenu->addMenu(""); QIcon img_icon = QIcon(":/settings/qt/icons/cassette_image.ico"); - cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this]() { cassetteNewImage(); }); + cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image…"), [this]() { cassetteNewImage(); }); cassetteMenu->addSeparator(); - cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this]() { cassetteSelectImage(false); }); - cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this]() { cassetteSelectImage(true); }); + cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image…"), [this]() { cassetteSelectImage(false); }); + cassetteMenu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)…"), [this]() { cassetteSelectImage(true); }); cassetteMenu->addSeparator(); for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) { cassetteImageHistoryPos[slot] = cassetteMenu->children().count(); @@ -116,7 +116,7 @@ MediaMenu::refresh(QMenu *parentMenu) for (int i = 0; i < 2; i++) { auto *menu = parentMenu->addMenu(""); QIcon img_icon = QIcon(":/settings/qt/icons/cartridge_image.ico"); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cartridgeSelectImage(i); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Image…"), [this, i]() { cartridgeSelectImage(i); }); menu->addSeparator(); for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) { cartridgeImageHistoryPos[slot] = menu->children().count(); @@ -134,10 +134,10 @@ MediaMenu::refresh(QMenu *parentMenu) MachineStatus::iterateFDD([this, parentMenu](int i) { auto *menu = parentMenu->addMenu(""); QIcon img_icon = fdd_is_525(i) ? QIcon(":/settings/qt/icons/floppy_525_image.ico") : QIcon(":/settings/qt/icons/floppy_35_image.ico"); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { floppyNewImage(i); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image…"), [this, i]() { floppyNewImage(i); }); menu->addSeparator(); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { floppySelectImage(i, false); }); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { floppySelectImage(i, true); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image…"), [this, i]() { floppySelectImage(i, false); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)…"), [this, i]() { floppySelectImage(i, true); }); menu->addSeparator(); for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) { floppyImageHistoryPos[slot] = menu->children().count(); @@ -145,7 +145,7 @@ MediaMenu::refresh(QMenu *parentMenu) } menu->addSeparator(); floppyExportPos = menu->children().count(); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Export), tr("E&xport to 86F..."), [this, i]() { floppyExportTo86f(i); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Export), tr("E&xport to 86F…"), [this, i]() { floppyExportTo86f(i); }); menu->addSeparator(); floppyEjectPos = menu->children().count(); menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Eject), tr("E&ject"), [this, i]() { floppyEject(i); }); @@ -159,8 +159,8 @@ MediaMenu::refresh(QMenu *parentMenu) cdromMutePos = menu->children().count(); menu->addAction(QIcon(":/settings/qt/icons/cdrom_mute.ico"), tr("&Mute"), [this, i]() { cdromMute(i); })->setCheckable(true); menu->addSeparator(); - menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_image.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Image..."), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false); - menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_folder.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Folder..."), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false); + menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_image.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Image…"), [this, i]() { cdromMount(i, 0, nullptr); })->setCheckable(false); + menu->addAction(getIconWithIndicator(QIcon(":/settings/qt/icons/cdrom_folder.ico"), pixmap_size, QIcon::Normal, Browse), tr("&Folder…"), [this, i]() { cdromMount(i, 1, nullptr); })->setCheckable(false); menu->addSeparator(); for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) { cdromImageHistoryPos[slot] = menu->children().count(); @@ -187,10 +187,10 @@ MediaMenu::refresh(QMenu *parentMenu) MachineStatus::iterateRDisk([this, parentMenu](int i) { auto *menu = parentMenu->addMenu(""); QIcon img_icon = QIcon(":/settings/qt/icons/rdisk_image.ico"); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { rdiskNewImage(i); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image…"), [this, i]() { rdiskNewImage(i); }); menu->addSeparator(); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { rdiskSelectImage(i, false); }); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { rdiskSelectImage(i, true); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image…"), [this, i]() { rdiskSelectImage(i, false); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)…"), [this, i]() { rdiskSelectImage(i, true); }); menu->addSeparator(); for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) { rdiskImageHistoryPos[slot] = menu->children().count(); @@ -207,10 +207,10 @@ MediaMenu::refresh(QMenu *parentMenu) MachineStatus::iterateMO([this, parentMenu](int i) { auto *menu = parentMenu->addMenu(""); QIcon img_icon = QIcon(":/settings/qt/icons/mo_image.ico"); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image..."), [this, i]() { moNewImage(i); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, New), tr("&New image…"), [this, i]() { moNewImage(i); }); menu->addSeparator(); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image..."), [this, i]() { moSelectImage(i, false); }); - menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)..."), [this, i]() { moSelectImage(i, true); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, Browse), tr("&Existing image…"), [this, i]() { moSelectImage(i, false); }); + menu->addAction(getIconWithIndicator(img_icon, pixmap_size, QIcon::Normal, WriteProtectedBrowse), tr("Existing image (&Write-protected)…"), [this, i]() { moSelectImage(i, true); }); menu->addSeparator(); for (int slot = 0; slot < MAX_PREV_IMAGES; slot++) { moImageHistoryPos[slot] = menu->children().count(); @@ -238,7 +238,7 @@ MediaMenu::refresh(QMenu *parentMenu) void MediaMenu::cassetteNewImage() { - auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Create...")); + auto filename = QFileDialog::getSaveFileName(parentWidget, tr("Create…")); QFileInfo fileinfo(filename); if (fileinfo.suffix().isEmpty()) { filename.append(".cas"); diff --git a/src/qt/qt_settingsdisplay.ui b/src/qt/qt_settingsdisplay.ui index 5ab71f4c0a9..71f10331966 100644 --- a/src/qt/qt_settingsdisplay.ui +++ b/src/qt/qt_settingsdisplay.ui @@ -184,7 +184,7 @@ - Export... + Export… @@ -198,7 +198,7 @@ - Custom... + Custom… diff --git a/src/qt/qt_settingsharddisks.ui b/src/qt/qt_settingsharddisks.ui index e68de43d172..d65b1d0c1a8 100644 --- a/src/qt/qt_settingsharddisks.ui +++ b/src/qt/qt_settingsharddisks.ui @@ -98,14 +98,14 @@ - &New... + &New… - &Existing... + &Existing… diff --git a/src/qt/qt_settingsinput.ui b/src/qt/qt_settingsinput.ui index e4c0dc8fae1..679df5c541b 100644 --- a/src/qt/qt_settingsinput.ui +++ b/src/qt/qt_settingsinput.ui @@ -114,28 +114,28 @@ - Joystick 1... + Joystick 1… - Joystick 2... + Joystick 2… - Joystick 3... + Joystick 3… - Joystick 4... + Joystick 4… diff --git a/src/qt/qt_settingsstoragecontrollers.ui b/src/qt/qt_settingsstoragecontrollers.ui index 50ebbe7ef82..adb80064a1c 100644 --- a/src/qt/qt_settingsstoragecontrollers.ui +++ b/src/qt/qt_settingsstoragecontrollers.ui @@ -31,7 +31,7 @@ - FD Controller: + Floppy disk controller: @@ -58,7 +58,7 @@ - CD-ROM Controller: + CD-ROM controller: @@ -87,7 +87,7 @@ - Hard disk + Hard disk controllers @@ -204,7 +204,7 @@ - SCSI + SCSI controllers diff --git a/src/qt/qt_updatecheckdialog.ui b/src/qt/qt_updatecheckdialog.ui index 3fd2942fdf0..d4cba42aa13 100644 --- a/src/qt/qt_updatecheckdialog.ui +++ b/src/qt/qt_updatecheckdialog.ui @@ -41,7 +41,7 @@ - Checking for updates... + Checking for updates… Qt::AlignCenter diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index 4d12ae1e16d..d91ba951bf5 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -16,6 +16,11 @@ #include #include +extern "C" { +#include <86box/86box.h> +} + +#include "qt_progsettings.hpp" #include "qt_util.hpp" #include "qt_vmmanager_details.hpp" #include "ui_qt_vmmanager_details.h" @@ -138,7 +143,7 @@ VMManagerDetails::VMManagerDetails(QWidget *parent) configureButton = new QToolButton(); configureButton->setIcon(QIcon(":/menuicons/qt/icons/settings.ico")); configureButton->setEnabled(false); - configureButton->setToolTip(tr("Settings...")); + configureButton->setToolTip(tr("Settings…")); cadButton = new QToolButton(); cadButton->setIcon(QIcon(":menuicons/qt/icons/send_cad.ico")); cadButton->setEnabled(false); @@ -161,6 +166,8 @@ VMManagerDetails::VMManagerDetails(QWidget *parent) connect(this, &VMManagerDetails::styleUpdated, inputSection, &VMManagerDetailSection::updateStyle); connect(this, &VMManagerDetails::styleUpdated, portsSection, &VMManagerDetailSection::updateStyle); connect(this, &VMManagerDetails::styleUpdated, otherSection, &VMManagerDetailSection::updateStyle); + + QApplication::setFont(QFont(ProgSettings::getFontName(lang_id), 9)); #endif sysconfig = new VMManagerSystem(); diff --git a/src/qt/qt_vmmanager_details.ui b/src/qt/qt_vmmanager_details.ui index 9b4fbbe8bb8..162fb20eea5 100644 --- a/src/qt/qt_vmmanager_details.ui +++ b/src/qt/qt_vmmanager_details.ui @@ -180,14 +180,14 @@ - ... + - ... + true diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 86c2cf90478..25e6e3775a4 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -141,13 +141,13 @@ VMManagerMain::VMManagerMain(QWidget *parent) contextMenu.addSeparator(); - QAction settingsAction(tr("&Settings...")); + QAction settingsAction(tr("&Settings…")); contextMenu.addAction(&settingsAction); connect(&settingsAction, &QAction::triggered, [this] { selected_sysconfig->launchSettings(); }); - QAction nameChangeAction(tr("Change &display name...")); + QAction nameChangeAction(tr("Change &display name…")); contextMenu.addAction(&nameChangeAction); // Use a lambda to call a function so indexAt can be passed connect(&nameChangeAction, &QAction::triggered, ui->listView, [this, indexAt] { @@ -155,7 +155,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) }); nameChangeAction.setEnabled(!selected_sysconfig->window_obscured); - QAction setSystemIcon(tr("Set &icon...")); + QAction setSystemIcon(tr("Set &icon…")); contextMenu.addAction(&setSystemIcon); connect(&setSystemIcon, &QAction::triggered, [this] { IconSelectionDialog dialog(":/systemicons/"); @@ -169,7 +169,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) contextMenu.addSeparator(); - QAction cloneMachine(tr("C&lone...")); + QAction cloneMachine(tr("C&lone…")); contextMenu.addAction(&cloneMachine); connect(&cloneMachine, &QAction::triggered, [this] { QDialog dialog = QDialog(this); @@ -332,7 +332,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) contextMenu.addSeparator(); - QAction openSystemFolderAction(tr("&Open folder...")); + QAction openSystemFolderAction(tr("&Open folder…")); contextMenu.addAction(&openSystemFolderAction); connect(&openSystemFolderAction, &QAction::triggered, [indexAt] { if (const auto configDir = indexAt.data(VMManagerModel::Roles::ConfigDir).toString(); !configDir.isEmpty()) { @@ -344,7 +344,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) } }); - QAction openPrinterFolderAction(tr("Open p&rinter tray...")); + QAction openPrinterFolderAction(tr("Open p&rinter tray…")); contextMenu.addAction(&openPrinterFolderAction); connect(&openPrinterFolderAction, &QAction::triggered, [indexAt] { if (const auto printerDir = indexAt.data(VMManagerModel::Roles::ConfigDir).toString() + QString("/printer/"); !printerDir.isEmpty()) { @@ -356,7 +356,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) } }); - QAction openScreenshotsFolderAction(tr("Open screenshots &folder...")); + QAction openScreenshotsFolderAction(tr("Open screenshots &folder…")); contextMenu.addAction(&openScreenshotsFolderAction); connect(&openScreenshotsFolderAction, &QAction::triggered, [indexAt] { if (const auto screenshotsDir = indexAt.data(VMManagerModel::Roles::ConfigDir).toString() + QString("/screenshots/"); !screenshotsDir.isEmpty()) { @@ -380,7 +380,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) } else { QMenu contextMenu(tr("Context Menu"), ui->listView); - QAction newMachineAction(tr("&New machine...")); + QAction newMachineAction(tr("&New machine…")); contextMenu.addAction(&newMachineAction); connect(&newMachineAction, &QAction::triggered, this, &VMManagerMain::newMachineWizard); diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 7efca83f3f2..3418519e545 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -171,20 +171,23 @@ VMManagerMainWindow::vmmStateChanged(const VMManagerSystem *sysconfig) const if (running) { if (sysconfig->getProcessStatus() == VMManagerSystem::ProcessStatus::Running) { ui->actionStartPause->setIcon(pauseIcon); - ui->actionStartPause->setText(tr("Pause")); + ui->actionStartPause->setText(tr("&Pause")); ui->actionStartPause->setToolTip(tr("Pause")); + ui->actionStartPause->setIconText(tr("Pause")); } else { ui->actionStartPause->setIcon(runIcon); - ui->actionStartPause->setText(tr("Continue")); + ui->actionStartPause->setText(tr("&Continue")); ui->actionStartPause->setToolTip(tr("Continue")); + ui->actionStartPause->setIconText(tr("Continue")); } disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); } else { ui->actionStartPause->setIcon(runIcon); - ui->actionStartPause->setText(tr("Start")); + ui->actionStartPause->setText(tr("&Start")); ui->actionStartPause->setToolTip(tr("Start")); + ui->actionStartPause->setIconText(tr("Start")); disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::pauseButtonPressed); disconnect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); connect(ui->actionStartPause, &QAction::triggered, vmm, &VMManagerMain::startButtonPressed); diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index 12ef7dee2da..fbaeecf0ff0 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -111,6 +111,9 @@ Start + + Start + @@ -123,6 +126,9 @@ Hard reset + + Hard reset + @@ -138,6 +144,9 @@ Force shutdown + + Force shutdown + true @@ -156,6 +165,9 @@ Ctrl+Alt+Del + + Ctrl+Alt+Del + true @@ -166,10 +178,13 @@ :/menuicons/qt/icons/settings.ico:/menuicons/qt/icons/settings.ico - &Settings... + &Settings… - Settings... + Settings… + + + Settings QAction::NoRole @@ -181,10 +196,13 @@ :/menuicons/qt/icons/new_vm.ico:/menuicons/qt/icons/new_vm.ico - &New machine... + &New machine… - New machine... + New machine… + + + New machine @@ -194,16 +212,10 @@ Hide &toolbar - - Hide tool bar - - &Preferences... - - - Preferences... + &Preferences… QAction::PreferencesRole @@ -211,7 +223,7 @@ - &Check for updates... + &Check for updates… @@ -224,12 +236,12 @@ - &Documentation... + &Documentation… - &About 86Box... + &About 86Box… QAction::AboutRole diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 46d0451e89e..d54dfad196a 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -124,7 +124,7 @@ VMManagerSystem::scanForConfigs(QWidget *parent, const QString &searchPath) QProgressDialog progDialog(parent); unsigned int found = 0; progDialog.setCancelButton(nullptr); - progDialog.setWindowTitle(tr("Searching for VMs...")); + progDialog.setWindowTitle(tr("Searching for VMs…")); progDialog.setMinimumDuration(0); progDialog.setValue(0); progDialog.setMinimum(0); From 54322a7ecefcec73720c159084806035ffd33e17 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 17 Dec 2025 19:12:56 +0100 Subject: [PATCH 075/320] Revert RichardG's recompiler changes from build 8136 due to too many regressions, a way to bring them back with fewer regressions will be looked into for 6.0. --- src/86box.c | 3 --- src/cpu/386_dynarec.c | 32 +++++++++----------------------- src/include/86box/86box.h | 1 - src/include/86box/mem.h | 6 ------ 4 files changed, 9 insertions(+), 33 deletions(-) diff --git a/src/86box.c b/src/86box.c index ad79e391bc2..fe5dcf5b7c1 100644 --- a/src/86box.c +++ b/src/86box.c @@ -331,7 +331,6 @@ int scrnsz_y = SCREEN_RES_Y; /* current screen size, Y */ int config_changed; /* config has changed */ int title_update; int framecountx = 0; -int seconds_elapsed = 0; int hard_reset_pending = 0; #if 0 @@ -1975,8 +1974,6 @@ pc_onesec(void) framecount = 0; title_update = 1; - - seconds_elapsed++; } void diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 26034657275..852c25427f4 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -392,9 +392,10 @@ static inline void __attribute__((optimize("O2"))) #else static __inline void #endif -exec386_dynarec_dyn(uint32_t phys_addr, page_t *page) +exec386_dynarec_dyn(void) { uint32_t start_pc = 0; + uint32_t phys_addr = get_phys(cs + cpu_state.pc); int hash = HASH(phys_addr); # ifdef USE_NEW_DYNAREC codeblock_t *block = &codeblock[codeblock_hash[hash]]; @@ -409,6 +410,8 @@ exec386_dynarec_dyn(uint32_t phys_addr, page_t *page) if (block && !cpu_state.abrt) # endif { + page_t *page = &pages[phys_addr >> 12]; + /* Block must match current CS, PC, code segment size, and physical address. The physical address check will also catch any page faults at this stage */ @@ -442,30 +445,16 @@ exec386_dynarec_dyn(uint32_t phys_addr, page_t *page) if (valid_block && (block->page_mask & *block->dirty_mask)) { # ifdef USE_NEW_DYNAREC codegen_check_flush(page, page->dirty_mask, phys_addr); - if (block->pc == BLOCK_PC_INVALID) { + if (block->pc == BLOCK_PC_INVALID) valid_block = 0; - goto invalid_block; - } else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) { + else if (block->flags & CODEBLOCK_IN_DIRTY_LIST) block->flags &= ~CODEBLOCK_WAS_RECOMPILED; -invalid_block: # else codegen_check_flush(page, page->dirty_mask[(phys_addr >> 10) & 3], phys_addr); page->dirty_mask[(phys_addr >> 10) & 3] = 0; - if (!block->valid) { + if (!block->valid) valid_block = 0; # endif - if (page->inv_timestamp != seconds_elapsed) { - page->inv_timestamp = seconds_elapsed; - page->inv_count = 1; - } else { - page->inv_count++; -# define INVALIDATION_LIMIT 100 /* amount of invalidations *per second* to kick a page to the interpreter */ -# ifdef ENABLE_386_DYNAREC_LOG - if (page->inv_count >= INVALIDATION_LIMIT) - x386_dynarec_log("Forcing interpreter on page %08X\n", phys_addr & 0xfffff000); -# endif - } - } } if (valid_block && block->page_mask2) { /* We don't want the second page to cause a page @@ -790,14 +779,11 @@ exec386_dynarec(int32_t cycs) cycles_old = cycles; oldtsc = tsc; tsc_old = tsc; - - uint32_t phys_addr = get_phys(cs + cpu_state.pc); - page_t *page = &pages[phys_addr >> 12]; - if (cpu_force_interpreter || cpu_override_dynarec || (page->inv_count >= INVALIDATION_LIMIT) || (!CACHE_ON())) /*Interpret block*/ + if (cpu_force_interpreter || cpu_override_dynarec || (!CACHE_ON())) /*Interpret block*/ { exec386_dynarec_int(); } else { - exec386_dynarec_dyn(phys_addr, page); + exec386_dynarec_dyn(); } if (cpu_init) { diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index a1406d2015a..67ba5ec1bae 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -320,7 +320,6 @@ extern void do_pause(int p); extern double isa_timing; extern int io_delay; extern int framecountx; -extern int seconds_elapsed; extern volatile int cpu_thread_run; extern uint8_t postcard_codes[POSTCARDS_NUM]; diff --git a/src/include/86box/mem.h b/src/include/86box/mem.h index 215dca438b1..9051189a635 100644 --- a/src/include/86box/mem.h +++ b/src/include/86box/mem.h @@ -224,9 +224,6 @@ typedef struct page_t { uint64_t *byte_dirty_mask; uint64_t *byte_code_present_mask; - - uint32_t inv_count; - uint32_t inv_timestamp; } page_t; extern uint32_t purgable_page_list_head; @@ -253,9 +250,6 @@ typedef struct _page_ { /*Head of codeblock tree associated with this page*/ struct codeblock_t *head; - - uint32_t inv_count; - uint32_t inv_timestamp; } page_t; #endif From 711450ce3e09a2afb00820c0ebcb488ff8a84aae Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Wed, 17 Dec 2025 23:45:28 +0500 Subject: [PATCH 076/320] Minor translation updates - fix broken "floppy disk controller" in Korean - remove spaces before ellipsis - better translation for Settings/Preferences in German --- src/qt/languages/cs-CZ.po | 2 +- src/qt/languages/de-DE.po | 10 +++++----- src/qt/languages/es-ES.po | 2 +- src/qt/languages/hr-HR.po | 2 +- src/qt/languages/ko-KR.po | 2 +- src/qt/languages/vi-VN.po | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index ea74d59f93d..dbb0d28268f 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -1630,7 +1630,7 @@ msgid "About &Qt" msgstr "O platformě &Qt" msgid "&MCA devices…" -msgstr "Zařízení MCA …" +msgstr "Zařízení MCA…" msgid "Show non-&primary monitors" msgstr "Zobrazit neprimární monitory" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 05259fb82ae..e426d1e2dfd 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -199,10 +199,10 @@ msgid "&Tools" msgstr "&Werkzeuge" msgid "&Settings…" -msgstr "&Optionen…" +msgstr "&Einstellungen…" msgid "Settings…" -msgstr "Optionen…" +msgstr "Einstellungen…" msgid "&Update status bar icons" msgstr "&Statusleistenicons aktualisieren" @@ -214,7 +214,7 @@ msgid "S&ound" msgstr "&Ton" msgid "&Preferences…" -msgstr "&Einstellungen…" +msgstr "&Preferenzen…" msgid "Enable &Discord integration" msgstr "&Discord-Integration einschalten" @@ -280,7 +280,7 @@ msgid "&Folder…" msgstr "&Verzeichnis…" msgid "Preferences" -msgstr "Einstellungen" +msgstr "Preferenzen" msgid "Sound Gain" msgstr "Klangverstärkung" @@ -289,7 +289,7 @@ msgid "New Image" msgstr "Neues Abbild" msgid "Settings" -msgstr "Optionen" +msgstr "Einstellungen" msgid "Specify Main Window Dimensions" msgstr "Fenstergröße einstellen" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index c42e3ec6c81..c348fa87b5b 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -1630,7 +1630,7 @@ msgid "About &Qt" msgstr "Acerca de &Qt" msgid "&MCA devices…" -msgstr "Dispositivos MCA …" +msgstr "Dispositivos MCA…" msgid "Show non-&primary monitors" msgstr "Mostrar monitores no prim&arios" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 90af3df85e9..5261ab338de 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -1632,7 +1632,7 @@ msgid "About &Qt" msgstr "O programu &Qt" msgid "&MCA devices…" -msgstr "Uređaji MCA …" +msgstr "Uređaji MCA…" msgid "Show non-&primary monitors" msgstr "Prikaži neprimarne monitore" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index b5f49554706..e49476e4042 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -516,7 +516,7 @@ msgstr "병렬 포트 3" msgid "Parallel port 4" msgstr "병렬 포트 4" -msgid "FD controller:" +msgid "Floppy disk controller:" msgstr "플로피 디스크 컨트롤러:" msgid "CD-ROM controller:" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 8cecc1a1278..0471fa1f012 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -1783,7 +1783,7 @@ msgid "Serial port passthrough 4" msgstr "Thông qua cổng serial 4" msgid "Renderer &options…" -msgstr "Tùy chọn kết xuất …" +msgstr "Tùy chọn kết xuất…" msgid "PC/XT Keyboard" msgstr "Bàn phím PC/XT" From 62a116586fbcd2ee294bd13fa8f992b8f431be54 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 18 Dec 2025 01:40:42 +0600 Subject: [PATCH 077/320] 1. Allow agpMoveCMD register reads 2. Fix bad depth + 16-bit RGB565 writes --- src/video/vid_voodoo_banshee.c | 6 ++++++ src/video/vid_voodoo_fb.c | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/video/vid_voodoo_banshee.c b/src/video/vid_voodoo_banshee.c index abccff8605d..f914c7e866e 100644 --- a/src/video/vid_voodoo_banshee.c +++ b/src/video/vid_voodoo_banshee.c @@ -129,6 +129,7 @@ typedef struct banshee_t { uint32_t agpHostAddressLow; uint32_t agpGraphicsAddress; uint32_t agpGraphicsStride; + uint32_t agpMoveCMD; int overlay_pix_fmt; @@ -1372,6 +1373,10 @@ banshee_cmd_read(banshee_t *banshee, uint32_t addr) ret = banshee->agpReqSize; break; + case Agp_agpMoveCMD: + ret = banshee->agpMoveCMD; + break; + case cmdBaseAddr0: ret = voodoo->cmdfifo_base >> 12; #if 0 @@ -1694,6 +1699,7 @@ banshee_cmd_write(void *priv, uint32_t addr, uint32_t val) #if 0 banshee_log("AGP: %d bytes W%d from %08x S%d to %d:%08x S%d\n", src_end - src_addr, src_width, src_addr, src_stride, (val >> 3) & 3, dest_addr, dest_stride); #endif + banshee->agpMoveCMD = val; switch ((val >> 3) & 3) { case 0: /*Linear framebuffer (Banshee)*/ case 1: /*Planar YUV*/ diff --git a/src/video/vid_voodoo_fb.c b/src/video/vid_voodoo_fb.c index cb5a614d456..1c140873f1d 100644 --- a/src/video/vid_voodoo_fb.c +++ b/src/video/vid_voodoo_fb.c @@ -373,7 +373,6 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *priv) colour_data[0].b = val & 0xff; colour_data[0].g = (val >> 8) & 0xff; colour_data[0].r = (val >> 16) & 0xff; - alpha_data[0] = 0xff; write_mask = LFB_WRITE_COLOUR; addr >>= 1; break; @@ -383,12 +382,14 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *priv) depth_data[0] = val >> 16; write_mask = LFB_WRITE_BOTH; count = 1; + addr >>= 1; break; case LFB_FORMAT_DEPTH_RGB555: colour_data[0] = argb1555[val & 0xffff]; depth_data[0] = val >> 16; write_mask = LFB_WRITE_BOTH; count = 1; + addr >>= 1; break; case LFB_FORMAT_DEPTH_ARGB1555: colour_data[0] = argb1555[val & 0xffff]; @@ -396,6 +397,7 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *priv) depth_data[0] = val >> 16; write_mask = LFB_WRITE_BOTH; count = 1; + addr >>= 1; break; case LFB_FORMAT_DEPTH: From 47b16bb5dccb821a61857b1c52b3c3173cbba824 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 18 Dec 2025 01:44:31 +0600 Subject: [PATCH 078/320] Revert "Merge pull request #6017 from Cacodemon345/ndr-memory-blocks" This reverts commit cc46ea4d8eb3f32019a4fe9f315cfa573187fd9c, reversing changes made to a2056d7fd86b47b5dc657fa7c427bb9e3a9d31c1. Needs more work for 6.0. --- src/codegen_new/codegen_allocator.c | 90 +++-------------------------- src/codegen_new/codegen_block.c | 4 -- 2 files changed, 8 insertions(+), 86 deletions(-) diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index ac19038694d..4719dfc399f 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -7,7 +7,6 @@ # include #endif -#include #include #include #include @@ -19,59 +18,6 @@ #include "codegen.h" #include "codegen_allocator.h" -#include "codegen_backend.h" - -struct mem_code_block_t; - -typedef struct mem_code_block_t -{ - struct mem_code_block_t* prev; - struct mem_code_block_t* next; - - int number; -} mem_code_block_t; - -static bool valid_code_blocks[BLOCK_SIZE]; -static mem_code_block_t mem_code_blocks[BLOCK_SIZE]; -static mem_code_block_t* mem_code_block_head = NULL; -static mem_code_block_t* mem_code_block_tail = NULL; - -static void -remove_from_block_list(mem_code_block_t* block) -{ - valid_code_blocks[block->number] = 0; - if (block->prev) { - block->prev->next = block->next; - if (block->next) { - block->next->prev = block->prev; - } else { - mem_code_block_tail = block->prev; - } - } else if (block->next) { - mem_code_block_head = block->next; - if (mem_code_block_head && mem_code_block_head->next) { - mem_code_block_head->next->prev = mem_code_block_head; - } - } else if (block == mem_code_block_head) { - mem_code_block_head = mem_code_block_tail = NULL; - } - block->next = block->prev = NULL; -} - -static void -add_to_block_list(int code_block) -{ - if (!mem_code_block_head) { - mem_code_block_head = &mem_code_blocks[code_block]; - mem_code_block_head->number = code_block; - mem_code_block_tail = mem_code_block_head; - } else { - mem_code_block_tail->next = &mem_code_blocks[code_block]; - mem_code_blocks[code_block].prev = mem_code_block_tail; - mem_code_block_tail = &mem_code_blocks[code_block]; - mem_code_blocks[code_block].number = code_block; - } -} typedef struct mem_block_t { uint32_t offset; /*Offset into mem_block_alloc*/ @@ -107,26 +53,15 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) mem_block_t *block; uint32_t block_nr; - if (!mem_block_free_list) { - if (mem_code_block_head == mem_code_block_tail) { - fatal("Out of memory blocks!\n"); - } else { - mem_code_block_t* mem_code_block = mem_code_block_head; - while (mem_code_block) { - if (code_block != mem_code_block->number) { - codegen_delete_block(&codeblock[mem_code_block->number]); - } - mem_code_block = mem_code_block->next; - } - - if (mem_block_free_list) - goto block_allocate; - - fatal("Out of memory blocks!\n"); - } + while (!mem_block_free_list) { + /*Pick a random memory block and free the owning code block*/ + block_nr = rand() & MEM_BLOCK_MASK; + block = &mem_blocks[block_nr]; + + if (block->code_block && block->code_block != code_block) + codegen_delete_block(&codeblock[block->code_block]); } -block_allocate: /*Remove from free list*/ block_nr = mem_block_free_list; block = &mem_blocks[block_nr - 1]; @@ -137,14 +72,8 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) /*Add to parent list*/ block->next = parent->next; parent->next = block_nr; - } else { + } else block->next = 0; - - if (!valid_code_blocks[code_block]) { - valid_code_blocks[code_block] = 1; - add_to_block_list(code_block); - } - } codegen_allocator_usage++; return block; @@ -154,9 +83,6 @@ codegen_allocator_free(mem_block_t *block) { int block_nr = (((uintptr_t) block - (uintptr_t) mem_blocks) / sizeof(mem_block_t)) + 1; - if (valid_code_blocks[block->code_block]) - remove_from_block_list(&mem_code_blocks[block->code_block]); - while (1) { int next_block_nr = block->next; codegen_allocator_usage--; diff --git a/src/codegen_new/codegen_block.c b/src/codegen_new/codegen_block.c index 97dd4927bf2..ff82384bedd 100644 --- a/src/codegen_new/codegen_block.c +++ b/src/codegen_new/codegen_block.c @@ -559,10 +559,6 @@ codegen_block_start_recompile(codeblock_t *block) fatal("Recompile to used block!\n"); #endif - if (block->head_mem_block) { - codegen_allocator_free(block->head_mem_block); - block->head_mem_block = NULL; - } block->head_mem_block = codegen_allocator_allocate(NULL, block_current); block->data = codeblock_allocator_get_ptr(block->head_mem_block); From 913c7c682b50b7d86afc703764aa426212baa64d Mon Sep 17 00:00:00 2001 From: TC1995 Date: Wed, 17 Dec 2025 22:13:37 +0100 Subject: [PATCH 079/320] Refresh rate fixes for mach8/32 and tgui9440/96x0 The Trident ones are a reworked port of MAME's code. --- src/video/vid_ati_mach8.c | 62 +++++++++++++-------------------------- src/video/vid_tgui9440.c | 36 ++++++++++++++++------- 2 files changed, 46 insertions(+), 52 deletions(-) diff --git a/src/video/vid_ati_mach8.c b/src/video/vid_ati_mach8.c index b9092881b60..81abadd5666 100644 --- a/src/video/vid_ati_mach8.c +++ b/src/video/vid_ati_mach8.c @@ -2371,7 +2371,7 @@ mach_out(uint16_t addr, uint8_t val, void *priv) svga->write_bank = mach->bank_w << 16; if (mach->index == 0xbe) { - if ((old ^ val) & 0x10) { + if ((old ^ val) & 0x13) { mach_log("ATI BE bit 4.\n"); svga_recalctimings(svga); } @@ -3320,30 +3320,30 @@ mach_recalctimings(svga_t *svga) } else { dev->mode = VGA_MODE; if (!svga->scrblank && svga->attr_palette_enable) { - mach_log("GDCREG5=%02x, ATTR10=%02x, ATI B0 bit 5=%02x, ON=%d.\n", - svga->gdcreg[5] & 0x60, svga->attrregs[0x10] & 0x40, mach->regs[0xb0] & 0x20, dev->on); + mach_log("GDCREG5=%02x, ATTR10=%02x, ATI B0 bit 5=%02x, ON=%d, char_width=%d, seqreg1 bit 3=%x, clk_sel=%02x.\n", + svga->gdcreg[5] & 0x60, svga->attrregs[0x10] & 0x40, mach->regs[0xb0] & 0x20, dev->on, svga->char_width, svga->seqregs[1] & 0x08, clock_sel); + if (ATI_MACH32) + svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel, svga->clock_gen); + else + svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel ^ 0x08, svga->clock_gen); + + switch ((mach->regs[0xb8] >> 6) & 3) { + case 1: + svga->clock *= 2.0; + break; + case 2: + svga->clock *= 3.0; + break; + case 3: + svga->clock *= 4.0; + break; + default: + break; + } mach_log("VGA clock sel=%02x, divide reg=%02x, miscout bits2-3=%x, machregbe bit4=%02x, machregb9 bit1=%02x, charwidth=%d, htotal=%02x, hdisptime=%02x, seqregs1 bit 3=%02x.\n", clock_sel, (mach->regs[0xb8] >> 6) & 3, svga->miscout & 0x0c, mach->regs[0xbe] & 0x10, mach->regs[0xb9] & 0x02, svga->char_width, svga->htotal, svga->hdisp_time, svga->seqregs[1] & 8); if ((svga->gdcreg[6] & 0x01) || (svga->attrregs[0x10] & 0x01)) { if ((svga->gdcreg[5] & 0x40) || (svga->attrregs[0x10] & 0x40) || (mach->regs[0xb0] & 0x20)) { - if (ATI_MACH32) - svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel, svga->clock_gen); - else - svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel ^ 0x08, svga->clock_gen); - - switch ((mach->regs[0xb8] >> 6) & 3) { - case 1: - svga->clock *= 2.0; - break; - case 2: - svga->clock *= 3.0; - break; - case 3: - svga->clock *= 4.0; - break; - default: - break; - } svga->map8 = svga->pallook; mach_log("Lowres=%x, seqreg[1]bit3=%x.\n", svga->lowres, svga->seqregs[1] & 8); if (svga->lowres) @@ -3356,26 +3356,6 @@ mach_recalctimings(svga_t *svga) } } } - } else { - if (ATI_MACH32) - svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel, svga->clock_gen); - else - svga->clock = (cpuclock * (double) (1ULL << 32)) / svga->getclock(clock_sel ^ 0x08, svga->clock_gen); - - switch ((mach->regs[0xb8] >> 6) & 3) { - case 0: - default: - break; - case 1: - svga->clock *= 2.0; - break; - case 2: - svga->clock *= 3.0; - break; - case 3: - svga->clock *= 4.0; - break; - } } } } diff --git a/src/video/vid_tgui9440.c b/src/video/vid_tgui9440.c index 30f76abfa77..28c02363c73 100644 --- a/src/video/vid_tgui9440.c +++ b/src/video/vid_tgui9440.c @@ -161,7 +161,7 @@ typedef struct tgui_t { uint8_t ramdac_ctrl; uint8_t alt_clock; - int clock_m, clock_n, clock_k; + uint16_t vclk; uint32_t vram_size, vram_mask; @@ -567,17 +567,18 @@ tgui_out(uint16_t addr, uint8_t val, void *priv) return; case 0x3DB: - tgui->alt_clock = val & 0xe3; + tgui->alt_clock = val; + svga_recalctimings(svga); return; case 0x43c8: - tgui->clock_n = val & 0x7f; - tgui->clock_m = (tgui->clock_m & ~1) | (val >> 7); - break; + tgui->vclk = (tgui->vclk & 0xff00) | val; + svga_recalctimings(svga); + return; case 0x43c9: - tgui->clock_m = (tgui->clock_m & ~0x1e) | ((val << 1) & 0x1e); - tgui->clock_k = (val & 0x10) >> 4; - break; + tgui->vclk = (tgui->vclk & 0x00ff) | (val << 8); + svga_recalctimings(svga); + return; default: break; @@ -693,6 +694,9 @@ tgui_recalctimings(svga_t *svga) uint8_t ger22lower = (tgui->accel.ger22 & 0xff); uint8_t ger22upper = (tgui->accel.ger22 >> 8); int std_vga_clock = 1; + int m = 0; + int n = 0; + int k = 0; if (tgui->type >= TGUI_9440) { if ((svga->crtc[0x38] & 0x19) == 0x09) @@ -764,13 +768,23 @@ tgui_recalctimings(svga_t *svga) svga->lowres = !(svga->crtc[0x2a] & 0x40); if (tgui->type >= TGUI_9440) { - if (svga->miscout & 8) - svga->clock = (cpuclock * (double) (1ULL << 32)) / (((tgui->clock_n + 8) * 14318180.0) / ((tgui->clock_m + 2) * (1 << tgui->clock_k))); + // Bits 0-6: M + // Bits 7-11: N + // Bit 12: K + // Later formula extends each variable by one extra bit (Providia 9685 and later) + if (((svga->miscout & 0x0c) >> 2) == 0x02) { + m = tgui->vclk & 0x007f; + n = (tgui->vclk & 0x0f80) >> 7; + k = (tgui->vclk & 0x1000) >> 12; + svga->clock = (cpuclock * (double) (1ULL << 32)) / (((m + 8) * 14318180.0) / ((n + 2) * (1 << k))); + } - if (svga->gdcreg[0xf] & 0x08) + if ((svga->gdcreg[0xf] & 0x08) || (tgui->alt_clock & 0x20)) svga->clock *= 2.0; else if (svga->gdcreg[0xf] & 0x40) svga->clock *= 3.0; + + pclog("GDCREGF=%02x, miscout=%02x.\n", svga->gdcreg[0xf] & 0x48, svga->miscout & 0x0c); } else { //pclog("TGUI9400CXi: Clock double=%d.\n", (((svga->miscout >> 2) & 3) | ((tgui->newctrl2 << 2) & 4) | ((tgui->newctrl2 >> 3) & 8))); switch (((svga->miscout >> 2) & 3) | ((tgui->newctrl2 << 2) & 4) | ((tgui->newctrl2 >> 3) & 8)) { From 6b3fa522ab562c091ea1e51b19bc0a4a02cc2e87 Mon Sep 17 00:00:00 2001 From: Yuuya <83148287+YuuyaGitHub@users.noreply.github.com> Date: Thu, 18 Dec 2025 08:32:19 +0900 Subject: [PATCH 080/320] Refine Japanese translations in ja-JP.po Updated various Japanese translations to remove unnecessary punctuation and improve consistency. --- src/qt/languages/ja-JP.po | 48 +++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 967316e991c..cfd44dabab2 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -1667,7 +1667,7 @@ msgid "Unknown Bus" msgstr "不明なバス" msgid "Null Driver" -msgstr "ヌル・ドライバー" +msgstr "ヌルドライバー" msgid "NIC:" msgstr "NIC:" @@ -1778,16 +1778,16 @@ msgid "Novell NetWare 2.x Key Card" msgstr "Novell NetWare 2.xキーカード" msgid "Serial port passthrough 1" -msgstr "シリアル・ポート・パススルー 1" +msgstr "シリアルポートパススルー 1" msgid "Serial port passthrough 2" -msgstr "シリアル・ポート・パススルー 2" +msgstr "シリアルポートパススルー 2" msgid "Serial port passthrough 3" -msgstr "シリアル・ポート・パススルー 3" +msgstr "シリアルポートパススルー 3" msgid "Serial port passthrough 4" -msgstr "シリアル・ポート・パススルー 4" +msgstr "シリアルポートパススルー 4" msgid "Renderer &options…" msgstr "レンダラー設定(&O)…" @@ -2015,10 +2015,10 @@ msgid "Chorus Voices" msgstr "コーラスの声" msgid "Chorus Level" -msgstr "コーラス・レベル" +msgstr "コーラスレベル" msgid "Chorus Speed" -msgstr "コーラス・スピード" +msgstr "コーラススピード" msgid "Chorus Depth" msgstr "コーラスの深さ" @@ -2030,16 +2030,16 @@ msgid "Reverb" msgstr "リバーブ" msgid "Reverb Room Size" -msgstr "リバーブ・ルームの大きさ" +msgstr "リバーブルームの大きさ" msgid "Reverb Damping" -msgstr "リバーブ・ダンピング" +msgstr "リバーブダンピング" msgid "Reverb Width" msgstr "リバーブ幅" msgid "Reverb Level" -msgstr "リバーブ・レベル" +msgstr "リバーブレベル" msgid "Interpolation Method" msgstr "補間法" @@ -2054,7 +2054,7 @@ msgid "Reversed stereo" msgstr "逆ステレオ" msgid "Nice ramp" -msgstr "ナイス・スロープ" +msgstr "ナイススロープ" msgid "Hz" msgstr "ヘルツ" @@ -2144,7 +2144,7 @@ msgid "SID Filter Strength" msgstr "SIDフィルターの強度" msgid "Surround module" -msgstr "サラウンド・モジュール" +msgstr "サラウンドモジュール" msgid "SB Address" msgstr "SBアドレス" @@ -2219,7 +2219,7 @@ msgid "Display type" msgstr "表示タイプ" msgid "Composite type" -msgstr "コンポジット・タイプ" +msgstr "コンポジットタイプ" msgid "RGB type" msgstr "RGBタイプ" @@ -2228,7 +2228,7 @@ msgid "Line doubling type" msgstr "ライン倍増タイプ" msgid "Snow emulation" -msgstr "スノー・エミュレーション" +msgstr "スノーエミュレーション" msgid "Monitor type" msgstr "モニタータイプ" @@ -2255,7 +2255,7 @@ msgid "Font" msgstr "フォント" msgid "Bilinear filtering" -msgstr "バイリニア・フィルタリング" +msgstr "バイリニアフィルタリング" msgid "Video chroma-keying" msgstr "ビデオのクロマキー処理" @@ -2549,16 +2549,16 @@ msgid "Apply overscan deltas" msgstr "オーバースキャンデルタを適用する" msgid "Mono Interlaced" -msgstr "モノラル・インターレース" +msgstr "モノラルインターレース" msgid "Mono Non-Interlaced" -msgstr "モノラル・ノンインターレース" +msgstr "モノラルノンインターレース" msgid "Color Interlaced" -msgstr "カラー・インターレース" +msgstr "カラーインターレース" msgid "Color Non-Interlaced" -msgstr "カラー・ノンインターレース" +msgstr "カラーノンインターレース" msgid "3Dfx Voodoo Graphics" msgstr "3dfx Voodooグラフィック" @@ -2594,7 +2594,7 @@ msgid "Stereo LPT DAC" msgstr "ステレオLPT DAC" msgid "Generic Text Printer" -msgstr "汎用テキスト・プリンタ" +msgstr "汎用テキストプリンタ" msgid "Generic ESC/P 2 Dot-Matrix Printer" msgstr "汎用ESC/P 2ドットマトリクスプリンタ" @@ -2606,19 +2606,19 @@ msgid "Generic PCL5e Printer" msgstr "汎用PCL5eプリンタ" msgid "Parallel Line Internet Protocol" -msgstr "パラレルライン・インターネット・プロトコル" +msgstr "パラレルラインインターネットプロトコル" msgid "Protection Dongle for Savage Quest" -msgstr "サベージ・クエスト用プロテクション・ドングル" +msgstr "サベージクエスト用プロテクションドングル" msgid "Serial Passthrough Device" -msgstr "シリアル・ポート・パススルー・デバイス" +msgstr "シリアルポートパススルーデバイス" msgid "Passthrough Mode" msgstr "パススルーモード" msgid "Host Serial Device" -msgstr "ホスト・シリアル・デバイス" +msgstr "ホストシリアルデバイス" msgid "Name of pipe" msgstr "パイプ名" From 738a92571a9526954770bda3aae809c1eaedb330 Mon Sep 17 00:00:00 2001 From: Bozo Scum Date: Thu, 18 Dec 2025 18:45:16 +0800 Subject: [PATCH 081/320] Update zh-TW.po * adjust some translations --- src/qt/languages/zh-TW.po | 70 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 0247c6148fc..156dbb2fe2a 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -373,13 +373,13 @@ msgid "Dynamic Recompiler" msgstr "動態重編譯器" msgid "CPU frame size" -msgstr "CPU 影格大小" +msgstr "CPU 執行期框架大小" msgid "Larger frames (less smooth)" -msgstr "大執行幀 (操作欠平滑)" +msgstr "大執行期框架 (運行欠平順)" msgid "Smaller frames (smoother)" -msgstr "小執行幀 (操作更平滑)" +msgstr "小執行期框架 (運行更平順)" msgid "Video:" msgstr "顯示卡:" @@ -766,7 +766,7 @@ msgid "Floppy & CD-ROM drives" msgstr "軟碟/光碟機" msgid "Other removable devices" -msgstr "其他卸除式裝置" +msgstr "其他抽取式裝置" msgid "Other peripherals" msgstr "其他周邊裝置" @@ -790,13 +790,13 @@ msgid "File" msgstr "檔案" msgid "C" -msgstr "C" +msgstr "磁柱" msgid "H" -msgstr "H" +msgstr "磁頭" msgid "S" -msgstr "S" +msgstr "磁區" msgid "KB" msgstr "KB" @@ -811,10 +811,10 @@ msgid "Type" msgstr "類型" msgid "No PCap devices found" -msgstr "未找到 PCap 裝置" +msgstr "未發現 PCap 裝置" msgid "Invalid PCap device" -msgstr "無效 PCap 裝置" +msgstr "無效的 PCap 裝置" msgid "Generic paddle controller(s)" msgstr "通用旋鈕控制器" @@ -988,7 +988,7 @@ msgid "Make sure %1 is installed and that you are on a %1-compatible network con msgstr "請確認 %1 已安裝且使用相容 %1 的網路連線。" msgid "Invalid configuration" -msgstr "無效設定" +msgstr "無效組態" msgid "%1 is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." msgstr "自動將 PostScript 檔案轉換為 PDF 需要 %1。\n\n使用通用 PostScript 印表機列印的文件將被儲存為 PostScript (.ps) 檔案。" @@ -1021,7 +1021,7 @@ msgid "GLSL shaders" msgstr "GLSL 著色器" msgid "You are loading an unsupported configuration" -msgstr "正在載入一個不受支援的設定" +msgstr "正在載入一個不受支援的組態" msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." msgstr "此模擬電腦停用了基於選定電腦的 CPU 類型過濾。\n\n能夠選中與所選機器本不相容的 CPU,但是可能會遇到與機器 BIOS 或其他軟體不相容的問題。\n\n啟用此設定不受官方支援,並且提交的任何錯誤報告可能會視為無效而結案。" @@ -1114,16 +1114,16 @@ msgid "Choose directory" msgstr "選擇目錄" msgid "Choose configuration file" -msgstr "選擇設定檔" +msgstr "選擇組態檔" msgid "86Box configuration files (86box.cfg)" -msgstr "86Box 設定檔 (86box.cfg)" +msgstr "86Box 組態檔 (86box.cfg)" msgid "Configuration read failed" -msgstr "設定讀取失敗" +msgstr "組態讀取失敗" msgid "Unable to open the selected configuration file for reading: %1" -msgstr "無法開啟選取的設定檔進行讀取: %1" +msgstr "無法開啟選取的組態檔進行讀取: %1" msgid "Use regular expressions in search box" msgstr "在搜尋方塊中使用正規表示式" @@ -1141,25 +1141,25 @@ msgid "This will help you add a new system to 86Box." msgstr "這將協助您在 86Box 中加入新系統。" msgid "New configuration" -msgstr "新增設定" +msgstr "新增組態" msgid "Complete" msgstr "完成" msgid "The wizard will now launch the configuration for the new system." -msgstr "精靈現在會啟動新系統的設定。" +msgstr "精靈現在會啟動新系統的組態。" msgid "Use existing configuration" -msgstr "使用現有設定" +msgstr "使用現有組態" msgid "Type some notes here" msgstr "在此輸入備註" msgid "Paste the contents of the existing configuration file into the box below." -msgstr "將現有設定檔的內容貼到下面的方塊中。" +msgstr "將現有組態檔的內容貼到下面的方塊中。" msgid "Load configuration from file" -msgstr "從檔案載入設定" +msgstr "從檔案載入組態" msgid "System name" msgstr "系統名稱" @@ -1261,10 +1261,10 @@ msgid "Unable to create the directory for the new system" msgstr "無法為新系統建立目錄" msgid "Configuration write failed" -msgstr "設定寫入失敗" +msgstr "組態寫入失敗" msgid "Unable to open the configuration file at %1 for writing" -msgstr "無法開啟 %1 的設定檔進行寫入" +msgstr "無法開啟 %1 的組態檔進行寫入" msgid "Error adding system" msgstr "新增系統錯誤" @@ -1309,7 +1309,7 @@ msgid "Show &config file" msgstr "顯示設定檔(&C)" msgid "No screenshot" -msgstr "沒有擷圖" +msgstr "沒有螢幕畫面擷取" msgid "Search" msgstr "搜尋" @@ -1429,7 +1429,7 @@ msgid "Dynamic-size VHD" msgstr "動態大小 VHD" msgid "Differencing VHD" -msgstr "差分 VHD" +msgstr "差異影像 VHD" msgid "(N/A)" msgstr "(不適用)" @@ -1450,7 +1450,7 @@ msgid "Dynamic-size VHD (.vhd)" msgstr "動態大小 VHD (.vhd)" msgid "Differencing VHD (.vhd)" -msgstr "差分 VHD (.vhd)" +msgstr "差異影像 VHD (.vhd)" msgid "Large blocks (2 MB)" msgstr "大區塊 (2 MB)" @@ -1567,7 +1567,7 @@ msgid "Failed to initialize network driver" msgstr "初始化網路驅動程式失敗" msgid "The network configuration will be switched to the null driver" -msgstr "網路設定將切換為空驅動程式" +msgstr "網路組態將切換為空驅動程式" msgid "Mouse sensitivity:" msgstr "滑鼠靈敏度:" @@ -1594,13 +1594,13 @@ msgid "WinBox is no longer supported" msgstr "不再支援 WinBox" msgid "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behavior will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." -msgstr "WinBox 於 2022 年因缺乏維護者而停止發展。由於我們傾注全力於將 86Box 做的更好,我們決定不再支援將 WinBox 做為管理員。\n\n在 WinBox 未提供更新前,搭配新版本的 86Box 使用將導致不正確的行為。任何由 WinBox 引起的錯誤回報將以無效結案。\n\n請造訪 86box.net 網站以取得其他可用的管理員列表。" +msgstr "WinBox 於 2022 年因缺乏維護者而停止發展。由於我們傾注全力於將 86Box 做的更好,我們決定不再支援將 WinBox 做為前端管理程式。\n\n在 WinBox 未提供更新前,搭配新版本的 86Box 使用將導致不正確的行為。任何由 WinBox 引起的錯誤回報將以無效結案。\n\n請造訪 86box.net 網站以取得其他可用的前端管理程式列表。" msgid "Generate" msgstr "產生" msgid "Joystick configuration" -msgstr "搖桿設定" +msgstr "搖桿組態" msgid "Device" msgstr "裝置" @@ -1630,7 +1630,7 @@ msgid "Show non-&primary monitors" msgstr "顯示非主要監視器(&P)" msgid "Open screenshots &folder…" -msgstr "開啟螢幕擷取畫面資料夾(&F)…" +msgstr "開啟螢幕畫面擷取資料夾(&F)…" msgid "Appl&y fullscreen stretch mode when maximized" msgstr "最大化時套用全螢幕延展模式(&Y)" @@ -1711,7 +1711,7 @@ msgid "\nFalling back to software rendering." msgstr "\n回退到軟體渲染。" msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" -msgstr "

當選擇媒體影像 (CD-ROM、軟碟等) 時,開啟對話方塊會在與 86Box 設定檔相同的目錄中開始。此設定可能只會在 macOS 上有所影響。

" +msgstr "

當選擇媒體影像 (CD-ROM、軟碟等) 時,開啟對話方塊會在與 86Box 組態檔相同的目錄中開始。此設定可能只會在 macOS 上有所影響。

" msgid "This machine might have been moved or copied." msgstr "這台機器可能已被移動或複製。" @@ -2044,7 +2044,7 @@ msgid "Reverb Output Gain" msgstr "迴響輸出增益" msgid "Reversed stereo" -msgstr "反向立體聲" +msgstr "左右互換立體聲" msgid "Nice ramp" msgstr "平滑漸變曲線" @@ -2104,7 +2104,7 @@ msgid "Initial RAM size" msgstr "初始 RAM 大小" msgid "Serial Number" -msgstr "序列號" +msgstr "序號" msgid "Host ID" msgstr "主機 ID" @@ -2737,7 +2737,7 @@ msgid "Shader Manager" msgstr "著色器管理員" msgid "Shader Configuration" -msgstr "著色器設定" +msgstr "著色器組態" msgid "Add" msgstr "新增" @@ -2791,7 +2791,7 @@ msgid "Toggle UI in fullscreen" msgstr "全螢幕模式下切換使用者介面顯示" msgid "Screenshot" -msgstr "螢幕擷取畫面" +msgstr "螢幕畫面擷取" msgid "Release mouse pointer" msgstr "放開滑鼠游標" @@ -2929,7 +2929,7 @@ msgid "The system will not be added." msgstr "系統將不會被新增。" msgid "&Update mouse every CPU frame" -msgstr "每 CPU 幀更新滑鼠(&U)" +msgstr "每 CPU 執行期框架更新滑鼠(&U)" msgid "Hue" msgstr "色調" From 45dcc4273fb073f4aba8cc7262faddcd9feb10a6 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 19 Dec 2025 01:48:17 +0600 Subject: [PATCH 082/320] Tail track list + double linked list for memory blocks --- src/codegen_new/codegen_allocator.c | 104 +++++++++++++++++++++++++--- src/codegen_new/codegen_block.c | 4 ++ 2 files changed, 97 insertions(+), 11 deletions(-) diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index 4719dfc399f..157c3cc0b5a 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -7,6 +7,7 @@ # include #endif +#include #include #include #include @@ -18,10 +19,64 @@ #include "codegen.h" #include "codegen_allocator.h" +#include "codegen_backend.h" + +struct mem_code_block_t; + +typedef struct mem_code_block_t +{ + struct mem_code_block_t* prev; + struct mem_code_block_t* next; + + int number; +} mem_code_block_t; + +static bool valid_code_blocks[BLOCK_SIZE]; +static mem_code_block_t mem_code_blocks[BLOCK_SIZE]; +static mem_code_block_t* mem_code_block_head = NULL; +static mem_code_block_t* mem_code_block_tail = NULL; + +static void +remove_from_block_list(mem_code_block_t* block) +{ + valid_code_blocks[block->number] = 0; + if (block->prev) { + block->prev->next = block->next; + if (block->next) { + block->next->prev = block->prev; + } else { + mem_code_block_tail = block->prev; + } + } else if (block->next) { + mem_code_block_head = block->next; + if (mem_code_block_head && mem_code_block_head->next) { + mem_code_block_head->next->prev = mem_code_block_head; + } + } else if (block == mem_code_block_head) { + mem_code_block_head = mem_code_block_tail = NULL; + } + block->next = block->prev = NULL; +} + +static void +add_to_block_list(int code_block) +{ + if (!mem_code_block_head) { + mem_code_block_head = &mem_code_blocks[code_block]; + mem_code_block_head->number = code_block; + mem_code_block_tail = mem_code_block_head; + } else { + mem_code_block_tail->next = &mem_code_blocks[code_block]; + mem_code_blocks[code_block].prev = mem_code_block_tail; + mem_code_block_tail = &mem_code_blocks[code_block]; + mem_code_blocks[code_block].number = code_block; + } +} typedef struct mem_block_t { uint32_t offset; /*Offset into mem_block_alloc*/ uint32_t next; + uint32_t tail; uint16_t code_block; } mem_block_t; @@ -39,6 +94,7 @@ codegen_allocator_init(void) for (uint32_t c = 0; c < MEM_BLOCK_NR; c++) { mem_blocks[c].offset = c * MEM_BLOCK_SIZE; mem_blocks[c].code_block = BLOCK_INVALID; + mem_blocks[c].tail = 0; if (c < MEM_BLOCK_NR - 1) mem_blocks[c].next = c + 2; else @@ -53,15 +109,26 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) mem_block_t *block; uint32_t block_nr; - while (!mem_block_free_list) { - /*Pick a random memory block and free the owning code block*/ - block_nr = rand() & MEM_BLOCK_MASK; - block = &mem_blocks[block_nr]; - - if (block->code_block && block->code_block != code_block) - codegen_delete_block(&codeblock[block->code_block]); + if (!mem_block_free_list) { + if (mem_code_block_head == mem_code_block_tail) { + fatal("Out of memory blocks!\n"); + } else { + mem_code_block_t* mem_code_block = mem_code_block_head; + while (mem_code_block) { + if (code_block != mem_code_block->number) { + codegen_delete_block(&codeblock[mem_code_block->number]); + } + mem_code_block = mem_code_block->next; + } + + if (mem_block_free_list) + goto block_allocate; + + fatal("Out of memory blocks!\n"); + } } +block_allocate: /*Remove from free list*/ block_nr = mem_block_free_list; block = &mem_blocks[block_nr - 1]; @@ -70,10 +137,21 @@ codegen_allocator_allocate(mem_block_t *parent, int code_block) block->code_block = code_block; if (parent) { /*Add to parent list*/ - block->next = parent->next; - parent->next = block_nr; - } else - block->next = 0; + if (parent->tail) { + mem_blocks[parent->tail - 1].next = block_nr; + parent->tail = block_nr; + } + else + parent->next = parent->tail = block_nr; + block->next = block->tail = 0; + } else { + block->next = block->tail = 0; + + if (!valid_code_blocks[code_block]) { + valid_code_blocks[code_block] = 1; + add_to_block_list(code_block); + } + } codegen_allocator_usage++; return block; @@ -83,6 +161,10 @@ codegen_allocator_free(mem_block_t *block) { int block_nr = (((uintptr_t) block - (uintptr_t) mem_blocks) / sizeof(mem_block_t)) + 1; + block->tail = 0; + if (valid_code_blocks[block->code_block]) + remove_from_block_list(&mem_code_blocks[block->code_block]); + while (1) { int next_block_nr = block->next; codegen_allocator_usage--; diff --git a/src/codegen_new/codegen_block.c b/src/codegen_new/codegen_block.c index ff82384bedd..97dd4927bf2 100644 --- a/src/codegen_new/codegen_block.c +++ b/src/codegen_new/codegen_block.c @@ -559,6 +559,10 @@ codegen_block_start_recompile(codeblock_t *block) fatal("Recompile to used block!\n"); #endif + if (block->head_mem_block) { + codegen_allocator_free(block->head_mem_block); + block->head_mem_block = NULL; + } block->head_mem_block = codegen_allocator_allocate(NULL, block_current); block->data = codeblock_allocator_get_ptr(block->head_mem_block); From 02925e15844d1b0f723a3aac1014f3cc6d7b5fc2 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Fri, 19 Dec 2025 16:28:03 -0300 Subject: [PATCH 083/320] Change the P6SBA hardware monitor's second voltage to Vtt --- src/machine/m_at_slot1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 0c4be22497f..630231046f5 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -1057,8 +1057,8 @@ machine_at_p6sba_init(const machine_t *model) device_add_params(&w83977_device, (void *) (W83977TF | W83977_AMI | W83977_NO_NVR)); device_add(&intel_flash_bxt_device); spd_register(SPD_TYPE_SDRAM, 0x7, 256); - device_add(&w83781d_device); /* fans: CPU1, CPU2, Thermal Control; temperatures: unused, CPU1, CPU2 */ - hwm_values.voltages[1] = 3300; /* Seems to be the I/O voltage, reported as "CPUi/o" in the Leadtek BIOS and "CPU2" in the SuperMicro BIOS */ + device_add(&w83781d_device); /* fans: CPU1, CPU2, Thermal Control; temperatures: unused, CPU1, CPU2 */ + hwm_values.voltages[1] = 1500; /* potentially Vtt; Leadtek BIOS calls it CPUi/o; Supermicro BIOS calls it CPU2 and reads a voltage this low as N/A */ return ret; } From ff0a8bad1feb95e033f2cab232a7f2005c5b8177 Mon Sep 17 00:00:00 2001 From: richardg867 Date: Fri, 19 Dec 2025 16:54:16 -0300 Subject: [PATCH 084/320] Remove redundant BIOS selector from the Thomson TO16 --- src/machine/m_xt.c | 37 +++++-------------------------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index e5906030c08..2d314b7f2eb 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -1704,27 +1704,6 @@ machine_xt_pcxt_init(const machine_t *model) static const device_config_t to16_config[] = { // clang-format off - { - .name = "bios", - .description = "BIOS Version", - .type = CONFIG_BIOS, - .default_string = "to16", - .default_int = 0, - .file_filter = NULL, - .spinner = { 0 }, - .bios = { - { - .name = "1.03", - .internal_name = "to16", - .bios_type = BIOS_NORMAL, - .files_no = 1, - .local = 0, - .size = 32768, - .files = { "roms/machines/to16/TO16_103.bin", "" } - }, - { .files_no = 0 } - }, - }, { .name = "rtc_port", .description = "Onboard RTC", @@ -1777,23 +1756,17 @@ const device_t to16_device = { int machine_xt_to16_init(const machine_t *model) { - int ret = 0; - int rtc_port = 0; - const char *fn; + int ret; - /* No ROMs available. */ - if (!device_available(model->device)) + ret = bios_load_linear("roms/machines/to16/TO16_103.bin", 0x000f8000, 32768, 0); + + if (bios_only || !ret) return ret; device_context(model->device); - rtc_port = machine_get_config_int("rtc_port"); - fn = device_get_bios_file(model->device, device_get_config_bios("bios"), 0); - ret = bios_load_linear(fn, 0x000f8000, 32768, 0); + int rtc_port = machine_get_config_int("rtc_port"); device_context_restore(); - if (bios_only || !ret) - return ret; - machine_xt_clone_init(model, 0); if (rtc_port != 0) From 2afa0e7503f8e551c115c34dab7f9c93893499df Mon Sep 17 00:00:00 2001 From: Domppari Date: Fri, 19 Dec 2025 21:56:23 +0200 Subject: [PATCH 085/320] FDD Support for detecting if in BIOS POST test mode or normal operations mode. Used to change FDD audio samples for the drive to match real HW BIOS FDD POST test sounds. --- src/floppy/fdc.c | 6 ++++ src/floppy/fdd.c | 70 ++++++++++++++++++++++++++++++++--------- src/floppy/fdd_audio.c | 4 +-- src/include/86box/fdd.h | 12 +++++++ 4 files changed, 76 insertions(+), 16 deletions(-) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index c1bf0461895..de0549ca42d 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -784,6 +784,9 @@ fdc_sis(fdc_t *fdc) static void fdc_soft_reset(fdc_t *fdc) { + /* Reset boot status to POST on controller soft reset */ + fdd_boot_status_reset(); + if (fdc->power_down) { timer_set_delay_u64(&fdc->timer, 1000 * TIMER_USEC); fdc->interrupt = -5; @@ -2403,6 +2406,9 @@ fdc_reset(void *priv) fdc_t *fdc = (fdc_t *) priv; + /* Reset boot status to POST on controller reset */ + fdd_boot_status_reset(); + default_rwc = (fdc->flags & FDC_FLAG_START_RWC_1) ? 1 : 0; fdc->enable_3f1 = 1; diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 30be0979af8..fbf5c1cd117 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -101,6 +101,9 @@ typedef struct fdd_pending_op_t { static fdd_pending_op_t fdd_pending[FDD_NUM]; +/* BIOS boot status tracking */ +static bios_boot_status_t bios_boot_status = BIOS_BOOT_POST; + char floppyfns[FDD_NUM][512]; char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY]; @@ -212,9 +215,9 @@ int fdd_do_log = ENABLE_FDD_LOG; static void fdd_log(const char *fmt, ...) { - va_list ap, ap_copy; + va_list ap; char timebuf[32]; - char fullbuf[1056]; // 32 + 1024 bytes for timestamp + message + char fullbuf[1056]; /* 32 + 1024 bytes for timestamp + message */ if (fdd_do_log) { uint32_t ticks = plat_get_ticks(); @@ -224,27 +227,58 @@ fdd_log(const char *fmt, ...) snprintf(timebuf, sizeof(timebuf), "[%07u.%03u] ", seconds, milliseconds); va_start(ap, fmt); - va_copy(ap_copy, ap); - strcpy(fullbuf, timebuf); - vsnprintf(fullbuf + strlen(timebuf), sizeof(fullbuf) - strlen(timebuf), fmt, ap_copy); - - va_end(ap_copy); - va_end(ap); - - va_start(ap, fmt); + vsnprintf(fullbuf + strlen(timebuf), sizeof(fullbuf) - strlen(timebuf), fmt, ap); va_end(ap); - char *msg = fullbuf; - va_start(ap, fmt); - pclog_ex("%s", (va_list) &msg); - va_end(ap); + pclog("%s", fullbuf); } } #else # define fdd_log(fmt, ...) #endif +/* + * BIOS boot status functions + * + * These functions track whether the system is in BIOS POST (Power-On Self Test) + * or has transitioned to normal operation. The POST state is set on: + * - System hard reset (fdd_reset) + * - FDC soft reset (fdd_boot_status_reset) + * + * POST is considered complete when the first floppy read operation occurs, + * indicating that BIOS has finished POST and is attempting to boot. + */ +bios_boot_status_t +fdd_get_boot_status(void) +{ + return bios_boot_status; +} + +void +fdd_set_boot_status(bios_boot_status_t status) +{ + if (bios_boot_status != status) { + fdd_log("BIOS boot status changed: %s -> %s\n", + bios_boot_status == BIOS_BOOT_POST ? "POST" : "NORMAL", + status == BIOS_BOOT_POST ? "POST" : "NORMAL"); + bios_boot_status = status; + } +} + +void +fdd_boot_status_reset(void) +{ + fdd_log("BIOS boot status reset to POST\n"); + bios_boot_status = BIOS_BOOT_POST; +} + +int +fdd_is_post_complete(void) +{ + return (bios_boot_status == BIOS_BOOT_NORMAL); +} + void fdd_set_audio_profile(int drive, int profile) { @@ -778,6 +812,9 @@ fdd_get_bitcell_period(int rate) void fdd_reset(void) { + /* Reset boot status to POST on system reset */ + fdd_boot_status_reset(); + for (uint8_t i = 0; i < FDD_NUM; i++) { drives[i].id = i; timer_add(&(fdd_poll_time[i]), fdd_poll, &drives[i], 0); @@ -789,6 +826,11 @@ fdd_readsector(int drive, int sector, int track, int side, int density, int sect { fdd_log("fdd_readsector(%d, %d, %d, %d, %d, %d)\n", drive, sector, track, side, density, sector_size); + /* First floppy read operation marks POST as complete */ + if (bios_boot_status == BIOS_BOOT_POST) { + fdd_set_boot_status(BIOS_BOOT_NORMAL); + } + if (fdd_seek_in_progress[drive]) { fdd_log("Seek in progress on drive %d, deferring READ (trk=%d->%d, side=%d, sec=%d)\n", drive, fdd[drive].track, track, side, sector); diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 9bd9aeea6ef..1657db92454 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -92,14 +92,14 @@ extern int fdd_get_audio_profile(int drive); static int16_t *load_wav(const char *filename, int *sample_count); # ifdef ENABLE_FDD_LOG -int fdc_do_log = ENABLE_FDD_LOG; +static int fdd_audio_do_log = ENABLE_FDD_LOG; static void fdd_log(const char *fmt, ...) { va_list ap; - if (fdc_do_log) { + if (fdd_audio_do_log) { va_start(ap, fmt); pclog_ex(fmt, ap); va_end(ap); diff --git a/src/include/86box/fdd.h b/src/include/86box/fdd.h index a173279a4d5..2ac46d6510d 100644 --- a/src/include/86box/fdd.h +++ b/src/include/86box/fdd.h @@ -26,6 +26,12 @@ #define SEEK_RECALIBRATE -999 #define DEFAULT_SEEK_TIME_MS 10.0 +/* BIOS boot status - used to detect POST vs normal operation */ +typedef enum bios_boot_status_t { + BIOS_BOOT_POST = 0, /* System is in POST (Power-On Self Test) */ + BIOS_BOOT_NORMAL /* POST complete, normal operation */ +} bios_boot_status_t; + #ifdef __cplusplus extern "C" { #endif @@ -118,6 +124,12 @@ extern int fdd_hole(int drive); extern void fdd_stop(int drive); extern void fdd_do_writeback(int drive); +/* BIOS boot status functions */ +extern bios_boot_status_t fdd_get_boot_status(void); +extern void fdd_set_boot_status(bios_boot_status_t status); +extern void fdd_boot_status_reset(void); +extern int fdd_is_post_complete(void); + extern int motorspin; extern uint64_t motoron[FDD_NUM]; From 9c6eccbf5adcb618035d177498d90698458d09d9 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 18:01:30 -0300 Subject: [PATCH 086/320] AC97 Codec: Add the ICE1232/VT1611A codec --- src/include/86box/snd_ac97.h | 3 +++ src/sound/snd_ac97_codec.c | 24 +++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/include/86box/snd_ac97.h b/src/include/86box/snd_ac97.h index 0bad4efa032..a0b5a8d727a 100644 --- a/src/include/86box/snd_ac97.h +++ b/src/include/86box/snd_ac97.h @@ -108,6 +108,7 @@ #define AC97_CODEC_ALC100 AC97_VENDOR_ID('A', 'L', 'C', 0x20) #define AC97_CODEC_CS4297 AC97_VENDOR_ID('C', 'R', 'Y', 0x03) #define AC97_CODEC_CS4297A AC97_VENDOR_ID('C', 'R', 'Y', 0x11) +#define AC97_CODEC_ICE1232 AC97_VENDOR_ID('I', 'C', 'E', 0x11) #define AC97_CODEC_STAC9708 AC97_VENDOR_ID(0x83, 0x84, 0x76, 0x08) #define AC97_CODEC_STAC9721 AC97_VENDOR_ID(0x83, 0x84, 0x76, 0x09) #define AC97_CODEC_TR28023 AC97_VENDOR_ID('T', 'R', 'A', 0x03) @@ -161,9 +162,11 @@ extern const device_t alc100_device; extern const device_t cs4297_device; extern const device_t cs4297a_device; # define ct1297_device tr28023_device +extern const device_t ice1232_device; extern const device_t stac9708_device; extern const device_t stac9721_device; extern const device_t tr28023_device; +# define vt1611a_device ice1232_device extern const device_t w83971d_device; extern const device_t wm9701a_device; #ifdef USE_SOFTMODEM diff --git a/src/sound/snd_ac97_codec.c b/src/sound/snd_ac97_codec.c index 0713568732d..c028e429dd9 100644 --- a/src/sound/snd_ac97_codec.c +++ b/src/sound/snd_ac97_codec.c @@ -35,7 +35,7 @@ static const struct { uint16_t reset_flags; uint16_t extid_flags; uint8_t pcsr_mask; /* register 26 bits [15:8] */ - uint8_t eascr_mask; /* register 2A bits [14:11] (audio) or 56 bits ... */ + uint8_t eascr_mask; /* register 2A bits [14:11] */ uint8_t modem_flags; uint16_t gpi_mask; /* modem GPIO input-capable bits */ uint16_t gpo_mask; /* modem GPIO output-capable bits */ @@ -80,6 +80,14 @@ static const struct { .pcsr_mask = 0xff, .vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x5e, 0x0000, 0x01b0}, {0, 0x60, 0x0023, 0x0001}, {0, 0x68, 0x0000, 0xdfff}, {0}} }, + { + .device = &ice1232_device, + .misc_flags = AC97_AUDIO | AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK, + .reset_flags = AC97_HPOUT | AC97_DAC_18B | AC97_ADC_18B | (27 << AC97_3D_SHIFT), + .extid_flags = AC97_VRA | AC97_AMAP, + .pcsr_mask = 0xff, + .vendor_regs = (const ac97_vendor_reg_t[]) {{0, 0x5a, 0x0021, 0x00fd}, {0}} + }, { .device = &stac9708_device, .misc_flags = AC97_AUDIO | AC97_AUXOUT | AC97_MONOOUT | AC97_PCBEEP | AC97_PHONE | AC97_VIDEO | AC97_AUXIN | AC97_MS | AC97_LPBK, @@ -890,6 +898,20 @@ const device_t cs4297a_device = { .config = NULL }; +const device_t ice1232_device = { + .name = "ICEnsemble ICE1232 / VIA VT1611A", + .internal_name = "ice1232", + .flags = DEVICE_AC97, + .local = AC97_CODEC_ICE1232, + .init = ac97_codec_init, + .close = ac97_codec_close, + .reset = ac97_codec_reset, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = NULL +}; + const device_t stac9708_device = { .name = "SigmaTel STAC9708", .internal_name = "stac9708", From 9be74a7a466c8fb834d15d5416ac42ed921f3134 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 18:02:14 -0300 Subject: [PATCH 087/320] Change MS-6318 AC97 codec to VT1611A matching pictures, and add it to the VIA controller if the onboard CT5880 is not selected --- src/machine/m_at_socket370.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index ee75752db90..a1ec1a30c75 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -611,10 +611,9 @@ machine_at_ms6318_init(const machine_t *model) hwm_values.temperatures[1] += 2; /* System offset */ hwm_values.temperatures[2] = 0; /* unused */ - if (sound_card_current[0] == SOUND_INTERNAL) { + if (sound_card_current[0] == SOUND_INTERNAL) device_add(machine_get_snd_device(machine)); - device_add(&stac9708_device); - } + device_add(&vt1611a_device); /* for both VIA and CT5880 options */ return ret; } From 851db09abbf6dff473e5962b788c0d327a324fe2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 19 Dec 2025 22:04:55 +0100 Subject: [PATCH 088/320] ABIT AB-BX6 - make the EG BIOS default as it was before the QS BIOS was added. --- src/machine/m_at_slot1.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 630231046f5..d4a4742e5d9 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -425,7 +425,7 @@ static const device_config_t bx6_config[] = { .bios = { { .name = "Award Modular BIOS v4.51PG - Revision EG", - .internal_name = "bx6_eg", + .internal_name = "bx6", .bios_type = BIOS_NORMAL, .files_no = 1, .local = 0, @@ -434,7 +434,7 @@ static const device_config_t bx6_config[] = { }, { .name = "Award Modular BIOS v4.51PG - Revision QS", - .internal_name = "bx6", + .internal_name = "bx6_qs", .bios_type = BIOS_NORMAL, .files_no = 1, .local = 0, From a99577d2eba3a0cb0396071fcc6b4a1132e4ef13 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 19 Dec 2025 22:30:28 +0100 Subject: [PATCH 089/320] ABit AB-BX6: Force bit 4 of CMOS register 39h to 1, fixes intermittent POST freezes on POST code AAh on later BIOS revisions. --- src/nvr_at.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/nvr_at.c b/src/nvr_at.c index ae7bd8bb490..2e04ddc6f06 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -635,6 +635,13 @@ nvr_reg_write(uint16_t reg, uint8_t val, void *priv) nvr_reg_common_write(reg, val, nvr, local); break; + case 0x39: + if (machines[machine].init == machine_at_bx6_init) + nvr_reg_common_write(reg, val | 0x08, nvr, local); + else + nvr_reg_common_write(reg, val, nvr, local); + break; + default: /* non-RTC registers are just NVRAM */ nvr_reg_common_write(reg, val, nvr, local); break; @@ -794,6 +801,14 @@ nvr_read(uint16_t addr, void *priv) ret = nvr->regs[local->addr[addr_id]]; break; + case 0x39: + if (!(local->lock[local->addr[addr_id]] & 0x02)) { + ret = nvr->regs[local->addr[addr_id]]; + if (machines[machine].init == machine_at_bx6_init) + ret |= 0x08; + } + break; + case 0x3e: case 0x3f: if (!nvr->is_new && (local->flags & FLAG_AMI_1995_HACK)) { From 854a3af014be983066e3a345d98a044ecda4de80 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 19 Dec 2025 22:51:02 +0100 Subject: [PATCH 090/320] Force bit 0 to 1 as well, fixes AA hang on first POST. --- src/nvr_at.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nvr_at.c b/src/nvr_at.c index 2e04ddc6f06..09ce1e57ea4 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -637,7 +637,7 @@ nvr_reg_write(uint16_t reg, uint8_t val, void *priv) case 0x39: if (machines[machine].init == machine_at_bx6_init) - nvr_reg_common_write(reg, val | 0x08, nvr, local); + nvr_reg_common_write(reg, val | 0x09, nvr, local); else nvr_reg_common_write(reg, val, nvr, local); break; @@ -805,7 +805,7 @@ nvr_read(uint16_t addr, void *priv) if (!(local->lock[local->addr[addr_id]] & 0x02)) { ret = nvr->regs[local->addr[addr_id]]; if (machines[machine].init == machine_at_bx6_init) - ret |= 0x08; + ret |= 0x09; } break; From fddfeb51cae034a6f4d50056747cf41169f85607 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 19 Dec 2025 23:07:24 +0100 Subject: [PATCH 091/320] Improve the fix, now it actually remembers the CPU settings. --- src/nvr_at.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/nvr_at.c b/src/nvr_at.c index 09ce1e57ea4..38a97560bb8 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -637,7 +637,7 @@ nvr_reg_write(uint16_t reg, uint8_t val, void *priv) case 0x39: if (machines[machine].init == machine_at_bx6_init) - nvr_reg_common_write(reg, val | 0x09, nvr, local); + nvr_reg_common_write(reg, val | 0x08, nvr, local); else nvr_reg_common_write(reg, val, nvr, local); break; @@ -805,7 +805,7 @@ nvr_read(uint16_t addr, void *priv) if (!(local->lock[local->addr[addr_id]] & 0x02)) { ret = nvr->regs[local->addr[addr_id]]; if (machines[machine].init == machine_at_bx6_init) - ret |= 0x09; + ret |= 0x08; } break; @@ -1231,6 +1231,9 @@ nvr_at_init(const device_t *info) if (nvr->is_new && (machines[machine].init == machine_at_spitfire_init)) nvr->regs[0x33] = nvr->regs[0x34] = 0xff; + if (nvr->is_new && (machines[machine].init == machine_at_bx6_init)) + nvr->regs[0x39] = 0x09; + return nvr; } From 84733be8081c7c569bd09731108c2aa40eea4add Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 19:20:32 -0300 Subject: [PATCH 092/320] OPTi 82C9xx: Fix capitalization --- src/sound/snd_optimc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sound/snd_optimc.c b/src/sound/snd_optimc.c index e9198b9f0e9..5ea5d773c46 100644 --- a/src/sound/snd_optimc.c +++ b/src/sound/snd_optimc.c @@ -1285,7 +1285,7 @@ const device_t mirosound_pcm10_device = { }; const device_t opti_82c930_device = { - .name = "OPTi 82c930", + .name = "OPTi 82C930", .internal_name = "opti_82c930", .flags = DEVICE_ISA16, .local = OPTI_930 | OPTIMC_CS4231, @@ -1299,7 +1299,7 @@ const device_t opti_82c930_device = { }; const device_t opti_82c931_device = { - .name = "OPTi 82c931", + .name = "OPTi 82C931", .internal_name = "opti_82c931", .flags = DEVICE_ISA16, .local = OPTI_930 | OPTIMC_CS4231 | OPTI_931, From f1e7533d3eb0fca4fae804594a6b594e989bf40a Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 19:51:32 -0300 Subject: [PATCH 093/320] Change PC5286 KBC hack away from string comparison --- src/machine/machine_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 0cd58032ab2..af72dda82c7 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -20598,7 +20598,7 @@ machine_has_flags_ex(int flags) int ret = machine_has_flags(machine, flags); if (flags & MACHINE_PS2_KBC) { - if (machine_is_ps2 && (strcmp(machine_get_internal_name(), "pc5286"))) + if (machine_is_ps2 && (machines[machine].init != machine_at_pc5286_init)) ret |= MACHINE_PS2_KBC; else ret &= ~MACHINE_PS2_KBC; From 40d79cb7e9a1a1d4c6d35cd9c1233794c1eb988f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 20:02:52 -0300 Subject: [PATCH 094/320] Fix force interpreter option flashing on startup --- src/qt/qt_mainwindow.ui | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index dee2c338cf5..777455d5be2 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -308,6 +308,10 @@ + + + :/menuicons/qt/icons/interpreter.ico:/menuicons/qt/icons/interpreter.ico + true From 0f2ce379499e785478885b0f13466c1612bb9656 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 21:39:10 -0300 Subject: [PATCH 095/320] Add an asset path within the macOS app bundle --- src/86box.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/86box.c b/src/86box.c index fe5dcf5b7c1..50821b77396 100644 --- a/src/86box.c +++ b/src/86box.c @@ -767,8 +767,10 @@ pc_init(int argc, char *argv[]) p = path_get_filename(exe_path); *p = '\0'; #if defined(__APPLE__) + char contents_path[2048] = {0}; c = strlen(exe_path); if ((c >= 16) && !strcmp(&exe_path[c - 16], "/Contents/MacOS/")) { + strncpy(contents_path, exe_path, c - 7); exe_path[c - 16] = '\0'; p = path_get_filename(exe_path); *p = '\0'; @@ -1035,10 +1037,18 @@ pc_init(int argc, char *argv[]) path_append_filename(temp, usr_path, "assets"); asset_add_path(temp); - // Add the standard ROM path in the same directory as the executable. + // Add the standard asset path in the same directory as the executable. path_append_filename(temp, exe_path, "assets"); asset_add_path(temp); +#ifdef __APPLE__ + // Add the standard asset path within the app bundle. + if (contents_path[0] != '\0') { + path_append_filename(temp, contents_path, "Resources/assets"); + asset_add_path(temp); + } +#endif + plat_init_asset_paths(); /* From 5aadad24fc52b49eed0d25a303b5bfe1fb286d02 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 22:17:31 -0300 Subject: [PATCH 096/320] Jenkins: Add assets to release builds --- .ci/build.sh | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/.ci/build.sh b/.ci/build.sh index fb360b826bf..834ea0f4b7f 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -880,6 +880,31 @@ then exit 5 fi +# Download assets if we're making a release build. +if grep -qiE "^BUILD_TYPE:[^=]+=release" build/CMakeCache.txt 2> /dev/null +then + git_repo=$(git remote get-url origin 2> /dev/null) + if [ "$CI" = "true" ] + then + # Backup strategy when running under Jenkins. + [ -z "$git_repo" ] && git_repo=$GIT_URL + fi + if [ -n "$git_repo" ] + then + echo [-] Downloading assets + cd archive_tmp + if ! git clone --depth 1 "$(dirname "$git_repo")/assets.git" assets + then + echo [!] Assets download failed + exit 7 + fi + # Remove dot directories (including .git) and top level files. + rm -rf assets/.* + rm -f assets/* 2> /dev/null + cd .. + fi +fi + # Archive the executable and its dependencies. # The executable should always be archived last for the check after this block. status=0 @@ -902,7 +927,7 @@ then [ ! -e "archive_tmp/discord_game_sdk.dll" ] && echo [!] No Discord Game SDK for architecture [$arch_discord] # Archive XAudio2 DLL if required. - grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt || cp -p "/home/$project/dll$arch/xaudio2"* archive_tmp/ + grep -qiE "^OPENAL:BOOL=ON" build/CMakeCache.txt || cp -p "/home/$project/dll$arch/xaudio2"* archive_tmp/ # Archive executable, while also stripping it if requested. if [ $strip -ne 0 ] @@ -971,6 +996,14 @@ then done fi + # Archive assets. + if [ -d archive_tmp/assets ] + then + data_dir="archive_tmp/"*".app/Contents" + mkdir -p "$data_dir/Resources" + mv archive_tmp/assets "$data_dir/Resources/assets" + fi + # Sign app bundle, unless we're in an universal build. [ $skip_archive -eq 0 ] && codesign --force --deep $(mac_signidentity) -o runtime --entitlements src/mac/entitlements.plist --timestamp "archive_tmp/"*".app" elif [ "$BUILD_TAG" = "precondition" ] @@ -982,7 +1015,7 @@ else cwd_root="$(pwd)" check_buildtag "libs.$arch_deb" - if grep -q "OPENAL:BOOL=ON" build/CMakeCache.txt + if grep -qiE "^OPENAL:BOOL=ON" build/CMakeCache.txt then # Build openal-soft 1.23.1 manually to fix audio issues. This is a temporary # workaround until a newer version of openal-soft trickles down to Debian repos. @@ -1133,6 +1166,14 @@ else done project_icon=$(find "$icon_base/"[0-9]*x[0-9]*/* -type f -name '*.png' -o -name '*.svg' | head -1 | grep -oP '/\K([^/]+)(?=\.[^\.]+$)') + # Archive assets. + if [ -d archive_tmp/assets ] + then + data_dir="archive_tmp/usr/local/share/$project" + mkdir -p "$data_dir" + mv archive_tmp/assets "$data_dir/assets" + fi + # Archive executable, while also stripping it if requested. mkdir -p archive_tmp/usr/local/bin if [ $strip -ne 0 ] From 456d82e83339d498d60692fc919d957f4c406221 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 22:37:04 -0300 Subject: [PATCH 097/320] Jenkins: Fix assets insertion in macOS [skip ci] --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index 834ea0f4b7f..4d866891179 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -999,7 +999,7 @@ then # Archive assets. if [ -d archive_tmp/assets ] then - data_dir="archive_tmp/"*".app/Contents" + data_dir="$(echo "archive_tmp/"*".app/Contents")" mkdir -p "$data_dir/Resources" mv archive_tmp/assets "$data_dir/Resources/assets" fi From 008061548b22f8a9c5838f7a7aa66ad8bdfd1a34 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 22:39:47 -0300 Subject: [PATCH 098/320] Jenkins: Suppress warning on assets directory cleanup [skip ci] --- .ci/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/build.sh b/.ci/build.sh index 4d866891179..a5b20f2aa63 100755 --- a/.ci/build.sh +++ b/.ci/build.sh @@ -899,7 +899,7 @@ then exit 7 fi # Remove dot directories (including .git) and top level files. - rm -rf assets/.* + rm -rf assets/.* 2> /dev/null rm -f assets/* 2> /dev/null cd .. fi From e3a2bca7612ebf304ae549a39e772f780c0f7b8d Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Fri, 19 Dec 2025 22:45:39 -0300 Subject: [PATCH 099/320] Fix internal name for HP Holly --- src/include/86box/machine.h | 2 +- src/machine/m_at_socket7_3v.c | 10 +++++----- src/machine/machine_table.c | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 789168d6e34..6b84d2b5775 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -971,7 +971,7 @@ extern const device_t p54tp4xe_device; #endif extern int machine_at_p54tp4xe_init(const machine_t *); extern int machine_at_exp8551_init(const machine_t *); -extern int machine_at_hpholly_init(const machine_t *); +extern int machine_at_holly_init(const machine_t *); #ifdef EMU_DEVICE_H extern const device_t vectra52_device; #endif diff --git a/src/machine/m_at_socket7_3v.c b/src/machine/m_at_socket7_3v.c index c3672c8e618..a1ea769405c 100644 --- a/src/machine/m_at_socket7_3v.c +++ b/src/machine/m_at_socket7_3v.c @@ -158,7 +158,7 @@ machine_at_exp8551_init(const machine_t *model) } static void -machine_at_hpholly_gpio_init(void) +machine_at_holly_gpio_init(void) { uint32_t gpio = 0xffffe2ff; @@ -193,19 +193,19 @@ machine_at_hpholly_gpio_init(void) } int -machine_at_hpholly_init(const machine_t *model) /* HP Pavilion Holly, 7070/7090/5100/7100 */ +machine_at_holly_init(const machine_t *model) /* HP Pavilion Holly, 7070/7090/5100/7100 */ { int ret; - ret = bios_load_linear_combined("roms/machines/hpholly/1005CA2L.BIO", - "roms/machines/hpholly/1005CA2L.BI1", + ret = bios_load_linear_combined("roms/machines/holly/1005CA2L.BIO", + "roms/machines/holly/1005CA2L.BI1", 0x20000, 128); if (bios_only || !ret) return ret; machine_at_common_init_ex(model, 2); - machine_at_hpholly_gpio_init(); + machine_at_holly_gpio_init(); pci_init(PCI_CONFIG_TYPE_1); pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index af72dda82c7..792409e9b05 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -13427,10 +13427,10 @@ const machine_t machines[] = { Command 0xA0 copyright string: (C)1994 AMI . */ { .name = "[i430FX] HP Pavilion 51xx/7070/7090/71xx (Holly)", - .internal_name = "hpholly", + .internal_name = "holly", .type = MACHINE_TYPE_SOCKET7_3V, .chipset = MACHINE_CHIPSET_INTEL_430FX, - .init = machine_at_hpholly_init, + .init = machine_at_holly_init, .p1_handler = machine_generic_p1_handler, .gpio_handler = NULL, .available_flag = MACHINE_AVAILABLE, From 251d5e6ced3b110fbdcff0b9c2e0f94b947f3cbf Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Sat, 20 Dec 2025 18:21:51 +0500 Subject: [PATCH 100/320] Manager: Re-enable search by machine configuration --- src/qt/qt_vmmanager_system.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index d54dfad196a..5c9fd3d014d 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -305,13 +305,11 @@ void VMManagerSystem::generateSearchTerms() { searchTerms.clear(); -#if 0 for (const auto &value : display_table.values()) if (value.contains(";")) searchTerms.append(value.split(';')); else searchTerms.append(value); -#endif searchTerms.append(displayName); searchTerms.append(config_name); QRegularExpression whitespaceRegex("\\s+"); From 3b8dc9a0c130c7405ac018e64cfe767544a4fc49 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 20 Dec 2025 21:58:12 +0600 Subject: [PATCH 101/320] Do perspective correction with floating-point math Fixes Actua Soccer with Matrox Mystique patch --- src/video/vid_mga.c | 54 ++++++++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 11 deletions(-) diff --git a/src/video/vid_mga.c b/src/video/vid_mga.c index 68de89767f5..07b0869f797 100644 --- a/src/video/vid_mga.c +++ b/src/video/vid_mga.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include <86box/86box.h> #include <86box/io.h> @@ -5149,7 +5150,7 @@ static uint16_t texture_texel_fetch(mystique_t *mystique, int *tex_r, int *tex_g *atransp = 0; break; case TEXCTL_TEXFORMAT_TW15: - src = ((uint16_t *) svga->vram)[((mystique->dwgreg.texorg >> 1) + (t * tex_pitch) + s) & mystique->vram_mask_w]; + src = *(uint16_t*)((&svga->vram[(mystique->dwgreg.texorg + ((t * tex_pitch) + s) * 2) & mystique->vram_mask])); *tex_r = ((src >> 10) & 0x1f) << 3; *tex_g = ((src >> 5) & 0x1f) << 3; *tex_b = (src & 0x1f) << 3; @@ -5159,7 +5160,7 @@ static uint16_t texture_texel_fetch(mystique_t *mystique, int *tex_r, int *tex_g *atransp = 0; break; case TEXCTL_TEXFORMAT_TW12: - src = ((uint16_t *) svga->vram)[((mystique->dwgreg.texorg >> 1) + (t * tex_pitch) + s) & mystique->vram_mask_w]; + src = *(uint16_t*)((&svga->vram[(mystique->dwgreg.texorg + ((t * tex_pitch) + s) * 2) & mystique->vram_mask])); *tex_r = ((src >> 8) & 0xf) << 4; *tex_g = ((src >> 4) & 0xf) << 4; *tex_b = (src & 0xf) << 4; @@ -5173,7 +5174,7 @@ static uint16_t texture_texel_fetch(mystique_t *mystique, int *tex_r, int *tex_g } break; case TEXCTL_TEXFORMAT_TW16: - src = ((uint16_t *) svga->vram)[((mystique->dwgreg.texorg >> 1) + (t * tex_pitch) + s) & mystique->vram_mask_w]; + src = *(uint16_t*)((&svga->vram[(mystique->dwgreg.texorg + ((t * tex_pitch) + s) * 2) & mystique->vram_mask])); *tex_r = (src >> 11) << 3; *tex_g = ((src >> 5) & 0x3f) << 2; *tex_b = (src & 0x1f) << 3; @@ -5190,6 +5191,40 @@ static double lerp(double v0, double v1, double t) { return (1. - t) * v0 + t * v1; } +// Taken from GZDoom. +static inline double +FixedToFloat(int fixed) +{ + return fixed * (1.0 / (1 << 16)); +} + +static inline void +persp_correct(mystique_t* mystique, int* s, int* t, int* q, double* s_frac, double* t_frac) +{ + const int s_shift = 20 - (mystique->dwgreg.texwidth & TEXWIDTH_TW_MASK); + const int t_shift = 20 - (mystique->dwgreg.texheight & TEXHEIGHT_TH_MASK); + double s_d = ((*s) >> s_shift); + double t_d = ((*t) >> t_shift); + double q_d = FixedToFloat(*q); + + double throwaway1 = 0; + double throwaway2 = 0; + if (q_d == 0.0) + q_d = INFINITY; + + s_d *= 1. / q_d; + t_d *= 1. / q_d; + + *s_frac = fabs(modf(s_d, &throwaway1)); + *t_frac = fabs(modf(s_d, &throwaway2)); + + (void)throwaway1; + (void)throwaway2; + + *s = s_d; + *t = t_d; +} + static int texture_read(mystique_t *mystique, int *tex_r, int *tex_g, int *tex_b, int *atransp, int *tex_a) { @@ -5223,14 +5258,11 @@ texture_read(mystique_t *mystique, int *tex_r, int *tex_g, int *tex_b, int *atra s_frac = (((int32_t) mystique->dwgreg.tmr[6]) & ((1 << s_shift) - 1)) / (double)(1 << s_shift); t_frac = (((int32_t) mystique->dwgreg.tmr[7]) & ((1 << t_shift) - 1)) / (double)(1 << t_shift); } else { - const int s_shift = (20 + 16) - (mystique->dwgreg.texwidth & TEXWIDTH_TW_MASK); - const int t_shift = (20 + 16) - (mystique->dwgreg.texheight & TEXHEIGHT_TH_MASK); - int64_t q = mystique->dwgreg.tmr[8] ? (0x100000000LL / (int64_t) (int32_t) mystique->dwgreg.tmr[8]) : 0; - - s = ((int64_t) (int32_t) mystique->dwgreg.tmr[6] * q) >> s_shift; - t = ((int64_t) (int32_t) mystique->dwgreg.tmr[7] * q) >> t_shift; - s_frac = (((int64_t) (int32_t) mystique->dwgreg.tmr[6] * q) & ((1 << s_shift) - 1)) / (double)(1 << s_shift); - t_frac = (((int64_t) (int32_t) mystique->dwgreg.tmr[7] * q) & ((1 << t_shift) - 1)) / (double)(1 << t_shift); + int q = (int32_t)mystique->dwgreg.tmr[8]; + s = (int32_t) mystique->dwgreg.tmr[6]; + t = (int32_t) mystique->dwgreg.tmr[7]; + + persp_correct(mystique, &s, &t, &q, &s_frac, &t_frac); } if (mystique->dwgreg.texctl & TEXCTL_CLAMPU) { From 430eda39f5454f6e1df4a904a20201593c8ab042 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 20 Dec 2025 20:02:10 +0100 Subject: [PATCH 102/320] New recompiler: Temporarily disable the recompilation of FPU opcode D9 44, so Blood II's gameplay music works. --- src/codegen_new/codegen.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/codegen_new/codegen.c b/src/codegen_new/codegen.c index 875dd72ca15..d234d8c1b4c 100644 --- a/src/codegen_new/codegen.c +++ b/src/codegen_new/codegen.c @@ -676,6 +676,9 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p if ((recomp_op_table == recomp_opcodes) && (opcode == 0x48)) goto codegen_skip; #endif + /* TODO: Fix the recompilation so Blood II's gameplay music no longer breaks! */ + if ((recomp_op_table == recomp_opcodes_d9) && (opcode == 0x44)) + goto codegen_skip; if (in_lock && ((opcode == 0x90) || (opcode == 0xec))) goto codegen_skip; From da146ac7df93a02508c8c42286aa3533d5fda570 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 16:06:28 -0300 Subject: [PATCH 103/320] Unify ROM and asset path appending into a single function with duplicate checking --- src/mem/rom.c | 80 ++++++++++++++++++++++----------------------------- 1 file changed, 35 insertions(+), 45 deletions(-) diff --git a/src/mem/rom.c b/src/mem/rom.c index 5798b4252ee..c2959e1b360 100644 --- a/src/mem/rom.c +++ b/src/mem/rom.c @@ -55,64 +55,54 @@ rom_log(const char *fmt, ...) # define rom_log(fmt, ...) #endif -void -rom_add_path(const char *path) +static void +add_path(rom_path_t *list, const char *path) { - char cwd[1024] = { 0 }; - - rom_path_t *rom_path = &rom_paths; - - if (rom_paths.path[0] != '\0') { - // Iterate to the end of the list. - while (rom_path->next != NULL) { - rom_path = rom_path->next; - } - - // Allocate the new entry. - rom_path = rom_path->next = calloc(1, sizeof(rom_path_t)); - } + rom_path_t *rom_path = calloc(1, sizeof(rom_path_t)); - // Save the path, turning it into absolute if needed. + /* Save the path, turning it into absolute if needed. */ if (!path_abs((char *) path)) { - plat_getcwd(cwd, sizeof(cwd)); - path_slash(cwd); - snprintf(rom_path->path, sizeof(rom_path->path), "%s%s", cwd, path); + plat_getcwd(rom_path->path, sizeof(rom_path->path)); + path_append_filename(rom_path->path, rom_path->path, path); } else { - snprintf(rom_path->path, sizeof(rom_path->path), "%s", path); + strncpy(rom_path->path, path, sizeof(rom_path->path) - 1); } - // Ensure the path ends with a separator. + /* Ensure the path ends with a separator. */ path_slash(rom_path->path); -} - -void -asset_add_path(const char *path) -{ - char cwd[1024] = { 0 }; - - rom_path_t *asset_path = &asset_paths; - if (asset_paths.path[0] != '\0') { - // Iterate to the end of the list. - while (asset_path->next != NULL) { - asset_path = asset_path->next; + /* Iterate to the end of the list. */ + if (list->path[0] != '\0') { + while (1) { + /* Check for duplicates. */ + if (!strcmp(list->path, rom_path->path)) { + free(rom_path); + return; + } + if (list->next == NULL) + break; + list = list->next; } - // Allocate the new entry. - asset_path = asset_path->next = calloc(1, sizeof(rom_path_t)); - } - - // Save the path, turning it into absolute if needed. - if (!path_abs((char *) path)) { - plat_getcwd(cwd, sizeof(cwd)); - path_slash(cwd); - snprintf(asset_path->path, sizeof(asset_path->path), "%s%s", cwd, path); + /* Add the new entry. */ + list->next = rom_path; } else { - snprintf(asset_path->path, sizeof(asset_path->path), "%s", path); + /* Set path on the first entry. */ + memcpy(list, rom_path, sizeof(rom_path_t)); + free(rom_path); } +} + +void +rom_add_path(const char *path) +{ + add_path(&rom_paths, path); +} - // Ensure the path ends with a separator. - path_slash(asset_path->path); +void +asset_add_path(const char *path) +{ + add_path(&asset_paths, path); } static int From 34e835a4f0ddacd460fb244b8fba94d44f5c3bc9 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 16:07:20 -0300 Subject: [PATCH 104/320] Add an asset path within the AppImage (in case XDG_DATA_DIRS is not the AppImage default) --- src/86box.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/86box.c b/src/86box.c index 50821b77396..1d4e527c817 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1041,12 +1041,19 @@ pc_init(int argc, char *argv[]) path_append_filename(temp, exe_path, "assets"); asset_add_path(temp); -#ifdef __APPLE__ +#if defined(__APPLE__) // Add the standard asset path within the app bundle. if (contents_path[0] != '\0') { path_append_filename(temp, contents_path, "Resources/assets"); asset_add_path(temp); } +#elif !defined(_WIN32) + // Add the standard asset path within the AppImage. + p = getenv("APPDIR"); + if (p && (p[0] != '\0')) { + path_append_filename(temp, p, "usr/local/share/" EMU_NAME "/assets"); + asset_add_path(temp); + } #endif plat_init_asset_paths(); From bc7008c54843de5a8c0c230b7f6cbd043474428b Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 16:12:21 -0300 Subject: [PATCH 105/320] Use EMU_NAME macros in paths --- src/include/86box/version.h.in | 2 +- src/qt/qt_platform.cpp | 14 ++++++------- src/unix/unix.c | 38 +++++++++++++++++----------------- 3 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/include/86box/version.h.in b/src/include/86box/version.h.in index 096bb651618..693bb80951d 100644 --- a/src/include/86box/version.h.in +++ b/src/include/86box/version.h.in @@ -50,7 +50,7 @@ /* Web URL info. */ #define EMU_SITE "86box.net" #define EMU_SITE_W LSTR(EMU_SITE) -#define EMU_ROMS_URL "https://github.com/86Box/roms/releases/latest" +#define EMU_ROMS_URL "https://github.com/@CMAKE_PROJECT_NAME@/roms/releases/latest" #define EMU_ROMS_URL_W LSTR(EMU_ROMS_URL) #ifdef RELEASE_BUILD # define EMU_DOCS_URL "https://86box.readthedocs.io/en/v@CMAKE_PROJECT_VERSION_MAJOR@.@CMAKE_PROJECT_VERSION_MINOR@/" diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index a042d8b7d16..37653c5a37f 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -273,7 +273,7 @@ plat_getcwd(char *bufp, int max) strncpy(bufp, exe_path, max); # else CharPointer(bufp, max) = QDir::homePath().toUtf8(); - path_append_filename(bufp, bufp, "Library/86Box"); + path_append_filename(bufp, bufp, "Library/" EMU_NAME); # endif #else CharPointer(bufp, max) = QDir::currentPath().toUtf8(); @@ -828,10 +828,10 @@ plat_init_rom_paths(void) for (auto &path : paths) { #ifdef __APPLE__ - rom_add_path(QDir(path).filePath("net.86Box.86Box/roms").toUtf8().constData()); - rom_add_path(QDir(path).filePath("86Box/roms").toUtf8().constData()); + rom_add_path(QDir(path).filePath("net." EMU_NAME "." EMU_NAME "/roms").toUtf8().constData()); + rom_add_path(QDir(path).filePath(EMU_NAME "/roms").toUtf8().constData()); #else - rom_add_path(QDir(path).filePath("86Box/roms").toUtf8().constData()); + rom_add_path(QDir(path).filePath(EMU_NAME "/roms").toUtf8().constData()); #endif } } @@ -852,10 +852,10 @@ plat_init_asset_paths(void) for (auto &path : paths) { #ifdef __APPLE__ - asset_add_path(QDir(path).filePath("net.86Box.86Box/assets").toUtf8().constData()); - asset_add_path(QDir(path).filePath("86Box/assets").toUtf8().constData()); + asset_add_path(QDir(path).filePath("net." EMU_NAME "." EMU_NAME "/assets").toUtf8().constData()); + asset_add_path(QDir(path).filePath(EMU_NAME "/assets").toUtf8().constData()); #else - asset_add_path(QDir(path).filePath("86Box/assets").toUtf8().constData()); + asset_add_path(QDir(path).filePath(EMU_NAME "/assets").toUtf8().constData()); #endif } } diff --git a/src/unix/unix.c b/src/unix/unix.c index ee92bddcb1e..535fd06ea16 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -691,9 +691,9 @@ ui_msgbox_header(int flags, void *header, void *message) if (!header) { if (flags & MBX_ANSI) - header = (void *) "86Box"; + header = (void *) EMU_NAME; else - header = (void *) L"86Box"; + header = (void *) EMU_NAME_W; } msgbtn.buttonid = 1; @@ -736,7 +736,7 @@ plat_get_exe_name(char *s, int size) { char *basepath = SDL_GetBasePath(); - snprintf(s, size, "%s%s", basepath, basepath[strlen(basepath) - 1] == '/' ? "86box" : "/86box"); + snprintf(s, size, "%s%s", basepath, basepath[strlen(basepath) - 1] == '/' ? EMU_NAME : "/" EMU_NAME); } void @@ -830,7 +830,7 @@ plat_init_rom_paths(void) char xdg_rom_path[TMP_PATH_BUFSIZE] = {0}; size_t used = snprintf(xdg_rom_path, sizeof(xdg_rom_path), "%s/", xdg_data_home); if (used < sizeof(xdg_rom_path)) - used += snprintf(xdg_rom_path + used, sizeof(xdg_rom_path) - used, "86Box/"); + used += snprintf(xdg_rom_path + used, sizeof(xdg_rom_path) - used, EMU_NAME "/"); if (used < sizeof(xdg_rom_path) && !plat_dir_check(xdg_rom_path)) plat_dir_create(xdg_rom_path); if (used < sizeof(xdg_rom_path)) @@ -850,7 +850,7 @@ plat_init_rom_paths(void) if (home) { char home_rom_path[TMP_PATH_BUFSIZE] = {0}; size_t used = snprintf(home_rom_path, sizeof(home_rom_path), - "%s/.local/share/86Box/", home); + "%s/.local/share/" EMU_NAME "/", home); if (used < sizeof(home_rom_path) && !plat_dir_check(home_rom_path)) plat_dir_create(home_rom_path); if (used < sizeof(home_rom_path)) @@ -878,7 +878,7 @@ plat_init_rom_paths(void) char real_xdg_rom_path[TMP_PATH_BUFSIZE] = {0}; size_t used = snprintf(real_xdg_rom_path, sizeof(real_xdg_rom_path), - "%s/86Box/roms/", cur_xdg); + "%s/" EMU_NAME "/roms/", cur_xdg); if (used < sizeof(real_xdg_rom_path)) rom_add_path(real_xdg_rom_path); cur_xdg = strtok_r(NULL, ":", &saveptr); @@ -887,8 +887,8 @@ plat_init_rom_paths(void) free(xdg_rom_paths); } } else { - rom_add_path("/usr/local/share/86Box/roms/"); - rom_add_path("/usr/share/86Box/roms/"); + rom_add_path("/usr/local/share/" EMU_NAME "/roms/"); + rom_add_path("/usr/share/" EMU_NAME "/roms/"); } #else char default_rom_path[TMP_PATH_BUFSIZE] = {0}; @@ -906,7 +906,7 @@ plat_init_asset_paths(void) char xdg_asset_path[TMP_PATH_BUFSIZE] = {0}; size_t used = snprintf(xdg_asset_path, sizeof(xdg_asset_path), "%s/", xdg_data_home); if (used < sizeof(xdg_asset_path)) - used += snprintf(xdg_asset_path + used, sizeof(xdg_asset_path) - used, "86Box/"); + used += snprintf(xdg_asset_path + used, sizeof(xdg_asset_path) - used, EMU_NAME "/"); if (used < sizeof(xdg_asset_path) && !plat_dir_check(xdg_asset_path)) plat_dir_create(xdg_asset_path); if (used < sizeof(xdg_asset_path)) @@ -926,7 +926,7 @@ plat_init_asset_paths(void) if (home) { char home_asset_path[TMP_PATH_BUFSIZE] = {0}; size_t used = snprintf(home_asset_path, sizeof(home_asset_path), - "%s/.local/share/86Box/", home); + "%s/.local/share/" EMU_NAME "/", home); if (used < sizeof(home_asset_path) && !plat_dir_check(home_asset_path)) plat_dir_create(home_asset_path); if (used < sizeof(home_asset_path)) @@ -954,7 +954,7 @@ plat_init_asset_paths(void) char real_xdg_asset_path[TMP_PATH_BUFSIZE] = {0}; size_t used = snprintf(real_xdg_asset_path, sizeof(real_xdg_asset_path), - "%s/86Box/assets/", cur_xdg); + "%s/" EMU_NAME "/assets/", cur_xdg); if (used < sizeof(real_xdg_asset_path)) asset_add_path(real_xdg_asset_path); cur_xdg = strtok_r(NULL, ":", &saveptr); @@ -963,8 +963,8 @@ plat_init_asset_paths(void) free(xdg_asset_paths); } } else { - asset_add_path("/usr/local/share/86Box/assets/"); - asset_add_path("/usr/share/86Box/assets/"); + asset_add_path("/usr/local/share/" EMU_NAME "/assets/"); + asset_add_path("/usr/share/" EMU_NAME "/assets/"); } #else char default_asset_path[TMP_PATH_BUFSIZE] = {0}; @@ -986,7 +986,7 @@ plat_get_global_data_dir(char *outbuf, const size_t len) if (portable_mode) { strncpy(outbuf, exe_path, len); } else { - char *prefPath = SDL_GetPrefPath(NULL, "86Box"); + char *prefPath = SDL_GetPrefPath(NULL, EMU_NAME); strncpy(outbuf, prefPath, len); SDL_free(prefPath); } @@ -1109,7 +1109,7 @@ unix_executeLine(char *line) "pause - pause the the emulated system.\n" "fullscreen - toggle fullscreen.\n" "version - print version and license information.\n" - "exit - exit 86Box.\n"); + "exit - exit " EMU_NAME ".\n"); } else if (strncasecmp(xargv[0], "exit", 4) == 0) { exit_event = 1; } else if (strncasecmp(xargv[0], "version", 7) == 0) { @@ -1299,7 +1299,7 @@ monitor_thread(UNUSED(void *param)) char *line = NULL; size_t n; - printf("86Box monitor console.\n"); + printf(EMU_NAME " monitor console.\n"); while (!exit_event) { if (feof(stdin)) @@ -1307,10 +1307,10 @@ monitor_thread(UNUSED(void *param)) #ifdef ENABLE_READLINE if (f_readline) - line = f_readline("(86Box) "); + line = f_readline("(" EMU_NAME ") "); else { #endif - printf("(86Box) "); + printf("(" EMU_NAME ") "); (void) !getline(&line, &n, stdin); #ifdef ENABLE_READLINE } @@ -1338,7 +1338,7 @@ main(int argc, char **argv) if (ret == 0) return 0; if (!pc_init_roms()) { - ui_msgbox_header(MBX_FATAL, L"No ROMs found.", L"86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory."); + ui_msgbox_header(MBX_FATAL, L"No ROMs found.", EMU_NAME_W L" could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory."); SDL_Quit(); return 6; } From c9d38549efd80eada1b877e8c34e4d3709d517ae Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 16:26:36 -0300 Subject: [PATCH 106/320] New Dynarec: Improve the D9 44 hack --- src/codegen_new/codegen.c | 4 ---- src/codegen_new/codegen_ops.c | 5 +++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/codegen_new/codegen.c b/src/codegen_new/codegen.c index d234d8c1b4c..fcdc1d9482e 100644 --- a/src/codegen_new/codegen.c +++ b/src/codegen_new/codegen.c @@ -676,10 +676,6 @@ codegen_generate_call(uint8_t opcode, OpFn op, uint32_t fetchdat, uint32_t new_p if ((recomp_op_table == recomp_opcodes) && (opcode == 0x48)) goto codegen_skip; #endif - /* TODO: Fix the recompilation so Blood II's gameplay music no longer breaks! */ - if ((recomp_op_table == recomp_opcodes_d9) && (opcode == 0x44)) - goto codegen_skip; - if (in_lock && ((opcode == 0x90) || (opcode == 0xec))) goto codegen_skip; diff --git a/src/codegen_new/codegen_ops.c b/src/codegen_new/codegen_ops.c index 68861ff5257..70481343b1b 100644 --- a/src/codegen_new/codegen_ops.c +++ b/src/codegen_new/codegen_ops.c @@ -258,6 +258,7 @@ RecompOpFn recomp_opcodes_d8[512] = { RecompOpFn recomp_opcodes_d9[512] = { // clang-format off + /* TODO: Fix the recompilation of D9 44 so Blood II's gameplay music no longer breaks! */ /*16-bit data*/ /* 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f*/ /*00*/ ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, @@ -265,7 +266,7 @@ RecompOpFn recomp_opcodes_d9[512] = { /*20*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*30*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, -/*40*/ ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +/*40*/ ropFLDs, ropFLDs, ropFLDs, ropFLDs, NULL, ropFLDs, ropFLDs, ropFLDs, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*50*/ ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, /*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, @@ -287,7 +288,7 @@ RecompOpFn recomp_opcodes_d9[512] = { /*20*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*30*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, -/*40*/ ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, ropFLDs, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, +/*40*/ ropFLDs, ropFLDs, ropFLDs, ropFLDs, NULL, ropFLDs, ropFLDs, ropFLDs, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*50*/ ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, ropFSTPs, /*60*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /*70*/ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, ropFSTCW, From 401a9165ab7f866ea67c1f37ce901b388661b9ec Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 16:42:07 -0300 Subject: [PATCH 107/320] Add one more AppImage asset path --- src/86box.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/86box.c b/src/86box.c index 1d4e527c817..4bf73790e0c 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1048,11 +1048,13 @@ pc_init(int argc, char *argv[]) asset_add_path(temp); } #elif !defined(_WIN32) - // Add the standard asset path within the AppImage. + // Add the standard asset paths within the AppImage. p = getenv("APPDIR"); if (p && (p[0] != '\0')) { path_append_filename(temp, p, "usr/local/share/" EMU_NAME "/assets"); asset_add_path(temp); + path_append_filename(temp, p, "usr/share/" EMU_NAME "/assets"); + asset_add_path(temp); } #endif From 539a1c199c14d7bf64c2a5acacbabb1ec12572f8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 18:05:23 -0300 Subject: [PATCH 108/320] SVGA: Increase VRAM top margin as a temporary workaround to an OOB in voodoo_banshee_blitter --- src/video/vid_svga.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_svga.c b/src/video/vid_svga.c index 43158adbb86..2409d12025c 100644 --- a/src/video/vid_svga.c +++ b/src/video/vid_svga.c @@ -1693,7 +1693,7 @@ svga_init(const device_t *info, svga_t *svga, void *priv, int memsize, svga->dispontime = 1000ULL << 32; svga->dispofftime = 1000ULL << 32; svga->bpp = 8; - svga->vram = calloc(memsize + 8, 1); + svga->vram = calloc(memsize + 4096, 1); svga->vram_max = memsize; svga->vram_display_mask = svga->vram_mask = memsize - 1; svga->decode_mask = 0x7fffff; From 6ad22de54b23ce4a50a970fc2e6737d14c001f9e Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 18:56:46 -0300 Subject: [PATCH 109/320] Config migration for the one surviving Panasonic FDD sound set --- src/config.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/config.c b/src/config.c index 197ed6b2788..27b5d25fe59 100644 --- a/src/config.c +++ b/src/config.c @@ -1511,11 +1511,14 @@ load_floppy_and_cdrom_drives(void) sprintf(temp, "fdd_%02i_check_bpb", c + 1); ini_section_delete_var(cat, temp); } - sprintf(temp, "fdd_%02i_audio", c + 1); + sprintf(temp, "fdd_%02i_audio", c + 1); #ifndef DISABLE_FDD_AUDIO - p = ini_section_get_string(cat, temp, "none"); - int prof = fdd_audio_get_profile_by_internal_name(p); - fdd_set_audio_profile(c, prof); + p = ini_section_get_string(cat, temp, "none"); + if (!strcmp(p, "panasonic")) + d = fdd_audio_get_profile_by_internal_name("panasonic_ju4755_40t"); + else + d = fdd_audio_get_profile_by_internal_name(p); + fdd_set_audio_profile(c, d); #else fdd_set_audio_profile(c, 0); #endif From 4af49b4f9b750eb086956b707f0e95b1f1bcbc1f Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 19:02:29 -0300 Subject: [PATCH 110/320] Replace a couple more machine internal name anchors with the init function --- src/config.c | 3 +-- src/device/postcard.c | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/config.c b/src/config.c index 27b5d25fe59..d5deded9dc7 100644 --- a/src/config.c +++ b/src/config.c @@ -408,8 +408,7 @@ load_machine(void) p = ini_section_get_string(cat, "cpu_family", NULL); if (p) { /* Migrate CPU family changes. */ - if ((!strcmp(machines[machine].internal_name, "deskpro386") || - !strcmp(machines[machine].internal_name, "deskpro386_05_1988"))) + if (machines[machine].init == machine_at_deskpro386_init) cpu_f = cpu_get_family("i386dx_deskpro386"); else cpu_f = cpu_get_family(p); diff --git a/src/device/postcard.c b/src/device/postcard.c index 908adfe7261..d94bc8ddfbe 100644 --- a/src/device/postcard.c +++ b/src/device/postcard.c @@ -204,7 +204,7 @@ postcard_init(UNUSED(const device_t *info)) postcard_port = 0x84; /* ISA Compaq machines */ else if (strstr(machines[machine].name, "Olivetti")) postcard_port = 0x378; /* Olivetti machines */ - else if (!strcmp(machines[machine].internal_name, "isa486c")) + else if (machines[machine].init == machine_at_isa486c_init) postcard_port = 0x5080; /* ASUS ISA-486C */ else postcard_port = 0x80; /* AT and clone machines */ From 747e71ef2db2dec40d4d3750623096c550c90eae Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sat, 20 Dec 2025 19:04:04 -0300 Subject: [PATCH 111/320] Remove unused machine_is_sony function --- src/include/86box/machine.h | 1 - src/machine/machine_table.c | 6 ------ 2 files changed, 7 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 6b84d2b5775..b39ecdad64e 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -422,7 +422,6 @@ extern int machine_get_type(int m); extern int machine_get_chipset(int m); extern void machine_close(void); extern int machine_has_mouse(void); -extern int machine_is_sony(void); extern uint8_t machine_compaq_p1_handler(void); extern uint8_t machine_generic_p1_handler(void); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 792409e9b05..e404a3f4a58 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -20715,12 +20715,6 @@ machine_has_mouse(void) return (machines[machine].flags & MACHINE_MOUSE); } -int -machine_is_sony(void) -{ - return (!strcmp(machines[machine].internal_name, "pcv90")); -} - const char * machine_get_nvr_name_ex(int m) { From 31a19a07f570f2578a1fc11a8cf7bc38a85f2c22 Mon Sep 17 00:00:00 2001 From: unreal9010 <84349460+unreal9010@users.noreply.github.com> Date: Sat, 20 Dec 2025 23:13:21 +0100 Subject: [PATCH 112/320] Add more BIOS revisions for ABIT-AB BX6 machine --- src/machine/m_at_slot1.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index d4a4742e5d9..8708377136f 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -432,6 +432,33 @@ static const device_config_t bx6_config[] = { .size = 131072, .files = { "roms/machines/bx6/BX6_EG.BIN", "" } }, + { + .name = "Award Modular BIOS v4.51PG - Revision CW", + .internal_name = "bx6_CW", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/bx6/BX6_CW.bin", "" } + }, + { + .name = "Award Modular BIOS v4.51PG - Revision GQ", + .internal_name = "bx6_GQ", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/bx6/BX6_GQ.bin", "" } + }, + { + .name = "Award Modular BIOS v4.51PG - Revision JL", + .internal_name = "bx6_JL", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/bx6/BX6_JL.bin", "" } + }, { .name = "Award Modular BIOS v4.51PG - Revision QS", .internal_name = "bx6_qs", From a5733a7ff6e499490885250fb9576a6006b8f474 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sat, 20 Dec 2025 18:44:05 -0600 Subject: [PATCH 113/320] Add the Analog Devices AD1816 audio controller --- src/include/86box/sound.h | 3 + src/sound/CMakeLists.txt | 1 + src/sound/snd_ad1816.c | 1000 +++++++++++++++++++++++++++++++++++++ src/sound/sound.c | 1 + 4 files changed, 1005 insertions(+) create mode 100644 src/sound/snd_ad1816.c diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index 4ce2d99f0ea..e35969ead84 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -122,6 +122,9 @@ extern const device_t adlib_device; extern const device_t adlib_mca_device; extern const device_t adgold_device; +/* Analog Devices AD1816 */ +extern const device_t ad1816_device; + /* Aztech Sound Galaxy 16 */ extern const device_t azt2316a_device; extern const device_t acermagic_s20_device; diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt index a6a9b691aa7..2c039fa9260 100644 --- a/src/sound/CMakeLists.txt +++ b/src/sound/CMakeLists.txt @@ -31,6 +31,7 @@ add_library(snd OBJECT snd_ps1.c snd_adlib.c snd_adlibgold.c + snd_ad1816.c snd_ad1848.c snd_audiopci.c snd_azt2316a.c diff --git a/src/sound/snd_ad1816.c b/src/sound/snd_ad1816.c new file mode 100644 index 00000000000..2ba79fc4c82 --- /dev/null +++ b/src/sound/snd_ad1816.c @@ -0,0 +1,1000 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Analog Devices AD1816 SoundPort audio controller emulation. + * + * Many similarities to the AD1848/CS423x WSS codec family but + * heavily modified and not register-compatible + * + * Authors: Sarah Walker, + * TheCollector1995, + * RichardG, + * win2kgamer + * + * Copyright 2008-2020 Sarah Walker. + * Copyright 2018-2020 TheCollector1995. + * Copyright 2021-2025 RichardG. + * Copyright 2025 win2kgamer + */ +#include +#include +#include +#include +#include +#include +#include +#define HAVE_STDARG_H + +#include <86box/86box.h> +#include <86box/device.h> +#include <86box/io.h> +#include <86box/midi.h> +#include <86box/timer.h> +#include <86box/pic.h> +#include <86box/dma.h> +#include <86box/sound.h> +#include <86box/gameport.h> +#include <86box/snd_sb.h> +#include <86box/mem.h> +#include <86box/rom.h> +#include <86box/plat_unused.h> +#include <86box/isapnp.h> +#include <86box/log.h> + +#define PNP_ROM_AD1816 "roms/sound/ad1816/ad1816.bin" + +#ifdef ENABLE_AD1816_LOG +int ad1816_do_log = ENABLE_AD1816_LOG; + +static void +ad1816_log(void *priv, const char *fmt, ...) +{ + if (ad1816_do_log) { + va_list ap; + va_start(ap, fmt); + log_out(priv, fmt, ap); + va_end(ap); + } +} +#else +# define ad1816_log(fmt, ...) +#endif + +static double ad1816_vols_5bits[32]; +static double ad1816_vols_5bits_aux_gain[32]; +static int ad1816_vols_6bits[64]; + +typedef struct ad1816_t { + uint8_t index; + uint8_t regs[16]; + uint16_t iregs[64]; + + uint16_t cur_ad1816_addr; + uint16_t cur_sb_addr; + uint16_t cur_opl_addr; + uint16_t cur_mpu_addr; + uint16_t cur_js_addr; + uint8_t cur_irq; + uint8_t cur_mpu_irq; + uint8_t cur_dma; + + int freq; + + pc_timer_t timer_count; + uint64_t timer_latch; + + pc_timer_t ad1816_irq_timer; + + uint8_t status; + int count; + int16_t out_l; + int16_t out_r; + uint8_t fmt_mask; + uint8_t dma_ff; + uint32_t dma_data; + int16_t buffer[SOUNDBUFLEN * 2]; + int pos; + uint8_t playback_pos : 2; + uint8_t enable; + uint8_t codec_enable; + + double master_l; + double master_r; + double cd_vol_l; + double cd_vol_r; + int fm_vol_l; + int fm_vol_r; + + void *gameport; + mpu_t *mpu; + sb_t *sb; + + void *pnp_card; + uint8_t pnp_rom[512]; + isapnp_device_config_t *ad1816_pnp_config; + + void * log; /* New logging system */ +} ad1816_t; + +static void +ad1816_update_mastervol(void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + if (ad1816->iregs[14] & 0x8000) + ad1816->master_l = 0; + else + ad1816->master_l = ad1816_vols_5bits[(ad1816->iregs[14] >> 8) & 0x1f] / 65536.0; + + if (ad1816->iregs[14] & 0x0080) + ad1816->master_r = 0; + else + ad1816->master_r = ad1816_vols_5bits[(ad1816->iregs[14]) & 0x1f] / 65536.0; +} + +void +ad1816_filter_cd_audio(int channel, double *buffer, void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + ad1816_update_mastervol(ad1816); + + const double cd_vol = channel ? ad1816->cd_vol_r : ad1816->cd_vol_l; + double master = channel ? ad1816->master_r : ad1816->master_l; + double c = ((*buffer * cd_vol / 1.0) * master) / 65536.0; + + *buffer = c; +} + +static void +ad1816_filter_opl(void *priv, double *out_l, double *out_r) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + ad1816_update_mastervol(ad1816); + *out_l *= ad1816->fm_vol_l; + *out_r *= ad1816->fm_vol_r; + *out_l *= ad1816->master_l; + *out_r *= ad1816->master_r; + +} + +void +ad1816_update(ad1816_t *ad1816) +{ + for (; ad1816->pos < sound_pos_global; ad1816->pos++) { + ad1816->buffer[ad1816->pos * 2] = ad1816->out_l; + ad1816->buffer[ad1816->pos * 2 + 1] = ad1816->out_r; + } +} + +static int16_t +ad1816_process_mulaw(uint8_t byte) +{ + byte = ~byte; + int temp = (((byte & 0x0f) << 3) + 0x84); + temp <<= ((byte & 0x70) >> 4); + temp = (byte & 0x80) ? (0x84 - temp) : (temp - 0x84); + if (temp > 32767) + return 32767; + else if (temp < -32768) + return -32768; + return (int16_t) temp; +} + +static int16_t +ad1816_process_alaw(uint8_t byte) +{ + byte ^= 0x55; + int dec = ((byte & 0x0f) << 4);; + const int seg = (int) ((byte & 0x70) >> 4); + switch (seg) { + default: + dec |= 0x108; + dec <<= seg - 1; + break; + + case 0: + dec |= 0x8; + break; + + case 1: + dec |= 0x108; + break; + } + return (int16_t) ((byte & 0x80) ? dec : -dec); +} + +static uint32_t +ad1816_dma_channel_read(ad1816_t *ad1816, int channel) +{ + uint32_t ret; + + if (channel >= 4) { + if (ad1816->dma_ff) { + ret = (ad1816->dma_data & 0xff00) >> 8; + ret |= (ad1816->dma_data & 0xffff0000); + } else { + ad1816->dma_data = dma_channel_read(channel); + + if (ad1816->dma_data == DMA_NODATA) + return DMA_NODATA; + + ret = ad1816->dma_data & 0xff; + } + + ad1816->dma_ff = !ad1816->dma_ff; + } else + ret = dma_channel_read(channel); + + return ret; +} + +static void +ad1816_poll(void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + if (ad1816->timer_latch) + timer_advance_u64(&ad1816->timer_count, ad1816->timer_latch); + else + timer_advance_u64(&ad1816->timer_count, TIMER_USEC * 1000); + + ad1816_update(ad1816); + + if (ad1816->enable) { + int32_t temp; + uint8_t format; + + format = (ad1816->regs[8] << 2) & 0xf0; + ad1816_log(ad1816->log, "AD1816 format = %04X\n", format); + ad1816_log(ad1816->log, "count = %04X, pos = %02X\n", ad1816->count, ad1816->playback_pos); + + switch (format) { + case 0x00: /* Mono, 8-bit PCM */ + ad1816->out_l = ad1816->out_r = (int16_t) ((ad1816_dma_channel_read(ad1816, ad1816->cur_dma) ^ 0x80) << 8); + ad1816->playback_pos++; + break; + + case 0x10: /* Stereo, 8-bit PCM */ + ad1816->out_l = (int16_t) ((ad1816_dma_channel_read(ad1816, ad1816->cur_dma) ^ 0x80) << 8); + ad1816->out_r = (int16_t) ((ad1816_dma_channel_read(ad1816, ad1816->cur_dma) ^ 0x80) << 8); + ad1816->playback_pos += 2; + break; + + case 0x20: /* Mono, 8-bit Mu-Law */ + ad1816->out_l = ad1816->out_r = ad1816_process_mulaw(ad1816_dma_channel_read(ad1816, ad1816->cur_dma)); + ad1816->playback_pos++; + break; + + case 0x30: /* Stereo, 8-bit Mu-Law */ + ad1816->out_l = ad1816_process_mulaw(ad1816_dma_channel_read(ad1816, ad1816->cur_dma)); + ad1816->out_r = ad1816_process_mulaw(ad1816_dma_channel_read(ad1816, ad1816->cur_dma)); + ad1816->playback_pos += 2; + break; + + case 0x40: /* Mono, 16-bit PCM little endian */ + temp = (int32_t) ad1816_dma_channel_read(ad1816, ad1816->cur_dma); + ad1816->out_l = ad1816->out_r = (int16_t) ((ad1816_dma_channel_read(ad1816, ad1816->cur_dma) << 8) | temp); + ad1816->playback_pos += 2; + break; + + case 0x50: /* Stereo, 16-bit PCM little endian */ + temp = (int32_t) ad1816_dma_channel_read(ad1816, ad1816->cur_dma); + ad1816->out_l = (int16_t) ((ad1816_dma_channel_read(ad1816, ad1816->cur_dma) << 8) | temp); + temp = (int32_t) ad1816_dma_channel_read(ad1816, ad1816->cur_dma); + ad1816->out_r = (int16_t) ((ad1816_dma_channel_read(ad1816, ad1816->cur_dma) << 8) | temp); + ad1816->playback_pos += 4; + break; + + case 0x60: /* Mono, 8-bit A-Law */ + ad1816->out_l = ad1816->out_r = ad1816_process_alaw(ad1816_dma_channel_read(ad1816, ad1816->cur_dma)); + ad1816->playback_pos++; + break; + + case 0x70: /* Stereo, 8-bit A-Law */ + ad1816->out_l = ad1816_process_alaw(ad1816_dma_channel_read(ad1816, ad1816->cur_dma)); + ad1816->out_r = ad1816_process_alaw(ad1816_dma_channel_read(ad1816, ad1816->cur_dma)); + ad1816->playback_pos += 2; + break; + + /* 0x80, 0x90, 0xa0, 0xb0 reserved */ + + case 0xc0: /* Mono, 16-bit PCM big endian */ + temp = (int32_t) ad1816_dma_channel_read(ad1816, ad1816->cur_dma); + ad1816->out_l = ad1816->out_r = (int16_t) (ad1816_dma_channel_read(ad1816, ad1816->cur_dma) | (temp << 8)); + ad1816->playback_pos += 2; + break; + + case 0xd0: /* Stereo, 16-bit PCM big endian */ + temp = (int32_t) ad1816_dma_channel_read(ad1816, ad1816->cur_dma); + ad1816->out_l = (int16_t) (ad1816_dma_channel_read(ad1816, ad1816->cur_dma) | (temp << 8)); + temp = (int32_t) ad1816_dma_channel_read(ad1816, ad1816->cur_dma); + ad1816->out_r = (int16_t) (ad1816_dma_channel_read(ad1816, ad1816->cur_dma) | (temp << 8)); + ad1816->playback_pos += 4; + break; + + /* 0xe0 and 0xf0 reserved */ + + default: + break; + } + if (ad1816->iregs[4] & 0x8000) + ad1816->out_l = 0; + else + ad1816->out_l = (int16_t) ((ad1816->out_l * ad1816_vols_6bits[(ad1816->iregs[4] >> 8) & 0x3f]) >> 16); + + if (ad1816->iregs[4] & 0x0080) + ad1816->out_r = 0; + else + ad1816->out_r = (int16_t) ((ad1816->out_r * ad1816_vols_6bits[ad1816->iregs[4] & 0x3f]) >> 16); + + if (ad1816->count < 0) { + ad1816->count = ad1816->iregs[8]; + ad1816->regs[1] |= 0x80; + ad1816->playback_pos = 0; + if (ad1816->iregs[1] & 0x8000) { + ad1816_log(ad1816->log, "AD1816 Playback interrupt fired\n"); + picint(1 << ad1816->cur_irq); + } + else { + ad1816_log(ad1816->log, "AD1816 Playback interrupt cleared\n"); + picintc(1 << ad1816->cur_irq); + } + } + /* AD1816 count decrements every 4 bytes */ + if (!(ad1816->playback_pos & 3)) + ad1816->count--; + } else { + ad1816->out_l = ad1816->out_r = 0; + } +} + +static void +ad1816_get_buffer(int32_t *buffer, int len, void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + /* Don't play audio if the DAC mute or chip powerdown bits are set */ + if ((ad1816->iregs[44] & 0x8000) || (ad1816->iregs[44] & 0x0008)) + return; + + ad1816_update_mastervol(ad1816); + ad1816_update(ad1816); + for (int c = 0; c < len * 2; c++) { + double out_l = 0.0; + double out_r = 0.0; + + out_l = (ad1816->buffer[c] * ad1816->master_l); + out_r = (ad1816->buffer[c + 1] * ad1816->master_r); + + buffer[c] += (int32_t) out_l; + buffer[c + 1] += (int32_t) out_r; + } + + ad1816->pos = 0; + + /* sbprov2 part */ + sb_get_buffer_sbpro(buffer, len, ad1816->sb); +} + +static void +ad1816_updatefreq(ad1816_t *ad1816) +{ + double freq; + + if (ad1816->iregs[2] > 55200) + ad1816->iregs[2] = 55200; + freq = ad1816->iregs[2]; + + ad1816->freq = (int) trunc(freq); + ad1816->timer_latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / (double) ad1816->freq)); + + ad1816_log(ad1816->log, "AD1816: Frequency set to %f\n", freq); +} + +static void +ad1816_reg_write(uint16_t addr, uint8_t val, void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + uint16_t iridx = ad1816->index; + uint8_t port = addr - ad1816->cur_ad1816_addr; + double timebase = 0; + + switch (port) { + case 0: /* Status/Indirect address */ + ad1816->regs[0] = val | 0x80; + ad1816->index = val & 0x3f; + break; + case 1: /* Interrupt Status */ + ad1816->regs[1] = 0x00; /* Sticky read/clear */ + break; + case 2: /* Indirect data low byte */ + ad1816->regs[2] = val; + ad1816->iregs[0] = val; /* Indirect low byte temp */ + break; + case 3: /* Indirect data high byte */ + ad1816->regs[3] = val; + switch (iridx) { + case 1: /* Interrupt Enable/External Control */ + ad1816->iregs[1] = ((val << 8) | ad1816->regs[2]); + if (ad1816->iregs[1] & 0x0080) { + ad1816_log(ad1816->log, "Timer Enable\n"); + timebase = (ad1816->iregs[44] & 0x0100) ? 100000 : 10; + timer_set_delay_u64(&ad1816->ad1816_irq_timer, (ad1816->iregs[13] * timebase * TIMER_USEC)); + } + else { + ad1816_log(ad1816->log, "Timer Disable\n"); + timer_disable(&ad1816->ad1816_irq_timer); + } + break; + case 2: /* Voice Playback Sample Rate */ + ad1816->iregs[2] = ((val << 8) | ad1816->regs[2]); + ad1816_updatefreq(ad1816); + break; + case 3: /* Voice Capture Sample Rate */ + ad1816->iregs[3] = ((val << 8) | ad1816->regs[2]); + break; + case 4: /* Voice Attenuation */ + ad1816->iregs[4] = ((val << 8) | ad1816->regs[2]); + break; + case 5: /* FM Attenuation */ + ad1816->iregs[5] = ((val << 8) | ad1816->regs[2]); + /* FM has distortion problems at the highest volume setting and the Win95 driver only uses the upper + 16 values, currently needs a small hack to use lower volumes if the FM mixer is set too high */ + if (ad1816->iregs[5] & 0x8000) + ad1816->fm_vol_l = 0; + else { + if (((ad1816->iregs[5] >> 8) & 0x3F) <= 0x0F) + ad1816->fm_vol_l = ad1816_vols_6bits[((ad1816->iregs[5] >> 8) & 0x3f) + 0x10]; + else + ad1816->fm_vol_l = ad1816_vols_6bits[((ad1816->iregs[5] >> 8) & 0x3f)]; + } + if (ad1816->iregs[5] & 0x0080) + ad1816->fm_vol_r = 0; + else { + if ((ad1816->iregs[5] & 0x3F) <= 0x0F) + ad1816->fm_vol_r = ad1816_vols_6bits[(ad1816->iregs[5] & 0x3f) + 0x10]; + else + ad1816->fm_vol_r = ad1816_vols_6bits[(ad1816->iregs[5] & 0x3f)]; + } + break; + case 6: /* I2S(1) Attenuation */ + ad1816->iregs[6] = ((val << 8) | ad1816->regs[2]); + break; + case 7: /* I2S(0) Attenuation */ + ad1816->iregs[7] = ((val << 8) | ad1816->regs[2]); + break; + case 8: /* Playback Base Count */ + ad1816->iregs[8] = ((val << 8) | ad1816->regs[2]); + ad1816->iregs[9] = ((val << 8) | ad1816->regs[2]); + ad1816->count = ad1816->iregs[8]; + break; + case 9: /* Playback Current Count */ + ad1816->iregs[9] = ((val << 8) | ad1816->regs[2]); + break; + case 10: /* Capture Base Count */ + ad1816->iregs[10] = ((val << 8) | ad1816->regs[2]); + ad1816->iregs[11] = ((val << 8) | ad1816->regs[2]); + break; + case 11: /* Capture Current Count */ + ad1816->iregs[11] = ((val << 8) | ad1816->regs[2]); + break; + case 12: /* Timer Base Count */ + ad1816->iregs[12] = ((val << 8) | ad1816->regs[2]); + ad1816->iregs[13] = ((val << 8) | ad1816->regs[2]); + break; + case 13: /* Timer Current Count */ + ad1816->iregs[13] = ((val << 8) | ad1816->regs[2]); + break; + case 14: /* Master Volume Attenuation */ + ad1816->iregs[14] = ((val << 8) | ad1816->regs[2]); + break; + case 15: /* CD Gain/Attenuation */ + ad1816->iregs[15] = ((val << 8) | ad1816->regs[2]); + if (ad1816->iregs[15] & 0x8000) + ad1816->cd_vol_l = 0; + else + ad1816->cd_vol_l = ad1816_vols_5bits_aux_gain[(ad1816->iregs[15] >> 8) & 0x1f]; + if (ad1816->iregs[15] & 0x0080) + ad1816->cd_vol_r = 0; + else + ad1816->cd_vol_r = ad1816_vols_5bits_aux_gain[ad1816->iregs[15] & 0x1f]; + break; + case 16: /* Synth Gain/Attenuation */ + ad1816->iregs[16] = ((val << 8) | ad1816->regs[2]); + break; + case 17: /* Vid Gain/Attenuation */ + ad1816->iregs[17] = ((val << 8) | ad1816->regs[2]); + break; + case 18: /* Line Gain/Attenuation */ + ad1816->iregs[18] = ((val << 8) | ad1816->regs[2]); + break; + case 19: /* Mic/Phone_In Gain/Attenuation */ + ad1816->iregs[19] = ((val << 8) | ad1816->regs[2]); + break; + case 20: /* ADC Source Select/ADC PGA */ + ad1816->iregs[20] = ((val << 8) | ad1816->regs[2]); + break; + case 32: /* Chip Configuration */ + ad1816->iregs[32] = ((val << 8) | ad1816->regs[2]); + if (ad1816->iregs[32] & 0x8000) { + ad1816->codec_enable = 1; + sound_set_cd_audio_filter(NULL, NULL); /* Seems to be necessary for the filter below to apply */ + sound_set_cd_audio_filter(ad1816_filter_cd_audio, ad1816); + ad1816->sb->opl_mixer = ad1816; + ad1816->sb->opl_mix = ad1816_filter_opl; + } + else { + ad1816->codec_enable = 0; + sound_set_cd_audio_filter(NULL, NULL); /* Seems to be necessary for the filter below to apply */ + sound_set_cd_audio_filter(sbpro_filter_cd_audio, ad1816->sb); /* Use SBPro to filter when codec is disabled */ + ad1816->sb->opl_mixer = NULL; + ad1816->sb->opl_mix = NULL; + } + break; + case 33: /* DSP Configuration */ + ad1816->iregs[33] = ((val << 8) | ad1816->regs[2]); + if ((ad1816->iregs[1] & 0x0800) && (ad1816->iregs[33] & 0x2000)) { + ad1816_log(ad1816->log, "Firing DSP interrupt\n"); + ad1816->regs[1] |= 0x08; + picint(1 << ad1816->cur_irq); + } + break; + case 34: /* FM Sample Rate */ + ad1816->iregs[34] = ((val << 8) | ad1816->regs[2]); + break; + case 35: /* I2S(1) Sample Rate */ + ad1816->iregs[35] = ((val << 8) | ad1816->regs[2]); + break; + case 36: /* I2S(0) Sample Rate */ + ad1816->iregs[36] = ((val << 8) | ad1816->regs[2]); + break; + case 37: /* Reserved on AD1816, Modem sample rate on AD1815 */ + break; + case 38: /* Programmable Clock Rate */ + ad1816->iregs[38] = ((val << 8) | ad1816->regs[2]); + break; + case 39: /* 3D Phat Stereo Control/Phone_Out Attenuation on AD1816, Modem DAC/ADC attenuation on AD1815 */ + ad1816->iregs[39] = ((val << 8) | ad1816->regs[2]); + break; + case 40: /* Reserved on AD1816, Modem mix attenuation on AD1815 */ + break; + case 41: /* Hardware Volume Button Modifier */ + ad1816->iregs[41] = ((val << 8) | ad1816->regs[2]); + break; + case 42: /* DSP Mailbox 0 */ + ad1816->iregs[42] = ((val << 8) | ad1816->regs[2]); + break; + case 43: /* DSP Mailbox 1 */ + ad1816->iregs[43] = ((val << 8) | ad1816->regs[2]); + break; + case 44: /* Powerdown and Timer Control */ + ad1816->iregs[44] = ((val << 8) | ad1816->regs[2]); + break; + case 45: /* Version/ID */ + break; + case 46: /* Reserved test register */ + break; + default: + break; + } + ad1816_log(ad1816->log, "AD1816 Indirect Register write: idx = %02X, val = %04X\n", ad1816->index, ad1816->iregs[iridx]); + break; + case 4: /* PIO Debug */ + ad1816->regs[4] = 0x00; /* Sticky read/clear */ + break; + case 5: /* PIO Status (RO) */ + break; + case 6: /* PIO Data */ + ad1816->regs[6] = val; + break; + case 7: /* Reserved */ + break; + case 8: /* Playback Config */ + ad1816->regs[8] = val; + if (!ad1816->enable && val & 0x01) { + ad1816->playback_pos = 0; + ad1816->dma_ff = 0; + if (ad1816->timer_latch) + timer_set_delay_u64(&ad1816->timer_count, ad1816->timer_latch); + else + timer_set_delay_u64(&ad1816->timer_count, TIMER_USEC); + } + ad1816->enable = (val & 0x01); + if (!ad1816->enable) { + timer_disable(&ad1816->timer_count); + ad1816->out_l = ad1816->out_r = 0; + } + break; + case 9: /* Capture Config */ + ad1816->regs[9] = val; + break; + case 10: /* Reserved on AD1816, PIO modem out/in bits 7-0 on AD1815 */ + break; + case 11: /* Reserved on AD1816, PIO modem out/in bits 15-8 on AD1815 */ + break; + case 12: /* Joystick Raw Data (RO) */ + break; + case 13: /* Joystick Control */ + ad1816->regs[13] = ((val & 0x7f) | (ad1816->regs[13] & 0x80)); + break; + case 14: /* Joystick Position Low Byte (RO) */ + case 15: /* Joystick Position Low Byte (RO) */ + break; + } + ad1816_log(ad1816->log, "AD1816 Write: idx = %02X, val = %02X\n", port, val); +} + +static uint8_t +ad1816_reg_read(uint16_t addr, void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + uint16_t iridx = ad1816->index; + uint8_t temp = 0xFF; + uint8_t port = addr - ad1816->cur_ad1816_addr; + + switch (port) { + case 0: + temp = ad1816->regs[port]; + break; + case 1: + temp = ad1816->regs[port]; + temp |= ((ad1816->sb->dsp.sb_irq8) ? 1 : 0); + break; + case 2: + temp = (ad1816->iregs[iridx] & 0x00ff); + break; + case 3: + temp = (ad1816->iregs[iridx] & 0xff00) >> 8; + break; + case 4 ... 15: + temp = ad1816->regs[port]; + break; + default: + break; + } + + ad1816_log(ad1816->log, "AD1816 Read: idx = %02X, val = %02X\n", port, temp); + return temp; +} + +static void +ad1816_pnp_config_changed(uint8_t ld, isapnp_device_config_t *config, void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + ad1816_log(ad1816->log, "PnP Config changed\n"); + + switch(ld) { + case 0: /* Audio */ + if (ad1816->cur_ad1816_addr) { + io_removehandler(ad1816->cur_ad1816_addr, 0x10, ad1816_reg_read, NULL, NULL, ad1816_reg_write, NULL, NULL, ad1816); + ad1816->cur_ad1816_addr = 0; + } + + if (ad1816->cur_opl_addr) { + io_removehandler(ad1816->cur_opl_addr, 0x0004, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + ad1816->cur_opl_addr = 0; + } + + if (ad1816->cur_sb_addr) { + sb_dsp_setaddr(&ad1816->sb->dsp, 0); + io_removehandler(ad1816->cur_sb_addr + 4, 0x0002, sb_ct1345_mixer_read, NULL, NULL, sb_ct1345_mixer_write, NULL, NULL, ad1816->sb); + io_removehandler(ad1816->cur_sb_addr + 0, 0x0004, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + io_removehandler(ad1816->cur_sb_addr + 8, 0x0002, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + ad1816->cur_sb_addr = 0; + } + + sb_dsp_setirq(&ad1816->sb->dsp, 0); + sb_dsp_setdma8(&ad1816->sb->dsp, 0); + + if (config->activate) { + if (config->io[0].base != ISAPNP_IO_DISABLED) { + ad1816->cur_sb_addr = config->io[0].base; + ad1816_log(ad1816->log, "Updating SB DSP I/O port, SB DSP addr = %04X\n", ad1816->cur_sb_addr); + sb_dsp_setaddr(&ad1816->sb->dsp, ad1816->cur_sb_addr); + io_sethandler(ad1816->cur_sb_addr + 4, 0x0002, sb_ct1345_mixer_read, NULL, NULL, sb_ct1345_mixer_write, NULL, NULL, ad1816->sb); + io_sethandler(ad1816->cur_sb_addr + 0, 0x0004, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + io_sethandler(ad1816->cur_sb_addr + 8, 0x0002, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + } + if (config->io[1].base != ISAPNP_IO_DISABLED) { + ad1816->cur_opl_addr = config->io[1].base; + ad1816_log(ad1816->log, "Updating OPL I/O port, OPL addr = %04X\n", ad1816->cur_opl_addr); + io_sethandler(ad1816->cur_opl_addr, 0x0004, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + + } + if (config->io[2].base != ISAPNP_IO_DISABLED) { + ad1816->cur_ad1816_addr = config->io[2].base; + ad1816_log(ad1816->log, "Updating AD1816 I/O port, AD1816 addr = %04X\n", ad1816->cur_ad1816_addr); + io_sethandler(ad1816->cur_ad1816_addr, 0x10, ad1816_reg_read, NULL, NULL, ad1816_reg_write, NULL, NULL, ad1816); + } + if (config->irq[0].irq != ISAPNP_IRQ_DISABLED) { + ad1816->cur_irq = config->irq[0].irq; + sb_dsp_setirq(&ad1816->sb->dsp, ad1816->cur_irq); + ad1816_log(ad1816->log, "Updated AD1816/SB IRQ to %02X\n", ad1816->cur_irq); + } + if (config->dma[0].dma != ISAPNP_DMA_DISABLED) { + ad1816->cur_dma = config->dma[0].dma; + sb_dsp_setdma8(&ad1816->sb->dsp, ad1816->cur_dma); + ad1816_log(ad1816->log, "Updated AD1816/SB DMA to %02X\n", ad1816->cur_dma); + } + } + break; + case 1: /* MPU401 */ + if (config->activate) { + if (config->io[0].base != ISAPNP_IO_DISABLED) { + ad1816->cur_mpu_addr = config->io[0].base; + ad1816_log(ad1816->log, "Updating MPU401 I/O port, MPU401 addr = %04X\n", ad1816->cur_mpu_addr); + mpu401_change_addr(ad1816->mpu, ad1816->cur_mpu_addr); + } + if (config->irq[0].irq != ISAPNP_IRQ_DISABLED) { + ad1816->cur_mpu_irq = config->irq[0].irq; + mpu401_setirq(ad1816->mpu, ad1816->cur_mpu_irq); + ad1816_log(ad1816->log, "Updated MPU401 IRQ to %02X\n", ad1816->cur_mpu_irq); + } + } + break; + case 2: /* Gameport */ + ad1816->cur_js_addr = config->io[0].base; + gameport_remap(ad1816->gameport, (config->activate && (config->io[0].base != ISAPNP_IO_DISABLED)) ? config->io[0].base : 0); + break; + default: + break; + } +} + +void +ad1816_irq_poll(void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + if (ad1816->iregs[1] & 0x2000) { + ad1816_log(ad1816->log, "Firing timer IRQ\n"); + picint(1 << ad1816->cur_irq); + ad1816_log(ad1816->log, "Setting TI bit\n"); + ad1816->regs[1] = ad1816->regs[1] | 0x20; + ad1816_log(ad1816->log, "Reloading Timer Count\n"); + ad1816->iregs[13] = ad1816->iregs[12]; + } +} + +static void * +ad1816_init(const device_t *info) +{ + ad1816_t *ad1816 = calloc(1, sizeof(ad1816_t)); + uint8_t c; + double attenuation; + + ad1816->cur_ad1816_addr = 0x530; + ad1816->cur_sb_addr = 0x220; + ad1816->cur_opl_addr = 0x388; + ad1816->cur_mpu_addr = 0x330; + ad1816->cur_js_addr = 0x200; + ad1816->cur_irq = 5; + ad1816->cur_mpu_irq = 9; + ad1816->cur_dma = 1; + ad1816->enable = 1; + + ad1816->regs[0] = 0x80; + ad1816->regs[13] = 0xf0; + ad1816->regs[14] = 0xff; + ad1816->regs[15] = 0xff; + + ad1816->iregs[01] = 0x0102; + ad1816->iregs[02] = 0x1f40; + ad1816->iregs[03] = 0x1f40; + ad1816->iregs[04] = 0x8080; + ad1816->iregs[05] = 0x8080; + ad1816->iregs[06] = 0x8080; + ad1816->iregs[07] = 0x8080; + ad1816->iregs[15] = 0x8888; + ad1816->iregs[16] = 0x8888; + ad1816->iregs[17] = 0x8888; + ad1816->iregs[18] = 0x8888; + ad1816->iregs[19] = 0x8888; + ad1816->iregs[32] = 0x00f0; + ad1816->iregs[34] = 0x5622; + ad1816->iregs[35] = 0xac44; + ad1816->iregs[36] = 0xac44; + ad1816->iregs[38] = 0xac44; + ad1816->iregs[39] = 0x8000; + ad1816->iregs[41] = 0x001b; + ad1816->iregs[45] = 0x0000; /* Version/ID */ + + ad1816->log = log_open("AD1816"); + + ad1816->gameport = gameport_add(&gameport_pnp_device); + gameport_remap(ad1816->gameport, ad1816->cur_js_addr); + + /* Set up Sound System direct registers */ + io_sethandler(ad1816->cur_ad1816_addr, 0x10, ad1816_reg_read, NULL,NULL, ad1816_reg_write, NULL, NULL, ad1816); + + ad1816_updatefreq(ad1816); + + ad1816->sb = calloc(1, sizeof(sb_t)); + ad1816->sb->opl_enabled = 1; + + sb_dsp_set_real_opl(&ad1816->sb->dsp, FM_YMF262); + sb_dsp_init(&ad1816->sb->dsp, SBPRO2_DSP_302, SB_SUBTYPE_DEFAULT, ad1816); + sb_dsp_setaddr(&ad1816->sb->dsp, ad1816->cur_sb_addr); + sb_dsp_setirq(&ad1816->sb->dsp, ad1816->cur_irq); + sb_dsp_setirq(&ad1816->sb->dsp, ad1816->cur_dma); + sb_ct1345_mixer_reset(ad1816->sb); + + fm_driver_get(FM_YMF262, &ad1816->sb->opl); + io_sethandler(ad1816->cur_sb_addr + 0, 0x0004, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + io_sethandler(ad1816->cur_sb_addr + 8, 0x0002, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + io_sethandler(ad1816->cur_opl_addr, 0x0004, ad1816->sb->opl.read, NULL, NULL, ad1816->sb->opl.write, NULL, NULL, ad1816->sb->opl.priv); + + io_sethandler(ad1816->cur_sb_addr + 4, 0x0002, sb_ct1345_mixer_read, NULL, NULL, sb_ct1345_mixer_write, NULL, NULL, ad1816->sb); + + sound_add_handler(ad1816_get_buffer, ad1816); + music_add_handler(sb_get_music_buffer_sbpro, ad1816->sb); + + sound_set_cd_audio_filter(NULL, NULL); /* Seems to be necessary for the filter below to apply */ + sound_set_cd_audio_filter(sbpro_filter_cd_audio, ad1816->sb); /* Default SBPro mode CD audio filter */ + + ad1816->mpu = (mpu_t *) calloc(1, sizeof(mpu_t)); + mpu401_init(ad1816->mpu, ad1816->cur_mpu_addr, ad1816->cur_mpu_irq, M_UART, device_get_config_int("receive_input401")); + + if (device_get_config_int("receive_input")) + midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &ad1816->sb->dsp); + + const char *pnp_rom_file = NULL; + uint16_t pnp_rom_len = 512; + pnp_rom_file = PNP_ROM_AD1816; + + uint8_t *pnp_rom = NULL; + if (pnp_rom_file) { + FILE *fp = rom_fopen(pnp_rom_file, "rb"); + if (fp) { + if (fread(ad1816->pnp_rom, 1, pnp_rom_len, fp) == pnp_rom_len) + pnp_rom = ad1816->pnp_rom; + fclose(fp); + } + } + ad1816->pnp_card = isapnp_add_card(pnp_rom, sizeof(ad1816->pnp_rom), ad1816_pnp_config_changed, + NULL, NULL, NULL, ad1816); + + timer_add(&ad1816->timer_count, ad1816_poll, ad1816, 0); + + timer_add(&ad1816->ad1816_irq_timer, ad1816_irq_poll, ad1816, 0); + + /* Calculate attenuation values for both the 6-bit and 5-bit volume controls */ + for (c = 0; c < 64; c++) { + attenuation = 0.0; + if (c & 0x01) + attenuation -= 1.5; + if (c & 0x02) + attenuation -= 3.0; + if (c & 0x04) + attenuation -= 6.0; + if (c & 0x08) + attenuation -= 12.0; + if (c & 0x10) + attenuation -= 24.0; + if (c & 0x20) + attenuation -= 48.0; + + attenuation = pow(10, attenuation / 10); + + ad1816_vols_6bits[c] = (int) (attenuation * 65536); + } + + for (c = 0; c < 32; c++) { + attenuation = 0.0; + if (c & 0x01) + attenuation -= 1.5; + if (c & 0x02) + attenuation -= 3.0; + if (c & 0x04) + attenuation -= 6.0; + if (c & 0x08) + attenuation -= 12.0; + if (c & 0x10) + attenuation -= 24.0; + + attenuation = pow(10, attenuation / 10); + + ad1816_vols_5bits[c] = (attenuation * 65536); + } + + for (c = 0; c < 32; c++) { + attenuation = 12.0; + if (c & 0x01) + attenuation -= 1.5; + if (c & 0x02) + attenuation -= 3.0; + if (c & 0x04) + attenuation -= 6.0; + if (c & 0x08) + attenuation -= 12.0; + if (c & 0x10) + attenuation -= 24.0; + + attenuation = pow(10, attenuation / 10); + + ad1816_vols_5bits_aux_gain[c] = (attenuation * 65536); + } + + return ad1816; +} + +static void +ad1816_close(void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + if (ad1816->log != NULL) { + log_close(ad1816->log); + ad1816->log = NULL; + } + + sb_close(ad1816->sb); + free(ad1816->mpu); + free(priv); +} + +static int +ad1816_available(void) +{ + return rom_present(PNP_ROM_AD1816); +} + +static void +ad1816_speed_changed(void *priv) +{ + ad1816_t *ad1816 = (ad1816_t *) priv; + + ad1816->timer_latch = (uint64_t) ((double) TIMER_USEC * (1000000.0 / (double) ad1816->freq)); + + sb_speed_changed(ad1816->sb); +} + +static const device_config_t ad1816_config[] = { + // clang-format off + { + .name = "receive_input", + .description = "Receive MIDI input", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 1, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, + { + .name = "receive_input401", + .description = "Receive MIDI input (MPU-401)", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t ad1816_device = { + .name = "Analog Devices AD1816", + .internal_name = "ad1816", + .flags = DEVICE_ISA16, + .local = 0, + .init = ad1816_init, + .close = ad1816_close, + .reset = NULL, + .available = ad1816_available, + .speed_changed = ad1816_speed_changed, + .force_redraw = NULL, + .config = ad1816_config +}; + diff --git a/src/sound/sound.c b/src/sound/sound.c index 4b3575bc092..a5a7b07ed4e 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -137,6 +137,7 @@ static const SOUND_CARD sound_cards[] = { { &adlib_device }, /* ISA16 */ { &acermagic_s20_device }, + { &ad1816_device }, { &azt2316a_device }, { &azt1605_device }, { &sb_goldfinch_device }, From 816f63b7a4b269918a9c00ff6dbd4954a878dff4 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 21 Dec 2025 01:01:30 -0300 Subject: [PATCH 114/320] SDL: Enable joystick support already present in the Qt UI Co-authored-by: Alexander Babikov --- src/unix/CMakeLists.txt | 1 + src/unix/unix.c | 21 --------------------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/src/unix/CMakeLists.txt b/src/unix/CMakeLists.txt index 1d428fa2b41..1c79b42d2e8 100644 --- a/src/unix/CMakeLists.txt +++ b/src/unix/CMakeLists.txt @@ -22,6 +22,7 @@ add_library(plat OBJECT unix.c unix_serial_passthrough.c unix_netsocket.c + ../qt/sdl_joystick.c ) if (NOT CPPTHREADS) diff --git a/src/unix/unix.c b/src/unix/unix.c index 535fd06ea16..97f8b972ad8 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -67,9 +67,6 @@ int fixed_size_x = 640; int fixed_size_y = 480; extern int title_set; extern wchar_t sdl_win_title[512]; -plat_joystick_state_t plat_joystick_state[MAX_PLAT_JOYSTICKS]; -joystick_state_t joystick_state[GAMEPORT_MAX][MAX_JOYSTICKS]; -int joysticks_present; SDL_mutex *blitmtx; SDL_threadID eventthread; static int exit_event = 0; @@ -1689,24 +1686,6 @@ plat_language_code_r(UNUSED(int id), UNUSED(char *outbuf), UNUSED(int len)) return; } -void -joystick_init(void) -{ - /* No-op. */ -} - -void -joystick_close(void) -{ - /* No-op. */ -} - -void -joystick_process(uint8_t gp) -{ - /* No-op. */ -} - void startblit(void) { From e59bb4dc2ec24688d57b3658eda1c19c0f1514ea Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 21 Dec 2025 22:00:24 +0600 Subject: [PATCH 115/320] Voodoo stippling support for 3D --- src/include/86box/vid_voodoo_codegen_x86-64.h | 82 +++++++++++++++++-- src/include/86box/vid_voodoo_regs.h | 3 + src/video/vid_voodoo_fb.c | 26 ++++++ src/video/vid_voodoo_render.c | 17 ++++ 4 files changed, 120 insertions(+), 8 deletions(-) diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index 67a5cae2c29..8b1413ad4d7 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -653,14 +653,15 @@ codegen_texture_fetch(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *pa static inline void voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t *state, int depthop) { - int block_pos = 0; - int z_skip_pos = 0; - int a_skip_pos = 0; - int amask_skip_pos = 0; - int chroma_skip_pos = 0; - int depth_jump_pos = 0; - int depth_jump_pos2 = 0; - int loop_jump_pos = 0; + int block_pos = 0; + int z_skip_pos = 0; + int a_skip_pos = 0; + int amask_skip_pos = 0; + int stipple_skip_pos = 0; + int chroma_skip_pos = 0; + int depth_jump_pos = 0; + int depth_jump_pos2 = 0; + int loop_jump_pos = 0; #if 0 xmm_01_w = (__m128i)0x0001000100010001ull; xmm_ff_w = (__m128i)0x00ff00ff00ff00ffull; @@ -766,6 +767,69 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, addquad((uint64_t) (uintptr_t) &i_00_ff_w); loop_jump_pos = block_pos; + if (params->fbzMode & FBZ_STIPPLE) { + /* Stipple enabled. */ + if (params->fbzMode & FBZ_STIPPLE_PATT) { + /* x64's BT instruction is too slow. So use TEST instead. */ + addbyte(0x4c); /* MOV RBX, R14(real_y)*/ + addbyte(0x89); + addbyte(0xf3); + + addbyte(0x83); /* AND EBX, 3 */ + addbyte(0xe3); + addbyte(0x03); + + addbyte(0xc1); /* SHL EBX, 3 */ + addbyte(0xe3); + addbyte(0x03); + + addbyte(0x8b); /*MOV EAX, state->x[EDI]*/ + addbyte(0x87); + addlong(offsetof(voodoo_state_t, x)); + + addbyte(0xf7); /* NOT EAX */ + addbyte(0xd0); + + addbyte(0x83); /* AND EAX, 7 */ + addbyte(0xe0); + addbyte(0x07); + + addbyte(0x09); /* OR EAX, EBX */ + addbyte(0xc3); + + addbyte(0x88); /* MOV CL, AL */ + addbyte(0xc1); + + addbyte(0xb8); /* MOV EAX, 1*/ + addlong(1); + + addbyte(0xd3); /* SHL EAX, CL */ + addbyte(0xe0); + + addbyte(0x85); /* TEST state->stipple[EDI], EAX */ + addbyte(0x87); + addlong(offsetof(voodoo_state_t, stipple)); + + addbyte(0x0f); /* JZ stipple_skip_pos */ + addbyte(0x84); + stipple_skip_pos = block_pos; + addlong(0); + } else { + addbyte(0xd1); /* ROR state->stipple[EDI], 1*/ + addbyte(0x8f); + addlong(offsetof(voodoo_state_t, stipple)); + + addbyte(0xf7); /* TEST state->stipple[EDI], 0x80000000 */ + addbyte(0x87); + addlong(offsetof(voodoo_state_t, stipple)); + addlong(0x80000000); + + addbyte(0x0f); /* JZ stipple_skip_pos */ + addbyte(0x84); + stipple_skip_pos = block_pos; + addlong(0); + } + } addbyte(0x4c); /*MOV RSI, R15*/ addbyte(0x89); addbyte(0xfe); @@ -3190,6 +3254,8 @@ voodoo_generate(uint8_t *code_block, voodoo_t *voodoo, voodoo_params_t *params, *(uint32_t *) &code_block[chroma_skip_pos] = (block_pos - chroma_skip_pos) - 4; if (amask_skip_pos) *(uint32_t *) &code_block[amask_skip_pos] = (block_pos - amask_skip_pos) - 4; + if (stipple_skip_pos) + *(uint32_t *) &code_block[stipple_skip_pos] = (block_pos - stipple_skip_pos) - 4; addbyte(0x4c); /*MOV RSI, R15*/ addbyte(0x89); diff --git a/src/include/86box/vid_voodoo_regs.h b/src/include/86box/vid_voodoo_regs.h index 3340720a7ec..9f3260c9fb2 100644 --- a/src/include/86box/vid_voodoo_regs.h +++ b/src/include/86box/vid_voodoo_regs.h @@ -358,6 +358,7 @@ enum { enum { FBZ_CHROMAKEY = (1 << 1), + FBZ_STIPPLE = (1 << 2), FBZ_W_BUFFER = (1 << 3), FBZ_DEPTH_ENABLE = (1 << 4), @@ -366,6 +367,8 @@ enum { FBZ_DEPTH_WMASK = (1 << 10), FBZ_DITHER_2x2 = (1 << 11), + FBZ_STIPPLE_PATT = (1 << 12), + FBZ_ALPHA_MASK = (1 << 13), FBZ_DRAW_FRONT = 0x0000, diff --git a/src/video/vid_voodoo_fb.c b/src/video/vid_voodoo_fb.c index 1c140873f1d..a97ca62a7e9 100644 --- a/src/video/vid_voodoo_fb.c +++ b/src/video/vid_voodoo_fb.c @@ -254,6 +254,19 @@ voodoo_fb_writew(uint32_t addr, uint16_t val, void *priv) int colbfog_g = 0; int colbfog_b = 0; + if (params->fbzMode & FBZ_STIPPLE) { + if (params->fbzMode & FBZ_STIPPLE_PATT) { + int index = ((y & 3) << 3) | (~x & 7); + if (!(params->stipple & (1 << index))) + goto skip_pixel; + } else { + voodoo->params.stipple = (voodoo->params.stipple << 1) | (voodoo->params.stipple >> 31); + if (!(voodoo->params.stipple & 0x80000000)) { + goto skip_pixel; + } + } + } + if (params->fbzMode & FBZ_DEPTH_ENABLE) { uint16_t old_depth = *(uint16_t *) (&voodoo->fb_mem[write_addr_aux & voodoo->fb_mask]); @@ -449,6 +462,19 @@ voodoo_fb_writel(uint32_t addr, uint32_t val, void *priv) int colbfog_g = 0; int colbfog_b = 0; + if (params->fbzMode & FBZ_STIPPLE) { + if (params->fbzMode & FBZ_STIPPLE_PATT) { + int index = ((y & 3) << 3) | (~(x + c) & 7); + if (!(params->stipple & (1 << index))) + goto skip_pixel; + } else { + voodoo->params.stipple = (voodoo->params.stipple << 1) | (voodoo->params.stipple >> 31); + if (!(voodoo->params.stipple & 0x80000000)) { + goto skip_pixel; + } + } + } + if (params->fbzMode & FBZ_DEPTH_ENABLE) { uint16_t old_depth = *(uint16_t *) (&voodoo->fb_mem[write_addr_aux & voodoo->fb_mask]); diff --git a/src/video/vid_voodoo_render.c b/src/video/vid_voodoo_render.c index 97186634d6c..b25f4250775 100644 --- a/src/video/vid_voodoo_render.c +++ b/src/video/vid_voodoo_render.c @@ -88,6 +88,8 @@ typedef struct voodoo_state_t { uint32_t texBaseAddr; int lod_frac[2]; + + int stipple; } voodoo_state_t; #ifdef ENABLE_VOODOO_RENDER_LOG @@ -990,6 +992,20 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * w_depth = 0xffff; } + if (params->fbzMode & FBZ_STIPPLE) { + if (params->fbzMode & FBZ_STIPPLE_PATT) { + int index = ((real_y & 3) << 3) | (~x & 7); + + if (!(state->stipple & (1 << index))) + goto skip_pixel; + } else { + state->stipple = (state->stipple << 1) | (state->stipple >> 31); + if (!(state->stipple & 0x80000000)) { + goto skip_pixel; + } + } + } + #if 0 w_depth = CLAMP16(w_depth); #endif @@ -1560,6 +1576,7 @@ voodoo_render_log("voodoo_triangle %i %i %i : vA %f, %f vB %f, %f vC %f, %f f if (lodbias & 0x20) lodbias |= ~0x3f; state.tmu[1].lod = LOD + (lodbias << 6); + state.stipple = params->stipple; voodoo_half_triangle(voodoo, params, &state, vertexAy_adjusted, vertexCy_adjusted, odd_even); } From 0516aa3d0064a5d44e4010924e5a209801e51c5d Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 21 Dec 2025 17:05:51 +0100 Subject: [PATCH 116/320] AT KBC: Actually leave the P1 video type bit handling to the machine code - the handling on the KBC side was redundant. --- src/device/kbc_at.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index b2e027cd3d7..599b35df029 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -37,7 +37,6 @@ #include <86box/fdd.h> #include <86box/fdc.h> #include <86box/pci.h> -#include <86box/video.h> #include <86box/keyboard.h> #define STAT_PARITY 0x80 @@ -2793,11 +2792,8 @@ kbc_at_reset(void *priv) dev->mem[0x20] |= CCB_TRANSLATE; dev->command_phase = 0; - /* Set up the correct Video Type bits. */ - if (!is286 || (kbc_ven == KBC_VEN_ACER)) - dev->p1 = video_is_mda() ? 0xb0 : 0xf0; - else - dev->p1 = video_is_mda() ? 0xf0 : 0xb0; + /* Video Type is now handled in the machine P1 handler. */ + dev->p1 = 0xf0; kbc_at_log("ATkbc: P1 = %02x\n", dev->p1); /* Disabled both the keyboard and auxiliary ports. */ @@ -2918,7 +2914,6 @@ kbc_at_init(const device_t *info) dev->is_asic = !!(info->local & KBC_FLAG_IS_ASIC); dev->is_type2 = !!(info->local & KBC_FLAG_IS_TYPE2); - video_reset(gfxcard[0]); kbc_at_reset(dev); dev->handlers[0].read = kbc_at_port_1_read; From 422944ec1a58654a2a2ea4f3a7640724287f4e0b Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 21 Dec 2025 17:07:57 +0100 Subject: [PATCH 117/320] AT KBC: Remove the now unused variable. --- src/device/kbc_at.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 599b35df029..771b95c2a82 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -2785,7 +2785,6 @@ static void kbc_at_reset(void *priv) { atkbc_t *dev = (atkbc_t *) priv; - uint8_t kbc_ven = dev->flags & KBC_VEN_MASK; dev->status = STAT_UNLOCKED; dev->mem[0x20] = 0x01; From 1739b8303c194c870b6e4fe0377aa003529962e2 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 21 Dec 2025 16:13:56 +0000 Subject: [PATCH 118/320] Get rid of some entirely unused video functions --- src/86box.c | 11 ----------- src/include/86box/video.h | 7 ------- src/video/vid_table.c | 18 ------------------ 3 files changed, 36 deletions(-) diff --git a/src/86box.c b/src/86box.c index 4bf73790e0c..b2311f0e23a 100644 --- a/src/86box.c +++ b/src/86box.c @@ -2138,17 +2138,6 @@ set_screen_size_natural(void) set_screen_size(monitors[i].mon_unscaled_size_x, monitors[i].mon_unscaled_size_y); } -int -get_actual_size_x(void) -{ - return (unscaled_size_x); -} - -int -get_actual_size_y(void) -{ - return (efscrnsz_y); -} void do_pause(int p) diff --git a/src/include/86box/video.h b/src/include/86box/video.h index ff63a3a7986..83fb2492e96 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -253,9 +253,6 @@ extern int video_get_video_from_internal_name(char *s); extern int video_card_get_flags(int card); extern int video_is_mda(void); extern int video_is_cga(void); -extern int video_is_ega_vga(void); -extern int video_is_8514(void); -extern int video_is_xga(void); extern void video_inform_monitor(int type, const video_timings_t *ptr, int monitor_index); extern int video_get_type_monitor(int monitor_index); @@ -290,10 +287,6 @@ extern void video_update_timing(void); extern void loadfont_ex(char *fn, int format, int offset); extern void loadfont(char *fn, int format); - -extern int get_actual_size_x(void); -extern int get_actual_size_y(void); - extern uint32_t video_color_transform(uint32_t color); #define video_inform(type, video_timings_ptr) video_inform_monitor(type, video_timings_ptr, monitor_index_global) diff --git a/src/video/vid_table.c b/src/video/vid_table.c index cb7e794e879..504e3dd54a4 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -482,21 +482,3 @@ video_is_cga(void) { return (video_get_type() == VIDEO_FLAG_TYPE_CGA); } - -int -video_is_ega_vga(void) -{ - return (video_get_type() == VIDEO_FLAG_TYPE_SPECIAL); -} - -int -video_is_8514(void) -{ - return (video_get_type() == VIDEO_FLAG_TYPE_8514); -} - -int -video_is_xga(void) -{ - return (video_get_type() == VIDEO_FLAG_TYPE_XGA); -} From cba44d222e3f7f605cff269bfa3146482d1e5094 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 21 Dec 2025 23:04:09 +0600 Subject: [PATCH 119/320] Fix refresh rate display if Voodoo 1/2 Graphics is active (#6598) --- src/video/vid_voodoo_display.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/vid_voodoo_display.c b/src/video/vid_voodoo_display.c index 3595d8b89e1..b126fc16590 100644 --- a/src/video/vid_voodoo_display.c +++ b/src/video/vid_voodoo_display.c @@ -645,6 +645,8 @@ voodoo_callback(void *priv) if (voodoo->dirty_line_high > voodoo->dirty_line_low || force_blit) svga_doblit(voodoo->h_disp, voodoo->v_disp - 1, voodoo->svga); + else if (voodoo->svga->override) + voodoo->svga->monitor->mon_renderedframes++; if (voodoo->clutData_dirty) { voodoo->clutData_dirty = 0; voodoo_calc_clutData(voodoo); From 61ed89f297596d41f0fdd93398733d9ae27523ee Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 22 Dec 2025 00:39:31 +0600 Subject: [PATCH 120/320] Fix glitched texts on Linux Voodoo drivers Also fix bad rectangle fills on Voodoo 2 if SLI is enabled --- src/include/86box/vid_voodoo_common.h | 2 ++ src/video/vid_voodoo_banshee_blitter.c | 45 +++++++++++++++++--------- src/video/vid_voodoo_blitter.c | 23 +++++++------ 3 files changed, 46 insertions(+), 24 deletions(-) diff --git a/src/include/86box/vid_voodoo_common.h b/src/include/86box/vid_voodoo_common.h index d87c1f73192..2870f09eae8 100644 --- a/src/include/86box/vid_voodoo_common.h +++ b/src/include/86box/vid_voodoo_common.h @@ -667,6 +667,8 @@ typedef struct voodoo_t { struct voodoo_set_t *set; + uint32_t launch_pending; + uint8_t fifo_thread_run; uint8_t render_thread_run[4]; diff --git a/src/video/vid_voodoo_banshee_blitter.c b/src/video/vid_voodoo_banshee_blitter.c index ac8cb172d31..af609d78571 100644 --- a/src/video/vid_voodoo_banshee_blitter.c +++ b/src/video/vid_voodoo_banshee_blitter.c @@ -1438,9 +1438,30 @@ banshee_polyfill_continue(voodoo_t *voodoo, uint32_t data) } } +static inline void +banshee_do_2d_launch(voodoo_t *voodoo) +{ + voodoo->launch_pending = 0; + voodoo->banshee_blt.rops[0] = voodoo->banshee_blt.command >> 24; + voodoo->banshee_blt.patoff_x = (voodoo->banshee_blt.command & COMMAND_PATOFF_X_MASK) >> COMMAND_PATOFF_X_SHIFT; + voodoo->banshee_blt.patoff_y = (voodoo->banshee_blt.command & COMMAND_PATOFF_Y_MASK) >> COMMAND_PATOFF_Y_SHIFT; + voodoo->banshee_blt.cur_x = 0; + voodoo->banshee_blt.cur_y = 0; + voodoo->banshee_blt.dstX = ((int32_t) (voodoo->banshee_blt.dstXY << 19)) >> 19; + voodoo->banshee_blt.dstY = ((int32_t) (voodoo->banshee_blt.dstXY << 3)) >> 19; + voodoo->banshee_blt.srcX = ((int32_t) (voodoo->banshee_blt.srcXY << 19)) >> 19; + voodoo->banshee_blt.srcY = ((int32_t) (voodoo->banshee_blt.srcXY << 3)) >> 19; + voodoo->banshee_blt.old_srcX = voodoo->banshee_blt.srcX; + voodoo->banshee_blt.host_data_remainder = 0; + voodoo->banshee_blt.host_data_count = 0; +} + static void banshee_do_2d_blit(voodoo_t *voodoo, int count, uint32_t data) { + if (voodoo->launch_pending) { + banshee_do_2d_launch(voodoo); + } switch (voodoo->banshee_blt.command & COMMAND_CMD_MASK) { case COMMAND_CMD_NOP: break; @@ -1691,21 +1712,7 @@ voodoo_2d_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val) case 0x70: voodoo_wait_for_render_thread_idle(voodoo); voodoo->banshee_blt.command = val; - voodoo->banshee_blt.rops[0] = val >> 24; -#if 0 - bansheeblt_log("command=%x %08x\n", voodoo->banshee_blt.command & COMMAND_CMD_MASK, val); -#endif - voodoo->banshee_blt.patoff_x = (val & COMMAND_PATOFF_X_MASK) >> COMMAND_PATOFF_X_SHIFT; - voodoo->banshee_blt.patoff_y = (val & COMMAND_PATOFF_Y_MASK) >> COMMAND_PATOFF_Y_SHIFT; - voodoo->banshee_blt.cur_x = 0; - voodoo->banshee_blt.cur_y = 0; - voodoo->banshee_blt.dstX = ((int32_t) (voodoo->banshee_blt.dstXY << 19)) >> 19; - voodoo->banshee_blt.dstY = ((int32_t) (voodoo->banshee_blt.dstXY << 3)) >> 19; - voodoo->banshee_blt.srcX = ((int32_t) (voodoo->banshee_blt.srcXY << 19)) >> 19; - voodoo->banshee_blt.srcY = ((int32_t) (voodoo->banshee_blt.srcXY << 3)) >> 19; - voodoo->banshee_blt.old_srcX = voodoo->banshee_blt.srcX; - voodoo->banshee_blt.host_data_remainder = 0; - voodoo->banshee_blt.host_data_count = 0; + voodoo->launch_pending = 1; switch (voodoo->banshee_blt.command & COMMAND_CMD_MASK) { #if 0 @@ -1725,6 +1732,7 @@ voodoo_2d_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val) #endif case COMMAND_CMD_POLYFILL: + banshee_do_2d_launch(voodoo); if (val & COMMAND_INITIATE) { voodoo->banshee_blt.dstXY = voodoo->banshee_blt.srcXY; voodoo->banshee_blt.dstX = voodoo->banshee_blt.srcX; @@ -1733,6 +1741,10 @@ voodoo_2d_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val) banshee_polyfill_start(voodoo); break; + case COMMAND_CMD_HOST_TO_SCREEN_BLT: + case COMMAND_CMD_HOST_TO_SCREEN_STRETCH_BLT: + break; + default: if (val & COMMAND_INITIATE) { banshee_do_2d_blit(voodoo, -1, 0); @@ -1779,6 +1791,9 @@ voodoo_2d_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val) #if 0 bansheeblt_log("launch %08x %08x %08x %08x\n", voodoo->banshee_blt.command, voodoo->banshee_blt.commandExtra, voodoo->banshee_blt.srcColorkeyMin, voodoo->banshee_blt.srcColorkeyMax); #endif + if (voodoo->launch_pending) { + banshee_do_2d_launch(voodoo); + } switch (voodoo->banshee_blt.command & COMMAND_CMD_MASK) { case COMMAND_CMD_SCREEN_TO_SCREEN_BLT: voodoo->banshee_blt.srcXY = val; diff --git a/src/video/vid_voodoo_blitter.c b/src/video/vid_voodoo_blitter.c index 0d2c9e103b2..856631637df 100644 --- a/src/video/vid_voodoo_blitter.c +++ b/src/video/vid_voodoo_blitter.c @@ -218,14 +218,7 @@ voodoo_v2_blit_start(voodoo_t *voodoo) break; case BLIT_COMMAND_CPU_TO_SCREEN: - voodoo->blt.dst_x = voodoo->bltDstX; - voodoo->blt.dst_y = voodoo->bltDstY; - voodoo->blt.cur_x = 0; - voodoo->blt.size_x = size_x; - voodoo->blt.size_y = size_y; - voodoo->blt.x_dir = x_dir; - voodoo->blt.y_dir = y_dir; - voodoo->blt.dst_stride = (voodoo->bltCommand & BLTCMD_DST_TILED) ? ((voodoo->bltDstXYStride & 0x3f) * 32 * 2) : (voodoo->bltDstXYStride & 0xff8); + voodoo->launch_pending = 1; break; case BLIT_COMMAND_RECT_FILL: @@ -234,7 +227,7 @@ voodoo_v2_blit_start(voodoo_t *voodoo) int dst_x = voodoo->bltDstX; if (SLI_ENABLED) { - if ((!(voodoo->initEnable & INITENABLE_SLI_MASTER_SLAVE) && (voodoo->blt.dst_y & 1)) || ((voodoo->initEnable & INITENABLE_SLI_MASTER_SLAVE) && !(voodoo->blt.dst_y & 1))) + if ((!(voodoo->initEnable & INITENABLE_SLI_MASTER_SLAVE) && (dst_y & 1)) || ((voodoo->initEnable & INITENABLE_SLI_MASTER_SLAVE) && !(dst_y & 1))) goto skip_line_fill; dst = (uint16_t *) &voodoo->fb_mem[dst_base_addr + (dst_y >> 1) * dst_stride]; } else @@ -303,6 +296,18 @@ voodoo_v2_blit_data(voodoo_t *voodoo, uint32_t data) if ((voodoo->bltCommand & BLIT_COMMAND_MASK) != BLIT_COMMAND_CPU_TO_SCREEN) return; + if (voodoo->launch_pending) { + voodoo->blt.dst_x = voodoo->bltDstX; + voodoo->blt.dst_y = voodoo->bltDstY; + voodoo->blt.cur_x = 0; + voodoo->blt.size_x = voodoo->bltSizeX; + voodoo->blt.size_y = voodoo->bltSizeY; + voodoo->blt.x_dir = (voodoo->bltSizeX > 0) ? 1 : -1; + voodoo->blt.y_dir = (voodoo->bltSizeY > 0) ? 1 : -1; + voodoo->blt.dst_stride = (voodoo->bltCommand & BLTCMD_DST_TILED) ? ((voodoo->bltDstXYStride & 0x3f) * 32 * 2) : (voodoo->bltDstXYStride & 0xff8); + voodoo->launch_pending = 0; + } + if (SLI_ENABLED) { addr = base_addr + (voodoo->blt.dst_y >> 1) * voodoo->blt.dst_stride; dst = (uint16_t *) &voodoo->fb_mem[addr]; From 407a0958f2ba233f540c708cf0767b4822f5cc9f Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 21 Dec 2025 18:49:10 +0000 Subject: [PATCH 121/320] rename load font to video_load_font, get rid of loadfont_ex; use calloc and don't malloc magic amount of vram --- src/include/86box/vid_mda.h | 1 + src/include/86box/video.h | 19 ++++++++- src/machine/m_amstrad.c | 8 ++-- src/machine/m_pcjr.c | 2 +- src/machine/m_v86p.c | 4 +- src/machine/m_xt.c | 2 +- src/machine/m_xt_olivetti.c | 2 +- src/machine/m_xt_t1000.c | 4 +- src/video/vid_ati28800.c | 6 +-- src/video/vid_cga.c | 8 ++-- src/video/vid_cga_ncr.c | 2 +- src/video/vid_cga_olivetti.c | 2 +- src/video/vid_cga_quadcolor.c | 6 +-- src/video/vid_cga_toshiba_t1000.c | 2 +- src/video/vid_cga_toshiba_t3100e.c | 2 +- src/video/vid_cga_v6355.c | 6 +-- src/video/vid_et4000.c | 4 +- src/video/vid_genius.c | 2 +- src/video/vid_hercules.c | 10 ++--- src/video/vid_hercules_incolor.c | 10 ++--- src/video/vid_hercules_plus.c | 10 ++--- src/video/vid_im1024.c | 2 +- src/video/vid_jega.c | 8 ++-- src/video/vid_mda.c | 16 ++++---- src/video/vid_ps55da2.c | 6 +-- src/video/vid_sigma.c | 2 +- src/video/vid_table.c | 2 +- src/video/vid_wy700.c | 2 +- src/video/video.c | 65 ++++++++++-------------------- 29 files changed, 104 insertions(+), 111 deletions(-) diff --git a/src/include/86box/vid_mda.h b/src/include/86box/vid_mda.h index 17c02834327..4d11305f4e9 100644 --- a/src/include/86box/vid_mda.h +++ b/src/include/86box/vid_mda.h @@ -18,6 +18,7 @@ // Defines #define MDA_CRTC_NUM_REGISTERS 32 +#define MDA_VRAM 0x1000 // Enums & structures diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 83fb2492e96..8e418867729 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -58,6 +58,21 @@ enum { VIDEO_AGP }; +typedef enum video_font_format_e +{ + FONT_FORMAT_MDA = 0, + FONT_FORMAT_PC200 = 1, + FONT_FORMAT_CGA = 2, + FONT_FORMAT_WY700 = 3, + FONT_FORMAT_MDSI_GENIUS = 4, + FONT_FORMAT_TOSHIBA_3100E = 5, + FONT_FORMAT_KSC6501 = 6, + FONT_FORMAT_SIGMA = 7, + FONT_FORMAT_PC1512_T1000 = 8, + FONT_FORMAT_IM1024 = 9, + FONT_FORMAT_PRAVETZ = 10, +} video_font_format; + #define VIDEO_FLAG_TYPE_CGA 0 #define VIDEO_FLAG_TYPE_MDA 1 #define VIDEO_FLAG_TYPE_SPECIAL 2 @@ -285,8 +300,8 @@ extern uint8_t video_force_resize_get_monitor(int monitor_index); extern void video_force_resize_set_monitor(uint8_t res, int monitor_index); extern void video_update_timing(void); -extern void loadfont_ex(char *fn, int format, int offset); -extern void loadfont(char *fn, int format); +#define LOAD_FONT_NO_OFFSET 0 +extern void video_load_font(char *fn, int format, int offset); extern uint32_t video_color_transform(uint32_t color); #define video_inform(type, video_timings_ptr) video_inform_monitor(type, video_timings_ptr, monitor_index_global) diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index 8e52bd4889f..f056397a10b 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -3020,7 +3020,7 @@ machine_amstrad_init(const machine_t *model, int type) if (gfxcard[0] == VID_INTERNAL) switch (type) { case AMS_PC1512: - loadfont("roms/machines/pc1512/40078", 8); + video_load_font("roms/machines/pc1512/40078", FONT_FORMAT_PC1512_T1000, LOAD_FONT_NO_OFFSET); device_context(&vid_1512_device); ams->language = device_get_config_int("language"); vid_init_1512(ams); @@ -3029,7 +3029,7 @@ machine_amstrad_init(const machine_t *model, int type) break; case AMS_PPC512: - loadfont("roms/machines/ppc512/40109", 1); + video_load_font("roms/machines/ppc512/40109", FONT_FORMAT_PC200, LOAD_FONT_NO_OFFSET); device_context(&vid_ppc512_device); ams->language = device_get_config_int("language"); vid_init_200(ams); @@ -3038,7 +3038,7 @@ machine_amstrad_init(const machine_t *model, int type) break; case AMS_PC1640: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); device_context(&vid_1640_device); ams->language = device_get_config_int("language"); vid_init_1640(ams); @@ -3047,7 +3047,7 @@ machine_amstrad_init(const machine_t *model, int type) break; case AMS_PC200: - loadfont("roms/machines/pc200/40109", 1); + video_load_font("roms/machines/pc200/40109", FONT_FORMAT_PC200, LOAD_FONT_NO_OFFSET); device_context(&vid_200_device); ams->language = device_get_config_int("language"); vid_init_200(ams); diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index 78f7ba7107d..10d2d0c7b30 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -897,7 +897,7 @@ machine_pcjr_init(UNUSED(const machine_t *model)) /* Initialize the video controller. */ video_reset(gfxcard[0]); - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); device_context(&pcjr_device); pcjr_vid_init(pcjr); device_context_restore(); diff --git a/src/machine/m_v86p.c b/src/machine/m_v86p.c index 0be44de5332..1265173458c 100644 --- a/src/machine/m_v86p.c +++ b/src/machine/m_v86p.c @@ -77,9 +77,9 @@ machine_v86p_init(const machine_t *model) return ret; if (rom_id == 2) - loadfont("roms/machines/v86p/V86P.FON", 8); + video_load_font("roms/machines/v86p/V86P.FON", FONT_FORMAT_PC1512_T1000, LOAD_FONT_NO_OFFSET); else - loadfont("roms/machines/v86p/v86pfont.rom", 8); + video_load_font("roms/machines/v86p/v86pfont.rom", FONT_FORMAT_PC1512_T1000, LOAD_FONT_NO_OFFSET); machine_common_init(model); diff --git a/src/machine/m_xt.c b/src/machine/m_xt.c index 2d314b7f2eb..81c9eba7280 100644 --- a/src/machine/m_xt.c +++ b/src/machine/m_xt.c @@ -2154,7 +2154,7 @@ machine_xt_maz1016_init(const machine_t *model) if (bios_only || !ret) return ret; - loadfont("roms/machines/maz1016/crt-8.bin", 0); + video_load_font("roms/machines/maz1016/crt-8.bin", FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); machine_xt_clone_init(model, 0); diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index 50a891e2c1c..e6c64cf951b 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -2018,7 +2018,7 @@ m19_vid_init(m19_vid_t *vid) #endif /* OGC emulation part begin */ - loadfont("roms/machines/m19/MBM2764-30 8514 107 AB PCF3.BIN", 7); + video_load_font("roms/machines/m19/MBM2764-30 8514 107 AB PCF3.BIN", FONT_FORMAT_SIGMA, LOAD_FONT_NO_OFFSET); /* composite is not working yet */ vid->ogc.cga.composite = 0; // (display_type != CGA_RGB); vid->ogc.cga.revision = device_get_config_int("composite_type"); diff --git a/src/machine/m_xt_t1000.c b/src/machine/m_xt_t1000.c index 87899e7c6c3..8fd6925882c 100644 --- a/src/machine/m_xt_t1000.c +++ b/src/machine/m_xt_t1000.c @@ -846,7 +846,7 @@ machine_xt_t1000_init(const machine_t *model) t1000.ems_port_index = 7; /* EMS disabled */ /* Load the T1000 CGA Font ROM. */ - loadfont("roms/machines/t1000/t1000font.bin", 2); + video_load_font("roms/machines/t1000/t1000font.bin", FONT_FORMAT_CGA, LOAD_FONT_NO_OFFSET); /* * The ROM drive is optional. @@ -928,7 +928,7 @@ machine_xt_t1200_init(const machine_t *model) t1000.ems_port_index = 7; /* EMS disabled */ /* Load the T1000 CGA Font ROM. */ - loadfont("roms/machines/t1000/t1000font.bin", 2); + video_load_font("roms/machines/t1000/t1000font.bin", FONT_FORMAT_CGA, LOAD_FONT_NO_OFFSET); /* Map the EMS page frame */ for (uint8_t pg = 0; pg < 4; pg++) { diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index 2fe46bea311..70b360c1e09 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -574,16 +574,16 @@ ati28800k_init(const device_t *info) default: case 0: rom_init(&ati28800->bios_rom, BIOS_ATIKOR_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); - loadfont(FONT_ATIKOR_PATH, 6); + video_load_font(FONT_ATIKOR_PATH, FONT_FORMAT_KSC6501, LOAD_FONT_NO_OFFSET); break; case 1: rom_init_interleaved(&ati28800->bios_rom, BIOS_ATIKOR_4620P_PATH_L, BIOS_ATIKOR_4620P_PATH_H, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); - loadfont(FONT_ATIKOR_4620P_PATH, 6); + video_load_font(FONT_ATIKOR_4620P_PATH, FONT_FORMAT_KSC6501, LOAD_FONT_NO_OFFSET); break; case 2: rom_init(&ati28800->bios_rom, BIOS_ATIKOR_6033P_PATH, 0xc0000, 0x8000, 0x7fff, 0, MEM_MAPPING_EXTERNAL); - loadfont(FONT_ATIKOR_6033P_PATH, 6); + video_load_font(FONT_ATIKOR_6033P_PATH, FONT_FORMAT_KSC6501,LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index 3bedf53a410..f4c93e9c4d6 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -782,13 +782,13 @@ cga_standalone_init(UNUSED(const device_t *info)) switch(device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } @@ -802,7 +802,7 @@ cga_pravetz_init(const device_t *info) { cga_t *cga = cga_standalone_init(info); - loadfont("roms/video/cga/PRAVETZ-VDC2.BIN", 10); + video_load_font("roms/video/cga/PRAVETZ-VDC2.BIN", FONT_FORMAT_PRAVETZ, LOAD_FONT_NO_OFFSET); io_removehandler(0x03dd, 0x0001, cga_in, NULL, NULL, cga_out, NULL, NULL, cga); io_sethandler(0x03dd, 0x0001, cga_pravetz_in, NULL, NULL, cga_pravetz_out, NULL, NULL, cga); diff --git a/src/video/vid_cga_ncr.c b/src/video/vid_cga_ncr.c index 6b0f15f6545..cda38036bb4 100644 --- a/src/video/vid_cga_ncr.c +++ b/src/video/vid_cga_ncr.c @@ -562,7 +562,7 @@ nga_init(UNUSED(const device_t *info)) charset = device_get_config_int("charset"); - loadfont_ex("roms/video/nga/ncr_nga_35122.bin", 1, 4096 * charset); + video_load_font("roms/video/nga/ncr_nga_35122.bin", 1, 4096 * charset); nga->cga.composite = 0; nga->cga.snow_enabled = device_get_config_int("snow_enabled"); diff --git a/src/video/vid_cga_olivetti.c b/src/video/vid_cga_olivetti.c index 4cb845684fc..bd565c0d780 100644 --- a/src/video/vid_cga_olivetti.c +++ b/src/video/vid_cga_olivetti.c @@ -592,7 +592,7 @@ ogc_init(UNUSED(const device_t *info)) memset(ogc, 0x00, sizeof(ogc_t)); video_inform(VIDEO_FLAG_TYPE_CGA, &timing_ogc); - loadfont("roms/video/ogc/ogc graphics board go380 258 pqbq.bin", 1); + video_load_font("roms/video/ogc/ogc graphics board go380 258 pqbq.bin", FONT_FORMAT_PC200, LOAD_FONT_NO_OFFSET); /* FIXME: composite is not working yet */ #if 0 diff --git a/src/video/vid_cga_quadcolor.c b/src/video/vid_cga_quadcolor.c index 4159dc2c12a..c5c3d34562a 100644 --- a/src/video/vid_cga_quadcolor.c +++ b/src/video/vid_cga_quadcolor.c @@ -828,13 +828,13 @@ quadcolor_standalone_init(UNUSED(const device_t *info)) switch(device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_cga_toshiba_t1000.c b/src/video/vid_cga_toshiba_t1000.c index 894d28a567a..2a16a7d0eb3 100644 --- a/src/video/vid_cga_toshiba_t1000.c +++ b/src/video/vid_cga_toshiba_t1000.c @@ -650,7 +650,7 @@ static void * t1000_init(UNUSED(const device_t *info)) { t1000_t *t1000 = calloc(1, sizeof(t1000_t)); - loadfont("roms/machines/t1000/t1000font.bin", 8); + video_load_font("roms/machines/t1000/t1000font.bin", FONT_FORMAT_PC1512_T1000, LOAD_FONT_NO_OFFSET); cga_init(&t1000->cga); video_inform(VIDEO_FLAG_TYPE_CGA, &timing_t1000); diff --git a/src/video/vid_cga_toshiba_t3100e.c b/src/video/vid_cga_toshiba_t3100e.c index 25f0792049d..d8344426bdf 100644 --- a/src/video/vid_cga_toshiba_t3100e.c +++ b/src/video/vid_cga_toshiba_t3100e.c @@ -654,7 +654,7 @@ void * t3100e_init(UNUSED(const device_t *info)) { t3100e_t *t3100e = calloc(1, sizeof(t3100e_t)); - loadfont("roms/machines/t3100e/t3100e_font.bin", 5); + video_load_font("roms/machines/t3100e/t3100e_font.bin", FONT_FORMAT_TOSHIBA_3100E, LOAD_FONT_NO_OFFSET); cga_init(&t3100e->cga); video_inform(VIDEO_FLAG_TYPE_CGA, &timing_t3100e); diff --git a/src/video/vid_cga_v6355.c b/src/video/vid_cga_v6355.c index 1ddc1f2cd6e..f259f627794 100644 --- a/src/video/vid_cga_v6355.c +++ b/src/video/vid_cga_v6355.c @@ -924,13 +924,13 @@ v6355_standalone_init(const device_t *info) { switch(device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index 937623689a6..c17495c1e89 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -850,7 +850,7 @@ et4000_init(const device_t *info) et4000k_in, NULL, NULL, et4000k_out, NULL, NULL, dev); io_sethandler(0x32cb, 1, et4000k_in, NULL, NULL, et4000k_out, NULL, NULL, dev); - loadfont(KOREAN_FONT_ROM_PATH, 6); + video_load_font(KOREAN_FONT_ROM_PATH, FONT_FORMAT_KSC6501, LOAD_FONT_NO_OFFSET); fn = KOREAN_BIOS_ROM_PATH; break; @@ -884,7 +884,7 @@ et4000_init(const device_t *info) et4000_kasan_in, NULL, NULL, et4000_kasan_out, NULL, NULL, dev); io_sethandler(0x0258, 2, et4000_kasan_in, NULL, NULL, et4000_kasan_out, NULL, NULL, dev); - loadfont(KASAN_FONT_ROM_PATH, 6); + video_load_font(KASAN_FONT_ROM_PATH, FONT_FORMAT_KSC6501, LOAD_FONT_NO_OFFSET); fn = KASAN_BIOS_ROM_PATH; break; diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index 472217d3043..5dd3d2ade46 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -744,7 +744,7 @@ genius_init(UNUSED(const device_t *info)) /* 160k video RAM */ genius->vram = malloc(0x28000); - loadfont(BIOS_ROM_PATH, 4); + video_load_font(BIOS_ROM_PATH, FONT_FORMAT_MDSI_GENIUS, LOAD_FONT_NO_OFFSET); timer_add(&genius->timer, genius_poll, genius, 1); diff --git a/src/video/vid_hercules.c b/src/video/vid_hercules.c index 758b041af31..a53ea9871a0 100644 --- a/src/video/vid_hercules.c +++ b/src/video/vid_hercules.c @@ -542,19 +542,19 @@ hercules_init(UNUSED(const device_t *info)) switch(device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 2: - loadfont(FONT_KAM_PATH, 0); + video_load_font(FONT_KAM_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 3: - loadfont(FONT_KAMCL16_PATH, 0); + video_load_font(FONT_KAMCL16_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_hercules_incolor.c b/src/video/vid_hercules_incolor.c index b9be0765e99..e6acb9bbb80 100644 --- a/src/video/vid_hercules_incolor.c +++ b/src/video/vid_hercules_incolor.c @@ -994,19 +994,19 @@ incolor_init(UNUSED(const device_t *info)) switch(device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 2: - loadfont(FONT_KAM_PATH, 0); + video_load_font(FONT_KAM_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 3: - loadfont(FONT_KAMCL16_PATH, 0); + video_load_font(FONT_KAMCL16_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_hercules_plus.c b/src/video/vid_hercules_plus.c index 25b44ad70ee..f6eb2e9fb6d 100644 --- a/src/video/vid_hercules_plus.c +++ b/src/video/vid_hercules_plus.c @@ -631,19 +631,19 @@ herculesplus_init(UNUSED(const device_t *info)) switch(device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 2: - loadfont(FONT_KAM_PATH, 0); + video_load_font(FONT_KAM_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 3: - loadfont(FONT_KAMCL16_PATH, 0); + video_load_font(FONT_KAMCL16_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_im1024.c b/src/video/vid_im1024.c index 1ade8badbcc..b16855229a6 100644 --- a/src/video/vid_im1024.c +++ b/src/video/vid_im1024.c @@ -1036,7 +1036,7 @@ im1024_init(UNUSED(const device_t *info)) dev = (im1024_t *) malloc(sizeof(im1024_t)); memset(dev, 0x00, sizeof(im1024_t)); - loadfont(BIOS_ROM_PATH, 9); + video_load_font(BIOS_ROM_PATH, FONT_FORMAT_IM1024, LOAD_FONT_NO_OFFSET); dev->fifo_len = 4096; dev->fifo = (uint8_t *) malloc(dev->fifo_len); diff --git a/src/video/vid_jega.c b/src/video/vid_jega.c index d3c80670870..8a34b9f6181 100644 --- a/src/video/vid_jega.c +++ b/src/video/vid_jega.c @@ -686,7 +686,7 @@ readfontxtbl(fontx_tbl *table, int size, FILE *fp) } static int -LoadFontxFile(const char *fn, void *priv) +jega_load_font(const char *fn, void *priv) { fontx_h fhead; fontx_tbl *ftbl; @@ -793,7 +793,7 @@ jega_standalone_init(const device_t *info) rom_init(&jega->bios_rom, JEGA_PATH_BIOS, 0xc0000, 0x8000, 0x7fff, 0, 0); memset(&jega->jfont_dbcs_16, 0, DBCS16_FILESIZE); - LoadFontxFile(JEGA_PATH_FONTDBCS, jega); + jega_load_font(JEGA_PATH_FONTDBCS, jega); jega_commoninit(info, jega, 0); @@ -807,7 +807,7 @@ jvga_standalone_init(const device_t *info) rom_init(&jega->bios_rom, JVGA_PATH_BIOS, 0xc0000, 0x8000, 0x7fff, 0, 0); memset(&jega->jfont_dbcs_16, 0, DBCS16_FILESIZE); - LoadFontxFile(JVGA_PATH_FONTDBCS, jega); + jega_load_font(JVGA_PATH_FONTDBCS, jega); jega_commoninit(info, jega, 1); @@ -1024,7 +1024,7 @@ if386jega_init(const device_t *info) rom_init(&jega->bios_rom, IF386_PATH_VBIOS, 0xc0000, 0x8000, 0x7fff, 0, 0); memset(&jega->jfont_dbcs_16, 0, DBCS16_FILESIZE); - LoadFontxFile(JEGA_PATH_FONTDBCS, jega); + jega_load_font(JEGA_PATH_FONTDBCS, jega); jega_commoninit(info, jega, 0); diff --git a/src/video/vid_mda.c b/src/video/vid_mda.c index f530419f2d8..574e315506c 100644 --- a/src/video/vid_mda.c +++ b/src/video/vid_mda.c @@ -414,27 +414,27 @@ mda_init(mda_t *mda) void * mda_standalone_init(UNUSED(const device_t *info)) { - mda_t *mda = malloc(sizeof(mda_t)); - memset(mda, 0, sizeof(mda_t)); + mda_t *mda = calloc(1, sizeof(mda_t)); + video_inform(VIDEO_FLAG_TYPE_MDA, &timing_mda); - mda->vram = malloc(0x1000); + mda->vram = malloc(MDA_VRAM); switch (device_get_config_int("font")) { case 0: - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 1: - loadfont(FONT_IBM_MDA_437_NORDIC_PATH, 0); + video_load_font(FONT_IBM_MDA_437_NORDIC_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 2: - loadfont(FONT_KAM_PATH, 0); + video_load_font(FONT_KAM_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 3: - loadfont(FONT_KAMCL16_PATH, 0); + video_load_font(FONT_KAMCL16_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; case 4: - loadfont(FONT_TULIP_DGA_PATH, 0); + video_load_font(FONT_TULIP_DGA_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); break; } diff --git a/src/video/vid_ps55da2.c b/src/video/vid_ps55da2.c index a97d2aa84fb..3df73f92cea 100644 --- a/src/video/vid_ps55da2.c +++ b/src/video/vid_ps55da2.c @@ -3149,7 +3149,7 @@ da2_poll(void *priv) } static void -da2_loadfont(char *fname, void *priv) +da2_video_load_font(char *fname, void *priv) { da2_t *da2 = (da2_t *) priv; uint8_t buf; @@ -3267,10 +3267,10 @@ da2_init(UNUSED(const device_t *info)) da2->mmio.font = malloc(DA2_FONTROM_SIZE); switch (da2->mmio.charset) { case DA2_DCONFIG_CHARSET_HANT: - da2_loadfont(DA2_FONTROM_PATH_HANT, da2); + da2_video_load_font(DA2_FONTROM_PATH_HANT, da2); break; case DA2_DCONFIG_CHARSET_JPAN: - da2_loadfont(DA2_FONTROM_PATH_JPAN, da2); + da2_video_load_font(DA2_FONTROM_PATH_JPAN, da2); /* Add magic code for OS/2 J1.3. This disables BitBlt's text drawing function. */ da2->mmio.font[0x1AFFE] = 0x80; da2->mmio.font[0x1AFFF] = 0x01; diff --git a/src/video/vid_sigma.c b/src/video/vid_sigma.c index 4759bb7af09..d2c79b62e6e 100644 --- a/src/video/vid_sigma.c +++ b/src/video/vid_sigma.c @@ -794,7 +794,7 @@ sigma_init(UNUSED(const device_t *info)) sigma->enable_nmi = device_get_config_int("enable_nmi"); - loadfont(ROM_SIGMA_FONT, 7); + video_load_font(ROM_SIGMA_FONT, FONT_FORMAT_SIGMA, LOAD_FONT_NO_OFFSET); rom_init(&sigma->bios_rom, ROM_SIGMA_BIOS, bios_addr, 0x2000, 0x1FFF, 0, MEM_MAPPING_EXTERNAL); /* The BIOS ROM is overlaid by RAM, so remove its default mapping diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 504e3dd54a4..88cd6789e70 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -360,7 +360,7 @@ video_reset(int card) card, machine_has_flags(machine, MACHINE_VIDEO) ? 1 : 0); monitor_index_global = 0; - loadfont(FONT_IBM_MDA_437_PATH, 0); + video_load_font(FONT_IBM_MDA_437_PATH, FONT_FORMAT_MDA, LOAD_FONT_NO_OFFSET); for (uint8_t i = 1; i < GFXCARD_MAX; i ++) { if ((card != VID_NONE) && !machine_has_flags(machine, MACHINE_VIDEO_ONLY) && diff --git a/src/video/vid_wy700.c b/src/video/vid_wy700.c index bd9ba93862f..0245b7e3eec 100644 --- a/src/video/vid_wy700.c +++ b/src/video/vid_wy700.c @@ -886,7 +886,7 @@ wy700_init(UNUSED(const device_t *info)) /* 128k video RAM */ wy700->vram = malloc(0x20000); - loadfont("roms/video/wyse700/wy700.rom", 3); + video_load_font("roms/video/wyse700/wy700.rom", FONT_FORMAT_WY700, LOAD_FONT_NO_OFFSET); timer_add(&wy700->timer, wy700_poll, wy700, 1); diff --git a/src/video/video.c b/src/video/video.c index 81fe3a26b92..648e90c29c2 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -1005,10 +1005,18 @@ video_force_resize_set_monitor(uint8_t res, int monitor_index) } void -loadfont_common(FILE *fp, int format) +video_load_font(char *fn, int format, int offset) { + FILE *fp; + + fp = rom_fopen(fn, "rb"); + if (fp == NULL) + return; + + fseek(fp, offset, SEEK_SET); + switch (format) { - case 0: /* MDA */ + case FONT_FORMAT_MDA: /* MDA */ for (uint16_t c = 0; c < 256; c++) /* 8x14 MDA in 8x8 cell (lines 0-7) */ for (uint8_t d = 0; d < 8; d++) fontdatm[c][d] = fgetc(fp) & 0xff; @@ -1021,7 +1029,7 @@ loadfont_common(FILE *fp, int format) fontdat[c][d] = fgetc(fp) & 0xff; break; - case 1: /* PC200 */ + case FONT_FORMAT_PC200: /* PC200 */ for (uint8_t d = 0; d < 4; d++) { /* There are 4 fonts in the ROM */ for (uint16_t c = 0; c < 256; c++) /* 8x14 MDA in 8x16 cell */ @@ -1033,26 +1041,25 @@ loadfont_common(FILE *fp, int format) } break; - default: - case 2: /* CGA */ + case FONT_FORMAT_CGA: /* CGA */ for (uint16_t c = 0; c < 256; c++) for (uint8_t d = 0; d < 8; d++) fontdat[c][d] = fgetc(fp) & 0xff; break; - case 3: /* Wyse 700 */ + case FONT_FORMAT_WY700: /* Wyse 700 */ for (uint16_t c = 0; c < 512; c++) for (uint8_t d = 0; d < 32; d++) fontdatw[c][d] = fgetc(fp) & 0xff; break; - case 4: /* MDSI Genius */ + case FONT_FORMAT_MDSI_GENIUS: /* MDSI Genius */ for (uint16_t c = 0; c < 256; c++) for (uint8_t d = 0; d < 16; d++) fontdat8x12[c][d] = fgetc(fp) & 0xff; break; - case 5: /* Toshiba 3100e */ + case FONT_FORMAT_TOSHIBA_3100E: /* Toshiba 3100e */ for (uint16_t d = 0; d < 2048; d += 512) { /* Four languages... */ for (uint16_t c = d; c < d + 256; c++) { (void) !fread(&fontdatm[c][8], 1, 8, fp); @@ -1076,7 +1083,7 @@ loadfont_common(FILE *fp, int format) } break; - case 6: /* Korean KSC-5601 */ + case FONT_FORMAT_KSC6501: /* Korean KSC-5601 */ if (!fontdatksc5601) fontdatksc5601 = malloc(16384 * sizeof(dbcs_font_t)); @@ -1089,7 +1096,7 @@ loadfont_common(FILE *fp, int format) } break; - case 7: /* Sigma Color 400 */ + case FONT_FORMAT_SIGMA: /* Sigma Color 400 */ /* The first 4k of the character ROM holds an 8x8 font */ for (uint16_t c = 0; c < 256; c++) { (void) !fread(&fontdat[c][0], 1, 8, fp); @@ -1098,62 +1105,32 @@ loadfont_common(FILE *fp, int format) /* The second 4k holds an 8x16 font */ for (uint16_t c = 0; c < 256; c++) { if (fread(&fontdatm[c][0], 1, 16, fp) != 16) - fatal("loadfont(): Error reading 8x16 font in Sigma Color 400 mode, c = %i\n", c); + fatal("video_load_font(): Error reading 8x16 font in Sigma Color 400 mode, c = %i\n", c); } break; - case 8: /* Amstrad PC1512, Toshiba T1000/T1200 */ + case FONT_FORMAT_PC1512_T1000: /* Amstrad PC1512, Toshiba T1000/T1200 */ for (uint16_t c = 0; c < 2048; c++) /* Allow up to 2048 chars */ for (uint8_t d = 0; d < 8; d++) fontdat[c][d] = fgetc(fp) & 0xff; break; - case 9: /* Image Manager 1024 native font */ + case FONT_FORMAT_IM1024: /* Image Manager 1024 native font */ for (uint16_t c = 0; c < 256; c++) (void) !fread(&fontdat12x18[c][0], 1, 36, fp); break; - case 10: /* Pravetz */ + case FONT_FORMAT_PRAVETZ: /* Pravetz */ for (uint16_t c = 0; c < 1024; c++) /* Allow up to 1024 chars */ for (uint8_t d = 0; d < 8; d++) fontdat[c][d] = fgetc(fp) & 0xff; break; - case 11: /* PC200 */ - for (uint8_t d = 0; d < 4; d++) { - /* There are 4 fonts in the ROM */ - for (uint16_t c = 0; c < 256; c++) /* 8x14 MDA in 8x16 cell */ - (void) !fread(&fontdatm2[256 * d + c][0], 1, 16, fp); - for (uint16_t c = 0; c < 256; c++) { /* 8x8 CGA in 8x16 cell */ - (void) !fread(&fontdat2[256 * d + c][0], 1, 8, fp); - fseek(fp, 8, SEEK_CUR); - } - } - break; } (void) fclose(fp); } -void -loadfont_ex(char *fn, int format, int offset) -{ - FILE *fp; - - fp = rom_fopen(fn, "rb"); - if (fp == NULL) - return; - - fseek(fp, offset, SEEK_SET); - loadfont_common(fp, format); -} - -void -loadfont(char *fn, int format) -{ - loadfont_ex(fn, format, 0); -} - uint32_t video_color_transform(uint32_t color) { From 5e959e4b2e69b5af3404a7493eb2c43f62f94994 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 21 Dec 2025 19:12:28 +0000 Subject: [PATCH 122/320] remove fontdat2 and fontdatm2 --- src/include/86box/video.h | 2 -- src/video/video.c | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/include/86box/video.h b/src/include/86box/video.h index 8e418867729..b94bdf41548 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -217,8 +217,6 @@ extern int video_fullscreen; extern int video_fullscreen_scale; extern uint8_t fontdat[2048][8]; /* IBM CGA font */ extern uint8_t fontdatm[2048][16]; /* IBM MDA font */ -extern uint8_t fontdat2[2048][8]; /* IBM CGA 2nd instance font */ -extern uint8_t fontdatm2[2048][16]; /* IBM MDA 2nd instance font */ extern uint8_t fontdatw[512][32]; /* Wyse700 font */ extern uint8_t fontdat8x12[256][16]; /* MDSI Genius font */ extern uint8_t fontdat12x18[256][36]; /* IM1024 font */ diff --git a/src/video/video.c b/src/video/video.c index 648e90c29c2..af635687f13 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -79,8 +79,6 @@ uint8_t edatlookup[4][4]; uint8_t egaremap2bpp[256]; uint8_t fontdat[2048][8]; /* IBM CGA font */ uint8_t fontdatm[2048][16]; /* IBM MDA font */ -uint8_t fontdat2[2048][8]; /* IBM CGA 2nd instance font */ -uint8_t fontdatm2[2048][16]; /* IBM MDA 2nd instance font */ uint8_t fontdatw[512][32]; /* Wyse700 font */ uint8_t fontdat8x12[256][16]; /* MDSI Genius font */ uint8_t fontdat12x18[256][36]; /* IM1024 font */ From 56020b92f7990452e84828808d2f97548ed8f176 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 21 Dec 2025 19:31:35 +0000 Subject: [PATCH 123/320] remove obsolete (2012-era) comment --- src/video/video.c | 33 ++------------------------------- 1 file changed, 2 insertions(+), 31 deletions(-) diff --git a/src/video/video.c b/src/video/video.c index af635687f13..0d4ce0c97a6 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -8,37 +8,8 @@ * * Main video-rendering module. * - * Video timing settings - - * - * 8-bit - 1mb/sec - * B = 8 ISA clocks - * W = 16 ISA clocks - * L = 32 ISA clocks - * - * Slow 16-bit - 2mb/sec - * B = 6 ISA clocks - * W = 8 ISA clocks - * L = 16 ISA clocks - * - * Fast 16-bit - 4mb/sec - * B = 3 ISA clocks - * W = 3 ISA clocks - * L = 6 ISA clocks - * - * Slow VLB/PCI - 8mb/sec (ish) - * B = 4 bus clocks - * W = 8 bus clocks - * L = 16 bus clocks - * - * Mid VLB/PCI - - * B = 4 bus clocks - * W = 5 bus clocks - * L = 10 bus clocks - * - * Fast VLB/PCI - - * B = 3 bus clocks - * W = 3 bus clocks - * L = 4 bus clocks + * Video timings are set individually by the graphics cards. + * * * Authors: Sarah Walker, * Miran Grca, From e45fecf5f24bfc1a8d7cf99271986c45be71ec4d Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Sun, 21 Dec 2025 19:32:22 +0000 Subject: [PATCH 124/320] remove several more unused functions --- src/video/video.c | 24 ------------------------ 1 file changed, 24 deletions(-) diff --git a/src/video/video.c b/src/video/video.c index 0d4ce0c97a6..4c4256a8962 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -762,30 +762,6 @@ hline(bitmap_t *b, int x1, int y, int x2, uint32_t col) b->line[y][x] = col; } -void -blit(UNUSED(bitmap_t *src), UNUSED(bitmap_t *dst), UNUSED(int x1), UNUSED(int y1), UNUSED(int x2), UNUSED(int y2), UNUSED(int xs), UNUSED(int ys)) -{ - // -} - -void -stretch_blit(UNUSED(bitmap_t *src), UNUSED(bitmap_t *dst), UNUSED(int x1), UNUSED(int y1), UNUSED(int xs1), UNUSED(int ys1), UNUSED(int x2), UNUSED(int y2), UNUSED(int xs2), UNUSED(int ys2)) -{ - // -} - -void -rectfill(UNUSED(bitmap_t *b), UNUSED(int x1), UNUSED(int y1), UNUSED(int x2), UNUSED(int y2), UNUSED(uint32_t col)) -{ - // -} - -void -set_palette(UNUSED(PALETTE p)) -{ - // -} - void destroy_bitmap(bitmap_t *b) { From 988056bb3526a671d571328ec21fa4fbc506bd2c Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 21 Dec 2025 20:56:06 +0100 Subject: [PATCH 125/320] Bring back the Catalan translation (redone from scratch) and fix the Spanish translation. --- src/qt/languages/ca-ES.po | 3001 +++++++++++++++++++++++++++++++++ src/qt/languages/es-ES.po | 62 +- src/qt/qt_progsettings.cpp | 1 + src/qt/qt_translations.qrc.in | 1 + 4 files changed, 3034 insertions(+), 31 deletions(-) create mode 100644 src/qt/languages/ca-ES.po diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po new file mode 100644 index 00000000000..dabe5823316 --- /dev/null +++ b/src/qt/languages/ca-ES.po @@ -0,0 +1,3001 @@ +msgid "" +msgstr "" +"PO-Revision-Date: 2025-11-29 00:34+0000\n" +"Last-Translator: OBattler \n" +"Language-Team: Catalan \n" +"Language: ca-ES\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.12.2\n" +"X-Language: ca_ES\n" +"X-Source-Language: en_US\n" + +msgid "&Action" +msgstr "&Acció" + +msgid "&Keyboard requires capture" +msgstr "&Teclat requereix captura" + +msgid "&Right CTRL is left ALT" +msgstr "CTRL &dret és ALT esquerre" + +msgid "&Hard reset" +msgstr "&Reiniciació completa" + +msgid "&Ctrl+Alt+Del" +msgstr "&Ctrl+Alt+Del" + +msgid "Ctrl+Alt+&Esc" +msgstr "Ctrl+Alt+&Esc" + +msgid "&Pause" +msgstr "&Pausa" + +msgid "Pause" +msgstr "Pausa" + +msgid "Re&sume" +msgstr "Re&prendre" + +msgid "E&xit" +msgstr "&Sortir" + +msgid "&View" +msgstr "&Visualització" + +msgid "&Hide status bar" +msgstr "&Ocultar barra d'estat" + +msgid "Hide &toolbar" +msgstr "Ocultar &barra d'eines" + +msgid "&Resizeable window" +msgstr "Fi&nestra redimensionable" + +msgid "R&emember size && position" +msgstr "&Recordar grandària i posició" + +msgid "Remember size && position" +msgstr "Recordar grandària i posició" + +msgid "Re&nderer" +msgstr "Re&ndidor" + +msgid "&Qt (Software)" +msgstr "&Qt (Software)" + +msgid "Open&GL (3.0 Core)" +msgstr "Open&GL (3.0 Core)" + +msgid "&VNC" +msgstr "&VNC" + +msgid "Specify &dimensions…" +msgstr "E&specificar dimensions…" + +msgid "Force &4:3 display ratio" +msgstr "Forçar ràtio de visualització &4:3" + +msgid "&Window scale factor" +msgstr "&Factor de escalat de finestra" + +msgid "&0.5x" +msgstr "&0.5x" + +msgid "&1x" +msgstr "&1x" + +msgid "1.&5x" +msgstr "1.&5x" + +msgid "&2x" +msgstr "&2x" + +msgid "&3x" +msgstr "&3x" + +msgid "&4x" +msgstr "&4x" + +msgid "&5x" +msgstr "&5x" + +msgid "&6x" +msgstr "&6x" + +msgid "&7x" +msgstr "&7x" + +msgid "&8x" +msgstr "&8x" + +msgid "Fi<er method" +msgstr "&Mètode de filtració" + +msgid "&Nearest" +msgstr "&Més a prop" + +msgid "&Linear" +msgstr "&Lineal" + +msgid "Hi&DPI scaling" +msgstr "&Escalat alta densitat" + +msgid "&Fullscreen" +msgstr "&Pantalla sencera" + +msgid "Fullscreen &stretch mode" +msgstr "M&odalitat de estirament en la pantalla sencera" + +msgid "&Full screen stretch" +msgstr "&Estirament en la pantalla sencera" + +msgid "&4:3" +msgstr "&4:3" + +msgid "&Square pixels (Keep ratio)" +msgstr "&Píxels quadrats (Mantenir ràtio)" + +msgid "&Integer scale" +msgstr "&Escalat de valor enter" + +msgid "4:&3 Integer scale" +msgstr "Escalat de valor enter 4:&3" + +msgid "EGA/(S)&VGA settings" +msgstr "Configuracions EGA/(S)&VGA" + +msgid "&Inverted VGA monitor" +msgstr "&Monitor VGA invertit" + +msgid "VGA screen &type" +msgstr "&Tipus de pantalla VGA" + +msgid "RGB &Color" +msgstr "&Colors RGB" + +msgid "RGB (no brown)" +msgstr "RGB (sense marró)" + +msgid "&RGB Grayscale" +msgstr "&RGB en escala de grisos" + +msgid "Generic RGBI color monitor" +msgstr "Monitor RGBI genèric en colors" + +msgid "&Amber monitor" +msgstr "Monitor ambr&e" + +msgid "&Green monitor" +msgstr "Monitor &verd" + +msgid "&White monitor" +msgstr "Monitor &blanc" + +msgid "Grayscale &conversion type" +msgstr "Tipus de &conversió a l'escala de grisos" + +msgid "BT&601 (NTSC/PAL)" +msgstr "BT&601 (NTSC/PAL)" + +msgid "BT&709 (HDTV)" +msgstr "BT&709 (HDTV)" + +msgid "&Average" +msgstr "&Mitjà" + +msgid "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" +msgstr "Overscan de CGA/PCjr/Tandy/E&GA/(S)VGA" + +msgid "Change contrast for &monochrome display" +msgstr "Canviar contrast per a la pantalla &monocromàtica" + +msgid "&Media" +msgstr "&Mitjans" + +msgid "&Tools" +msgstr "&Eines" + +msgid "&Settings…" +msgstr "&Configuracions…" + +msgid "Settings…" +msgstr "Configuracions…" + +msgid "&Update status bar icons" +msgstr "&Actualitzar icones en barra d'estat" + +msgid "Take s&creenshot" +msgstr "Desar imatge de &pantalla" + +msgid "S&ound" +msgstr "S&o" + +msgid "&Preferences…" +msgstr "&Preferències…" + +msgid "Enable &Discord integration" +msgstr "Activar integració amb D&iscord" + +msgid "Sound &gain…" +msgstr "&Guany de so…" + +msgid "Begin trace" +msgstr "Iniciar el rastreig" + +msgid "End trace" +msgstr "Terminar el rastreig" + +msgid "&Help" +msgstr "Aj&uda" + +msgid "&Documentation…" +msgstr "&Documentació…" + +msgid "&About 86Box…" +msgstr "&Quant al 86Box…" + +msgid "&New image…" +msgstr "&Nova imatge…" + +msgid "&Existing image…" +msgstr "Imatge &existent…" + +msgid "Existing image (&Write-protected)…" +msgstr "Imatge existent (&Protegit d'escriptura)…" + +msgid "&Record" +msgstr "&Enregistrar" + +msgid "&Play" +msgstr "&Reproduir" + +msgid "&Rewind to the beginning" +msgstr "&Rebobinar al inici" + +msgid "&Fast forward to the end" +msgstr "&Avanç ràpid al final" + +msgid "E&ject" +msgstr "E&xpulsar" + +msgid "&Image…" +msgstr "&Imatge…" + +msgid "E&xport to 86F…" +msgstr "E&xportar a 86F…" + +msgid "&Mute" +msgstr "&Silenciar" + +msgid "E&mpty" +msgstr "&CDROM buit" + +msgid "Reload previous image" +msgstr "Recarregar imatge prèvia" + +msgid "&Folder…" +msgstr "&Carpeta…" + +msgid "Preferences" +msgstr "Preferències" + +msgid "Sound Gain" +msgstr "Guany de so" + +msgid "New Image" +msgstr "Nova imatge" + +msgid "Settings" +msgstr "Configuracions" + +msgid "Specify Main Window Dimensions" +msgstr "Especificar dimensions de la finestra principal" + +msgid "OK" +msgstr "D'acord" + +msgid "Cancel" +msgstr "Anuŀlació" + +msgid "&Default" +msgstr "&Per defecte" + +msgid "Language:" +msgstr "Idioma:" + +msgid "Gain" +msgstr "Guany" + +msgid "File name:" +msgstr "Nom de fitxer:" + +msgid "Disk size:" +msgstr "Grandària del disc:" + +msgid "RPM mode:" +msgstr "Modalitat RPM:" + +msgid "Progress:" +msgstr "Progrés:" + +msgid "Width:" +msgstr "Amplada:" + +msgid "Height:" +msgstr "Alçada:" + +msgid "Lock to this size" +msgstr "Fixar a aquesta grandària" + +msgid "Machine type:" +msgstr "Tipus de màquina:" + +msgid "Machine:" +msgstr "Màquina:" + +msgid "Configure" +msgstr "Configurar" + +msgid "CPU:" +msgstr "Processador:" + +msgid "CPU type:" +msgstr "Tipus del CPU:" + +msgid "Speed:" +msgstr "Velocitat:" + +msgid "Frequency:" +msgstr "Freqüència:" + +msgid "FPU:" +msgstr "FPU:" + +msgid "Wait states:" +msgstr "Estats de espera:" + +msgid "MB" +msgstr "MB" + +msgid "Memory:" +msgstr "Memòria:" + +msgid "Time synchronization" +msgstr "Sincronització de la hora" + +msgid "Disabled" +msgstr "Desactivat" + +msgid "Enabled (local time)" +msgstr "Activat (hora local)" + +msgid "Enabled (UTC)" +msgstr "Activat (UTC)" + +msgid "Dynamic Recompiler" +msgstr "Recompilador dinàmic" + +msgid "CPU frame size" +msgstr "Grandària de blocs del CPU" + +msgid "Larger frames (less smooth)" +msgstr "Blocs més grans (menys suau)" + +msgid "Smaller frames (smoother)" +msgstr "Blocs més petits (més suau)" + +msgid "Video:" +msgstr "Vídeo:" + +msgid "Video #2:" +msgstr "Vídeo 2:" + +msgid "Voodoo 1 or 2 Graphics" +msgstr "Gràfics Voodoo 1 o 2" + +msgid "IBM 8514/A Graphics" +msgstr "Gràfics IBM 8514/A" + +msgid "XGA Graphics" +msgstr "Gràfics XGA" + +msgid "IBM PS/55 Display Adapter Graphics" +msgstr "Adaptador de gràfics de pantalla IBM PS/55" + +msgid "Keyboard:" +msgstr "Teclat:" + +msgid "Keyboard" +msgstr "Teclat" + +msgid "Mouse:" +msgstr "Ratolí:" + +msgid "Mouse" +msgstr "Ratolí" + +msgid "Joystick:" +msgstr "Mando:" + +msgid "Joystick" +msgstr "Joystick" + +msgid "Joystick 1…" +msgstr "Joystick 1…" + +msgid "Joystick 2…" +msgstr "Joystick 2…" + +msgid "Joystick 3…" +msgstr "Joystick 3…" + +msgid "Joystick 4…" +msgstr "Joystick 4…" + +msgid "Sound card #1:" +msgstr "Targeta de so 1:" + +msgid "Sound card #2:" +msgstr "Targeta de so 2:" + +msgid "Sound card #3:" +msgstr "Targeta de so 3:" + +msgid "Sound card #4:" +msgstr "Targeta de so 4:" + +msgid "MIDI Out Device:" +msgstr "Dispositiu MIDI de sortida:" + +msgid "MIDI In Device:" +msgstr "Dispositiu MIDI de entrada:" + +msgid "MIDI Out:" +msgstr "Sortida MIDI:" + +msgid "Standalone MPU-401" +msgstr "MPU-401 independent" + +msgid "Use FLOAT32 sound" +msgstr "Utilitzar so FLOAT32" + +msgid "FM synth driver" +msgstr "Manejador de síntesi FM" + +msgid "Nuked (more accurate)" +msgstr "Nuked (més acurat)" + +msgid "YMFM (faster)" +msgstr "YMFM (més ràpid)" + +msgid "COM1 Device:" +msgstr "Dispositiu COM1:" + +msgid "COM2 Device:" +msgstr "Dispositiu COM2:" + +msgid "COM3 Device:" +msgstr "Dispositiu COM3:" + +msgid "COM4 Device:" +msgstr "Dispositiu COM4:" + +msgid "LPT1 Device:" +msgstr "Dispositiu LPT1:" + +msgid "LPT2 Device:" +msgstr "Dispositiu LPT2:" + +msgid "LPT3 Device:" +msgstr "Dispositiu LPT3:" + +msgid "LPT4 Device:" +msgstr "Dispositiu LPT4:" + +msgid "Internal LPT ECP DMA:" +msgstr "DMA de ECP del LPT intern:" + +msgid "Serial port 1" +msgstr "Port sèrie 1" + +msgid "Serial port 2" +msgstr "Port sèrie 2" + +msgid "Serial port 3" +msgstr "Port sèrie 3" + +msgid "Serial port 4" +msgstr "Port sèrie 4" + +msgid "Parallel port 1" +msgstr "Port paralel 1" + +msgid "Parallel port 2" +msgstr "Port paralel 2" + +msgid "Parallel port 3" +msgstr "Port paralel 3" + +msgid "Parallel port 4" +msgstr "Port paralel 4" + +msgid "Floppy disk controller:" +msgstr "Controlador de disquet:" + +msgid "CD-ROM controller:" +msgstr "Controlador de CD-ROM:" + +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Controlador IDE terciari" + +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Controlador IDE quaternari" + +msgid "Hard disk controllers" +msgstr "Controladors de disc dur" + +msgid "SCSI controllers" +msgstr "Controladors SCSI" + +msgid "Controller 1:" +msgstr "Controlador 1:" + +msgid "Controller 2:" +msgstr "Controlador 2:" + +msgid "Controller 3:" +msgstr "Controlador 3:" + +msgid "Controller 4:" +msgstr "Controlador 4:" + +msgid "Cassette" +msgstr "Casset" + +msgid "Hard disks:" +msgstr "Discs durs:" + +msgid "Firmware Version" +msgstr "Versió de firmware" + +msgid "&New…" +msgstr "&Nou…" + +msgid "&Existing…" +msgstr "&Existent…" + +msgid "&Remove" +msgstr "&Suprimir" + +msgid "Bus:" +msgstr "Bus:" + +msgid "Channel:" +msgstr "Canal:" + +msgid "ID:" +msgstr "ID:" + +msgid "Sectors:" +msgstr "Sectors:" + +msgid "Heads:" +msgstr "Cabeçals:" + +msgid "Cylinders:" +msgstr "Cilindres:" + +msgid "Size (MB):" +msgstr "Grandària (MB):" + +msgid "Type:" +msgstr "Tipus:" + +msgid "Image Format:" +msgstr "Format de imatge:" + +msgid "Block Size:" +msgstr "Grandària de bloc:" + +msgid "Floppy drives:" +msgstr "Unitats de disquet:" + +msgid "Turbo timings" +msgstr "Velocitat turbo" + +msgid "Check BPB" +msgstr "Verificar BPB" + +msgid "CD-ROM drives:" +msgstr "Unitats de CD-ROM:" + +msgid "MO drives:" +msgstr "Unitats MO:" + +msgid "MO:" +msgstr "MO:" + +msgid "Removable disks:" +msgstr "Discs extraïbles:" + +msgid "Removable disk drives:" +msgstr "Unitats de disc extraïble:" + +msgid "ZIP 250" +msgstr "ZIP 250" + +msgid "ISA RTC:" +msgstr "ISA RTC:" + +msgid "ISA Memory Expansion" +msgstr "Expansió de memòria ISA" + +msgid "ISA ROM Cards" +msgstr "Targetas ROM ISA" + +msgid "Card 1:" +msgstr "Targeta 1:" + +msgid "Card 2:" +msgstr "Targeta 2:" + +msgid "Card 3:" +msgstr "Targeta 3:" + +msgid "Card 4:" +msgstr "Targeta 4:" + +msgid "Generic ISA ROM Board" +msgstr "Targeta ROM ISA genèrica" + +msgid "Generic Dual ISA ROM Board" +msgstr "Targeta ROM ISA genèrica doble" + +msgid "Generic Quad ISA ROM Board" +msgstr "Targeta ROM ISA genèrica quàdruple" + +msgid "ISABugger device" +msgstr "Dispositiu ISABugger" + +msgid "POST card" +msgstr "Targeta POST" + +msgid "Error" +msgstr "Error" + +msgid "Fatal error" +msgstr "Error fatal" + +msgid " - PAUSED" +msgstr " - EN PAUSA" + +msgid "Speed" +msgstr "Velocitat" + +msgid "Removable disk %1 (%2): %3" +msgstr "Disc extraïble %1 (%2): %3" + +msgid "&Removable disk %1 (%2): %3" +msgstr "&Disc extraïble %1 (%2): %3" + +msgid "Removable disk images" +msgstr "Imatges de disc extraïble" + +msgid "Image %1" +msgstr "Imatge %1" + +msgid "86Box could not find any usable ROM images.\n\nPlease
download a ROM set and extract it into the \"roms\" directory." +msgstr "El 86Box no ha pogut trobar cap de imatge ROM utilitzable.\n\nSi us plau, descarregueu un conjunt de ROMs i extraieu-lo al directori \"roms\"." + +msgid "(empty)" +msgstr "(buit)" + +msgid "All files" +msgstr "Tots els fitxers" + +msgid "Turbo" +msgstr "Turbo" + +msgid "On" +msgstr "Activat" + +msgid "Off" +msgstr "Desactivat" + +msgid "All images" +msgstr "Totes les imatges" + +msgid "Basic sector images" +msgstr "Imatges bàsiques de sector" + +msgid "Surface images" +msgstr "Imatges de superfície" + +msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." +msgstr "La màquina \"%hs\" no està disponible a causa dels ROMs faltants en el directori roms/machines. Canviant a una màquina disponible." + +msgid "Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card." +msgstr "La tarjeta de vídeo \"%hs\" no està disponible a causa dels ROMs faltants en el directori roms/video. Canviant a una tarjeta de video disponible." + +msgid "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card." +msgstr "La tarjeta de vídeo 2 \"%hs\" no està disponible a causa dels ROMs faltants en el directori roms/video. Desactivnt a la segona targeta de vídeo." + +msgid "Device \"%hs\" is not available due to missing ROMs. Ignoring the device." +msgstr "El dispositiu \"%hs\" no està disponible a causa dels ROMs faltants. Ignorant el dispositiu." + +msgid "Machine" +msgstr "Màquina" + +msgid "Display" +msgstr "Vídeo" + +msgid "Input devices" +msgstr "Dispositius de entrada" + +msgid "Sound" +msgstr "So" + +msgid "Network" +msgstr "Xarxa" + +msgid "Ports (COM & LPT)" +msgstr "Ports (COM i LPT)" + +msgid "Ports" +msgstr "Ports" + +msgid "Serial ports:" +msgstr "Ports sèrie:" + +msgid "Parallel ports:" +msgstr "Puerts paralels:" + +msgid "Storage controllers" +msgstr "Controladors de emmagatzematge" + +msgid "Hard disks" +msgstr "Discs durs" + +msgid "Disks:" +msgstr "Discs:" + +msgid "Floppy:" +msgstr "Disquet:" + +msgid "Controllers:" +msgstr "Controladors:" + +msgid "Floppy & CD-ROM drives" +msgstr "Disquets i unitates de CD-ROM" + +msgid "Other removable devices" +msgstr "Altres dispositius extraïbles" + +msgid "Other peripherals" +msgstr "Altres perifèrics" + +msgid "Other devices" +msgstr "Altres dispositius" + +msgid "Click to capture mouse" +msgstr "Feu clic per capturar el ratolí" + +msgid "Press %1 to release mouse" +msgstr "Premeu %1 per soltar el ratolí" + +msgid "Press %1 or middle button to release mouse" +msgstr "Premeu %1 o bé el botó central per soltar el ratolí" + +msgid "Bus" +msgstr "Bus" + +msgid "File" +msgstr "Fitxer" + +msgid "C" +msgstr "C" + +msgid "H" +msgstr "H" + +msgid "S" +msgstr "S" + +msgid "KB" +msgstr "KB" + +msgid "Default" +msgstr "Per defecte" + +msgid "%1 Wait state(s)" +msgstr "%1 estat(s) de espera" + +msgid "Type" +msgstr "Tipus" + +msgid "No PCap devices found" +msgstr "No se trobaren dispositius PCap" + +msgid "Invalid PCap device" +msgstr "Dispositiu PCap invàlid" + +msgid "Generic paddle controller(s)" +msgstr "Controlador(s) de rem genèric(s)" + +msgid "2-axis, 1-button joystick(s)" +msgstr "Joystick(s) de 2 eixos, 1 botons" + +msgid "2-axis, 2-button joystick(s)" +msgstr "Joystick(s) de 2 eixos, 2 botons" + +msgid "2-axis, 3-button joystick" +msgstr "Joystick de 2 eixos, 3 botons" + +msgid "2-axis, 4-button joystick" +msgstr "Joystick de 2 eixos, 4 botons" + +msgid "2-axis, 6-button joystick" +msgstr "Joystick de 2 eixos, 6 botons" + +msgid "2-axis, 8-button joystick" +msgstr "Joystick de 2 eixos, 8 botons" + +msgid "3-axis, 2-button joystick" +msgstr "Joystick de 3 eixos, 2 botons" + +msgid "3-axis, 3-button joystick" +msgstr "Joystick de 3 eixos, 3 botons" + +msgid "3-axis, 4-button joystick" +msgstr "Joystick de 3 eixos, 4 botons" + +msgid "4-axis, 2-button joystick" +msgstr "Joystick de 4 eixos, 2 botons" + +msgid "4-axis, 3-button joystick" +msgstr "Joystick de 4 eixos, 3 botons" + +msgid "4-axis, 4-button joystick" +msgstr "Joystick de 4 eixos, 4 botons" + +msgid "2-button gamepad(s)" +msgstr "Maneta(s) de joc de 2 botons" + +msgid "3-button gamepad" +msgstr "Maneta de joc de 3 botons" + +msgid "4-button gamepad" +msgstr "Maneta de joc de 4 botons" + +msgid "6-button gamepad" +msgstr "Maneta de joc de 6 botons" + +msgid "2-button flight yoke" +msgstr "Volant d'avió de 2 botons" + +msgid "3-button flight yoke" +msgstr "Volant d'avió de 3 botons" + +msgid "4-button flight yoke" +msgstr "Volant d'avió de 4 botons" + +msgid "2-button flight yoke with throttle" +msgstr "Volant d'avió de 2 botones amb accelerador" + +msgid "3-button flight yoke with throttle" +msgstr "Volant d'avió de 3 botones amb accelerador" + +msgid "4-button flight yoke with throttle" +msgstr "Volant d'avió de 4 botones amb accelerador" + +msgid "Steering wheel (3-axis, 2-button)" +msgstr "Volant (de 3 eixos, 2 botons)" + +msgid "Steering wheel (3-axis, 3-button)" +msgstr "Volant (de 3 eixos, 3 botons)" + +msgid "Steering wheel (3-axis, 4-button)" +msgstr "Volant (de 3 eixos, 4 botons)" + +msgid "Thrustmaster Formula T1/T2 with adapter" +msgstr "Thrustmaster Formula T1/T2 amb adaptador" + +msgid "Thrustmaster Formula T1/T2 without adapter" +msgstr "Thrustmaster Formula T1/T2 sense adaptador" + +msgid "None" +msgstr "Cap" + +msgid "%1 MB (CHS: %2, %3, %4)" +msgstr "%1 MB (CHS: %2, %3, %4)" + +msgid "Floppy %1 (%2): %3" +msgstr "Disquet %1 (%2): %3" + +msgid "&Floppy %1 (%2): %3" +msgstr "&Disquet %1 (%2): %3" + +msgid "Advanced sector images" +msgstr "Imatges avançades de sector" + +msgid "Flux images" +msgstr "Imatges de fluix" + +msgid "Are you sure you want to hard reset the emulated machine?" +msgstr "Segur que voleu fer una reinicialització completa de la màquina emulada?" + +msgid "Are you sure you want to exit 86Box?" +msgstr "Segur que voleu tancar al 86Box?" + +msgid "Unable to initialize Ghostscript" +msgstr "No fou possible inicialitzar el Ghostscript" + +msgid "Unable to initialize GhostPCL" +msgstr "No fou possible inicialitzar el GhostPCL" + +msgid "MO %1 (%2): %3" +msgstr "MO %1 (%2): %3" + +msgid "&MO %1 (%2): %3" +msgstr "&MO %1 (%2): %3" + +msgid "MO images" +msgstr "Imatges de MO" + +msgid "Welcome to 86Box!" +msgstr "Benvinguts al 86Box!" + +msgid "Internal device" +msgstr "Dispositiu intern" + +msgid "&File" +msgstr "&Fitxer" + +msgid "&New machine…" +msgstr "&Nova màquina…" + +msgid "New machine…" +msgstr "Nova màquina…" + +msgid "New machine" +msgstr "Nova màquina" + +msgid "&Check for updates…" +msgstr "&Verifica actualitzacions…" + +msgid "Exit" +msgstr "Sortir" + +msgid "No ROMs found" +msgstr "No se trobaren ROMs" + +msgid "Do you want to save the settings?" +msgstr "Voleu desar les configuracions?" + +msgid "This will hard reset the emulated machine." +msgstr "Això causarà una reinicialització completa de la màquina emulada." + +msgid "Save" +msgstr "Desar" + +msgid "About %1" +msgstr "Quant al %1" + +msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." +msgstr "Un emulador de ordinadors anticos\n\nAutors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, y otros.\n\nAmb contribucions anteriors de Sarah Walker, leilei, JohnElliott, greatpsycho y otros.\n\nPublicat sota la GNU General Public License versió 2 o bé posterior. Veieu LICENSE per més informacions." + +msgid "Hardware not available" +msgstr "Equip no disponible" + +msgid "Make sure %1 is installed and that you are on a %1-compatible network connection." +msgstr "Assegureu-vos de que %1 està instalat i de que esteu en una connexió de xarxa compatible amb %1." + +msgid "Invalid configuration" +msgstr "Configuració invàlida" + +msgid "%1 is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." +msgstr "%1 és imprescindible per la conversió automàtica de fitxers PostScript a PDF.\n\nQualsevol document enviat a la impressora genèrica PostScript se desarà com ara fitxer PostScript (.ps)." + +msgid "%1 is required for automatic conversion of PCL files to PDF.\n\nAny documents sent to the generic PCL printer will be saved as Printer Command Language (.pcl) files." +msgstr "%1 és imprescindible per la conversió automàtica de fitxers PCL a PDF.\n\nQualsevol document enviat a la impressora genèrica PCL se desarà com ara fitxer Printer Command Language (.pcl)." + +msgid "Don't show this message again" +msgstr "No tornar a mostrar aquest missatge" + +msgid "Don't exit" +msgstr "No sortir" + +msgid "Reset" +msgstr "Reinicialitzar" + +msgid "Don't reset" +msgstr "No reinicialitzar" + +msgid "CD-ROM images" +msgstr "Imatges de CD-ROM" + +msgid "%1 Device Configuration" +msgstr "Configuració de dispositiu %1" + +msgid "Monitor in sleep mode" +msgstr "Monitor en modalitat de dormida" + +msgid "GLSL shaders" +msgstr "Shaders GLSL" + +msgid "You are loading an unsupported configuration" +msgstr "Esteu carregant una configuració no suportada" + +msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." +msgstr "La filtració de tipus CPU basat en màquina seleccionada està desactivat per a aquesta màquina.\n\nAixò fa possible seleccionar una CPU que sigui incompatible amb aquesta màquina. Tanmateix, poden aparèixerr incompatibilitats amb la BIOS de la màquina o altres programes.\n\nActivar esta configuració no està oficialment suportat i qualsevol report de error pot ésser tancat com ara invàlid." + +msgid "Continue" +msgstr "Continuar" + +msgid "Cassette: %1" +msgstr "Casset: %1" + +msgid "C&assette: %1" +msgstr "C&asset: %1" + +msgid "Cassette images" +msgstr "Imatges de casset" + +msgid "Cartridge %1: %2" +msgstr "Cartutx %1: %2" + +msgid "Car&tridge %1: %2" +msgstr "Car&tutx %1: %2" + +msgid "Cartridge images" +msgstr "Imatges de cartutx" + +msgid "Resume execution" +msgstr "Reprendre la execució" + +msgid "Pause execution" +msgstr "Metre en pausa la execució" + +msgid "Ctrl+Alt+Del" +msgstr "Ctrl+Alt+Del" + +msgid "Press Ctrl+Alt+Del" +msgstr "Prémer Ctrl+Alt+Supr" + +msgid "Press Ctrl+Alt+Esc" +msgstr "Prémer Ctrl+Alt+Esc" + +msgid "Hard reset" +msgstr "Reiniciació completa" + +msgid "Force shutdown" +msgstr "Apagada forçada" + +msgid "Start" +msgstr "Iniciar" + +msgid "&Force shutdown" +msgstr "&Apagada forçada" + +msgid "&Start" +msgstr "&Iniciar" + +msgid "Not running" +msgstr "No en execució" + +msgid "Running" +msgstr "En exeució" + +msgid "Paused" +msgstr "En pausa" + +msgid "Waiting" +msgstr "En espera" + +msgid "Powered Off" +msgstr "Apagat" + +msgid "%n running" +msgstr "%n en execució" + +msgid "%n paused" +msgstr "%n en pausa" + +msgid "%n waiting" +msgstr "%n en espera" + +msgid "%1 total" +msgstr "%1 total" + +msgid "VMs: %1" +msgstr "MV: %1" + +msgid "System Directory:" +msgstr "Directori de sistema:" + +msgid "Choose directory" +msgstr "Escollir directori" + +msgid "Choose configuration file" +msgstr "Escollir fitxer de configuració" + +msgid "86Box configuration files (86box.cfg)" +msgstr "Fitxers de configuració de 86Box (86box.cfg)" + +msgid "Configuration read failed" +msgstr "Error en llegir la configuració" + +msgid "Unable to open the selected configuration file for reading: %1" +msgstr "No fou possible obrir el fitxer de configuració seleccionat per llegir: %1" + +msgid "Use regular expressions in search box" +msgstr "Utilitzar expressions regulars en la caixa de cerca" + +msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%1 màquina(es) són actives en aquest moment. Segur que voleu sortir del administrador de MV?" + +msgid "Add new system wizard" +msgstr "Auxiliar d'addició de un nou sistema" + +msgid "Introduction" +msgstr "Introducció" + +msgid "This will help you add a new system to 86Box." +msgstr "Aquest us ajudará a afegir un nou sistema al 86Box." + +msgid "New configuration" +msgstr "Nova configuració" + +msgid "Complete" +msgstr "Completar" + +msgid "The wizard will now launch the configuration for the new system." +msgstr "L'auxiliar ara executarà la configuració pel nou sistema." + +msgid "Use existing configuration" +msgstr "Utilitzar configuració existent" + +msgid "Type some notes here" +msgstr "Escriure algunes notes aquí" + +msgid "Paste the contents of the existing configuration file into the box below." +msgstr "Enganxar el contingut del fitxer de configuració existent en la caixa que de sota." + +msgid "Load configuration from file" +msgstr "Carregar la configuració a partir d'un fitxer" + +msgid "System name" +msgstr "Nomb del sistema" + +msgid "System name:" +msgstr "Nom del sistema:" + +msgid "System name cannot contain certain characters" +msgstr "El nom del sistema no pot contenir alguns caràcters" + +msgid "System name already exists" +msgstr "El nom del sistema ja existeix" + +msgid "Please enter a directory for the system" +msgstr "Si us plau, escriviu un directori per el sistema" + +msgid "Directory does not exist" +msgstr "El directori no existeix" + +msgid "A new directory for the system will be created in the selected directory above" +msgstr "Un nou directour per el sistema serà criat en el directori escollit a dalt" + +msgid "System location:" +msgstr "Ubicació del sistema:" + +msgid "System name and location" +msgstr "Nom i ubicació del sistema" + +msgid "Enter the name of the system and choose the location" +msgstr "Escriviu el nom del sistema i escolliu la ubicació" + +msgid "Enter the name of the system" +msgstr "Escriviu el nome del sistema" + +msgid "Please enter a system name" +msgstr "Si us plau, escriviu un nom del sistema" + +msgid "Display name (optional):" +msgstr "Nom mostrat (optatiu):" + +msgid "Display name:" +msgstr "Nom mostrat:" + +msgid "Set display name" +msgstr "Establir nom mostrat" + +msgid "Enter the new display name (blank to reset)" +msgstr "Escriviu el nou nom mostrat (buit per restablir)" + +msgid "Change &display name…" +msgstr "Canviar nom &mostrat…" + +msgid "Context Menu" +msgstr "Menú de context" + +msgid "&Open folder…" +msgstr "&Obrir carpeta…" + +msgid "Open p&rinter tray…" +msgstr "Obrir safata de la &impressora…" + +msgid "Set &icon…" +msgstr "Establir &icona…" + +msgid "Select an icon" +msgstr "Escollir una icona" + +msgid "C&lone…" +msgstr "C&lonar…" + +msgid "Virtual machine \"%1\" (%2) will be cloned into:" +msgstr "La màquina virtual \"%1\" (%2) serà clonada a:" + +msgid "Directory %1 already exists" +msgstr "El directori %1 ja existeix" + +msgid "You cannot use the following characters in the name: %1" +msgstr "No es pot utilitzar els seguints caràcters en el nom: %1" + +msgid "Clone" +msgstr "Clonar" + +msgid "Failed to create directory for cloned VM" +msgstr "Error en criar el directori per la MV clonada" + +msgid "Failed to clone VM." +msgstr "Error en clonar la VM." + +msgid "Directory in use" +msgstr "Directori en ús" + +msgid "The selected directory is already in use. Please select a different directory." +msgstr "El directori escollit ja està en ùs. Si us plau, escolliu un altre directori." + +msgid "Create directory failed" +msgstr "Error en criar el directori" + +msgid "Unable to create the directory for the new system" +msgstr "No fou possible criar el directori pel nou sistema" + +msgid "Configuration write failed" +msgstr "Error en escriure la configuració" + +msgid "Unable to open the configuration file at %1 for writing" +msgstr "No fou possible obrir el fitxer de configuració en %1 per escriure" + +msgid "Error adding system" +msgstr "Error en afegir el sistema" + +msgid "Remove directory failed" +msgstr "Error en suprimir el directori" + +msgid "Some files in the machine's directory were unable to be deleted. Please delete them manually." +msgstr "No fou possible suprimir alguns fitxers en el directori de la màquina. Si us plau, suprimiu-los manualment." + +msgid "Build" +msgstr "Compilació" + +msgid "Version" +msgstr "Versió" + +msgid "An update to 86Box is available: %1 %2" +msgstr "Està disponible una actualització pel 86Box: %1 %2" + +msgid "An error has occurred while checking for updates: %1" +msgstr "S'ha produït un error en verificar les actualitzacions: %1" + +msgid "An update to 86Box is available!" +msgstr "Una actualització pel 86Box està disponible!" + +msgid "Warning" +msgstr "Compte" + +msgid "&Kill" +msgstr "&Terminar forçadament" + +msgid "Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?" +msgstr "Terminar forçadament a la màquina virtual pot causar la pèrdua de dades. Només ho feu si el procés del 86Box es blocà.\n\n¿De verdad quiere terminar forzadamente a la máquina virtual \"%1\"?" + +msgid "&Delete" +msgstr "&Suprimir" + +msgid "Do you really want to delete the virtual machine \"%1\" and all its files? This action cannot be undone!" +msgstr "Realment voleu suprimir la màquina virtual \"%1\" i tots seus fitxers? Aquesta acció no se pot desfer!" + +msgid "Show &config file" +msgstr "Mostrar fitxer de &configuració" + +msgid "No screenshot" +msgstr "Sense captura de pantalla" + +msgid "Search" +msgstr "Cercar" + +msgid "Searching for VMs…" +msgstr "Cercar per MV…" + +msgid "Found %1" +msgstr "%1 trobada" + +msgid "System" +msgstr "Sistema" + +msgid "Storage" +msgstr "Emmagatzematge" + +msgid "Disk %1:" +msgstr "Disc %1:" + +msgid "No disks" +msgstr "Sense disc" + +msgid "Audio" +msgstr "So" + +msgid "Audio:" +msgstr "So:" + +msgid "ACPI shutdown" +msgstr "Apagada ACPI" + +msgid "ACP&I shutdown" +msgstr "Apagada ACP&I" + +msgid "Hard disk (%1)" +msgstr "Disc dur (%1)" + +msgid "MFM/RLL or ESDI CD-ROM drives never existed" +msgstr "Mai existiren unitats de CD-ROM MFM/RLL o bé ESDI" + +msgid "Custom…" +msgstr "Personalitzada…" + +msgid "Custom (large)…" +msgstr "Personalitzada (gran)…" + +msgid "Add New Hard Disk" +msgstr "Afegir nou disc dur" + +msgid "Add Existing Hard Disk" +msgstr "Afegir disc dur existent" + +msgid "HDI disk images cannot be larger than 4 GB." +msgstr "Les imatges de disc HDI no poden superar els 4 GB." + +msgid "Disk images cannot be larger than 127 GB." +msgstr "Les imatges de disc no poden superar els 127 GB." + +msgid "Hard disk images" +msgstr "Imatges de disc dur" + +msgid "Unable to read file" +msgstr "No es pogué llegir el fitxer" + +msgid "Unable to write file" +msgstr "No es pogué escriure el fitxer" + +msgid "HDI or HDX images with a sector size other than 512 are not supported." +msgstr "No es suporten les imatges HDI o bé HDX amb una grandària de sector diferent a 512." + +msgid "Disk image file already exists" +msgstr "La imatge de disc ja existeix" + +msgid "Please specify a valid file name." +msgstr "Si us plau especifiqueu un nomb de fitxer vàlid." + +msgid "Disk image created" +msgstr "Imatge de disc criada" + +msgid "Make sure the file exists and is readable." +msgstr "Assegureu-vos que el fitxer existeix i és llegible." + +msgid "Make sure the file is being saved to a writable directory." +msgstr "Assegureu-vos que el fitxer es està desant a un directori amb permís de escirptura." + +msgid "Disk image too large" +msgstr "Imatge de disc massa gran" + +msgid "Remember to partition and format the newly-created drive." +msgstr "Recordeu de particionar i formatar la nova unitat." + +msgid "The selected file will be overwritten. Are you sure you want to use it?" +msgstr "El fitxer escollit serà sobreescrit. Segur que voleu utilitzar-lo?" + +msgid "Unsupported disk image" +msgstr "Imatge de disc no suportada" + +msgid "Overwrite" +msgstr "Sobreescriure" + +msgid "Don't overwrite" +msgstr "No sobreescriure" + +msgid "Raw image" +msgstr "Imatge en brut" + +msgid "HDI image" +msgstr "Imatge HDI" + +msgid "HDX image" +msgstr "Imatge HDX" + +msgid "Fixed-size VHD" +msgstr "VHD de grandària fixa" + +msgid "Dynamic-size VHD" +msgstr "VHD de grandària dinàmica" + +msgid "Differencing VHD" +msgstr "VHD diferencial" + +msgid "(N/A)" +msgstr "(Cap)" + +msgid "Raw image (.img)" +msgstr "Imatge en brut (.img)" + +msgid "HDI image (.hdi)" +msgstr "Imatge HDI (.hdi)" + +msgid "HDX image (.hdx)" +msgstr "Imatge HDX (.hdx)" + +msgid "Fixed-size VHD (.vhd)" +msgstr "VHD de grandària fixa (.vhd)" + +msgid "Dynamic-size VHD (.vhd)" +msgstr "VHD de grandària dinàmica (.vhd)" + +msgid "Differencing VHD (.vhd)" +msgstr "VHD diferencial (.vhd)" + +msgid "Large blocks (2 MB)" +msgstr "Blocs grans (2 MB)" + +msgid "Small blocks (512 KB)" +msgstr "Blocs petits (512 KB)" + +msgid "VHD files" +msgstr "Fitxers VHD" + +msgid "Select the parent VHD" +msgstr "Escolliu el VHD pare" + +msgid "This could mean that the parent image was modified after the differencing image was created.\n\nIt can also happen if the image files were moved or copied, or by a bug in the program that created this disk.\n\nDo you want to fix the timestamps?" +msgstr "Això podria significar que la imatge pare es va modificar després de que es creés la imatge diferencial.\n\nTambé pot passar si les imatges foren mogudes o copiades, o a causa d'un error en el programa que crià aquest disc.\n\nVoleu corregir els registres de temps?" + +msgid "Parent and child disk timestamps do not match" +msgstr "Els segells de temps del pare e fill no coincideixen" + +msgid "Could not fix VHD timestamp." +msgstr "No fou possible corregir el segell de temps del VHD." + +msgid "CD-ROM %1 (%2): %3" +msgstr "CD-ROM %1 (%2): %3" + +msgid "&CD-ROM %1 (%2): %3" +msgstr "&CD-ROM %1 (%2): %3" + +msgid "160 KB" +msgstr "160 KB" + +msgid "180 KB" +msgstr "180 KB" + +msgid "320 KB" +msgstr "320 KB" + +msgid "360 KB" +msgstr "360 KB" + +msgid "640 KB" +msgstr "640 KB" + +msgid "720 KB" +msgstr "720 KB" + +msgid "1.2 MB" +msgstr "1.2 MB" + +msgid "1.25 MB" +msgstr "1.25 MB" + +msgid "1.44 MB" +msgstr "1.44 MB" + +msgid "DMF (cluster 1024)" +msgstr "DMF (clúster 1024)" + +msgid "DMF (cluster 2048)" +msgstr "DMF (clúster 2048)" + +msgid "2.88 MB" +msgstr "2.88 MB" + +msgid "ZIP 100" +msgstr "ZIP 100" + +msgid "3.5\" 128 MB (ISO 10090)" +msgstr "3.5\" 128 MB (ISO 10090)" + +msgid "3.5\" 230 MB (ISO 13963)" +msgstr "3.5\" 230 MB (ISO 13963)" + +msgid "3.5\" 540 MB (ISO 15498)" +msgstr "3.5\" 540 MB (ISO 15498)" + +msgid "3.5\" 640 MB (ISO 15498)" +msgstr "3.5\" 640 MB (ISO 15498)" + +msgid "3.5\" 1.3 GB (GigaMO)" +msgstr "3.5\" 1.3 GB (GigaMO)" + +msgid "3.5\" 2.3 GB (GigaMO 2)" +msgstr "3.5\" 2.3 GB (GigaMO 2)" + +msgid "5.25\" 600 MB" +msgstr "5.25\" 600 MB" + +msgid "5.25\" 650 MB" +msgstr "5.25\" 650 MB" + +msgid "5.25\" 1 GB" +msgstr "5.25\" 1 GB" + +msgid "5.25\" 1.3 GB" +msgstr "5.25\" 1.3 GB" + +msgid "Perfect RPM" +msgstr "RPM perfectes" + +msgid "1% below perfect RPM" +msgstr "1% por sota dels RPM perfectes" + +msgid "1.5% below perfect RPM" +msgstr "1.5% por sota dels RPM perfectes" + +msgid "2% below perfect RPM" +msgstr "2% por sota dels RPM perfectes" + +msgid "(System Default)" +msgstr "(Per defecte del sistema)" + +msgid "Failed to initialize network driver" +msgstr "No fou possible iniciaitzar el controlador de xarxa" + +msgid "The network configuration will be switched to the null driver" +msgstr "La configuració de xarxa es canviarà al controlador nul" + +msgid "Mouse sensitivity:" +msgstr "Sensitivitat del ratón:" + +msgid "Select media images from program working directory" +msgstr "Escollir imatges de mitjans del directori de treball del programa" + +msgid "PIT mode:" +msgstr "Modalitat PIT:" + +msgid "Auto" +msgstr "Automàtica" + +msgid "Slow" +msgstr "Lenta" + +msgid "Fast" +msgstr "Ráàida" + +msgid "&Auto-pause on focus loss" +msgstr "Pa&usa automàtica en perdre el focus" + +msgid "WinBox is no longer supported" +msgstr "El WinBox no és més suportat" + +msgid "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behavior will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." +msgstr "El desenvolupament del administrador WinBox s'ha aturat en 2022 per la manca de mantenidors. Com ara dirigim els nostres esforços a fer 86Box encara millor, hem pres la decisió de no més suportar el WinBox com ara administrador.\n\nNo es proporcionaran més actualitzacions a través del WinBox, i podeu trobar un comportament incorrecte si continua en utilitzar-lo amb versions más noves del 86Box. Qualsevol report de error relacionat amb el comportament del WinBox serà tancat com ara invàlid.\n\nAneu a 86box.net per a una llista de altres administradors que podeu utilitzar." + +msgid "Generate" +msgstr "Generar" + +msgid "Joystick configuration" +msgstr "Configuració del joystick" + +msgid "Device" +msgstr "Dispositiu" + +msgid "%1 (X axis)" +msgstr "%1 (eix X)" + +msgid "%1 (Y axis)" +msgstr "%1 (eix Y)" + +msgid "MCA devices" +msgstr "Dispositius MCA" + +msgid "List of MCA devices:" +msgstr "Llista de dispositius MCA:" + +msgid "&Tablet tool" +msgstr "Eine de &taula" + +msgid "About &Qt" +msgstr "Quant al &Qt" + +msgid "&MCA devices…" +msgstr "Dispositius MCA…" + +msgid "Show non-&primary monitors" +msgstr "Mostrar monitors no prim&aris" + +msgid "Open screenshots &folder…" +msgstr "Obrir la ca&rpeta de captures…" + +msgid "Appl&y fullscreen stretch mode when maximized" +msgstr "&Utilitzar estirament de la pantalla sencera en modalitat maximitzada" + +msgid "&Cursor/Puck" +msgstr "&Cursor/Puck" + +msgid "&Pen" +msgstr "&Bolígraf" + +msgid "&Host CD/DVD Drive (%1:)" +msgstr "&Unitat de CD/DVD del amfitrió (%1:)" + +msgid "&Connected" +msgstr "&Connectat" + +msgid "Clear image &history" +msgstr "Suprimir &història de imatges" + +msgid "Create…" +msgstr "Criar…" + +msgid "Host CD/DVD Drive (%1)" +msgstr "Unitat de CD/DVD del amfitrió (%1)" + +msgid "Unknown Bus" +msgstr "Bus desconegut" + +msgid "Null Driver" +msgstr "Controlador nul" + +msgid "NIC:" +msgstr "NIC:" + +msgid "NIC %1 (%2) %3" +msgstr "NIC %1 (%2) %3" + +msgid "&NIC %1 (%2) %3" +msgstr "&NIC %1 (%2) %3" + +msgid "Render behavior" +msgstr "Comportament del renderitzador" + +msgid "Use target framerate:" +msgstr "Utilitzar la freqüència de fotogrames del objectiu:" + +msgid " fps" +msgstr " fps" + +msgid "VSync" +msgstr "VSync" + +msgid "Synchronize with video" +msgstr "Sincronitzar amb els gràfics" + +msgid "Shaders" +msgstr "Shaders" + +msgid "Remove" +msgstr "Suprimir" + +msgid "Browse…" +msgstr "Navegació…" + +msgid "Couldn't create OpenGL context." +msgstr "Impossible de criar el context OpenGL." + +msgid "Couldn't switch to OpenGL context." +msgstr "Impossible de canviar al context OpenGL." + +msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" +msgstr "Es requereix la versió 3.0 o bé més alta del OpenGL. La versió actual és %1.%2" + +msgid "Error initializing OpenGL" +msgstr "Error en inicialitzar el OpenGL" + +msgid "\nFalling back to software rendering." +msgstr "\nTornant al renderitzat per software." + +msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" +msgstr "

En escollir imatges de mitjans (CD-ROM, disquet, etc.), el diàleg d'obertura s'iniciarà en el mateix directori que el fitxer de configuració del 86Box. És probable que aquest ajust només farà una diferència en el macOS.

" + +msgid "This machine might have been moved or copied." +msgstr "Aquesta màquina pot haver estat moguda o bé copiada." + +msgid "In order to ensure proper networking functionality, 86Box needs to know if this machine was moved or copied.\n\nSelect \"I Copied It\" if you are not sure." +msgstr "Per garantir la funcionalitat adequada de la xarxa, el 86Box ha de saber si aquesta màquina s'ha mogut o bé copiat.\n\nSi no està segur, escolliu \"La vaig copiar\"." + +msgid "I Moved It" +msgstr "La vaig moure" + +msgid "I Copied It" +msgstr "La vaig copiar" + +msgid "86Box Monitor #%1" +msgstr "Monitor del 86Box %1" + +msgid "No MCA devices." +msgstr "Cap de dispositius MCA." + +msgid "MiB" +msgstr "MiB" + +msgid "GiB" +msgstr "GiB" + +msgid "Network Card #1" +msgstr "Targeta de xarxa 1" + +msgid "Network Card #2" +msgstr "Targeta de xarxa 2" + +msgid "Network Card #3" +msgstr "Targeta de xarxa 3" + +msgid "Network Card #4" +msgstr "Targeta de xarxa 4" + +msgid "Mode:" +msgstr "Modalitat:" + +msgid "Interface:" +msgstr "Interfase:" + +msgid "Adapter:" +msgstr "Adaptador:" + +msgid "VDE Socket:" +msgstr "Sòcol VDE:" + +msgid "TAP Bridge Device:" +msgstr "Dispositiu pont TAP:" + +msgid "86Box Unit Tester" +msgstr "Comprovador de unitat del 86Box" + +msgid "Novell NetWare 2.x Key Card" +msgstr "Targeta de clau del Novell NetWare 2.x" + +msgid "Serial port passthrough 1" +msgstr "Passatge de port sèrie 1" + +msgid "Serial port passthrough 2" +msgstr "Passatge de port sèrie 2" + +msgid "Serial port passthrough 3" +msgstr "Passatge de port sèrie 3" + +msgid "Serial port passthrough 4" +msgstr "Passatge de port sèrie 4" + +msgid "Renderer &options…" +msgstr "Opc&ions del renderitzador…" + +msgid "PC/XT Keyboard" +msgstr "Teclat PC/XT" + +msgid "AT Keyboard" +msgstr "Teclat AT" + +msgid "AX Keyboard" +msgstr "Teclat AX" + +msgid "PS/2 Keyboard" +msgstr "Teclat PS/2" + +msgid "PS/55 Keyboard" +msgstr "Teclat PS/55" + +msgid "Keys" +msgstr "Tecles" + +msgid "Logitech/Microsoft Bus Mouse" +msgstr "Ratolí de bus Logitech/Microsoft" + +msgid "Microsoft Bus Mouse (InPort)" +msgstr "Ratolí de bus (InPort)" + +msgid "Mouse Systems Serial Mouse" +msgstr "Ratolí sèrie Mouse Systems" + +msgid "Mouse Systems Bus Mouse" +msgstr "Ratolí de bus Mouse Systems" + +msgid "Microsoft Serial Mouse" +msgstr "Ratolí sèrie Microsoft" + +msgid "Microsoft Serial BallPoint" +msgstr "Ratolí sèrie Microsoft BallPoint" + +msgid "Logitech Serial Mouse" +msgstr "Ratolí sèrie Logitech" + +msgid "PS/2 Mouse" +msgstr "Ratolì PS/2" + +msgid "PS/2 QuickPort Mouse" +msgstr "Ratolì PS/2 QuickPort" + +msgid "3M MicroTouch (Serial)" +msgstr "3M MicroTouch (sèrie)" + +msgid "Default Baud rate" +msgstr "Velocitat de transmissió per defecte" + +msgid "[COM] Standard Hayes-compliant Modem" +msgstr "[COM] Mòdem estàndard compatible amb Hayes" + +msgid "Roland MT-32 Emulation" +msgstr "Emulació Roland MT-32" + +msgid "Roland MT-32 (New) Emulation" +msgstr "Emulació Roland MT-32 (nou)" + +msgid "Roland CM-32L Emulation" +msgstr "Emulació Roland CM-32L" + +msgid "Roland CM-32LN Emulation" +msgstr "Emulació Roland CM-32LN" + +msgid "OPL4-ML Daughterboard" +msgstr "Placa filla OPL4-ML" + +msgid "System MIDI" +msgstr "MIDI del sistema" + +msgid "MIDI Input Device" +msgstr "Dispositiu de entrada MIDI" + +msgid "BIOS file" +msgstr "Fitxer del BIOS" + +msgid "BIOS file (ROM #1)" +msgstr "Fitxer del BIOS (ROM núm. 1)" + +msgid "BIOS file (ROM #2)" +msgstr "Fitxer del BIOS (ROM núm. 2)" + +msgid "BIOS file (ROM #3)" +msgstr "Fitxer del BIOS (ROM núm. 3)" + +msgid "BIOS file (ROM #4)" +msgstr "Fitxer del BIOS (ROM núm. 4)" + +msgid "BIOS address" +msgstr "Adreça del BIOS" + +msgid "BIOS address (ROM #1)" +msgstr "Adreça del BIOS (ROM núm. 1)" + +msgid "BIOS address (ROM #2)" +msgstr "Adreça del BIOS (ROM núm. 2)" + +msgid "BIOS address (ROM #3)" +msgstr "Adreça del BIOS (ROM núm. 3)" + +msgid "BIOS address (ROM #4)" +msgstr "Adreça del BIOS (ROM núm. 4)" + +msgid "Enable BIOS extension ROM Writes" +msgstr "Activar escriptures per al ROM de extensió del BIOS" + +msgid "Enable BIOS extension ROM Writes (ROM #1)" +msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 1)" + +msgid "Enable BIOS extension ROM Writes (ROM #2)" +msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 2)" + +msgid "Enable BIOS extension ROM Writes (ROM #3)" +msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 3)" + +msgid "Enable BIOS extension ROM Writes (ROM #4)" +msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 4)" + +msgid "Linear framebuffer base" +msgstr "Base del buffer lineal de pantalla" + +msgid "Address" +msgstr "Adreça" + +msgid "IRQ" +msgstr "IRQ" + +msgid "Serial port IRQ" +msgstr "IRQ del port sèrie" + +msgid "Parallel port IRQ" +msgstr "IRQ del port paralel" + +msgid "Hard disk" +msgstr "Disc dur" + +msgid "BIOS Revision" +msgstr "Revisió del BIOS" + +msgid "BIOS Version" +msgstr "Versió del BIOS" + +msgid "BIOS Language" +msgstr "Idioma del BIOS" + +msgid "IBM 5161 Expansion Unit" +msgstr "Unitat de expansió IBM 5161" + +msgid "IBM Cassette Basic" +msgstr "BASIC de casset IBM" + +msgid "Translate 26 -> 17" +msgstr "Traduir 26 -> 17" + +msgid "Language" +msgstr "Idioma" + +msgid "Enable backlight" +msgstr "Activar retroiŀluminació" + +msgid "Invert colors" +msgstr "Invertir colors" + +msgid "BIOS size" +msgstr "Grandària del BIOS" + +msgid "BIOS size (ROM #1)" +msgstr "Grandària del BIOS (ROM núm. 1)" + +msgid "BIOS size (ROM #2)" +msgstr "Grandària del BIOS (ROM núm. 2)" + +msgid "BIOS size (ROM #3)" +msgstr "Grandària del BIOS (ROM núm. 3)" + +msgid "BIOS size (ROM #4)" +msgstr "Grandària del BIOS (ROM núm. 4)" + +msgid "Map C0000-C7FFF as UMB" +msgstr "Mapar C0000-C7FFF com ara UMB" + +msgid "Map C8000-CFFFF as UMB" +msgstr "Mapar C8000-CFFFF com ara UMB" + +msgid "Map D0000-D7FFF as UMB" +msgstr "Mapar D0000-D7FFF com ara UMB" + +msgid "Map D8000-DFFFF as UMB" +msgstr "Mapar D8000-DFFFF com ara UMB" + +msgid "Map E0000-E7FFF as UMB" +msgstr "Mapar E0000-E7FFF com ara UMB" + +msgid "Map E8000-EFFFF as UMB" +msgstr "Mapar E8000-EFFFF com ara UMB" + +msgid "JS9 Jumper (JIM)" +msgstr "Pont JS9 (JIM)" + +msgid "MIDI Output Device" +msgstr "Dispositiu de sortida MIDI" + +msgid "MIDI Real time" +msgstr "MIDI en temps real" + +msgid "MIDI Thru" +msgstr "Passatge de la entrada MIDI" + +msgid "MIDI Clockout" +msgstr "Sortida del rellotge MIDI" + +msgid "Output Gain" +msgstr "Guany de sortida" + +msgid "Chorus" +msgstr "Cor" + +msgid "Chorus Voices" +msgstr "Veus del cor" + +msgid "Chorus Level" +msgstr "Nivell del cor" + +msgid "Chorus Speed" +msgstr "Velocitat del cor" + +msgid "Chorus Depth" +msgstr "Profunditat del cor" + +msgid "Chorus Waveform" +msgstr "Forma d'ona del cor" + +msgid "Reverb" +msgstr "Reverberació" + +msgid "Reverb Room Size" +msgstr "Mida de l'habitaciò de reverberació" + +msgid "Reverb Damping" +msgstr "Amortiment de reverberació" + +msgid "Reverb Width" +msgstr "Amplada de reverberació" + +msgid "Reverb Level" +msgstr "Nivell de reverberació" + +msgid "Interpolation Method" +msgstr "Mètode de interpolació" + +msgid "Dynamic Sample Loading" +msgstr "Càrrega dinàmica de mostres" + +msgid "Reverb Output Gain" +msgstr "Guany de sortida de reverberació" + +msgid "Reversed stereo" +msgstr "Estéreo invertit" + +msgid "Nice ramp" +msgstr "Rampa agradable" + +msgid "Hz" +msgstr "Hz" + +msgid "Buttons" +msgstr "Botons" + +msgid "Serial Port" +msgstr "Port sèrie" + +msgid "RTS toggle" +msgstr "Commutació RTS" + +msgid "Revision" +msgstr "Revisió" + +msgid "Controller" +msgstr "Controlador" + +msgid "Show Crosshair" +msgstr "Mostrar mirada creuada" + +msgid "DMA" +msgstr "DMA" + +msgid "MAC Address" +msgstr "Adreça MAC" + +msgid "MAC Address OUI" +msgstr "OUI de la adreça MAC" + +msgid "Enable BIOS" +msgstr "Activar el BIOS" + +msgid "Baud Rate" +msgstr "Velocitat de transmissió" + +msgid "TCP/IP listening port" +msgstr "Port de auscultació TCP/IP" + +msgid "Phonebook File" +msgstr "Fitxer de llista de contactes" + +msgid "Telnet emulation" +msgstr "Emulació Telnet" + +msgid "RAM Address" +msgstr "Adreça del RAM" + +msgid "RAM size" +msgstr "Grandària del RAM" + +msgid "Initial RAM size" +msgstr "Grandària inicial del RAM" + +msgid "Serial Number" +msgstr "Número de sèrie" + +msgid "Host ID" +msgstr "ID del amfitrió" + +msgid "FDC Address" +msgstr "Adreça del FDC" + +msgid "MPU-401 Address" +msgstr "Adreça del MPU-401" + +msgid "MPU-401 IRQ" +msgstr "IRQ del MPU-401" + +msgid "Receive MIDI input" +msgstr "Rebre entrada MIDI" + +msgid "Low DMA" +msgstr "DMA baix" + +msgid "Enable Game port" +msgstr "Activar port de joc" + +msgid "Enable Adlib ports" +msgstr "Activar ports Adlib" + +msgid "SID Model" +msgstr "Model del SID" + +msgid "SID Filter Strength" +msgstr "Força del filtre del SID" + +msgid "Surround module" +msgstr "Mòdulo surround" + +msgid "SB Address" +msgstr "Adreça del SB" + +msgid "Adlib Address" +msgstr "Adreça del Adlib" + +msgid "Use EEPROM setting" +msgstr "Uitilitzar la configuració del EEPROM" + +msgid "WSS IRQ" +msgstr "IRQ del WSS" + +msgid "WSS DMA" +msgstr "DMA del WSS" + +msgid "RTC IRQ" +msgstr "IRQ RTC" + +msgid "RTC Port Address" +msgstr "Adreça del port RTC" + +msgid "Onboard RTC" +msgstr "RTC integrat" + +msgid "Not installed" +msgstr "No instalat" + +msgid "Enable OPL" +msgstr "Activar OPL" + +msgid "Receive MIDI input (MPU-401)" +msgstr "Rebre entrada MIDI (MPU-401)" + +msgid "SB low DMA" +msgstr "DMA baix del SB" + +msgid "6CH variant (6-channel)" +msgstr "Variant 6CH (6 canals)" + +msgid "Enable CMS" +msgstr "Activar CMS" + +msgid "Mixer" +msgstr "Mesclador" + +msgid "High DMA" +msgstr "DMA alt" + +msgid "Control PC speaker" +msgstr "Controlar el altaveu del PC" + +msgid "Memory size" +msgstr "Grandària de memòria" + +msgid "EMU8000 Address" +msgstr "Adreça del EMU8000" + +msgid "IDE Controller" +msgstr "Controlador IDE" + +msgid "Codec" +msgstr "Codec" + +msgid "GUS type" +msgstr "Tipus de GUS" + +msgid "Enable 0x04 \"Exit 86Box\" command" +msgstr "Activar ordre 0x04 \"Sortir de 86Box\"" + +msgid "Display type" +msgstr "Tipus de pantalla" + +msgid "Composite type" +msgstr "Tipus de pantalla compòsita" + +msgid "RGB type" +msgstr "Tipus de pantalla RGB" + +msgid "Line doubling type" +msgstr "Tipus de duplicació de línia" + +msgid "Snow emulation" +msgstr "Emulació de neu" + +msgid "Monitor type" +msgstr "Tipus de monitor" + +msgid "Character set" +msgstr "Conjunt de caracters" + +msgid "XGA type" +msgstr "Tipus de XGA" + +msgid "Instance" +msgstr "Instància" + +msgid "MMIO Address" +msgstr "Adreça del MMIO" + +msgid "RAMDAC type" +msgstr "Tipus de RAMDAC" + +msgid "Blend" +msgstr "Mesclar" + +msgid "Font" +msgstr "Tipus de lletra" + +msgid "Bilinear filtering" +msgstr "Filtració bilineal" + +msgid "Video chroma-keying" +msgstr "Croma-clau de vídeo" + +msgid "Dithering" +msgstr "Dithering" + +msgid "Enable NMI for CGA emulation" +msgstr "Activar NMI per a emulació del CGA" + +msgid "Voodoo type" +msgstr "Tipus de Voodoo" + +msgid "Framebuffer memory size" +msgstr "Grandària de memòria del buffer de pantalla" + +msgid "Texture memory size" +msgstr "Grandària de memòria de textura" + +msgid "Dither subtraction" +msgstr "Subtracció de dither" + +msgid "Screen Filter" +msgstr "Filtre de pantalla" + +msgid "Render threads" +msgstr "Fils de renderització" + +msgid "SLI" +msgstr "SLI" + +msgid "Start Address" +msgstr "Adreça inicial" + +msgid "Contiguous Size" +msgstr "Grandària contigua" + +msgid "I/O Width" +msgstr "Amplada de E/S" + +msgid "Transfer Speed" +msgstr "Velocitat de transferència" + +msgid "EMS mode" +msgstr "Modalitat EMS" + +msgid "EMS Address" +msgstr "Adreça del EMS" + +msgid "EMS 1 Address" +msgstr "Adreça del EMS 1" + +msgid "EMS 2 Address" +msgstr "Adreça del EMS 2" + +msgid "EMS Memory Size" +msgstr "Grandària de memòria del EMS" + +msgid "EMS 1 Memory Size" +msgstr "Grandària de memòria del EMS 1" + +msgid "EMS 2 Memory Size" +msgstr "Grandària de memòria del EMS 2" + +msgid "Enable EMS" +msgstr "Activar EMS" + +msgid "Enable EMS 1" +msgstr "Activar EMS 1" + +msgid "Enable EMS 2" +msgstr "Activar EMS 2" + +msgid "Address for > 2 MB" +msgstr "Adreça per a > 2 MB" + +msgid "Frame Address" +msgstr "Adreça del marc" + +msgid "USA" +msgstr "EUA" + +msgid "Danish" +msgstr "Danés" + +msgid "Always at selected speed" +msgstr "Sempre a la velocitat escollida" + +msgid "BIOS setting + Hotkeys (off during POST)" +msgstr "Configuració del BIOS + Tecles de accés ràpid (desactivates durant el POST)" + +msgid "64 KB starting from F0000" +msgstr "64 KB a partir de F0000" + +msgid "128 KB starting from E0000 (address MSB inverted, last 64 KB first)" +msgstr "128 KB a partir de E0000 (MSB de adreça invertit, últimes 64 KB primer)" + +msgid "Sine" +msgstr "Sinusoidal" + +msgid "Triangle" +msgstr "Triangular" + +msgid "Linear" +msgstr "Lineal" + +msgid "4th Order" +msgstr "De 4º ordre" + +msgid "7th Order" +msgstr "De 7º ordre" + +msgid "Non-timed (original)" +msgstr "No cronometrat (original)" + +msgid "45 Hz (JMP2 not populated)" +msgstr "45 Hz (JMP2 no poblat)" + +msgid "Two" +msgstr "Dos" + +msgid "Three" +msgstr "Tres" + +msgid "Wheel" +msgstr "Roda" + +msgid "Five + Wheel" +msgstr "Cinc + roda" + +msgid "Five + 2 Wheels" +msgstr "Cinc + 2 rodes" + +msgid "A3 - SMT2 Serial / SMT3(R)V" +msgstr "A3 - SMT2 sèrie / SMT3(R)V" + +msgid "Q1 - SMT3(R) Serial" +msgstr "Q1 - SMT3(R) sèrie" + +msgid "8 KB" +msgstr "8 KB" + +msgid "32 KB" +msgstr "32 KB" + +msgid "16 KB" +msgstr "16 KB" + +msgid "64 KB" +msgstr "64 KB" + +msgid "Disable BIOS" +msgstr "Desactivar el BIOS" + +msgid "512 KB" +msgstr "512 KB" + +msgid "2 MB" +msgstr "2 MB" + +msgid "8 MB" +msgstr "8 MB" + +msgid "28 MB" +msgstr "28 MB" + +msgid "1 MB" +msgstr "1 MB" + +msgid "4 MB" +msgstr "4 MB" + +msgid "12 MB" +msgstr "12 MB" + +msgid "16 MB" +msgstr "16 MB" + +msgid "20 MB" +msgstr "20 MB" + +msgid "24 MB" +msgstr "24 MB" + +msgid "SigmaTel STAC9721T (stereo)" +msgstr "SigmaTel STAC9721T (estéreo)" + +msgid "256 KB" +msgstr "256 KB" + +msgid "Composite" +msgstr "Compòsit" + +msgid "True color" +msgstr "Color veritable" + +msgid "Old" +msgstr "Vell" + +msgid "New" +msgstr "Nou" + +msgid "Color (generic)" +msgstr "Colors (genèric)" + +msgid "Green Monochrome" +msgstr "Monocromàtic verd" + +msgid "Amber Monochrome" +msgstr "Monocromàtic ambre" + +msgid "Gray Monochrome" +msgstr "Monocromàtic gris" + +msgid "Color (no brown)" +msgstr "Colors (sense marró)" + +msgid "Color (IBM 5153)" +msgstr "Colors (IBM 5153)" + +msgid "Simple doubling" +msgstr "Duplicació simple" + +msgid "sRGB interpolation" +msgstr "Interpolació sRGB" + +msgid "Linear interpolation" +msgstr "Interpolació lineal" + +msgid "Has secondary 8x8 character set" +msgstr "Té conjunt de caràcters 8x8 secundari" + +msgid "Has Quadcolor II daughter board" +msgstr "Té placa filla Quadcolor II" + +msgid "Alternate monochrome contrast" +msgstr "Contrast monocromátic alternatiu" + +msgid "128 KB" +msgstr "128 KB" + +msgid "Monochrome (5151/MDA) (white)" +msgstr "Monocromàtic (5151/MDA) (blanc)" + +msgid "Monochrome (5151/MDA) (green)" +msgstr "Monocromàtic (5151/MDA) (verd)" + +msgid "Monochrome (5151/MDA) (amber)" +msgstr "Monocromàtic (5151/MDA) (ambre)" + +msgid "Color 40x25 (5153/CGA)" +msgstr "Colors 40x25 (5153/CGA)" + +msgid "Color 80x25 (5153/CGA)" +msgstr "Colors 80x25 (5153/CGA)" + +msgid "Enhanced Color - Normal Mode (5154/ECD)" +msgstr "Colors millorat - modalitat normal (5154/ECD)" + +msgid "Enhanced Color - Enhanced Mode (5154/ECD)" +msgstr "Colors millorat - modalitat millorada (5154/ECD)" + +msgid "Green" +msgstr "Verd" + +msgid "Amber" +msgstr "Ambre" + +msgid "Gray" +msgstr "Gris" + +msgid "Grayscale" +msgstr "Escala de grisos" + +msgid "Color" +msgstr "Colors" + +msgid "U.S. English" +msgstr "Anglès dels EUA" + +msgid "Scandinavian" +msgstr "Escandinau" + +msgid "Other languages" +msgstr "Altres idiomes" + +msgid "Bochs latest" +msgstr "Bochs més nou" + +msgid "Apply overscan deltas" +msgstr "Aplicar deltes del overscan" + +msgid "Mono Interlaced" +msgstr "Monocromàtic entrallaçat" + +msgid "Mono Non-Interlaced" +msgstr "Monocromàtic no entrallaçat" + +msgid "Color Interlaced" +msgstr "Colors entrallaçat" + +msgid "Color Non-Interlaced" +msgstr "Colors no entrallaçat" + +msgid "3Dfx Voodoo Graphics" +msgstr "Gràfics 3dfx Voodoo" + +msgid "3Dfx Voodoo 2" +msgstr "3Dfx Voodoo 2" + +msgid "Obsidian SB50 + Amethyst (2 TMUs)" +msgstr "Obsidian SB50 + Amethyst (2 unitats TMU)" + +msgid "8-bit" +msgstr "8 bits" + +msgid "16-bit" +msgstr "16 bits" + +msgid "Standard (150ns)" +msgstr "Estàndard (150ns)" + +msgid "High-Speed (120ns)" +msgstr "Alta velocitat (120ns)" + +msgid "Enabled" +msgstr "Activat" + +msgid "Standard" +msgstr "Estàndard" + +msgid "High-Speed" +msgstr "Alta velocitat" + +msgid "Stereo LPT DAC" +msgstr "DAC LPT estéreo" + +msgid "Generic Text Printer" +msgstr "Impressora genèrica de text" + +msgid "Generic ESC/P 2 Dot-Matrix Printer" +msgstr "Impressora genèrica matricial ESC/P 2" + +msgid "Generic PostScript Printer" +msgstr "Impressora genèrica PostScript" + +msgid "Generic PCL5e Printer" +msgstr "Impresora genèrica PCL5e" + +msgid "Parallel Line Internet Protocol" +msgstr "Protocol de Internet de línia paralela" + +msgid "Protection Dongle for Savage Quest" +msgstr "Dongle de protecció per a Savage Quest" + +msgid "Serial Passthrough Device" +msgstr "Dispositiu de passatge de port sèrie" + +msgid "Passthrough Mode" +msgstr "Modalitat de passatge" + +msgid "Host Serial Device" +msgstr "Dispositiu serie del amfitrió" + +msgid "Name of pipe" +msgstr "Nom de conducta" + +msgid "Data bits" +msgstr "Bits de dades" + +msgid "Stop bits" +msgstr "Bits de parada" + +msgid "Baud Rate of Passthrough" +msgstr "Velocitat de transmissió de passatge" + +msgid "Named Pipe (Server)" +msgstr "Conducta anomenada (servidor)" + +msgid "Named Pipe (Client)" +msgstr "Conducta anomenada (client)" + +msgid "Host Serial Passthrough" +msgstr "Passatge del port sèrie del amfitrió" + +msgid "E&ject %1" +msgstr "E&xpulsar %1" + +msgid "&Unmute" +msgstr "&Reactivar so" + +msgid "Softfloat FPU" +msgstr "FPU Softfloat" + +msgid "High performance impact" +msgstr "Alt impacte en el rendiment" + +msgid "[Generic] RAM Disk (max. speed)" +msgstr "[Genèric] Disc RAM (velocitat màxima)" + +msgid "[Generic] 1989 (3500 RPM)" +msgstr "[Genèric] 1989 (3500 RPM)" + +msgid "[Generic] 1992 (3600 RPM)" +msgstr "[Genèric] 1992 (3600 RPM)" + +msgid "[Generic] 1994 (4500 RPM)" +msgstr "[Genèric] 1994 (4500 RPM)" + +msgid "[Generic] 1996 (5400 RPM)" +msgstr "[Genèric] 1996 (5400 RPM)" + +msgid "[Generic] 1997 (5400 RPM)" +msgstr "[Genèric] 1997 (5400 RPM)" + +msgid "[Generic] 1998 (5400 RPM)" +msgstr "[Genèric] 1998 (5400 RPM)" + +msgid "[Generic] 2000 (7200 RPM)" +msgstr "[Genèric] 2000 (7200 RPM)" + +msgid "IBM 8514/A clone (ISA)" +msgstr "Clon IBM 8514/A (ISA)" + +msgid "Vendor" +msgstr "Fabricant" + +msgid "30 Hz (JMP2 = 1)" +msgstr "30 Hz (JMP2 = 1)" + +msgid "60 Hz (JMP2 = 2)" +msgstr "60 Hz (JMP2 = 2)" + +msgid "Generic PC/XT Memory Expansion" +msgstr "Expansió genèrica PC/XT de memòria" + +msgid "Generic PC/AT Memory Expansion" +msgstr "Expansió genèrica PC/AT de memòria" + +msgid "Unable to find Dot-Matrix fonts" +msgstr "No fou possible trobar els tipus de lletra matricials" + +msgid "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P 2 Dot-Matrix Printer." +msgstr "Els tipus de lletra TrueType en el directori \"roms/printer/fonts\" són imprescindibles per l'emulació de la impressora genèrica matricial ESC/P 2." + +msgid "Inhibit multimedia keys" +msgstr "Inhibir tecles multimèdia" + +msgid "Ask for confirmation before saving settings" +msgstr "Demanar confirmació abans de desar la configuració" + +msgid "Ask for confirmation before hard resetting" +msgstr "Demanar confirmació abans de la reiniciació completa" + +msgid "Ask for confirmation before quitting" +msgstr "Demanar confirmació abans de sortir" + +msgid "Options" +msgstr "Opcions" + +msgid "Model" +msgstr "Model" + +msgid "Model:" +msgstr "Model:" + +msgid "Failed to initialize Vulkan renderer." +msgstr "Error en inicialitzar el renderitzador Vulkan." + +msgid "GLSL Error" +msgstr "Error de GLSL" + +msgid "Could not load shader: %1" +msgstr "No fou possible carregar el shader: %1" + +msgid "Could not load texture: %1" +msgstr "Error en carregar la textura: %1" + +msgid "Could not compile shader:\n\n%1" +msgstr "Error en compilar el shader:\n\n%1" + +msgid "Program not linked:\n\n%1" +msgstr "Programa no vinculat:\n\n%1" + +msgid "Shader Manager" +msgstr "Administrador de shaders" + +msgid "Shader Configuration" +msgstr "Configuració de shaders" + +msgid "Add" +msgstr "Afegir" + +msgid "Move up" +msgstr "Moure cap amunt" + +msgid "Move down" +msgstr "Moure cap avall" + +msgid "Could not load file %1" +msgstr "Error en carregar el fitxer %1" + +msgid "Key Bindings:" +msgstr "Dreceres de teclat:" + +msgid "Action" +msgstr "Acció" + +msgid "Keybind" +msgstr "Drecera" + +msgid "Clear binding" +msgstr "Escorrar drecera" + +msgid "Bind" +msgstr "Vincular" + +msgid "Bind Key" +msgstr "Vincular tecla" + +msgid "Enter key combo:" +msgstr "Escriure combinació de tecles:" + +msgid "Bind conflict" +msgstr "Conflicte entre dreceres" + +msgid "This key combo is already in use." +msgstr "Aquesta combinació de tecles ja està en ús." + +msgid "Send Control+Alt+Del" +msgstr "Enviar Control+Alt+Del" + +msgid "Send Control+Alt+Escape" +msgstr "Enviar Control+Alt+Escape" + +msgid "Toggle fullscreen" +msgstr "Alternar pantalla completa" + +msgid "Toggle UI in fullscreen" +msgstr "Alternar interfase de usuari en modalitat de pantalla completa" + +msgid "Screenshot" +msgstr "Captura de pantalla" + +msgid "Release mouse pointer" +msgstr "Soltar el punter del ratolí" + +msgid "Toggle pause" +msgstr "Alternar pausa" + +msgid "Toggle mute" +msgstr "Alternar silenci" + +msgid "Text files" +msgstr "Fitxers de text" + +msgid "ROM files" +msgstr "Fitxers de ROM" + +msgid "SoundFont files" +msgstr "Fitxers SoundFont" + +msgid "Local Switch" +msgstr "Commutador local" + +msgid "Remote Switch" +msgstr "Commutador remot" + +msgid "Switch:" +msgstr "Commutador:" + +msgid "Hub Mode" +msgstr "Modalitat de concentrador" + +msgid "Hostname:" +msgstr "Nombre del amfitrió:" + +msgid "ISA RAM:" +msgstr "RAM ISA:" + +msgid "ISA ROM:" +msgstr "ROM ISA:" + +msgid "&Wipe NVRAM" +msgstr "&Esborrar el NVRAM" + +msgid "This will delete all NVRAM (and related) files of the virtual machine located in the \"nvr\" subdirectory. You'll have to reconfigure the BIOS (and possibly other devices inside the VM) settings again if applicable.\n\nAre you sure you want to wipe all NVRAM contents of the virtual machine \"%1\"?" +msgstr "Això suprimirà tots els fitxers de NVRAM (i relacionats) de la màquina virtual situats al subdirectori \"nvr\". Haureu de tornar a reconfigurar la configuració del BIOS (i potser de altres dispositius a l'interior de la MV) si s'escau.\n\nSegur que voleu suprimir tots els continguts de la NVRAM de la màquina virtual \"%1\"?" + +msgid "Success" +msgstr "Èxito" + +msgid "Successfully wiped the NVRAM contents of the virtual machine \"%1\"" +msgstr "Els continguts de la NVRAM de la màquina virtual \"%1\" s'han esborrat amb èxit" + +msgid "An error occurred trying to wipe the NVRAM contents of the virtual machine \"%1\"" +msgstr "S'ha produït un error en intentar esborrar els continguts de la NVRAM de la màquina virtual \"%1\"" + +msgid "%1 VM Manager" +msgstr "Administrador de MV de %1" + +msgid "%n disk(s)" +msgstr "%n disc(s)" + +msgid "Unknown Status" +msgstr "Estat desconegut" + +msgid "No Machines Found!" +msgstr "No s'han trobat màquines!" + +msgid "Check for updates on startup" +msgstr "Verificar actualitzacions en iniciar" + +msgid "Unable to determine release information" +msgstr "No fou possible determinar informacions de la versió" + +msgid "There was an error checking for updates:\n\n%1\n\nPlease try again later." +msgstr "S'ha produït un error en verificar actualitzacions:\n\n%1\n\nSi us plau, torneu a intentar més tard." + +msgid "Update check complete" +msgstr "Verificació de actualitzacions completada" + +msgid "stable" +msgstr "estable" + +msgid "beta" +msgstr "beta" + +msgid "You are running the latest %1 version of 86Box: %2" +msgstr "Està executant la última versió %1 del 86Box: %2" + +msgid "version" +msgstr "versió" + +msgid "build" +msgstr "compilació" + +msgid "You are currently running version %1." +msgstr "Actualment està a executar la versió %1." + +msgid "Version %1 is now available." +msgstr "La versió %1 és ara disponible." + +msgid "You are currently running build %1." +msgstr "Actualment está a executar la compialació %1." + +msgid "Build %1 is now available." +msgstr "La compilació %1 és ara disponible." + +msgid "Would you like to visit the download page?" +msgstr "Voleu visitar a la pàgina de descàrregas?" + +msgid "Visit download page" +msgstr "Visitar a la pàgina de descarregas" + +msgid "Update check" +msgstr "Verificació de actualitzacions" + +msgid "Checking for updates…" +msgstr "Verificant las actualitzacions…" + +msgid "86Box Update" +msgstr "Actualització del 86Box" + +msgid "Release notes:" +msgstr "Notes de versió:" + +msgid "%1 Hz" +msgstr "%1 Hz" + +msgid "Virtual machine crash" +msgstr "Terminació inesperada de la màquina virtual" + +msgid "The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2." +msgstr "El procés de la màquina virtual \"%1\" s'ha terminat inesperadament amb con el codi de sortida %2." + +msgid "The system will not be added." +msgstr "El sistema no serà afegit." + +msgid "&Update mouse every CPU frame" +msgstr "&Actualitza el estat del ratolí a cada bloc del CPU" + +msgid "Hue" +msgstr "Matís" + +msgid "Saturation" +msgstr "Saturació" + +msgid "Contrast" +msgstr "Contrast" + +msgid "Brightness" +msgstr "Luminositat" + +msgid "Sharpness" +msgstr "Nitidesa" + +msgid "&CGA composite settings…" +msgstr "Configuració de la modalitat compòsita &CGA…" + +msgid "CGA composite settings" +msgstr "Configuració de la modalitat compòsita CGA" + +msgid "Monitor EDID" +msgstr "EDID del monitor" + +msgid "Export…" +msgstr "Exportar…" + +msgid "Export EDID" +msgstr "Exportar el EDID" + +msgid "EDID file \"%ls\" is too large." +msgstr "El fitxer EDID \"%ls\" es massa gran." + +msgid "OpenGL input scale" +msgstr "Escala de entrada del OpenGL" + +msgid "OpenGL input stretch mode" +msgstr "Modalitat de estirament de entrada del OpenGL" + +msgid "Color scheme" +msgstr "Esquema de colors" + +msgid "Light" +msgstr "Clar" + +msgid "Dark" +msgstr "Fosc" + +msgid "Search:" +msgstr "Cercar:" + +msgid "Force interpretation" +msgstr "Forçar interpretació" + +msgid "Allow recompilation" +msgstr "Permetre recompilació" + +msgid "&Force interpretation" +msgstr "&Forçar interpretació" + +msgid "&Allow recompilation" +msgstr "&Permetre recompilació" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index c348fa87b5b..e99f2431bd8 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -160,7 +160,7 @@ msgid "RGB (no brown)" msgstr "RGB (sin marrón)" msgid "&RGB Grayscale" -msgstr "RGB &Grises" +msgstr "RGB &grises" msgid "Generic RGBI color monitor" msgstr "Monitor a colores RGBI genérico" @@ -241,10 +241,10 @@ msgid "&New image…" msgstr "&Nueva imagen…" msgid "&Existing image…" -msgstr "Imagen &Existente…" +msgstr "Imagen &existente…" msgid "Existing image (&Write-protected)…" -msgstr "Imagen Existente (&Sólo-lectura)…" +msgstr "Imagen existente (&Sólo-lectura)…" msgid "&Record" msgstr "&Grabar" @@ -292,7 +292,7 @@ msgid "Settings" msgstr "Configuraciones" msgid "Specify Main Window Dimensions" -msgstr "Especificar Dimensiones de la Ventana Principal" +msgstr "Especificar dimensiones de la ventana principal" msgid "OK" msgstr "Aceptar" @@ -376,7 +376,7 @@ msgid "Enabled (UTC)" msgstr "Habilitado (UTC)" msgid "Dynamic Recompiler" -msgstr "Recompilador Dinámico" +msgstr "Recompilador dinámico" msgid "CPU frame size" msgstr "Tamaño de blocos de CPU" @@ -682,7 +682,7 @@ msgid "&Removable disk %1 (%2): %3" msgstr "&Disco removible %1 (%2): %3" msgid "Removable disk images" -msgstr "Imagenes de disco removible" +msgstr "Imágenes de disco removible" msgid "Image %1" msgstr "Imagen %1" @@ -709,10 +709,10 @@ msgid "All images" msgstr "Todas las imagenes" msgid "Basic sector images" -msgstr "Basic sector images" +msgstr "Imaáenes básicas de sector" msgid "Surface images" -msgstr "Surface images" +msgstr "Imágenes de superficie" msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." msgstr "La máquina \"%hs\" no está disponible debido a ROMs faltantes en el directorio roms/machines. Cambiando a una máquina disponible." @@ -733,7 +733,7 @@ msgid "Display" msgstr "Vídeo" msgid "Input devices" -msgstr "Dispositivos de Entrada" +msgstr "Dispositivos de entrada" msgid "Sound" msgstr "Sonido" @@ -946,7 +946,7 @@ msgid "MO images" msgstr "Imágenes de MO" msgid "Welcome to 86Box!" -msgstr "¡Bienvenido a 86Box!" +msgstr "¡Bienvenido en 86Box!" msgid "Internal device" msgstr "Dispositivo interno" @@ -1018,7 +1018,7 @@ msgid "CD-ROM images" msgstr "Imágenes de CD-ROM" msgid "%1 Device Configuration" -msgstr "%1 Configuración de Dispositivo" +msgstr "%1 configuración de dispositivo" msgid "Monitor in sleep mode" msgstr "Monitor en modo ahorro" @@ -1042,7 +1042,7 @@ msgid "C&assette: %1" msgstr "C&assette: %1" msgid "Cassette images" -msgstr "Imágenes de Cassette" +msgstr "Imágenes de cassette" msgid "Cartridge %1: %2" msgstr "Cartucho %1: %2" @@ -1051,7 +1051,7 @@ msgid "Car&tridge %1: %2" msgstr "Car&tucho %1: %2" msgid "Cartridge images" -msgstr "Imágenes de Cartucho" +msgstr "Imágenes de cartucho" msgid "Resume execution" msgstr "Retomar la ejecución" @@ -1072,13 +1072,13 @@ msgid "Hard reset" msgstr "Hard reset" msgid "Force shutdown" -msgstr "Apagqar forzadamente" +msgstr "Apagar forzadamente" msgid "Start" msgstr "Iniciar" msgid "&Force shutdown" -msgstr "&Apagqar forzadamente" +msgstr "&Apagar forzadamente" msgid "&Start" msgstr "&Iniciar" @@ -2122,7 +2122,7 @@ msgid "MPU-401 Address" msgstr "Dirección del MPU-401" msgid "MPU-401 IRQ" -msgstr "IQ del MPU-401" +msgstr "IRQ del MPU-401" msgid "Receive MIDI input" msgstr "Recebir entrada MIDI" @@ -2218,7 +2218,7 @@ msgid "Display type" msgstr "Tipo de pantalla" msgid "Composite type" -msgstr "Tipo de pantalla compuesta" +msgstr "Tipo de pantalla compósita" msgid "RGB type" msgstr "Tipo de pantalla RGB" @@ -2446,7 +2446,7 @@ msgid "256 KB" msgstr "256 KB" msgid "Composite" -msgstr "Compuesto" +msgstr "Compósito" msgid "True color" msgstr "Verdadero color" @@ -2482,13 +2482,13 @@ msgid "sRGB interpolation" msgstr "Interpolación sRGB" msgid "Linear interpolation" -msgstr "Interpolación lineare" +msgstr "Interpolación lineal" msgid "Has secondary 8x8 character set" msgstr "Tiene conjunto de carácteres 8x8 secundário" msgid "Has Quadcolor II daughter board" -msgstr "Tiene tarjeta hija Quadcolor II" +msgstr "Tiene placa hija Quadcolor II" msgid "Alternate monochrome contrast" msgstr "Contraste monocromo alternativo" @@ -2569,7 +2569,7 @@ msgid "Obsidian SB50 + Amethyst (2 TMUs)" msgstr "Obsidian SB50 + Amethyst (2 unidades TMU)" msgid "8-bit" -msgstr "8 bitss" +msgstr "8 bits" msgid "16-bit" msgstr "16 bits" @@ -2596,7 +2596,7 @@ msgid "Generic Text Printer" msgstr "Impresora genérica de texto" msgid "Generic ESC/P 2 Dot-Matrix Printer" -msgstr "Impresora matricial ESC/P 2 genérica" +msgstr "Impresora genérica matricial ESC/P 2" msgid "Generic PostScript Printer" msgstr "Impresora genérica PostScript" @@ -2698,7 +2698,7 @@ msgid "Unable to find Dot-Matrix fonts" msgstr "No fué posible encontrar las fuentes matriciales" msgid "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P 2 Dot-Matrix Printer." -msgstr "Las fuentes TrueType en el directorio \"roms/printer/fonts\" son necesarias para la emulación de la impresora matricial ESC/P 2 genérica." +msgstr "Las fuentes TrueType en el directorio \"roms/printer/fonts\" son necesarias para la emulación de la impresora genérica matricial ESC/P 2." msgid "Inhibit multimedia keys" msgstr "Inhibir teclas multimedia" @@ -2863,10 +2863,10 @@ msgid "Unknown Status" msgstr "Estado desconocido" msgid "No Machines Found!" -msgstr "¡No fueron encontradas máquinas!" +msgstr "¡No fueran encontradas máquinas!" msgid "Check for updates on startup" -msgstr "Contorlar actualizaciones al iniciar" +msgstr "Verificar actualizaciones al iniciar" msgid "Unable to determine release information" msgstr "No fué posible determinar informaciones de la versión" @@ -2953,19 +2953,19 @@ msgid "Sharpness" msgstr "Nitidez" msgid "&CGA composite settings…" -msgstr "Configuración del modo compuesto &CGA…" +msgstr "Configuración del modo compósito &CGA…" msgid "CGA composite settings" -msgstr "Configuración del modo compuesto CGA" +msgstr "Configuración del modo compósito CGA" msgid "Monitor EDID" -msgstr "EDID du moniteur" +msgstr "EDID del monitor" msgid "Export…" -msgstr "Exporter…" +msgstr "Exportar…" msgid "Export EDID" -msgstr "EDID exportieren" +msgstr "Exportar el EDID" msgid "EDID file \"%ls\" is too large." msgstr "El archivo EDID \"%ls\" es demasiado grande." @@ -2980,7 +2980,7 @@ msgid "Color scheme" msgstr "Esquema de colores" msgid "Light" -msgstr "Luz" +msgstr "Claro" msgid "Dark" msgstr "Oscuro" diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index 268cec8945b..58d22c63b8e 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -47,6 +47,7 @@ QTranslator *ProgSettings::qtTranslator = nullptr; QVector> ProgSettings::languages = { { "system", "(System Default)" }, + { "ca-ES", "Catalan (Spain)" }, { "zh-CN", "Chinese (Simplified)" }, { "zh-TW", "Chinese (Traditional)" }, { "hr-HR", "Croatian (Croatia)" }, diff --git a/src/qt/qt_translations.qrc.in b/src/qt/qt_translations.qrc.in index ef79933722b..46541b1033a 100644 --- a/src/qt/qt_translations.qrc.in +++ b/src/qt/qt_translations.qrc.in @@ -1,5 +1,6 @@ + 86box_ca-ES.qm 86box_cs-CZ.qm 86box_de-DE.qm 86box_en-US.qm From 41ed34c67f5baa875eb74bbdeae36f47e8bf57de Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 22 Dec 2025 01:57:13 +0600 Subject: [PATCH 126/320] Fix black/white dot glitches in Voodoo 2 --- src/video/vid_voodoo_blitter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_voodoo_blitter.c b/src/video/vid_voodoo_blitter.c index 856631637df..d4b316dc59c 100644 --- a/src/video/vid_voodoo_blitter.c +++ b/src/video/vid_voodoo_blitter.c @@ -233,7 +233,7 @@ voodoo_v2_blit_start(voodoo_t *voodoo) } else dst = (uint16_t *) &voodoo->fb_mem[dst_base_addr + dst_y * dst_stride]; - for (int x = 0; x <= size_x; x++) { + for (int x = 0; x < size_x; x++) { if (voodoo->bltCommand & BLIT_CLIPPING_ENABLED) { if (dst_x < voodoo->bltClipLeft || dst_x >= voodoo->bltClipRight || dst_y < voodoo->bltClipLowY || dst_y >= voodoo->bltClipHighY) goto skip_pixel_fill; From 42e0fb67262850effd1d00f5d8f096e638dc9f17 Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 21 Dec 2025 22:45:16 +0200 Subject: [PATCH 127/320] Enhance FDD audio support for BIOS POST mode: - Implement detection of BIOS vendor and corresponding audio samples for seek operations. - Add support for loading and playing POST mode seek samples based on BIOS vendor. - Reset seek state on FDD close and reset functions. --- src/floppy/fdd.c | 4 + src/floppy/fdd_audio.c | 460 +++++++++++++++++++++++++++------- src/include/86box/fdd.h | 4 +- src/include/86box/fdd_audio.h | 55 +++- 4 files changed, 425 insertions(+), 98 deletions(-) diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index fbf5c1cd117..35676258cfd 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -724,6 +724,7 @@ fdd_close(int drive) drives[drive].format = NULL; drives[drive].byteperiod = NULL; drives[drive].stop = NULL; + fdd_seek_in_progress[drive] = 0; d86f_destroy(drive); ui_sb_update_icon_state(SB_FLOPPY | drive, 1); } @@ -818,6 +819,9 @@ fdd_reset(void) for (uint8_t i = 0; i < FDD_NUM; i++) { drives[i].id = i; timer_add(&(fdd_poll_time[i]), fdd_poll, &drives[i], 0); + + /* Clear any pending seek state */ + fdd_seek_in_progress[i] = 0; } } diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 1657db92454..f5fc493d109 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -38,39 +38,6 @@ static fdd_audio_profile_config_t audio_profiles[FDD_AUDIO_PROFILE_MAX]; static int audio_profile_count = 0; -/* Audio sample structure */ -typedef struct { - char filename[512]; - int16_t *buffer; - int samples; - float volume; -} audio_sample_t; - -typedef struct { - int position; - int active; -} single_step_state_t; - -/* Multi-track seek audio state */ -typedef struct { - int position; - int active; - int duration_samples; - int from_track; - int to_track; - int track_diff; -} multi_seek_state_t; - -/* Drive type specific audio samples */ -typedef struct { - audio_sample_t spindlemotor_start; - audio_sample_t spindlemotor_loop; - audio_sample_t spindlemotor_stop; - /* Individual seek samples for each track count (indexed 0-78 for 1-79 tracks) */ - audio_sample_t seek_up[MAX_SEEK_SAMPLES]; - audio_sample_t seek_down[MAX_SEEK_SAMPLES]; -} drive_audio_samples_t; - /* Dynamic sample storage for each profile */ static drive_audio_samples_t profile_samples[FDD_AUDIO_PROFILE_MAX]; @@ -86,13 +53,24 @@ static multi_seek_state_t seek_state[FDD_NUM][MAX_CONCURRENT_SEEKS] = {}; extern uint64_t motoron[FDD_NUM]; extern char exe_path[2048]; -extern int fdd_get_audio_profile(int drive); - /* Forward declaration */ static int16_t *load_wav(const char *filename, int *sample_count); -# ifdef ENABLE_FDD_LOG -static int fdd_audio_do_log = ENABLE_FDD_LOG; +extern uint8_t *rom; +extern uint32_t biosmask; +extern uint32_t biosaddr; +typedef enum { + BIOS_VENDOR_UNKNOWN = 0, + BIOS_VENDOR_AMI, + BIOS_VENDOR_AWARD, + BIOS_VENDOR_PHOENIX, + BIOS_VENDOR_IBM, + BIOS_VENDOR_COMPAQ, + BIOS_VENDOR_OTHER +} bios_vendor_t; + +#ifdef ENABLE_FDD_LOG +int fdd_audio_do_log = ENABLE_FDD_LOG; static void fdd_log(const char *fmt, ...) @@ -105,9 +83,85 @@ fdd_log(const char *fmt, ...) va_end(ap); } } -# else +#else # define fdd_log(fmt, ...) -# endif +#endif + +/* Detect BIOS vendor by scanning ROM for signature strings */ +static bios_vendor_t +fdd_audio_detect_bios_vendor(void) +{ + if (!rom || biosmask == 0) + return BIOS_VENDOR_UNKNOWN; + + /* Search for BIOS vendor strings in ROM */ + for (uint32_t i = 0; i < (biosmask + 1); i++) { + /* AMI BIOS signatures */ + if ((i + 7) < (biosmask + 1)) { + if (memcmp(&rom[i], "AMIBIOS", 7) == 0) { + fdd_log("FDD Audio: Detected AMI BIOS\n"); + return BIOS_VENDOR_AMI; + } + if (memcmp(&rom[i], "American Megatrends", 19) == 0) { + fdd_log("FDD Audio: Detected AMI BIOS (American Megatrends)\n"); + return BIOS_VENDOR_AMI; + } + } + + /* Award BIOS signatures */ + if ((i + 5) < (biosmask + 1)) { + if (memcmp(&rom[i], "Award", 5) == 0) { + fdd_log("FDD Audio: Detected Award BIOS\n"); + return BIOS_VENDOR_AWARD; + } + } + + /* Phoenix BIOS signatures */ + if ((i + 7) < (biosmask + 1)) { + if (memcmp(&rom[i], "Phoenix", 7) == 0) { + fdd_log("FDD Audio: Detected Phoenix BIOS\n"); + return BIOS_VENDOR_PHOENIX; + } + } + + /* IBM BIOS signatures */ + if ((i + 3) < (biosmask + 1)) { + if (memcmp(&rom[i], "IBM", 3) == 0 && (i + 10) < (biosmask + 1)) { + if (memcmp(&rom[i], "IBM CORP", 8) == 0) { + fdd_log("FDD Audio: Detected IBM BIOS\n"); + return BIOS_VENDOR_IBM; + } + } + } + + /* Compaq BIOS signatures */ + if ((i + 6) < (biosmask + 1)) { + if (memcmp(&rom[i], "COMPAQ", 6) == 0) { + fdd_log("FDD Audio: Detected Compaq BIOS\n"); + return BIOS_VENDOR_COMPAQ; + } + } + } + + fdd_log("FDD Audio: BIOS vendor unknown\n"); + return BIOS_VENDOR_UNKNOWN; +} + +/* Determine if this BIOS uses POST-mode FDC seeks */ +static int +fdd_audio_get_bios_vendor(void) +{ + static bios_vendor_t detected_vendor = BIOS_VENDOR_UNKNOWN; + static int detection_done = 0; + + /* Only detect once */ + if (!detection_done) { + detected_vendor = fdd_audio_detect_bios_vendor(); + detection_done = 1; + } + + return detected_vendor; +} /* Logging function for audio profile parameters */ static void @@ -271,9 +325,63 @@ fdd_audio_load_profiles(void) snprintf(key, sizeof(key), "seek_down_%dtrack_volume", track_count); profile->seek_down[track_count - 1].volume = ini_section_get_double(section, key, 1.0); + /* POST mode seek down samples */ + snprintf(key, sizeof(key), "post_seek_down_%dtrack_file", track_count); + filename = ini_section_get_string(section, key, ""); + strncpy(profile->post_seek_down[track_count - 1].filename, filename, + sizeof(profile->post_seek_down[track_count - 1].filename) - 1); + profile->post_seek_down[track_count - 1].filename[sizeof(profile->post_seek_down[track_count - 1].filename) - 1] = '\0'; + + snprintf(key, sizeof(key), "post_seek_down_%dtrack_volume", track_count); + profile->post_seek_down[track_count - 1].volume = ini_section_get_double(section, key, 1.0); + + /* BIOS vendor-specific POST mode seek samples */ + static const char *bios_prefixes[] = { + NULL, /* BIOS_VENDOR_UNKNOWN */ + "amibios", /* BIOS_VENDOR_AMI */ + "award", /* BIOS_VENDOR_AWARD */ + "phoenix", /* BIOS_VENDOR_PHOENIX */ + "ibm", /* BIOS_VENDOR_IBM */ + "compaq", /* BIOS_VENDOR_COMPAQ */ + NULL /* BIOS_VENDOR_OTHER */ + }; + + for (int vendor = 1; vendor < BIOS_VENDOR_COUNT; vendor++) { + if (!bios_prefixes[vendor]) + continue; + + /* BIOS-specific POST mode seek up samples */ + snprintf(key, sizeof(key), "%s_post_seek_up_%dtrack_file", bios_prefixes[vendor], track_count); + filename = ini_section_get_string(section, key, ""); + strncpy(profile->bios_post_seek_up[vendor][track_count - 1].filename, filename, + sizeof(profile->bios_post_seek_up[vendor][track_count - 1].filename) - 1); + profile->bios_post_seek_up[vendor][track_count - 1].filename[sizeof(profile->bios_post_seek_up[vendor][track_count - 1].filename) - 1] = '\0'; + + snprintf(key, sizeof(key), "%s_post_seek_up_%dtrack_volume", bios_prefixes[vendor], track_count); + profile->bios_post_seek_up[vendor][track_count - 1].volume = ini_section_get_double(section, key, 1.0); + + /* BIOS-specific POST mode seek down samples */ + snprintf(key, sizeof(key), "%s_post_seek_down_%dtrack_file", bios_prefixes[vendor], track_count); + filename = ini_section_get_string(section, key, ""); + strncpy(profile->bios_post_seek_down[vendor][track_count - 1].filename, filename, + sizeof(profile->bios_post_seek_down[vendor][track_count - 1].filename) - 1); + profile->bios_post_seek_down[vendor][track_count - 1].filename[sizeof(profile->bios_post_seek_down[vendor][track_count - 1].filename) - 1] = '\0'; + + snprintf(key, sizeof(key), "%s_post_seek_down_%dtrack_volume", bios_prefixes[vendor], track_count); + profile->bios_post_seek_down[vendor][track_count - 1].volume = ini_section_get_double(section, key, 1.0); + + /* BIOS-specific POST mode seek time in milliseconds */ + snprintf(key, sizeof(key), "%s_post_seek_%dtrack_time_ms", bios_prefixes[vendor], track_count); + profile->bios_post_seek_time_ms[vendor][track_count - 1] = ini_section_get_double(section, key, 0.0); + } + /* Seek time in milliseconds - used for FDC timing, not sample playback */ snprintf(key, sizeof(key), "seek_%dtrack_time_ms", track_count); profile->seek_time_ms[track_count - 1] = ini_section_get_double(section, key, 6.0 * track_count); + + /* POST mode seek time in milliseconds */ + snprintf(key, sizeof(key), "post_seek_%dtrack_time_ms", track_count); + profile->post_seek_time_ms[track_count - 1] = ini_section_get_double(section, key, 0.0); } /* Load timing configurations */ @@ -362,7 +470,7 @@ load_profile_samples(int profile_id) &samples->seek_up[idx].samples); if (samples->seek_up[idx].buffer) { fdd_log(" Loaded seek_up[%d]: %s (%d samples, volume %.2f)\n", - track_count, config->seek_up[idx].filename, + idx, config->seek_up[idx].filename, samples->seek_up[idx].samples, config->seek_up[idx].volume); } } @@ -375,11 +483,75 @@ load_profile_samples(int profile_id) &samples->seek_down[idx].samples); if (samples->seek_down[idx].buffer) { fdd_log(" Loaded seek_down[%d]: %s (%d samples, volume %.2f)\n", - track_count, config->seek_down[idx].filename, + idx, config->seek_down[idx].filename, samples->seek_down[idx].samples, config->seek_down[idx].volume); } } - } + + /* Load POST mode seek samples if configured */ + if (config->post_seek_up[idx].filename[0]) { + if (samples->post_seek_up[idx].buffer == NULL) { + strcpy(samples->post_seek_up[idx].filename, config->post_seek_up[idx].filename); + samples->post_seek_up[idx].volume = config->post_seek_up[idx].volume; + samples->post_seek_up[idx].buffer = load_wav(config->post_seek_up[idx].filename, + &samples->post_seek_up[idx].samples); + if (samples->post_seek_up[idx].buffer) { + fdd_log(" Loaded POST seek_up[%d] (%d-track): %s (%d samples, volume %.2f)\n", + idx, track_count, config->post_seek_up[idx].filename, + samples->post_seek_up[idx].samples, config->post_seek_up[idx].volume); + } + } + } + + if (config->post_seek_down[idx].filename[0]) { + if (samples->post_seek_down[idx].buffer == NULL) { + strcpy(samples->post_seek_down[idx].filename, config->post_seek_down[idx].filename); + samples->post_seek_down[idx].volume = config->post_seek_down[idx].volume; + samples->post_seek_down[idx].buffer = load_wav(config->post_seek_down[idx].filename, + &samples->post_seek_down[idx].samples); + if (samples->post_seek_down[idx].buffer) { + fdd_log(" Loaded POST seek_down[%d] (%d-track): %s (%d samples, volume %.2f)\n", + idx, track_count, config->post_seek_down[idx].filename, + samples->post_seek_down[idx].samples, config->post_seek_down[idx].volume); + } + } + } + + /* Load BIOS vendor-specific POST mode seek samples if configured */ + static const char *bios_names[] = { + "UNKNOWN", "AMI", "AWARD", "PHOENIX", "IBM", "COMPAQ", "OTHER" + }; + + for (int vendor = 1; vendor < BIOS_VENDOR_COUNT; vendor++) { + if (config->bios_post_seek_up[vendor][idx].filename[0]) { + if (samples->bios_post_seek_up[vendor][idx].buffer == NULL) { + strcpy(samples->bios_post_seek_up[vendor][idx].filename, config->bios_post_seek_up[vendor][idx].filename); + samples->bios_post_seek_up[vendor][idx].volume = config->bios_post_seek_up[vendor][idx].volume; + samples->bios_post_seek_up[vendor][idx].buffer = load_wav(config->bios_post_seek_up[vendor][idx].filename, + &samples->bios_post_seek_up[vendor][idx].samples); + if (samples->bios_post_seek_up[vendor][idx].buffer) { + fdd_log(" Loaded %s POST seek_up[%d] (%d-track): %s (%d samples, volume %.2f)\n", + bios_names[vendor], idx, track_count, config->bios_post_seek_up[vendor][idx].filename, + samples->bios_post_seek_up[vendor][idx].samples, config->bios_post_seek_up[vendor][idx].volume); + } + } + } + + if (config->bios_post_seek_down[vendor][idx].filename[0]) { + if (samples->bios_post_seek_down[vendor][idx].buffer == NULL) { + strcpy(samples->bios_post_seek_down[vendor][idx].filename, config->bios_post_seek_down[vendor][idx].filename); + samples->bios_post_seek_down[vendor][idx].volume = config->bios_post_seek_down[vendor][idx].volume; + samples->bios_post_seek_down[vendor][idx].buffer = load_wav(config->bios_post_seek_down[vendor][idx].filename, + &samples->bios_post_seek_down[vendor][idx].samples); + if (samples->bios_post_seek_down[vendor][idx].buffer) { + fdd_log(" Loaded %s POST seek_down[%d] (%d-track): %s (%d samples, volume %.2f)\n", + bios_names[vendor], idx, track_count, config->bios_post_seek_down[vendor][idx].filename, + samples->bios_post_seek_down[vendor][idx].samples, config->bios_post_seek_down[vendor][idx].volume); + } + } + } + } + } } static drive_audio_samples_t * @@ -461,6 +633,21 @@ fdd_audio_get_seek_time(int drive, int track_count, int is_seek_down) /* Return configured seek time in microseconds */ if (track_count > 0 && track_count <= MAX_SEEK_SAMPLES) { + /* In POST mode, check for BIOS-specific timing first */ + if (fdd_get_boot_status() == BIOS_BOOT_POST) { + int bios_vendor = fdd_audio_get_bios_vendor(); + + /* Check BIOS vendor-specific timing first */ + if (bios_vendor > 0 && bios_vendor < BIOS_VENDOR_COUNT && + profile->bios_post_seek_time_ms[bios_vendor][track_count - 1] > 0.0) { + return profile->bios_post_seek_time_ms[bios_vendor][track_count - 1] * 1000.0; + } + + /* Fall back to generic POST timing */ + if (profile->post_seek_time_ms[track_count - 1] > 0.0) { + return profile->post_seek_time_ms[track_count - 1] * 1000.0; + } + } return profile->seek_time_ms[track_count - 1] * 1000.0; } @@ -489,6 +676,7 @@ fdd_audio_init(void) seek_state[i][j].from_track = -1; seek_state[i][j].to_track = -1; seek_state[i][j].track_diff = 0; + seek_state[i][j].sample_to_play = NULL; } } @@ -546,6 +734,30 @@ fdd_audio_close(void) samples->seek_down[track_count].buffer = NULL; samples->seek_down[track_count].samples = 0; } + if (samples->post_seek_up[track_count].buffer) { + free(samples->post_seek_up[track_count].buffer); + samples->post_seek_up[track_count].buffer = NULL; + samples->post_seek_up[track_count].samples = 0; + } + if (samples->post_seek_down[track_count].buffer) { + free(samples->post_seek_down[track_count].buffer); + samples->post_seek_down[track_count].buffer = NULL; + samples->post_seek_down[track_count].samples = 0; + } + + /* Free BIOS vendor-specific POST seek samples */ + for (int vendor = 0; vendor < BIOS_VENDOR_COUNT; vendor++) { + if (samples->bios_post_seek_up[vendor][track_count].buffer) { + free(samples->bios_post_seek_up[vendor][track_count].buffer); + samples->bios_post_seek_up[vendor][track_count].buffer = NULL; + samples->bios_post_seek_up[vendor][track_count].samples = 0; + } + if (samples->bios_post_seek_down[vendor][track_count].buffer) { + free(samples->bios_post_seek_down[vendor][track_count].buffer); + samples->bios_post_seek_down[vendor][track_count].buffer = NULL; + samples->bios_post_seek_down[vendor][track_count].samples = 0; + } + } } } @@ -629,16 +841,81 @@ fdd_audio_play_multi_track_seek(int drive, int from_track, int to_track) track_diff = max_seek_tracks; } - /* Get the appropriate seek sample */ - int idx = track_diff - 1; - audio_sample_t *sample_to_use = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; + int boot_status = fdd_get_boot_status(); + int bios_vendor = fdd_audio_get_bios_vendor(); + int idx = track_diff - 1; + int real_track_diff = to_track - from_track; + audio_sample_t *sample_to_use = NULL; + + if (boot_status == BIOS_BOOT_POST) { + if (bios_vendor == BIOS_VENDOR_AMI) { + /* AMI BIOS POST mode: use AMI-specific samples if available */ + + /* AMI BIOS quirk: for single-track seeks down (except 10->9), do not play audio */ + if (real_track_diff == -1 && (from_track != 10 || to_track != 9)) { + fdd_log("FDD Audio Drive %d: AMI BIOS quirk: for single-track seeks down (except 10->9), do not play audio\n", drive); + return; + } + + /* For 10->9 seek, use the 1-track sample (which should be the 10-0 sound) */ + sample_to_use = is_seek_down ? &samples->bios_post_seek_down[bios_vendor][idx] : &samples->bios_post_seek_up[bios_vendor][idx]; + + if (sample_to_use->buffer && sample_to_use->samples > 0) { + fdd_log("FDD Audio Drive %d: Using AMI BIOS POST mode seek sample (idx=%d, %s)\n", + drive, idx, is_seek_down ? "DOWN" : "UP"); + } else { + /* Fall back to generic POST sample */ + sample_to_use = is_seek_down ? &samples->post_seek_down[idx] : &samples->post_seek_up[idx]; + if (sample_to_use->buffer && sample_to_use->samples > 0) { + fdd_log("FDD Audio Drive %d: AMI BIOS sample not available, using generic POST sample (idx=%d, %s)\n", + drive, idx, is_seek_down ? "DOWN" : "UP"); + } else { + /* Fall back to normal sample */ + fdd_log("FDD Audio Drive %d: POST sample not available, using normal sample\n", drive); + sample_to_use = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; + } + } + } else if (bios_vendor > 0 && bios_vendor < BIOS_VENDOR_COUNT) { + /* Other known BIOS vendors: try vendor-specific samples first */ + sample_to_use = is_seek_down ? &samples->bios_post_seek_down[bios_vendor][idx] : &samples->bios_post_seek_up[bios_vendor][idx]; + + if (sample_to_use->buffer && sample_to_use->samples > 0) { + fdd_log("FDD Audio Drive %d: Using BIOS vendor %d POST mode seek sample (idx=%d, %s)\n", + drive, bios_vendor, idx, is_seek_down ? "DOWN" : "UP"); + } else { + /* Fall back to generic POST sample */ + sample_to_use = is_seek_down ? &samples->post_seek_down[idx] : &samples->post_seek_up[idx]; + if (sample_to_use->buffer && sample_to_use->samples > 0) { + fdd_log("FDD Audio Drive %d: BIOS-specific sample not available, using generic POST sample (idx=%d, %s)\n", + drive, idx, is_seek_down ? "DOWN" : "UP"); + } else { + /* Fall back to normal sample */ + fdd_log("FDD Audio Drive %d: POST sample not available, using normal sample\n", drive); + sample_to_use = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; + } + } + } else { + /* Unknown BIOS vendor POST mode */ + sample_to_use = is_seek_down ? &samples->post_seek_down[idx] : &samples->post_seek_up[idx]; + if (!sample_to_use->buffer || sample_to_use->samples == 0) { + fdd_log("FDD Audio Drive %d: POST sample not available, using normal sample\n", drive); + sample_to_use = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; + } else { + fdd_log("FDD Audio Drive %d: Using POST mode seek sample (idx=%d, %s)\n", + drive, idx, is_seek_down ? "DOWN" : "UP"); + } + } + } else { + /* Use normal samples */ + sample_to_use = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; + } /* Only proceed if we have the appropriate sample */ if (!sample_to_use || !sample_to_use->buffer || sample_to_use->samples == 0) return; - fdd_log("FDD Audio Drive %d: Multi-track seek %d -> %d (%d tracks, %s)\n", - drive, from_track, to_track, track_diff, is_seek_down ? "DOWN" : "UP"); + fdd_log("FDD Audio Drive %d: Multi-track seek %d -> %d (%d tracks, %s, POST=%d)\n", + drive, from_track, to_track, track_diff, is_seek_down ? "DOWN" : "UP", boot_status); /* Find an available seek slot */ int slot = -1; @@ -662,6 +939,7 @@ fdd_audio_play_multi_track_seek(int drive, int from_track, int to_track) seek_state[drive][slot].from_track = from_track; seek_state[drive][slot].to_track = to_track; seek_state[drive][slot].track_diff = track_diff; + seek_state[drive][slot].sample_to_play = sample_to_use; fdd_log("FDD Audio Drive %d: Started seek in slot %d, duration %d samples\n", drive, slot, sample_to_use->samples); @@ -867,30 +1145,26 @@ fdd_audio_callback(int16_t *buffer, int length) if (!seek_state[drive][slot].active) continue; - int track_diff = seek_state[drive][slot].track_diff; - if (track_diff > 0 && track_diff <= MAX_SEEK_SAMPLES) { - int idx = track_diff - 1; - int is_seek_down = (seek_state[drive][slot].to_track < seek_state[drive][slot].from_track); - audio_sample_t *seek_sample = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; - - if (seek_sample && seek_sample->buffer && seek_state[drive][slot].position < seek_sample->samples) { - /* Mix seek sound with existing audio */ - float seek_left = (float) seek_sample->buffer[seek_state[drive][slot].position * 2] / 131072.0f * seek_sample->volume; - float seek_right = (float) seek_sample->buffer[seek_state[drive][slot].position * 2 + 1] / 131072.0f * seek_sample->volume; - - left_sample += seek_left; - right_sample += seek_right; - - seek_state[drive][slot].position++; - } else { - /* Seek sound finished */ - seek_state[drive][slot].active = 0; - seek_state[drive][slot].position = 0; - seek_state[drive][slot].duration_samples = 0; - seek_state[drive][slot].from_track = -1; - seek_state[drive][slot].to_track = -1; - seek_state[drive][slot].track_diff = 0; - } + audio_sample_t *seek_sample = seek_state[drive][slot].sample_to_play; + + if (seek_sample && seek_sample->buffer && seek_state[drive][slot].position < seek_sample->samples) { + /* Mix seek sound with existing audio */ + float seek_left = (float) seek_sample->buffer[seek_state[drive][slot].position * 2] / 131072.0f * seek_sample->volume; + float seek_right = (float) seek_sample->buffer[seek_state[drive][slot].position * 2 + 1] / 131072.0f * seek_sample->volume; + + left_sample += seek_left; + right_sample += seek_right; + + seek_state[drive][slot].position++; + } else { + /* Seek sound finished */ + seek_state[drive][slot].active = 0; + seek_state[drive][slot].position = 0; + seek_state[drive][slot].duration_samples = 0; + seek_state[drive][slot].from_track = -1; + seek_state[drive][slot].to_track = -1; + seek_state[drive][slot].track_diff = 0; + seek_state[drive][slot].sample_to_play = NULL; } } @@ -983,30 +1257,26 @@ fdd_audio_callback(int16_t *buffer, int length) if (!seek_state[drive][slot].active) continue; - int track_diff = seek_state[drive][slot].track_diff; - if (track_diff > 0 && track_diff <= MAX_SEEK_SAMPLES) { - int idx = track_diff - 1; - int is_seek_down = (seek_state[drive][slot].to_track < seek_state[drive][slot].from_track); - audio_sample_t *seek_sample = is_seek_down ? &samples->seek_down[idx] : &samples->seek_up[idx]; - - if (seek_sample && seek_sample->buffer && seek_state[drive][slot].position < seek_sample->samples) { - /* Mix seek sound with existing audio */ - int16_t seek_left = (int16_t) ((float) seek_sample->buffer[seek_state[drive][slot].position * 2] / 4.0f * seek_sample->volume); - int16_t seek_right = (int16_t) ((float) seek_sample->buffer[seek_state[drive][slot].position * 2 + 1] / 4.0f * seek_sample->volume); - - left_sample += seek_left; - right_sample += seek_right; - - seek_state[drive][slot].position++; - } else { - /* Seek sound finished */ - seek_state[drive][slot].active = 0; - seek_state[drive][slot].position = 0; - seek_state[drive][slot].duration_samples = 0; - seek_state[drive][slot].from_track = -1; - seek_state[drive][slot].to_track = -1; - seek_state[drive][slot].track_diff = 0; - } + audio_sample_t *seek_sample = seek_state[drive][slot].sample_to_play; + + if (seek_sample && seek_sample->buffer && seek_state[drive][slot].position < seek_sample->samples) { + /* Mix seek sound with existing audio */ + int16_t seek_left = (int16_t) ((float) seek_sample->buffer[seek_state[drive][slot].position * 2] / 4.0f * seek_sample->volume); + int16_t seek_right = (int16_t) ((float) seek_sample->buffer[seek_state[drive][slot].position * 2 + 1] / 4.0f * seek_sample->volume); + + left_sample += seek_left; + right_sample += seek_right; + + seek_state[drive][slot].position++; + } else { + /* Seek sound finished */ + seek_state[drive][slot].active = 0; + seek_state[drive][slot].position = 0; + seek_state[drive][slot].duration_samples = 0; + seek_state[drive][slot].from_track = -1; + seek_state[drive][slot].to_track = -1; + seek_state[drive][slot].track_diff = 0; + seek_state[drive][slot].sample_to_play = NULL; } } diff --git a/src/include/86box/fdd.h b/src/include/86box/fdd.h index 2ac46d6510d..ef2a33489f7 100644 --- a/src/include/86box/fdd.h +++ b/src/include/86box/fdd.h @@ -27,9 +27,9 @@ #define DEFAULT_SEEK_TIME_MS 10.0 /* BIOS boot status - used to detect POST vs normal operation */ -typedef enum bios_boot_status_t { +typedef enum { BIOS_BOOT_POST = 0, /* System is in POST (Power-On Self Test) */ - BIOS_BOOT_NORMAL /* POST complete, normal operation */ + BIOS_BOOT_NORMAL = 1 /* POST complete, normal operation */ } bios_boot_status_t; #ifdef __cplusplus diff --git a/src/include/86box/fdd_audio.h b/src/include/86box/fdd_audio.h index 1d1b52d1494..433aeaff819 100644 --- a/src/include/86box/fdd_audio.h +++ b/src/include/86box/fdd_audio.h @@ -16,6 +16,7 @@ #define EMU_FDD_AUDIO_H #include +#include <86box/fdd.h> #ifdef __cplusplus extern "C" { @@ -29,6 +30,9 @@ extern "C" { /* Maximum number of simultaneous seek sounds per drive */ #define MAX_CONCURRENT_SEEKS 8 +/* Number of BIOS vendors (for BIOS-specific samples) */ +#define BIOS_VENDOR_COUNT 7 + /* Audio sample configuration structure */ typedef struct { char filename[512]; @@ -45,7 +49,15 @@ typedef struct { audio_sample_config_t spindlemotor_stop; audio_sample_config_t seek_up[MAX_SEEK_SAMPLES]; audio_sample_config_t seek_down[MAX_SEEK_SAMPLES]; - double seek_time_ms[MAX_SEEK_SAMPLES]; /* Seek time in milliseconds for each track count */ + audio_sample_config_t post_seek_up[MAX_SEEK_SAMPLES]; + audio_sample_config_t post_seek_down[MAX_SEEK_SAMPLES]; + /* BIOS vendor-specific POST seek samples [vendor][track] */ + audio_sample_config_t bios_post_seek_up[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES]; + audio_sample_config_t bios_post_seek_down[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES]; + double seek_time_ms[MAX_SEEK_SAMPLES]; + double post_seek_time_ms[MAX_SEEK_SAMPLES]; + /* BIOS vendor-specific POST seek times [vendor][track] */ + double bios_post_seek_time_ms[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES]; int total_tracks; /* 40 or 80 */ } fdd_audio_profile_config_t; @@ -76,6 +88,45 @@ typedef struct { uint32_t data_size; } wav_header_t; +/* Audio sample structure */ +typedef struct { + char filename[512]; + int16_t *buffer; + int samples; + float volume; +} audio_sample_t; + +typedef struct { + int position; + int active; +} single_step_state_t; + +/* Multi-track seek audio state */ +typedef struct { + int position; + int active; + int duration_samples; + int from_track; + int to_track; + int track_diff; + audio_sample_t *sample_to_play; +} multi_seek_state_t; + +/* Drive type specific audio samples */ +typedef struct { + audio_sample_t spindlemotor_start; + audio_sample_t spindlemotor_loop; + audio_sample_t spindlemotor_stop; + /* Individual seek samples for each track count (indexed 0-78 for 1-79 tracks) */ + audio_sample_t seek_up[MAX_SEEK_SAMPLES]; + audio_sample_t seek_down[MAX_SEEK_SAMPLES]; + audio_sample_t post_seek_up[MAX_SEEK_SAMPLES]; + audio_sample_t post_seek_down[MAX_SEEK_SAMPLES]; + /* BIOS vendor-specific POST seek samples [vendor][track] */ + audio_sample_t bios_post_seek_up[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES]; + audio_sample_t bios_post_seek_down[BIOS_VENDOR_COUNT][MAX_SEEK_SAMPLES]; +} drive_audio_samples_t; + /* Fade duration: 75ms at 48kHz = 3600 samples */ #define FADE_DURATION_MS 75 #define FADE_SAMPLES (48000 * FADE_DURATION_MS / 1000) @@ -89,6 +140,8 @@ extern const char* fdd_audio_get_profile_internal_name(int id); extern int fdd_audio_get_profile_by_internal_name(const char *internal_name); extern double fdd_audio_get_seek_time(int drive, int track_count, int is_seek_down); extern void load_profile_samples(int profile_id); +extern int fdd_get_audio_profile(int drive); +extern bios_boot_status_t fdd_get_boot_status(void); #else From eca6011a3e49d22bc876af3c6b3fd99975b1303d Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 21 Dec 2025 22:23:45 +0100 Subject: [PATCH 128/320] FDD Audio: #ifdef out the unused variable. --- src/floppy/fdd_audio.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index f5fc493d109..0e636c78c61 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -517,10 +517,12 @@ load_profile_samples(int profile_id) } } +#ifdef BIOS_NAMES /* Load BIOS vendor-specific POST mode seek samples if configured */ static const char *bios_names[] = { "UNKNOWN", "AMI", "AWARD", "PHOENIX", "IBM", "COMPAQ", "OTHER" }; +#endif for (int vendor = 1; vendor < BIOS_VENDOR_COUNT; vendor++) { if (config->bios_post_seek_up[vendor][idx].filename[0]) { From 82fa8beccbaac204f6807165fb9bd1b73cefa530 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 21 Dec 2025 22:28:39 +0100 Subject: [PATCH 129/320] Change the #ifdef. --- src/floppy/fdd_audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 0e636c78c61..46cc40a8165 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -517,7 +517,7 @@ load_profile_samples(int profile_id) } } -#ifdef BIOS_NAMES +#ifdef ENABLE_FDD_LOG /* Load BIOS vendor-specific POST mode seek samples if configured */ static const char *bios_names[] = { "UNKNOWN", "AMI", "AWARD", "PHOENIX", "IBM", "COMPAQ", "OTHER" From a822628111b586a89c24dc6bde32fbb2814d8a02 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 21 Dec 2025 19:05:02 -0300 Subject: [PATCH 130/320] Display proper floppy sound profile names in the drive list --- src/qt/qt_settingsfloppycdrom.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_settingsfloppycdrom.cpp b/src/qt/qt_settingsfloppycdrom.cpp index 8fcad3f210e..d896614d84f 100644 --- a/src/qt/qt_settingsfloppycdrom.cpp +++ b/src/qt/qt_settingsfloppycdrom.cpp @@ -149,7 +149,7 @@ SettingsFloppyCDROM::SettingsFloppyCDROM(QWidget *parent) #ifndef DISABLE_FDD_AUDIO // Get the profile name from the configuration system - const char *name = fdd_audio_get_profile_internal_name(prof); + const char *name = fdd_audio_get_profile_name(prof); if (name) { profName = QString(name); } else { @@ -449,7 +449,7 @@ SettingsFloppyCDROM::on_comboBoxFloppyAudio_activated(int) #ifndef DISABLE_FDD_AUDIO // Get the profile name from the configuration system - const char *name = fdd_audio_get_profile_internal_name(prof); + const char *name = fdd_audio_get_profile_name(prof); if (name) { profName = name; } else { From 7513769b4bc1463f7cc54f4709bd21a1993f5701 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Sun, 21 Dec 2025 20:40:30 -0300 Subject: [PATCH 131/320] Fix missing None floppy sound preset on 40-track drives --- src/floppy/fdd_audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 46cc40a8165..8cbebf20913 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -385,7 +385,7 @@ fdd_audio_load_profiles(void) } /* Load timing configurations */ - profile->total_tracks = ini_section_get_int(section, "total_tracks", 80); + profile->total_tracks = ini_section_get_int(section, "total_tracks", 0); audio_profile_count++; } @@ -553,7 +553,7 @@ load_profile_samples(int profile_id) } } } - } + } } static drive_audio_samples_t * From 69a7db1af627fd4b36ee08579429bfd08fdb8c1e Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 22 Dec 2025 00:59:02 +0100 Subject: [PATCH 132/320] Corrected Catalan translation by ahernandez094 from BetaWiki (native speaker) and more fixes to the Spanish translation. --- src/qt/languages/ca-ES.po | 658 +++++++++++++++++++------------------- src/qt/languages/es-ES.po | 4 +- 2 files changed, 331 insertions(+), 331 deletions(-) diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index dabe5823316..75e0a593dcd 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -25,7 +25,7 @@ msgid "&Hard reset" msgstr "&Reiniciació completa" msgid "&Ctrl+Alt+Del" -msgstr "&Ctrl+Alt+Del" +msgstr "&Ctrl+Alt+Supr" msgid "Ctrl+Alt+&Esc" msgstr "Ctrl+Alt+&Esc" @@ -40,31 +40,31 @@ msgid "Re&sume" msgstr "Re&prendre" msgid "E&xit" -msgstr "&Sortir" +msgstr "&Surt" msgid "&View" -msgstr "&Visualització" +msgstr "&Visualitza" msgid "&Hide status bar" -msgstr "&Ocultar barra d'estat" +msgstr "&Amaga la barra d'estat" msgid "Hide &toolbar" -msgstr "Ocultar &barra d'eines" +msgstr "Amaga la &barra d'eines" msgid "&Resizeable window" msgstr "Fi&nestra redimensionable" msgid "R&emember size && position" -msgstr "&Recordar grandària i posició" +msgstr "&Recorda grandària i posició" msgid "Remember size && position" -msgstr "Recordar grandària i posició" +msgstr "Recorda grandària i posició" msgid "Re&nderer" -msgstr "Re&ndidor" +msgstr "Re&nderitzador" msgid "&Qt (Software)" -msgstr "&Qt (Software)" +msgstr "&Qt (Programari)" msgid "Open&GL (3.0 Core)" msgstr "Open&GL (3.0 Core)" @@ -73,10 +73,10 @@ msgid "&VNC" msgstr "&VNC" msgid "Specify &dimensions…" -msgstr "E&specificar dimensions…" +msgstr "E&specifica dimensions…" msgid "Force &4:3 display ratio" -msgstr "Forçar ràtio de visualització &4:3" +msgstr "Força ràtio de visualització &4:3" msgid "&Window scale factor" msgstr "&Factor de escalat de finestra" @@ -145,7 +145,7 @@ msgid "4:&3 Integer scale" msgstr "Escalat de valor enter 4:&3" msgid "EGA/(S)&VGA settings" -msgstr "Configuracions EGA/(S)&VGA" +msgstr "Configuració EGA/(S)&VGA" msgid "&Inverted VGA monitor" msgstr "&Monitor VGA invertit" @@ -163,7 +163,7 @@ msgid "&RGB Grayscale" msgstr "&RGB en escala de grisos" msgid "Generic RGBI color monitor" -msgstr "Monitor RGBI genèric en colors" +msgstr "Monitor RGBI genèric a color" msgid "&Amber monitor" msgstr "Monitor ambr&e" @@ -184,13 +184,13 @@ msgid "BT&709 (HDTV)" msgstr "BT&709 (HDTV)" msgid "&Average" -msgstr "&Mitjà" +msgstr "&Mitja" msgid "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" msgstr "Overscan de CGA/PCjr/Tandy/E&GA/(S)VGA" msgid "Change contrast for &monochrome display" -msgstr "Canviar contrast per a la pantalla &monocromàtica" +msgstr "Canvia contrast per a la pantalla &monocromàtica" msgid "&Media" msgstr "&Mitjans" @@ -199,16 +199,16 @@ msgid "&Tools" msgstr "&Eines" msgid "&Settings…" -msgstr "&Configuracions…" +msgstr "&Configuració…" msgid "Settings…" -msgstr "Configuracions…" +msgstr "Configuració…" msgid "&Update status bar icons" -msgstr "&Actualitzar icones en barra d'estat" +msgstr "&Actualitza icones a la barra d'estat" msgid "Take s&creenshot" -msgstr "Desar imatge de &pantalla" +msgstr "Desa captura de &pantalla" msgid "S&ound" msgstr "S&o" @@ -217,16 +217,16 @@ msgid "&Preferences…" msgstr "&Preferències…" msgid "Enable &Discord integration" -msgstr "Activar integració amb D&iscord" +msgstr "Activa integració amb D&iscord" msgid "Sound &gain…" msgstr "&Guany de so…" msgid "Begin trace" -msgstr "Iniciar el rastreig" +msgstr "Inicia el rastreig" msgid "End trace" -msgstr "Terminar el rastreig" +msgstr "Acaba el rastreig" msgid "&Help" msgstr "Aj&uda" @@ -247,34 +247,34 @@ msgid "Existing image (&Write-protected)…" msgstr "Imatge existent (&Protegit d'escriptura)…" msgid "&Record" -msgstr "&Enregistrar" +msgstr "&Enregistra" msgid "&Play" -msgstr "&Reproduir" +msgstr "&Reprodueix" msgid "&Rewind to the beginning" -msgstr "&Rebobinar al inici" +msgstr "&Rebobina a l'inici" msgid "&Fast forward to the end" -msgstr "&Avanç ràpid al final" +msgstr "&Avança ràpid al final" msgid "E&ject" -msgstr "E&xpulsar" +msgstr "E&xpolsa" msgid "&Image…" msgstr "&Imatge…" msgid "E&xport to 86F…" -msgstr "E&xportar a 86F…" +msgstr "E&xporta a 86F…" msgid "&Mute" -msgstr "&Silenciar" +msgstr "&Silencia" msgid "E&mpty" msgstr "&CDROM buit" msgid "Reload previous image" -msgstr "Recarregar imatge prèvia" +msgstr "Recarrega imatge prèvia" msgid "&Folder…" msgstr "&Carpeta…" @@ -289,16 +289,16 @@ msgid "New Image" msgstr "Nova imatge" msgid "Settings" -msgstr "Configuracions" +msgstr "Configuració" msgid "Specify Main Window Dimensions" -msgstr "Especificar dimensions de la finestra principal" +msgstr "Especifica dimensions de la finestra principal" msgid "OK" msgstr "D'acord" msgid "Cancel" -msgstr "Anuŀlació" +msgstr "Anuŀla" msgid "&Default" msgstr "&Per defecte" @@ -313,7 +313,7 @@ msgid "File name:" msgstr "Nom de fitxer:" msgid "Disk size:" -msgstr "Grandària del disc:" +msgstr "Mida del disc:" msgid "RPM mode:" msgstr "Modalitat RPM:" @@ -328,7 +328,7 @@ msgid "Height:" msgstr "Alçada:" msgid "Lock to this size" -msgstr "Fixar a aquesta grandària" +msgstr "Fixa a aquesta grandària" msgid "Machine type:" msgstr "Tipus de màquina:" @@ -337,7 +337,7 @@ msgid "Machine:" msgstr "Màquina:" msgid "Configure" -msgstr "Configurar" +msgstr "Configura" msgid "CPU:" msgstr "Processador:" @@ -364,7 +364,7 @@ msgid "Memory:" msgstr "Memòria:" msgid "Time synchronization" -msgstr "Sincronització de la hora" +msgstr "Sincronització de l'hora" msgid "Disabled" msgstr "Desactivat" @@ -379,7 +379,7 @@ msgid "Dynamic Recompiler" msgstr "Recompilador dinàmic" msgid "CPU frame size" -msgstr "Grandària de blocs del CPU" +msgstr "Mida de blocs de la CPU" msgid "Larger frames (less smooth)" msgstr "Blocs més grans (menys suau)" @@ -418,7 +418,7 @@ msgid "Mouse" msgstr "Ratolí" msgid "Joystick:" -msgstr "Mando:" +msgstr "Comandament:" msgid "Joystick" msgstr "Joystick" @@ -436,22 +436,22 @@ msgid "Joystick 4…" msgstr "Joystick 4…" msgid "Sound card #1:" -msgstr "Targeta de so 1:" +msgstr "Targeta de so núm. 1:" msgid "Sound card #2:" -msgstr "Targeta de so 2:" +msgstr "Targeta de so núm. 2:" msgid "Sound card #3:" -msgstr "Targeta de so 3:" +msgstr "Targeta de so núm. 3:" msgid "Sound card #4:" -msgstr "Targeta de so 4:" +msgstr "Targeta de so núm. 4:" msgid "MIDI Out Device:" msgstr "Dispositiu MIDI de sortida:" msgid "MIDI In Device:" -msgstr "Dispositiu MIDI de entrada:" +msgstr "Dispositiu MIDI d'entrada:" msgid "MIDI Out:" msgstr "Sortida MIDI:" @@ -460,13 +460,13 @@ msgid "Standalone MPU-401" msgstr "MPU-401 independent" msgid "Use FLOAT32 sound" -msgstr "Utilitzar so FLOAT32" +msgstr "Utilitza so FLOAT32" msgid "FM synth driver" msgstr "Manejador de síntesi FM" msgid "Nuked (more accurate)" -msgstr "Nuked (més acurat)" +msgstr "Nuked (més precís)" msgid "YMFM (faster)" msgstr "YMFM (més ràpid)" @@ -496,7 +496,7 @@ msgid "LPT4 Device:" msgstr "Dispositiu LPT4:" msgid "Internal LPT ECP DMA:" -msgstr "DMA de ECP del LPT intern:" +msgstr "DMA de ECP de l'LPT intern:" msgid "Serial port 1" msgstr "Port sèrie 1" @@ -523,10 +523,10 @@ msgid "Parallel port 4" msgstr "Port paralel 4" msgid "Floppy disk controller:" -msgstr "Controlador de disquet:" +msgstr "Controladora de disquets:" msgid "CD-ROM controller:" -msgstr "Controlador de CD-ROM:" +msgstr "Controladora de CD-ROM:" msgid "[ISA16] Tertiary IDE Controller" msgstr "[ISA16] Controlador IDE terciari" @@ -535,31 +535,31 @@ msgid "[ISA16] Quaternary IDE Controller" msgstr "[ISA16] Controlador IDE quaternari" msgid "Hard disk controllers" -msgstr "Controladors de disc dur" +msgstr "Controladores de disc dur" msgid "SCSI controllers" -msgstr "Controladors SCSI" +msgstr "Controladores SCSI" msgid "Controller 1:" -msgstr "Controlador 1:" +msgstr "Controladora 1:" msgid "Controller 2:" -msgstr "Controlador 2:" +msgstr "Controladora 2:" msgid "Controller 3:" -msgstr "Controlador 3:" +msgstr "Controladora 3:" msgid "Controller 4:" -msgstr "Controlador 4:" +msgstr "Controladora 4:" msgid "Cassette" -msgstr "Casset" +msgstr "Cinta" msgid "Hard disks:" msgstr "Discs durs:" msgid "Firmware Version" -msgstr "Versió de firmware" +msgstr "Versió del firmware" msgid "&New…" msgstr "&Nou…" @@ -589,16 +589,16 @@ msgid "Cylinders:" msgstr "Cilindres:" msgid "Size (MB):" -msgstr "Grandària (MB):" +msgstr "Mida (MB):" msgid "Type:" msgstr "Tipus:" msgid "Image Format:" -msgstr "Format de imatge:" +msgstr "Format d'imatge:" msgid "Block Size:" -msgstr "Grandària de bloc:" +msgstr "Mida de bloc:" msgid "Floppy drives:" msgstr "Unitats de disquet:" @@ -634,7 +634,7 @@ msgid "ISA Memory Expansion" msgstr "Expansió de memòria ISA" msgid "ISA ROM Cards" -msgstr "Targetas ROM ISA" +msgstr "Targetes ROM ISA" msgid "Card 1:" msgstr "Targeta 1:" @@ -688,7 +688,7 @@ msgid "Image %1" msgstr "Imatge %1" msgid "86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory." -msgstr "El 86Box no ha pogut trobar cap de imatge ROM utilitzable.\n\nSi us plau, descarregueu un conjunt de ROMs i extraieu-lo al directori \"roms\"." +msgstr "El 86Box no ha pogut trobar cap de imatge ROM utilitzable.\n\nSi us plau, descarregueu un conjunt de ROMs i extraieu-les al directori \"roms\"." msgid "(empty)" msgstr "(buit)" @@ -715,22 +715,22 @@ msgid "Surface images" msgstr "Imatges de superfície" msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." -msgstr "La màquina \"%hs\" no està disponible a causa dels ROMs faltants en el directori roms/machines. Canviant a una màquina disponible." +msgstr "La màquina \"%hs\" no està disponible a causa de les ROMs faltants al directori roms/machines. Canviant a una màquina disponible." msgid "Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card." -msgstr "La tarjeta de vídeo \"%hs\" no està disponible a causa dels ROMs faltants en el directori roms/video. Canviant a una tarjeta de video disponible." +msgstr "La tarjeta de vídeo \"%hs\" no està disponible a causa de les ROMs faltants al directori roms/video. Canviant a una tarjeta de video disponible." msgid "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card." -msgstr "La tarjeta de vídeo 2 \"%hs\" no està disponible a causa dels ROMs faltants en el directori roms/video. Desactivnt a la segona targeta de vídeo." +msgstr "La tarjeta de vídeo 2 \"%hs\" no està disponible a causa de les ROMs faltants al directori roms/video. Desactivant la segona targeta de vídeo." msgid "Device \"%hs\" is not available due to missing ROMs. Ignoring the device." -msgstr "El dispositiu \"%hs\" no està disponible a causa dels ROMs faltants. Ignorant el dispositiu." +msgstr "El dispositiu \"%hs\" no està disponible a causa de les ROMs faltants. Ignorant el dispositiu." msgid "Machine" msgstr "Màquina" msgid "Display" -msgstr "Vídeo" +msgstr "Pantalla" msgid "Input devices" msgstr "Dispositius de entrada" @@ -769,7 +769,7 @@ msgid "Controllers:" msgstr "Controladors:" msgid "Floppy & CD-ROM drives" -msgstr "Disquets i unitates de CD-ROM" +msgstr "Disquets i unitats de CD-ROM" msgid "Other removable devices" msgstr "Altres dispositius extraïbles" @@ -784,10 +784,10 @@ msgid "Click to capture mouse" msgstr "Feu clic per capturar el ratolí" msgid "Press %1 to release mouse" -msgstr "Premeu %1 per soltar el ratolí" +msgstr "Premeu %1 per alliberar el ratolí" msgid "Press %1 or middle button to release mouse" -msgstr "Premeu %1 o bé el botó central per soltar el ratolí" +msgstr "Premeu %1 o bé el botó central per alliberar el ratolí" msgid "Bus" msgstr "Bus" @@ -817,7 +817,7 @@ msgid "Type" msgstr "Tipus" msgid "No PCap devices found" -msgstr "No se trobaren dispositius PCap" +msgstr "No s'ha trobat cap dispositiu PCap" msgid "Invalid PCap device" msgstr "Dispositiu PCap invàlid" @@ -862,16 +862,16 @@ msgid "4-axis, 4-button joystick" msgstr "Joystick de 4 eixos, 4 botons" msgid "2-button gamepad(s)" -msgstr "Maneta(s) de joc de 2 botons" +msgstr "Comandament(s) de joc de 2 botons" msgid "3-button gamepad" -msgstr "Maneta de joc de 3 botons" +msgstr "Comandament de joc de 3 botons" msgid "4-button gamepad" -msgstr "Maneta de joc de 4 botons" +msgstr "Comandament de joc de 4 botons" msgid "6-button gamepad" -msgstr "Maneta de joc de 6 botons" +msgstr "Comandament de joc de 6 botons" msgid "2-button flight yoke" msgstr "Volant d'avió de 2 botons" @@ -925,10 +925,10 @@ msgid "Flux images" msgstr "Imatges de fluix" msgid "Are you sure you want to hard reset the emulated machine?" -msgstr "Segur que voleu fer una reinicialització completa de la màquina emulada?" +msgstr "Esteu segurs de que voleu fer una reinicialització completa de la màquina emulada?" msgid "Are you sure you want to exit 86Box?" -msgstr "Segur que voleu tancar al 86Box?" +msgstr "Esteu segurs de que voleu tancar al 86Box?" msgid "Unable to initialize Ghostscript" msgstr "No fou possible inicialitzar el Ghostscript" @@ -964,13 +964,13 @@ msgid "New machine" msgstr "Nova màquina" msgid "&Check for updates…" -msgstr "&Verifica actualitzacions…" +msgstr "&Comprova actualitzacions…" msgid "Exit" msgstr "Sortir" msgid "No ROMs found" -msgstr "No se trobaren ROMs" +msgstr "No s'han trobat ROMs" msgid "Do you want to save the settings?" msgstr "Voleu desar les configuracions?" @@ -979,40 +979,40 @@ msgid "This will hard reset the emulated machine." msgstr "Això causarà una reinicialització completa de la màquina emulada." msgid "Save" -msgstr "Desar" +msgstr "Desa" msgid "About %1" msgstr "Quant al %1" msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." -msgstr "Un emulador de ordinadors anticos\n\nAutors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, y otros.\n\nAmb contribucions anteriors de Sarah Walker, leilei, JohnElliott, greatpsycho y otros.\n\nPublicat sota la GNU General Public License versió 2 o bé posterior. Veieu LICENSE per més informacions." +msgstr "Un emulador d'ordinadors antics\n\nAutors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, i altres.\n\nAmb contribucions anteriors de Sarah Walker, leilei, JohnElliott, greatpsycho i altres.\n\nPublicat sota la GNU General Public License versió 2 o posterior. Veieu LICENSE per a més informació." msgid "Hardware not available" msgstr "Equip no disponible" msgid "Make sure %1 is installed and that you are on a %1-compatible network connection." -msgstr "Assegureu-vos de que %1 està instalat i de que esteu en una connexió de xarxa compatible amb %1." +msgstr "Assegureu-vos de que %1 està instal·lat i de que esteu en una connexió de xarxa compatible amb %1." msgid "Invalid configuration" msgstr "Configuració invàlida" msgid "%1 is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." -msgstr "%1 és imprescindible per la conversió automàtica de fitxers PostScript a PDF.\n\nQualsevol document enviat a la impressora genèrica PostScript se desarà com ara fitxer PostScript (.ps)." +msgstr "%1 és imprescindible per la conversió automàtica de fitxers PostScript a PDF.\n\nQualsevol document enviat a la impressora genèrica PostScript es desarà com a fitxer PostScript (.ps)." msgid "%1 is required for automatic conversion of PCL files to PDF.\n\nAny documents sent to the generic PCL printer will be saved as Printer Command Language (.pcl) files." -msgstr "%1 és imprescindible per la conversió automàtica de fitxers PCL a PDF.\n\nQualsevol document enviat a la impressora genèrica PCL se desarà com ara fitxer Printer Command Language (.pcl)." +msgstr "%1 és imprescindible per la conversió automàtica de fitxers PCL a PDF.\n\nQualsevol document enviat a la impressora genèrica PCL es desarà com a fitxer Printer Command Language (.pcl)." msgid "Don't show this message again" -msgstr "No tornar a mostrar aquest missatge" +msgstr "No tornis a mostrar aquest missatge" msgid "Don't exit" msgstr "No sortir" msgid "Reset" -msgstr "Reinicialitzar" +msgstr "Reinicialitza" msgid "Don't reset" -msgstr "No reinicialitzar" +msgstr "No reinicialitzis" msgid "CD-ROM images" msgstr "Imatges de CD-ROM" @@ -1021,7 +1021,7 @@ msgid "%1 Device Configuration" msgstr "Configuració de dispositiu %1" msgid "Monitor in sleep mode" -msgstr "Monitor en modalitat de dormida" +msgstr "Monitor en suspens" msgid "GLSL shaders" msgstr "Shaders GLSL" @@ -1030,19 +1030,19 @@ msgid "You are loading an unsupported configuration" msgstr "Esteu carregant una configuració no suportada" msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." -msgstr "La filtració de tipus CPU basat en màquina seleccionada està desactivat per a aquesta màquina.\n\nAixò fa possible seleccionar una CPU que sigui incompatible amb aquesta màquina. Tanmateix, poden aparèixerr incompatibilitats amb la BIOS de la màquina o altres programes.\n\nActivar esta configuració no està oficialment suportat i qualsevol report de error pot ésser tancat com ara invàlid." +msgstr "La filtració del tipus de CPU basat en la màquina sel·leccionada està desactivada per a aquesta màquina.\n\nAixò fa possible sel·leccionar una CPU que sigui incompatible amb aquesta màquina. Tanmateix, poden aparèixer incompatibilitats amb la BIOS de la màquina o altres programes.\n\nActivar esta configuració no està oficialment suportat i qualsevol report de error pot ser tancat com a invàlid." msgid "Continue" -msgstr "Continuar" +msgstr "Continua" msgid "Cassette: %1" -msgstr "Casset: %1" +msgstr "Cinta: %1" msgid "C&assette: %1" -msgstr "C&asset: %1" +msgstr "C&inta: %1" msgid "Cassette images" -msgstr "Imatges de casset" +msgstr "Imatges de cinta" msgid "Cartridge %1: %2" msgstr "Cartutx %1: %2" @@ -1075,13 +1075,13 @@ msgid "Force shutdown" msgstr "Apagada forçada" msgid "Start" -msgstr "Iniciar" +msgstr "Inicia" msgid "&Force shutdown" msgstr "&Apagada forçada" msgid "&Start" -msgstr "&Iniciar" +msgstr "&Inicir" msgid "Not running" msgstr "No en execució" @@ -1114,7 +1114,7 @@ msgid "VMs: %1" msgstr "MV: %1" msgid "System Directory:" -msgstr "Directori de sistema:" +msgstr "Directori del sistema:" msgid "Choose directory" msgstr "Escollir directori" @@ -1132,10 +1132,10 @@ msgid "Unable to open the selected configuration file for reading: %1" msgstr "No fou possible obrir el fitxer de configuració seleccionat per llegir: %1" msgid "Use regular expressions in search box" -msgstr "Utilitzar expressions regulars en la caixa de cerca" +msgstr "Utilitzeu expressions regulars a la caixa de cerca" msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 màquina(es) són actives en aquest moment. Segur que voleu sortir del administrador de MV?" +msgstr "%1 màquina(es) són actives en aquest moment. Segur que voleu sortir de l'administrador de MV?" msgid "Add new system wizard" msgstr "Auxiliar d'addició de un nou sistema" @@ -1156,19 +1156,19 @@ msgid "The wizard will now launch the configuration for the new system." msgstr "L'auxiliar ara executarà la configuració pel nou sistema." msgid "Use existing configuration" -msgstr "Utilitzar configuració existent" +msgstr "Utilitza una configuració existent" msgid "Type some notes here" -msgstr "Escriure algunes notes aquí" +msgstr "Escriviu algunes notes aquí" msgid "Paste the contents of the existing configuration file into the box below." -msgstr "Enganxar el contingut del fitxer de configuració existent en la caixa que de sota." +msgstr "Enganxa el contingut del fitxer de configuració existent en la caixa de sota." msgid "Load configuration from file" -msgstr "Carregar la configuració a partir d'un fitxer" +msgstr "Carrega la configuració a partir d'un fitxer" msgid "System name" -msgstr "Nomb del sistema" +msgstr "Nom del sistema" msgid "System name:" msgstr "Nom del sistema:" @@ -1186,7 +1186,7 @@ msgid "Directory does not exist" msgstr "El directori no existeix" msgid "A new directory for the system will be created in the selected directory above" -msgstr "Un nou directour per el sistema serà criat en el directori escollit a dalt" +msgstr "Un nou directori per al sistema serà creat en el directori escollit a dalt" msgid "System location:" msgstr "Ubicació del sistema:" @@ -1216,25 +1216,25 @@ msgid "Enter the new display name (blank to reset)" msgstr "Escriviu el nou nom mostrat (buit per restablir)" msgid "Change &display name…" -msgstr "Canviar nom &mostrat…" +msgstr "Canvia nom &mostrat…" msgid "Context Menu" msgstr "Menú de context" msgid "&Open folder…" -msgstr "&Obrir carpeta…" +msgstr "&Obre carpeta…" msgid "Open p&rinter tray…" -msgstr "Obrir safata de la &impressora…" +msgstr "Obre safata de la &impressora…" msgid "Set &icon…" -msgstr "Establir &icona…" +msgstr "Estableix &icona…" msgid "Select an icon" -msgstr "Escollir una icona" +msgstr "Tria una icona" msgid "C&lone…" -msgstr "C&lonar…" +msgstr "C&lona…" msgid "Virtual machine \"%1\" (%2) will be cloned into:" msgstr "La màquina virtual \"%1\" (%2) serà clonada a:" @@ -1246,10 +1246,10 @@ msgid "You cannot use the following characters in the name: %1" msgstr "No es pot utilitzar els seguints caràcters en el nom: %1" msgid "Clone" -msgstr "Clonar" +msgstr "Clona" msgid "Failed to create directory for cloned VM" -msgstr "Error en criar el directori per la MV clonada" +msgstr "Error en crear el directori per a la MV clonada" msgid "Failed to clone VM." msgstr "Error en clonar la VM." @@ -1261,10 +1261,10 @@ msgid "The selected directory is already in use. Please select a different direc msgstr "El directori escollit ja està en ùs. Si us plau, escolliu un altre directori." msgid "Create directory failed" -msgstr "Error en criar el directori" +msgstr "Error en crear el directori" msgid "Unable to create the directory for the new system" -msgstr "No fou possible criar el directori pel nou sistema" +msgstr "No fou possible crear el directori pel nou sistema" msgid "Configuration write failed" msgstr "Error en escriure la configuració" @@ -1279,7 +1279,7 @@ msgid "Remove directory failed" msgstr "Error en suprimir el directori" msgid "Some files in the machine's directory were unable to be deleted. Please delete them manually." -msgstr "No fou possible suprimir alguns fitxers en el directori de la màquina. Si us plau, suprimiu-los manualment." +msgstr "No fou possible suprimir alguns fitxers al directori de la màquina. Si us plau, suprimiu-los manualment." msgid "Build" msgstr "Compilació" @@ -1297,31 +1297,31 @@ msgid "An update to 86Box is available!" msgstr "Una actualització pel 86Box està disponible!" msgid "Warning" -msgstr "Compte" +msgstr "Atenció" msgid "&Kill" -msgstr "&Terminar forçadament" +msgstr "&Finalitza forçosament" msgid "Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?" -msgstr "Terminar forçadament a la màquina virtual pot causar la pèrdua de dades. Només ho feu si el procés del 86Box es blocà.\n\n¿De verdad quiere terminar forzadamente a la máquina virtual \"%1\"?" +msgstr "Finalitzar forçosament la màquina virtual pot causar la pèrdua de dades. Només feu-ho si el procés del 86Box s'ha blocat.\n\n¿Realment voleu finalitzar forçosament la màquina virtual \"%1\"?" msgid "&Delete" msgstr "&Suprimir" msgid "Do you really want to delete the virtual machine \"%1\" and all its files? This action cannot be undone!" -msgstr "Realment voleu suprimir la màquina virtual \"%1\" i tots seus fitxers? Aquesta acció no se pot desfer!" +msgstr "Realment voleu suprimir la màquina virtual \"%1\" i tots els seus fitxers? Aquesta acció no es pot desfer!" msgid "Show &config file" -msgstr "Mostrar fitxer de &configuració" +msgstr "Mostra fitxer de &configuració" msgid "No screenshot" -msgstr "Sense captura de pantalla" +msgstr "Sense captures de pantalla" msgid "Search" -msgstr "Cercar" +msgstr "Cerca" msgid "Searching for VMs…" -msgstr "Cercar per MV…" +msgstr "Cerca per MV…" msgid "Found %1" msgstr "%1 trobada" @@ -1354,7 +1354,7 @@ msgid "Hard disk (%1)" msgstr "Disc dur (%1)" msgid "MFM/RLL or ESDI CD-ROM drives never existed" -msgstr "Mai existiren unitats de CD-ROM MFM/RLL o bé ESDI" +msgstr "Les unitats de CD-ROM MFM/RLL o bé ESDI no han existit" msgid "Custom…" msgstr "Personalitzada…" @@ -1363,10 +1363,10 @@ msgid "Custom (large)…" msgstr "Personalitzada (gran)…" msgid "Add New Hard Disk" -msgstr "Afegir nou disc dur" +msgstr "Afegeix nou disc dur" msgid "Add Existing Hard Disk" -msgstr "Afegir disc dur existent" +msgstr "Afegeix disc dur existent" msgid "HDI disk images cannot be larger than 4 GB." msgstr "Les imatges de disc HDI no poden superar els 4 GB." @@ -1378,28 +1378,28 @@ msgid "Hard disk images" msgstr "Imatges de disc dur" msgid "Unable to read file" -msgstr "No es pogué llegir el fitxer" +msgstr "No s'ha pogut llegir el fitxer" msgid "Unable to write file" -msgstr "No es pogué escriure el fitxer" +msgstr "No s'ha pogut escriure el fitxer" msgid "HDI or HDX images with a sector size other than 512 are not supported." -msgstr "No es suporten les imatges HDI o bé HDX amb una grandària de sector diferent a 512." +msgstr "Les imatges HDI o bé HDX amb una mida de sector diferent a 512 no estan suportades." msgid "Disk image file already exists" msgstr "La imatge de disc ja existeix" msgid "Please specify a valid file name." -msgstr "Si us plau especifiqueu un nomb de fitxer vàlid." +msgstr "Si us plau, especifiqueu un nom de fitxer vàlid." msgid "Disk image created" -msgstr "Imatge de disc criada" +msgstr "Imatge de disc creada" msgid "Make sure the file exists and is readable." msgstr "Assegureu-vos que el fitxer existeix i és llegible." msgid "Make sure the file is being saved to a writable directory." -msgstr "Assegureu-vos que el fitxer es està desant a un directori amb permís de escirptura." +msgstr "Assegureu-vos que el fitxer s'està desant a un directori amb permís de escirptura." msgid "Disk image too large" msgstr "Imatge de disc massa gran" @@ -1408,16 +1408,16 @@ msgid "Remember to partition and format the newly-created drive." msgstr "Recordeu de particionar i formatar la nova unitat." msgid "The selected file will be overwritten. Are you sure you want to use it?" -msgstr "El fitxer escollit serà sobreescrit. Segur que voleu utilitzar-lo?" +msgstr "El fitxer triat se sobreescriurà. Esteu segurs de que voleu utilitzar-lo?" msgid "Unsupported disk image" msgstr "Imatge de disc no suportada" msgid "Overwrite" -msgstr "Sobreescriure" +msgstr "Sobreescriu" msgid "Don't overwrite" -msgstr "No sobreescriure" +msgstr "No sobreescriguis" msgid "Raw image" msgstr "Imatge en brut" @@ -1429,10 +1429,10 @@ msgid "HDX image" msgstr "Imatge HDX" msgid "Fixed-size VHD" -msgstr "VHD de grandària fixa" +msgstr "VHD de mida fixa" msgid "Dynamic-size VHD" -msgstr "VHD de grandària dinàmica" +msgstr "VHD de mida dinàmica" msgid "Differencing VHD" msgstr "VHD diferencial" @@ -1450,10 +1450,10 @@ msgid "HDX image (.hdx)" msgstr "Imatge HDX (.hdx)" msgid "Fixed-size VHD (.vhd)" -msgstr "VHD de grandària fixa (.vhd)" +msgstr "VHD de mida fixa (.vhd)" msgid "Dynamic-size VHD (.vhd)" -msgstr "VHD de grandària dinàmica (.vhd)" +msgstr "VHD de mida dinàmica (.vhd)" msgid "Differencing VHD (.vhd)" msgstr "VHD diferencial (.vhd)" @@ -1471,13 +1471,13 @@ msgid "Select the parent VHD" msgstr "Escolliu el VHD pare" msgid "This could mean that the parent image was modified after the differencing image was created.\n\nIt can also happen if the image files were moved or copied, or by a bug in the program that created this disk.\n\nDo you want to fix the timestamps?" -msgstr "Això podria significar que la imatge pare es va modificar després de que es creés la imatge diferencial.\n\nTambé pot passar si les imatges foren mogudes o copiades, o a causa d'un error en el programa que crià aquest disc.\n\nVoleu corregir els registres de temps?" +msgstr "Això podria significar que la imatge pare es va modificar després de que es creés la imatge diferencial.\n\nTambé pot passar si les imatges han sigut mogudes o copiades, o a causa d'un error all programa que va crear aquest disc.\n\nVoleu corregir les marques de temps?" msgid "Parent and child disk timestamps do not match" -msgstr "Els segells de temps del pare e fill no coincideixen" +msgstr "Les marques de temps del pare e fill no coincideixen" msgid "Could not fix VHD timestamp." -msgstr "No fou possible corregir el segell de temps del VHD." +msgstr "No ha sigut possible corregir la marca de temps del VHD." msgid "CD-ROM %1 (%2): %3" msgstr "CD-ROM %1 (%2): %3" @@ -1504,13 +1504,13 @@ msgid "720 KB" msgstr "720 KB" msgid "1.2 MB" -msgstr "1.2 MB" +msgstr "1,2 MB" msgid "1.25 MB" -msgstr "1.25 MB" +msgstr "1,25 MB" msgid "1.44 MB" -msgstr "1.44 MB" +msgstr "1,44 MB" msgid "DMF (cluster 1024)" msgstr "DMF (clúster 1024)" @@ -1519,52 +1519,52 @@ msgid "DMF (cluster 2048)" msgstr "DMF (clúster 2048)" msgid "2.88 MB" -msgstr "2.88 MB" +msgstr "2,88 MB" msgid "ZIP 100" msgstr "ZIP 100" msgid "3.5\" 128 MB (ISO 10090)" -msgstr "3.5\" 128 MB (ISO 10090)" +msgstr "3,5\" 128 MB (ISO 10090)" msgid "3.5\" 230 MB (ISO 13963)" -msgstr "3.5\" 230 MB (ISO 13963)" +msgstr "3,5\" 230 MB (ISO 13963)" msgid "3.5\" 540 MB (ISO 15498)" -msgstr "3.5\" 540 MB (ISO 15498)" +msgstr "3,5\" 540 MB (ISO 15498)" msgid "3.5\" 640 MB (ISO 15498)" -msgstr "3.5\" 640 MB (ISO 15498)" +msgstr "3,5\" 640 MB (ISO 15498)" msgid "3.5\" 1.3 GB (GigaMO)" -msgstr "3.5\" 1.3 GB (GigaMO)" +msgstr "3,5\" 1.3 GB (GigaMO)" msgid "3.5\" 2.3 GB (GigaMO 2)" -msgstr "3.5\" 2.3 GB (GigaMO 2)" +msgstr "3,5\" 2.3 GB (GigaMO 2)" msgid "5.25\" 600 MB" -msgstr "5.25\" 600 MB" +msgstr "5,25\" 600 MB" msgid "5.25\" 650 MB" -msgstr "5.25\" 650 MB" +msgstr "5,25\" 650 MB" msgid "5.25\" 1 GB" -msgstr "5.25\" 1 GB" +msgstr "5,25\" 1 GB" msgid "5.25\" 1.3 GB" -msgstr "5.25\" 1.3 GB" +msgstr "5,25\" 1.3 GB" msgid "Perfect RPM" msgstr "RPM perfectes" msgid "1% below perfect RPM" -msgstr "1% por sota dels RPM perfectes" +msgstr "1% per sota dels RPM perfectes" msgid "1.5% below perfect RPM" -msgstr "1.5% por sota dels RPM perfectes" +msgstr "1.5% per sota dels RPM perfectes" msgid "2% below perfect RPM" -msgstr "2% por sota dels RPM perfectes" +msgstr "2% per sota dels RPM perfectes" msgid "(System Default)" msgstr "(Per defecte del sistema)" @@ -1576,10 +1576,10 @@ msgid "The network configuration will be switched to the null driver" msgstr "La configuració de xarxa es canviarà al controlador nul" msgid "Mouse sensitivity:" -msgstr "Sensitivitat del ratón:" +msgstr "Sensitivitat del ratolí:" msgid "Select media images from program working directory" -msgstr "Escollir imatges de mitjans del directori de treball del programa" +msgstr "Trieu imatges de mitjans del directori de treball del programa" msgid "PIT mode:" msgstr "Modalitat PIT:" @@ -1591,19 +1591,19 @@ msgid "Slow" msgstr "Lenta" msgid "Fast" -msgstr "Ráàida" +msgstr "Rápida" msgid "&Auto-pause on focus loss" msgstr "Pa&usa automàtica en perdre el focus" msgid "WinBox is no longer supported" -msgstr "El WinBox no és més suportat" +msgstr "El WinBox ja no és suportat" msgid "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behavior will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." -msgstr "El desenvolupament del administrador WinBox s'ha aturat en 2022 per la manca de mantenidors. Com ara dirigim els nostres esforços a fer 86Box encara millor, hem pres la decisió de no més suportar el WinBox com ara administrador.\n\nNo es proporcionaran més actualitzacions a través del WinBox, i podeu trobar un comportament incorrecte si continua en utilitzar-lo amb versions más noves del 86Box. Qualsevol report de error relacionat amb el comportament del WinBox serà tancat com ara invàlid.\n\nAneu a 86box.net per a una llista de altres administradors que podeu utilitzar." +msgstr "El desenvolupament de l'administrador WinBox es va aturar el 2022 per la manca de mantenidors. Com que ara dirigim els nostres esforços a fer 86Box encara millor, hem pres la decisió de no suportar més el WinBox com a administrador.\n\nNo es proporcionaran més actualitzacions a través del WinBox, i podríeu trobar un comportament incorrecte si continua utilitzant amb versions más noves del 86Box. Qualsevol report de error relacionat amb el comportament del WinBox serà tancat com a invàlid.\n\nAneu a 86box.net per a una llista d'altres administradors que podeu utilitzar." msgid "Generate" -msgstr "Generar" +msgstr "Genera" msgid "Joystick configuration" msgstr "Configuració del joystick" @@ -1624,7 +1624,7 @@ msgid "List of MCA devices:" msgstr "Llista de dispositius MCA:" msgid "&Tablet tool" -msgstr "Eine de &taula" +msgstr "Eina de &tauleta" msgid "About &Qt" msgstr "Quant al &Qt" @@ -1636,31 +1636,31 @@ msgid "Show non-&primary monitors" msgstr "Mostrar monitors no prim&aris" msgid "Open screenshots &folder…" -msgstr "Obrir la ca&rpeta de captures…" +msgstr "Obre la ca&rpeta de captures…" msgid "Appl&y fullscreen stretch mode when maximized" -msgstr "&Utilitzar estirament de la pantalla sencera en modalitat maximitzada" +msgstr "&Utilitza estirament de la pantalla sencera en modalitat maximitzada" msgid "&Cursor/Puck" msgstr "&Cursor/Puck" msgid "&Pen" -msgstr "&Bolígraf" +msgstr "&Llapis" msgid "&Host CD/DVD Drive (%1:)" -msgstr "&Unitat de CD/DVD del amfitrió (%1:)" +msgstr "&Unitat de CD/DVD de l'amfitrió (%1:)" msgid "&Connected" msgstr "&Connectat" msgid "Clear image &history" -msgstr "Suprimir &història de imatges" +msgstr "Esborra &historial d'imatges" msgid "Create…" -msgstr "Criar…" +msgstr "Crea…" msgid "Host CD/DVD Drive (%1)" -msgstr "Unitat de CD/DVD del amfitrió (%1)" +msgstr "Unitat de CD/DVD de l'amfitrió (%1)" msgid "Unknown Bus" msgstr "Bus desconegut" @@ -1681,7 +1681,7 @@ msgid "Render behavior" msgstr "Comportament del renderitzador" msgid "Use target framerate:" -msgstr "Utilitzar la freqüència de fotogrames del objectiu:" +msgstr "Utilitza la següent freqüència de fotogrames:" msgid " fps" msgstr " fps" @@ -1696,46 +1696,46 @@ msgid "Shaders" msgstr "Shaders" msgid "Remove" -msgstr "Suprimir" +msgstr "Esborra" msgid "Browse…" -msgstr "Navegació…" +msgstr "Navega…" msgid "Couldn't create OpenGL context." -msgstr "Impossible de criar el context OpenGL." +msgstr "Impossible de crear el context OpenGL." msgid "Couldn't switch to OpenGL context." msgstr "Impossible de canviar al context OpenGL." msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" -msgstr "Es requereix la versió 3.0 o bé més alta del OpenGL. La versió actual és %1.%2" +msgstr "Es requereix la versió 3.0 o superior de l'OpenGL. La versió actual és %1.%2" msgid "Error initializing OpenGL" -msgstr "Error en inicialitzar el OpenGL" +msgstr "Error en inicialitzar l'OpenGL" msgid "\nFalling back to software rendering." msgstr "\nTornant al renderitzat per software." msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" -msgstr "

En escollir imatges de mitjans (CD-ROM, disquet, etc.), el diàleg d'obertura s'iniciarà en el mateix directori que el fitxer de configuració del 86Box. És probable que aquest ajust només farà una diferència en el macOS.

" +msgstr "

En escollir imatges de mitjans (CD-ROM, disquet, etc.), el quadred de diàleg d'obertura s'iniciarà en el mateix directori que el fitxer de configuració del 86Box. És probable que aquest ajust només farà una diferència en el macOS.

" msgid "This machine might have been moved or copied." msgstr "Aquesta màquina pot haver estat moguda o bé copiada." msgid "In order to ensure proper networking functionality, 86Box needs to know if this machine was moved or copied.\n\nSelect \"I Copied It\" if you are not sure." -msgstr "Per garantir la funcionalitat adequada de la xarxa, el 86Box ha de saber si aquesta màquina s'ha mogut o bé copiat.\n\nSi no està segur, escolliu \"La vaig copiar\"." +msgstr "Per garantir la funcionalitat adequada de la xarxa, el 86Box ha de saber si aquesta màquina s'ha mogut o bé copiat.\n\nSi no esteu segurs, escolliu \"La vaig copiar\"." msgid "I Moved It" -msgstr "La vaig moure" +msgstr "L'he moguda" msgid "I Copied It" -msgstr "La vaig copiar" +msgstr "L'he copiada" msgid "86Box Monitor #%1" msgstr "Monitor del 86Box %1" msgid "No MCA devices." -msgstr "Cap de dispositius MCA." +msgstr "Cap dispositiu MCA." msgid "MiB" msgstr "MiB" @@ -1759,7 +1759,7 @@ msgid "Mode:" msgstr "Modalitat:" msgid "Interface:" -msgstr "Interfase:" +msgstr "Interfície:" msgid "Adapter:" msgstr "Adaptador:" @@ -1771,10 +1771,10 @@ msgid "TAP Bridge Device:" msgstr "Dispositiu pont TAP:" msgid "86Box Unit Tester" -msgstr "Comprovador de unitat del 86Box" +msgstr "Comprovador d'unitats del 86Box" msgid "Novell NetWare 2.x Key Card" -msgstr "Targeta de clau del Novell NetWare 2.x" +msgstr "Targeta de clau per al Novell NetWare 2.x" msgid "Serial port passthrough 1" msgstr "Passatge de port sèrie 1" @@ -1864,55 +1864,55 @@ msgid "System MIDI" msgstr "MIDI del sistema" msgid "MIDI Input Device" -msgstr "Dispositiu de entrada MIDI" +msgstr "Dispositiu d'entrada MIDI" msgid "BIOS file" -msgstr "Fitxer del BIOS" +msgstr "Fitxer de la BIOS" msgid "BIOS file (ROM #1)" -msgstr "Fitxer del BIOS (ROM núm. 1)" +msgstr "Fitxer de la BIOS (ROM núm. 1)" msgid "BIOS file (ROM #2)" -msgstr "Fitxer del BIOS (ROM núm. 2)" +msgstr "Fitxer de la BIOS (ROM núm. 2)" msgid "BIOS file (ROM #3)" -msgstr "Fitxer del BIOS (ROM núm. 3)" +msgstr "Fitxer de la BIOS (ROM núm. 3)" msgid "BIOS file (ROM #4)" -msgstr "Fitxer del BIOS (ROM núm. 4)" +msgstr "Fitxer de la BIOS (ROM núm. 4)" msgid "BIOS address" -msgstr "Adreça del BIOS" +msgstr "Adreça de la BIOS" msgid "BIOS address (ROM #1)" -msgstr "Adreça del BIOS (ROM núm. 1)" +msgstr "Adreça de la BIOS (ROM núm. 1)" msgid "BIOS address (ROM #2)" -msgstr "Adreça del BIOS (ROM núm. 2)" +msgstr "Adreça de la BIOS (ROM núm. 2)" msgid "BIOS address (ROM #3)" -msgstr "Adreça del BIOS (ROM núm. 3)" +msgstr "Adreça de la BIOS (ROM núm. 3)" msgid "BIOS address (ROM #4)" -msgstr "Adreça del BIOS (ROM núm. 4)" +msgstr "Adreça de la BIOS (ROM núm. 4)" msgid "Enable BIOS extension ROM Writes" -msgstr "Activar escriptures per al ROM de extensió del BIOS" +msgstr "Activa l'escriptura per a la ROM d'extensió de la BIOS" msgid "Enable BIOS extension ROM Writes (ROM #1)" -msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 1)" +msgstr "Activa l'escriptura per a la ROM d'extensió de la BIOS (ROM núm. 1)" msgid "Enable BIOS extension ROM Writes (ROM #2)" -msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 2)" +msgstr "Activa l'escriptura per a la ROM d'extensió de la BIOS (ROM núm. 2)" msgid "Enable BIOS extension ROM Writes (ROM #3)" -msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 3)" +msgstr "Activa l'escriptura per a la ROM d'extensió de la BIOS (ROM núm. 3)" msgid "Enable BIOS extension ROM Writes (ROM #4)" -msgstr "Activar escriptures per al ROM de extensió del BIOS (ROM núm. 4)" +msgstr "Activa l'escriptura per a la ROM d'extensió de la BIOS (ROM núm. 4)" msgid "Linear framebuffer base" -msgstr "Base del buffer lineal de pantalla" +msgstr "Base del búfer lineal de pantalla" msgid "Address" msgstr "Adreça" @@ -1924,25 +1924,25 @@ msgid "Serial port IRQ" msgstr "IRQ del port sèrie" msgid "Parallel port IRQ" -msgstr "IRQ del port paralel" +msgstr "IRQ del port paral·lel" msgid "Hard disk" msgstr "Disc dur" msgid "BIOS Revision" -msgstr "Revisió del BIOS" +msgstr "Revisió de la BIOS" msgid "BIOS Version" -msgstr "Versió del BIOS" +msgstr "Versió de la BIOS" msgid "BIOS Language" -msgstr "Idioma del BIOS" +msgstr "Idioma de la BIOS" msgid "IBM 5161 Expansion Unit" -msgstr "Unitat de expansió IBM 5161" +msgstr "Unitat d'expansió IBM 5161" msgid "IBM Cassette Basic" -msgstr "BASIC de casset IBM" +msgstr "IBM Basic per a cinta" msgid "Translate 26 -> 17" msgstr "Traduir 26 -> 17" @@ -1951,46 +1951,46 @@ msgid "Language" msgstr "Idioma" msgid "Enable backlight" -msgstr "Activar retroiŀluminació" +msgstr "Activa retroiŀluminació" msgid "Invert colors" -msgstr "Invertir colors" +msgstr "Inverteix colors" msgid "BIOS size" -msgstr "Grandària del BIOS" +msgstr "Mida de la BIOS" msgid "BIOS size (ROM #1)" -msgstr "Grandària del BIOS (ROM núm. 1)" +msgstr "Mida de la BIOS (ROM núm. 1)" msgid "BIOS size (ROM #2)" -msgstr "Grandària del BIOS (ROM núm. 2)" +msgstr "Mida de la BIOS (ROM núm. 2)" msgid "BIOS size (ROM #3)" -msgstr "Grandària del BIOS (ROM núm. 3)" +msgstr "Mida de la BIOS (ROM núm. 3)" msgid "BIOS size (ROM #4)" -msgstr "Grandària del BIOS (ROM núm. 4)" +msgstr "Mida de la BIOS (ROM núm. 4)" msgid "Map C0000-C7FFF as UMB" -msgstr "Mapar C0000-C7FFF com ara UMB" +msgstr "Mapeja C0000-C7FFF com a UMB" msgid "Map C8000-CFFFF as UMB" -msgstr "Mapar C8000-CFFFF com ara UMB" +msgstr "Mapeja C8000-CFFFF com a UMB" msgid "Map D0000-D7FFF as UMB" -msgstr "Mapar D0000-D7FFF com ara UMB" +msgstr "Mapeja D0000-D7FFF com a UMB" msgid "Map D8000-DFFFF as UMB" -msgstr "Mapar D8000-DFFFF com ara UMB" +msgstr "Mapeja D8000-DFFFF com a UMB" msgid "Map E0000-E7FFF as UMB" -msgstr "Mapar E0000-E7FFF com ara UMB" +msgstr "Mapeja E0000-E7FFF com a UMB" msgid "Map E8000-EFFFF as UMB" -msgstr "Mapar E8000-EFFFF com ara UMB" +msgstr "Mapeja E8000-EFFFF com a UMB" msgid "JS9 Jumper (JIM)" -msgstr "Pont JS9 (JIM)" +msgstr "Jumper JS9 (JIM)" msgid "MIDI Output Device" msgstr "Dispositiu de sortida MIDI" @@ -2005,7 +2005,7 @@ msgid "MIDI Clockout" msgstr "Sortida del rellotge MIDI" msgid "Output Gain" -msgstr "Guany de sortida" +msgstr "Guany de la sortida" msgid "Chorus" msgstr "Cor" @@ -2029,7 +2029,7 @@ msgid "Reverb" msgstr "Reverberació" msgid "Reverb Room Size" -msgstr "Mida de l'habitaciò de reverberació" +msgstr "Mida de l'habitació de reverberació" msgid "Reverb Damping" msgstr "Amortiment de reverberació" @@ -2086,13 +2086,13 @@ msgid "MAC Address OUI" msgstr "OUI de la adreça MAC" msgid "Enable BIOS" -msgstr "Activar el BIOS" +msgstr "Activar la BIOS" msgid "Baud Rate" msgstr "Velocitat de transmissió" msgid "TCP/IP listening port" -msgstr "Port de auscultació TCP/IP" +msgstr "Port TCP/IP d'escolta" msgid "Phonebook File" msgstr "Fitxer de llista de contactes" @@ -2104,16 +2104,16 @@ msgid "RAM Address" msgstr "Adreça del RAM" msgid "RAM size" -msgstr "Grandària del RAM" +msgstr "Mida de la RAM" msgid "Initial RAM size" -msgstr "Grandària inicial del RAM" +msgstr "Mida inicial de la RAM" msgid "Serial Number" msgstr "Número de sèrie" msgid "Host ID" -msgstr "ID del amfitrió" +msgstr "ID de l'amfitrió" msgid "FDC Address" msgstr "Adreça del FDC" @@ -2131,28 +2131,28 @@ msgid "Low DMA" msgstr "DMA baix" msgid "Enable Game port" -msgstr "Activar port de joc" +msgstr "Activa port de joystick" msgid "Enable Adlib ports" -msgstr "Activar ports Adlib" +msgstr "Activa ports Adlib" msgid "SID Model" msgstr "Model del SID" msgid "SID Filter Strength" -msgstr "Força del filtre del SID" +msgstr "Força del filtatge del SID" msgid "Surround module" -msgstr "Mòdulo surround" +msgstr "Mòdul surround" msgid "SB Address" -msgstr "Adreça del SB" +msgstr "Adreça de la SB" msgid "Adlib Address" -msgstr "Adreça del Adlib" +msgstr "Adreça de l'Adlib" msgid "Use EEPROM setting" -msgstr "Uitilitzar la configuració del EEPROM" +msgstr "Uitilitza la configuració de l'EEPROM" msgid "WSS IRQ" msgstr "IRQ del WSS" @@ -2170,16 +2170,16 @@ msgid "Onboard RTC" msgstr "RTC integrat" msgid "Not installed" -msgstr "No instalat" +msgstr "No instal·lat" msgid "Enable OPL" -msgstr "Activar OPL" +msgstr "Activa OPL" msgid "Receive MIDI input (MPU-401)" msgstr "Rebre entrada MIDI (MPU-401)" msgid "SB low DMA" -msgstr "DMA baix del SB" +msgstr "DMA baix de la SB" msgid "6CH variant (6-channel)" msgstr "Variant 6CH (6 canals)" @@ -2194,16 +2194,16 @@ msgid "High DMA" msgstr "DMA alt" msgid "Control PC speaker" -msgstr "Controlar el altaveu del PC" +msgstr "Controla l'altaveu del PC" msgid "Memory size" -msgstr "Grandària de memòria" +msgstr "Mida de memòria" msgid "EMU8000 Address" msgstr "Adreça del EMU8000" msgid "IDE Controller" -msgstr "Controlador IDE" +msgstr "Controladora IDE" msgid "Codec" msgstr "Codec" @@ -2212,13 +2212,13 @@ msgid "GUS type" msgstr "Tipus de GUS" msgid "Enable 0x04 \"Exit 86Box\" command" -msgstr "Activar ordre 0x04 \"Sortir de 86Box\"" +msgstr "Activa ordre 0x04 \"Surt de 86Box\"" msgid "Display type" msgstr "Tipus de pantalla" msgid "Composite type" -msgstr "Tipus de pantalla compòsita" +msgstr "Tipus de pantalla composta" msgid "RGB type" msgstr "Tipus de pantalla RGB" @@ -2233,7 +2233,7 @@ msgid "Monitor type" msgstr "Tipus de monitor" msgid "Character set" -msgstr "Conjunt de caracters" +msgstr "Conjunt de caràcters" msgid "XGA type" msgstr "Tipus de XGA" @@ -2248,7 +2248,7 @@ msgid "RAMDAC type" msgstr "Tipus de RAMDAC" msgid "Blend" -msgstr "Mesclar" +msgstr "Mescla" msgid "Font" msgstr "Tipus de lletra" @@ -2260,19 +2260,19 @@ msgid "Video chroma-keying" msgstr "Croma-clau de vídeo" msgid "Dithering" -msgstr "Dithering" +msgstr "Díthering" msgid "Enable NMI for CGA emulation" -msgstr "Activar NMI per a emulació del CGA" +msgstr "Activar NMI per a l'emulació del CGA" msgid "Voodoo type" msgstr "Tipus de Voodoo" msgid "Framebuffer memory size" -msgstr "Grandària de memòria del buffer de pantalla" +msgstr "Mida de memòria del búffer de la pantalla" msgid "Texture memory size" -msgstr "Grandària de memòria de textura" +msgstr "Mida de memòria de textura" msgid "Dither subtraction" msgstr "Subtracció de dither" @@ -2290,7 +2290,7 @@ msgid "Start Address" msgstr "Adreça inicial" msgid "Contiguous Size" -msgstr "Grandària contigua" +msgstr "Mida contígua" msgid "I/O Width" msgstr "Amplada de E/S" @@ -2302,31 +2302,31 @@ msgid "EMS mode" msgstr "Modalitat EMS" msgid "EMS Address" -msgstr "Adreça del EMS" +msgstr "Adreça de l'EMS" msgid "EMS 1 Address" -msgstr "Adreça del EMS 1" +msgstr "Adreça de l'EMS 1" msgid "EMS 2 Address" -msgstr "Adreça del EMS 2" +msgstr "Adreça de l'EMS 2" msgid "EMS Memory Size" -msgstr "Grandària de memòria del EMS" +msgstr "Mida de la memòria EMS" msgid "EMS 1 Memory Size" -msgstr "Grandària de memòria del EMS 1" +msgstr "Mida de la memòria EMS 1" msgid "EMS 2 Memory Size" -msgstr "Grandària de memòria del EMS 2" +msgstr "Mida de la memòria EMS 2" msgid "Enable EMS" -msgstr "Activar EMS" +msgstr "Activa EMS" msgid "Enable EMS 1" -msgstr "Activar EMS 1" +msgstr "Activa EMS 1" msgid "Enable EMS 2" -msgstr "Activar EMS 2" +msgstr "Activa EMS 2" msgid "Address for > 2 MB" msgstr "Adreça per a > 2 MB" @@ -2344,13 +2344,13 @@ msgid "Always at selected speed" msgstr "Sempre a la velocitat escollida" msgid "BIOS setting + Hotkeys (off during POST)" -msgstr "Configuració del BIOS + Tecles de accés ràpid (desactivates durant el POST)" +msgstr "Configuració de la BIOS + Tecles d'accés ràpid (desactivades durant el POST)" msgid "64 KB starting from F0000" msgstr "64 KB a partir de F0000" msgid "128 KB starting from E0000 (address MSB inverted, last 64 KB first)" -msgstr "128 KB a partir de E0000 (MSB de adreça invertit, últimes 64 KB primer)" +msgstr "128 KB a partir d'E0000 (MSB d'adreça invertida, darrers 64 KB primer)" msgid "Sine" msgstr "Sinusoidal" @@ -2362,10 +2362,10 @@ msgid "Linear" msgstr "Lineal" msgid "4th Order" -msgstr "De 4º ordre" +msgstr "De 4t ordre" msgid "7th Order" -msgstr "De 7º ordre" +msgstr "De 7è ordre" msgid "Non-timed (original)" msgstr "No cronometrat (original)" @@ -2407,7 +2407,7 @@ msgid "64 KB" msgstr "64 KB" msgid "Disable BIOS" -msgstr "Desactivar el BIOS" +msgstr "Desactiva la BIOS" msgid "512 KB" msgstr "512 KB" @@ -2446,19 +2446,19 @@ msgid "256 KB" msgstr "256 KB" msgid "Composite" -msgstr "Compòsit" +msgstr "Compost" msgid "True color" -msgstr "Color veritable" +msgstr "Color real" msgid "Old" -msgstr "Vell" +msgstr "Antic" msgid "New" msgstr "Nou" msgid "Color (generic)" -msgstr "Colors (genèric)" +msgstr "Color (genèric)" msgid "Green Monochrome" msgstr "Monocromàtic verd" @@ -2470,10 +2470,10 @@ msgid "Gray Monochrome" msgstr "Monocromàtic gris" msgid "Color (no brown)" -msgstr "Colors (sense marró)" +msgstr "Color (sense marró)" msgid "Color (IBM 5153)" -msgstr "Colors (IBM 5153)" +msgstr "Color (IBM 5153)" msgid "Simple doubling" msgstr "Duplicació simple" @@ -2506,16 +2506,16 @@ msgid "Monochrome (5151/MDA) (amber)" msgstr "Monocromàtic (5151/MDA) (ambre)" msgid "Color 40x25 (5153/CGA)" -msgstr "Colors 40x25 (5153/CGA)" +msgstr "Color 40x25 (5153/CGA)" msgid "Color 80x25 (5153/CGA)" -msgstr "Colors 80x25 (5153/CGA)" +msgstr "Color 80x25 (5153/CGA)" msgid "Enhanced Color - Normal Mode (5154/ECD)" -msgstr "Colors millorat - modalitat normal (5154/ECD)" +msgstr "Color millorat - modalitat normal (5154/ECD)" msgid "Enhanced Color - Enhanced Mode (5154/ECD)" -msgstr "Colors millorat - modalitat millorada (5154/ECD)" +msgstr "Color millorat - modalitat millorada (5154/ECD)" msgid "Green" msgstr "Verd" @@ -2530,7 +2530,7 @@ msgid "Grayscale" msgstr "Escala de grisos" msgid "Color" -msgstr "Colors" +msgstr "Color" msgid "U.S. English" msgstr "Anglès dels EUA" @@ -2545,7 +2545,7 @@ msgid "Bochs latest" msgstr "Bochs més nou" msgid "Apply overscan deltas" -msgstr "Aplicar deltes del overscan" +msgstr "Aplicar deltes de l'overscan" msgid "Mono Interlaced" msgstr "Monocromàtic entrallaçat" @@ -2554,10 +2554,10 @@ msgid "Mono Non-Interlaced" msgstr "Monocromàtic no entrallaçat" msgid "Color Interlaced" -msgstr "Colors entrallaçat" +msgstr "Color entrallaçat" msgid "Color Non-Interlaced" -msgstr "Colors no entrallaçat" +msgstr "Color no entrallaçat" msgid "3Dfx Voodoo Graphics" msgstr "Gràfics 3dfx Voodoo" @@ -2590,7 +2590,7 @@ msgid "High-Speed" msgstr "Alta velocitat" msgid "Stereo LPT DAC" -msgstr "DAC LPT estéreo" +msgstr "DAC LPT estèreo" msgid "Generic Text Printer" msgstr "Impressora genèrica de text" @@ -2605,7 +2605,7 @@ msgid "Generic PCL5e Printer" msgstr "Impresora genèrica PCL5e" msgid "Parallel Line Internet Protocol" -msgstr "Protocol de Internet de línia paralela" +msgstr "Protocol d'Internet de línia paralela" msgid "Protection Dongle for Savage Quest" msgstr "Dongle de protecció per a Savage Quest" @@ -2626,7 +2626,7 @@ msgid "Data bits" msgstr "Bits de dades" msgid "Stop bits" -msgstr "Bits de parada" +msgstr "Bits d'aturada" msgid "Baud Rate of Passthrough" msgstr "Velocitat de transmissió de passatge" @@ -2638,13 +2638,13 @@ msgid "Named Pipe (Client)" msgstr "Conducta anomenada (client)" msgid "Host Serial Passthrough" -msgstr "Passatge del port sèrie del amfitrió" +msgstr "Passatge del port sèrie de l'amfitrió" msgid "E&ject %1" -msgstr "E&xpulsar %1" +msgstr "E&xpulsa %1" msgid "&Unmute" -msgstr "&Reactivar so" +msgstr "&Reactiva so" msgid "Softfloat FPU" msgstr "FPU Softfloat" @@ -2704,13 +2704,13 @@ msgid "Inhibit multimedia keys" msgstr "Inhibir tecles multimèdia" msgid "Ask for confirmation before saving settings" -msgstr "Demanar confirmació abans de desar la configuració" +msgstr "Demana confirmació abans de desar la configuració" msgid "Ask for confirmation before hard resetting" -msgstr "Demanar confirmació abans de la reiniciació completa" +msgstr "Demana confirmació abans de la reiniciació completa" msgid "Ask for confirmation before quitting" -msgstr "Demanar confirmació abans de sortir" +msgstr "Demana confirmació abans de sortir" msgid "Options" msgstr "Opcions" @@ -2746,7 +2746,7 @@ msgid "Shader Configuration" msgstr "Configuració de shaders" msgid "Add" -msgstr "Afegir" +msgstr "Afegeix" msgid "Move up" msgstr "Moure cap amunt" @@ -2767,16 +2767,16 @@ msgid "Keybind" msgstr "Drecera" msgid "Clear binding" -msgstr "Escorrar drecera" +msgstr "Esborra drecera" msgid "Bind" -msgstr "Vincular" +msgstr "Vincula" msgid "Bind Key" -msgstr "Vincular tecla" +msgstr "Vincula tecla" msgid "Enter key combo:" -msgstr "Escriure combinació de tecles:" +msgstr "Escriviu combinació de tecles:" msgid "Bind conflict" msgstr "Conflicte entre dreceres" @@ -2785,28 +2785,28 @@ msgid "This key combo is already in use." msgstr "Aquesta combinació de tecles ja està en ús." msgid "Send Control+Alt+Del" -msgstr "Enviar Control+Alt+Del" +msgstr "Envia Control+Alt+Supr" msgid "Send Control+Alt+Escape" -msgstr "Enviar Control+Alt+Escape" +msgstr "Envia Control+Alt+Esc" msgid "Toggle fullscreen" msgstr "Alternar pantalla completa" msgid "Toggle UI in fullscreen" -msgstr "Alternar interfase de usuari en modalitat de pantalla completa" +msgstr "Alternar interfície d'usuari en modalitat de pantalla completa" msgid "Screenshot" msgstr "Captura de pantalla" msgid "Release mouse pointer" -msgstr "Soltar el punter del ratolí" +msgstr "Allibera el punter del ratolí" msgid "Toggle pause" -msgstr "Alternar pausa" +msgstr "Alterna pausa" msgid "Toggle mute" -msgstr "Alternar silenci" +msgstr "Alterna silenci" msgid "Text files" msgstr "Fitxers de text" @@ -2830,7 +2830,7 @@ msgid "Hub Mode" msgstr "Modalitat de concentrador" msgid "Hostname:" -msgstr "Nombre del amfitrió:" +msgstr "Nom de l'amfitrió:" msgid "ISA RAM:" msgstr "RAM ISA:" @@ -2839,19 +2839,19 @@ msgid "ISA ROM:" msgstr "ROM ISA:" msgid "&Wipe NVRAM" -msgstr "&Esborrar el NVRAM" +msgstr "&Esborra la NVRAM" msgid "This will delete all NVRAM (and related) files of the virtual machine located in the \"nvr\" subdirectory. You'll have to reconfigure the BIOS (and possibly other devices inside the VM) settings again if applicable.\n\nAre you sure you want to wipe all NVRAM contents of the virtual machine \"%1\"?" -msgstr "Això suprimirà tots els fitxers de NVRAM (i relacionats) de la màquina virtual situats al subdirectori \"nvr\". Haureu de tornar a reconfigurar la configuració del BIOS (i potser de altres dispositius a l'interior de la MV) si s'escau.\n\nSegur que voleu suprimir tots els continguts de la NVRAM de la màquina virtual \"%1\"?" +msgstr "Això suprimirà tots els fitxers NVRAM (i relacionats) de la màquina virtual situats al subdirectori \"nvr\". Haureu de tornar a reconfigurar la configuració de la BIOS (i potser d'altres dispositius a l'interior de la MV) si s'escau.\n\nEsteu segurs que voleu esborrar tot el contingut de la NVRAM de la màquina virtual \"%1\"?" msgid "Success" -msgstr "Èxito" +msgstr "Èxit" msgid "Successfully wiped the NVRAM contents of the virtual machine \"%1\"" -msgstr "Els continguts de la NVRAM de la màquina virtual \"%1\" s'han esborrat amb èxit" +msgstr "El contingut de la NVRAM de la màquina virtual \"%1\" s'ha esborrat amb èxit" msgid "An error occurred trying to wipe the NVRAM contents of the virtual machine \"%1\"" -msgstr "S'ha produït un error en intentar esborrar els continguts de la NVRAM de la màquina virtual \"%1\"" +msgstr "S'ha produït un error en intentar esborrar el contingut de la NVRAM de la màquina virtual \"%1\"" msgid "%1 VM Manager" msgstr "Administrador de MV de %1" @@ -2866,16 +2866,16 @@ msgid "No Machines Found!" msgstr "No s'han trobat màquines!" msgid "Check for updates on startup" -msgstr "Verificar actualitzacions en iniciar" +msgstr "Comprova actualitzacions en iniciar" msgid "Unable to determine release information" -msgstr "No fou possible determinar informacions de la versió" +msgstr "No fou possible determinar la informació de la versió" msgid "There was an error checking for updates:\n\n%1\n\nPlease try again later." -msgstr "S'ha produït un error en verificar actualitzacions:\n\n%1\n\nSi us plau, torneu a intentar més tard." +msgstr "S'ha produït un error en verificar actualitzacions:\n\n%1\n\nSi us plau, torneu a intentar-ho més tard." msgid "Update check complete" -msgstr "Verificació de actualitzacions completada" +msgstr "Verificació de actualitzacions finalitzada" msgid "stable" msgstr "estable" @@ -2884,7 +2884,7 @@ msgid "beta" msgstr "beta" msgid "You are running the latest %1 version of 86Box: %2" -msgstr "Està executant la última versió %1 del 86Box: %2" +msgstr "Esteu executant l'última versió %1 del 86Box: %2" msgid "version" msgstr "versió" @@ -2893,22 +2893,22 @@ msgid "build" msgstr "compilació" msgid "You are currently running version %1." -msgstr "Actualment està a executar la versió %1." +msgstr "Actualment esteu executant la versió %1." msgid "Version %1 is now available." -msgstr "La versió %1 és ara disponible." +msgstr "La versió %1 ja és disponible." msgid "You are currently running build %1." -msgstr "Actualment está a executar la compialació %1." +msgstr "Actualment esteu executant la compialació %1." msgid "Build %1 is now available." -msgstr "La compilació %1 és ara disponible." +msgstr "La compilació %1 ja és disponible." msgid "Would you like to visit the download page?" -msgstr "Voleu visitar a la pàgina de descàrregas?" +msgstr "Voleu visitar la pàgina de descàrregues?" msgid "Visit download page" -msgstr "Visitar a la pàgina de descarregas" +msgstr "Visita la pàgina de descàrregues" msgid "Update check" msgstr "Verificació de actualitzacions" @@ -2926,16 +2926,16 @@ msgid "%1 Hz" msgstr "%1 Hz" msgid "Virtual machine crash" -msgstr "Terminació inesperada de la màquina virtual" +msgstr "Finalització inesperada de la màquina virtual" msgid "The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2." -msgstr "El procés de la màquina virtual \"%1\" s'ha terminat inesperadament amb con el codi de sortida %2." +msgstr "El procés de la màquina virtual \"%1\" s'ha finalitzat inesperadament amb con el codi de sortida %2." msgid "The system will not be added." msgstr "El sistema no serà afegit." msgid "&Update mouse every CPU frame" -msgstr "&Actualitza el estat del ratolí a cada bloc del CPU" +msgstr "&Actualitza l'estat del ratolí a cada bloc del CPU" msgid "Hue" msgstr "Matís" @@ -2962,19 +2962,19 @@ msgid "Monitor EDID" msgstr "EDID del monitor" msgid "Export…" -msgstr "Exportar…" +msgstr "Exporta…" msgid "Export EDID" -msgstr "Exportar el EDID" +msgstr "Exporta l'EDID" msgid "EDID file \"%ls\" is too large." -msgstr "El fitxer EDID \"%ls\" es massa gran." +msgstr "El fitxer EDID \"%ls\" és massa gran." msgid "OpenGL input scale" -msgstr "Escala de entrada del OpenGL" +msgstr "Escala de entrada de l'OpenGL" msgid "OpenGL input stretch mode" -msgstr "Modalitat de estirament de entrada del OpenGL" +msgstr "Modalitat de estirament de entrada de l'OpenGL" msgid "Color scheme" msgstr "Esquema de colors" @@ -2986,16 +2986,16 @@ msgid "Dark" msgstr "Fosc" msgid "Search:" -msgstr "Cercar:" +msgstr "Cerca:" msgid "Force interpretation" -msgstr "Forçar interpretació" +msgstr "Força interpretació" msgid "Allow recompilation" msgstr "Permetre recompilació" msgid "&Force interpretation" -msgstr "&Forçar interpretació" +msgstr "&Força interpretació" msgid "&Allow recompilation" msgstr "&Permetre recompilació" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index e99f2431bd8..31fb803592f 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -991,7 +991,7 @@ msgid "Hardware not available" msgstr "Equipo no disponible" msgid "Make sure %1 is installed and that you are on a %1-compatible network connection." -msgstr "Asegúrate de que %1 está instalado y de que estás en una conexión de red compatible con %1." +msgstr "Asegúree de que %1 está instalado y de que estás en una conexión de red compatible con %1." msgid "Invalid configuration" msgstr "Configuración inválida" @@ -1018,7 +1018,7 @@ msgid "CD-ROM images" msgstr "Imágenes de CD-ROM" msgid "%1 Device Configuration" -msgstr "%1 configuración de dispositivo" +msgstr "Configuración de dispositivo %1" msgid "Monitor in sleep mode" msgstr "Monitor en modo ahorro" From 46520dc16aecea1325a68e712142b6c42d94982b Mon Sep 17 00:00:00 2001 From: RSX798 Date: Mon, 22 Dec 2025 16:37:37 +0800 Subject: [PATCH 133/320] Update es-ES.po --- src/qt/languages/es-ES.po | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 31fb803592f..53bd643b2c5 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -166,13 +166,13 @@ msgid "Generic RGBI color monitor" msgstr "Monitor a colores RGBI genérico" msgid "&Amber monitor" -msgstr "Monitor Ámb&ar" +msgstr "Monitor ámb&ar" msgid "&Green monitor" -msgstr "Monitor &Verde" +msgstr "Monitor &verde" msgid "&White monitor" -msgstr "Monitor &Blanco" +msgstr "Monitor &blanco" msgid "Grayscale &conversion type" msgstr "&Conversión a grises" @@ -283,10 +283,10 @@ msgid "Preferences" msgstr "Preferencias" msgid "Sound Gain" -msgstr "Ganancia de Sonido" +msgstr "Ganancia de sonido" msgid "New Image" -msgstr "Nueva Imagen" +msgstr "Nueva imagen" msgid "Settings" msgstr "Configuraciones" @@ -754,10 +754,10 @@ msgid "Parallel ports:" msgstr "Puertos paralelos:" msgid "Storage controllers" -msgstr "Controladoras de Almacenamiento" +msgstr "Controladoras de almacenamiento" msgid "Hard disks" -msgstr "Discos Duros" +msgstr "Discos duros" msgid "Disks:" msgstr "Discos:" @@ -1192,7 +1192,7 @@ msgid "System location:" msgstr "Ubicación del sistema:" msgid "System name and location" -msgstr "Nombre y ubicaciónd el sistema" +msgstr "Nombre y ubicación del sistema" msgid "Enter the name of the system and choose the location" msgstr "Escribir el nombre del sistema y escoger la ubicación" @@ -1363,10 +1363,10 @@ msgid "Custom (large)…" msgstr "A medida (grande)…" msgid "Add New Hard Disk" -msgstr "Añadir Nuevo Disco Duro" +msgstr "Añadir nuevo disco duro" msgid "Add Existing Hard Disk" -msgstr "Añadir Disco Duro Existente" +msgstr "Añadir disco duro existente" msgid "HDI disk images cannot be larger than 4 GB." msgstr "Las imágenes de disco HDI no pueden superar los 4 GB." @@ -1375,7 +1375,7 @@ msgid "Disk images cannot be larger than 127 GB." msgstr "Las imágenes de disco no pueden superar los 127 GB." msgid "Hard disk images" -msgstr "Imágenes de Disco Duro" +msgstr "Imágenes de disco duro" msgid "Unable to read file" msgstr "No se pudo leer el archivo" From f6f518eacc7b5120d26bad129caedeebe55de019 Mon Sep 17 00:00:00 2001 From: Mike Swanson Date: Mon, 22 Dec 2025 00:54:50 -0800 Subject: [PATCH 134/320] Use lock emoji to indicate write-protected recent disk images. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes the menu look a little more visually distinct and obvious when a recent disk image item is set to write-protected mode. While an icon does exist, I have found it to be small and visually indistinguisable enough that I didn't even know it existed before I dug into the code. This prefixes image names with U+1F512 LOCK (🔒). My first iteration also added U+1F513 OPEN LOCK (🔓) to read-write image names, but I quickly found that to be too visually distracting and confusing next to the write-protect symbols, so I have opted to only keep the first one. This might have a caveat that the symbol will fail to show up on systems without the lock emoji somewhere in their font set, but these days, I expect pretty much everyone to be on OSes that come with the full set of emoji fonts anyhow. --- src/qt/qt_mediamenu.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index b2dcf9c40af..c5611ec2ee5 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -668,7 +668,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) else fi.setFile(fn); if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) { - menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5); + menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : "🔒 " + fn.right(fn.length() - 5); imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected)); } else { menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn; @@ -696,7 +696,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) else fi.setFile(fn); if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) { - menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5); + menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : "🔒 " + fn.right(fn.length() - 5); imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected)); } else { menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn; @@ -735,7 +735,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) else fi.setFile(fn); if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) { - menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5); + menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : "🔒 " + fn.right(fn.length() - 5); imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected)); } else { menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn; @@ -754,7 +754,7 @@ MediaMenu::updateImageHistory(int index, int slot, ui::MediaType type) else fi.setFile(fn); if (!fi.fileName().isEmpty() && (fn.left(5) == "wp://")) { - menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn.right(fn.length() - 5); + menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : "🔒 " + fn.right(fn.length() - 5); imageHistoryUpdatePos->setIcon(getIconWithIndicator(menu_icon, pixmap_size, QIcon::Normal, WriteProtected)); } else { menu_item_name = fi.fileName().isEmpty() ? tr("Reload previous image") : fn; From 0092ce15de3efac108b961882f870a8c05e8c38f Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 22 Dec 2025 22:56:10 +0100 Subject: [PATCH 135/320] Only make the fallthrough define available in C code, fixes #6607. --- src/include/86box/plat.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index dcf7e4d5306..cbc348709ec 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -90,16 +90,12 @@ extern int strnicmp(const char *s1, const char *s2, size_t n); # include # define atomic_flag_t std::atomic_flag # define atomic_bool_t std::atomic_bool + extern "C" { #else # include # define atomic_flag_t atomic_flag # define atomic_bool_t atomic_bool -#endif - -#if defined(_MSC_VER) -# define ssize_t intptr_t -#endif #ifdef _MSC_VER # define fallthrough do {} while (0) /* fallthrough */ @@ -114,6 +110,12 @@ extern "C" { # endif #endif +#endif + +#if defined(_MSC_VER) +# define ssize_t intptr_t +#endif + /* Global variables residing in the platform module. */ extern int dopause; /* system is paused */ extern int mouse_capture; /* mouse is captured in app */ From d95d0d0b59de5881aa11d6e8524790820e4182e6 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 22 Dec 2025 23:00:02 +0100 Subject: [PATCH 136/320] Manager: Reorder the toolbar buttons to match the buttons below. --- src/qt/qt_vmmanager_mainwindow.ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index fbaeecf0ff0..a33893ee3cb 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -94,11 +94,11 @@ - + + - From 11976adced0e45c12c16665c8ea678c101038685 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Mon, 22 Dec 2025 22:29:35 +0000 Subject: [PATCH 137/320] remove remaining msvc check --- src/include/86box/plat.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index cbc348709ec..7b2f0c12fd0 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -112,10 +112,6 @@ extern "C" { #endif -#if defined(_MSC_VER) -# define ssize_t intptr_t -#endif - /* Global variables residing in the platform module. */ extern int dopause; /* system is paused */ extern int mouse_capture; /* mouse is captured in app */ From 0055af732ada9617894ec568a259a73afa2463c5 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 22 Dec 2025 23:33:56 +0100 Subject: [PATCH 138/320] Increase MAX_IMAGE_PATH_LEN to 4096 bytes (to fix that config.c warning) and make sure all file name arrays are of that length (no more hardcoded 512 or 1024). --- src/device/cartridge.c | 2 +- src/device/cassette.c | 2 +- src/floppy/fdd.c | 2 +- src/include/86box/86box.h | 2 +- src/include/86box/cartridge.h | 2 +- src/include/86box/cassette.h | 2 +- src/include/86box/cdrom.h | 4 ++-- src/include/86box/fdd.h | 2 +- src/include/86box/hdd.h | 2 +- src/include/86box/mo.h | 4 ++-- src/include/86box/rdisk.h | 4 ++-- src/machine/m_elt.c | 2 +- src/qt/qt_harddrive_common.cpp | 1 + src/qt/qt_machinestatus.cpp | 2 +- src/qt/qt_settings_bus_tracking.cpp | 4 ++++ src/qt/qt_settingsotherremovable.cpp | 1 + 16 files changed, 22 insertions(+), 16 deletions(-) diff --git a/src/device/cartridge.c b/src/device/cartridge.c index 639095f72d2..bbcbad6619a 100644 --- a/src/device/cartridge.c +++ b/src/device/cartridge.c @@ -33,7 +33,7 @@ typedef struct cart_t { uint32_t base; } cart_t; -char cart_fns[2][512]; +char cart_fns[2][MAX_IMAGE_PATH_LEN]; char *cart_image_history[2][CART_IMAGE_HISTORY]; static cart_t carts[2]; diff --git a/src/device/cassette.c b/src/device/cassette.c index 0577ae06fe4..b2d8f7a1cd4 100644 --- a/src/device/cassette.c +++ b/src/device/cassette.c @@ -43,7 +43,7 @@ pc_cassette_t *cassette; -char cassette_fname[512]; +char cassette_fname[MAX_IMAGE_PATH_LEN]; char cassette_mode[512]; char * cassette_image_history[CASSETTE_IMAGE_HISTORY]; unsigned long cassette_pos; diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 35676258cfd..14627a3f9e8 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -104,7 +104,7 @@ static fdd_pending_op_t fdd_pending[FDD_NUM]; /* BIOS boot status tracking */ static bios_boot_status_t bios_boot_status = BIOS_BOOT_POST; -char floppyfns[FDD_NUM][512]; +char floppyfns[FDD_NUM][MAX_IMAGE_PATH_LEN]; char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY]; pc_timer_t fdd_poll_time[FDD_NUM]; diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index d9c1055467e..0a6b2461a0f 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -47,7 +47,7 @@ /* Recently used images */ #define MAX_PREV_IMAGES 10 -#define MAX_IMAGE_PATH_LEN 2048 +#define MAX_IMAGE_PATH_LEN 4096 /* Max UUID Length */ #define MAX_UUID_LEN 64 diff --git a/src/include/86box/cartridge.h b/src/include/86box/cartridge.h index 3afe1c3fcf8..66fa34e1a84 100644 --- a/src/include/86box/cartridge.h +++ b/src/include/86box/cartridge.h @@ -21,7 +21,7 @@ extern "C" { #define CART_IMAGE_HISTORY 10 -extern char cart_fns[2][512]; +extern char cart_fns[2][MAX_IMAGE_PATH_LEN]; extern char *cart_image_history[2][CART_IMAGE_HISTORY]; extern void cart_load(int drive, char *fn); diff --git a/src/include/86box/cassette.h b/src/include/86box/cassette.h index dc85bfc269a..82aebeef6a2 100644 --- a/src/include/86box/cassette.h +++ b/src/include/86box/cassette.h @@ -157,7 +157,7 @@ void pc_cas_advance(pc_cassette_t *cas); extern pc_cassette_t *cassette; -extern char cassette_fname[512]; +extern char cassette_fname[MAX_IMAGE_PATH_LEN]; extern char cassette_mode[512]; extern char * cassette_image_history[CASSETTE_IMAGE_HISTORY]; extern unsigned long cassette_pos; diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 82c59ccd64f..4876760239f 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -323,8 +323,8 @@ typedef struct cdrom { void *priv; - char image_path[1024]; - char prev_image_path[1280]; + char image_path[MAX_IMAGE_PATH_LEN]; + char prev_image_path[MAX_IMAGE_PATH_LEN + 256]; uint32_t sound_on; uint32_t cdrom_capacity; diff --git a/src/include/86box/fdd.h b/src/include/86box/fdd.h index ef2a33489f7..5e526ab6dbc 100644 --- a/src/include/86box/fdd.h +++ b/src/include/86box/fdd.h @@ -96,7 +96,7 @@ typedef struct DRIVE { } DRIVE; extern DRIVE drives[FDD_NUM]; -extern char floppyfns[FDD_NUM][512]; +extern char floppyfns[FDD_NUM][MAX_IMAGE_PATH_LEN]; extern char *fdd_image_history[FDD_NUM][FLOPPY_IMAGE_HISTORY]; extern pc_timer_t fdd_poll_time[FDD_NUM]; extern int ui_writeprot[FDD_NUM]; diff --git a/src/include/86box/hdd.h b/src/include/86box/hdd.h index e471cb54e54..88855552b9c 100644 --- a/src/include/86box/hdd.h +++ b/src/include/86box/hdd.h @@ -161,7 +161,7 @@ typedef struct hard_disk_t { void *priv; - char fn[1024]; /* Name of current image file */ + char fn[MAX_IMAGE_PATH_LEN]; /* Name of current image file */ /* Differential VHD parent file */ char vhd_parent[1280]; diff --git a/src/include/86box/mo.h b/src/include/86box/mo.h index 5d48579eba3..53e342ed697 100644 --- a/src/include/86box/mo.h +++ b/src/include/86box/mo.h @@ -113,8 +113,8 @@ typedef struct mo_drive_t { FILE *fp; void *priv; - char image_path[1024]; - char prev_image_path[1024]; + char image_path[MAX_IMAGE_PATH_LEN]; + char prev_image_path[MAX_IMAGE_PATH_LEN + 256]; char *image_history[MO_IMAGE_HISTORY]; diff --git a/src/include/86box/rdisk.h b/src/include/86box/rdisk.h index 6f0255847d1..fff53ec6300 100644 --- a/src/include/86box/rdisk.h +++ b/src/include/86box/rdisk.h @@ -91,8 +91,8 @@ typedef struct rdisk_drive_t { FILE *fp; void *priv; - char image_path[1024]; - char prev_image_path[1024]; + char image_path[MAX_IMAGE_PATH_LEN]; + char prev_image_path[MAX_IMAGE_PATH_LEN + 256]; char *image_history[RDISK_IMAGE_HISTORY]; diff --git a/src/machine/m_elt.c b/src/machine/m_elt.c index b965486d1ae..1f440bad204 100644 --- a/src/machine/m_elt.c +++ b/src/machine/m_elt.c @@ -33,9 +33,9 @@ #include #include #include +#include <86box/86box.h> #include <86box/timer.h> #include <86box/fdd.h> -#include <86box/86box.h> #include <86box/device.h> #include <86box/fdc.h> #include <86box/fdc_ext.h> diff --git a/src/qt/qt_harddrive_common.cpp b/src/qt/qt_harddrive_common.cpp index eb814ebfdd3..7ec75d47d9c 100644 --- a/src/qt/qt_harddrive_common.cpp +++ b/src/qt/qt_harddrive_common.cpp @@ -17,6 +17,7 @@ #include extern "C" { +#include <86box/86box.h> #include <86box/hdd.h> #include <86box/scsi.h> #include <86box/cdrom.h> diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index 2e6203f24d8..e6ab8068815 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -17,9 +17,9 @@ #include "qt_machinestatus.hpp" extern "C" { +#include <86box/86box.h> #include <86box/hdd.h> #include <86box/timer.h> -#include <86box/86box.h> #include <86box/device.h> #include <86box/cartridge.h> #include <86box/cassette.h> diff --git a/src/qt/qt_settings_bus_tracking.cpp b/src/qt/qt_settings_bus_tracking.cpp index aee57da1bdb..77865be7256 100644 --- a/src/qt/qt_settings_bus_tracking.cpp +++ b/src/qt/qt_settings_bus_tracking.cpp @@ -19,9 +19,13 @@ #include #include +extern "C" { +#include "86box/86box.h" #include "86box/hdd.h" #include "86box/scsi.h" #include "86box/cdrom.h" +} + #include "qt_settings_bus_tracking.hpp" SettingsBusTracking::SettingsBusTracking() diff --git a/src/qt/qt_settingsotherremovable.cpp b/src/qt/qt_settingsotherremovable.cpp index 7b3bb89f634..567eaa3e2e0 100644 --- a/src/qt/qt_settingsotherremovable.cpp +++ b/src/qt/qt_settingsotherremovable.cpp @@ -18,6 +18,7 @@ #include "ui_qt_settingsotherremovable.h" extern "C" { +#include <86box/86box.h> #include <86box/timer.h> #include <86box/scsi_device.h> #include <86box/mo.h> From 7860e06f8a3514ce5614e6806e917d091d7ad324 Mon Sep 17 00:00:00 2001 From: starfrost013 Date: Mon, 22 Dec 2025 22:36:15 +0000 Subject: [PATCH 139/320] Remove all non-library _MSC_VER checks --- src/codegen_new/codegen_allocator.c | 4 --- src/cpu/cpu.h | 12 ++++---- src/cpu/x87_ops.h | 30 ++----------------- src/floppy/fdd_pcjs.c | 4 --- src/include/86box/plat.h | 24 ++++----------- src/include/86box/plat_fallthrough.h | 16 +++++----- src/include/86box/plat_unused.h | 7 ++--- src/include/86box/vid_voodoo_codegen_x86-64.h | 6 +--- src/include/86box/vid_voodoo_codegen_x86.h | 6 +--- src/network/network.c | 2 -- src/utils/random.c | 10 ++----- 11 files changed, 26 insertions(+), 95 deletions(-) diff --git a/src/codegen_new/codegen_allocator.c b/src/codegen_new/codegen_allocator.c index 157c3cc0b5a..c3fca66b748 100644 --- a/src/codegen_new/codegen_allocator.c +++ b/src/codegen_new/codegen_allocator.c @@ -192,11 +192,7 @@ codegen_allocator_clean_blocks(UNUSED(struct mem_block_t *block)) { #if defined __ARM_EABI__ || defined __aarch64__ || defined _M_ARM64 while (1) { -# ifndef _MSC_VER __clear_cache(&mem_block_alloc[block->offset], &mem_block_alloc[block->offset + MEM_BLOCK_SIZE]); -# else - FlushInstructionCache(GetCurrentProcess(), &mem_block_alloc[block->offset], MEM_BLOCK_SIZE); -# endif if (block->next) block = &mem_blocks[block->next - 1]; else diff --git a/src/cpu/cpu.h b/src/cpu/cpu.h index 25564082b8c..865e76ffb28 100644 --- a/src/cpu/cpu.h +++ b/src/cpu/cpu.h @@ -446,16 +446,14 @@ typedef struct { # define CPU_STATUS_MASK 0xffff0000 #endif -#ifdef _MSC_VER -# define COMPILE_TIME_ASSERT(expr) /*nada*/ + +#ifdef EXTREME_DEBUG +# define COMPILE_TIME_ASSERT(expr) typedef char COMP_TIME_ASSERT[(expr) ? 1 : 0]; #else -# ifdef EXTREME_DEBUG -# define COMPILE_TIME_ASSERT(expr) typedef char COMP_TIME_ASSERT[(expr) ? 1 : 0]; -# else -# define COMPILE_TIME_ASSERT(expr) /*nada*/ -# endif +# define COMPILE_TIME_ASSERT(expr) /*nada*/ #endif + COMPILE_TIME_ASSERT(sizeof(cpu_state_t) <= 128) #define cpu_state_offset(MEMBER) ((uint8_t) ((uintptr_t) &cpu_state.MEMBER - (uintptr_t) &cpu_state - 128)) diff --git a/src/cpu/x87_ops.h b/src/cpu/x87_ops.h index e581652d498..4d099885a29 100644 --- a/src/cpu/x87_ops.h +++ b/src/cpu/x87_ops.h @@ -33,9 +33,6 @@ #endif #include "x87_timings.h" -#ifdef _MSC_VER -# include -#endif #include "x87_ops_conv.h" #ifdef ENABLE_FPU_LOG @@ -390,8 +387,7 @@ x87_compare(double a, double b) if ((fpu_type < FPU_287XL) && !(cpu_state.npxc & 0x1000) && ((a == INFINITY) || (a == -INFINITY)) && ((b == INFINITY) || (b == -INFINITY))) eb = ea; -# if !defined(_MSC_VER) || defined(__clang__) - /* Memory barrier, to force GCC to write to the input parameters + /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ __asm volatile("" : @@ -406,17 +402,7 @@ x87_compare(double a, double b) "fnstsw %0\n" : "=m"(result) : "m"(ea), "m"(eb)); -# else - _ReadWriteBarrier(); - _asm - { - fld eb - fld ea - fclex - fcompp - fnstsw result - } -# endif + return result & (FPU_SW_C0 | FPU_SW_C2 | FPU_SW_C3); #else @@ -451,7 +437,6 @@ x87_ucompare(double a, double b) #ifdef X87_INLINE_ASM uint32_t result; -# if !defined(_MSC_VER) || defined(__clang__) /* Memory barrier, to force GCC to write to the input parameters * before the compare rather than after */ __asm volatile("" @@ -467,17 +452,6 @@ x87_ucompare(double a, double b) "fnstsw %0\n" : "=m"(result) : "m"(a), "m"(b)); -# else - _ReadWriteBarrier(); - _asm - { - fld b - fld a - fclex - fcompp - fnstsw result - } -# endif return result & (FPU_SW_C0 | FPU_SW_C2 | FPU_SW_C3); #else diff --git a/src/floppy/fdd_pcjs.c b/src/floppy/fdd_pcjs.c index 2193048c6e3..b1494cd383e 100644 --- a/src/floppy/fdd_pcjs.c +++ b/src/floppy/fdd_pcjs.c @@ -18,11 +18,7 @@ #include #include #include -#ifndef _MSC_VER #include -#else -#include -#endif #define HAVE_STDARG_H #include <86box/86box.h> #include <86box/timer.h> diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 7b2f0c12fd0..2d28ec9bc7a 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -69,19 +69,10 @@ extern int strnicmp(const char *s1, const char *s2, size_t n); # define fseeko64 fseeko # define ftello64 ftello # define off64_t off_t -#elif defined(_MSC_VER) -// # define fopen64 fopen -# define fseeko64 _fseeki64 -# define ftello64 _ftelli64 -# define off64_t off_t #endif -#ifdef _MSC_VER -# define UNUSED(arg) arg -#else /* A hack (GCC-specific?) to allow us to ignore unused parameters. */ # define UNUSED(arg) __attribute__((unused)) arg -#endif /* Return the size (in wchar's) of a wchar_t array. */ #define sizeof_w(x) (sizeof((x)) / sizeof(wchar_t)) @@ -97,17 +88,14 @@ extern "C" { # define atomic_flag_t atomic_flag # define atomic_bool_t atomic_bool -#ifdef _MSC_VER -# define fallthrough do {} while (0) /* fallthrough */ + +#if __has_attribute(fallthrough) +# define fallthrough __attribute__((fallthrough)) #else -# if __has_attribute(fallthrough) -# define fallthrough __attribute__((fallthrough)) -# else -# if __has_attribute(__fallthrough__) -# define fallthrough __attribute__((__fallthrough__)) -# endif -# define fallthrough do {} while (0) /* fallthrough */ +# if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) # endif +# define fallthrough do {} while (0) /* fallthrough */ #endif #endif diff --git a/src/include/86box/plat_fallthrough.h b/src/include/86box/plat_fallthrough.h index 2ba0008483b..1221f03fa80 100644 --- a/src/include/86box/plat_fallthrough.h +++ b/src/include/86box/plat_fallthrough.h @@ -16,18 +16,16 @@ #define EMU_PLAT_FALLTHROUGH_H #ifndef EMU_PLAT_H -#ifdef _MSC_VER -# define fallthrough do {} while (0) /* fallthrough */ + +#if __has_attribute(fallthrough) +# define fallthrough __attribute__((fallthrough)) #else -# if __has_attribute(fallthrough) -# define fallthrough __attribute__((fallthrough)) -# else -# if __has_attribute(__fallthrough__) -# define fallthrough __attribute__((__fallthrough__)) -# endif -# define fallthrough do {} while (0) /* fallthrough */ +# if __has_attribute(__fallthrough__) +# define fallthrough __attribute__((__fallthrough__)) # endif +# define fallthrough do {} while (0) /* fallthrough */ #endif + #endif #endif /*EMU_PLAT_FALLTHROUGH_H*/ diff --git a/src/include/86box/plat_unused.h b/src/include/86box/plat_unused.h index 4688a615b1f..4090f3358b9 100644 --- a/src/include/86box/plat_unused.h +++ b/src/include/86box/plat_unused.h @@ -19,12 +19,9 @@ #define EMU_PLAT_UNUSED_H #ifndef EMU_PLAT_H -#ifdef _MSC_VER -# define UNUSED(arg) arg -#else /* A hack (GCC-specific?) to allow us to ignore unused parameters. */ + # define UNUSED(arg) __attribute__((unused)) arg -#endif -#endif +#endif #endif /*EMU_PLAT_UNUSED_H*/ diff --git a/src/include/86box/vid_voodoo_codegen_x86-64.h b/src/include/86box/vid_voodoo_codegen_x86-64.h index 8b1413ad4d7..0e43c15bdc2 100644 --- a/src/include/86box/vid_voodoo_codegen_x86-64.h +++ b/src/include/86box/vid_voodoo_codegen_x86-64.h @@ -8,11 +8,7 @@ #ifndef VIDEO_VOODOO_CODEGEN_X86_64_H #define VIDEO_VOODOO_CODEGEN_X86_64_H -#ifdef _MSC_VER -# include -#else -# include -#endif +#include #define BLOCK_NUM 8 #define BLOCK_MASK (BLOCK_NUM - 1) diff --git a/src/include/86box/vid_voodoo_codegen_x86.h b/src/include/86box/vid_voodoo_codegen_x86.h index 996bd28f1ab..f479a5413e0 100644 --- a/src/include/86box/vid_voodoo_codegen_x86.h +++ b/src/include/86box/vid_voodoo_codegen_x86.h @@ -8,11 +8,7 @@ #ifndef VIDEO_VOODOO_CODEGEN_X86_H #define VIDEO_VOODOO_CODEGEN_X86_H -#ifdef _MSC_VER -# include -#else -# include -#endif +#include #define BLOCK_NUM 8 #define BLOCK_MASK (BLOCK_NUM - 1) diff --git a/src/network/network.c b/src/network/network.c index 3f854f35656..8680d6c64a2 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -52,9 +52,7 @@ #include #include #include -#ifndef _MSC_VER #include -#endif #include #define HAVE_STDARG_H #include <86box/86box.h> diff --git a/src/utils/random.c b/src/utils/random.c index 6ed6c1d0c4f..5658bc3fbb5 100644 --- a/src/utils/random.c +++ b/src/utils/random.c @@ -51,16 +51,10 @@ rdtsc(void) #if defined(__x86_64__) unsigned int hi; unsigned int lo; -# ifdef _MSC_VER - __asm { - rdtsc - mov hi, edx ; EDX:EAX is already standard return!! - mov lo, eax - } -# else + __asm__ __volatile__("rdtsc" : "=a"(lo), "=d"(hi)); -# endif + return ((unsigned long long) lo) | (((unsigned long long) hi) << 32); #else return time(NULL); From 1275f13d6883656c102fd1aa5a3d54ff4fc1346c Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 23 Dec 2025 00:22:00 +0100 Subject: [PATCH 140/320] (S)VGA render: Make sure the overscan is not blitted to a line whose pointer is NULL, fixes #6591. --- src/video/vid_svga_render.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/video/vid_svga_render.c b/src/video/vid_svga_render.c index 25b3cd9463f..f266fbf8f55 100644 --- a/src/video/vid_svga_render.c +++ b/src/video/vid_svga_render.c @@ -91,7 +91,7 @@ svga_render_blank(svga_t *svga) line_width -= svga->x_add; } - if (((svga->hdisp + svga->scrollcache) > 0) && (line_width >= 0)) + if ((line_ptr != NULL) && ((svga->hdisp + svga->scrollcache) > 0) && (line_width >= 0)) memset(line_ptr, 0, line_width); } @@ -106,7 +106,7 @@ svga_render_overscan_left(svga_t *svga) uint32_t *line_ptr = svga->monitor->target_buffer->line[svga->displine + svga->y_add]; - if (svga->x_add >= 0) for (int i = 0; i < svga->x_add; i++) + if ((line_ptr != NULL) && (svga->x_add >= 0)) for (int i = 0; i < svga->x_add; i++) *line_ptr++ = svga->overscan_color; } @@ -121,10 +121,15 @@ svga_render_overscan_right(svga_t *svga) if (svga->scrblank || (svga->hdisp <= 0)) return; - uint32_t *line_ptr = &svga->monitor->target_buffer->line[svga->displine + svga->y_add][svga->x_add + svga->hdisp]; + uint32_t *line_ptr = svga->monitor->target_buffer->line[svga->displine + svga->y_add]; right = overscan_x - svga->left_overscan; - for (int i = 0; i < right; i++) - *line_ptr++ = svga->overscan_color; + + if (line_ptr != NULL) { + line_ptr += svga->x_add + svga->hdisp; + + for (int i = 0; i < right; i++) + *line_ptr++ = svga->overscan_color; + } } void From 196ffe7e4ec92cc1bdbf9553f34daaaf2f82e875 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 23 Dec 2025 00:26:58 +0100 Subject: [PATCH 141/320] Actually use the previous toolbar icons order in both cases, because it's more logical. --- src/qt/qt_vmmanager_details.cpp | 4 ++-- src/qt/qt_vmmanager_mainwindow.ui | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index d91ba951bf5..396997e7d38 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -149,11 +149,11 @@ VMManagerDetails::VMManagerDetails(QWidget *parent) cadButton->setEnabled(false); cadButton->setToolTip(tr("Ctrl+Alt+Del")); - ui->toolButtonHolder->layout()->addWidget(configureButton); + ui->toolButtonHolder->layout()->addWidget(startPauseButton); ui->toolButtonHolder->layout()->addWidget(resetButton); ui->toolButtonHolder->layout()->addWidget(stopButton); - ui->toolButtonHolder->layout()->addWidget(startPauseButton); ui->toolButtonHolder->layout()->addWidget(cadButton); + ui->toolButtonHolder->layout()->addWidget(configureButton); ui->notesTextEdit->setEnabled(false); diff --git a/src/qt/qt_vmmanager_mainwindow.ui b/src/qt/qt_vmmanager_mainwindow.ui index a33893ee3cb..fbaeecf0ff0 100644 --- a/src/qt/qt_vmmanager_mainwindow.ui +++ b/src/qt/qt_vmmanager_mainwindow.ui @@ -94,11 +94,11 @@ - + - + From 0c6f43cd5500092ecd83c4d6a682b44abfa28405 Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 23 Dec 2025 00:28:08 +0100 Subject: [PATCH 142/320] Bump version to 5.4. --- CMakeLists.txt | 2 +- debian/changelog | 4 ++-- src/unix/assets/86Box.spec | 6 +++--- src/unix/assets/net.86box.86Box.metainfo.xml | 2 +- vcpkg.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index adec2eedb9e..a7dede226e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,7 +36,7 @@ if(MUNT_EXTERNAL) endif() project(86Box - VERSION 5.3 + VERSION 5.4 DESCRIPTION "Emulator of x86-based systems" HOMEPAGE_URL "https://86box.net" LANGUAGES C CXX) diff --git a/debian/changelog b/debian/changelog index 3720d22aa8c..c0c4bf945ed 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,5 @@ -86box (5.3) UNRELEASED; urgency=medium +86box (5.4) UNRELEASED; urgency=medium * Bump release. - -- Jasmine Iwanek Tue, 02 Dec 2025 15:24:58 +0100 + -- Jasmine Iwanek Tue, 23 Dec 2025 00:27:45 +0100 diff --git a/src/unix/assets/86Box.spec b/src/unix/assets/86Box.spec index c5fbc120fd0..a189a5f41ae 100644 --- a/src/unix/assets/86Box.spec +++ b/src/unix/assets/86Box.spec @@ -12,10 +12,10 @@ # After a successful build, you can install the RPMs as follows: # sudo dnf install RPMS/$(uname -m)/86Box-3* RPMS/noarch/86Box-roms* -%global romver 5.3 +%global romver 5.4 Name: 86Box -Version: 5.3 +Version: 5.4 Release: 1%{?dist} Summary: Classic PC emulator License: GPLv2+ @@ -121,5 +121,5 @@ popd %{_datadir}/%{name}/roms %changelog -* Sat Aug 31 Jasmine Iwanek 5.3-1 +* Sat Aug 31 Jasmine Iwanek 5.4-1 - Bump release diff --git a/src/unix/assets/net.86box.86Box.metainfo.xml b/src/unix/assets/net.86box.86Box.metainfo.xml index 0cf1a0fb4cd..c6a612a4c15 100644 --- a/src/unix/assets/net.86box.86Box.metainfo.xml +++ b/src/unix/assets/net.86box.86Box.metainfo.xml @@ -11,7 +11,7 @@ net.86box.86Box.desktop - + diff --git a/vcpkg.json b/vcpkg.json index 43cf367c516..4c0d502ef14 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "86box", - "version-string": "5.3", + "version-string": "5.4", "homepage": "https://86box.net/", "documentation": "https://86box.readthedocs.io/", "license": "GPL-2.0-or-later", From 77596d36231ef0a149c89c9f456b62daadebe69c Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 23 Dec 2025 01:20:26 +0100 Subject: [PATCH 143/320] Include 86box.h in the two dummy CD-ROM IOCTL files, fixes compile on Linux and Mac. --- src/qt/dummy_cdrom_ioctl.c | 1 + src/unix/dummy_cdrom_ioctl.c | 1 + 2 files changed, 2 insertions(+) diff --git a/src/qt/dummy_cdrom_ioctl.c b/src/qt/dummy_cdrom_ioctl.c index af8679ecc66..9b7a8bfbfb5 100644 --- a/src/qt/dummy_cdrom_ioctl.c +++ b/src/qt/dummy_cdrom_ioctl.c @@ -24,6 +24,7 @@ #include #include #define HAVE_STDARG_H +#include <86box/86box.h> #include <86box/scsi_device.h> #include <86box/cdrom.h> #include <86box/log.h> diff --git a/src/unix/dummy_cdrom_ioctl.c b/src/unix/dummy_cdrom_ioctl.c index af8679ecc66..9b7a8bfbfb5 100644 --- a/src/unix/dummy_cdrom_ioctl.c +++ b/src/unix/dummy_cdrom_ioctl.c @@ -24,6 +24,7 @@ #include #include #define HAVE_STDARG_H +#include <86box/86box.h> #include <86box/scsi_device.h> #include <86box/cdrom.h> #include <86box/log.h> From cebf1502ac99f103ef69dfe99ad879533316bdc9 Mon Sep 17 00:00:00 2001 From: RSX798 Date: Tue, 23 Dec 2025 08:52:38 +0800 Subject: [PATCH 144/320] Update fr-FR.po --- src/qt/languages/fr-FR.po | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index cba81ff673f..20c6483db32 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -19,7 +19,7 @@ msgid "&Keyboard requires capture" msgstr "C&apturer le clavier" msgid "&Right CTRL is left ALT" -msgstr "CTRL &Droite devient ALT Gauche" +msgstr "CTRL &droite devient ALT gauche" msgid "&Hard reset" msgstr "&Hard reset" @@ -28,7 +28,7 @@ msgid "&Ctrl+Alt+Del" msgstr "&Ctrl+Alt+Suppr" msgid "Ctrl+Alt+&Esc" -msgstr "Ctrl+Alt+&Esc" +msgstr "Ctrl+A<+Échap" msgid "&Pause" msgstr "&Pause" @@ -79,7 +79,7 @@ msgid "Force &4:3 display ratio" msgstr "Forcer le ratio &4:3" msgid "&Window scale factor" -msgstr "Facteur d'&Echelle" +msgstr "Facteur d'éch&elle" msgid "&0.5x" msgstr "&0.5x" @@ -112,7 +112,7 @@ msgid "&8x" msgstr "&8x" msgid "Fi<er method" -msgstr "Mét&hode de Filtre" +msgstr "Mét&hode de filtre" msgid "&Nearest" msgstr "&Plus proche" @@ -139,16 +139,16 @@ msgid "&Square pixels (Keep ratio)" msgstr "Pixels &carrés (Conserver le ratio)" msgid "&Integer scale" -msgstr "&Echelle entière" +msgstr "Éch&elle entière" msgid "4:&3 Integer scale" -msgstr "Echelle entière 4:&3" +msgstr "Échelle entière 4:&3" msgid "EGA/(S)&VGA settings" msgstr "Réglages EGA/(S)&VGA" msgid "&Inverted VGA monitor" -msgstr "Moniteur VGA &Inversé" +msgstr "Moniteur VGA &inversé" msgid "VGA screen &type" msgstr "&Type d'écran VGA" @@ -160,22 +160,22 @@ msgid "RGB (no brown)" msgstr "RVB (sans brun)" msgid "&RGB Grayscale" -msgstr "Niveau de Gris &RVB" +msgstr "Niveau de gris &RVB" msgid "Generic RGBI color monitor" msgstr "Moniteur couleur RVB générique" msgid "&Amber monitor" -msgstr "Moniteur &Ambre" +msgstr "Moniteur &ambre" msgid "&Green monitor" -msgstr "Moniteur &Vert" +msgstr "Moniteur &vert" msgid "&White monitor" -msgstr "Moniteur &Blanc" +msgstr "Moniteur &blanc" msgid "Grayscale &conversion type" -msgstr "Type de &conversion du niveau de Gris" +msgstr "Type de &conversion du niveau de gris" msgid "BT&601 (NTSC/PAL)" msgstr "BT&601 (NTSC/PAL)" @@ -220,7 +220,7 @@ msgid "Enable &Discord integration" msgstr "Activer l'intégration &Discord" msgid "Sound &gain…" -msgstr "&Gain Son…" +msgstr "&Gain son…" msgid "Begin trace" msgstr "Démarrer traces" @@ -229,22 +229,22 @@ msgid "End trace" msgstr "Arrêter traces" msgid "&Help" -msgstr "Ai&de" +msgstr "&Aide" msgid "&Documentation…" msgstr "&Documentation…" msgid "&About 86Box…" -msgstr "&A Propos de 86Box…" +msgstr "À &propos de 86Box…" msgid "&New image…" msgstr "&Nouvelle image…" msgid "&Existing image…" -msgstr "Image &Existante…" +msgstr "Image &existante…" msgid "Existing image (&Write-protected)…" -msgstr "Image Existante (&Lecture seule)…" +msgstr "Image existante (&Lecture seule)…" msgid "&Record" msgstr "En®istrer" @@ -256,7 +256,7 @@ msgid "&Rewind to the beginning" msgstr "&Revenir au debut" msgid "&Fast forward to the end" -msgstr "Avance rapide jusqu'à la &Fin" +msgstr "Avance rapide jusqu'à la &fin" msgid "E&ject" msgstr "É&jecter" @@ -595,7 +595,7 @@ msgid "Type:" msgstr "Type :" msgid "Image Format:" -msgstr "Format Image :" +msgstr "Format image :" msgid "Block Size:" msgstr "Taille du bloc :" @@ -1300,7 +1300,7 @@ msgid "Warning" msgstr "Avertissement" msgid "&Kill" -msgstr "Fo&rcer Extinction" +msgstr "Fo&rcer extinction" msgid "Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?" msgstr "La fermeture forcée d'une machine virtuelle peut entraîner une perte de données. Ne procédez ainsi que si le processus 86Box est bloqué.\n\nVoulez-vous vraiment fermer la machine virtuelle « %1 » ?" @@ -1459,10 +1459,10 @@ msgid "Differencing VHD (.vhd)" msgstr "VHD différentiel (.vhd)" msgid "Large blocks (2 MB)" -msgstr "Grands Blocs (2 Mo)" +msgstr "Grands blocs (2 Mo)" msgid "Small blocks (512 KB)" -msgstr "Petits Blocs (512 Ko)" +msgstr "Petits blocs (512 Ko)" msgid "VHD files" msgstr "Fichiers VHD" @@ -1624,10 +1624,10 @@ msgid "List of MCA devices:" msgstr "Liste des dispositifs MCA :" msgid "&Tablet tool" -msgstr "Outil Tablette" +msgstr "Outil tablette" msgid "About &Qt" -msgstr "A propos de &Qt" +msgstr "À propos de &Qt" msgid "&MCA devices…" msgstr "Dispositifs MCA…" @@ -1684,7 +1684,7 @@ msgid "Use target framerate:" msgstr "Utiliser le taux de rafraîchissement cible :" msgid " fps" -msgstr " Images par seconde" +msgstr " images par seconde" msgid "VSync" msgstr "VSync" @@ -2707,7 +2707,7 @@ msgid "Ask for confirmation before saving settings" msgstr "Demander confirmation avant de sauvegarder les réglages" msgid "Ask for confirmation before hard resetting" -msgstr "Demander confirmation avant Hard Reset" +msgstr "Demander confirmation avant hard reset" msgid "Ask for confirmation before quitting" msgstr "Demander confirmation avant de quitter" @@ -2743,7 +2743,7 @@ msgid "Shader Manager" msgstr "Gestionnaire de shader" msgid "Shader Configuration" -msgstr "Configuration Shader" +msgstr "Configuration du shader" msgid "Add" msgstr "Ajouter" From 2e9c82bf3efe1e28c62d1b0b9620d3c8b4bd8f56 Mon Sep 17 00:00:00 2001 From: RSX798 Date: Tue, 23 Dec 2025 09:02:20 +0800 Subject: [PATCH 145/320] Make "d" as hotkey in "Aide" --- src/qt/languages/fr-FR.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 20c6483db32..6a5628f29ad 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -229,7 +229,7 @@ msgid "End trace" msgstr "Arrêter traces" msgid "&Help" -msgstr "&Aide" +msgstr "Ai&de" msgid "&Documentation…" msgstr "&Documentation…" From b258de33de863a4c9f6d85624c95d591afd225d7 Mon Sep 17 00:00:00 2001 From: RSX798 Date: Tue, 23 Dec 2025 14:55:51 +0800 Subject: [PATCH 146/320] Update es-ES.po --- src/qt/languages/es-ES.po | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 53bd643b2c5..8dcc24758f1 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -25,7 +25,7 @@ msgid "&Hard reset" msgstr "&Hard reset" msgid "&Ctrl+Alt+Del" -msgstr "&Ctrl+Alt+Del" +msgstr "&Ctrl+Alt+Supr" msgid "Ctrl+Alt+&Esc" msgstr "Ctrl+Alt+&Esc" @@ -604,7 +604,7 @@ msgid "Floppy drives:" msgstr "Unidades de disquete:" msgid "Turbo timings" -msgstr "Temporizaciones Turbo" +msgstr "Temporizaciones turbo" msgid "Check BPB" msgstr "Chequear BPB" @@ -631,7 +631,7 @@ msgid "ISA RTC:" msgstr "ISA RTC:" msgid "ISA Memory Expansion" -msgstr "Expansión de Memoria ISA" +msgstr "Expansión de memoria ISA" msgid "ISA ROM Cards" msgstr "Tarjetas ROM ISA" @@ -709,7 +709,7 @@ msgid "All images" msgstr "Todas las imagenes" msgid "Basic sector images" -msgstr "Imaáenes básicas de sector" +msgstr "Imágenes básicas de sector" msgid "Surface images" msgstr "Imágenes de superficie" @@ -718,10 +718,10 @@ msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines msgstr "La máquina \"%hs\" no está disponible debido a ROMs faltantes en el directorio roms/machines. Cambiando a una máquina disponible." msgid "Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card." -msgstr "La tarjeta de vídeo \"%hs\" no está disponible debido a ROMs faltantes en el directorio roms/machines. Cambiando a una tarjeta de vídeo disponible." +msgstr "La tarjeta de vídeo \"%hs\" no está disponible debido a ROMs faltantes en el directorio roms/video. Cambiando a una tarjeta de vídeo disponible." msgid "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card." -msgstr "La tarjeta de vídeo 2 \"%hs\" no está disponible debido a ROMs faltantes en el directorio roms/machines. Deshabilitanto la segunda tarjeta de vídeo." +msgstr "La tarjeta de vídeo 2 \"%hs\" no está disponible debido a ROMs faltantes en el directorio roms/video. Deshabilitanto la segunda tarjeta de vídeo." msgid "Device \"%hs\" is not available due to missing ROMs. Ignoring the device." msgstr "El dispositivo \"%hs\" no está disponible debido a ROMs faltantes. Ignorando el dispositivo." @@ -811,7 +811,7 @@ msgid "Default" msgstr "Por defecto" msgid "%1 Wait state(s)" -msgstr "%1 estado(s) de Espera" +msgstr "%1 estado(s) de espera" msgid "Type" msgstr "Tipo" @@ -997,7 +997,7 @@ msgid "Invalid configuration" msgstr "Configuración inválida" msgid "%1 is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." -msgstr "%1 es necesaria para la conversión automática de archivos PostScript a PDF.\n\nCualquier documento enviado a la impresora genérica postScript se guardará como archivo PostScript (.ps)." +msgstr "%1 es necesaria para la conversión automática de archivos PostScript a PDF.\n\nCualquier documento enviado a la impresora genérica PostScript se guardará como archivo PostScript (.ps)." msgid "%1 is required for automatic conversion of PCL files to PDF.\n\nAny documents sent to the generic PCL printer will be saved as Printer Command Language (.pcl) files." msgstr "%1 es necesaria para la conversión automática de archivos PCL a PDF.\n\nCualquier documento enviado a la impresora genérica PCL se guardará como archivo Printer Command Language (.pcl)." @@ -1030,7 +1030,7 @@ msgid "You are loading an unsupported configuration" msgstr "Está cargando una configuración no soportada" msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." -msgstr "El Filtrado de tipo de CPU basado en máquina seleccionada está deshabilitado para la esta máquina.\n\nEsto hace posible seleccionar una CPU que sea incompatible con esta máquina. Por ello, pueden aparecer incompatibilidader con la BIOS de la máquina u otro software.\n\nActivar esta configuración no está oficialmente soportado y cualquier reporte de fallo puede ser cerrado como inválido." +msgstr "El filtrado de tipo de CPU basado en máquina seleccionada está deshabilitado para la esta máquina.\n\nEsto hace posible seleccionar una CPU que sea incompatible con esta máquina. Por ello, pueden aparecer incompatibilidader con la BIOS de la máquina u otro software.\n\nActivar esta configuración no está oficialmente soportado y cualquier reporte de fallo puede ser cerrado como inválido." msgid "Continue" msgstr "Continuar" @@ -1060,7 +1060,7 @@ msgid "Pause execution" msgstr "Pausar la ejecución" msgid "Ctrl+Alt+Del" -msgstr "Ctrl+Alt+Del" +msgstr "Ctrl+Alt+Supr" msgid "Press Ctrl+Alt+Del" msgstr "Pulsar Ctrl+Alt+Supr" @@ -1252,7 +1252,7 @@ msgid "Failed to create directory for cloned VM" msgstr "Error al crear el directório para la MV clonada" msgid "Failed to clone VM." -msgstr "Error al clonar la VM." +msgstr "Error al clonar la MV." msgid "Directory in use" msgstr "Directório en uso" @@ -1291,7 +1291,7 @@ msgid "An update to 86Box is available: %1 %2" msgstr "Está disponible una actualización para 86Box: %1 %2" msgid "An error has occurred while checking for updates: %1" -msgstr "Ha ocurrido un error al verificar las actualizacioens: %1" +msgstr "Ha ocurrido un error al verificar las actualizaciones: %1" msgid "An update to 86Box is available!" msgstr "¡Una actualización para 86Box está disponible!" @@ -1735,7 +1735,7 @@ msgid "86Box Monitor #%1" msgstr "Monitor de 86Box %1" msgid "No MCA devices." -msgstr "No hay dispositovos MCA." +msgstr "No hay dispositivos MCA." msgid "MiB" msgstr "MiB" @@ -2689,10 +2689,10 @@ msgid "60 Hz (JMP2 = 2)" msgstr "60 Hz (JMP2 = 2)" msgid "Generic PC/XT Memory Expansion" -msgstr "Expansión de Memoria Generica PC/XT" +msgstr "Expansión de memoria generica PC/XT" msgid "Generic PC/AT Memory Expansion" -msgstr "Expansión de Memoria Generica PC/AT" +msgstr "Expansión de memoria generica PC/AT" msgid "Unable to find Dot-Matrix fonts" msgstr "No fué posible encontrar las fuentes matriciales" @@ -2785,7 +2785,7 @@ msgid "This key combo is already in use." msgstr "Esta combinación de teclas ya está en uso." msgid "Send Control+Alt+Del" -msgstr "Enviar Control+Alt+Del" +msgstr "Enviar Control+Alt+Supr" msgid "Send Control+Alt+Escape" msgstr "Enviar Control+Alt+Escape" @@ -2842,7 +2842,7 @@ msgid "&Wipe NVRAM" msgstr "&Limpiar el NVRAM" msgid "This will delete all NVRAM (and related) files of the virtual machine located in the \"nvr\" subdirectory. You'll have to reconfigure the BIOS (and possibly other devices inside the VM) settings again if applicable.\n\nAre you sure you want to wipe all NVRAM contents of the virtual machine \"%1\"?" -msgstr "Estó borrará todos los archivos de NVRAM (y relacionados) de la máquina virtual ubicados en el subdirectório \"nvr\". Tendrá que reconifigurar la definiciones del BIOS (y talvez de otros dispositivoes dentro de la MV) otra vez si aplicable.\n\n¿Está seguro de que quierere limpiar todos los contenidos de la NVRAM de la máquina virtual \"%1\"?" +msgstr "Estó borrará todos los archivos de NVRAM (y relacionados) de la máquina virtual ubicados en el subdirectório \"nvr\". Tendrá que reconfigurar la definiciones del BIOS (y tal vez de otros dispositivos dentro de la MV) otra vez si aplicable.\n\n¿Está seguro de que quiere limpiar todos los contenidos de la NVRAM de la máquina virtual \"%1\"?" msgid "Success" msgstr "Éxito" @@ -2899,7 +2899,7 @@ msgid "Version %1 is now available." msgstr "La versión %1 está ahora disponible." msgid "You are currently running build %1." -msgstr "Actualmente está a ejecutar la compialación %1." +msgstr "Actualmente está a ejecutar la compilación %1." msgid "Build %1 is now available." msgstr "La compilación %1 está ahora disponible." From 3dd5657decad2adda1abcf59f5abd9d6e5b212fc Mon Sep 17 00:00:00 2001 From: OBattler Date: Tue, 23 Dec 2025 17:53:23 +0100 Subject: [PATCH 147/320] DEC Tulip: Revert the changes introduced in build 8078, fixes #6614. --- src/network/net_l80225.c | 11 +---------- src/network/net_tulip.c | 39 +++++++++++++-------------------------- 2 files changed, 14 insertions(+), 36 deletions(-) diff --git a/src/network/net_l80225.c b/src/network/net_l80225.c index 341799e57cf..6493edec6d9 100644 --- a/src/network/net_l80225.c +++ b/src/network/net_l80225.c @@ -34,17 +34,8 @@ l80225_mii_readw(uint16_t *regs, uint16_t addr) return 0; } -/* Readonly mask for MDI (PHY) registers */ -static const uint16_t tulip_mdi_mask[] = { - 0x0000, 0xffff, 0xffff, 0xffff, 0xc01f, 0xffff, 0xffff, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0fff, 0x0000, 0xffff, 0xffff, 0x0000, 0xffff, 0xffff, 0xffff, - 0xffff, 0xffff, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - -}; - void l80225_mii_writew(uint16_t *regs, uint16_t addr, uint16_t val) { - regs[addr] = val & tulip_mdi_mask[addr]; + regs[addr] = val; } diff --git a/src/network/net_tulip.c b/src/network/net_tulip.c index f93ac87670e..a575a4cfbf1 100644 --- a/src/network/net_tulip.c +++ b/src/network/net_tulip.c @@ -346,10 +346,10 @@ static void tulip_desc_read(TULIPState *s, uint32_t p, struct tulip_descriptor *desc) { - dma_bm_read(p , (uint8_t *) &(desc->status) , 4, 4); - dma_bm_read(p + 4, (uint8_t *) &(desc->control) , 4, 4); - dma_bm_read(p + 8, (uint8_t *) &(desc->buf_addr1), 4, 4); - dma_bm_read(p + 12, (uint8_t *) &(desc->buf_addr2), 4, 4); + desc->status = mem_readl_phys(p); + desc->control = mem_readl_phys(p + 4); + desc->buf_addr1 = mem_readl_phys(p + 8); + desc->buf_addr2 = mem_readl_phys(p + 12); if (s->csr[0] & CSR0_DBO) { bswap32s(&desc->status); @@ -364,20 +364,15 @@ tulip_desc_write(TULIPState *s, uint32_t p, struct tulip_descriptor *desc) { if (s->csr[0] & CSR0_DBO) { - uint32_t status = bswap32(desc->status); - uint32_t control = bswap32(desc->control); - uint32_t buf_addr1 = bswap32(desc->buf_addr1); - uint32_t buf_addr2 = bswap32(desc->buf_addr2); - - dma_bm_write(p , (uint8_t *) &status , 4, 4); - dma_bm_write(p + 4, (uint8_t *) &control , 4, 4); - dma_bm_write(p + 8, (uint8_t *) &buf_addr1, 4, 4); - dma_bm_write(p + 12, (uint8_t *) &buf_addr2, 4, 4); + mem_writel_phys(p, bswap32(desc->status)); + mem_writel_phys(p + 4, bswap32(desc->control)); + mem_writel_phys(p + 8, bswap32(desc->buf_addr1)); + mem_writel_phys(p + 12, bswap32(desc->buf_addr2)); } else { - dma_bm_write(p , (uint8_t *) &(desc->status) , 4, 4); - dma_bm_write(p + 4, (uint8_t *) &(desc->control) , 4, 4); - dma_bm_write(p + 8, (uint8_t *) &(desc->buf_addr1), 4, 4); - dma_bm_write(p + 12, (uint8_t *) &(desc->buf_addr2), 4, 4); + mem_writel_phys(p, desc->status); + mem_writel_phys(p + 4, desc->control); + mem_writel_phys(p + 8, desc->buf_addr1); + mem_writel_phys(p + 12, desc->buf_addr2); } } @@ -438,10 +433,6 @@ tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc) len = s->rx_frame_len; } - if (s->rx_frame_len + len > sizeof(s->rx_frame)) { - return; - } - dma_bm_write(desc->buf_addr1, s->rx_frame + (s->rx_frame_size - s->rx_frame_len), len, 4); s->rx_frame_len -= len; } @@ -453,10 +444,6 @@ tulip_copy_rx_bytes(TULIPState *s, struct tulip_descriptor *desc) len = s->rx_frame_len; } - if (s->rx_frame_len + len > sizeof(s->rx_frame)) { - return; - } - dma_bm_write(desc->buf_addr2, s->rx_frame + (s->rx_frame_size - s->rx_frame_len), len, 4); s->rx_frame_len -= len; } @@ -581,7 +568,7 @@ static const uint16_t tulip_mdi_default[] = { 0x0600, 0x0001, 0x0000, - 0x3b40, + 0x0000, 0x0000, 0x0000, 0x0000, From 9366ddd60d83f3d0ef9984aaaedba1ed71e2cc79 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 24 Dec 2025 01:09:48 -0300 Subject: [PATCH 148/320] Manager: Improve machine load times by caching details labels --- src/qt/qt_vmmanager_details.cpp | 4 ++ src/qt/qt_vmmanager_detailsection.cpp | 80 ++++++++++++++++++--------- src/qt/qt_vmmanager_detailsection.hpp | 1 + 3 files changed, 58 insertions(+), 27 deletions(-) diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index 396997e7d38..59491d89eb2 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -263,6 +263,8 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig) // * First you clear it with VMManagerDetailSection::clear() // * Then you add each line with VMManagerDetailSection::addSection() + setUpdatesEnabled(false); + // System systemSection->clear(); systemSection->addSection("Machine", passed_sysconfig->getDisplayValue(VMManager::Display::Name::Machine)); @@ -320,6 +322,8 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig) inputSection->setSections(); portsSection->setSections(); otherSection->setSections(); + + setUpdatesEnabled(true); } void diff --git a/src/qt/qt_vmmanager_detailsection.cpp b/src/qt/qt_vmmanager_detailsection.cpp index 0b19f77cd10..a025abb063c 100644 --- a/src/qt/qt_vmmanager_detailsection.cpp +++ b/src/qt/qt_vmmanager_detailsection.cpp @@ -39,6 +39,10 @@ VMManagerDetailSection:: ui->setupUi(this); frameGridLayout = new QGridLayout(); + frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid)); + ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + ui->detailFrame->setLayout(frameGridLayout); + // Create the collapse button, set the name and add it to the layout collapseButton = new CollapseButton(); setSectionName(sectionName); @@ -128,6 +132,8 @@ VMManagerDetailSection:: innerFrameLayout->addWidget(buttonWidget); innerFrameLayout->addWidget(frame); setLayout(outerFrameLayout); + + usedRows = 0; } VMManagerDetailSection::~VMManagerDetailSection() @@ -156,6 +162,7 @@ VMManagerDetailSection::setupMainLayout() delete mainLayout; mainLayout = new QVBoxLayout; } + void VMManagerDetailSection::setSections() { @@ -172,52 +179,71 @@ VMManagerDetailSection::setSections() continue; } - const auto labelValue = new QLabel(); - labelValue->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - labelValue->setTextInteractionFlags(labelValue->textInteractionFlags() | Qt::TextSelectableByMouse); - labelValue->setText(line); - frameGridLayout->addWidget(labelValue, row, 1, Qt::AlignLeft); + auto item = frameGridLayout->itemAtPosition(row, 1); + auto label = item ? ((QLabel *) item->widget()) : nullptr; + if (label) { + label->setVisible(true); + } else { + label = new QLabel(); + label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + label->setTextInteractionFlags(label->textInteractionFlags() | Qt::TextSelectableByMouse); + frameGridLayout->addWidget(label, row, 1, Qt::AlignLeft); + } + label->setText(line); + item = frameGridLayout->itemAtPosition(row, 0); if (!labelKey) { - labelKey = new QLabel(); - labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - labelKey->setTextInteractionFlags(labelValue->textInteractionFlags()); + if (item) + labelKey = (QLabel *) item->widget(); + if (labelKey) { + labelKey->setVisible(true); + } else { + labelKey = new QLabel(); + labelKey->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); + frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); + } labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); - frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); + } else if (item) { + label = (QLabel *) item->widget(); + if (label) + label->setVisible(false); + } + + item = frameGridLayout->itemAtPosition(row, 2); + if (!item || !item->widget()) { + const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + frameGridLayout->addItem(hSpacer, row, 2); } - const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - frameGridLayout->addItem(hSpacer, row, 2); empty = false; row++; } } + int prevUsedRows = usedRows; + usedRows = row; + for (; row < prevUsedRows; row++) { + for (int i = 0; i <= 2; i++) { + auto item = frameGridLayout->itemAtPosition(row, i); + if (item) { + auto widget = item->widget(); + if (widget) + widget->setVisible(false); + } + } + } + collapseButton->setContent(ui->detailFrame); if (!empty) setVisible(true); } + void VMManagerDetailSection::clear() { sections.clear(); setVisible(false); - - // Clear everything out - if (frameGridLayout) { - while (frameGridLayout->count()) { - QLayoutItem *cur_item = frameGridLayout->takeAt(0); - if (cur_item->widget()) - delete cur_item->widget(); - delete cur_item; - } - } - - delete frameGridLayout; - frameGridLayout = new QGridLayout(); - frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid)); - ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - ui->detailFrame->setLayout(frameGridLayout); } #ifdef Q_OS_WINDOWS diff --git a/src/qt/qt_vmmanager_detailsection.hpp b/src/qt/qt_vmmanager_detailsection.hpp index 71a3c992e82..39ec51f16c0 100644 --- a/src/qt/qt_vmmanager_detailsection.hpp +++ b/src/qt/qt_vmmanager_detailsection.hpp @@ -91,6 +91,7 @@ public slots: static QMargins getMargins(MarginSection section); QString sectionName; + int usedRows; struct DetailSection { QString name; From 9bc36f74e81b40a9fe9594bc2fef92db9ddd55a7 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 24 Dec 2025 01:20:30 -0300 Subject: [PATCH 149/320] Manager: Streamline details label caching code to address an incorrect assumption --- src/qt/qt_vmmanager_detailsection.cpp | 28 +++++++++++---------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/src/qt/qt_vmmanager_detailsection.cpp b/src/qt/qt_vmmanager_detailsection.cpp index a025abb063c..9a849b89294 100644 --- a/src/qt/qt_vmmanager_detailsection.cpp +++ b/src/qt/qt_vmmanager_detailsection.cpp @@ -179,9 +179,10 @@ VMManagerDetailSection::setSections() continue; } - auto item = frameGridLayout->itemAtPosition(row, 1); - auto label = item ? ((QLabel *) item->widget()) : nullptr; - if (label) { + auto item = frameGridLayout->itemAtPosition(row, 1); + QLabel *label; + if (item) { + label = (QLabel *) item->widget(); label->setVisible(true); } else { label = new QLabel(); @@ -193,25 +194,21 @@ VMManagerDetailSection::setSections() item = frameGridLayout->itemAtPosition(row, 0); if (!labelKey) { - if (item) + if (item) { labelKey = (QLabel *) item->widget(); - if (labelKey) { labelKey->setVisible(true); } else { labelKey = new QLabel(); - labelKey->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); } labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); } else if (item) { - label = (QLabel *) item->widget(); - if (label) - label->setVisible(false); + item->widget()->setVisible(false); } - item = frameGridLayout->itemAtPosition(row, 2); - if (!item || !item->widget()) { + if (!frameGridLayout->itemAtPosition(row, 2)) { const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); frameGridLayout->addItem(hSpacer, row, 2); } @@ -224,13 +221,10 @@ VMManagerDetailSection::setSections() int prevUsedRows = usedRows; usedRows = row; for (; row < prevUsedRows; row++) { - for (int i = 0; i <= 2; i++) { + for (int i = 0; i <= 1; i++) { auto item = frameGridLayout->itemAtPosition(row, i); - if (item) { - auto widget = item->widget(); - if (widget) - widget->setVisible(false); - } + if (item) + item->widget()->setVisible(false); } } From 1585efbef697dbe99c350195afe52520bd9ec787 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 24 Dec 2025 01:27:03 -0300 Subject: [PATCH 150/320] Manager: Fix duplicate call on details keys --- src/qt/qt_vmmanager_detailsection.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/qt/qt_vmmanager_detailsection.cpp b/src/qt/qt_vmmanager_detailsection.cpp index 9a849b89294..635dcd0f99f 100644 --- a/src/qt/qt_vmmanager_detailsection.cpp +++ b/src/qt/qt_vmmanager_detailsection.cpp @@ -200,7 +200,6 @@ VMManagerDetailSection::setSections() } else { labelKey = new QLabel(); labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); - labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); } labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); From f0ab2e9b78bca914288321a2b66c28929b1b5fab Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 25 Dec 2025 03:44:23 +0100 Subject: [PATCH 151/320] Extended the screenshot functionality to allow taking both raw and (renderer/resize-)processed screenshots, to both file and clipboard, made the functionality available on the toolbar as well, and moved the recently added "Force interpretation" button to the end of the toolbar. --- src/include/86box/plat.h | 1 + src/include/86box/video.h | 3 ++ src/qt/icons/copy_raw_screenshot.ico | Bin 0 -> 9622 bytes src/qt/icons/copy_screenshot.ico | Bin 0 -> 9622 bytes src/qt/icons/take_raw_screenshot.ico | Bin 0 -> 9622 bytes src/qt/icons/take_screenshot.ico | Bin 0 -> 9622 bytes src/qt/languages/ca-ES.po | 9 ++++ src/qt/languages/cs-CZ.po | 9 ++++ src/qt/languages/de-DE.po | 9 ++++ src/qt/languages/es-ES.po | 9 ++++ src/qt/languages/fi-FI.po | 9 ++++ src/qt/languages/fr-FR.po | 11 ++++- src/qt/languages/hr-HR.po | 9 ++++ src/qt/languages/it-IT.po | 11 ++++- src/qt/languages/ja-JP.po | 11 ++++- src/qt/languages/ko-KR.po | 11 ++++- src/qt/languages/nb-NO.po | 9 ++++ src/qt/languages/nl-NL.po | 11 ++++- src/qt/languages/pl-PL.po | 9 ++++ src/qt/languages/pt-BR.po | 9 ++++ src/qt/languages/pt-PT.po | 9 ++++ src/qt/languages/ru-RU.po | 11 ++++- src/qt/languages/sk-SK.po | 9 ++++ src/qt/languages/sl-SI.po | 9 ++++ src/qt/languages/sv-SE.po | 9 ++++ src/qt/languages/tr-TR.po | 9 ++++ src/qt/languages/uk-UA.po | 11 ++++- src/qt/languages/vi-VN.po | 9 ++++ src/qt/languages/zh-CN.po | 9 ++++ src/qt/languages/zh-TW.po | 9 ++++ src/qt/qt_mainwindow.cpp | 30 ++++++++++++ src/qt/qt_mainwindow.hpp | 3 ++ src/qt/qt_mainwindow.ui | 48 ++++++++++++++++-- src/qt/qt_openglrenderer.cpp | 21 ++++++++ src/qt/qt_platform.cpp | 37 ++++++++++++++ src/qt/qt_rendererstack.cpp | 49 +++++++++++++++++-- src/qt/qt_softwarerenderer.cpp | 70 +++++++++++++++++---------- src/qt/qt_softwarerenderer.hpp | 10 ++-- src/qt/qt_vulkanwindowrenderer.cpp | 39 +++++++++++++++ src/qt_resources.qrc | 4 ++ src/unix/unix_sdl.c | 2 +- src/video/video.c | 5 +- 42 files changed, 503 insertions(+), 49 deletions(-) create mode 100644 src/qt/icons/copy_raw_screenshot.ico create mode 100644 src/qt/icons/copy_screenshot.ico create mode 100644 src/qt/icons/take_raw_screenshot.ico create mode 100644 src/qt/icons/take_screenshot.ico diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 2d28ec9bc7a..316825f1073 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -153,6 +153,7 @@ extern void plat_language_code_r(int id, char *outbuf, int len); extern void plat_get_cpu_string(char *outbuf, uint8_t len); extern void plat_set_thread_name(void *thread, const char *name); extern void plat_break(void); +extern void plat_send_to_clipboard(unsigned char *rgb, int width, int height); /* Resource management. */ extern wchar_t *plat_get_string(int id); diff --git a/src/include/86box/video.h b/src/include/86box/video.h index b94bdf41548..b7f86ac1832 100644 --- a/src/include/86box/video.h +++ b/src/include/86box/video.h @@ -145,6 +145,9 @@ typedef struct monitor_t { int mon_renderedframes; atomic_int mon_actualrenderedframes; atomic_int mon_screenshots; + atomic_int mon_screenshots_clipboard; + atomic_int mon_screenshots_raw; + atomic_int mon_screenshots_raw_clipboard; uint32_t *mon_pal_lookup; int *mon_cga_palette; int mon_pal_lookup_static; /* Whether it should not be freed by the API. */ diff --git a/src/qt/icons/copy_raw_screenshot.ico b/src/qt/icons/copy_raw_screenshot.ico new file mode 100644 index 0000000000000000000000000000000000000000..80626be20ac6530e8fcc5b4c05b10406201d5545 GIT binary patch literal 9622 zcmeHMJ&zqV6!p_aL2w1v%XKdedj_-JEzu6FW;X!!xD8OHYuOEc)c?jY0 z<8=S~2O<25x+hQ4{r4Y+@YP2lTwJ94pAq*L`hJQSTmm80!-Z#v`v*$|*PP8siQ$LW z?bxdyecKoVaV!>(>kb-Z1#^tibLIHoh=ExAv3U7{A$`wZ#qbNd(Y}D@D!%J_4CUHshdhx$T zyo@-Ek_TU&`22KW_E{>3o>z)Fe_)UWuftE<>D^iR*1zAic5`lR+W z#`>D`qZLm)<`AZ5cyn_TkH=&D>E+85liS&KsxWrWrs9~h`?DDDb}`=K(ROLNf|q(L z`xy71B6ZHK-xdyl1S4v+YiKCL|v-(F8=@Hnr9H_%6{E=|&+ zafLpQ#~c#7=$l$^x9H=#$6UyGzeS(Z*jx|UzEU5$m10_`#~ZZzQuJaFeyw!%Wj<=o z%&zy!MTJLB!<5g@q&Z&dRlkHsw1GbE1KJCS>#vPRV^(~BpRg)C>LbQfLHD%(3$I7% zukgNUui+eQ?KP@1ytzGts2Pu#)<1DiUoYWhOzlS;tM(%9N7|F@{aLXm5l)3MOQyap zue{%fL%a*;@raG6TeS1o?Ji;1*Rmb4*WEr$`xcJS;VDe})|WU-|3}L799fz}bMreT zZ@8Z5y`pbn`~6ORr#TE;bHUaC+?2I|@!HSm#i{+z_pLd!7b1qG#^yT2@*U#7h0z;V zi-UEl*MzF@i6z~_CN7dx_D9|~Iac7;*vvh#_g(Vh8jXXxR^Xd{^pket?++O}bL>$! z8pBHbrha5h`@J8>AV(|ly?*Xjb`QOLD*JsJhs{^cqosYD&$xQNUcdH3aTqSROgFJN z;2Rdz=4aqJ*v6u|G8b7#Tlsv6!6J@&FV;QBfgdzs3ZQ8EkIbaB>;c!!b5x?IE&X|hqG5W!Px&Z*yX^k zagMvknT+2LE@01KI)`=qaQT1vw`ZXJzOPvmwvW8$)H*27GvJh|k9@E36eaemlrL_d|ngSwiVXHr?|H>IJ)&ox>3_@ z^djAMq<&aSjGya%{cfRRvE=!u-{|r>kJK7GcR9C_ zdn-Q$LPN`H4Fm30%;I3zcc{5rxnGZVdQb8%+3Bc##9$q{#Xo>Le2@tEAc4;YoJiNO X<7u`#hO<9m_%6}5Yfwadr=a}}jH2PI literal 0 HcmV?d00001 diff --git a/src/qt/icons/copy_screenshot.ico b/src/qt/icons/copy_screenshot.ico new file mode 100644 index 0000000000000000000000000000000000000000..5ea6bc7057b21cd8dc51799798935edbb77f0273 GIT binary patch literal 9622 zcmeI1ziwqU5XOC#6)S`gTWqmiQc@!E0NDzOw?HWn5^u1A+*4BW2wPAf3d)GBaw~WV zic~34$`p~z{A_9g?FlMp@&Av}Mc z>%Y7g!q3+B;zh21_kIXpeh|XhS+4(Ret($l$L3>?hLGD$g_q{{50+?Lb21l7?7FV$ zdvS5$`$ib}QP4>&hE7s28yG#8{BLh>Q=9!s{?hc5mvngbCWfD4md}4r?eNRL>wmeOLrRM z;XFq68QX5se#3r6`QG-Zcc^II*65|Q2k(>_k1(}2mG!B9kDJ=GR+zu3ITr?)dgs-a z09jXM?-HKuv<5qiQKCNcoyWtctYyUq9)9+xxt|KV6(4QFlb!Gedt>2UiqGSX;+xoS z#k(awe27INjIHs>kDO}}mTZ>dBVQGbgV*5sQsZf_cI_!Y>cmDI64^*=9Eu+7y>MdZ z^Qd#Bj<2`tvFyR`<(vaL3$XXk)FtwFb&ztg_e1#-9~e``9AdEZKk4E=QVtKk)>)&r zgfn+$0ABEjG1~`lSwzi5K?5w+cn$In}LWfUGbZ&iNcj^B~S+`!M*VEiE_3u_a*XA_h_2-@Ji(QK& zVQVdDpYeMJ>r(2cp znLMV%0A!jp*e!gWrRtO2Rt=vpO7#6%C@gFwYV&j9$J}A{KJsnh>n@?O#1@R!_^40X z`}Ej6*!XLF7({V^tD-!-uJ0V`8(>f16U&^K+wz@8L{_0U*AIOc};~wlz#_tDbCNE8N59|2h^8fO0AA#0hy0-1u z+WLLWTdUeD@V z6M*>TD@{9lG(~M*`~A+h^NjCA4E@-ZF-msIAK&Zi>(o|rb0?LEZz_f+KYOzFea@~T z*eXXf^%l1U-rw(uV=jhSe)CoCXz?qCnjagu_g&U-Q&$YFF_`1`e7dWMTXX00hrj18 zG3@^aeqx|B^LO75eJmCO@g9>uc}p}Nn$Mb__B00;!+xK~p1SOh;m?^q-W62`Q~dhw z5D%OZwZZN0!)gZuDfXtUl=V-$NXWYhXg7H*EBJ{8K8a#e-Rno-{502>EF8bae5*E` z_1|@MfR0~z)#I=BDg7?;YtLDu-*)~9Z~VU0?@y`|-`nE%Yn8d?{c7d!&o+D#|Jv_z zGai(({`8G54Q?w2&)whKbbqVg?E%qD#bVHRyw`OM1MZg348_*2np^WQh+!+}27CCI xWCPsDG)=Dl+}S^XI{QH)*bfr+vjGe0#^kU~c875Cn~D7{(Uu#di1s@L@+aDqGo}Cl literal 0 HcmV?d00001 diff --git a/src/qt/icons/take_raw_screenshot.ico b/src/qt/icons/take_raw_screenshot.ico new file mode 100644 index 0000000000000000000000000000000000000000..b33735a8327b4b05f1e31c16f3260e675c2641aa GIT binary patch literal 9622 zcmeHMv5p)?5bcvKpAdl^IB@0*2`%vf=ZNn>1Qws*!0e7h;?N@C8xR2!8R2E{5f?Zj zL?$CZUcc8}uco@Edv|V^z(!kAxu&bD-m9+e?HSuCU8MWz(W3-=mA<{7(pM>^$B)bS zw+AWx0^gG-W&HZHlwN$E($!TN|Af515c>sk@CbzBhe^+o_YunuwXM~58N2ku?W{eV zZ+`5}C+0~ijEKi)ViE(v9!H<$%l|9qZ*O-K=A<0w9L5jwSp#EoKH@-_^JNd^3s?Em zG-I%iL-`ASR2nf3_s5qd zllKg+n|$B!zM{Or9rcOId}hnu-gO+8U7tVg8*L9e-cO3v`64QOl6=-Mh-WVSjImT4 zy02oaFb%K8;(4WfhqzZz+Kk)7q)&dsW3K8F7IAo>CbJxOF*|rI7JEmm%~Y(g7j?3Z z4qmPge$__2&DO9Ca|7R^#sOZpK6F5LXRNbY^8hc_$NMLbQ4hPi*_1k2bH-Y6ug3ax zp9wSLM64BfIhWN~4x z^x-O<5O;(4KObHTX2 zdGeX?`vRkK+nSwo<{IQ{V{4wm0bi5~Tk(2tN6R_#v>Y63jtqvsh=bqXaXk!j38$T> zUvsb$=YX%p<~vjBaU+fnK65DK?O~%C{{29ny&N6H#I`WW{=p@ zrdK|e{}?OWvS*-yh%fG=VY7bkN9=bmC+0_daS)4nyz@Da=U#s_=eEsjv58Nynr%Hx zpXSTV{HOf1|09Vf>m9zKrgVw*-Gg3~{xA1y=)XbiTjc%y{qGLT@31TAbEv+#xizcpW5v6N&!g|*=x=kDb++~RZ??K4iNm{9y2R<%%sA!H_UoBz zz&wRHlqy%_h{5;!NEO%CARJo8l(m!^j2}}&ZoTJ*G0N4qhdAVqHrB`rjDNK59`}U$ zTlM@yHHcp|8b8-YaUA$Z+-RVGm$HsLW>1yBuZ97?=L)08FRsZrW#xy>I7jeTYiA7u ze*OF3!h)N(k7;nel}+V}AL`g=8;(0{I<;x+X8 z&v|h4YM|e9k2rsxs~Q47zp*JEL#|deFYfp~t~pxZx)K9piQ`+Ge*gN$XIvH2jwAOS z`H4%Z@S7f}4<&N>r|Qg>>x_FM?6vD>yz#evsCc-}R>g5g{^g41{bCJkRcB)#UOofm z49$Nxvh(2QL+ki2ZR8L?3eG~F;#*p)VYnB{l^x;Kej^Ts`L_4ohvx63i~WvgUHtoS z+I0u|{HR>kL1jFBroD5}#wfP>JsskWbp*cX&d+g9&x;^)XrA^g=MFR-=-pB8aZV@v fClEp}q4%H{&^yb7jJL>r2aJD!_wUQ=r!C(Hr*OfV literal 0 HcmV?d00001 diff --git a/src/qt/icons/take_screenshot.ico b/src/qt/icons/take_screenshot.ico new file mode 100644 index 0000000000000000000000000000000000000000..66f83ebbdf5d7872df04967b2bd66f17cf798632 GIT binary patch literal 9622 zcmeI1ziu5x6voF&goP-QB1O8mq(tHYoQmf_E)b7E0r#$iET!ZTQly}wwCH?0c#Kpo zQRpZTm-Ef;Z~ggrW_|6eNU?NBIzBV!&-a})$^s<+rfCd^xV)d|t|TUzBokGOmA(yuTv$%gBjoAdL1<<#ptJ!ebk??J9X2+hG`H zY2lomowfW$c?`$Mb72Z&v)SChAs_qI)zugi@xvteguz^ST9dCDG*`at@uTLWiSOlO zCw~~OF=`zXA93Jy`M0XgFz(0)m;GxG2tKWuxA^f1BMZ62wDOmpqw;-tK6OgV&K|@C zA3l$r=0!Qgk>9G{eDI0@x>1XcU+qYXpvEtx;MLc!^ zf`<<*om-8cBLBw_Y2lLVn6hC9Pq`UOI66?nq_u8gw(v5R_9d*3b$`slJPg3$?R8OJS~7Bc^H=mi*-R@UW{s#XF{O z9BUUm)zib2PXivWjT~&!dB~DBkh%9RIFb_+Z4m*u3@$9Pg#~EXNDaM35De zUdX4M)_(D!Jtu5826bU%?HV5%AL~zD^W2BBj-H-|yb5`?lME5JiTJB$r@(CW-HI!8 z`6`6(*0*t&K8(FP5YObsxxdf4M?Pb4ZqfQ4^@JF-)#W_(Oc0~rGZ)L5Yry7l{C)~& z@>dS6eRvL>dY5Mb$K#pf6M^O$_|UTJz0&e2CVz{_lUA-o`v4!D%gf98orO&~`eq_v z^*CDi%F&Q7*Dc&AX1+gYy~NSNr`C+GJqmk0j2bRDT6<{WQ%?(j#-2FV!FON$+MGsz zYW;TKn7M*OHSJr!FyL5E_av>^@2>c{|J*~s5hj97*#3RR-s`_O=s$N5c*#YBy(_-s zv^eDV0l#9sU*d1o@41@8(YhPBP1t#4d}_eHuNEhmF|Whc^K*np_0kXTcPl5r=KN_s z62wo%(?7lQ<(JL-!5kkt=gA&&YX}d)$=WqO^pcO5$Ef{meTX~MP>!Q-PeP7r|6@-( z>rKSIkG#Ks{$qyKJ?tdpbqM#cLH}@h7>5o#o(}B%I}lsy#qP4(X0E?`H1FMq-JWwA zb>({I-`SkYH&wcU)3teC#+-2G8syhd4%+iIcMN^sdqSKzG6rkKcn$C`ar2$)#emJ- z0}kx2y+$SlWZI6H6H{9r`O}$Y458+py*U;mS23+?ZZuB1f&aGN{{B{4G8ur~k z&wh!2-hZoxJ@@ZDXzgEh)iVe;I(TKL{)aw)^7H<6xAxk^m4#fm{XUKlTk6Rq<{jU8J%ikT2eb*cgKNIu_UyDEQM{DA# zV;9ZYSi*xpVhbF~WB#$Ub7&qi4{^q#Db$nCB+r6ebPp%lXKp6S=h?%V|0adgHN38S zI8zN!-qO^-nNj@t`T6{8T4z8p)ax1yX~olhp(hq#YcNyt&iy~hw4?<4m^VEhw!|Ne0LD)aphXl7r_ literal 0 HcmV?d00001 diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index 75e0a593dcd..314b12e3ea1 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -210,6 +210,15 @@ msgstr "&Actualitza icones a la barra d'estat" msgid "Take s&creenshot" msgstr "Desa captura de &pantalla" +msgid "Take &raw screenshot" +msgstr "Desa captura en &brut de pantalla" + +msgid "C&opy screenshot" +msgstr "C&opia captura de pantalla" + +msgid "Copy r&aw screenshot" +msgstr "Copy captura en b&rut de pantalla" + msgid "S&ound" msgstr "S&o" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index dbb0d28268f..041992219d8 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -210,6 +210,15 @@ msgstr "&Aktualizovat ikony stavového řádku" msgid "Take s&creenshot" msgstr "Pořídit &screenshot" +msgid "Take &raw screenshot" +msgstr "Pořídit &surový screenshot" + +msgid "C&opy screenshot" +msgstr "Z&kopírovát screenshot" + +msgid "Copy r&aw screenshot" +msgstr "Zkopírovát s&urový screenshot" + msgid "S&ound" msgstr "&Zvuk" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index e426d1e2dfd..634069dd7d5 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -210,6 +210,15 @@ msgstr "&Statusleistenicons aktualisieren" msgid "Take s&creenshot" msgstr "S&creenshot aufnehmen" +msgid "Take &raw screenshot" +msgstr "&Roh-Screenshot aufnehmen" + +msgid "C&opy screenshot" +msgstr "Screenshot k&opieren" + +msgid "Copy r&aw screenshot" +msgstr "R&oh-Screenshot kopieren" + msgid "S&ound" msgstr "&Ton" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 53bd643b2c5..de155cf7a24 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -210,6 +210,15 @@ msgstr "&Actualizar iconos en barra de estado" msgid "Take s&creenshot" msgstr "Tomar cap&tura" +msgid "Take &raw screenshot" +msgstr "Tomar captura &plana" + +msgid "C&opy screenshot" +msgstr "C&opiar captura" + +msgid "Copy r&aw screenshot" +msgstr "Copiar captura p&lana" + msgid "S&ound" msgstr "S&onido" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 0db30bede46..d43b701923c 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -210,6 +210,15 @@ msgstr "&Päivitä tilapalkin kuvakkeita" msgid "Take s&creenshot" msgstr "Ota &kuvakaappaus" +msgid "Take &raw screenshot" +msgstr "Ota &raaka kuvakaapus" + +msgid "C&opy screenshot" +msgstr "K&opia kuvakaapaus" + +msgid "Copy r&aw screenshot" +msgstr "Kopia r&aaka kuvakaapaus" + msgid "S&ound" msgstr "&Ääni" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 6a5628f29ad..aa550e5f313 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -208,7 +208,16 @@ msgid "&Update status bar icons" msgstr "Mettre à jour la barre de stat&us" msgid "Take s&creenshot" -msgstr "Copie d'é&cran" +msgstr "Faire copie d'é&cran" + +msgid "Take &raw screenshot" +msgstr "Faire copie &brute d'écran" + +msgid "C&opy screenshot" +msgstr "C&opier copie d'écran" + +msgid "Copy r&aw screenshot" +msgstr "Copier copie b&rute d'écran" msgid "S&ound" msgstr "S&on" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 5261ab338de..882da52b5e3 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -212,6 +212,15 @@ msgstr "&Ažuriraj ikone statusnog redka" msgid "Take s&creenshot" msgstr "Napravi &snimku zaslona" +msgid "Take &raw screenshot" +msgstr "Napravi &neobrađenu snimku zaslona" + +msgid "C&opy screenshot" +msgstr "K&opiraj snimku zalsona" + +msgid "Copy r&aw screenshot" +msgstr "Kopiraj n&eobrađenu snimku zaslona" + msgid "S&ound" msgstr "&Zvuk" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 67937b08991..36621b840bb 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -210,6 +210,15 @@ msgstr "&Aggiorna icone della barra di stato" msgid "Take s&creenshot" msgstr "&Cattura schermata" +msgid "Take &raw screenshot" +msgstr "Cattura &grezza della schermata" + +msgid "C&opy screenshot" +msgstr "C&opia cattura della schermata" + +msgid "Copy r&aw screenshot" +msgstr "Copia cattura g&rezza della schermata" + msgid "S&ound" msgstr "A&udio" @@ -1420,7 +1429,7 @@ msgid "Don't overwrite" msgstr "Non sovrascrivere" msgid "Raw image" -msgstr "Immagine RAW" +msgstr "Immagine grezza" msgid "HDI image" msgstr "Immagine HDI" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index cfd44dabab2..d9eba264666 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -211,6 +211,15 @@ msgstr "ステータスバーのアイコンを更新(&U)" msgid "Take s&creenshot" msgstr "スクリーンショットを撮る(&C)" +msgid "Take &raw screenshot" +msgstr "生のスクリーンショットを撮る(&R)" + +msgid "C&opy screenshot" +msgstr "スクリーンショットをコピーする(&O)" + +msgid "Copy r&aw screenshot" +msgstr "生のスクリーンショットをコピーする(&A)" + msgid "S&ound" msgstr "サウンド(&O)" @@ -1421,7 +1430,7 @@ msgid "Don't overwrite" msgstr "上書きしない" msgid "Raw image" -msgstr "Rawイメージ" +msgstr "生のイメージ" msgid "HDI image" msgstr "HDIイメージ" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index e49476e4042..51b77209d4a 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -204,6 +204,15 @@ msgstr "상태 바 아이콘 갱신하기(&U)" msgid "Take s&creenshot" msgstr "스크린샷 찍기(&C)" +msgid "Take &raw screenshot" +msgstr "원본 스크린샷 찍기(&R)" + +msgid "C&opy screenshot" +msgstr "스크린샷 복사하세요(&O)" + +msgid "Copy r&aw screenshot" +msgstr "원본 스크린샷 복사하세요(&A)" + msgid "S&ound" msgstr "사운드(&O)" @@ -1414,7 +1423,7 @@ msgid "Don't overwrite" msgstr "덮어쓰지 않음" msgid "Raw image" -msgstr "Raw 이미지" +msgstr "원본 이미지" msgid "HDI image" msgstr "HDI 이미지" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index 5b2748210a6..4da9f607370 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -204,6 +204,15 @@ msgstr "&Oppdater statuslinjeikoner" msgid "Take s&creenshot" msgstr "Ta s&kjermbilde" +msgid "Take &raw screenshot" +msgstr "Ta &rå skjermbilde" + +msgid "C&opy screenshot" +msgstr "K&opiera skjermbilde" + +msgid "Copy r&aw screenshot" +msgstr "Kopiera r&å skjermbilde" + msgid "S&ound" msgstr "L&yd" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 88a0964eceb..abaae4a9873 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -202,7 +202,16 @@ msgid "&Update status bar icons" msgstr "&Statusbalkpictogrammen bijwerken" msgid "Take s&creenshot" -msgstr "Maak een schermafbeelding" +msgstr "Maak een s&chermafbeelding" + +msgid "Take &raw screenshot" +msgstr "Maak een &ruw schermafbeelding" + +msgid "C&opy screenshot" +msgstr "K&opieer een schermafbeelding" + +msgid "Copy r&aw screenshot" +msgstr "Kopieer een r&uw schermafbeelding" msgid "S&ound" msgstr "&Geluid" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 43b89a8da86..02a24fa2ca7 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -211,6 +211,15 @@ msgstr "&Aktualizuj ikony na pasku statusu" msgid "Take s&creenshot" msgstr "Zrób &zrzut ekranu" +msgid "Take &raw screenshot" +msgstr "Zrób &surowy zrzut ekranu" + +msgid "C&opy screenshot" +msgstr "S&kopiuj zrzut ekranu" + +msgid "Copy r&aw screenshot" +msgstr "Skopiuj s&urowy zrzut ekranu" + msgid "S&ound" msgstr "Dź&więk" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 04b96c62de9..02e13e571b6 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -204,6 +204,15 @@ msgstr "&Atualizar ícones da barra de status" msgid "Take s&creenshot" msgstr "Capturar &tela" +msgid "Take &raw screenshot" +msgstr "Fazer captura &bruta da tela" + +msgid "C&opy screenshot" +msgstr "C&opiar captura da tela" + +msgid "Copy r&aw screenshot" +msgstr "Copiar captura b&ruta da tela" + msgid "S&ound" msgstr "&Som" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index f81d1ec94e0..5b3aaececa7 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -211,6 +211,15 @@ msgstr "&Atualizar ícones da barra de estado" msgid "Take s&creenshot" msgstr "Gravar imagem de &ecrã" +msgid "Take &raw screenshot" +msgstr "Gravar imagem &bruta de ecrã" + +msgid "C&opy screenshot" +msgstr "Copiar imagem de ecrã" + +msgid "Copy r&aw screenshot" +msgstr "Copiar imagem b&ruta de ecrã" + msgid "S&ound" msgstr "&Som" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index ce3fe75a333..9e16f6c2858 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -211,6 +211,15 @@ msgstr "&Обновление значков строки состояния" msgid "Take s&creenshot" msgstr "Сделать с&криншот" +msgid "Take &raw screenshot" +msgstr "Сделать &сырой скриншот" + +msgid "C&opy screenshot" +msgstr "С&копировать скриншот" + +msgid "Copy r&aw screenshot" +msgstr "Скопировать с&ырой скриншот" + msgid "S&ound" msgstr "&Звук" @@ -1433,7 +1442,7 @@ msgid "Don't overwrite" msgstr "Не перезаписывать" msgid "Raw image" -msgstr "RAW образ" +msgstr "Сырой образ" msgid "HDI image" msgstr "Образ HDI" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index f049c3f4828..0310f6938cc 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -210,6 +210,15 @@ msgstr "&Aktualizovať ikony na stavovom riadku" msgid "Take s&creenshot" msgstr "Urobiť snímku &obrazovky" +msgid "Take &raw screenshot" +msgstr "Urobiť &surovú snímku obrazovky" + +msgid "C&opy screenshot" +msgstr "S&kopírovať snímku obrazovky" + +msgid "Copy r&aw screenshot" +msgstr "Skopírovať s&urovú snímku obrazovky" + msgid "S&ound" msgstr "&Zvuk" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index d6a4c20ea22..4e31b36da71 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -212,6 +212,15 @@ msgstr "&Posodabljaj ikone statusne vrstice" msgid "Take s&creenshot" msgstr "&Zajemi posnetek zaslona" +msgid "Take &raw screenshot" +msgstr "Zajemi &neobdelan posnetek zaslona" + +msgid "C&opy screenshot" +msgstr "K&opiraj posnetek zaslona" + +msgid "Copy r&aw screenshot" +msgstr "Kopriaj n&eobdelan posenetk zaslona" + msgid "S&ound" msgstr "Z&vok" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 4e626a47bb5..d937828f9e3 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -204,6 +204,15 @@ msgstr "&Uppdatera statusfältets ikoner" msgid "Take s&creenshot" msgstr "Tag s&kärmbild" +msgid "Take &raw screenshot" +msgstr "Tag &rå skärmbild" + +msgid "C&opy screenshot" +msgstr "Kopiera skärmbild" + +msgid "Copy r&aw screenshot" +msgstr "Kopera r&å skärmbild" + msgid "S&ound" msgstr "L&jud" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 91301e0b3c1..f2a21f5d2e9 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -204,6 +204,15 @@ msgstr "Durum &çubuğu simgelerini güncelle" msgid "Take s&creenshot" msgstr "&Ekran görüntüsü al" +msgid "Take &raw screenshot" +msgstr "Ekran &ham görüntüsü al" + +msgid "C&opy screenshot" +msgstr "Ekran görüntüsü k&opyala" + +msgid "Copy r&aw screenshot" +msgstr "Ekran h&am görüntüsü kopyala" + msgid "S&ound" msgstr "&Ses" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 49eac891c6d..f9ff3e4674b 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -212,6 +212,15 @@ msgstr "&Обновлення значків рядка стану" msgid "Take s&creenshot" msgstr "Зробити &знімок" +msgid "Take &raw screenshot" +msgstr "Зробити &сирий знімок" + +msgid "C&opy screenshot" +msgstr "С&копійовати знімок" + +msgid "Copy r&aw screenshot" +msgstr "Скопійовати с&ирий знімок" + msgid "S&ound" msgstr "&Звук" @@ -1422,7 +1431,7 @@ msgid "Don't overwrite" msgstr "Не перезаписувати" msgid "Raw image" -msgstr "RAW образ" +msgstr "Сирий образ" msgid "HDI image" msgstr "Образ HDI" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 0471fa1f012..e4d7a806de4 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -204,6 +204,15 @@ msgstr "Cậ&p nhật biểu tượng thanh trạng thái" msgid "Take s&creenshot" msgstr "Chụp &màn hình" +msgid "Take &raw screenshot" +msgstr "Chụp màn hình &thô" + +msgid "C&opy screenshot" +msgstr "S&ao chép ảnh chụp màn hình" + +msgid "Copy r&aw screenshot" +msgstr "Sao chép ảnh chụp màn hình t&hô" + msgid "S&ound" msgstr "&Âm thanh" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index cf31d697500..cea569a6f8e 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -204,6 +204,15 @@ msgstr "更新状态栏图标(&U)" msgid "Take s&creenshot" msgstr "截图(&C)" +msgid "Take &raw screenshot" +msgstr "原始截图(&R)" + +msgid "C&opy screenshot" +msgstr "复制截图(&O)" + +msgid "Copy r&aw screenshot" +msgstr "复制原始截图(&A)" + msgid "S&ound" msgstr "声音(&O)" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 156dbb2fe2a..ddb879c8f25 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -204,6 +204,15 @@ msgstr "更新狀態列圖示(&U)" msgid "Take s&creenshot" msgstr "擷圖(&C)" +msgid "Take &raw screenshot" +msgstr "原始擷圖(&R)" + +msgid "C&opy screenshot" +msgstr "複製擷圖(&O)" + +msgid "Copy r&aw screenshot" +msgstr "複製原始擷圖(&A)" + msgid "S&ound" msgstr "聲音(&O)" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index cd752398531..cce6d9c9580 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -2263,6 +2263,36 @@ MainWindow::on_actionTake_screenshot_triggered() device_force_redraw(); } +void +MainWindow::on_actionTake_raw_screenshot_triggered() +{ + startblit(); + for (auto &monitor : monitors) + ++monitor.mon_screenshots_raw; + endblit(); + device_force_redraw(); +} + +void +MainWindow::on_actionCopy_screenshot_triggered() +{ + startblit(); + for (auto &monitor : monitors) + ++monitor.mon_screenshots_clipboard; + endblit(); + device_force_redraw(); +} + +void +MainWindow::on_actionCopy_raw_screenshot_triggered() +{ + startblit(); + for (auto &monitor : monitors) + ++monitor.mon_screenshots_raw_clipboard; + endblit(); + device_force_redraw(); +} + void MainWindow::on_actionMute_Unmute_triggered() { diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index a3190076786..e1c0c7409b8 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -132,6 +132,9 @@ private slots: void on_actionHide_tool_bar_triggered(); void on_actionUpdate_status_bar_icons_triggered(); void on_actionTake_screenshot_triggered(); + void on_actionTake_raw_screenshot_triggered(); + void on_actionCopy_screenshot_triggered(); + void on_actionCopy_raw_screenshot_triggered(); void toggleFullscreenUI(); void on_actionMute_Unmute_triggered(); void on_actionSound_gain_triggered(); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 777455d5be2..27501d0b90e 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -70,8 +70,6 @@ - - @@ -80,6 +78,8 @@ + + @@ -106,6 +106,10 @@ + + + + @@ -295,8 +299,6 @@ false - - @@ -306,6 +308,13 @@ + + + + + + + @@ -749,6 +758,37 @@ Ctrl+F11 + + + :/menuicons/qt/icons/take_screenshot.ico:/menuicons/qt/icons/take_screenshot.ico + + + + + Take &raw screenshot + + + + :/menuicons/qt/icons/take_raw_screenshot.ico:/menuicons/qt/icons/take_raw_screenshot.ico + + + + + C&opy screenshot + + + + :/menuicons/qt/icons/copy_screenshot.ico:/menuicons/qt/icons/copy_screenshot.ico + + + + + Copy r&aw screenshot + + + + :/menuicons/qt/icons/copy_raw_screenshot.ico:/menuicons/qt/icons/copy_raw_screenshot.ico + diff --git a/src/qt/qt_openglrenderer.cpp b/src/qt/qt_openglrenderer.cpp index 8e01bfe6c1c..22e400c6571 100644 --- a/src/qt/qt_openglrenderer.cpp +++ b/src/qt/qt_openglrenderer.cpp @@ -26,6 +26,7 @@ extern MainWindow *main_window; #include #include #include +#include #include #include #include @@ -1147,6 +1148,8 @@ OpenGLRenderer::finalize() isFinalized = true; } +extern void take_screenshot_clipboard_monitor(int sx, int sy, int sw, int sh, int i); + void OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h) { @@ -1184,6 +1187,10 @@ OpenGLRenderer::onBlit(int buf_idx, int x, int y, int w, int h) if (video_framerate == -1) render(); + + if (monitors[r_monitor_index].mon_screenshots_raw_clipboard) { + take_screenshot_clipboard_monitor(x, y, w, h, r_monitor_index); + } } std::vector> @@ -1725,6 +1732,20 @@ OpenGLRenderer::render() monitors[r_monitor_index].mon_screenshots--; free(rgb); } + if (monitors[r_monitor_index].mon_screenshots_clipboard) { + int width = destination.width(), height = destination.height(); + + unsigned char *rgb = (unsigned char *) calloc(1, (size_t) width * height * 4); + + glw.glFinish(); + glw.glReadPixels(window_rect.x, window_rect.y, width, height, GL_RGB, GL_UNSIGNED_BYTE, rgb); + + QImage image((uchar*)rgb, width, height, width * 3, QImage::Format_RGB888); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setImage(image.mirrored(false, true), QClipboard::Clipboard); + monitors[r_monitor_index].mon_screenshots_clipboard--; + free(rgb); + } glw.glDisable(GL_FRAMEBUFFER_SRGB); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 37653c5a37f..9fd16d3f15b 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -30,8 +30,11 @@ #include +#include +#include #include #include +#include #include #include #include @@ -978,3 +981,37 @@ plat_break(void) raise(SIGTRAP); #endif } + +static unsigned char *rgb_ = NULL; +static int width_ = 0; +static int height_ = 0; +static volatile int waiting = 0; + +static void +send_to_clipboard(void) +{ + unsigned char *rgb = (unsigned char *) calloc(1, height_ * width_ * 4); + memcpy(rgb, rgb_, height_ * width_ * 3); + QImage image(rgb, width_, height_, width_ * 3, QImage::Format_RGB888); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setImage(image, QClipboard::Clipboard); + free(rgb); + waiting = 0; +} + +void +plat_send_to_clipboard(unsigned char *rgb, int width, int height) +{ + rgb_ = rgb; + width_ = width; + height_ = height; + waiting = 1; + + QTimer::singleShot(0, main_window, &send_to_clipboard); + while (waiting) + ; + + height_ = 0; + width_ = 0; + rgb_ = NULL; +} diff --git a/src/qt/qt_rendererstack.cpp b/src/qt/qt_rendererstack.cpp index 41d17d8971b..99a6bf649d3 100644 --- a/src/qt/qt_rendererstack.cpp +++ b/src/qt/qt_rendererstack.cpp @@ -33,6 +33,9 @@ #include #include +#include +#include + #include #include #ifdef TOUCH_PR @@ -66,9 +69,12 @@ # include #endif +#include + extern "C" { #include <86box/86box.h> #include <86box/config.h> +#include <86box/path.h> #include <86box/plat.h> #include <86box/video.h> #include <86box/mouse.h> @@ -87,6 +93,8 @@ extern MainWindow *main_window; HWND rw_hwnd; #endif +static unsigned char *screenshot_rgb = NULL; + RendererStack::RendererStack(QWidget *parent, int monitor_index) : QWidget(parent) , boxLayout(new QBoxLayout(QBoxLayout::TopToBottom, this)) @@ -158,12 +166,20 @@ RendererStack::RendererStack(QWidget *parent, int monitor_index) if (monitor_index == 0) mouse_set_raw(raw); + + screenshot_rgb = (unsigned char *) calloc(1, (size_t) 2048 * 2048 * 4); } RendererStack::~RendererStack() { + if (screenshot_rgb != NULL) { + free(screenshot_rgb); + screenshot_rgb = NULL; + } + while (QApplication::overrideCursor()) QApplication::restoreOverrideCursor(); + delete ui; } @@ -372,11 +388,7 @@ RendererStack::createRenderer(Renderer renderer) auto sw = new SoftwareRenderer(this); rendererWindow = sw; connect(this, &RendererStack::blitToRenderer, sw, &SoftwareRenderer::onBlit, Qt::QueuedConnection); -#ifdef __HAIKU__ current.reset(sw); -#else - current.reset(this->createWindowContainer(sw)); -#endif } break; case Renderer::OpenGL3: @@ -460,6 +472,32 @@ RendererStack::createRenderer(Renderer renderer) } } +uint32_t *screenshot_buf = NULL; + +void +take_screenshot_clipboard_monitor(int sx, int sy, int sw, int sh, int i) +{ + uint32_t temp = 0x00000000; + + for (int y = 0; y < sh; ++y) { + for (int x = 0; x < sw; ++x) { + if (screenshot_buf == NULL) + memset(&(screenshot_rgb[(y * sw * 3) + (x * 3)]), 0x00, 3); + else { + temp = screenshot_buf[((sy + y) * 2048) + sx + x]; + screenshot_rgb[(y * sw * 3) + (x * 3)] = (temp >> 16) & 0xff; + screenshot_rgb[(y * sw * 3) + (x * 3) + 1] = (temp >> 8) & 0xff; + screenshot_rgb[(y * sw * 3) + (x * 3) + 2] = temp & 0xff; + } + } + } + + QImage image(screenshot_rgb, sw, sh, sw * 3, QImage::Format_RGB888); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setImage(image, QClipboard::Clipboard); + monitors[i].mon_screenshots_raw_clipboard--; +} + // called from blitter thread void RendererStack::blit(int x, int y, int w, int h) @@ -478,10 +516,11 @@ RendererStack::blit(int x, int y, int w, int h) video_copy(scanline, &(monitors[m_monitor_index].target_buffer->line[y1][x]), w * 4); } - if (monitors[m_monitor_index].mon_screenshots && !rendererTakesScreenshots) { + if (monitors[m_monitor_index].mon_screenshots_raw) { video_screenshot_monitor((uint32_t *) imagebits, x, y, 2048, m_monitor_index); } video_blit_complete_monitor(m_monitor_index); + screenshot_buf = (uint32_t *) imagebits; emit blitToRenderer(currentBuf, sx, sy, sw, sh); currentBuf = (currentBuf + 1) % imagebufs.size(); } diff --git a/src/qt/qt_softwarerenderer.cpp b/src/qt/qt_softwarerenderer.cpp index 0a4492a3e50..d9e217ed327 100644 --- a/src/qt/qt_softwarerenderer.cpp +++ b/src/qt/qt_softwarerenderer.cpp @@ -18,21 +18,19 @@ */ #include "qt_softwarerenderer.hpp" #include +#include #include #include extern "C" { #include <86box/86box.h> +#include <86box/path.h> +#include <86box/plat.h> #include <86box/video.h> } SoftwareRenderer::SoftwareRenderer(QWidget *parent) -#ifdef __HAIKU__ : QWidget(parent) -#else - : QWindow(parent->windowHandle()) - , m_backingStore(new QBackingStore(this)) -#endif { RendererCommon::parentWidget = parent; @@ -42,25 +40,23 @@ SoftwareRenderer::SoftwareRenderer(QWidget *parent) buf_usage = std::vector(2); buf_usage[0].clear(); buf_usage[1].clear(); -#ifdef __HAIKU__ this->setMouseTracking(true); -#endif } -#ifdef __HAIKU__ void SoftwareRenderer::paintEvent(QPaintEvent *event) { (void) event; onPaint(this); } -#endif void SoftwareRenderer::render() { +#ifdef __HAIKU__ if (!isExposed()) return; +#endif QRect rect(0, 0, width(), height()); m_backingStore->beginPaint(rect); @@ -78,6 +74,8 @@ SoftwareRenderer::exposeEvent(QExposeEvent *event) render(); } +extern void take_screenshot_clipboard_monitor(int sx, int sy, int sw, int sh, int i); + void SoftwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) { @@ -94,24 +92,52 @@ SoftwareRenderer::onBlit(int buf_idx, int x, int y, int w, int h) if (source != origSource) onResize(this->width(), this->height()); -#ifdef __HAIKU__ + update(); -#else - render(); -#endif + + if (monitors[r_monitor_index].mon_screenshots) { + char path[1024]; + char fn[256]; + + memset(fn, 0, sizeof(fn)); + memset(path, 0, sizeof(path)); + + path_append_filename(path, usr_path, SCREENSHOT_PATH); + + if (!plat_dir_check(path)) + plat_dir_create(path); + + path_slash(path); + strcat(path, "Monitor_"); + snprintf(&path[strlen(path)], 42, "%d_", r_monitor_index + 1); + + plat_tempfile(fn, NULL, (char *) ".png"); + strcat(path, fn); + + QPixmap pixmap(RendererCommon::parentWidget->size()); + RendererCommon::parentWidget->render(&pixmap); + QImage image = pixmap.toImage(); + image.save(path, "png"); + monitors[r_monitor_index].mon_screenshots--; + } + if (monitors[r_monitor_index].mon_screenshots_clipboard) { + QPixmap pixmap(RendererCommon::parentWidget->size()); + RendererCommon::parentWidget->render(&pixmap); + QImage image = pixmap.toImage(); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setImage(image, QClipboard::Clipboard); + monitors[r_monitor_index].mon_screenshots_clipboard--; + } + if (monitors[r_monitor_index].mon_screenshots_raw_clipboard) { + take_screenshot_clipboard_monitor(x, y, w, h, r_monitor_index); + } } void SoftwareRenderer::resizeEvent(QResizeEvent *event) { onResize(width(), height()); -#ifdef __HAIKU__ QWidget::resizeEvent(event); -#else - QWindow::resizeEvent(event); - m_backingStore->resize(event->size()); - render(); -#endif } bool @@ -119,11 +145,7 @@ SoftwareRenderer::event(QEvent *event) { bool res = false; if (!eventDelegate(event, res)) -#ifdef __HAIKU__ return QWidget::event(event); -#else - return QWindow::event(event); -#endif return res; } @@ -142,9 +164,7 @@ SoftwareRenderer::onPaint(QPaintDevice *device) #endif painter.setCompositionMode(QPainter::CompositionMode_Plus); painter.drawImage(destination, *images[cur_image], source); -#ifndef __HAIKU__ painter.end(); -#endif } std::vector> diff --git a/src/qt/qt_softwarerenderer.hpp b/src/qt/qt_softwarerenderer.hpp index e80410956b1..a2b11c01219 100644 --- a/src/qt/qt_softwarerenderer.hpp +++ b/src/qt/qt_softwarerenderer.hpp @@ -11,21 +11,19 @@ #include "qt_renderercommon.hpp" class SoftwareRenderer : -#ifdef __HAIKU__ public QWidget, -#else - public QWindow, -#endif public RendererCommon { Q_OBJECT public: explicit SoftwareRenderer(QWidget *parent = nullptr); -#ifdef __HAIKU__ void paintEvent(QPaintEvent *event) override; -#endif +#ifdef __HAIKU__ void exposeEvent(QExposeEvent *event) override; +#else + void exposeEvent(QExposeEvent *event); +#endif std::vector> getBuffers() override; diff --git a/src/qt/qt_vulkanwindowrenderer.cpp b/src/qt/qt_vulkanwindowrenderer.cpp index 79dbc8f873e..ce6b464ee0c 100644 --- a/src/qt/qt_vulkanwindowrenderer.cpp +++ b/src/qt/qt_vulkanwindowrenderer.cpp @@ -32,6 +32,8 @@ ****************************************************************************/ #include "qt_vulkanwindowrenderer.hpp" +#include +#include #include #include @@ -46,6 +48,8 @@ extern "C" { # include <86box/86box.h> +# include <86box/path.h> +# include <86box/plat.h> # include <86box/video.h> } # if 0 @@ -861,6 +865,8 @@ VulkanWindowRenderer::event(QEvent *event) return res; } +extern void take_screenshot_clipboard_monitor(int sx, int sy, int sw, int sh, int i); + void VulkanWindowRenderer::onBlit(int buf_idx, int x, int y, int w, int h) { @@ -873,6 +879,39 @@ VulkanWindowRenderer::onBlit(int buf_idx, int x, int y, int w, int h) this->pixelRatio = devicePixelRatio(); onResize(this->width(), this->height()); } + + if (monitors[r_monitor_index].mon_screenshots) { + char path[1024]; + char fn[256]; + + memset(fn, 0, sizeof(fn)); + memset(path, 0, sizeof(path)); + + path_append_filename(path, usr_path, SCREENSHOT_PATH); + + if (!plat_dir_check(path)) + plat_dir_create(path); + + path_slash(path); + strcat(path, "Monitor_"); + snprintf(&path[strlen(path)], 42, "%d_", r_monitor_index + 1); + + plat_tempfile(fn, NULL, (char *) ".png"); + strcat(path, fn); + + QImage image = this->grab(); + image.save(path, "png"); + monitors[r_monitor_index].mon_screenshots--; + } + if (monitors[r_monitor_index].mon_screenshots_clipboard) { + QImage image = this->grab(); + QClipboard *clipboard = QApplication::clipboard(); + clipboard->setImage(image, QClipboard::Clipboard); + monitors[r_monitor_index].mon_screenshots_clipboard--; + } + if (monitors[r_monitor_index].mon_screenshots_raw_clipboard) { + take_screenshot_clipboard_monitor(x, y, w, h, r_monitor_index); + } } uint32_t diff --git a/src/qt_resources.qrc b/src/qt_resources.qrc index dda79c0b3cc..4b069cb3f18 100644 --- a/src/qt_resources.qrc +++ b/src/qt_resources.qrc @@ -71,6 +71,10 @@ qt/icons/interpreter.ico qt/icons/recompiler.ico qt/icons/new_vm.ico + qt/icons/take_screenshot.ico + qt/icons/take_raw_screenshot.ico + qt/icons/copy_screenshot.ico + qt/icons/copy_raw_screenshot.ico
qt/icons/warning.ico diff --git a/src/unix/unix_sdl.c b/src/unix/unix_sdl.c index 8d3a71002c5..fdd31d901ac 100644 --- a/src/unix/unix_sdl.c +++ b/src/unix/unix_sdl.c @@ -156,7 +156,7 @@ sdl_blit_shim(int x, int y, int w, int h, int monitor_index) for (int row = 0; row < h; ++row) video_copy(&(((uint8_t *) pixeldata)[row * 2048 * sizeof(uint32_t)]), &(buffer32->line[y + row][x]), w * sizeof(uint32_t)); - if (monitors[monitor_index].mon_screenshots) + if (monitors[monitor_index].mon_screenshots_raw) video_screenshot((uint32_t *) pixeldata, 0, 0, 2048); blitreq = 1; diff --git a/src/video/video.c b/src/video/video.c index 4c4256a8962..c1d09627038 100644 --- a/src/video/video.c +++ b/src/video/video.c @@ -376,7 +376,7 @@ video_screenshot_monitor(uint32_t *buf, int start_x, int start_y, int row_len, i video_take_screenshot_monitor((const char *) path, buf, start_x, start_y, row_len, monitor_index); png_destroy_write_struct(&png_ptr[monitor_index], &info_ptr[monitor_index]); - atomic_fetch_sub(&monitors[monitor_index].mon_screenshots, 1); + atomic_fetch_sub(&monitors[monitor_index].mon_screenshots_raw, 1); } void @@ -814,6 +814,9 @@ video_monitor_init(int index) monitors[index].mon_vid_type = VIDEO_FLAG_TYPE_NONE; atomic_init(&doresize_monitors[index], 0); atomic_init(&monitors[index].mon_screenshots, 0); + atomic_init(&monitors[index].mon_screenshots_clipboard, 0); + atomic_init(&monitors[index].mon_screenshots_raw, 0); + atomic_init(&monitors[index].mon_screenshots_raw_clipboard, 0); if (index >= 1) ui_init_monitor(index); monitors[index].mon_blit_data_ptr->blit_thread = thread_create(blit_thread, monitors[index].mon_blit_data_ptr); From adb8af06f959e8417f284df4016ec128db26bed9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 25 Dec 2025 15:17:46 +0600 Subject: [PATCH 152/320] Add CD audio play/pause indicators to icons --- src/qt/icons/pause.ico | Bin 43006 -> 43350 bytes src/qt/icons/run.ico | Bin 43006 -> 43350 bytes src/qt/qt_iconindicators.cpp | 15 +++++++++++--- src/qt/qt_iconindicators.hpp | 6 +++++- src/qt/qt_machinestatus.cpp | 37 +++++++++++++++++++++++++++++++++-- 5 files changed, 52 insertions(+), 6 deletions(-) diff --git a/src/qt/icons/pause.ico b/src/qt/icons/pause.ico index a71a38e91f8a963f8927dc6b18c1aa0a31f590f9..a6456910d90ba5b53cb4ff103a2162b628e93934 100644 GIT binary patch delta 592 zcmex&p6S{prg{bjMg|TB4h|5lz~I5iz|h9Pz#t$1;b*WgFq{L5iHJb>JJ=W)%z#)z z0>ba$WMFv5!@!`R0O79y>MIjtV9?Nj>X%|*kW*)1Fff41s{+k;WMFV`fbcbBofsJO z(t#R)mIB?t0Mrk52#{h>V4OHnynfaH{|r?-|APd;fX@7S20B}aX5ZwuO9dwv@bYXd z(_oqWZmGcJf((Pr_gFI6pd9Oo3s^T#)ex8*m+lKxZM^xIs)i(x jVU2+sbR;+HIcTV0NWc_-aFyG9Emgw-rvjM5f(#7+`T3;_ literal 43006 zcmeI5v2G+q5QZCpun++k9MXw^bAsdu-5Z?66YvO^An^nQM3zX15E0LScml|{geO3R z$d5qi;H05@cfY;a^7L#?U3FP-HPYzco~in(x@voNyt}qbd8b^IM~_O?%kuSmrF>IL zdHi@k{`LJ*{;tQKJlT)G|DcqgJ}l+(azFmL`hEIwDOXnq|4&N!TfAvKve|=T$YmDkzkL-_EDc3d5$~M(=a>raAZ{ySL+ux=#-}kJ&&HQ+KJU<7e z9{=IbX)3?eUD~XjOaEhyvwr{m=TGb5u8;FIa(MnPo|`@YPuAal4IQ5wy>l+B2Wq@c7iW&2zrb>vn2cPVDyeY0T5D9`CNBQ_CIi ztZnk{*O)qLYNN49-u>6iEj8I!-DYi)#I}c5qRxpVkg8s`b;_!9}%xT06L?)=z5(7uEV5?6_Cjy%w+itSb0t z{VM<7eO5bmZad@m`}FQKa&Pxxmvz6cJMSOdv^Or-H}0W&y6*k@Y|o$LuPx_~dNteE zyZP!iE2sLM+{?B5xh?l}WM}1A{fLWNIaWX7qE?R8kGQCnWA!60YUNn{h>Kb|RzKpR zR*uz=xTuw5^&>87&BQ9#?SpA5LS~*rf;-XfL)sMKS zm1FfIE^6gi{fLWNIaWX7qE?R8kGQCnWA!60YUNn{h>Kb|RzKpRR*uz=xTuw5^&>87 z> zJmlWqr)c|^b?1GG>-t?R#m0LHYpTF3nyfK7x9E60*sDFqw>+PY(8B{5J=L(QZ+mX; z-rwMT4zzJK44D^W54Hz`e587?Js2`C#vW`B2Kh+!V0$oRUW`519t`r4>cRG4$h;VP zuss;$Bh`cL!H{_|_F#K3$VaLN+k+wVV(h{8V33bg54HzG=Ec~9?ZF@)sUB<(hRlnx z2it=|K2kl{9t@cmV-L0mgM6fVuss+uFUB5h4+i;2^k?O(rV92}} zd$2ti1 z&221eZ|<*oyd_5Ebw8`(Gb^;k-omDEBV&wYXZ}>6uUY?oZ8$TsMkCpoKNaX}*1umH z&Wx7AYc!Ib`BQF%=da4sX-a*VI<)U;UDy4l?tD+H)c?J*VdMKh7TpkLlc^;a zd^QEzyv|q`Th{ZojBIPOmK`n7A+;@>skJ7Q9;v9xuF%qcQf&RYmN5G6nRaGjFt1(RUon_k+F2M&)5IR zouK&oMM8?Yg>naf0lgL=Q+2{I? z>`7#-?7yx8kv)lwrJH@O|Hz(1#>)QdDiGO|$XL4B=lYNANo1_-zpet2J&BB^n|-eT z$eu*T%Kqyr5ZRN+Si0Hg`j6~MWUTDJt^$!giHxP2eXjq=ouK&oMM8?Yg>naf0lgL=Q+2{I?>`7#-?7yx8kv)lwrJMbO ytbhJafmZ8Ow*Ri-#`$Y=!OoOZ?f)D64!Cwk+w2D9^r~D;({1}>4XJNq9sUJQO5i2{ diff --git a/src/qt/icons/run.ico b/src/qt/icons/run.ico index dfb43b05bcbd8d268fc25ac9277fdd8ef7506348..b4bd9bf922c2418dd92b34ef1c42ac991859bc01 100644 GIT binary patch delta 302 zcmXYru}%U(5QhId53+|suHXPQUN%u=5)*QjEen;M_BL1;cmi6tGWL_$(^+b^@d+%| zSWwCvnCne|;g(D$Gv7@9nSb>aE`GuXAb^5W+p2LD0FMBY#Pc))K4sQydVa40my(^1 z=cgF>I{>uy{35zp3n1F*kASQP!w^r9;jqOPSuezM-=cteLyTJ(&`=+aeup0B1gh6ov1`maPaRy9g*yWL$vQDoRB=CQra4&>->zX$KnM325EYZ$r5e60IeQ z(4m!5q(h778P2&s4xm`N{^tIjduR6Y>)!9}UJ+?zF3TmklC!DExriJbnEz=e@*T0m zL-XJ7i+s2vvRaw{5q(GZMB3K-ABuc=EOK(UZ6O<;{1&x|pL8rHIB1M8m7&SuYf`bQ;s2RnsUV9AYV#6p#|l^J^ZV_xY%%3CtfysIf}x|w?R)IqOM)$6 z6PVBnEWzfmi5t(1F;}gYJ?w=BwWvvL&ZssMvzyu-J!v248i?vDx)8L)rX7{ zl1g0Cn4S1i_;CfJ6>v58lT(!tr&2+KRgf7Gl2Rn4{$|9Zu2^1ILR|wf>bIjR4I~`BxjPGNm5Fgosd!=Qc6e}i!(Xr z&c-Rl>Lh!;EIbhOgm^hsxEP;;b2IXK0LXY6*3nPSVzh5? d^VIsHsLM=)iknZRDu^eK7voPu<)@$W{0GHy7@zsetPixmap(write_active ? pixmaps->empty_write_active : (active ? pixmaps->empty_active : pixmaps->empty)); } else { - if (wp) + if (wp && !(play || pause)) label->setPixmap(active ? pixmaps->wp_active : pixmaps->wp); - else if (active && write_active) + else if (active && write_active && !wp) label->setPixmap(pixmaps->read_write_active); + else if ((play || pause) && !write_active) + label->setPixmap(play ? (active ? pixmaps->play_active : pixmaps->play) : (active ? pixmaps->pause_active : pixmaps->pause)); else label->setPixmap(write_active ? pixmaps->write_active : (active ? pixmaps->active : pixmaps->normal)); } @@ -252,6 +278,10 @@ void PixmapSetEmptyActive::load(const QIcon &icon) { normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None); + play = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Play); + pause = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Pause); + play_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, PlayActive); + pause_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, PauseActive); wp = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteProtected); wp_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteProtectedActive); active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Active); @@ -504,8 +534,11 @@ MachineStatus::refreshIcons() d->fdd[i].setWriteActive(machine_status.fdd[i].write_active); } for (size_t i = 0; i < CDROM_NUM; ++i) { + auto status = cdrom_get_current_status(&cdrom[i]); d->cdrom[i].setActive(machine_status.cdrom[i].active); d->cdrom[i].setWriteActive(machine_status.cdrom[i].write_active); + d->cdrom[i].setPlay(status == 0x11); + d->cdrom[i].setPause((!cdrom[i].is_chinon) ? (status == 0x12) : (status == 0x15)); if (machine_status.cdrom[i].active) { ui_sb_update_icon(SB_CDROM | i, 0); } From dfd36f6e89e71efdbfdca3e68a9ae25d0e521c88 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 25 Dec 2025 15:45:34 +0100 Subject: [PATCH 153/320] The remaining sizes for the indicator and proper functions for determining the playing and paused statuses of a CD-ROM drive. --- src/cdrom/cdrom.c | 16 ++++++++++++++++ src/include/86box/cdrom.h | 2 ++ src/qt/icons/pause.ico | Bin 43350 -> 44526 bytes src/qt/icons/run.ico | Bin 43350 -> 44526 bytes src/qt/qt_machinestatus.cpp | 5 ++--- 5 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/cdrom/cdrom.c b/src/cdrom/cdrom.c index 52ea9797206..e5f6ba259d4 100644 --- a/src/cdrom/cdrom.c +++ b/src/cdrom/cdrom.c @@ -3224,6 +3224,22 @@ cdrom_is_empty(const uint8_t id) return ret; } +int +cdrom_is_playing(const uint8_t id) +{ + const cdrom_t *dev = &cdrom[id]; + + return (dev->cd_status == CD_STATUS_PLAYING); +} + +int +cdrom_is_paused(const uint8_t id) +{ + const cdrom_t *dev = &cdrom[id]; + + return (dev->cd_status == CD_STATUS_PAUSED); +} + /* The mechanics of ejecting a CD-ROM from a drive. */ void cdrom_eject(const uint8_t id) diff --git a/src/include/86box/cdrom.h b/src/include/86box/cdrom.h index 4876760239f..fb157ba6611 100644 --- a/src/include/86box/cdrom.h +++ b/src/include/86box/cdrom.h @@ -481,6 +481,8 @@ extern void cdrom_close(void); extern void cdrom_insert(const uint8_t id); extern void cdrom_exit(const uint8_t id); extern int cdrom_is_empty(const uint8_t id); +extern int cdrom_is_playing(const uint8_t id); +extern int cdrom_is_paused(const uint8_t id); extern void cdrom_eject(const uint8_t id); extern void cdrom_reload(const uint8_t id); diff --git a/src/qt/icons/pause.ico b/src/qt/icons/pause.ico index a6456910d90ba5b53cb4ff103a2162b628e93934..3f7079fd758e31647ccd9387c5399574d65fc6c5 100644 GIT binary patch literal 44526 zcmeHQy^b735H4fnGu88vp*U!}x~2;vaSFf8WQl(^4%ua(al< zHR$;4xQ<0H6lmAuXFqm?+UwrWLtnwt&$wHI)L!<>HoVGy+5V5t8}cUN8~S-2gMQ^2 zMf9IO={ij<`Q@X!+XLl1m+}>#*_krU<2ZNM=jVD3_8f3LAAP_w#@9o>OTU(P8UcISTAt*K>SmV5VxEB57V0TBlZxM?b2W3otC_2rlYIT2nA;1f-{GFm{gV4d?19DCnl*FzyiM-UrClovbDv+G zlV>fjSLNUB{1{|--FnK;P8JGYe%&-BFfE$zP0&XYd0cG`KbIX~W4?Ouyly#5}wWBm`_ zXO+HV<%r!M-EC@F%lohm*DY5(Ke#9lE|&}5yVP*m`g*ixkN)eKuQQ7ii_N+QBc-%44;IU!ax8Y6rhSE05I< zet}jVs~!9Ttvpsc_yt;dtak7VwDMT(;1_7+vD(2e(8^=AgI}PP$7%<^Kr4^c4t{}F z9;+Sv0xYGA^_|xIH)!k3mbxX||C_TWG~ z5 z4-Uj5(SzHAL&k-+2e$_Y;*sdV?ZF}ALfeDeg9GtM^x*d3ka3~y!R^6;cqDpodvM6O z(DvZ=;6OYQJ-9tMWL#)_aC>kd9*G{@9vm_*v^}^zI1rCS4{i?*85i0f+#Vc=N1_M! zo&!BC^gPS=PKZ_~j)?(oP=cK#5&;Al^I+V|t%HJeC<%-XlF8DWElm(xM ztU)F9Fl`Mt<_^Y-7n=Pxo?|(CV|&f@8XwG8{j3U~SpkdhHQW%crH_`}89x-LW9nbm z1|uysYRR4PLxDP`{&j6I(o&R;CeBP}&*$(`{-fjXxCb!{-x zQlpmK89x-LW9nbm1|uysYRR4PLxDP`{&j6I(o&Y5E54^i{C{VyDER)5 z1y{IPHPsReY*sm1eFkvu)|}^c5!udWiOUib+m(CN?C%=jJ7N;8zO*_-#uVu**RN9` zGAEI~bgQ5Ke=hRu)!MucrZ06}$@S;`FYo{P`d7QJ%=KIEHQGB<)#v$-%t@rL%)d^7$ecv_(yczve`HP~eP#Z23Pk24 z(wA=adHy4F66q`RuTvm0Cy~B%tIzWvnUhFgnSY%EkvWOJJ=W)%z#)z z0>ba$WMFv5!@!`R0O79y>MIjtV9?Nj>X%|*kW*)1Fff41s{+k;WMFV`fbca~ofsJO z(kCv_1v+Ha|NjhCJO2Z%hXA_rf%Xrm118^IEj&q>XLA~x2Fv7os|6+}XfGJ)O SB)9okwuS>v1u%sPc^Ux0Y@t>F diff --git a/src/qt/icons/run.ico b/src/qt/icons/run.ico index b4bd9bf922c2418dd92b34ef1c42ac991859bc01..8909146728201ff61694e5bde5e121f46ad9ceb2 100644 GIT binary patch delta 2124 zcmZ8hO=w(I6h80GG?NTN<|V|CD)t6R%xh9~z#;{qFLoh{3zx2>I~84|8&_T2NX2#| zrQC(?W}!&;1GZ4ah~P4U3pXMRbkUV%#HGmf`_4V5q7S}&_xye5+;fNg@^k(8*E)(+ zGL+?I^0vHQiF_?0!(p-Kupa}XQL(?MMNWGnO;ham`y%fyiEL~X`##R6sNLEs_N^6> zPuE1Yw~Kujb*s;aw5`?eJ}vUifyiWH3A-ZaUK2SyEOvWEn6o& zDScKC)0cydH0_Pji&cEN!^i^wlRo))rjIdn!zD2$z-#imU!}GBsq}aCe0rsB)9rRM zef!dLDO9U>ejBE7g--j+=+LC2{jGGh-=x3#ZQ9#q>Uw(i%w~FUX76&Ba~=adK#0y@ zKE~k6oB%r%?B&S>*J?~~78AUXu3wozc9h<3Ch1;tDTTF5>1bt=zFTQix8A1D*Ds`_ zuh@E&-rU(i>x0P@vbTX7z%dblVBi@(#+Wk&W~Wu#zdX$%H-V3V;|O%X7{IF@V`mDU z>0=Bz%w^3q&n_-~u=Lh6FJLd=Umy+yU<~vCA+7<9foJ#_V-9ms!&+)UYxeu-{K{2~ z2uDUBBLN7&0O$cibif!G0F{Af`WQnFb6LY$Xi$rq(4Kv?dA^B1VGln5CqxGXU;tEr zL?8fTpa%#MfdCAEo`Glj7|SJ>HLQgOwWvvL_Q<6tdRKXNZm&J7V_=`cQOMsLpTuIb zlzz%6LsD6sJF~~eJ!2%W4x~d_`Xul}<40utmM^@we;EH% zXU+@fSPqL|%%1ob+62t)(&l!RwHs{h4laocE?46cj5QH{O$1XZqCg)?nVGcNlT0Zx zrIb5kNU04eWk?l{#=&@CTp3F&dD2JJ=W)%z#)z z0>ba$WMFv5!@!`R0O79y>MIjtV9?Nj>X%|*kW*)1Fff41s{+k;WMFV`fbca~ofsJO z(kCv7ovh2wH@TmQV{$%|#AIn!fywik_$E(GQ=44O7(ICdo5JQaHVu}^7X%$PpX174 zo17pWu(?f8gL9Hj!e%~c4S`8I4V$-VYe-Hu$Ui?xr*N~Jn}!OA4a6HaAIsKofO3G6 FNdWgaI9dPz diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index 82ef631593a..bbcee95ccff 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -534,11 +534,10 @@ MachineStatus::refreshIcons() d->fdd[i].setWriteActive(machine_status.fdd[i].write_active); } for (size_t i = 0; i < CDROM_NUM; ++i) { - auto status = cdrom_get_current_status(&cdrom[i]); d->cdrom[i].setActive(machine_status.cdrom[i].active); d->cdrom[i].setWriteActive(machine_status.cdrom[i].write_active); - d->cdrom[i].setPlay(status == 0x11); - d->cdrom[i].setPause((!cdrom[i].is_chinon) ? (status == 0x12) : (status == 0x15)); + d->cdrom[i].setPlay(cdrom_is_playing(i)); + d->cdrom[i].setPause(cdrom_is_paused(i)); if (machine_status.cdrom[i].active) { ui_sb_update_icon(SB_CDROM | i, 0); } From 8377dad8c66a18d736ef206849338af129a18a4c Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 26 Dec 2025 18:00:09 +0100 Subject: [PATCH 154/320] Give the 12x12, 10x10, and 8x8 sizes to the record icon. --- src/qt/icons/record.ico | Bin 9622 -> 11142 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/record.ico b/src/qt/icons/record.ico index 357563594e7fb6a38034a7e4c9224b1349bdc81d..3715837b10ace0c8374b8b280e56d1b79d9aaf06 100644 GIT binary patch delta 563 zcmZ9IKTE?<6va>4^tHbJ@mbSYiqxpJbnN6*)JX)PIO*cz=BSHn>mrVZ3*usDM=K5) zY!Lhc&P7DOf$l=QFVBWz;3PRGH#xuD>)nfk9$+DhTuxs->{!4V04a_CU>~vy1>x!3GWuXuY}|zMc<8PvWIGn;>5o=&L~C@Le delta 80 zcmZn*pXTkxz`)4B!XO|3q7@i2SQr?9LJT4z5dID}28MM&F$oC>zk`#3A&r}XK|uk+ QUjfwj4ybms8C!rV0BULphyVZp From d1bcf8421c9c2f967c8e5cf3fbcf75bb21e5ca0e Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 26 Dec 2025 23:01:29 +0600 Subject: [PATCH 155/320] Play/record indicators for cassette --- src/device/cassette.c | 13 ++++++++++--- src/qt/qt_iconindicators.cpp | 14 ++++++++++---- src/qt/qt_iconindicators.hpp | 4 +++- src/qt/qt_machinestatus.cpp | 27 +++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 8 deletions(-) diff --git a/src/device/cassette.c b/src/device/cassette.c index b2d8f7a1cd4..c648139996a 100644 --- a/src/device/cassette.c +++ b/src/device/cassette.c @@ -500,7 +500,10 @@ pc_cas_set_motor(pc_cassette_t *cas, unsigned char val) else timer_disable(&cas->timer); - ui_sb_update_icon(SB_CASSETTE, !!val); + if (!cas->save) + ui_sb_update_icon(SB_CASSETTE, !!val); + else + ui_sb_update_icon_write(SB_CASSETTE, !!val); } unsigned char @@ -665,8 +668,12 @@ cassette_callback(void *priv) pc_cas_clock(cas, 8); - if (cas->motor) - ui_sb_update_icon(SB_CASSETTE, 1); + if (cas->motor) { + if (cas->pcm && cas->save) + ui_sb_update_icon_write(SB_CASSETTE, 1); + else + ui_sb_update_icon(SB_CASSETTE, 1); + } timer_advance_u64(&cas->timer, 8ULL * PITCONST); } diff --git a/src/qt/qt_iconindicators.cpp b/src/qt/qt_iconindicators.cpp index 22ae9e9a666..771a9ac59a2 100644 --- a/src/qt/qt_iconindicators.cpp +++ b/src/qt/qt_iconindicators.cpp @@ -14,6 +14,8 @@ getIndicatorIcon(IconIndicator indicator) return QIcon(":/settings/qt/icons/active.ico"); case WriteActive: return QIcon(":/settings/qt/icons/write_active.ico"); + case Record: + return QIcon(":/settings/qt/icons/record.ico"); case Disabled: return QIcon(":/settings/qt/icons/disabled.ico"); case WriteProtected: @@ -41,17 +43,21 @@ getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode, auto painter = QPainter(&iconPixmap); auto indicatorPixmap = getIndicatorIcon((indicator == ReadWriteActive || indicator == WriteProtectedActive - || indicator == PlayActive || indicator == PauseActive)? Active : indicator) - .pixmap((indicator == Play || indicator == Pause) ? size / 2. : size); + || indicator == PlayActive || indicator == PauseActive) ? Active : + (indicator == RecordWriteActive) ? Record : indicator) + .pixmap((indicator == Play || indicator == Pause || indicator == Record || indicator == RecordWriteActive) ? size / 2. : size); if (indicator == WriteProtectedBrowse) indicatorPixmap = getIndicatorIcon(WriteProtected).pixmap(size); - painter.drawPixmap(0, (indicator == Play || indicator == Pause) ? (size.height() / 2) : 0, indicatorPixmap); + if (indicator == Record || indicator == RecordWriteActive) + painter.drawPixmap(size.width() / 2, size.height() / 2, indicatorPixmap); + else + painter.drawPixmap(0, (indicator == Play || indicator == Pause) ? (size.height() / 2) : 0, indicatorPixmap); if (indicator == PlayActive || indicator == PauseActive) { auto playPauseIndicatorPixmap = getIndicatorIcon(indicator == PlayActive ? Play : Pause).pixmap(size / 2.); painter.drawPixmap(0, size.height() / 2, playPauseIndicatorPixmap); - } else if ((indicator == ReadWriteActive) || (indicator == WriteProtectedActive)) { + } else if ((indicator == ReadWriteActive) || (indicator == WriteProtectedActive) || (indicator == RecordWriteActive)) { auto writeIndicatorPixmap = getIndicatorIcon(indicator == WriteProtectedActive ? WriteProtected : WriteActive).pixmap(size); painter.drawPixmap(0, 0, writeIndicatorPixmap); } else if (indicator == WriteProtectedBrowse) { diff --git a/src/qt/qt_iconindicators.hpp b/src/qt/qt_iconindicators.hpp index 7d1b4e0419b..971ab6ead0e 100644 --- a/src/qt/qt_iconindicators.hpp +++ b/src/qt/qt_iconindicators.hpp @@ -20,7 +20,9 @@ enum IconIndicator { Play, Pause, PlayActive, - PauseActive + PauseActive, + Record, + RecordWriteActive }; QPixmap getIconWithIndicator(const QIcon &icon, const QSize &size, QIcon::Mode iconMode, IconIndicator indicator); diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index bbcee95ccff..9773c404db4 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -83,6 +83,7 @@ struct PixmapSetEmpty { struct PixmapSetEmptyActive { QPixmap normal; QPixmap active; + QPixmap record; QPixmap play; QPixmap pause; QPixmap play_active; @@ -90,6 +91,7 @@ struct PixmapSetEmptyActive { QPixmap empty; QPixmap empty_active; QPixmap write_active; + QPixmap record_write_active; QPixmap read_write_active; QPixmap empty_write_active; QPixmap empty_read_write_active; @@ -175,6 +177,16 @@ struct StateEmptyActive { bool wp = false; bool play = false; bool pause = false; + bool record = false; + + void setRecord(bool b) + { + if (!label || b == record) + return; + + record = b; + refresh(); + } void setPlay(bool b) { @@ -240,6 +252,8 @@ struct StateEmptyActive { label->setPixmap(active ? pixmaps->wp_active : pixmaps->wp); else if (active && write_active && !wp) label->setPixmap(pixmaps->read_write_active); + else if (record && !active && !wp) + label->setPixmap(write_active ? pixmaps->record_write_active : pixmaps->record); else if ((play || pause) && !write_active) label->setPixmap(play ? (active ? pixmaps->play_active : pixmaps->play) : (active ? pixmaps->pause_active : pixmaps->pause)); else @@ -280,12 +294,14 @@ PixmapSetEmptyActive::load(const QIcon &icon) normal = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, None); play = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Play); pause = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Pause); + record = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Record); play_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, PlayActive); pause_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, PauseActive); wp = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteProtected); wp_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteProtectedActive); active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, Active); write_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, WriteActive); + record_write_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, RecordWriteActive); read_write_active = getIconWithIndicator(icon, pixmap_size, QIcon::Normal, ReadWriteActive); empty = getIconWithIndicator(icon, pixmap_size, QIcon::Disabled, None); empty_active = getIconWithIndicator(icon, pixmap_size, QIcon::Disabled, Active); @@ -525,10 +541,21 @@ MachineStatus::refreshEmptyIcons() void MachineStatus::refreshIcons() { + /* Always show record/play statuses of cassette even if icon updates are disabled, since it's important to indicate play/record modes. */ + if (cassette_enable) { + d->cassette.setRecord(!!cassette->save); + d->cassette.setPlay(!cassette->save); + } + /* Check if icons should show activity. */ if (!update_icons) return; + if (cassette_enable) { + d->cassette.setWriteActive(machine_status.cassette.write_active); + d->cassette.setActive(machine_status.cassette.active); + } + for (size_t i = 0; i < FDD_NUM; ++i) { d->fdd[i].setActive(machine_status.fdd[i].active); d->fdd[i].setWriteActive(machine_status.fdd[i].write_active); From 9bcf3c0c9e21801a258dbe05efe604d517d3f1e9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 27 Dec 2025 17:15:45 +0600 Subject: [PATCH 156/320] S3: Allow gamma correction in Trio3D/2X --- src/video/vid_s3_virge.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 5fa84e555b8..cc4f75205fb 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -828,6 +828,7 @@ s3_virge_recalctimings(svga_t *svga) if (virge->chip >= S3_TRIO3D2X) { svga_set_ramdac_type(svga, (svga->seqregs[0x1b] & 0x10) ? RAMDAC_8BIT : RAMDAC_6BIT); + svga->lut_map = !!(svga->seqregs[0x1b] & 0x8); } if (!svga->scrblank && svga->attr_palette_enable && (svga->crtc[0x43] & 0x80)) { /* TODO: In case of bug reports, disable 9-dots-wide character clocks in graphics modes. */ @@ -5377,6 +5378,7 @@ s3_virge_init(const device_t *info) s3_virge_hwcursor_draw, s3_virge_overlay_draw); virge->svga.hwcursor.cur_ysize = 64; + virge->svga.conv_16to32 = tvp3026_conv_16to32; if (bios_fn != NULL) { if (virge->type == S3_VIRGE_GX2) From 803453cdcb8d53a48ea909669576ccc6ebff9c42 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 27 Dec 2025 17:45:40 +0600 Subject: [PATCH 157/320] Fix card detection by S3VBEFIX --- src/video/vid_s3.c | 2 +- src/video/vid_s3_virge.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/vid_s3.c b/src/video/vid_s3.c index 175b5048fad..101d3ae8bf5 100644 --- a/src/video/vid_s3.c +++ b/src/video/vid_s3.c @@ -3527,7 +3527,7 @@ s3_in(uint16_t addr, void *priv) } break; case 0x30: - return s3->id; /*Chip ID*/ + return ((svga->crtc[0x38] & 0xcc) != 0x48) ? 0xFF : s3->id; /*Chip ID*/ case 0x31: return (svga->crtc[0x31] & 0xcf) | ((s3->ma_ext & 3) << 4); case 0x35: diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index cc4f75205fb..bb1b2b11e56 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -751,7 +751,7 @@ s3_virge_in(uint16_t addr, void *priv) ret = virge->virge_rev; break; case 0x30: - ret = virge->virge_id; + ret = ((svga->crtc[0x38] & 0xcc) != 0x48) ? 0xFF : virge->virge_id; break; /*Chip ID*/ case 0x31: ret = (svga->crtc[0x31] & 0xcf) | ((virge->ma_ext & 3) << 4); From 6af1524cfec5a9e3cad6e1a8869897b1d53604fe Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 27 Dec 2025 17:13:25 +0100 Subject: [PATCH 158/320] Video: Add the graphics card before any coprocessor cards such as the 8514/a. --- src/video/vid_table.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 88cd6789e70..3e637f158a7 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -389,6 +389,10 @@ video_reset(int card) void video_post_reset(void) { + /* Reset the graphics card (or do nothing if it was already done + by the machine's init function). */ + video_reset(gfxcard[0]); + int ibm8514_has_vga = 0; if (gfxcard[0] == VID_INTERNAL) ibm8514_has_vga = (video_get_type_monitor(0) == VIDEO_FLAG_TYPE_8514); @@ -408,9 +412,6 @@ video_post_reset(void) if (da2_standalone_enabled) da2_device_add(); - /* Reset the graphics card (or do nothing if it was already done - by the machine's init function). */ - video_reset(gfxcard[0]); } void From e315b70fd26c1a4b2e0980b8d3a0beb90e244a8a Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 27 Dec 2025 17:23:52 +0100 Subject: [PATCH 159/320] Force interpretation: Menu/toolbar item is no longer checkable. --- src/qt/qt_mainwindow.ui | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 27501d0b90e..f03beee7cef 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -321,9 +321,6 @@ :/menuicons/qt/icons/interpreter.ico:/menuicons/qt/icons/interpreter.ico - - true - &Force interpretation From c7923229abdb6a9f637d37a34c1e4d5ea4e0b4bc Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 27 Dec 2025 23:48:13 +0600 Subject: [PATCH 160/320] Add scale labels to Sound Gain dialog --- src/qt/qt_soundgain.ui | 89 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_soundgain.ui b/src/qt/qt_soundgain.ui index 8d3f2c3f6b6..72323f25161 100644 --- a/src/qt/qt_soundgain.ui +++ b/src/qt/qt_soundgain.ui @@ -31,7 +31,90 @@ Sound Gain - + + + + + -18 dB + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + -4 dB + + + + + + + -8 dB + + + + + + + -14 dB + + + + + + + -12 dB + + + + + + + -2 dB + + + + + + + -16 dB + + + + + + + -6 dB + + + + + + + -10 dB + + + + + + + 0 dB + + + @@ -48,7 +131,7 @@ - + 18 @@ -70,7 +153,7 @@ - + From d35da5a5c1617297834253029c01ac52f7bcfd24 Mon Sep 17 00:00:00 2001 From: Domppari Date: Sat, 27 Dec 2025 22:29:08 +0200 Subject: [PATCH 161/320] Fixes recalibration not working correclty with audio profiles, even when no audio was selected. --- src/floppy/fdc.c | 18 +++++++++++------- src/floppy/fdd.c | 9 ++------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index de0549ca42d..fb1b0c31e7a 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -1142,7 +1142,7 @@ fdc_write(uint16_t addr, uint8_t val, void *priv) timer_set_delay_u64(&fdc->timer, 1000 * TIMER_USEC); else timer_set_delay_u64(&fdc->timer, 256 * TIMER_USEC); - break; + break; default: timer_set_delay_u64(&fdc->timer, 256 * TIMER_USEC); break; @@ -1882,13 +1882,17 @@ fdc_callback(void *priv) fdc->st0 = 0x20 | (fdc->params[0] & 3); if (!fdd_track0(drive_num)) fdc->st0 |= 0x50; - if (fdc->flags & FDC_FLAG_PCJR) { - fdc->fintr = 1; - fdc->interrupt = -4; - } else - fdc->interrupt = -3; - timer_set_delay_u64(&fdc->timer, 2048 * TIMER_USEC); fdc->stat = 0x10 | (1 << fdc->rw_drive); + if (fdd_get_turbo(drive_num)) { + if (fdc->flags & FDC_FLAG_PCJR) { + fdc->fintr = 1; + fdc->interrupt = -4; + } else { + fdc->interrupt = -3; + } + timer_set_delay_u64(&fdc->timer, 2048 * TIMER_USEC); + } + /* Interrupts and callbacks in the fdd callback function (fdc_seek_complete_interrupt) */ return; case 0x0d: /*Format track*/ if (fdc->format_state == 1) { diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 14627a3f9e8..5cf21c77cbc 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -419,9 +419,9 @@ fdd_seek(int drive, int track_diff) fdd_changed[drive] = 0; - if (fdd[drive].turbo) + if (fdd[drive].turbo) { fdd_do_seek(drive, fdd[drive].track); - else { + } else { /* Trigger appropriate audio for track movements */ int actual_track_diff = abs(old_track - fdd[drive].track); if (actual_track_diff > 0) { @@ -429,11 +429,6 @@ fdd_seek(int drive, int track_diff) fdd_audio_play_multi_track_seek(drive, old_track, fdd[drive].track); } - if (old_track + track_diff < 0) { - fdd_do_seek(drive, fdd[drive].track); - return; - } - fdd_seek_in_progress[drive] = 1; if (!fdd_seek_timer[drive].callback) { From 41bcccc325462be0fdc404e134081b05f8084ca6 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 27 Dec 2025 22:41:25 +0100 Subject: [PATCH 162/320] Sound gain: Fix the scale label values and their alignment. --- src/qt/qt_soundgain.ui | 116 ++++++++++++++++++++++++++--------------- 1 file changed, 73 insertions(+), 43 deletions(-) diff --git a/src/qt/qt_soundgain.ui b/src/qt/qt_soundgain.ui index 72323f25161..2f796a5fafa 100644 --- a/src/qt/qt_soundgain.ui +++ b/src/qt/qt_soundgain.ui @@ -32,13 +32,6 @@ Sound Gain - - - - -18 dB - - - @@ -52,82 +45,119 @@ - - - - -4 dB + + + + + 0 + 0 + - - - - - -8 dB + Gain - - - - - - -14 dB + + Qt::AlignCenter - - + + - -12 dB + 18 dB + + + Qt::AlignRight - -2 dB + 16 dB + + + Qt::AlignRight - - + + - -16 dB + 14 dB + + + Qt::AlignRight - -6 dB + 12 dB + + + Qt::AlignRight + + + + + + + 10 dB + + + Qt::AlignRight - -10 dB + 8 dB + + + Qt::AlignRight - - + + - 0 dB + 6 dB + + + Qt::AlignRight - - - - - 0 - 0 - + + + + 4 dB + + + Qt::AlignRight + + + + + + + 2 dB + + + Qt::AlignRight + + + + - Gain + 0 dB - Qt::AlignCenter + Qt::AlignRight From d227bc54bb7b1683e6de3f93c7059e2c90b6ff94 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sat, 27 Dec 2025 17:10:43 -0600 Subject: [PATCH 163/320] AD1816: Don't reset playback_pos when sample count is < 0, fixes playback glitches on Win3.1 drivers --- src/sound/snd_ad1816.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/sound/snd_ad1816.c b/src/sound/snd_ad1816.c index 2ba79fc4c82..c989b9fade4 100644 --- a/src/sound/snd_ad1816.c +++ b/src/sound/snd_ad1816.c @@ -337,7 +337,6 @@ ad1816_poll(void *priv) if (ad1816->count < 0) { ad1816->count = ad1816->iregs[8]; ad1816->regs[1] |= 0x80; - ad1816->playback_pos = 0; if (ad1816->iregs[1] & 0x8000) { ad1816_log(ad1816->log, "AD1816 Playback interrupt fired\n"); picint(1 << ad1816->cur_irq); From b65217a3cb85c7fe3211266a0364d82635810dde Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sat, 27 Dec 2025 17:17:30 -0600 Subject: [PATCH 164/320] AD1816: Right shift master and wave volume values by 1, makes wave output audible on Win3.1 at default volume --- src/sound/snd_ad1816.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/sound/snd_ad1816.c b/src/sound/snd_ad1816.c index c989b9fade4..4e929794d91 100644 --- a/src/sound/snd_ad1816.c +++ b/src/sound/snd_ad1816.c @@ -129,12 +129,12 @@ ad1816_update_mastervol(void *priv) if (ad1816->iregs[14] & 0x8000) ad1816->master_l = 0; else - ad1816->master_l = ad1816_vols_5bits[(ad1816->iregs[14] >> 8) & 0x1f] / 65536.0; + ad1816->master_l = ad1816_vols_5bits[((ad1816->iregs[14] >> 8) & 0x1f) >> 1] / 65536.0; if (ad1816->iregs[14] & 0x0080) ad1816->master_r = 0; else - ad1816->master_r = ad1816_vols_5bits[(ad1816->iregs[14]) & 0x1f] / 65536.0; + ad1816->master_r = ad1816_vols_5bits[((ad1816->iregs[14]) & 0x1f) >> 1] / 65536.0; } void @@ -327,12 +327,12 @@ ad1816_poll(void *priv) if (ad1816->iregs[4] & 0x8000) ad1816->out_l = 0; else - ad1816->out_l = (int16_t) ((ad1816->out_l * ad1816_vols_6bits[(ad1816->iregs[4] >> 8) & 0x3f]) >> 16); + ad1816->out_l = (int16_t) ((ad1816->out_l * ad1816_vols_6bits[((ad1816->iregs[4] >> 8) & 0x3f) >> 1]) >> 16); if (ad1816->iregs[4] & 0x0080) ad1816->out_r = 0; else - ad1816->out_r = (int16_t) ((ad1816->out_r * ad1816_vols_6bits[ad1816->iregs[4] & 0x3f]) >> 16); + ad1816->out_r = (int16_t) ((ad1816->out_r * ad1816_vols_6bits[(ad1816->iregs[4] & 0x3f) >> 1]) >> 16); if (ad1816->count < 0) { ad1816->count = ad1816->iregs[8]; From 47bff0fdb5fe475f3fcd40a64e86dfc9167e216e Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 28 Dec 2025 00:20:29 +0100 Subject: [PATCH 165/320] Added + signs to positive dB values. --- src/qt/qt_soundgain.ui | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/qt/qt_soundgain.ui b/src/qt/qt_soundgain.ui index 2f796a5fafa..06ea38c1059 100644 --- a/src/qt/qt_soundgain.ui +++ b/src/qt/qt_soundgain.ui @@ -64,7 +64,7 @@ - 18 dB + +18 dB Qt::AlignRight @@ -74,7 +74,7 @@ - 16 dB + +16 dB Qt::AlignRight @@ -84,7 +84,7 @@ - 14 dB + +14 dB Qt::AlignRight @@ -94,7 +94,7 @@ - 12 dB + +12 dB Qt::AlignRight @@ -104,7 +104,7 @@ - 10 dB + +10 dB Qt::AlignRight @@ -114,7 +114,7 @@ - 8 dB + +8 dB Qt::AlignRight @@ -124,7 +124,7 @@ - 6 dB + +6 dB Qt::AlignRight @@ -134,7 +134,7 @@ - 4 dB + +4 dB Qt::AlignRight @@ -144,7 +144,7 @@ - 2 dB + +2 dB Qt::AlignRight From 8e176a52950e4ae55853e7726348c5f0d9d546e8 Mon Sep 17 00:00:00 2001 From: RSX798 Date: Sun, 28 Dec 2025 14:05:07 +0800 Subject: [PATCH 166/320] Update it-IT.po --- src/qt/languages/it-IT.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 36621b840bb..7c76f0cbec0 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -154,13 +154,13 @@ msgid "VGA screen &type" msgstr "Schermi &VGA" msgid "RGB &Color" -msgstr "RGB a &Colori" +msgstr "RGB a &colori" msgid "RGB (no brown)" msgstr "RGB (senza marrone)" msgid "&RGB Grayscale" -msgstr "&RGB a Scala di grigi" +msgstr "&RGB a scala di grigi" msgid "Generic RGBI color monitor" msgstr "Monitor a colori RGBI generico" @@ -1123,7 +1123,7 @@ msgid "VMs: %1" msgstr "Macchine virtuali: %1" msgid "System Directory:" -msgstr "Directory Sistema:" +msgstr "Directory sistema:" msgid "Choose directory" msgstr "Scegli la directory" @@ -2392,10 +2392,10 @@ msgid "Wheel" msgstr "Rotellina" msgid "Five + Wheel" -msgstr "Cinque + Rotellina" +msgstr "Cinque + rotellina" msgid "Five + 2 Wheels" -msgstr "Cinque + 2 Rotelline" +msgstr "Cinque + 2 rotelline" msgid "A3 - SMT2 Serial / SMT3(R)V" msgstr "A3 - SMT2 seriale / SMT3(R)V" From 0d2a64ab48fd36016a4fa92d3f306ae66876750d Mon Sep 17 00:00:00 2001 From: RSX798 Date: Sun, 28 Dec 2025 20:58:37 +0800 Subject: [PATCH 167/320] Update fr-FR.po --- src/qt/languages/fr-FR.po | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index aa550e5f313..bb1857e9975 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -55,10 +55,10 @@ msgid "&Resizeable window" msgstr "Fenêtre &redimensionnable" msgid "R&emember size && position" -msgstr "S&auvegarder taille && position" +msgstr "S&auvegarder taille et position" msgid "Remember size && position" -msgstr "Sauvegarder taille && position" +msgstr "Sauvegarder taille et position" msgid "Re&nderer" msgstr "Moteur de re&ndu vidéo" @@ -691,7 +691,7 @@ msgid "&Removable disk %1 (%2): %3" msgstr "&Disque amovible %1 (%2) : %3" msgid "Removable disk images" -msgstr "Imges de disque amovible" +msgstr "Images de disque amovible" msgid "Image %1" msgstr "Image %1" @@ -931,7 +931,7 @@ msgid "Advanced sector images" msgstr "Images secteur avancé" msgid "Flux images" -msgstr "Images Flux" +msgstr "Images de flux" msgid "Are you sure you want to hard reset the emulated machine?" msgstr "Etes-vous sûr de vouloir réinitialiser la machine émulée ?" @@ -1957,7 +1957,7 @@ msgid "Translate 26 -> 17" msgstr "Traduire 26 -> 17" msgid "Language" -msgstr "Langage" +msgstr "Langue" msgid "Enable backlight" msgstr "Activer le rétro-éclairage" @@ -2662,28 +2662,28 @@ msgid "High performance impact" msgstr "Impact important sur la performance" msgid "[Generic] RAM Disk (max. speed)" -msgstr "[Generic] Disque RAM (vitesse maximale)" +msgstr "[Générique] Disque RAM (vitesse maximale)" msgid "[Generic] 1989 (3500 RPM)" -msgstr "[Generic] 1989 (3500 RPM)" +msgstr "[Générique] 1989 (3500 RPM)" msgid "[Generic] 1992 (3600 RPM)" -msgstr "[Generic] 1992 (3600 RPM)" +msgstr "[Générique] 1992 (3600 RPM)" msgid "[Generic] 1994 (4500 RPM)" -msgstr "[Generic] 1994 (4500 RPM)" +msgstr "[Générique] 1994 (4500 RPM)" msgid "[Generic] 1996 (5400 RPM)" -msgstr "[Generic] 1996 (5400 RPM)" +msgstr "[Générique] 1996 (5400 RPM)" msgid "[Generic] 1997 (5400 RPM)" -msgstr "[Generic] 1997 (5400 RPM)" +msgstr "[Générique] 1997 (5400 RPM)" msgid "[Generic] 1998 (5400 RPM)" -msgstr "[Generic] 1998 (5400 RPM)" +msgstr "[Générique] 1998 (5400 RPM)" msgid "[Generic] 2000 (7200 RPM)" -msgstr "[Generic] 2000 (7200 RPM)" +msgstr "[Générique] 2000 (7200 RPM)" msgid "IBM 8514/A clone (ISA)" msgstr "Clone IBM 8514/A (ISA)" @@ -2911,7 +2911,7 @@ msgid "You are currently running build %1." msgstr "Vous exécutez actuellement le build %1." msgid "Build %1 is now available." -msgstr "Le Build %1 est désormais disponible." +msgstr "Le build %1 est désormais disponible." msgid "Would you like to visit the download page?" msgstr "Souhaitez-vous visiter la page de téléchargement ?" From c0b2376b1435673ce72c90f8db3cc7042070e267 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 28 Dec 2025 23:34:13 +0600 Subject: [PATCH 168/320] Revert "Manager: Fix duplicate call on details keys" This reverts commit 1585efbef697dbe99c350195afe52520bd9ec787. --- src/qt/qt_vmmanager_detailsection.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qt/qt_vmmanager_detailsection.cpp b/src/qt/qt_vmmanager_detailsection.cpp index 635dcd0f99f..9a849b89294 100644 --- a/src/qt/qt_vmmanager_detailsection.cpp +++ b/src/qt/qt_vmmanager_detailsection.cpp @@ -200,6 +200,7 @@ VMManagerDetailSection::setSections() } else { labelKey = new QLabel(); labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); } labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); From 7bc12acca7c375cbbe222d34811ae26607cb287b Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 28 Dec 2025 23:34:25 +0600 Subject: [PATCH 169/320] Revert "Manager: Streamline details label caching code to address an incorrect assumption" This reverts commit 9bc36f74e81b40a9fe9594bc2fef92db9ddd55a7. --- src/qt/qt_vmmanager_detailsection.cpp | 28 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/src/qt/qt_vmmanager_detailsection.cpp b/src/qt/qt_vmmanager_detailsection.cpp index 9a849b89294..a025abb063c 100644 --- a/src/qt/qt_vmmanager_detailsection.cpp +++ b/src/qt/qt_vmmanager_detailsection.cpp @@ -179,10 +179,9 @@ VMManagerDetailSection::setSections() continue; } - auto item = frameGridLayout->itemAtPosition(row, 1); - QLabel *label; - if (item) { - label = (QLabel *) item->widget(); + auto item = frameGridLayout->itemAtPosition(row, 1); + auto label = item ? ((QLabel *) item->widget()) : nullptr; + if (label) { label->setVisible(true); } else { label = new QLabel(); @@ -194,21 +193,25 @@ VMManagerDetailSection::setSections() item = frameGridLayout->itemAtPosition(row, 0); if (!labelKey) { - if (item) { + if (item) labelKey = (QLabel *) item->widget(); + if (labelKey) { labelKey->setVisible(true); } else { labelKey = new QLabel(); - labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + labelKey->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); } labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); } else if (item) { - item->widget()->setVisible(false); + label = (QLabel *) item->widget(); + if (label) + label->setVisible(false); } - if (!frameGridLayout->itemAtPosition(row, 2)) { + item = frameGridLayout->itemAtPosition(row, 2); + if (!item || !item->widget()) { const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); frameGridLayout->addItem(hSpacer, row, 2); } @@ -221,10 +224,13 @@ VMManagerDetailSection::setSections() int prevUsedRows = usedRows; usedRows = row; for (; row < prevUsedRows; row++) { - for (int i = 0; i <= 1; i++) { + for (int i = 0; i <= 2; i++) { auto item = frameGridLayout->itemAtPosition(row, i); - if (item) - item->widget()->setVisible(false); + if (item) { + auto widget = item->widget(); + if (widget) + widget->setVisible(false); + } } } From 6adcdbe68dc2464c1904bc2fb3aae80c541bfa13 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 28 Dec 2025 23:34:35 +0600 Subject: [PATCH 170/320] Revert "Manager: Improve machine load times by caching details labels" This reverts commit 9366ddd60d83f3d0ef9984aaaedba1ed71e2cc79. --- src/qt/qt_vmmanager_details.cpp | 4 -- src/qt/qt_vmmanager_detailsection.cpp | 80 +++++++++------------------ src/qt/qt_vmmanager_detailsection.hpp | 1 - 3 files changed, 27 insertions(+), 58 deletions(-) diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index 59491d89eb2..396997e7d38 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -263,8 +263,6 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig) // * First you clear it with VMManagerDetailSection::clear() // * Then you add each line with VMManagerDetailSection::addSection() - setUpdatesEnabled(false); - // System systemSection->clear(); systemSection->addSection("Machine", passed_sysconfig->getDisplayValue(VMManager::Display::Name::Machine)); @@ -322,8 +320,6 @@ VMManagerDetails::updateConfig(VMManagerSystem *passed_sysconfig) inputSection->setSections(); portsSection->setSections(); otherSection->setSections(); - - setUpdatesEnabled(true); } void diff --git a/src/qt/qt_vmmanager_detailsection.cpp b/src/qt/qt_vmmanager_detailsection.cpp index a025abb063c..0b19f77cd10 100644 --- a/src/qt/qt_vmmanager_detailsection.cpp +++ b/src/qt/qt_vmmanager_detailsection.cpp @@ -39,10 +39,6 @@ VMManagerDetailSection:: ui->setupUi(this); frameGridLayout = new QGridLayout(); - frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid)); - ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); - ui->detailFrame->setLayout(frameGridLayout); - // Create the collapse button, set the name and add it to the layout collapseButton = new CollapseButton(); setSectionName(sectionName); @@ -132,8 +128,6 @@ VMManagerDetailSection:: innerFrameLayout->addWidget(buttonWidget); innerFrameLayout->addWidget(frame); setLayout(outerFrameLayout); - - usedRows = 0; } VMManagerDetailSection::~VMManagerDetailSection() @@ -162,7 +156,6 @@ VMManagerDetailSection::setupMainLayout() delete mainLayout; mainLayout = new QVBoxLayout; } - void VMManagerDetailSection::setSections() { @@ -179,71 +172,52 @@ VMManagerDetailSection::setSections() continue; } - auto item = frameGridLayout->itemAtPosition(row, 1); - auto label = item ? ((QLabel *) item->widget()) : nullptr; - if (label) { - label->setVisible(true); - } else { - label = new QLabel(); - label->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - label->setTextInteractionFlags(label->textInteractionFlags() | Qt::TextSelectableByMouse); - frameGridLayout->addWidget(label, row, 1, Qt::AlignLeft); - } - label->setText(line); + const auto labelValue = new QLabel(); + labelValue->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); + labelValue->setTextInteractionFlags(labelValue->textInteractionFlags() | Qt::TextSelectableByMouse); + labelValue->setText(line); + frameGridLayout->addWidget(labelValue, row, 1, Qt::AlignLeft); - item = frameGridLayout->itemAtPosition(row, 0); if (!labelKey) { - if (item) - labelKey = (QLabel *) item->widget(); - if (labelKey) { - labelKey->setVisible(true); - } else { - labelKey = new QLabel(); - labelKey->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Preferred); - labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); - frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); - } + labelKey = new QLabel(); + labelKey->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Preferred); + labelKey->setTextInteractionFlags(labelValue->textInteractionFlags()); labelKey->setText(QCoreApplication::translate("", QString(section.name + ":").toUtf8().data())); - } else if (item) { - label = (QLabel *) item->widget(); - if (label) - label->setVisible(false); - } - - item = frameGridLayout->itemAtPosition(row, 2); - if (!item || !item->widget()) { - const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); - frameGridLayout->addItem(hSpacer, row, 2); + frameGridLayout->addWidget(labelKey, row, 0, Qt::AlignLeft); } + const auto hSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + frameGridLayout->addItem(hSpacer, row, 2); empty = false; row++; } } - int prevUsedRows = usedRows; - usedRows = row; - for (; row < prevUsedRows; row++) { - for (int i = 0; i <= 2; i++) { - auto item = frameGridLayout->itemAtPosition(row, i); - if (item) { - auto widget = item->widget(); - if (widget) - widget->setVisible(false); - } - } - } - collapseButton->setContent(ui->detailFrame); if (!empty) setVisible(true); } - void VMManagerDetailSection::clear() { sections.clear(); setVisible(false); + + // Clear everything out + if (frameGridLayout) { + while (frameGridLayout->count()) { + QLayoutItem *cur_item = frameGridLayout->takeAt(0); + if (cur_item->widget()) + delete cur_item->widget(); + delete cur_item; + } + } + + delete frameGridLayout; + frameGridLayout = new QGridLayout(); + frameGridLayout->setContentsMargins(getMargins(MarginSection::DisplayGrid)); + ui->detailFrame->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed); + ui->detailFrame->setLayout(frameGridLayout); } #ifdef Q_OS_WINDOWS diff --git a/src/qt/qt_vmmanager_detailsection.hpp b/src/qt/qt_vmmanager_detailsection.hpp index 39ec51f16c0..71a3c992e82 100644 --- a/src/qt/qt_vmmanager_detailsection.hpp +++ b/src/qt/qt_vmmanager_detailsection.hpp @@ -91,7 +91,6 @@ public slots: static QMargins getMargins(MarginSection section); QString sectionName; - int usedRows; struct DetailSection { QString name; From 909e893f4dcf516b909de0ea9ffff1fa673f70ba Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 28 Dec 2025 23:43:04 +0600 Subject: [PATCH 171/320] Improve slow loading speeds for manager --- src/include/86box/machine.h | 1 + src/machine/machine_table.c | 15 +++++++++++++++ src/qt/qt_vmmanager_system.cpp | 11 ++++------- 3 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index b39ecdad64e..de4e75ff87f 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -392,6 +392,7 @@ extern const char * machine_getname_ex(int m); extern const char * machine_get_internal_name(void); extern const char * machine_get_nvr_name(void); extern int machine_get_machine_from_internal_name(const char *s); +extern int machine_get_machine_from_internal_name_ex(const char *s); /* returns -1 if internal name does not exist. */ extern void machine_init(void); #ifdef EMU_DEVICE_H extern const device_t *machine_get_kbc_device(int m); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index e404a3f4a58..cefc2587818 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -20709,6 +20709,21 @@ machine_get_machine_from_internal_name(const char *s) return 0; } + +int +machine_get_machine_from_internal_name_ex(const char *s) +{ + int c = 0; + + while (machines[c].init != NULL) { + if (!strcmp(machines[c].internal_name, s)) + return c; + c++; + } + + return -1; +} + int machine_has_mouse(void) { diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 5c9fd3d014d..159659ebff9 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -521,14 +521,11 @@ VMManagerSystem::setupVars() auto machine_name = QString(); int i = 0; int ram_granularity = 0; + int ci = machine_get_machine_from_internal_name_ex(machine_config["machine"].toUtf8()); // Machine - for (int ci = 0; ci < machine_count(); ++ci) { - if (machine_available(ci)) { - if (machines[ci].internal_name == machine_config["machine"]) { - machine_name = machines[ci].name; - ram_granularity = machines[ci].ram.step; - } - } + if (ci != -1 && machine_available(ci)) { + machine_name = machines[ci].name; + ram_granularity = machines[ci].ram.step; } display_table[VMManager::Display::Name::Machine] = machine_name; From c81fedeaeae1fee9a520cd6200b6dd9b97eae765 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sun, 28 Dec 2025 22:20:37 -0600 Subject: [PATCH 172/320] Block incompatible WinChip CPUs on the HP Ruby USB machine --- src/machine/machine_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index cefc2587818..12ed4a874b1 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -14788,7 +14788,7 @@ const machine_t machines[] = { .cpu = { .package = CPU_PKG_SOCKET5_7, .block = CPU_BLOCK(CPU_K5, CPU_5K86, CPU_K6, CPU_K6_2, CPU_K6_2C, CPU_K6_3, CPU_K6_2P, - CPU_K6_3P, CPU_Cx6x86, CPU_Cx6x86MX, CPU_Cx6x86L), + CPU_K6_3P, CPU_Cx6x86, CPU_Cx6x86MX, CPU_Cx6x86L, CPU_WINCHIP, CPU_WINCHIP2), .min_bus = 50000000, .max_bus = 66666667, .min_voltage = 2800, From b9a55829f2fd35d3be5ba90b8b97c99bc63491b3 Mon Sep 17 00:00:00 2001 From: Bozo Scum Date: Mon, 29 Dec 2025 16:29:48 +0800 Subject: [PATCH 173/320] Update zh-TW.po --- src/qt/languages/zh-TW.po | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index ddb879c8f25..635ce006a05 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -202,16 +202,16 @@ msgid "&Update status bar icons" msgstr "更新狀態列圖示(&U)" msgid "Take s&creenshot" -msgstr "擷圖(&C)" +msgstr "擷取螢幕畫面(&C)" msgid "Take &raw screenshot" -msgstr "原始擷圖(&R)" +msgstr "擷取原始螢幕畫面(&R)" msgid "C&opy screenshot" -msgstr "複製擷圖(&O)" +msgstr "擷取螢幕畫面至剪貼簿(&O)" msgid "Copy r&aw screenshot" -msgstr "複製原始擷圖(&A)" +msgstr " 擷取原始螢幕畫面至剪貼薄(&A)" msgid "S&ound" msgstr "聲音(&O)" @@ -340,7 +340,7 @@ msgid "Machine:" msgstr "機型:" msgid "Configure" -msgstr "設定" +msgstr "組態" msgid "CPU:" msgstr "CPU:" @@ -652,13 +652,13 @@ msgid "Card 4:" msgstr "擴充卡 4:" msgid "Generic ISA ROM Board" -msgstr "通用 ISA ROM 板" +msgstr "通用 ISA 單 ROM 板" msgid "Generic Dual ISA ROM Board" -msgstr "通用雙 ISA ROM 板" +msgstr "通用 ISA 雙 ROM 板" msgid "Generic Quad ISA ROM Board" -msgstr "通用四通道 ISA ROM 板" +msgstr "通用 ISA 四 ROM 板" msgid "ISABugger device" msgstr "ISABugger 裝置" @@ -904,10 +904,10 @@ msgid "Steering wheel (3-axis, 4-button)" msgstr "方向盤 (3 軸, 4 鍵搖桿)" msgid "Thrustmaster Formula T1/T2 with adapter" -msgstr "附轉接器 Thrustmaster Formula T1/T2" +msgstr "Thrustmaster Formula T1/T2 附轉接器" msgid "Thrustmaster Formula T1/T2 without adapter" -msgstr "不附轉接器 Thrustmaster Formula T1/T2" +msgstr "Thrustmaster Formula T1/T2 不附轉接器 " msgid "None" msgstr "無" @@ -1006,7 +1006,7 @@ msgid "%1 is required for automatic conversion of PCL files to PDF.\n\nAny docum msgstr "自動將 PCL 檔案轉換為 PDF 需要 %1。\n\n使用通用 PCL 印表機列印的文件將被儲存為 Printer Command Language (.pcl) 檔案。" msgid "Don't show this message again" -msgstr "不要再顯示此消息" +msgstr "不要再顯示此訊息" msgid "Don't exit" msgstr "不退出" @@ -1021,7 +1021,7 @@ msgid "CD-ROM images" msgstr "光碟影像" msgid "%1 Device Configuration" -msgstr "%1 裝置設定" +msgstr "%1 裝置組態" msgid "Monitor in sleep mode" msgstr "監視器處在睡眠狀態" @@ -1297,7 +1297,7 @@ msgid "An error has occurred while checking for updates: %1" msgstr "檢查更新時發生錯誤: %1" msgid "An update to 86Box is available!" -msgstr "86Box 的更新可用!" +msgstr "有 86Box 的更新可用!" msgid "Warning" msgstr "警告" @@ -1312,10 +1312,10 @@ msgid "&Delete" msgstr "刪除(&D)" msgid "Do you really want to delete the virtual machine \"%1\" and all its files? This action cannot be undone!" -msgstr "您真的想要刪除虛擬機器 \"%1\" 及其所有檔案嗎?此操作無法撤銷!" +msgstr "您真的想要刪除虛擬機器 \"%1\" 及其所有檔案嗎?此操作無法回復!" msgid "Show &config file" -msgstr "顯示設定檔(&C)" +msgstr "顯示組態檔(&C)" msgid "No screenshot" msgstr "沒有螢幕畫面擷取" @@ -1915,7 +1915,7 @@ msgid "Enable BIOS extension ROM Writes (ROM #4)" msgstr "啟用 BIOS 擴充 ROM 寫入 (ROM 4)" msgid "Linear framebuffer base" -msgstr "線性圖框緩衝記憶體的起始位址" +msgstr "線性影格緩衝記憶體的起始位址" msgid "Address" msgstr "位址" @@ -2335,7 +2335,7 @@ msgid "Address for > 2 MB" msgstr "> 2 MB 的位址" msgid "Frame Address" -msgstr "影格位址" +msgstr "頁框位址" msgid "USA" msgstr "美國" @@ -2554,13 +2554,13 @@ msgid "Mono Interlaced" msgstr "單色隔行掃描" msgid "Mono Non-Interlaced" -msgstr "單色非隔行掃描" +msgstr "單色逐行掃描" msgid "Color Interlaced" msgstr "彩色隔行掃描" msgid "Color Non-Interlaced" -msgstr "彩色非隔行掃描" +msgstr "彩色逐行掃描" msgid "3Dfx Voodoo Graphics" msgstr "3Dfx Voodoo 圖形" @@ -2761,28 +2761,28 @@ msgid "Could not load file %1" msgstr "無法載入檔案 %1" msgid "Key Bindings:" -msgstr "按鍵綁定:" +msgstr "按鍵組合:" msgid "Action" -msgstr "行動" +msgstr "動作" msgid "Keybind" -msgstr "鍵盤綁定" +msgstr "按鍵組合" msgid "Clear binding" -msgstr "解除綁定" +msgstr "解除組合" msgid "Bind" -msgstr "綁定" +msgstr "組合" msgid "Bind Key" -msgstr "綁定按鍵" +msgstr "組合按鍵" msgid "Enter key combo:" msgstr "輸入組合鍵:" msgid "Bind conflict" -msgstr "綁定衝突" +msgstr "組合衝突" msgid "This key combo is already in use." msgstr "此組合鍵已在使用中。" @@ -2932,7 +2932,7 @@ msgid "Virtual machine crash" msgstr "虛擬機當機" msgid "The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2." -msgstr "虛擬機 \"%1\" 的進程以退出代碼 %2 意外終止。" +msgstr "虛擬機 \"%1\" 的行程以結束碼 %2 意外終止。" msgid "The system will not be added." msgstr "系統將不會被新增。" From cc939fe1710e03c0f7e3e7fd41a6dd1f6cc90165 Mon Sep 17 00:00:00 2001 From: Daniel Gurney Date: Sun, 28 Dec 2025 15:37:18 +0000 Subject: [PATCH 174/320] Translated using Weblate (Finnish) Currently translated at 97.1% (971 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/fi/ --- src/qt/languages/fi-FI.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index d43b701923c..f5cd64b9094 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2025-12-06 18:56+0000\n" +"PO-Revision-Date: 2025-12-29 09:54+0000\n" "Last-Translator: Daniel Gurney \n" "Language-Team: Finnish \n" "Language: fi-FI\n" @@ -211,13 +211,13 @@ msgid "Take s&creenshot" msgstr "Ota &kuvakaappaus" msgid "Take &raw screenshot" -msgstr "Ota &raaka kuvakaapus" +msgstr "Ota &raaka kuvakaappaus" msgid "C&opy screenshot" -msgstr "K&opia kuvakaapaus" +msgstr "K&opioi kuvakaappaus" msgid "Copy r&aw screenshot" -msgstr "Kopia r&aaka kuvakaapaus" +msgstr "Kopioi r&aaka kuvakaappaus" msgid "S&ound" msgstr "&Ääni" From 41997e1badfbf2ec5c7c5b492852b8e4fa907d3c Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Tue, 30 Dec 2025 02:08:20 +0100 Subject: [PATCH 175/320] Remove redundant FIFO wait calls in vid_s3_virge.c --- src/video/vid_s3_virge.c | 26 -------------------------- 1 file changed, 26 deletions(-) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index bb1b2b11e56..844a8d51e74 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -1378,122 +1378,96 @@ s3_virge_mmio_read_l(uint32_t addr, void *priv) case 0xa4d4: case 0xa8d4: case 0xacd4: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.src_base; break; case 0xa4d8: case 0xa8d8: case 0xacd8: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.dest_base; break; case 0xa4dc: case 0xa8dc: case 0xacdc: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.clip_l << 16) | virge->s3d.clip_r; break; case 0xa4e0: case 0xa8e0: case 0xace0: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.clip_t << 16) | virge->s3d.clip_b; break; case 0xa4e4: case 0xa8e4: case 0xace4: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.dest_str << 16) | virge->s3d.src_str; break; case 0xa4e8: case 0xace8: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.mono_pat_0; break; case 0xa4ec: case 0xacec: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.mono_pat_1; break; case 0xa4f0: case 0xacf0: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pat_bg_clr; break; case 0xa4f4: case 0xa8f4: case 0xacf4: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pat_fg_clr; break; case 0xa4f8: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.src_bg_clr; break; case 0xa4fc: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.src_fg_clr; break; case 0xa500: case 0xa900: case 0xad00: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.cmd_set; break; case 0xa504: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.r_width << 16) | virge->s3d.r_height; break; case 0xa508: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.rsrc_x << 16) | virge->s3d.rsrc_y; break; case 0xa50c: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.rdest_x << 16) | virge->s3d.rdest_y; break; case 0xa96c: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.lxend0 << 16) | virge->s3d.lxend1; break; case 0xa970: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.ldx; break; case 0xa974: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.lxstart; break; case 0xa978: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.lystart; break; case 0xa97c: - s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.line_dir << 31) | virge->s3d.lycnt; break; case 0xad68: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.prdx; break; case 0xad6c: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.prxstart; break; case 0xad70: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pldx; break; case 0xad74: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.plxstart; break; case 0xad78: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pystart; break; case 0xad7c: - s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pycnt; break; From 33bd395dc55aba011d6714af15ccd23cf7659b6d Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Tue, 30 Dec 2025 12:38:12 +0100 Subject: [PATCH 176/320] Add s3_virge_wait_fifo_idle calls for register access --- src/video/vid_s3_virge.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index 844a8d51e74..bb1b2b11e56 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -1378,96 +1378,122 @@ s3_virge_mmio_read_l(uint32_t addr, void *priv) case 0xa4d4: case 0xa8d4: case 0xacd4: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.src_base; break; case 0xa4d8: case 0xa8d8: case 0xacd8: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.dest_base; break; case 0xa4dc: case 0xa8dc: case 0xacdc: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.clip_l << 16) | virge->s3d.clip_r; break; case 0xa4e0: case 0xa8e0: case 0xace0: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.clip_t << 16) | virge->s3d.clip_b; break; case 0xa4e4: case 0xa8e4: case 0xace4: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.dest_str << 16) | virge->s3d.src_str; break; case 0xa4e8: case 0xace8: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.mono_pat_0; break; case 0xa4ec: case 0xacec: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.mono_pat_1; break; case 0xa4f0: case 0xacf0: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pat_bg_clr; break; case 0xa4f4: case 0xa8f4: case 0xacf4: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pat_fg_clr; break; case 0xa4f8: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.src_bg_clr; break; case 0xa4fc: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.src_fg_clr; break; case 0xa500: case 0xa900: case 0xad00: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.cmd_set; break; case 0xa504: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.r_width << 16) | virge->s3d.r_height; break; case 0xa508: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.rsrc_x << 16) | virge->s3d.rsrc_y; break; case 0xa50c: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.rdest_x << 16) | virge->s3d.rdest_y; break; case 0xa96c: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.lxend0 << 16) | virge->s3d.lxend1; break; case 0xa970: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.ldx; break; case 0xa974: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.lxstart; break; case 0xa978: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.lystart; break; case 0xa97c: + s3_virge_wait_fifo_idle(virge); ret = (virge->s3d.line_dir << 31) | virge->s3d.lycnt; break; case 0xad68: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.prdx; break; case 0xad6c: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.prxstart; break; case 0xad70: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pldx; break; case 0xad74: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.plxstart; break; case 0xad78: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pystart; break; case 0xad7c: + s3_virge_wait_fifo_idle(virge); ret = virge->s3d.pycnt; break; From caab65339e5b62a40002a2f5a830f2d91e001b7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Tue, 30 Dec 2025 18:01:17 +0100 Subject: [PATCH 177/320] Create CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md new file mode 100644 index 00000000000..7446dd9aaff --- /dev/null +++ b/CODE_OF_CONDUCT.md @@ -0,0 +1,27 @@ +**1. No illegal activity or Discord ToS violations** +- 1.1. Do not distribute malware for non-research purposes. Post samples in a clearly named encrypted archive. +- 1.2. Posting old software is allowed if at least 10 years old and out of support. +- 1.3. Do not join while being under the age of 13 (this Discord server is bridged to an IRC network and Minecraft server hosted in Finland, where the minimum age is 13 (or higher if you are in a country where the minimum age is higher), as such we enforce that minimum age server-wide). +- 1.4. Do not post NSFW content (defined at the staff's discretion). + +**2. No offensive or disruptive behavior or harassment** +- 2.1. No gate-keeping. We aim to accommodate and welcome people of all different opinions and knowledge levels to this server. +- 2.2. You may speak any language but provide a summary in English so that we can understand what you are saying and use English when requested. +- 2.3. Do not retroactively delete messages or do major edits. +- 2.4. Do not antagonize, defame, demean, blackmail, impersonate, dox others, bring outside drama, use intentionally offensive profile aspects, or otherwise post messages to start a fight (eg. platform wars). Discuss or debate the idea, not the person. +- 2.5. Do not backseat moderate, spam, flood, unsolicitedly ping people, advertise without staff permission, or evade server bans. +- 2.6. Do not speak on behalf of the project unless you are a project member (staff role or higher). This includes all messages which could reasonably be understood as being an official position. Ask a staff member if you're unsure about your message. +- 2.7. Do not block essential communications, including Staff or the Owner. +- 2.8. Do not engage in political discussions. (Formerly Rule 8) +- 2.9. Decisions by higher-ranked users supersede those by lower-ranked users. This applies to moderation **and** emulator development. The rank will be proportional to the accrued contribution. Seniority must be earned. + +**3. Moderation and appeal protocol** +- 3.1. Rule violations are punished at the staff's discretion, taking all circumstances into account. +- 3.2. Rules enforcement must be equal, impartial, and not retroactive or politically motivated. +- 3.3. Everyone is innocent until proven guilty. +- 3.4. Unless there is an emergency, urgent action is otherwise warranted, or a user has joined with the express purpose of violating our rules, staff shall deliberate before taking action in order to reach consensus and avoid staff conflicts. + +**4. Do not insist on requests or suggestions** +- 4.1. You may politely request something from us; if rejected, you are going to be told why and what to do to have it reconsidered. +- 4.2. Follow the contribution requirements listed on the GitHub readme. +- 4.3. Follow proper procedure (eg. for pull requests or bug reports). From e8c3f13eccda5c89740e82c8d680f2a3eca91b18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Tue, 30 Dec 2025 18:04:29 +0100 Subject: [PATCH 178/320] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 7446dd9aaff..56384bfdadc 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,8 +1,9 @@ -**1. No illegal activity or Discord ToS violations** +**1. No illegal activity or Discord or GitHub ToS violations** - 1.1. Do not distribute malware for non-research purposes. Post samples in a clearly named encrypted archive. - 1.2. Posting old software is allowed if at least 10 years old and out of support. -- 1.3. Do not join while being under the age of 13 (this Discord server is bridged to an IRC network and Minecraft server hosted in Finland, where the minimum age is 13 (or higher if you are in a country where the minimum age is higher), as such we enforce that minimum age server-wide). +- 1.3. Do not join while being under the age of 13. - 1.4. Do not post NSFW content (defined at the staff's discretion). +- 1.5. Do not do anything forbidden by the law or the Discord or GitHub Terms of Service. **2. No offensive or disruptive behavior or harassment** - 2.1. No gate-keeping. We aim to accommodate and welcome people of all different opinions and knowledge levels to this server. From f4f2a1223ae72b28d332f803ae14beeb0cd0f563 Mon Sep 17 00:00:00 2001 From: Daniel Gurney Date: Tue, 30 Dec 2025 19:16:39 +0200 Subject: [PATCH 179/320] Refine CoC Change some wording to fit GitHub better, as the initial commit was just a copy from Discord --- CODE_OF_CONDUCT.md | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 56384bfdadc..3975e1df6af 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -1,28 +1,30 @@ -**1. No illegal activity or Discord or GitHub ToS violations** +# Code of Conduct +In order for everyone to enjoy their time contributing to 86Box or otherwise being a part of the community, we kindly ask you to review and follow the below rules. + +## 1. No illegal activity or GitHub ToS violations - 1.1. Do not distribute malware for non-research purposes. Post samples in a clearly named encrypted archive. - 1.2. Posting old software is allowed if at least 10 years old and out of support. - 1.3. Do not join while being under the age of 13. -- 1.4. Do not post NSFW content (defined at the staff's discretion). +- 1.4. Do not post NSFW content (defined at the team's discretion). - 1.5. Do not do anything forbidden by the law or the Discord or GitHub Terms of Service. -**2. No offensive or disruptive behavior or harassment** -- 2.1. No gate-keeping. We aim to accommodate and welcome people of all different opinions and knowledge levels to this server. +## 2. No offensive or disruptive behavior or harassment +- 2.1. No gate-keeping. We aim to accommodate and welcome people of all different opinions and knowledge levels to this community. - 2.2. You may speak any language but provide a summary in English so that we can understand what you are saying and use English when requested. -- 2.3. Do not retroactively delete messages or do major edits. +- 2.3. Do not retroactively delete messages or do major edits unless you posted something by mistake. - 2.4. Do not antagonize, defame, demean, blackmail, impersonate, dox others, bring outside drama, use intentionally offensive profile aspects, or otherwise post messages to start a fight (eg. platform wars). Discuss or debate the idea, not the person. -- 2.5. Do not backseat moderate, spam, flood, unsolicitedly ping people, advertise without staff permission, or evade server bans. -- 2.6. Do not speak on behalf of the project unless you are a project member (staff role or higher). This includes all messages which could reasonably be understood as being an official position. Ask a staff member if you're unsure about your message. -- 2.7. Do not block essential communications, including Staff or the Owner. -- 2.8. Do not engage in political discussions. (Formerly Rule 8) -- 2.9. Decisions by higher-ranked users supersede those by lower-ranked users. This applies to moderation **and** emulator development. The rank will be proportional to the accrued contribution. Seniority must be earned. +- 2.5. Do not backseat moderate, spam, flood, unsolicitedly ping people, advertise without permission, or evade blocks. +- 2.6. Do not speak on behalf of the project unless you are a team member. This includes all messages which could reasonably be understood as being an official position. Ask a team member if you're unsure about your message. +- 2.7. Do not engage in political discussions. +- 2.8. Decisions by higher-ranked users supersede those by lower-ranked users. -**3. Moderation and appeal protocol** -- 3.1. Rule violations are punished at the staff's discretion, taking all circumstances into account. +## 3. Moderation and appeal protocol +- 3.1. Rule violations are punished at the team's discretion, taking all circumstances into account. - 3.2. Rules enforcement must be equal, impartial, and not retroactive or politically motivated. - 3.3. Everyone is innocent until proven guilty. -- 3.4. Unless there is an emergency, urgent action is otherwise warranted, or a user has joined with the express purpose of violating our rules, staff shall deliberate before taking action in order to reach consensus and avoid staff conflicts. +- 3.4. Unless there is an emergency, urgent action is otherwise warranted, or a user is participating with the express purpose of violating our rules, the team shall deliberate before taking action in order to reach consensus and avoid team conflicts. -**4. Do not insist on requests or suggestions** +## 4. Do not insist on requests or suggestions - 4.1. You may politely request something from us; if rejected, you are going to be told why and what to do to have it reconsidered. - 4.2. Follow the contribution requirements listed on the GitHub readme. - 4.3. Follow proper procedure (eg. for pull requests or bug reports). From 15e6841d8a11908009b0bfcef0be7ebb10581caf Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 31 Dec 2025 00:16:51 +0600 Subject: [PATCH 180/320] Fix drawing of 2D polygons on ATi Mach64 --- src/video/vid_ati_mach64.c | 93 ++++++++++++++------------------------ 1 file changed, 34 insertions(+), 59 deletions(-) diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 97c869668cc..4cecf6cf4b7 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -2169,6 +2169,14 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) uint32_t dest_dat; uint32_t host_dat = 0; int mix = 0; + int draw_pixel = !(mach64->dst_cntl & DST_POLYGON_EN); + + if (mach64->dst_cntl & DST_POLYGON_EN) { + if (mach64->dst_cntl & DST_Y_MAJOR) + draw_pixel = 1; + else if (mach64->accel.err >= 0) + draw_pixel = 1; + } if (mach64->accel.source_host) { host_dat = cpu_dat; @@ -2215,7 +2223,7 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) break; } - if ((mach64->accel.dst_x >= mach64->accel.sc_left) && (mach64->accel.dst_x <= mach64->accel.sc_right) && (mach64->accel.dst_y >= mach64->accel.sc_top) && (mach64->accel.dst_y <= mach64->accel.sc_bottom)) { + if ((mach64->accel.dst_x >= mach64->accel.sc_left) && (mach64->accel.dst_x <= mach64->accel.sc_right) && (mach64->accel.dst_y >= mach64->accel.sc_top) && (mach64->accel.dst_y <= mach64->accel.sc_bottom) && draw_pixel) { switch (mix ? mach64->accel.source_fg : mach64->accel.source_bg) { case SRC_HOST: src_dat = host_dat; @@ -2285,17 +2293,21 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) if (mach64->dst_cntl & DST_Y_MAJOR) { mach64->accel.dst_y += mach64->accel.yinc; + mach64->accel.src_y += mach64->accel.yinc; if (mach64->accel.err >= 0) { mach64->accel.err += mach64->dst_bres_dec; mach64->accel.dst_x += mach64->accel.xinc; + mach64->accel.src_x += mach64->accel.xinc; } else { mach64->accel.err += mach64->dst_bres_inc; } } else { mach64->accel.dst_x += mach64->accel.xinc; + mach64->accel.src_x += mach64->accel.xinc; if (mach64->accel.err >= 0) { mach64->accel.err += mach64->dst_bres_dec; mach64->accel.dst_y += mach64->accel.yinc; + mach64->accel.src_y += mach64->accel.yinc; } else { mach64->accel.err += mach64->dst_bres_inc; } @@ -2347,9 +2359,7 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) if (mach64->dst_cntl & DST_POLYGON_EN) { if (mach64->dst_cntl & DST_Y_MAJOR) draw_pixel = 1; - else if ((mach64->dst_cntl & DST_X_DIR) && mach64->accel.err < (mach64->dst_bres_dec + mach64->dst_bres_inc)) /*X+*/ - draw_pixel = 1; - else if (!(mach64->dst_cntl & DST_X_DIR) && mach64->accel.err >= 0) /*X-*/ + else if (mach64->accel.err >= 0) draw_pixel = 1; } @@ -2406,62 +2416,27 @@ mach64_blit(uint32_t cpu_dat, int count, mach64_t *mach64) return; } - switch (mach64->dst_cntl & 7) { - case 0: - case 2: - mach64->accel.src_x--; - mach64->accel.dst_x--; - break; - case 1: - case 3: - mach64->accel.src_x++; - mach64->accel.dst_x++; - break; - case 4: - case 5: - mach64->accel.src_y--; - mach64->accel.dst_y--; - break; - case 6: - case 7: - mach64->accel.src_y++; - mach64->accel.dst_y++; - break; - - default: - break; - } - mach64_log("x %i y %i err %i inc %i dec %i\n", mach64->accel.dst_x, mach64->accel.dst_y, mach64->accel.err, mach64->dst_bres_inc, mach64->dst_bres_dec); - if (mach64->accel.err >= 0) { - mach64->accel.err += mach64->dst_bres_dec; - - switch (mach64->dst_cntl & 7) { - case 0: - case 1: - mach64->accel.src_y--; - mach64->accel.dst_y--; - break; - case 2: - case 3: - mach64->accel.src_y++; - mach64->accel.dst_y++; - break; - case 4: - case 6: - mach64->accel.src_x--; - mach64->accel.dst_x--; - break; - case 5: - case 7: - mach64->accel.src_x++; - mach64->accel.dst_x++; - break; - - default: - break; + if (mach64->dst_cntl & DST_Y_MAJOR) { + mach64->accel.dst_y += mach64->accel.yinc; + mach64->accel.src_y += mach64->accel.yinc; + if (mach64->accel.err >= 0) { + mach64->accel.err += mach64->dst_bres_dec; + mach64->accel.dst_x += mach64->accel.xinc; + mach64->accel.src_x += mach64->accel.xinc; + } else { + mach64->accel.err += mach64->dst_bres_inc; } - } else - mach64->accel.err += mach64->dst_bres_inc; + } else { + mach64->accel.dst_x += mach64->accel.xinc; + mach64->accel.src_x += mach64->accel.xinc; + if (mach64->accel.err >= 0) { + mach64->accel.err += mach64->dst_bres_dec; + mach64->accel.dst_y += mach64->accel.yinc; + mach64->accel.src_y += mach64->accel.yinc; + } else { + mach64->accel.err += mach64->dst_bres_inc; + } + } } } break; From a10bda22ef8297de5aa0a31e0bdb6823d1c5219c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Tue, 30 Dec 2025 20:02:15 +0100 Subject: [PATCH 181/320] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 3975e1df6af..bd5810a7738 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -15,8 +15,8 @@ In order for everyone to enjoy their time contributing to 86Box or otherwise bei - 2.4. Do not antagonize, defame, demean, blackmail, impersonate, dox others, bring outside drama, use intentionally offensive profile aspects, or otherwise post messages to start a fight (eg. platform wars). Discuss or debate the idea, not the person. - 2.5. Do not backseat moderate, spam, flood, unsolicitedly ping people, advertise without permission, or evade blocks. - 2.6. Do not speak on behalf of the project unless you are a team member. This includes all messages which could reasonably be understood as being an official position. Ask a team member if you're unsure about your message. -- 2.7. Do not engage in political discussions. -- 2.8. Decisions by higher-ranked users supersede those by lower-ranked users. +- 2.7. Decisions by higher-ranked users supersede those by lower-ranked users. +- 2.8. Do not engage in political discussions. ## 3. Moderation and appeal protocol - 3.1. Rule violations are punished at the team's discretion, taking all circumstances into account. From 08851fae31ecbdc96c71caaf4c72f52fb21656a7 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Mon, 29 Dec 2025 13:46:46 +0000 Subject: [PATCH 182/320] Translated using Weblate (Russian) Currently translated at 100.0% (999 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/ru/ --- src/qt/languages/ru-RU.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 9e16f6c2858..8f3e611ad03 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2025-12-07 13:33+0000\n" +"PO-Revision-Date: 2025-12-30 13:56+0000\n" "Last-Translator: Alexander Babikov \n" "Language-Team: Russian \n" "Language: ru-RU\n" @@ -212,13 +212,13 @@ msgid "Take s&creenshot" msgstr "Сделать с&криншот" msgid "Take &raw screenshot" -msgstr "Сделать &сырой скриншот" +msgstr "Сделать н&еобработанный скриншот" msgid "C&opy screenshot" -msgstr "С&копировать скриншот" +msgstr "Ско&пировать скриншот" msgid "Copy r&aw screenshot" -msgstr "Скопировать с&ырой скриншот" +msgstr "Скопировать необработанный скрин&шот" msgid "S&ound" msgstr "&Звук" From 261840be7bc2423a8a1d40b1b8e8ffc439df5f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Tue, 30 Dec 2025 20:04:24 +0100 Subject: [PATCH 183/320] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index bd5810a7738..88c62ddef24 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -17,6 +17,7 @@ In order for everyone to enjoy their time contributing to 86Box or otherwise bei - 2.6. Do not speak on behalf of the project unless you are a team member. This includes all messages which could reasonably be understood as being an official position. Ask a team member if you're unsure about your message. - 2.7. Decisions by higher-ranked users supersede those by lower-ranked users. - 2.8. Do not engage in political discussions. +- 2.9. Ignoring essential communication from team members does not exempt you from possible actions against you. Seniority must be earned. ## 3. Moderation and appeal protocol - 3.1. Rule violations are punished at the team's discretion, taking all circumstances into account. From b1756b250f49a8a21234953c6f26cffdf601c255 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Tue, 30 Dec 2025 20:08:38 +0100 Subject: [PATCH 184/320] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 88c62ddef24..8691505fc9a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -4,9 +4,8 @@ In order for everyone to enjoy their time contributing to 86Box or otherwise bei ## 1. No illegal activity or GitHub ToS violations - 1.1. Do not distribute malware for non-research purposes. Post samples in a clearly named encrypted archive. - 1.2. Posting old software is allowed if at least 10 years old and out of support. -- 1.3. Do not join while being under the age of 13. -- 1.4. Do not post NSFW content (defined at the team's discretion). -- 1.5. Do not do anything forbidden by the law or the Discord or GitHub Terms of Service. +- 1.3. Do not post NSFW content (defined at the staff's discretion). +- 1.4. Do not do anything forbidden by the law or the Discord or GitHub Terms of Service. ## 2. No offensive or disruptive behavior or harassment - 2.1. No gate-keeping. We aim to accommodate and welcome people of all different opinions and knowledge levels to this community. From 61918e4d72479e07349022401b072a621ad12028 Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Tue, 30 Dec 2025 21:14:13 +0100 Subject: [PATCH 185/320] Implement wait states for MMIO reads Added wait states for MMIO reads to reduce excessive polling. --- src/video/vid_s3_virge.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/video/vid_s3_virge.c b/src/video/vid_s3_virge.c index bb1b2b11e56..abeba064ec2 100644 --- a/src/video/vid_s3_virge.c +++ b/src/video/vid_s3_virge.c @@ -24,6 +24,7 @@ #include #define HAVE_STDARG_H #include <86box/86box.h> +#include "cpu.h" #include <86box/io.h> #include <86box/timer.h> #include <86box/dma.h> @@ -1191,6 +1192,9 @@ s3_virge_mmio_read(uint32_t addr, void *priv) virge_t *virge = (virge_t *) priv; uint8_t ret; + /* Add wait states for MMIO reads to prevent excessive polling */ + cycles -= virge->svga.monitor->mon_video_timing_read_b; + switch (addr & 0xffff) { case 0x8504: if (!virge->virge_busy) @@ -1242,6 +1246,9 @@ s3_virge_mmio_read_w(uint32_t addr, void *priv) virge_t *virge = (virge_t *) priv; uint16_t ret; + /* Add wait states for MMIO reads to prevent excessive polling */ + cycles -= virge->svga.monitor->mon_video_timing_read_w; + switch (addr & 0xfffe) { case 0x8504: ret = 0xc000; @@ -1275,6 +1282,9 @@ s3_virge_mmio_read_l(uint32_t addr, void *priv) virge_t *virge = (virge_t *) priv; uint32_t ret = 0xffffffff; + /* Add wait states for MMIO reads to prevent excessive polling */ + cycles -= virge->svga.monitor->mon_video_timing_read_l; + switch (addr & 0xfffc) { case 0x8180: ret = virge->streams.pri_ctrl; From 2c670bf42d8a1d58540c227785cde225da1522a2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 31 Dec 2025 18:54:28 +0100 Subject: [PATCH 186/320] Fix extended key processing on XT 101/102-key and AT 84-key keyboards. --- src/device/kbc_xt.c | 101 +++++++++++++++++++++++++++++++++-- src/device/keyboard_at.c | 45 +++++++++++++++- src/device/keyboard_xt.c | 19 ++++++- src/include/86box/keyboard.h | 3 ++ 4 files changed, 161 insertions(+), 7 deletions(-) diff --git a/src/device/kbc_xt.c b/src/device/kbc_xt.c index a9fa8bf6c24..c1a3aee5cb8 100644 --- a/src/device/kbc_xt.c +++ b/src/device/kbc_xt.c @@ -85,6 +85,7 @@ typedef struct xtkbd_t { uint8_t type; uint8_t pravetz_flags; uint8_t cpu_speed; + uint8_t ignore; pc_timer_t send_delay_timer; } xtkbd_t; @@ -96,6 +97,8 @@ static int is_tandy = 0; static int is_t1x00 = 0; static int is_amstrad = 0; +#define kbd_adddata kbd_adddata_xt_common + #ifdef ENABLE_KEYBOARD_XT_LOG int keyboard_xt_do_log = ENABLE_KEYBOARD_XT_LOG; @@ -117,7 +120,6 @@ kbd_log(const char *fmt, ...) static uint8_t get_fdd_switch_settings(void) { - uint8_t fdd_count = 0; for (uint8_t i = 0; i < FDD_NUM; i++) { @@ -134,7 +136,6 @@ get_fdd_switch_settings(void) static uint8_t get_videomode_switch_settings(void) { - if (video_is_mda()) return 0x30; else if (video_is_cga()) @@ -172,8 +173,8 @@ kbd_poll(void *priv) } } -static void -kbd_adddata(uint16_t val) +void +kbd_adddata_xt_common(uint16_t val) { /* Test for T1000 'Fn' key (Right Alt / Right Ctrl) */ if (is_t1x00) { @@ -257,6 +258,98 @@ kbd_adddata_process(uint16_t val, void (*adddata)(uint16_t val)) } } +void +kbd_adddata_process_10x(uint16_t val, void (*adddata)(uint16_t val)) +{ + uint8_t fake_shift[4] = { 0 }; + uint8_t num_lock = 0; + uint8_t shift_states = 0; + + if (!adddata) + return; + + keyboard_get_states(NULL, &num_lock, NULL, NULL); + shift_states = keyboard_get_shift() & STATE_SHIFT_MASK; + + switch (val) { + case FAKE_LSHIFT_ON: + kbd_log("%s: Fake left shift on, scan code: ", dev->name); + if (num_lock) { + if (shift_states) { + kbd_log("N/A (one or both shifts on)\n"); + break; + } else { + /* Num lock on and no shifts are pressed, send non-inverted fake shift. */ + kbd_log("E0 2A\n"); + fake_shift[0] = 0xe0; + fake_shift[1] = 0x2a; + for (int i = 0; i < 2; i++) + adddata(fake_shift[0]); + } + } else { + if (shift_states & STATE_LSHIFT) { + /* Num lock off and left shift pressed. */ + kbd_log("E0 AA\n"); + fake_shift[0] = 0xe0; + fake_shift[1] = 0xaa; + for (int i = 0; i < 2; i++) + adddata(fake_shift[0]); + } + if (shift_states & STATE_RSHIFT) { + /* Num lock off and right shift pressed. */ + kbd_log("E0 B6\n"); + fake_shift[0] = 0xe0; + fake_shift[1] = 0xb6; + for (int i = 0; i < 2; i++) + adddata(fake_shift[0]); + } + kbd_log(shift_states ? "" : "N/A (both shifts off)\n"); + } + break; + + case FAKE_LSHIFT_OFF: + kbd_log("%s: Fake left shift on, scan code: ", dev->name); + if (num_lock) { + if (shift_states) { + kbd_log("N/A (one or both shifts on)\n"); + break; + } else { + /* Num lock on and no shifts are pressed, send non-inverted fake shift. */ + kbd_log("E0 AA\n"); + fake_shift[0] = 0xe0; + fake_shift[1] = 0xaa; + for (int i = 0; i < 2; i++) + adddata(fake_shift[0]); + } + } else { + if (shift_states & STATE_LSHIFT) { + /* Num lock off and left shift pressed. */ + kbd_log("E0 2A\n"); + fake_shift[0] = 0xe0; + fake_shift[1] = 0x2a; + for (int i = 0; i < 2; i++) + adddata(fake_shift[0]); + break; + } + if (shift_states & STATE_RSHIFT) { + /* Num lock off and right shift pressed. */ + kbd_log("E0 36\n"); + fake_shift[0] = 0xe0; + fake_shift[1] = 0x36; + for (int i = 0; i < 2; i++) + adddata(fake_shift[0]); + break; + } + kbd_log(shift_states ? "" : "N/A (both shifts off)\n"); + } + break; + + default: + adddata(val); + break; + } +} + static void kbd_adddata_ex(uint16_t val) { diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index d6fdaf4b71b..fd8d1150322 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -5342,6 +5342,46 @@ add_data_vals(atkbc_dev_t *dev, uint8_t *val, uint8_t len) kbc_at_dev_queue_add(dev, val[i], 1); } +static void +add_data_kbd_84(uint16_t val) +{ + atkbc_dev_t *dev = SavedKbd; + uint8_t fake_shift = 0; + uint8_t num_lock = 0; + uint8_t shift_states = 0; + + keyboard_get_states(NULL, &num_lock, NULL, NULL); + shift_states = keyboard_get_shift() & STATE_LSHIFT; + + /* If NumLock is on, invert the left shift state so we can always check for + the the same way flag being set (and with NumLock on that then means it + is actually *NOT* set). */ + if (num_lock) + shift_states ^= STATE_LSHIFT; + + switch (val) { + case FAKE_LSHIFT_ON: + /* If NumLock is on, fake shifts are sent when shift is *NOT* presed, + if NumLock is off, fake shifts are sent when shift is pressed. */ + if (shift_states) { + /* Send fake shift. */ + fake_shift = num_lock ? 0x2a : 0xaa; + add_data_vals(dev, &fake_shift, 1); + } + break; + case FAKE_LSHIFT_OFF: + if (shift_states) { + /* Send fake shift. */ + fake_shift = num_lock ? 0xaa : 0x2a; + add_data_vals(dev, &fake_shift, 1); + } + break; + default: + kbc_at_dev_queue_add(dev, val, 1); + break; + } +} + static void add_data_kbd(uint16_t val) { @@ -5975,7 +6015,10 @@ keyboard_at_init(const device_t *info) bat_counter = 0x0000; } - keyboard_send = add_data_kbd; + if ((dev->type & FLAG_TYPE_MASK) > KBD_84_KEY) + keyboard_send = add_data_kbd; + else + keyboard_send = add_data_kbd_84; SavedKbd = dev; keyboard_update_states(0, 0, 0, 0); diff --git a/src/device/keyboard_xt.c b/src/device/keyboard_xt.c index 41f8937e51a..0ac25b06143 100644 --- a/src/device/keyboard_xt.c +++ b/src/device/keyboard_xt.c @@ -557,6 +557,18 @@ typedef struct { int type; } kbd_t; +static void +kbd_adddata_xt(uint16_t val) +{ + kbd_adddata_process(val, kbd_adddata_xt_common); +} + +static void +kbd_adddata_xt_10x(uint16_t val) +{ + kbd_adddata_process_10x(val, kbd_adddata_xt_common); +} + static void * kbd_init(const device_t *info) { @@ -564,10 +576,13 @@ kbd_init(const device_t *info) dev->type = device_get_config_int("keys"); - if (dev->type == KBD_83_KEY) + if (dev->type == KBD_83_KEY) { keyboard_set_table(scancode_xt); - else + keyboard_send = kbd_adddata_xt; + } else { keyboard_set_table(scancode_set1); + keyboard_send = kbd_adddata_xt_10x; + } return dev; } diff --git a/src/include/86box/keyboard.h b/src/include/86box/keyboard.h index 78714986c8d..8b32851bbf7 100644 --- a/src/include/86box/keyboard.h +++ b/src/include/86box/keyboard.h @@ -165,7 +165,9 @@ extern uint16_t scancode_map[768]; extern uint16_t scancode_config_map[768]; extern void (*keyboard_send)(uint16_t val); +extern void kbd_adddata_xt_common(uint16_t val); extern void kbd_adddata_process(uint16_t val, void (*adddata)(uint16_t val)); +extern void kbd_adddata_process_10x(uint16_t val, void (*adddata)(uint16_t val)); extern const scancode scancode_xt[512]; @@ -211,6 +213,7 @@ extern void keyboard_close(void); extern void keyboard_set_table(const scancode *ptr); extern void keyboard_poll_host(void); extern void keyboard_process(void); +extern void keyboard_process_10x(void); extern uint16_t keyboard_convert(int ch); extern void keyboard_input(int down, uint16_t scan); extern void keyboard_all_up(void); From a75d64d0b2c3f456aa190cd74693b3e83da01432 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 31 Dec 2025 18:59:15 +0100 Subject: [PATCH 187/320] MO and removable disk: Fix memcpy-related warnings. --- src/disk/mo.c | 2 +- src/disk/rdisk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/disk/mo.c b/src/disk/mo.c index 5ffe74f78da..079e82c6ee4 100644 --- a/src/disk/mo.c +++ b/src/disk/mo.c @@ -254,7 +254,7 @@ mo_disk_close(const mo_t *dev) mo_disk_unload(dev); memcpy(dev->drv->prev_image_path, dev->drv->image_path, - sizeof(dev->drv->prev_image_path)); + sizeof(dev->drv->image_path)); memset(dev->drv->image_path, 0, sizeof(dev->drv->image_path)); dev->drv->medium_size = 0; diff --git a/src/disk/rdisk.c b/src/disk/rdisk.c index 683b1e9632b..87e9eb5e41e 100644 --- a/src/disk/rdisk.c +++ b/src/disk/rdisk.c @@ -307,7 +307,7 @@ rdisk_disk_close(const rdisk_t *dev) rdisk_disk_unload(dev); memcpy(dev->drv->prev_image_path, dev->drv->image_path, - sizeof(dev->drv->prev_image_path)); + sizeof(dev->drv->image_path)); memset(dev->drv->image_path, 0, sizeof(dev->drv->image_path)); dev->drv->medium_size = 0; From e81a49d62ae2321aaa226fc0b64a966ea478c2d0 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 31 Dec 2025 19:48:45 +0100 Subject: [PATCH 188/320] Toshiba T3100: Some clean-ups and call video_reset() before the on-board graphics card is added - fixes the font being overwritten with the default one. --- src/device/kbc_at.c | 48 +++++++-------------------------------- src/machine/m_at_t3100e.c | 2 ++ 2 files changed, 10 insertions(+), 40 deletions(-) diff --git a/src/device/kbc_at.c b/src/device/kbc_at.c index 771b95c2a82..4cb23428edd 100644 --- a/src/device/kbc_at.c +++ b/src/device/kbc_at.c @@ -470,16 +470,8 @@ kbc_scan_kbd_at(atkbc_t *dev) kbc_ibf_process(dev); /* AT mode. */ } else { -#if 0 - dev->t = dev->mem[0x28]; -#endif - if (dev->mem[0x2e] != 0x00) { -#if 0 - if (!(dev->t & 0x02)) - return; -#endif + if (dev->mem[0x2e] != 0x00) dev->mem[0x2e] = 0x00; - } dev->p2 &= 0xbf; if ((dev->ports[0] != NULL) && (dev->ports[0]->out_new != -1)) { /* In our case, we never have noise on the line, so we can simplify this. */ @@ -539,9 +531,6 @@ kbc_at_poll_at(atkbc_t *dev) /* Keyboard controller command want to output a single byte. */ kbc_at_log("ATkbc: %02X coming from channel %i with high status %02X\n", dev->val, dev->channel, dev->stat_hi); kbc_send_to_ob(dev, dev->val, dev->channel, dev->stat_hi); -#if 0 - dev->state = (dev->pending == 2) ? STATE_KBC_AMI_OUT : STATE_MAIN_IBF; -#endif dev->state = STATE_MAIN_IBF; dev->pending = 0; goto at_main_ibf; @@ -683,12 +672,8 @@ kbc_at_poll_ps2(atkbc_t *dev) /* Keyboard controller command want to output a single byte. */ kbc_at_log("ATkbc: %02X coming from channel %i with high status %02X\n", dev->val, dev->channel, dev->stat_hi); kbc_send_to_ob(dev, dev->val, dev->channel, dev->stat_hi); -#if 0 - dev->state = (dev->pending == 2) ? STATE_KBC_AMI_OUT : STATE_MAIN_IBF; -#endif dev->state = STATE_MAIN_IBF; dev->pending = 0; - // goto ps2_main_ibf; break; case STATE_KBC_OUT: /* Keyboard controller command want to output multiple bytes. */ @@ -768,19 +753,6 @@ write_p2(atkbc_t *dev, uint8_t val) uint8_t kbc_ven = dev->flags & KBC_VEN_MASK; -#if 0 - /* PS/2: Handle IRQ's. */ - if (dev->misc_flags & FLAG_PS2) { - /* IRQ 12 */ - if (dev->irq[1] != 0xffff) - picint_common(1 << dev->irq[1], 0, val & 0x20, NULL); - - /* IRQ 1 */ - if (dev->irq[0] != 0xffff) - picint_common(1 << dev->irq[0], 0, val & 0x10, NULL); - } -#endif - /* AT, PS/2: Handle A20. */ if ((mem_a20_key ^ val) & 0x02) { /* A20 enable change */ mem_a20_key = val & 0x02; @@ -2199,16 +2171,6 @@ write_cmd_toshiba(void *priv, uint8_t val) t3100e_notify_set(0x00); ret = 0; break; - - case 0xc0: /* Read P1 */ - kbc_at_log("ATkbc: read P1\n"); - - /* The T3100e returns all bits set except bit 6 which - * is set by t3100e_mono_set() */ - dev->p1 = (t3100e_mono_get() & 1) ? 0xff : 0xbf; - kbc_delay_to_ob(dev, dev->p1, 0, 0x00); - ret = 0; - break; } return ret; @@ -2282,7 +2244,13 @@ read_p1(atkbc_t *dev) Compaq: Reserved; NCR: DMA mode. */ - uint8_t ret = machine_get_p1(dev->p1) | (dev->p1 & 0x03); + uint8_t kbc_ven = dev->flags & KBC_VEN_MASK; + uint8_t ret = 0x00; + + if ((dev != NULL) && (kbc_ven == KBC_VEN_TOSHIBA)) + ret = machine_get_p1(0xff); + else + ret = machine_get_p1(dev->p1) | (dev->p1 & 0x03); dev->p1 = ((dev->p1 + 1) & 0x03) | (dev->p1 & 0xfc); diff --git a/src/machine/m_at_t3100e.c b/src/machine/m_at_t3100e.c index 4919f49751d..e13ec95303e 100644 --- a/src/machine/m_at_t3100e.c +++ b/src/machine/m_at_t3100e.c @@ -158,6 +158,7 @@ #include <86box/device.h> #include <86box/keyboard.h> #include <86box/rom.h> +#include <86box/video.h> #include "cpu.h" #include <86box/fdd.h> #include <86box/fdc.h> @@ -817,6 +818,7 @@ machine_at_t3100e_init(const machine_t *model) machine_at_common_ide_init(model); + video_reset(gfxcard[0]); device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params); if (fdc_current[0] == FDC_INTERNAL) From 5c6b5240f9683348d32c98fdb5899c070504c453 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 31 Dec 2025 22:14:25 +0100 Subject: [PATCH 189/320] Change the raw screenshot icons to be more different from the non-raw ones. --- src/qt/icons/copy_raw_screenshot.ico | Bin 9622 -> 9622 bytes src/qt/icons/take_raw_screenshot.ico | Bin 9622 -> 9622 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/copy_raw_screenshot.ico b/src/qt/icons/copy_raw_screenshot.ico index 80626be20ac6530e8fcc5b4c05b10406201d5545..072b8576266ac805a0d5bf15f79808516202851b 100644 GIT binary patch literal 9622 zcmeHMF>Vzx5cO9g5TYPOigfu65+yfCDkN@!QXnL5kcKU(5JyNsfl^SDZYxeeN%5ZLX1(^>{@Fw#%1D#hUC+EX9(!%?k1;E=Yxeex*tL1LYs@QS%>KT=|Nh9B zZ}RNmz~6s-V$9p8#;n)={;S0O7T*^VBbS2UpNlca5_d;pg{P#+RJyLSH5%|I7>F%N z-}jC~VGOx49`@qYOcdCNL%WMVy|Ct7o**TCN2Q+*({Nz^D<-BZvSD?=r3(Am&|IyNCzNcQCfV0Unk8nBWC2_`?V7 z_I#{-Piyic&jin{jUHFymGaBtsT_$H`Zim?6rPU5HSu&G7#Do~Iw0f0=k(=$Y|*ZT z?I}F?p}j>?cwB4IA1HiS?~-K>IzQr}jWr@~tra{kYAt7eIV%Bfzjii+PmIFT`QbX2 zRy_1Awb$^O!<*YPkZi~gHFW;y)0~#@0w(t(^pSfJ#}<1Ma;FbMYNTc?=Wtl>D|00K z)S>NVGwO+bVnozliuRjG z2_M+-**1U1OV$_@FDie&Kg?rWOK4{mKKMC5aGev0E1zLVlE5$3=O*|rR=qdb``mXq z^QKk#v)-sn?tB6t$60gc0Y|{cS&9k_%`u#P&@bRp^*mv|DJvX2H^tZ-ixCI?Q&@#( ztkIk;K)7aCfbi$a?AVQ2$=OTRscMD)(L^`qgZ(RKGyHzA7Cjc_IjqAEmk;tkR$$mC zCHbYUtLiW}&u`Ke`ccdQ91y<8OIYSzlLPs~tJ-XsZ{TwM*oGf5+#hSLt{bkA1M->S zpUf@x9~SXECzdStS@vJsBtO<QBB| z{=|1fJRi0lfAH)1&3s1vzh!>(9kNvYIrm_*?_cHkYpl6zU4Qh2^{e5})gKrw3SRJO zso|%;u0P_IQuZO#PmD;W{>TOXOG=KPzuD^g^BOTr^`Cu`USm!1BK;>n`wDI?%zG(I zYG*6>buOuE!Kwdl8gTU>uW&)NIP-!kWy?!Uu}&I7q;$a5)v{eEGr z<8N`+M1RvF#_`vFmy7dA!u;nqIxTQhIcV2w1v%XKdedj_-JEzu6FW;X!!xD8OHYuOEc)c?jY0 z<8=S~2O<25x+hQ4{r4Y+@YP2lTwJ94pAq*L`hJQSTmm80!-Z#v`v*$|*PP8siQ$LW z?bxdyecKoVaV!>(>kb-Z1#^tibLIHoh=ExAv3U7{A$`wZ#qbNd(Y}D@D!%J_4CUHshdhx$T zyo@-Ek_TU&`22KW_E{>3o>z)Fe_)UWuftE<>D^iR*1zAic5`lR+W z#`>D`qZLm)<`AZ5cyn_TkH=&D>E+85liS&KsxWrWrs9~h`?DDDb}`=K(ROLNf|q(L z`xy71B6ZHK-xdyl1S4v+YiKCL|v-(F8=@Hnr9H_%6{E=|&+ zafLpQ#~c#7=$l$^x9H=#$6UyGzeS(Z*jx|UzEU5$m10_`#~ZZzQuJaFeyw!%Wj<=o z%&zy!MTJLB!<5g@q&Z&dRlkHsw1GbE1KJCS>#vPRV^(~BpRg)C>LbQfLHD%(3$I7% zukgNUui+eQ?KP@1ytzGts2Pu#)<1DiUoYWhOzlS;tM(%9N7|F@{aLXm5l)3MOQyap zue{%fL%a*;@raG6TeS1o?Ji;1*Rmb4*WEr$`xcJS;VDe})|WU-|3}L799fz}bMreT zZ@8Z5y`pbn`~6ORr#TE;bHUaC+?2I|@!HSm#i{+z_pLd!7b1qG#^yT2@*U#7h0z;V zi-UEl*MzF@i6z~_CN7dx_D9|~Iac7;*vvh#_g(Vh8jXXxR^Xd{^pket?++O}bL>$! z8pBHbrha5h`@J8>AV(|ly?*Xjb`QOLD*JsJhs{^cqosYD&$xQNUcdH3aTqSROgFJN z;2Rdz=4aqJ*v6u|G8b7#Tlsv6!6J@&FV;QBfgdzs3ZQ8EkIbaB>;c!!b5x?IE&X|hqG5W!Px&Z*yX^k zagMvknT+2LE@01KI)`=qaQT1vw`ZXJzOPvmwvW8$)H*27GvJh|k9@E36eaemlrL_d|ngSwiVXHr?|H>IJ)&ox>3_@ z^djAMq<&aSjGya%{cfRRvE=!u-{|r>kJK7GcR9C_ zdn-Q$LPN`H4Fm30%;I3zcc{5rxnGZVdQb8%+3Bc##9$q{#Xo>Le2@tEAc4;YoJiNO X<7u`#hO<9m_%6}5Yfwadr=a}}jH2PI diff --git a/src/qt/icons/take_raw_screenshot.ico b/src/qt/icons/take_raw_screenshot.ico index b33735a8327b4b05f1e31c16f3260e675c2641aa..a00bf5c742c4db9dcf24fcfe59c1a96baaa83f18 100644 GIT binary patch literal 9622 zcmeI0J#O1T5QRsu5hF+u7cSgIO@NfSL0sh=se+s#P{A@)kYfZcTqm7M!*vdz6Qt1r zl=+r?#+c#qPn2xH9AG%R%boXThr{JcW(zyD^K)~%v@fS-AIRBmZeLq^J?>R`D^9$&7SvZ>3%|E^-S|8S`;2cl zX}@8=LVoxjHA~8XYGfaqfcn-{*E|O!7GoaLRqJi{#RaDDR2N-VxXi$i=n{Yp4};=9L7`|d;BI-YQ``^E>avNdv5T8W7{ZFq`1XTiZg zN)C_lu`2#*O-6qospC0r!Wl&YHVIMrFZ(Lt@YTsal ztnXo88`n)64)~hlXN>!~?`C~Gepj>x*+by>$Kpb89Kg9aQ8SOFi4{zW4JH-0Q`&@ry;rZ5ItbN+YuK&UOJ$@(V z_QtsX>Aj1#*ZL>or{?tTVb9Laj=KMEx7*#_-Ca`n$wSxrW3I-uWBwyQadh#kF88&1 z*Ws^gZvFKdJ!D_&tMY5~k12J2k0Zr!$Tdf7)=CUoKm3T|I+iV2=j(IMK>fWd%uYNX Riz##Bn6`G^@Fz!2{sH#x)fWH& literal 9622 zcmeHMv5p)?5bcvKpAdl^IB@0*2`%vf=ZNn>1Qws*!0e7h;?N@C8xR2!8R2E{5f?Zj zL?$CZUcc8}uco@Edv|V^z(!kAxu&bD-m9+e?HSuCU8MWz(W3-=mA<{7(pM>^$B)bS zw+AWx0^gG-W&HZHlwN$E($!TN|Af515c>sk@CbzBhe^+o_YunuwXM~58N2ku?W{eV zZ+`5}C+0~ijEKi)ViE(v9!H<$%l|9qZ*O-K=A<0w9L5jwSp#EoKH@-_^JNd^3s?Em zG-I%iL-`ASR2nf3_s5qd zllKg+n|$B!zM{Or9rcOId}hnu-gO+8U7tVg8*L9e-cO3v`64QOl6=-Mh-WVSjImT4 zy02oaFb%K8;(4WfhqzZz+Kk)7q)&dsW3K8F7IAo>CbJxOF*|rI7JEmm%~Y(g7j?3Z z4qmPge$__2&DO9Ca|7R^#sOZpK6F5LXRNbY^8hc_$NMLbQ4hPi*_1k2bH-Y6ug3ax zp9wSLM64BfIhWN~4x z^x-O<5O;(4KObHTX2 zdGeX?`vRkK+nSwo<{IQ{V{4wm0bi5~Tk(2tN6R_#v>Y63jtqvsh=bqXaXk!j38$T> zUvsb$=YX%p<~vjBaU+fnK65DK?O~%C{{29ny&N6H#I`WW{=p@ zrdK|e{}?OWvS*-yh%fG=VY7bkN9=bmC+0_daS)4nyz@Da=U#s_=eEsjv58Nynr%Hx zpXSTV{HOf1|09Vf>m9zKrgVw*-Gg3~{xA1y=)XbiTjc%y{qGLT@31TAbEv+#xizcpW5v6N&!g|*=x=kDb++~RZ??K4iNm{9y2R<%%sA!H_UoBz zz&wRHlqy%_h{5;!NEO%CARJo8l(m!^j2}}&ZoTJ*G0N4qhdAVqHrB`rjDNK59`}U$ zTlM@yHHcp|8b8-YaUA$Z+-RVGm$HsLW>1yBuZ97?=L)08FRsZrW#xy>I7jeTYiA7u ze*OF3!h)N(k7;nel}+V}AL`g=8;(0{I<;x+X8 z&v|h4YM|e9k2rsxs~Q47zp*JEL#|deFYfp~t~pxZx)K9piQ`+Ge*gN$XIvH2jwAOS z`H4%Z@S7f}4<&N>r|Qg>>x_FM?6vD>yz#evsCc-}R>g5g{^g41{bCJkRcB)#UOofm z49$Nxvh(2QL+ki2ZR8L?3eG~F;#*p)VYnB{l^x;Kej^Ts`L_4ohvx63i~WvgUHtoS z+I0u|{HR>kL1jFBroD5}#wfP>JsskWbp*cX&d+g9&x;^)XrA^g=MFR-=-pB8aZV@v fClEp}q4%H{&^yb7jJL>r2aJD!_wUQ=r!C(Hr*OfV From 35a48ccdc9fe169c18e1dc573e4183a64facb9c4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 31 Dec 2025 23:14:40 +0100 Subject: [PATCH 190/320] And change them again. --- src/qt/icons/copy_raw_screenshot.ico | Bin 9622 -> 9622 bytes src/qt/icons/take_raw_screenshot.ico | Bin 9622 -> 9622 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/src/qt/icons/copy_raw_screenshot.ico b/src/qt/icons/copy_raw_screenshot.ico index 072b8576266ac805a0d5bf15f79808516202851b..a153305b7bad9750650f87c98ec1d141ebbfdd35 100644 GIT binary patch literal 9622 zcmd5>v5q7)5cTRtoDjiYaKU9eWQ6>|UW7z+_X%hNgv1|Qvd$pn6D}Y?1jKAM5nn+t zn{0@di#9+q@3~xdb&b2*GmHRBwRV@Q-Yb{gwx>6Qi?9hVUIf(J@XaQKFG2_}U&`~Z zABFG>bgy2?^Yt0FFTk$rw zuZO{Y(Z78gQcnc2*-aTle|HyBjC~=d#8~+`mWimp*Ar9x3+ubP6n+LL<;&lzsDF$x z?RL8?#G3V=;irG3U+JIorya}PJ0zcV9Y6euQKcV0`{@fB2-?*j+;J+C{FU)5zxrzo z#PK4T6P^J7Z+}ZUKFhD`PjrZjxy?D?oEb6xnX`_8_|&kr{-T#S(PR8?Zf;UfvOniH z^W(2A#UCo|@7Htw!~zCIbNKM^kk`wP@81hn>9@4L-R9TMb!&TjeSZ2grN_sVK5S4U zU-22nX@%6NKhBMHKzgd$stUH893nMe(ez*FM-ch{tv1_AbTadeVK%*Ti4M>%^yc zew`9~4Uax7+zWhsxx@S!#miV7JU`Y^yk2~fdFsf>czf~nu&5is>&Az?`uS+j?wkOL z-77&0-sN**bvE5q+InK_R!Fl(>kkl_XJ9v6l)O>Qz^BIA>)iZ_OF^{L!P#HYN zC0tVT*%nwkJZn#U6obb+_s$yC!CKx;)^nxcF^Ab+Z0FlcXOMCLGw%ziS@bN@_kw2< zV^TdUi;nqPBE7*FXcJ*La_A-uskb(wbI8t>MUT%!L?iWjIat{^zuAUm9GkI&`Y z!WBAv4$*V#E8L~W3dTQKFJoR)A7b>1T{qh9+4Xd4uXT@ueWLH3VIw+WZaC9OMBnyl z?1Aw(VGLNxHBN(H^@@)^=*Fd;TMnP=-kgPs&vmP7f30R54c|n~rs9`aJwAPxWbqs_ z_>7mu<5Q>aAbI@rG5C2et-lW>Kg1&jITYVMAA?V?ujaSsT`vJ}6b^*;U)Y}$%Hf2e~@$5o@*OF^>q1fR<^3nOmFe2gxWqod zw?1r}V(@kTxEIXbPb3a-jNExhQ}8(lD#WlH_3p#C^{g1hFC2Pr^4K~D6Ar|b?M)g+ zo0_AgdIam~_C7t{?s4zh;NBI|9^+_ObQh%*SaQxbJ>vsgA+ITF+u~z6Kb|ZJV5gTD_xXTfUT|2kO_rtk; zv%62u1~KJ_8FO~Bv~z59{1R9je_Xv!=sWLg#@+Y@cl594CzcoG^LjqBkM+6uxqsR{ zNIA$e*Ehg_Feds?{P@YC<7FJ4zt^|O&plc9e)GLwzy0_4^FYlXgS$E#$V_BKbrrVb2|qn{}JOoMVOm&jGx@TcwH~PbMp7_*K}+AydV4Z&!PUa-(7KX zPPF{H^S9j7{r+>vFLOwoQ>A-OXIj_>jU&C+Lf3xEmCt~|;o1oL* zbrrod8irz33&XE#o7gN8L#wsl*X#TZLoh4*Wc-S&{QA6Buk#x|-<%o0?%gBxx%o35 z=X5~oen0u&hacp^vl&0%K^5lQ{}$I=*x$6Y&v72}yV-_Q`1Los*18|~7%X?ax9R;& z@@3J-+K54a$J^S+FyZd`jIj+_dG22Bhk#BrBLAA42%X*1cj-PoPy4jR#{_7yn2!+q e5T5PECBT-l0mL4155aedsq6#(QH1Xll)nLaP(Yyo literal 9622 zcmeHMF>Vzx5cO9g5TYPOigfu65+yfCDkN@!QXnL5kcKU(5JyNsfl^SDZYxeeN%5ZLX1(^>{@Fw#%1D#hUC+EX9(!%?k1;E=Yxeex*tL1LYs@QS%>KT=|Nh9B zZ}RNmz~6s-V$9p8#;n)={;S0O7T*^VBbS2UpNlca5_d;pg{P#+RJyLSH5%|I7>F%N z-}jC~VGOx49`@qYOcdCNL%WMVy|Ct7o**TCN2Q+*({Nz^D<-BZvSD?=r3(Am&|IyNCzNcQCfV0Unk8nBWC2_`?V7 z_I#{-Piyic&jin{jUHFymGaBtsT_$H`Zim?6rPU5HSu&G7#Do~Iw0f0=k(=$Y|*ZT z?I}F?p}j>?cwB4IA1HiS?~-K>IzQr}jWr@~tra{kYAt7eIV%Bfzjii+PmIFT`QbX2 zRy_1Awb$^O!<*YPkZi~gHFW;y)0~#@0w(t(^pSfJ#}<1Ma;FbMYNTc?=Wtl>D|00K z)S>NVGwO+bVnozliuRjG z2_M+-**1U1OV$_@FDie&Kg?rWOK4{mKKMC5aGev0E1zLVlE5$3=O*|rR=qdb``mXq z^QKk#v)-sn?tB6t$60gc0Y|{cS&9k_%`u#P&@bRp^*mv|DJvX2H^tZ-ixCI?Q&@#( ztkIk;K)7aCfbi$a?AVQ2$=OTRscMD)(L^`qgZ(RKGyHzA7Cjc_IjqAEmk;tkR$$mC zCHbYUtLiW}&u`Ke`ccdQ91y<8OIYSzlLPs~tJ-XsZ{TwM*oGf5+#hSLt{bkA1M->S zpUf@x9~SXECzdStS@vJsBtO<QBB| z{=|1fJRi0lfAH)1&3s1vzh!>(9kNvYIrm_*?_cHkYpl6zU4Qh2^{e5})gKrw3SRJO zso|%;u0P_IQuZO#PmD;W{>TOXOG=KPzuD^g^BOTr^`Cu`USm!1BK;>n`wDI?%zG(I zYG*6>buOuE!Kwdl8gTU>uW&)NIP-!kWy?!Uu}&I7q;$a5)v{eEGr z<8N`+M1RvF#_`vFmy7dA!u;nqIxTQhIcV)0#3{@t7$S@R1ks=*iQgQ=Q(UK!jF&x9Gpo3#jQIqZ;1unpZnwc2A@4T#{ zXm{=X4inGl%l1m|NnWq)MC3p=a&jW72l==Wc`G8Pr)B)(naFpYJ3A}m&(B3Zybu|N zGXAE1zt#4Y`e;`X%DgH$SHHNWEJBGb##!1yqh-}r%Ix&7wFL&o1?%EMa*Y&h`W1b3 zB{`)!0f*%U9{she&!z<&#UEZ{qkl>%Z@1e})Or_VjX!X#0JFtEyVmL-Wr3~UA;lQLi?&UDsGIKI<|T^OM7Zq*gV*O=o!z@o*KC5LyOeZ zpvb0h5vS;}F4WZ~Tf<77i1CyQu~y5t?}=BU9pjs>TfP>6cf>0={PlRSos-tOgtEr( z8MuDD1`j^KB%U3w!P^Bj@zaV2`z1l#Yu^Xs;XC5E7H=uG7QBQ!Dx@~w8Z6kvc>eoM zcl(a}Z(j4B!0*lDm3M}9u9c`BXzaVY%hH(>J%_KRulZx|Q=?BQ7R$f1x0=|%r7R;A z3))kQe7bp=k8Y0hAnz3KcqdzVlWTA2av&|ljk9Oh{C zT6~LvKKQ8DpKJcCE71|R=&|nC@8_v~AMJDED>v4EwTyL*@t16fk8irBrbRZ0Ys4?O z{Pp;-^+HTPk8w*Kg{?godA1RM>KS-y;|B)uBK+uCD?T`EBc`2WAJ1CwiPfT?5iXrytI2t@h9ZDLXb<%`T*NEKNs=0;79&Tb1}ZJ|4DP) zNBZBJu;x~x^F?!8eUCzIw*oA@!u#iMx*bEWZ5D%lV1diZT6~LvzTUg?uY8n$>b+}& z@lLjKsQ0dRp+B&I32fZM29~(0oV$$Ps3@E=gcD#Zrbg`JWk2o-f z?st##_c}i=A(FS~@g8&ko3h_muYUBMl3!!n?ZwB^$YG9upL-(D%PEbVYWe5#pTnQ> zdw9r1mhk)Y_utedZ^lG!===PHdR#kZEQrI){>%lz<8mx=ne*j=mYP9i SRBmZeLq^J?>R`D^9$&7SvZ>3%|E^-S|8S`;2cl zX}@8=LVoxjHA~8XYGfaqfcn-{*E|O!7GoaLRqJi{#RaDDR2N-VxXi$i=n{Yp4};=9L7`|d;BI-YQ``^E>avNdv5T8W7{ZFq`1XTiZg zN)C_lu`2#*O-6qospC0r!Wl&YHVIMrFZ(Lt@YTsal ztnXo88`n)64)~hlXN>!~?`C~Gepj>x*+by>$Kpb89Kg9aQ8SOFi4{zW4JH-0Q`&@ry;rZ5ItbN+YuK&UOJ$@(V z_QtsX>Aj1#*ZL>or{?tTVb9Laj=KMEx7*#_-Ca`n$wSxrW3I-uWBwyQadh#kF88&1 z*Ws^gZvFKdJ!D_&tMY5~k12J2k0Zr!$Tdf7)=CUoKm3T|I+iV2=j(IMK>fWd%uYNX Riz##Bn6`G^@Fz!2{sH#x)fWH& From 1db6dc9328e7a97e451241aa7768dbcf12c8582a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Thu, 1 Jan 2026 17:38:01 +0100 Subject: [PATCH 191/320] Update CODE_OF_CONDUCT.md --- CODE_OF_CONDUCT.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md index 8691505fc9a..e0aaf14104a 100644 --- a/CODE_OF_CONDUCT.md +++ b/CODE_OF_CONDUCT.md @@ -14,7 +14,7 @@ In order for everyone to enjoy their time contributing to 86Box or otherwise bei - 2.4. Do not antagonize, defame, demean, blackmail, impersonate, dox others, bring outside drama, use intentionally offensive profile aspects, or otherwise post messages to start a fight (eg. platform wars). Discuss or debate the idea, not the person. - 2.5. Do not backseat moderate, spam, flood, unsolicitedly ping people, advertise without permission, or evade blocks. - 2.6. Do not speak on behalf of the project unless you are a team member. This includes all messages which could reasonably be understood as being an official position. Ask a team member if you're unsure about your message. -- 2.7. Decisions by higher-ranked users supersede those by lower-ranked users. +- 2.7. Decisions by higher-ranked users supersede those by lower-ranked users. This applies to moderation **and** emulator development. Rank and seniority must be earned. - 2.8. Do not engage in political discussions. - 2.9. Ignoring essential communication from team members does not exempt you from possible actions against you. Seniority must be earned. From 2b99bf64bd5c755812df29570fd625c9f352cfe9 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 1 Jan 2026 16:41:03 +0500 Subject: [PATCH 192/320] Merge `machine_getname_ex` into `machine_getname` --- src/86box.c | 6 +++--- src/device/postcard.c | 2 +- src/discord.c | 4 ++-- src/floppy/fdd.c | 2 +- src/include/86box/machine.h | 3 +-- src/machine/machine.c | 2 +- src/machine/machine_table.c | 8 +------- 7 files changed, 10 insertions(+), 17 deletions(-) diff --git a/src/86box.c b/src/86box.c index b2311f0e23a..615d904bf7d 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1353,7 +1353,7 @@ pc_init_roms(void) while (machine_get_internal_name_ex(c) != NULL) { m = machine_available(c); if (!m) - pclog("Missing machine: %s\n", machine_getname_ex(c)); + pclog("Missing machine: %s\n", machine_getname(c)); c++; } @@ -1394,7 +1394,7 @@ pc_init_modules(void) /* Load the ROMs for the selected machine. */ if (!machine_available(machine)) { - swprintf(temp, sizeof_w(temp), plat_get_string(STRING_HW_NOT_AVAILABLE_MACHINE), machine_getname()); + swprintf(temp, sizeof_w(temp), plat_get_string(STRING_HW_NOT_AVAILABLE_MACHINE), machine_getname(machine)); c = 0; machine = -1; while (machine_get_internal_name_ex(c) != NULL) { @@ -1816,7 +1816,7 @@ update_mouse_msg(void) wchar_t wmachine[2048]; wchar_t *wcp; - mbstowcs(wmachine, machine_getname(), strlen(machine_getname()) + 1); + mbstowcs(wmachine, machine_getname(machine), strlen(machine_getname(machine)) + 1); if (!cpu_override) mbstowcs(wcpufamily, cpu_f->name, strlen(cpu_f->name) + 1); diff --git a/src/device/postcard.c b/src/device/postcard.c index d94bc8ddfbe..f3357445205 100644 --- a/src/device/postcard.c +++ b/src/device/postcard.c @@ -191,7 +191,7 @@ postcard_init(UNUSED(const device_t *info)) if (machine_has_bus(machine, MACHINE_BUS_MCA)) postcard_port = 0x680; /* MCA machines */ else if (strstr(machines[machine].name, " PS/2 ") || - strstr(machine_getname_ex(machine), " PS/1 ")) + strstr(machine_getname(machine), " PS/1 ")) postcard_port = 0x190; /* ISA PS/2 machines */ else if (strstr(machines[machine].name, " IBM XT ")) postcard_port = 0x60; /* IBM XT */ diff --git a/src/discord.c b/src/discord.c index 091d4c95f93..3eb5424e920 100644 --- a/src/discord.c +++ b/src/discord.c @@ -91,9 +91,9 @@ discord_update_activity(int paused) #endif if (strlen(vm_name) < 100) { snprintf(activity.details, sizeof(activity.details), "Running \"%s\"", vm_name); - snprintf(activity.state, sizeof(activity.state), "%s (%s/%s)", strchr(machine_getname(), ']') + 2, cpufamily, cpu_s->name); + snprintf(activity.state, sizeof(activity.state), "%s (%s/%s)", strchr(machine_getname(machine), ']') + 2, cpufamily, cpu_s->name); } else { - strncpy(activity.details, strchr(machine_getname(), ']') + 2, sizeof(activity.details) - 1); + strncpy(activity.details, strchr(machine_getname(machine), ']') + 2, sizeof(activity.details) - 1); snprintf(activity.state, sizeof(activity.state), "%s/%s", cpufamily, cpu_s->name); } #pragma GCC diagnostic pop diff --git a/src/floppy/fdd.c b/src/floppy/fdd.c index 5cf21c77cbc..89ec2e9f6e8 100644 --- a/src/floppy/fdd.c +++ b/src/floppy/fdd.c @@ -484,7 +484,7 @@ fdd_type_invert_densel(int type) int ret; if (drive_types[type].flags & FLAG_PS2) - ret = (!!strstr(machine_getname(), "PS/1")) || (!!strstr(machine_getname(), "PS/2")) || (!!strstr(machine_getname(), "PS/55")); + ret = (!!strstr(machine_getname(machine), "PS/1")) || (!!strstr(machine_getname(machine), "PS/2")) || (!!strstr(machine_getname(machine), "PS/55")); else ret = drive_types[type].flags & FLAG_INVERT_DENSEL; diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index de4e75ff87f..67a120523a9 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -387,8 +387,7 @@ extern void * machine_snd; /* Core functions. */ extern int machine_count(void); extern int machine_available(int m); -extern const char * machine_getname(void); -extern const char * machine_getname_ex(int m); +extern const char * machine_getname(int m); extern const char * machine_get_internal_name(void); extern const char * machine_get_nvr_name(void); extern int machine_get_machine_from_internal_name(const char *s); diff --git a/src/machine/machine.c b/src/machine/machine.c index 30f979fd466..2db543cf2f3 100644 --- a/src/machine/machine.c +++ b/src/machine/machine.c @@ -69,7 +69,7 @@ machine_init_ex(int m) int ret = 0; if (!bios_only) { - machine_log("Initializing as \"%s\"\n", machine_getname()); + machine_log("Initializing as \"%s\"\n", machine_getname(machine)); machine_init_p1(); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 12ed4a874b1..75ecabe2ce1 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -20472,13 +20472,7 @@ machine_count(void) } const char * -machine_getname(void) -{ - return (machines[machine].name); -} - -const char * -machine_getname_ex(int m) +machine_getname(int m) { return (machines[m].name); } From 46d0d90f8d4c2a8f02ae016dab2cb7fb6f261c4b Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 1 Jan 2026 16:41:23 +0500 Subject: [PATCH 193/320] Get rid of `machine_get_machine_from_internal_name_ex` --- src/config.c | 15 ++++++++++----- src/include/86box/machine.h | 1 - src/machine/machine_table.c | 15 --------------- src/qt/qt_vmmanager_system.cpp | 2 +- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/src/config.c b/src/config.c index d5deded9dc7..ecb2c272c1a 100644 --- a/src/config.c +++ b/src/config.c @@ -349,16 +349,21 @@ load_machine(void) for (i = 0; machine_migrations[i].old; i++) { if (!strcmp(p, machine_migrations[i].old)) { machine = machine_get_machine_from_internal_name(machine_migrations[i].new); - migrate_from = p; - if (machine_migrations[i].new_bios) { - migration_cat = ini_find_or_create_section(config, machine_get_device(machine)->name); - ini_section_set_string(migration_cat, "bios", machine_migrations[i].new_bios); + if (machine != -1) { + migrate_from = p; + if (machine_migrations[i].new_bios) { + migration_cat = ini_find_or_create_section(config, machine_get_device(machine)->name); + ini_section_set_string(migration_cat, "bios", machine_migrations[i].new_bios); + } } break; } } - if (!migrate_from) + if (!migrate_from) { machine = machine_get_machine_from_internal_name(p); + if (machine == -1) + machine = 0; + } } else { machine = 0; } diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 67a120523a9..982abda3fbe 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -391,7 +391,6 @@ extern const char * machine_getname(int m); extern const char * machine_get_internal_name(void); extern const char * machine_get_nvr_name(void); extern int machine_get_machine_from_internal_name(const char *s); -extern int machine_get_machine_from_internal_name_ex(const char *s); /* returns -1 if internal name does not exist. */ extern void machine_init(void); #ifdef EMU_DEVICE_H extern const device_t *machine_get_kbc_device(int m); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 75ecabe2ce1..fcfc83839a3 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -20700,21 +20700,6 @@ machine_get_machine_from_internal_name(const char *s) c++; } - return 0; -} - - -int -machine_get_machine_from_internal_name_ex(const char *s) -{ - int c = 0; - - while (machines[c].init != NULL) { - if (!strcmp(machines[c].internal_name, s)) - return c; - c++; - } - return -1; } diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 159659ebff9..7528ad44eeb 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -521,7 +521,7 @@ VMManagerSystem::setupVars() auto machine_name = QString(); int i = 0; int ram_granularity = 0; - int ci = machine_get_machine_from_internal_name_ex(machine_config["machine"].toUtf8()); + int ci = machine_get_machine_from_internal_name(machine_config["machine"].toUtf8()); // Machine if (ci != -1 && machine_available(ci)) { machine_name = machines[ci].name; From 1420a5a00f106ebdda2e3a7f0daef03080ff870a Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 2 Jan 2026 00:32:00 +0600 Subject: [PATCH 194/320] Fix bad screenshots on Vulkan --- src/qt/qt_vulkanwindowrenderer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/qt/qt_vulkanwindowrenderer.cpp b/src/qt/qt_vulkanwindowrenderer.cpp index ce6b464ee0c..c27d382a50b 100644 --- a/src/qt/qt_vulkanwindowrenderer.cpp +++ b/src/qt/qt_vulkanwindowrenderer.cpp @@ -900,11 +900,12 @@ VulkanWindowRenderer::onBlit(int buf_idx, int x, int y, int w, int h) strcat(path, fn); QImage image = this->grab(); - image.save(path, "png"); + image.rgbSwapped().save(path, "png"); monitors[r_monitor_index].mon_screenshots--; } if (monitors[r_monitor_index].mon_screenshots_clipboard) { QImage image = this->grab(); + image = image.rgbSwapped(); QClipboard *clipboard = QApplication::clipboard(); clipboard->setImage(image, QClipboard::Clipboard); monitors[r_monitor_index].mon_screenshots_clipboard--; From 5166d0d8c981d367c5506ba99e0b7256458f28c2 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 2 Jan 2026 01:05:18 +0500 Subject: [PATCH 195/320] Update default copyright year (#6657) --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7dede226e7..afc981b0a03 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -224,7 +224,7 @@ if(NOT EMU_BUILD_NUM) set(EMU_BUILD_NUM 0) endif() if(NOT EMU_COPYRIGHT_YEAR) - set(EMU_COPYRIGHT_YEAR 2025) + set(EMU_COPYRIGHT_YEAR 2026) endif() # Libasan From cce7f2cbc4c69e0984864877f17d823824a4fdaa Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 2 Jan 2026 01:06:30 +0500 Subject: [PATCH 196/320] Legacy SDL UI: Add a screenshot command to the monitor (#6654) * Legacy SDL UI: Add a screenshot monitor command * Add new strings to 86box.pot --- src/qt/languages/86box.pot | 9 +++++++++ src/unix/unix.c | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index 1eeb6bfc75b..e04c73f2ac1 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -204,6 +204,15 @@ msgstr "" msgid "Take s&creenshot" msgstr "" +msgid "Take &raw screenshot" +msgstr "" + +msgid "C&opy screenshot" +msgstr "" + +msgid "Copy r&aw screenshot" +msgstr "" + msgid "S&ound" msgstr "" diff --git a/src/unix/unix.c b/src/unix/unix.c index 97f8b972ad8..b417d38bd9d 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -1104,6 +1104,7 @@ unix_executeLine(char *line) "moeject - eject image from MO drive .\n\n" "hardreset - hard reset the emulated system.\n" "pause - pause the the emulated system.\n" + "screenshot - save a screenshot.\n" "fullscreen - toggle fullscreen.\n" "version - print version and license information.\n" "exit - exit " EMU_NAME ".\n"); @@ -1144,6 +1145,11 @@ unix_executeLine(char *line) } else if (strncasecmp(xargv[0], "fullscreen", 10) == 0) { video_fullscreen = video_fullscreen ? 0 : 1; fullscreen_pending = 1; + } else if (strncasecmp(xargv[0], "screenshot", 10) == 0) { + startblit(); + ++monitors[0].mon_screenshots_raw; + endblit(); + device_force_redraw(); } else if (strncasecmp(xargv[0], "pause", 5) == 0) { plat_pause(dopause ^ 1); printf("%s", dopause ? "Paused.\n" : "Unpaused.\n"); From 99a666e6c974a72ce4e5626677b1d30efd2acf95 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 2 Jan 2026 01:15:34 +0500 Subject: [PATCH 197/320] Qt: Remove keyboard shortcuts from .ui files (#6655) Fixes keybinds being reset on a language change --- src/qt/qt_mainwindow.ui | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index f03beee7cef..7562391bb5d 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -380,9 +380,6 @@ Press Ctrl+Alt+Del - - Ctrl+F12 - @@ -432,9 +429,6 @@ &Fullscreen - - Ctrl+Alt+PgUp - @@ -752,9 +746,6 @@ Take s&creenshot - - Ctrl+F11 - :/menuicons/qt/icons/take_screenshot.ico:/menuicons/qt/icons/take_screenshot.ico From 6a5aaa26cfefcfd5b8c6ea1263639ccaefbccb44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 1 Jan 2026 19:56:44 +0000 Subject: [PATCH 198/320] Translated using Weblate (Czech) Currently translated at 100.0% (999 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/cs/ --- src/qt/languages/cs-CZ.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 041992219d8..a229f505c05 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2025-12-04 18:56+0000\n" +"PO-Revision-Date: 2026-01-01 20:06+0000\n" "Last-Translator: David Hrdlička \n" "Language-Team: Czech \n" "Language: cs-CZ\n" @@ -214,10 +214,10 @@ msgid "Take &raw screenshot" msgstr "Pořídit &surový screenshot" msgid "C&opy screenshot" -msgstr "Z&kopírovát screenshot" +msgstr "Z&kopírovat screenshot" msgid "Copy r&aw screenshot" -msgstr "Zkopírovát s&urový screenshot" +msgstr "Zkopírovat s&urový screenshot" msgid "S&ound" msgstr "&Zvuk" From 327a169fd82c2810655a7be4c40a931883e736e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Umut=20=C3=87a=C4=9Fan=20U=C3=A7anok?= Date: Thu, 1 Jan 2026 20:04:03 +0000 Subject: [PATCH 199/320] Translated using Weblate (Turkish) Currently translated at 100.0% (999 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/tr/ --- src/qt/languages/tr-TR.po | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index f2a21f5d2e9..036cf72bb99 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -1,8 +1,14 @@ msgid "" msgstr "" +"PO-Revision-Date: 2026-01-01 20:06+0000\n" +"Last-Translator: Umut Çağan Uçanok \n" +"Language-Team: Turkish \n" +"Language: tr-TR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: tr_TR\n" "X-Source-Language: en_US\n" @@ -1771,7 +1777,7 @@ msgid "VDE Socket:" msgstr "VDE Soketi:" msgid "TAP Bridge Device:" -msgstr "" +msgstr "TAP Köprü Cihazı:" msgid "86Box Unit Tester" msgstr "86Box Test Cihazı" @@ -1810,7 +1816,7 @@ msgid "PS/55 Keyboard" msgstr "PS/55 Klavyesi" msgid "Keys" -msgstr "Keys" +msgstr "Tuşlar" msgid "Logitech/Microsoft Bus Mouse" msgstr "Logitech/Microsoft Bus Faresi" @@ -2053,7 +2059,7 @@ msgid "Reverb Output Gain" msgstr "Yankı Çıkış Sesi Artışı" msgid "Reversed stereo" -msgstr "Tersine çevirilmiş stereo" +msgstr "Tersine çevrilmiş stereo" msgid "Nice ramp" msgstr "Güzel rampa" @@ -2164,16 +2170,16 @@ msgid "WSS DMA" msgstr "WSS DMA" msgid "RTC IRQ" -msgstr "" +msgstr "RTC IRQ" msgid "RTC Port Address" -msgstr "" +msgstr "RTC Bağlantı Noktası Adresi" msgid "Onboard RTC" -msgstr "" +msgstr "Yerleşik RTC" msgid "Not installed" -msgstr "" +msgstr "Kurulu değil" msgid "Enable OPL" msgstr "OPL'yi etkinleştir" @@ -2797,7 +2803,7 @@ msgid "Toggle fullscreen" msgstr "Tam ekran modunu ayarla" msgid "Toggle UI in fullscreen" -msgstr "" +msgstr "Arayüzü tam ekranda ayarla" msgid "Screenshot" msgstr "Ekran görüntüsü" From 6ae9aac5f95e99ecaae59c1d8550dfc2b92eeaed Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 2 Jan 2026 02:02:16 +0500 Subject: [PATCH 200/320] Partial Greek translation Co-authored-by: DimMan88 <71668463+DimMan88@users.noreply.github.com> --- src/qt/languages/el-GR.po | 3004 +++++++++++++++++++++++++++++++++ src/qt/qt_progsettings.cpp | 1 + src/qt/qt_translations.qrc.in | 1 + 3 files changed, 3006 insertions(+) create mode 100644 src/qt/languages/el-GR.po diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po new file mode 100644 index 00000000000..ccc043030cf --- /dev/null +++ b/src/qt/languages/el-GR.po @@ -0,0 +1,3004 @@ +msgid "" +msgstr "" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Language: el_GR\n" +"X-Source-Language: en_US\n" + +msgid "&Action" +msgstr "&Ενέργειες" + +msgid "&Keyboard requires capture" +msgstr "&Keyboard requires capture" + +msgid "&Right CTRL is left ALT" +msgstr "&Το Right CTRL είναι left ALT" + +msgid "&Hard reset" +msgstr "&Hard reset" + +msgid "&Ctrl+Alt+Del" +msgstr "&Ctrl+Alt+Del" + +msgid "Ctrl+Alt+&Esc" +msgstr "Ctrl+Alt+&Esc" + +msgid "&Pause" +msgstr "&Παύση" + +msgid "Pause" +msgstr "Παύση" + +msgid "Re&sume" +msgstr "Συ&νέχια" + +msgid "E&xit" +msgstr "Έ&ξοδος" + +msgid "&View" +msgstr "&Προβολή" + +msgid "&Hide status bar" +msgstr "&Απόκρυψη γραμμής κατάστασης" + +msgid "Hide &toolbar" +msgstr "Απόκρυψη &γραμμής εργαλείων" + +msgid "&Resizeable window" +msgstr "&Προσαρμόσιμο παράθυρο" + +msgid "R&emember size && position" +msgstr "Α&πομνήμευση μεγέθους && θέσης" + +msgid "Remember size && position" +msgstr "Απομνήμευση μεγέθους && θέσης" + +msgid "Re&nderer" +msgstr "Re&nderer" + +msgid "&Qt (Software)" +msgstr "&Qt (Software)" + +msgid "Open&GL (3.0 Core)" +msgstr "Open&GL (3.0 Core)" + +msgid "&VNC" +msgstr "&VNC" + +msgid "Specify &dimensions…" +msgstr "Ορισμός &διαστάσεων…" + +msgid "Force &4:3 display ratio" +msgstr "Εξαναγκασμός &αναλογίας οθόνης 4:3" + +msgid "&Window scale factor" +msgstr "&Συντελεστής κλίμακας παραθύρου" + +msgid "&0.5x" +msgstr "&0.5x" + +msgid "&1x" +msgstr "&1x" + +msgid "1.&5x" +msgstr "1.&5x" + +msgid "&2x" +msgstr "&2x" + +msgid "&3x" +msgstr "&3x" + +msgid "&4x" +msgstr "&4x" + +msgid "&5x" +msgstr "&5x" + +msgid "&6x" +msgstr "&6x" + +msgid "&7x" +msgstr "&7x" + +msgid "&8x" +msgstr "&8x" + +msgid "Fi<er method" +msgstr "Τύ&πος φιλτραρίσματος" + +msgid "&Nearest" +msgstr "&Nearest" + +msgid "&Linear" +msgstr "&Linear" + +msgid "Hi&DPI scaling" +msgstr "Κλ&ίμακα HiDPI" + +msgid "&Fullscreen" +msgstr "&Πλήρης οθόνη" + +msgid "Fullscreen &stretch mode" +msgstr "Πλήρης οθόνη &σε τύπο τεντώματος" + +msgid "&Full screen stretch" +msgstr "&Τέντωμα πλήρους οθόνης" + +msgid "&4:3" +msgstr "&4:3" + +msgid "&Square pixels (Keep ratio)" +msgstr "&Square pixels (Διατήρηση αναλογίας)" + +msgid "&Integer scale" +msgstr "&Integer scale" + +msgid "4:&3 Integer scale" +msgstr "4:&3 Integer scale" + +msgid "EGA/(S)&VGA settings" +msgstr "Ρυθμίσε&ις EGA/(S)VGA" + +msgid "&Inverted VGA monitor" +msgstr "&Inverted VGA monitor" + +msgid "VGA screen &type" +msgstr "Τύπος οθόνης& VGA" + +msgid "RGB &Color" +msgstr "Χρώματα RGB" + +msgid "RGB (no brown)" +msgstr "RGB (χωρίς το καφέ)" + +msgid "&RGB Grayscale" +msgstr "&RGB κλίμακας γκρι" + +msgid "Generic RGBI color monitor" +msgstr "Γενική έγχρωμη οθόνη RGBI" + +msgid "&Amber monitor" +msgstr "&Κεχριμπάρι οθόνη" + +msgid "&Green monitor" +msgstr "&Πράσινη οθόνη" + +msgid "&White monitor" +msgstr "&Λευκή οθόνη" + +msgid "Grayscale &conversion type" +msgstr "Τύπος μετα&τροπής κλίμακας του γκρι" + +msgid "BT&601 (NTSC/PAL)" +msgstr "BT&601 (NTSC/PAL)" + +msgid "BT&709 (HDTV)" +msgstr "BT&709 (HDTV)" + +msgid "&Average" +msgstr "&Σχετικό" + +msgid "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" +msgstr "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" + +msgid "Change contrast for &monochrome display" +msgstr "Αλλαγή αντίθεσης γι&α μονόχρωμη οθόνη" + +msgid "&Media" +msgstr "&Μέσα" + +msgid "&Tools" +msgstr "&Εργαλεία" + +msgid "&Settings…" +msgstr "&Ρυθμίσεις…" + +msgid "Settings…" +msgstr "Ρυθμίσεις…" + +msgid "&Update status bar icons" +msgstr "&Ανανέωση εικονιδίων γραμμής κατάστασης" + +msgid "Take s&creenshot" +msgstr "Λήψη σ&τιγμιότυπου" + +msgid "Take &raw screenshot" +msgstr "" + +msgid "C&opy screenshot" +msgstr "" + +msgid "Copy r&aw screenshot" +msgstr "" + +msgid "S&ound" +msgstr "Ή&χος" + +msgid "&Preferences…" +msgstr "&Προτιμήσεις…" + +msgid "Enable &Discord integration" +msgstr "Enable &Discord integration" + +msgid "Sound &gain…" +msgstr "&Ενίσχυση ήχου…" + +msgid "Begin trace" +msgstr "Αρχλη καταγραφής" + +msgid "End trace" +msgstr "Τέλος καταγραφής" + +msgid "&Help" +msgstr "&Βοήθεια" + +msgid "&Documentation…" +msgstr "&Εγχειρίδια…" + +msgid "&About 86Box…" +msgstr "&Σχετικά με το 86Box…" + +msgid "&New image…" +msgstr "&Δημιουργία εικόνας…" + +msgid "&Existing image…" +msgstr "&Υπάρχουσα εικόνα…" + +msgid "Existing image (&Write-protected)…" +msgstr "Υπάρχουσα εικόνα (&Προστασία-εγγραφής)…" + +msgid "&Record" +msgstr "&Καταγραφή" + +msgid "&Play" +msgstr "&Αναπαραγωγή" + +msgid "&Rewind to the beginning" +msgstr "&Γύρισμα στην αρχή" + +msgid "&Fast forward to the end" +msgstr "&Γρήγορα μπροστά στο τέλος" + +msgid "E&ject" +msgstr "&Εξαγωγή" + +msgid "&Image…" +msgstr "&Εικόνα…" + +msgid "E&xport to 86F…" +msgstr "&Εξαγωγή σε 86F…" + +msgid "&Mute" +msgstr "&Σίγαση" + +msgid "E&mpty" +msgstr "&Κενό" + +msgid "Reload previous image" +msgstr "Επαναφώρτωση προηγύμενης εικόνας" + +msgid "&Folder…" +msgstr "&Φάκελος…" + +msgid "Preferences" +msgstr "Προτιμήσεις" + +msgid "Sound Gain" +msgstr "Ενίσχυση Ήχου" + +msgid "New Image" +msgstr "Δημιουργία εικόνας" + +msgid "Settings" +msgstr "Ρυθμίσεις" + +msgid "Specify Main Window Dimensions" +msgstr "Ορισμός Διαστάσεων Κύριου Παραθύρου" + +msgid "OK" +msgstr "ΟΚ" + +msgid "Cancel" +msgstr "Άκυρο" + +msgid "&Default" +msgstr "&Προεπιλογή" + +msgid "Language:" +msgstr "Γλώσσα:" + +msgid "Gain" +msgstr "Ενίσχυση" + +msgid "File name:" +msgstr "Όνομα αρχείου:" + +msgid "Disk size:" +msgstr "Μέγεθος δίσκου:" + +msgid "RPM mode:" +msgstr "Τύπος RPM:" + +msgid "Progress:" +msgstr "Πρόοδος:" + +msgid "Width:" +msgstr "Πλάτος:" + +msgid "Height:" +msgstr "Ύψος:" + +msgid "Lock to this size" +msgstr "Κλείδωμα σε αυτό το μέγεθος" + +msgid "Machine type:" +msgstr "Τύπος συστήματος" + +msgid "Machine:" +msgstr "Σύστημα:" + +msgid "Configure" +msgstr "Προσαρμογή" + +msgid "CPU:" +msgstr "CPU:" + +msgid "CPU type:" +msgstr "Τύπος CPU:" + +msgid "Speed:" +msgstr "Ταχύτητα:" + +msgid "Frequency:" +msgstr "Συχνότητα:" + +msgid "FPU:" +msgstr "FPU" + +msgid "Wait states:" +msgstr "" + +msgid "MB" +msgstr "MB" + +msgid "Memory:" +msgstr "Μνήμη:" + +msgid "Time synchronization" +msgstr "Συγχρονισμός ώρας" + +msgid "Disabled" +msgstr "Ανενεργό" + +msgid "Enabled (local time)" +msgstr "Ενεργό (τοπική ώρα)" + +msgid "Enabled (UTC)" +msgstr "Ενεργό (UTC)" + +msgid "Dynamic Recompiler" +msgstr "Dynamic Recompiler" + +msgid "CPU frame size" +msgstr "CPU frame size" + +msgid "Larger frames (less smooth)" +msgstr "Larger frames (less smooth)" + +msgid "Smaller frames (smoother)" +msgstr "Smaller frames (smoother)" + +msgid "Video:" +msgstr "Κάρτα γραφικών:" + +msgid "Video #2:" +msgstr "Κάρτα γραφικών #2:" + +msgid "Voodoo 1 or 2 Graphics" +msgstr "Γραφικά Voodoo 1 ή 2" + +msgid "IBM 8514/A Graphics" +msgstr "Γραφικά IBM 8514/A" + +msgid "XGA Graphics" +msgstr "Γραφικά XGA" + +msgid "IBM PS/55 Display Adapter Graphics" +msgstr "Προσαρμογέας Γραφικών IBM PS/55" + +msgid "Keyboard:" +msgstr "Πληκτρολόγιο:" + +msgid "Keyboard" +msgstr "Πληκτρολόγιο" + +msgid "Mouse:" +msgstr "Ποντίκι:" + +msgid "Mouse" +msgstr "Ποντίκι" + +msgid "Joystick:" +msgstr "Joystick:" + +msgid "Joystick" +msgstr "Joystick" + +msgid "Joystick 1…" +msgstr "Joystick 1…" + +msgid "Joystick 2…" +msgstr "Joystick 2…" + +msgid "Joystick 3…" +msgstr "Joystick 3…" + +msgid "Joystick 4…" +msgstr "Joystick 4…" + +msgid "Sound card #1:" +msgstr "Κάρτα ήχου #1:" + +msgid "Sound card #2:" +msgstr "Κάρτα ήχου #2:" + +msgid "Sound card #3:" +msgstr "Κάρτα ήχου #3:" + +msgid "Sound card #4:" +msgstr "Κάρτα ήχου #4:" + +msgid "MIDI Out Device:" +msgstr "Συσκευή MIDI Out:" + +msgid "MIDI In Device:" +msgstr "Συσκευή MIDI In:" + +msgid "MIDI Out:" +msgstr "MIDI Out:" + +msgid "Standalone MPU-401" +msgstr "Ξέχωρο MPU-401" + +msgid "Use FLOAT32 sound" +msgstr "Χρήση ήχου FLOAT32" + +msgid "FM synth driver" +msgstr "Οδηγός FM synth" + +msgid "Nuked (more accurate)" +msgstr "Nuked (πιο ακριβές)" + +msgid "YMFM (faster)" +msgstr "YMFM (γρήγορο)" + +msgid "COM1 Device:" +msgstr "Συσκευή COM1:" + +msgid "COM2 Device:" +msgstr "Συσκευή COM2:" + +msgid "COM3 Device:" +msgstr "Συσκευή COM3:" + +msgid "COM4 Device:" +msgstr "Συσκευή COM4:" + +msgid "LPT1 Device:" +msgstr "Συσκευή LPT1:" + +msgid "LPT2 Device:" +msgstr "Συσκευή LPT2:" + +msgid "LPT3 Device:" +msgstr "Συσκευή LPT3:" + +msgid "LPT4 Device:" +msgstr "Συσκευή LPT4:" + +msgid "Internal LPT ECP DMA:" +msgstr "Εσωτερικό LPT ECP DMA:" + +msgid "Serial port 1" +msgstr "Σειριακή θύρα 1" + +msgid "Serial port 2" +msgstr "Σειριακή θύρα 2" + +msgid "Serial port 3" +msgstr "Σειριακή θύρα 3" + +msgid "Serial port 4" +msgstr "Σειριακή θύρα 4" + +msgid "Parallel port 1" +msgstr "Παράλληλη θύρα 1" + +msgid "Parallel port 2" +msgstr "Παράλληλη θύρα 2" + +msgid "Parallel port 3" +msgstr "Παράλληλη θύρα 3" + +msgid "Parallel port 4" +msgstr "Παράλληλη θύρα 4" + +msgid "Floppy disk controller:" +msgstr "" + +msgid "CD-ROM controller:" +msgstr "Ελεγκτής CD-ROM:" + +msgid "[ISA16] Tertiary IDE Controller" +msgstr "[ISA16] Τριτογενής Ελεγκτής IDE" + +msgid "[ISA16] Quaternary IDE Controller" +msgstr "[ISA16] Τεταρτογενής Ελεγκτής IDE" + +msgid "Hard disk controllers" +msgstr "" + +msgid "SCSI controllers" +msgstr "Ελεγκτές SCSI" + +msgid "Controller 1:" +msgstr "Ελεγκτής 1:" + +msgid "Controller 2:" +msgstr "Ελεγκτής 2:" + +msgid "Controller 3:" +msgstr "Ελεγκτής 3:" + +msgid "Controller 4:" +msgstr "Ελεγκτής 4:" + +msgid "Cassette" +msgstr "Κασέτα" + +msgid "Hard disks:" +msgstr "Σκληροί δίσκοι:" + +msgid "Firmware Version" +msgstr "Έκδοση Firmware" + +msgid "&New…" +msgstr "&Δημιουργία…" + +msgid "&Existing…" +msgstr "&Υπάρχων…" + +msgid "&Remove" +msgstr "&Κατάργηση" + +msgid "Bus:" +msgstr "Bus:" + +msgid "Channel:" +msgstr "Κανάλι:" + +msgid "ID:" +msgstr "ID:" + +msgid "Sectors:" +msgstr "Τομείς:" + +msgid "Heads:" +msgstr "Κεφαλές:" + +msgid "Cylinders:" +msgstr "Κύλινδροι:" + +msgid "Size (MB):" +msgstr "Μέγεθος (MB):" + +msgid "Type:" +msgstr "Τύπος:" + +msgid "Image Format:" +msgstr "Τύπος Εικόνας:" + +msgid "Block Size:" +msgstr "Block Size:" + +msgid "Floppy drives:" +msgstr "Οδηγοί δισκέτας:" + +msgid "Turbo timings" +msgstr "Χρονισμοί Turbo" + +msgid "Check BPB" +msgstr "Έλεγχος BPB" + +msgid "CD-ROM drives:" +msgstr "Οδηγοί CD-ROM:" + +msgid "MO drives:" +msgstr "Οδηγοί MO:" + +msgid "MO:" +msgstr "MO:" + +msgid "Removable disks:" +msgstr "Αφαιρούμενοι δίσκοι:" + +msgid "Removable disk drives:" +msgstr "Οδηγοί αφαιρούμενων δίσκων:" + +msgid "ZIP 250" +msgstr "ZIP 250" + +msgid "ISA RTC:" +msgstr "ISA RTC:" + +msgid "ISA Memory Expansion" +msgstr "ISA Επέκταση Μνήμης" + +msgid "ISA ROM Cards" +msgstr "ISA κάρτες ROM" + +msgid "Card 1:" +msgstr "Κάρτα 1:" + +msgid "Card 2:" +msgstr "Κάρτα 2:" + +msgid "Card 3:" +msgstr "Κάρτα 3:" + +msgid "Card 4:" +msgstr "Κάρτα 4:" + +msgid "Generic ISA ROM Board" +msgstr "Γενική ROM πλακέτα ISA" + +msgid "Generic Dual ISA ROM Board" +msgstr "Γενική διπλή ROM πλακέτα ISA" + +msgid "Generic Quad ISA ROM Board" +msgstr "Γενική τετραπλή ROM πλακέτα ISA" + +msgid "ISABugger device" +msgstr "ISABugger device" + +msgid "POST card" +msgstr "κάρτα POST" + +msgid "Error" +msgstr "Σφάλμα" + +msgid "Fatal error" +msgstr "Οριστικό σφάλμα" + +msgid " - PAUSED" +msgstr " - ΣΤΑΜΑΤΗΜΕΝΟ" + +msgid "Speed" +msgstr "Ταχύτητα" + +msgid "Removable disk %1 (%2): %3" +msgstr "Αφαιρούμενος δίσκος %1 (%2): %3" + +msgid "&Removable disk %1 (%2): %3" +msgstr "&Αφαιρούμενος δίσκος %1 (%2): %3" + +msgid "Removable disk images" +msgstr "Εικόνες αφαιρούμενων δίσκων" + +msgid "Image %1" +msgstr "Εικόνα %1" + +msgid "86Box could not find any usable ROM images.\n\nPlease download a ROM set and extract it into the \"roms\" directory." +msgstr "Το 86Box δεν μπόρεσε να εντοπίσει καμία ROM.\n\nΠαρακαλώ κατεβάστε το πακέτο ROM και εξάγετέ το στον κατάλογο \"roms\"." + +msgid "(empty)" +msgstr "(κενό)" + +msgid "All files" +msgstr "Όλα τα αρχεία" + +msgid "Turbo" +msgstr "Turbo" + +msgid "On" +msgstr "On" + +msgid "Off" +msgstr "Off" + +msgid "All images" +msgstr "Όλες οι εικόνες" + +msgid "Basic sector images" +msgstr "Εικόνες βασικού τόμου" + +msgid "Surface images" +msgstr "Εικόνες επιφάνειας" + +msgid "Machine \"%hs\" is not available due to missing ROMs in the roms/machines directory. Switching to an available machine." +msgstr "Το σύστημα \"%hs\" δεν είναι διαθέσιμο λόγω έλλειψης των ROMs στον κατάλογο roms/machines. Αλλάξτε σε διαθέσιμο σύστημα." + +msgid "Video card \"%hs\" is not available due to missing ROMs in the roms/video directory. Switching to an available video card." +msgstr "Η κάρτα γραφικών \"%hs\" δεν είναι διαθέσιμη λόγω έλλειψης των ROMs στον κατάλογο roms/video. Αλλάξτε σε διαθέσιμη κάρτα γραφικών." + +msgid "Video card #2 \"%hs\" is not available due to missing ROMs in the roms/video directory. Disabling the second video card." +msgstr "Η κάρτα γραφικών #2 \"%hs\" δεν είναι διαθέσιμη λόγω έλλειψης των ROMs στον κατάλογο roms/video. Αλλάξτε σε διαθέσιμη κάρτα γραφικών." + +msgid "Device \"%hs\" is not available due to missing ROMs. Ignoring the device." +msgstr "Η συσκευή \"%hs\" δεν είναι διαθέσιμη λόγω έλλειψης των ROMs. Παράκαμψη συσκευής." + +msgid "Machine" +msgstr "Σύστημα" + +msgid "Display" +msgstr "Οθόνη" + +msgid "Input devices" +msgstr "Συσκευές εισόδου" + +msgid "Sound" +msgstr "Ήχος" + +msgid "Network" +msgstr "Δίκτυο" + +msgid "Ports (COM & LPT)" +msgstr "Θύρες (COM & LPT) " + +msgid "Ports" +msgstr "Θύρες" + +msgid "Serial ports:" +msgstr "Σειριακές θύρες:" + +msgid "Parallel ports:" +msgstr "Παράλληλες θύρες:" + +msgid "Storage controllers" +msgstr "Ελεγκτές αποθήκευσης" + +msgid "Hard disks" +msgstr "Σκληροί δίσκοι" + +msgid "Disks:" +msgstr "Δίσκοι:" + +msgid "Floppy:" +msgstr "Floppy:" + +msgid "Controllers:" +msgstr "Ελεγκτές:" + +msgid "Floppy & CD-ROM drives" +msgstr "Οδηγοί Floppy & CD-ROM" + +msgid "Other removable devices" +msgstr "Άλλες αφαιρούμενες συσκευές" + +msgid "Other peripherals" +msgstr "Άλλα περιφερειακά" + +msgid "Other devices" +msgstr "Άλλες συσκευές" + +msgid "Click to capture mouse" +msgstr "Κλικ για σύνδεση ποντικιού" + +msgid "Press %1 to release mouse" +msgstr "Πατήσε %1 για απελευθέρωση ποντικιού" + +msgid "Press %1 or middle button to release mouse" +msgstr "Πατήσε %1 ή το μεσαίο κουμπί για απελευθέρωση ποντικιού" + +msgid "Bus" +msgstr "Bus" + +msgid "File" +msgstr "Αρχείο" + +msgid "C" +msgstr "C" + +msgid "H" +msgstr "H" + +msgid "S" +msgstr "S" + +msgid "KB" +msgstr "KB" + +msgid "Default" +msgstr "Προεπιλογή" + +msgid "%1 Wait state(s)" +msgstr "%1 Κατάσταση αναμονής(ών)" + +msgid "Type" +msgstr "Τύπος" + +msgid "No PCap devices found" +msgstr "Δεν βέθηκαν PCap συσκευές" + +msgid "Invalid PCap device" +msgstr "Μη έγκυρη PCap συσκευή" + +msgid "Generic paddle controller(s)" +msgstr "Generic paddle controller(s)" + +msgid "2-axis, 1-button joystick(s)" +msgstr "2-axis, 1-button joystick(s)" + +msgid "2-axis, 2-button joystick(s)" +msgstr "2-axis, 2-button joystick(s)" + +msgid "2-axis, 3-button joystick" +msgstr "2-axis, 3-button joystick" + +msgid "2-axis, 4-button joystick" +msgstr "2-axis, 4-button joystick" + +msgid "2-axis, 6-button joystick" +msgstr "2-axis, 6-button joystick" + +msgid "2-axis, 8-button joystick" +msgstr "2-axis, 8-button joystick" + +msgid "3-axis, 2-button joystick" +msgstr "3-axis, 2-button joystick" + +msgid "3-axis, 3-button joystick" +msgstr "3-axis, 3-button joystick" + +msgid "3-axis, 4-button joystick" +msgstr "3-axis, 4-button joystick" + +msgid "4-axis, 2-button joystick" +msgstr "4-axis, 2-button joystick" + +msgid "4-axis, 3-button joystick" +msgstr "4-axis, 3-button joystick" + +msgid "4-axis, 4-button joystick" +msgstr "4-axis, 4-button joystick" + +msgid "2-button gamepad(s)" +msgstr "2-button gamepad(s)" + +msgid "3-button gamepad" +msgstr "3-button gamepad" + +msgid "4-button gamepad" +msgstr "4-button gamepad" + +msgid "6-button gamepad" +msgstr "6-button gamepad" + +msgid "2-button flight yoke" +msgstr "2-button flight yoke" + +msgid "3-button flight yoke" +msgstr "3-button flight yoke" + +msgid "4-button flight yoke" +msgstr "4-button flight yoke" + +msgid "2-button flight yoke with throttle" +msgstr "2-button flight yoke with throttle" + +msgid "3-button flight yoke with throttle" +msgstr "3-button flight yoke with throttle" + +msgid "4-button flight yoke with throttle" +msgstr "4-button flight yoke with throttle" + +msgid "Steering wheel (3-axis, 2-button)" +msgstr "Steering wheel (3-axis, 2-button)" + +msgid "Steering wheel (3-axis, 3-button)" +msgstr "Steering wheel (3-axis, 3-button)" + +msgid "Steering wheel (3-axis, 4-button)" +msgstr "Steering wheel (3-axis, 4-button)" + +msgid "Thrustmaster Formula T1/T2 with adapter" +msgstr "Thrustmaster Formula T1/T2 with adapter" + +msgid "Thrustmaster Formula T1/T2 without adapter" +msgstr "Thrustmaster Formula T1/T2 without adapter" + +msgid "None" +msgstr "Κανένα" + +msgid "%1 MB (CHS: %2, %3, %4)" +msgstr "%1 MB (CHS: %2, %3, %4)" + +msgid "Floppy %1 (%2): %3" +msgstr "Floppy %1 (%2): %3" + +msgid "&Floppy %1 (%2): %3" +msgstr "&Floppy %1 (%2): %3" + +msgid "Advanced sector images" +msgstr "Εικόνες προχωρημένου τομέα" + +msgid "Flux images" +msgstr "Εικόνες Flux" + +msgid "Are you sure you want to hard reset the emulated machine?" +msgstr "Είστε σίγουρος οτι θέλετε να κάνετε ολική επαναφορά του εξομειωμένου σύστηματος;" + +msgid "Are you sure you want to exit 86Box?" +msgstr "Είστε σίγουρος για την έξοδο απο το 86Box;" + +msgid "Unable to initialize Ghostscript" +msgstr "Αδυναμία αρχικοποίησης Ghostscript " + +msgid "Unable to initialize GhostPCL" +msgstr "Αδυναμία αρχικοποίησης GhostPCL " + +msgid "MO %1 (%2): %3" +msgstr "MO %1 (%2): %3" + +msgid "&MO %1 (%2): %3" +msgstr "&MO %1 (%2): %3" + +msgid "MO images" +msgstr "Εικόνες MO" + +msgid "Welcome to 86Box!" +msgstr "Καλως ορίσατε στο 86Box!" + +msgid "Internal device" +msgstr "Εσωτερική συσκευή" + +msgid "&File" +msgstr "&Αρχείο" + +msgid "&New machine…" +msgstr "&Νέα μηχανή…" + +msgid "New machine…" +msgstr "Νέα μηχανή…" + +msgid "New machine" +msgstr "Νέα μηχανή" + +msgid "&Check for updates..." +msgstr "&Έλεγχος για ενημερώσεις..." + +msgid "Exit" +msgstr "Έξοδος" + +msgid "No ROMs found" +msgstr "Δεν βρέθηκαν ROMs" + +msgid "Do you want to save the settings?" +msgstr "Επιθυμείτε να αποθηκεύσετε τις ρυθμίσεις;" + +msgid "This will hard reset the emulated machine." +msgstr "Αυτό θα οδηγήσει σε ολική επαναφορά της εξομειωμένης μηχανής." + +msgid "Save" +msgstr "Αποθήκευση" + +msgid "About %1" +msgstr "Σχετικά με το %1" + +msgid "An emulator of old computers\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." +msgstr "Εξομειωτής παλαιών υπολογιστών\n\nAuthors: Miran Grča (OBattler), RichardG867, Jasmine Iwanek, TC1995, coldbrewed, Teemu Korhonen (Manaatti), Joakim L. Gilje, Adrien Moulin (elyosh), Daniel Balsom (gloriouscow), Cacodemon345, Fred N. van Kempen (waltje), Tiseno100, reenigne, and others.\n\nWith previous core contributions from Sarah Walker, leilei, JohnElliott, greatpsycho, and others.\n\nReleased under the GNU General Public License version 2 or later. See LICENSE for more information." + +msgid "Hardware not available" +msgstr "Μη διαθέσιμο υλικό" + +msgid "Make sure %1 is installed and that you are on a %1-compatible network connection." +msgstr "Βεβαιωθήτε οτι το %1 είναι εγκατεστημένο και οτι είστε σε %1-συμβατό δίκτυο." + +msgid "Invalid configuration" +msgstr "Μη έγκυρη προσαρμογή" + +msgid "%1 is required for automatic conversion of PostScript files to PDF.\n\nAny documents sent to the generic PostScript printer will be saved as PostScript (.ps) files." +msgstr "%1 απαιτείται για αυτόματη μετατροπή αρχείων PostScript σε PDF.\n\nΈγγραφα που στέλνονται στον γενικό εκτυπωτή PostScript θα αποθηκεύονται ως αρχεία PostScript (.ps)." + +msgid "%1 is required for automatic conversion of PCL files to PDF.\n\nAny documents sent to the generic PCL printer will be saved as Printer Command Language (.pcl) files." +msgstr "%1 απαιτείται για αυτόματη μετατροπή αρχείων PCL σε PDF.\n\nΈγγραφα που στέλνονται στον γενικό εκτυπωτή PCL θα αποθηκεύονται ως αρχεία Printer Command Language (.pcl)." + +msgid "Don't show this message again" +msgstr "Να μην ξαναεμφανιστεί αυτό το μήνυμα" + +msgid "Don't exit" +msgstr "Παραμονή" + +msgid "Reset" +msgstr "Επαναφορά" + +msgid "Don't reset" +msgstr "Οχι επαναφορά" + +msgid "CD-ROM images" +msgstr "Εικόνες CD-ROM" + +msgid "%1 Device Configuration" +msgstr "%1 Προσαρμογή Συσκευής" + +msgid "Monitor in sleep mode" +msgstr "Οθόνη σε sleep mode" + +msgid "GLSL shaders" +msgstr "GLSL shaders" + +msgid "You are loading an unsupported configuration" +msgstr "Προσπαθείτε να φορτώσετε μη υποστηριζόμενη προσαρμογή" + +msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." +msgstr "Το φιλτράρισμα τύπου CPU βασισμένο στην επιλεγμένη μηχανή είναι απενεργοποιημένο για αυτήν την εξομειωμένη μηχανή.\n\nΑυτό δίνει την δυνατότητα να επιλέξετε CPU που δεν είναι συμβατός με την επιλεγμένη μηχανή. Παρ'όλ' αυτά υπάρχει περίτωση να έχετε ασυμβατότητες με το BIOS της μηχανής ή άλλο λογισμικό.\n\Ενεργοποιώντας αυτή την ρύθμιση η οποία δεν υποστηρίζεται επίσημα και οι οποιεσδήποτε αναφορές σφαλμάτων θα κλείνουν ως μη έκγυρες. " + +msgid "Continue" +msgstr "Συνέχεια" + +msgid "Cassette: %1" +msgstr "Κασέτα: %1" + +msgid "C&assette: %1" +msgstr "Κ&ασέτα: %1" + +msgid "Cassette images" +msgstr "Εικόνες κασέτας" + +msgid "Cartridge %1: %2" +msgstr "Cartridge %1: %2" + +msgid "Car&tridge %1: %2" +msgstr "Car&tridge %1: %2" + +msgid "Cartridge images" +msgstr "Εικόνες Cartridge" + +msgid "Resume execution" +msgstr "Συνέχεια εκτέλεσης" + +msgid "Pause execution" +msgstr "Παύση εκτέλεσης" + +msgid "Ctrl+Alt+Del" +msgstr "Ctrl+Alt+Del" + +msgid "Press Ctrl+Alt+Del" +msgstr "Πατήστε Ctrl+Alt+Del" + +msgid "Press Ctrl+Alt+Esc" +msgstr "Πατήστε Ctrl+Alt+Esc" + +msgid "Hard reset" +msgstr "Ολική επαναφορά" + +msgid "Force shutdown" +msgstr "Εξαναγκασμός τερματισμού" + +msgid "Start" +msgstr "Εκκίνηση" + +msgid "&Force shutdown" +msgstr "&Εξαναγκασμός τερματισμού" + +msgid "&Start" +msgstr "&Εκκίνηση" + +msgid "Not running" +msgstr "Δεν τρέχει" + +msgid "Running" +msgstr "Τρέχει" + +msgid "Paused" +msgstr "Σε παύση" + +msgid "Waiting" +msgstr "Αναμονή" + +msgid "Powered Off" +msgstr "Κλειστή" + +msgid "%n running" +msgstr "%n τρέχει" + +msgid "%n paused" +msgstr "%n σε παύση" + +msgid "%n waiting" +msgstr "%n σε αναμονή" + +msgid "%1 total" +msgstr "%1 σύνολο" + +msgid "VMs: %1" +msgstr "VMs: %1" + +msgid "System Directory:" +msgstr "Κατάλογος Συστήματος" + +msgid "Choose directory" +msgstr "Επιλέξτε κατάλογο" + +msgid "Choose configuration file" +msgstr "Επιλέξτε αρχείο προσαρμογής" + +msgid "86Box configuration files (86box.cfg)" +msgstr "Αρχεία προσαρμογής 86Box (86box.cfg)" + +msgid "Configuration read failed" +msgstr "Αποτυχία ανάγνωσης προσαρμογής" + +msgid "Unable to open the selected configuration file for reading: %1" +msgstr "Αδυναμία ανοίγματος επιλεγμένου αρχείου προσαρμογής για ανάγνωση: %1" + +msgid "Use regular expressions in search box" +msgstr "Χρήση συχνών εκφράσεων στην αναζήτηση" + +msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%1 μηχανής(ών)" είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" + +msgid "Add new system wizard" +msgstr "Οδηγός προσθήκης νέο συστήματος" + +msgid "Introduction" +msgstr "Παρουσίαση" + +msgid "This will help you add a new system to 86Box." +msgstr "Αυτός ο οδηγός θα σας βοηθήσει να εισάγετε νέο σύστημα στο 86Box." + +msgid "New configuration" +msgstr "Νέα προσαρμογή" + +msgid "Complete" +msgstr "Ολοκληρώθηκε" + +msgid "The wizard will now launch the configuration for the new system." +msgstr "Ο οδηγός θα εκκινήσει τώρα την προσαρμογή για το νέο σύστημα." + +msgid "Use existing configuration" +msgstr "Χρήση υπάρχουσας προσαρμογής" + +msgid "Type some notes here" +msgstr "Κρατήστε σημειώσεις εδώ" + +msgid "Paste the contents of the existing configuration file into the box below." +msgstr "Επικόλληση των περιεχομένων υπάρχον αρχείου προσαρμογής στο παρακάτω πλαίσιο." + +msgid "Load configuration from file" +msgstr "Φόρτωση προσαρμογής απο αρχείο" + +msgid "System name" +msgstr "Όνομα συστήματος" + +msgid "System name:" +msgstr "Όνομα συστήματος:" + +msgid "System name cannot contain certain characters" +msgstr "Το όνομα συστήματος δεν πρέπει να περιλαμβάνει ορισμένους χαρακτήρες" + +msgid "System name already exists" +msgstr "Το όνομα συστήματος υπάρχει ήδη" + +msgid "Please enter a directory for the system" +msgstr "Παρακαλώ ορίστε κατάλογο για το σύστημα" + +msgid "Directory does not exist" +msgstr "Ο κατάλογος δεν υπάρχει" + +msgid "A new directory for the system will be created in the selected directory above" +msgstr "Ένας νέος κατάλογος για το σύστημα θα δημιουργηθεί στον παραπάνω επιλεγμένο κατάλογο" + +msgid "System location:" +msgstr "Τοποθεσία συστήματος" + +msgid "System name and location" +msgstr "Όνομα και τοποθεσία συστήματος" + +msgid "Enter the name of the system and choose the location" +msgstr "Εισάγετε το όνομα συστήματος και επιλέξτε τοποθεσία" + +msgid "Enter the name of the system" +msgstr "Εισάγετε το όνομα συστήματος" + +msgid "Please enter a system name" +msgstr "Παρακαλώ εισάγετε ένα όνομα συστήματος" + +msgid "Display name (optional):" +msgstr "Εμφανιζόμενο όνομα (προαιρετικό):" + +msgid "Display name:" +msgstr "Εμφανιζόμενο όνομα:" + +msgid "Set display name" +msgstr "Ορισμός ονόματος εμφάνισης" + +msgid "Enter the new display name (blank to reset)" +msgstr "Εισάγετε το νέο όνομα εμφάνισης (κενό για επαναφορά)" + +msgid "Change &display name…" +msgstr "Αλλαγή &ονόματος εμφάνισης…" + +msgid "Context Menu" +msgstr "Μενού επιλογών" + +msgid "&Open folder…" +msgstr "&Άνοιγμα φακέλου…" + +msgid "Open p&rinter tray…" +msgstr "Άνοιγμα δίσκου &εκτυπωτή…" + +msgid "Set &icon…" +msgstr "Ορισμός &εικονιδίου…" + +msgid "Select an icon" +msgstr "Επιλέξτε εικονίδιο" + +msgid "C&lone…" +msgstr "&Κλωνοποίηση…" + +msgid "Virtual machine \"%1\" (%2) will be cloned into:" +msgstr "Η εικονική μηχανή \"%1\" (%2) θα κλωνοποιηθεί σε:" + +msgid "Directory %1 already exists" +msgstr "Ο κατάλογος %1 υπάρχει ήδη" + +msgid "You cannot use the following characters in the name: %1" +msgstr "Δεν μπορείτε να χρησιμοποιήσετε τους ακόλουθους χαρακτήρες στο όνομα: %1" + +msgid "Clone" +msgstr "Κλωνοποίηση" + +msgid "Failed to create directory for cloned VM" +msgstr "Αποτυχία δημιουργίας καταλόγου για την κλωνοποιημένη VM" + +msgid "Failed to clone VM." +msgstr "Αποτυχία κλωνοποίησης VM." + +msgid "Directory in use" +msgstr "Κατάλογος σε χρήση" + +msgid "The selected directory is already in use. Please select a different directory." +msgstr "Ο επιλεγμένος κατάλογος χρησιμοποείται ήδη. Παρακαλώ επιλέξτε έναν διαφορετικό κατάλογο." + +msgid "Create directory failed" +msgstr "Αποτυχία δημιουργίας καταλόγου" + +msgid "Unable to create the directory for the new system" +msgstr "Αποτυχία δημιουργίας καταλόγου για το νέο σύστημα" + +msgid "Configuration write failed" +msgstr "Αποτυχία εγγραφής προσαρμογής" + +msgid "Unable to open the configuration file at %1 for writing" +msgstr "Αδυναμία ανοίγματος αρχείου προσαρμογής στο %1 για εγγραφή" + +msgid "Error adding system" +msgstr "Σφάλμα προσθήκης συστήματος" + +msgid "Remove directory failed" +msgstr "Αποτυχία αφαίρεσης καταλόγου" + +msgid "Some files in the machine's directory were unable to be deleted. Please delete them manually." +msgstr "Ορισμένα αρχεία στον κατάλογο μηχανής ήταν αδύνατο να διαγραφούν. Παρακαλώ διαγράψτε τα χειροκίνητα." + +msgid "Build" +msgstr "Δομή" + +msgid "Version" +msgstr "Έκδοση" + +msgid "An update to 86Box is available: %1 %2" +msgstr "Μία ενημέρωση είναι διαθέσιμη για το 86Box: %1 %2" + +msgid "An error has occurred while checking for updates: %1" +msgstr "Προέκυψε σφάλμα κατά τον έλεγχο ενημερώσεων: %1" + +msgid "An update to 86Box is available!" +msgstr "Μία ενημέρωση είναι διαθέσιμη για το 86Box!" + +msgid "Warning" +msgstr "Προειδοποίση" + +msgid "&Kill" +msgstr "&Εξαναγκαστικός τέρματισμός" + +msgid "Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?" +msgstr "Ο εξαναγκαστικός τέρματισμός της εικονικής μηχανής μπορεί να επιφέρει απώλεια δεδομένων. Εκτελέστε τον μόνο αν το 86Box εχει κολλήσει.\n\nΘέλετε οποσήποτε να κάνετε εξαναγκαστικό τέρματισμό της εικονικής μηχανής \"%1\;" + +msgid "&Delete" +msgstr "&Διαγραφή" + +msgid "Do you really want to delete the virtual machine \"%1\" and all its files? This action cannot be undone!" +msgstr "Επιθυμείτε σίγουρα να διαγράψετε την εικονική μηχανή \"%1\" και όλα τα αρχεία της; Αυτή η ενέργεια είναι ανεπανόρθωτη" + +msgid "Show &config file" +msgstr "Εμφάνιση αρχείου &προσαρμογής" + +msgid "No screenshot" +msgstr "Κανένα στιγμιότυπο" + +msgid "Search" +msgstr "Αναζήτηση" + +msgid "Searching for VMs…" +msgstr "Αναζήτηση για VMs…" + +msgid "Found %1" +msgstr "Βρέθηκε %1" + +msgid "System" +msgstr "Σύστημα" + +msgid "Storage" +msgstr "Αποθηκευτικός χώρος" + +msgid "Disk %1:" +msgstr "Δισκέτα %1:" + +msgid "No disks" +msgstr "Καμία δισκέτα" + +msgid "Audio" +msgstr "Ήχος" + +msgid "Audio:" +msgstr "Ήχος:" + +msgid "ACPI shutdown" +msgstr "Τερματισμός ACPI" + +msgid "ACP&I shutdown" +msgstr "Τερματισμός ACP&I" + +msgid "Hard disk (%1)" +msgstr "Σκληρός δίσκος (%1)" + +msgid "MFM/RLL or ESDI CD-ROM drives never existed" +msgstr "Δεν υπήρξαν ποτέ οδηγοί MFM/RLL ή ESDI CD-ROM" + +msgid "Custom…" +msgstr "Προσαρμογή…" + +msgid "Custom (large)…" +msgstr "Προσαρμογή (μεγάλο)…" + +msgid "Add New Hard Disk" +msgstr "Προσθήκη Νέου Σκληρού Δίσκου" + +msgid "Add Existing Hard Disk" +msgstr "Προσθήκη Υπάρχων Σκληρού Δίσκου" + +msgid "HDI disk images cannot be larger than 4 GB." +msgstr "Οι εικόνες δίσκου HDI δεν μπορούν να είναι μεγαλύτερες απο 4 GB." + +msgid "Disk images cannot be larger than 127 GB." +msgstr "Οι εικόνες δίσκου δεν μπορούν να είναι μεγαλύτερες απο 127 GB." + +msgid "Hard disk images" +msgstr "Εικόνες σκληρού δίσκου" + +msgid "Unable to read file" +msgstr "Αδυναμία ανάγνωσης αρχείου" + +msgid "Unable to write file" +msgstr "Αδυναμία εγγραφής αρχείου" + +msgid "HDI or HDX images with a sector size other than 512 are not supported." +msgstr "Δεν υποστηρίζονται εικόνες HDI ή HDX με μέγεθος sector διαφορετικό από 512." + +msgid "Disk image file already exists" +msgstr "Το αρχείο εικόνας δίσκου υπάρχει ήδη" + +msgid "Please specify a valid file name." +msgstr "Παρακαλώ ορίστε άνα έγκυρο όνομα αρχείου." + +msgid "Disk image created" +msgstr "Η εικόνα δίσκου δημιουργήθηκε" + +msgid "Make sure the file exists and is readable." +msgstr "Βεβαιωθείτε οτι το αρχείο υπάρχει και οτι είναι αναγνώσιμο." + +msgid "Make sure the file is being saved to a writable directory." +msgstr "Βεβαιωθείτε οτι το αρχείο αποθηκεύεται σε έναν εγγράψιμο κατάλογο." + +msgid "Disk image too large" +msgstr "Η εικόνα δίσκου είναι αρκετά μεγάλη." + +msgid "Remember to partition and format the newly-created drive." +msgstr "Μην ξεχάσετε να κάνετε partition και format τον νέο-δημιουργημένο δίσκο." + +msgid "The selected file will be overwritten. Are you sure you want to use it?" +msgstr "Το επιλεγμένο αρχείο θα επανεγγραφεί. Θέλετε σίγουρα να το χρησιμοποιήσετε;" + +msgid "Unsupported disk image" +msgstr "Μη υποστηριζόμενη εικόνα δίσκου" + +msgid "Overwrite" +msgstr "Επανεγγραφή" + +msgid "Don't overwrite" +msgstr "Να μην γίνει επανεγγραφή." + +msgid "Raw image" +msgstr "Εικόνα Raw" + +msgid "HDI image" +msgstr "Εικόνα HDI" + +msgid "HDX image" +msgstr "Εικόνα HDX" + +msgid "Fixed-size VHD" +msgstr "Fixed-size VHD" + +msgid "Dynamic-size VHD" +msgstr "Dynamic-size VHD" + +msgid "Differencing VHD" +msgstr "Differencing VHD" + +msgid "(N/A)" +msgstr "(Μ/Δ)" + +msgid "Raw image (.img)" +msgstr "Εικόνα Raw (.img)" + +msgid "HDI image (.hdi)" +msgstr "Εικόνα HDI (.hdi)" + +msgid "HDX image (.hdx)" +msgstr "Εικόνα HDX (.hdx)" + +msgid "Fixed-size VHD (.vhd)" +msgstr "Fixed-size VHD (.vhd)" + +msgid "Dynamic-size VHD (.vhd)" +msgstr "Dynamic-size VHD (.vhd)" + +msgid "Differencing VHD (.vhd)" +msgstr "Differencing VHD (.vhd)" + +msgid "Large blocks (2 MB)" +msgstr "Large blocks (2 MB)" + +msgid "Small blocks (512 KB)" +msgstr "Small blocks (512 KB)" + +msgid "VHD files" +msgstr "Αρχεία VHD" + +msgid "Select the parent VHD" +msgstr "Επιλέξτε το αρχικό VHD" + +msgid "This could mean that the parent image was modified after the differencing image was created.\n\nIt can also happen if the image files were moved or copied, or by a bug in the program that created this disk.\n\nDo you want to fix the timestamps?" +msgstr "Αυτό μπορεί να σημαίνει οτι η αρχική εικόνα έχει τροποποιηθεί μετά την δημιουργία differencing image.\n\nΜπορεί επίσης να συμβεί αν τα αρχεία εικόνας έχουν μετακινηθεί ή αντιγραφεί, ή ένα bug του προγράμματος που δημιουργήθηκε αυτός ο δίσκος.\n\nΕπιθυμείτε να διορθώσετε τις χρονικές σημάνσεις;" + +msgid "Parent and child disk timestamps do not match" +msgstr "Οι χρονικές σημάνσεις αρχικού και δευτερεύον δίσκου δεν ταιριάζουν" + +msgid "Could not fix VHD timestamp." +msgstr "Αποτυχία διόρθωσης χρονικής σημάνσης VHD." + +msgid "CD-ROM %1 (%2): %3" +msgstr "CD-ROM %1 (%2): %3" + +msgid "&CD-ROM %1 (%2): %3" +msgstr "&CD-ROM %1 (%2): %3" + +msgid "160 KB" +msgstr "160 KB" + +msgid "180 KB" +msgstr "180 KB" + +msgid "320 KB" +msgstr "320 KB" + +msgid "360 KB" +msgstr "360 KB" + +msgid "640 KB" +msgstr "640 KB" + +msgid "720 KB" +msgstr "720 KB" + +msgid "1.2 MB" +msgstr "1.2 MB" + +msgid "1.25 MB" +msgstr "1.25 MB" + +msgid "1.44 MB" +msgstr "1.44 MB" + +msgid "DMF (cluster 1024)" +msgstr "DMF (cluster 1024)" + +msgid "DMF (cluster 2048)" +msgstr "DMF (cluster 2048)" + +msgid "2.88 MB" +msgstr "2.88 MB" + +msgid "ZIP 100" +msgstr "ZIP 100" + +msgid "3.5\" 128 MB (ISO 10090)" +msgstr "3.5\" 128 MB (ISO 10090)" + +msgid "3.5\" 230 MB (ISO 13963)" +msgstr "3.5\" 230 MB (ISO 13963)" + +msgid "3.5\" 540 MB (ISO 15498)" +msgstr "3.5\" 540 MB (ISO 15498)" + +msgid "3.5\" 640 MB (ISO 15498)" +msgstr "3.5\" 640 MB (ISO 15498)" + +msgid "3.5\" 1.3 GB (GigaMO)" +msgstr "3.5\" 1.3 GB (GigaMO)" + +msgid "3.5\" 2.3 GB (GigaMO 2)" +msgstr "3.5\" 2.3 GB (GigaMO 2)" + +msgid "5.25\" 600 MB" +msgstr "5.25\" 600 MB" + +msgid "5.25\" 650 MB" +msgstr "5.25\" 650 MB" + +msgid "5.25\" 1 GB" +msgstr "5.25\" 1 GB" + +msgid "5.25\" 1.3 GB" +msgstr "5.25\" 1.3 GB" + +msgid "Perfect RPM" +msgstr "Ιδανικό RPM" + +msgid "1% below perfect RPM" +msgstr "1% κάτω απο το ιδανικό RPM" + +msgid "1.5% below perfect RPM" +msgstr "1.5% κάτω απο το ιδανικό RPM" + +msgid "2% below perfect RPM" +msgstr "2% κάτω απο το ιδανικό RPM" + +msgid "(System Default)" +msgstr "(Προεπιλογή Συστήματος)" + +msgid "Failed to initialize network driver" +msgstr "Αποτυχία αρχικοποίησης οδηγού δικτύου" + +msgid "The network configuration will be switched to the null driver" +msgstr "Η παραμετροποίηση δικτύου θα αλλάξει σε άκυρο οδηγό" + +msgid "Mouse sensitivity:" +msgstr "Ευαισθησία ποντικιού" + +msgid "Select media images from program working directory" +msgstr "Επιλέξτε αρχεία πολυμέσων απο τον ενεργό κατάλογο προγράμματος" + +msgid "PIT mode:" +msgstr "PIT mode:" + +msgid "Auto" +msgstr "Αυτόματο" + +msgid "Slow" +msgstr "Αργό" + +msgid "Fast" +msgstr "Γρήγορο" + +msgid "&Auto-pause on focus loss" +msgstr "&Αυτόματο-πάγωμα σε απώλεια εστίασης" + +msgid "WinBox is no longer supported" +msgstr "" + +msgid "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behavior will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." +msgstr "" + +msgid "Generate" +msgstr "" + +msgid "Joystick configuration" +msgstr "" + +msgid "Device" +msgstr "" + +msgid "%1 (X axis)" +msgstr "" + +msgid "%1 (Y axis)" +msgstr "" + +msgid "MCA devices" +msgstr "" + +msgid "List of MCA devices:" +msgstr "" + +msgid "&Tablet tool" +msgstr "" + +msgid "About &Qt" +msgstr "" + +msgid "&MCA devices…" +msgstr "" + +msgid "Show non-&primary monitors" +msgstr "" + +msgid "Open screenshots &folder…" +msgstr "" + +msgid "Appl&y fullscreen stretch mode when maximized" +msgstr "" + +msgid "&Cursor/Puck" +msgstr "" + +msgid "&Pen" +msgstr "" + +msgid "&Host CD/DVD Drive (%1:)" +msgstr "" + +msgid "&Connected" +msgstr "" + +msgid "Clear image &history" +msgstr "" + +msgid "Create…" +msgstr "" + +msgid "Host CD/DVD Drive (%1)" +msgstr "" + +msgid "Unknown Bus" +msgstr "" + +msgid "Null Driver" +msgstr "" + +msgid "NIC:" +msgstr "" + +msgid "NIC %1 (%2) %3" +msgstr "" + +msgid "&NIC %1 (%2) %3" +msgstr "" + +msgid "Render behavior" +msgstr "" + +msgid "Use target framerate:" +msgstr "" + +msgid " fps" +msgstr "" + +msgid "VSync" +msgstr "" + +msgid "Synchronize with video" +msgstr "" + +msgid "Shaders" +msgstr "" + +msgid "Remove" +msgstr "" + +msgid "Browse…" +msgstr "" + +msgid "Couldn't create OpenGL context." +msgstr "" + +msgid "Couldn't switch to OpenGL context." +msgstr "" + +msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" +msgstr "" + +msgid "Error initializing OpenGL" +msgstr "" + +msgid "\nFalling back to software rendering." +msgstr "" + +msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" +msgstr "" + +msgid "This machine might have been moved or copied." +msgstr "" + +msgid "In order to ensure proper networking functionality, 86Box needs to know if this machine was moved or copied.\n\nSelect \"I Copied It\" if you are not sure." +msgstr "" + +msgid "I Moved It" +msgstr "" + +msgid "I Copied It" +msgstr "" + +msgid "86Box Monitor #%1" +msgstr "" + +msgid "No MCA devices." +msgstr "" + +msgid "MiB" +msgstr "" + +msgid "GiB" +msgstr "" + +msgid "Network Card #1" +msgstr "" + +msgid "Network Card #2" +msgstr "" + +msgid "Network Card #3" +msgstr "" + +msgid "Network Card #4" +msgstr "" + +msgid "Mode:" +msgstr "" + +msgid "Interface:" +msgstr "" + +msgid "Adapter:" +msgstr "" + +msgid "VDE Socket:" +msgstr "" + +msgid "TAP Bridge Device:" +msgstr "" + +msgid "86Box Unit Tester" +msgstr "" + +msgid "Novell NetWare 2.x Key Card" +msgstr "" + +msgid "Serial port passthrough 1" +msgstr "" + +msgid "Serial port passthrough 2" +msgstr "" + +msgid "Serial port passthrough 3" +msgstr "" + +msgid "Serial port passthrough 4" +msgstr "" + +msgid "Renderer &options…" +msgstr "" + +msgid "PC/XT Keyboard" +msgstr "" + +msgid "AT Keyboard" +msgstr "" + +msgid "AX Keyboard" +msgstr "" + +msgid "PS/2 Keyboard" +msgstr "" + +msgid "PS/55 Keyboard" +msgstr "" + +msgid "Keys" +msgstr "" + +msgid "Logitech/Microsoft Bus Mouse" +msgstr "" + +msgid "Microsoft Bus Mouse (InPort)" +msgstr "" + +msgid "Mouse Systems Serial Mouse" +msgstr "" + +msgid "Mouse Systems Bus Mouse" +msgstr "" + +msgid "Microsoft Serial Mouse" +msgstr "" + +msgid "Microsoft Serial BallPoint" +msgstr "" + +msgid "Logitech Serial Mouse" +msgstr "" + +msgid "PS/2 Mouse" +msgstr "" + +msgid "PS/2 QuickPort Mouse" +msgstr "" + +msgid "3M MicroTouch (Serial)" +msgstr "" + +msgid "Default Baud rate" +msgstr "" + +msgid "[COM] Standard Hayes-compliant Modem" +msgstr "" + +msgid "Roland MT-32 Emulation" +msgstr "" + +msgid "Roland MT-32 (New) Emulation" +msgstr "" + +msgid "Roland CM-32L Emulation" +msgstr "" + +msgid "Roland CM-32LN Emulation" +msgstr "" + +msgid "OPL4-ML Daughterboard" +msgstr "" + +msgid "System MIDI" +msgstr "" + +msgid "MIDI Input Device" +msgstr "" + +msgid "BIOS file" +msgstr "" + +msgid "BIOS file (ROM #1)" +msgstr "" + +msgid "BIOS file (ROM #2)" +msgstr "" + +msgid "BIOS file (ROM #3)" +msgstr "" + +msgid "BIOS file (ROM #4)" +msgstr "" + +msgid "BIOS address" +msgstr "" + +msgid "BIOS address (ROM #1)" +msgstr "" + +msgid "BIOS address (ROM #2)" +msgstr "" + +msgid "BIOS address (ROM #3)" +msgstr "" + +msgid "BIOS address (ROM #4)" +msgstr "" + +msgid "Enable BIOS extension ROM Writes" +msgstr "" + +msgid "Enable BIOS extension ROM Writes (ROM #1)" +msgstr "" + +msgid "Enable BIOS extension ROM Writes (ROM #2)" +msgstr "" + +msgid "Enable BIOS extension ROM Writes (ROM #3)" +msgstr "" + +msgid "Enable BIOS extension ROM Writes (ROM #4)" +msgstr "" + +msgid "Linear framebuffer base" +msgstr "" + +msgid "Address" +msgstr "" + +msgid "IRQ" +msgstr "" + +msgid "Serial port IRQ" +msgstr "" + +msgid "Parallel port IRQ" +msgstr "" + +msgid "Hard disk" +msgstr "Σκληρός δίσκος" + +msgid "BIOS Revision" +msgstr "" + +msgid "BIOS Version" +msgstr "" + +msgid "BIOS Language" +msgstr "" + +msgid "IBM 5161 Expansion Unit" +msgstr "" + +msgid "IBM Cassette Basic" +msgstr "" + +msgid "Translate 26 -> 17" +msgstr "" + +msgid "Language" +msgstr "" + +msgid "Enable backlight" +msgstr "" + +msgid "Invert colors" +msgstr "" + +msgid "BIOS size" +msgstr "" + +msgid "BIOS size (ROM #1)" +msgstr "" + +msgid "BIOS size (ROM #2)" +msgstr "" + +msgid "BIOS size (ROM #3)" +msgstr "" + +msgid "BIOS size (ROM #4)" +msgstr "" + +msgid "Map C0000-C7FFF as UMB" +msgstr "" + +msgid "Map C8000-CFFFF as UMB" +msgstr "" + +msgid "Map D0000-D7FFF as UMB" +msgstr "" + +msgid "Map D8000-DFFFF as UMB" +msgstr "" + +msgid "Map E0000-E7FFF as UMB" +msgstr "" + +msgid "Map E8000-EFFFF as UMB" +msgstr "" + +msgid "JS9 Jumper (JIM)" +msgstr "" + +msgid "MIDI Output Device" +msgstr "" + +msgid "MIDI Real time" +msgstr "" + +msgid "MIDI Thru" +msgstr "" + +msgid "MIDI Clockout" +msgstr "" + +msgid "Output Gain" +msgstr "" + +msgid "Chorus" +msgstr "" + +msgid "Chorus Voices" +msgstr "" + +msgid "Chorus Level" +msgstr "" + +msgid "Chorus Speed" +msgstr "" + +msgid "Chorus Depth" +msgstr "" + +msgid "Chorus Waveform" +msgstr "" + +msgid "Reverb" +msgstr "" + +msgid "Reverb Room Size" +msgstr "" + +msgid "Reverb Damping" +msgstr "" + +msgid "Reverb Width" +msgstr "" + +msgid "Reverb Level" +msgstr "" + +msgid "Interpolation Method" +msgstr "" + +msgid "Dynamic Sample Loading" +msgstr "" + +msgid "Reverb Output Gain" +msgstr "" + +msgid "Reversed stereo" +msgstr "" + +msgid "Nice ramp" +msgstr "" + +msgid "Hz" +msgstr "" + +msgid "Buttons" +msgstr "" + +msgid "Serial Port" +msgstr "" + +msgid "RTS toggle" +msgstr "" + +msgid "Revision" +msgstr "" + +msgid "Controller" +msgstr "" + +msgid "Show Crosshair" +msgstr "" + +msgid "DMA" +msgstr "" + +msgid "MAC Address" +msgstr "" + +msgid "MAC Address OUI" +msgstr "" + +msgid "Enable BIOS" +msgstr "" + +msgid "Baud Rate" +msgstr "" + +msgid "TCP/IP listening port" +msgstr "" + +msgid "Phonebook File" +msgstr "" + +msgid "Telnet emulation" +msgstr "" + +msgid "RAM Address" +msgstr "" + +msgid "RAM size" +msgstr "" + +msgid "Initial RAM size" +msgstr "" + +msgid "Serial Number" +msgstr "" + +msgid "Host ID" +msgstr "" + +msgid "FDC Address" +msgstr "" + +msgid "MPU-401 Address" +msgstr "" + +msgid "MPU-401 IRQ" +msgstr "" + +msgid "Receive MIDI input" +msgstr "" + +msgid "Low DMA" +msgstr "" + +msgid "Enable Game port" +msgstr "" + +msgid "Enable Adlib ports" +msgstr "" + +msgid "SID Model" +msgstr "" + +msgid "SID Filter Strength" +msgstr "" + +msgid "Surround module" +msgstr "" + +msgid "SB Address" +msgstr "" + +msgid "Adlib Address" +msgstr "" + +msgid "Use EEPROM setting" +msgstr "" + +msgid "WSS IRQ" +msgstr "" + +msgid "WSS DMA" +msgstr "" + +msgid "RTC IRQ" +msgstr "" + +msgid "RTC Port Address" +msgstr "" + +msgid "Onboard RTC" +msgstr "" + +msgid "Not installed" +msgstr "" + +msgid "Enable OPL" +msgstr "" + +msgid "Receive MIDI input (MPU-401)" +msgstr "" + +msgid "SB low DMA" +msgstr "" + +msgid "6CH variant (6-channel)" +msgstr "" + +msgid "Enable CMS" +msgstr "" + +msgid "Mixer" +msgstr "" + +msgid "High DMA" +msgstr "" + +msgid "Control PC speaker" +msgstr "" + +msgid "Memory size" +msgstr "" + +msgid "EMU8000 Address" +msgstr "" + +msgid "IDE Controller" +msgstr "" + +msgid "Codec" +msgstr "" + +msgid "GUS type" +msgstr "" + +msgid "Enable 0x04 \"Exit 86Box\" command" +msgstr "" + +msgid "Display type" +msgstr "" + +msgid "Composite type" +msgstr "" + +msgid "RGB type" +msgstr "" + +msgid "Line doubling type" +msgstr "" + +msgid "Snow emulation" +msgstr "" + +msgid "Monitor type" +msgstr "" + +msgid "Character set" +msgstr "" + +msgid "XGA type" +msgstr "" + +msgid "Instance" +msgstr "" + +msgid "MMIO Address" +msgstr "" + +msgid "RAMDAC type" +msgstr "" + +msgid "Blend" +msgstr "" + +msgid "Font" +msgstr "" + +msgid "Bilinear filtering" +msgstr "" + +msgid "Video chroma-keying" +msgstr "" + +msgid "Dithering" +msgstr "" + +msgid "Enable NMI for CGA emulation" +msgstr "" + +msgid "Voodoo type" +msgstr "" + +msgid "Framebuffer memory size" +msgstr "" + +msgid "Texture memory size" +msgstr "" + +msgid "Dither subtraction" +msgstr "" + +msgid "Screen Filter" +msgstr "" + +msgid "Render threads" +msgstr "" + +msgid "SLI" +msgstr "" + +msgid "Start Address" +msgstr "" + +msgid "Contiguous Size" +msgstr "" + +msgid "I/O Width" +msgstr "" + +msgid "Transfer Speed" +msgstr "" + +msgid "EMS mode" +msgstr "" + +msgid "EMS Address" +msgstr "" + +msgid "EMS 1 Address" +msgstr "" + +msgid "EMS 2 Address" +msgstr "" + +msgid "EMS Memory Size" +msgstr "" + +msgid "EMS 1 Memory Size" +msgstr "" + +msgid "EMS 2 Memory Size" +msgstr "" + +msgid "Enable EMS" +msgstr "" + +msgid "Enable EMS 1" +msgstr "" + +msgid "Enable EMS 2" +msgstr "" + +msgid "Address for > 2 MB" +msgstr "" + +msgid "Frame Address" +msgstr "" + +msgid "USA" +msgstr "" + +msgid "Danish" +msgstr "" + +msgid "Always at selected speed" +msgstr "" + +msgid "BIOS setting + Hotkeys (off during POST)" +msgstr "" + +msgid "64 KB starting from F0000" +msgstr "" + +msgid "128 KB starting from E0000 (address MSB inverted, last 64 KB first)" +msgstr "" + +msgid "Sine" +msgstr "" + +msgid "Triangle" +msgstr "" + +msgid "Linear" +msgstr "" + +msgid "4th Order" +msgstr "" + +msgid "7th Order" +msgstr "" + +msgid "Non-timed (original)" +msgstr "" + +msgid "45 Hz (JMP2 not populated)" +msgstr "" + +msgid "Two" +msgstr "" + +msgid "Three" +msgstr "" + +msgid "Wheel" +msgstr "" + +msgid "Five + Wheel" +msgstr "" + +msgid "Five + 2 Wheels" +msgstr "" + +msgid "A3 - SMT2 Serial / SMT3(R)V" +msgstr "" + +msgid "Q1 - SMT3(R) Serial" +msgstr "" + +msgid "8 KB" +msgstr "" + +msgid "32 KB" +msgstr "" + +msgid "16 KB" +msgstr "" + +msgid "64 KB" +msgstr "" + +msgid "Disable BIOS" +msgstr "" + +msgid "512 KB" +msgstr "" + +msgid "2 MB" +msgstr "" + +msgid "8 MB" +msgstr "" + +msgid "28 MB" +msgstr "" + +msgid "1 MB" +msgstr "" + +msgid "4 MB" +msgstr "" + +msgid "12 MB" +msgstr "" + +msgid "16 MB" +msgstr "" + +msgid "20 MB" +msgstr "" + +msgid "24 MB" +msgstr "" + +msgid "SigmaTel STAC9721T (stereo)" +msgstr "" + +msgid "256 KB" +msgstr "" + +msgid "Composite" +msgstr "" + +msgid "True color" +msgstr "" + +msgid "Old" +msgstr "" + +msgid "New" +msgstr "" + +msgid "Color (generic)" +msgstr "" + +msgid "Green Monochrome" +msgstr "" + +msgid "Amber Monochrome" +msgstr "" + +msgid "Gray Monochrome" +msgstr "" + +msgid "Color (no brown)" +msgstr "" + +msgid "Color (IBM 5153)" +msgstr "" + +msgid "Simple doubling" +msgstr "" + +msgid "sRGB interpolation" +msgstr "" + +msgid "Linear interpolation" +msgstr "" + +msgid "Has secondary 8x8 character set" +msgstr "" + +msgid "Has Quadcolor II daughter board" +msgstr "" + +msgid "Alternate monochrome contrast" +msgstr "" + +msgid "128 KB" +msgstr "" + +msgid "Monochrome (5151/MDA) (white)" +msgstr "" + +msgid "Monochrome (5151/MDA) (green)" +msgstr "" + +msgid "Monochrome (5151/MDA) (amber)" +msgstr "" + +msgid "Color 40x25 (5153/CGA)" +msgstr "" + +msgid "Color 80x25 (5153/CGA)" +msgstr "" + +msgid "Enhanced Color - Normal Mode (5154/ECD)" +msgstr "" + +msgid "Enhanced Color - Enhanced Mode (5154/ECD)" +msgstr "" + +msgid "Green" +msgstr "" + +msgid "Amber" +msgstr "" + +msgid "Gray" +msgstr "" + +msgid "Grayscale" +msgstr "" + +msgid "Color" +msgstr "" + +msgid "U.S. English" +msgstr "" + +msgid "Scandinavian" +msgstr "" + +msgid "Other languages" +msgstr "" + +msgid "Bochs latest" +msgstr "" + +msgid "Apply overscan deltas" +msgstr "" + +msgid "Mono Interlaced" +msgstr "" + +msgid "Mono Non-Interlaced" +msgstr "" + +msgid "Color Interlaced" +msgstr "" + +msgid "Color Non-Interlaced" +msgstr "" + +msgid "3Dfx Voodoo Graphics" +msgstr "" + +msgid "3Dfx Voodoo 2" +msgstr "" + +msgid "Obsidian SB50 + Amethyst (2 TMUs)" +msgstr "" + +msgid "8-bit" +msgstr "" + +msgid "16-bit" +msgstr "" + +msgid "Standard (150ns)" +msgstr "" + +msgid "High-Speed (120ns)" +msgstr "" + +msgid "Enabled" +msgstr "" + +msgid "Standard" +msgstr "" + +msgid "High-Speed" +msgstr "" + +msgid "Stereo LPT DAC" +msgstr "" + +msgid "Generic Text Printer" +msgstr "" + +msgid "Generic ESC/P 2 Dot-Matrix Printer" +msgstr "" + +msgid "Generic PostScript Printer" +msgstr "" + +msgid "Generic PCL5e Printer" +msgstr "" + +msgid "Parallel Line Internet Protocol" +msgstr "" + +msgid "Protection Dongle for Savage Quest" +msgstr "" + +msgid "Serial Passthrough Device" +msgstr "" + +msgid "Passthrough Mode" +msgstr "" + +msgid "Host Serial Device" +msgstr "" + +msgid "Name of pipe" +msgstr "" + +msgid "Data bits" +msgstr "" + +msgid "Stop bits" +msgstr "" + +msgid "Baud Rate of Passthrough" +msgstr "" + +msgid "Named Pipe (Server)" +msgstr "" + +msgid "Named Pipe (Client)" +msgstr "" + +msgid "Host Serial Passthrough" +msgstr "" + +msgid "E&ject %1" +msgstr "" + +msgid "&Unmute" +msgstr "" + +msgid "Softfloat FPU" +msgstr "" + +msgid "High performance impact" +msgstr "" + +msgid "[Generic] RAM Disk (max. speed)" +msgstr "" + +msgid "[Generic] 1989 (3500 RPM)" +msgstr "" + +msgid "[Generic] 1992 (3600 RPM)" +msgstr "" + +msgid "[Generic] 1994 (4500 RPM)" +msgstr "" + +msgid "[Generic] 1996 (5400 RPM)" +msgstr "" + +msgid "[Generic] 1997 (5400 RPM)" +msgstr "" + +msgid "[Generic] 1998 (5400 RPM)" +msgstr "" + +msgid "[Generic] 2000 (7200 RPM)" +msgstr "" + +msgid "IBM 8514/A clone (ISA)" +msgstr "" + +msgid "Vendor" +msgstr "" + +msgid "30 Hz (JMP2 = 1)" +msgstr "" + +msgid "60 Hz (JMP2 = 2)" +msgstr "" + +msgid "Generic PC/XT Memory Expansion" +msgstr "" + +msgid "Generic PC/AT Memory Expansion" +msgstr "" + +msgid "Unable to find Dot-Matrix fonts" +msgstr "" + +msgid "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P 2 Dot-Matrix Printer." +msgstr "" + +msgid "Inhibit multimedia keys" +msgstr "" + +msgid "Ask for confirmation before saving settings" +msgstr "" + +msgid "Ask for confirmation before hard resetting" +msgstr "" + +msgid "Ask for confirmation before quitting" +msgstr "" + +msgid "Options" +msgstr "" + +msgid "Model" +msgstr "" + +msgid "Model:" +msgstr "" + +msgid "Failed to initialize Vulkan renderer." +msgstr "" + +msgid "GLSL Error" +msgstr "" + +msgid "Could not load shader: %1" +msgstr "" + +msgid "Could not load texture: %1" +msgstr "" + +msgid "Could not compile shader:\n\n%1" +msgstr "" + +msgid "Program not linked:\n\n%1" +msgstr "" + +msgid "Shader Manager" +msgstr "" + +msgid "Shader Configuration" +msgstr "" + +msgid "Add" +msgstr "" + +msgid "Move up" +msgstr "" + +msgid "Move down" +msgstr "" + +msgid "Could not load file %1" +msgstr "" + +msgid "Key Bindings:" +msgstr "" + +msgid "Action" +msgstr "" + +msgid "Keybind" +msgstr "" + +msgid "Clear binding" +msgstr "" + +msgid "Bind" +msgstr "" + +msgid "Bind Key" +msgstr "" + +msgid "Enter key combo:" +msgstr "" + +msgid "Bind conflict" +msgstr "" + +msgid "This key combo is already in use." +msgstr "" + +msgid "Send Control+Alt+Del" +msgstr "" + +msgid "Send Control+Alt+Escape" +msgstr "" + +msgid "Toggle fullscreen" +msgstr "" + +msgid "Toggle UI in fullscreen" +msgstr "" + +msgid "Screenshot" +msgstr "" + +msgid "Release mouse pointer" +msgstr "" + +msgid "Toggle pause" +msgstr "" + +msgid "Toggle mute" +msgstr "" + +msgid "Text files" +msgstr "" + +msgid "ROM files" +msgstr "" + +msgid "SoundFont files" +msgstr "" + +msgid "Local Switch" +msgstr "" + +msgid "Remote Switch" +msgstr "" + +msgid "Switch:" +msgstr "" + +msgid "Hub Mode" +msgstr "" + +msgid "Hostname:" +msgstr "" + +msgid "ISA RAM:" +msgstr "" + +msgid "ISA ROM:" +msgstr "" + +msgid "&Wipe NVRAM" +msgstr "" + +msgid "This will delete all NVRAM (and related) files of the virtual machine located in the \"nvr\" subdirectory. You'll have to reconfigure the BIOS (and possibly other devices inside the VM) settings again if applicable.\n\nAre you sure you want to wipe all NVRAM contents of the virtual machine \"%1\"?" +msgstr "" + +msgid "Success" +msgstr "" + +msgid "Successfully wiped the NVRAM contents of the virtual machine \"%1\"" +msgstr "" + +msgid "An error occurred trying to wipe the NVRAM contents of the virtual machine \"%1\"" +msgstr "" + +msgid "%1 VM Manager" +msgstr "" + +msgid "%n disk(s)" +msgstr "" + +msgid "Unknown Status" +msgstr "" + +msgid "No Machines Found!" +msgstr "" + +msgid "Check for updates on startup" +msgstr "" + +msgid "Unable to determine release information" +msgstr "" + +msgid "There was an error checking for updates:\n\n%1\n\nPlease try again later." +msgstr "" + +msgid "Update check complete" +msgstr "" + +msgid "stable" +msgstr "" + +msgid "beta" +msgstr "" + +msgid "You are running the latest %1 version of 86Box: %2" +msgstr "" + +msgid "version" +msgstr "" + +msgid "build" +msgstr "" + +msgid "You are currently running version %1." +msgstr "" + +msgid "Version %1 is now available." +msgstr "" + +msgid "You are currently running build %1." +msgstr "" + +msgid "Build %1 is now available." +msgstr "" + +msgid "Would you like to visit the download page?" +msgstr "" + +msgid "Visit download page" +msgstr "" + +msgid "Update check" +msgstr "" + +msgid "Checking for updates…" +msgstr "" + +msgid "86Box Update" +msgstr "" + +msgid "Release notes:" +msgstr "" + +msgid "%1 Hz" +msgstr "" + +msgid "Virtual machine crash" +msgstr "" + +msgid "The virtual machine \"%1\"'s process has unexpectedly terminated with exit code %2." +msgstr "" + +msgid "The system will not be added." +msgstr "" + +msgid "&Update mouse every CPU frame" +msgstr "" + +msgid "Hue" +msgstr "" + +msgid "Saturation" +msgstr "" + +msgid "Contrast" +msgstr "" + +msgid "Brightness" +msgstr "" + +msgid "Sharpness" +msgstr "" + +msgid "&CGA composite settings…" +msgstr "" + +msgid "CGA composite settings" +msgstr "" + +msgid "Monitor EDID" +msgstr "" + +msgid "Export…" +msgstr "" + +msgid "Export EDID" +msgstr "" + +msgid "EDID file \"%ls\" is too large." +msgstr "" + +msgid "OpenGL input scale" +msgstr "" + +msgid "OpenGL input stretch mode" +msgstr "" + +msgid "Color scheme" +msgstr "" + +msgid "Light" +msgstr "" + +msgid "Dark" +msgstr "" + +msgid "Search:" +msgstr "" + +msgid "Force interpretation" +msgstr "" + +msgid "Allow recompilation" +msgstr "" + +msgid "&Force interpretation" +msgstr "" + +msgid "&Allow recompilation" +msgstr "" diff --git a/src/qt/qt_progsettings.cpp b/src/qt/qt_progsettings.cpp index 58d22c63b8e..62b63bbcc14 100644 --- a/src/qt/qt_progsettings.cpp +++ b/src/qt/qt_progsettings.cpp @@ -53,6 +53,7 @@ QVector> ProgSettings::languages = { { "hr-HR", "Croatian (Croatia)" }, { "cs-CZ", "Czech (Czech Republic)" }, { "de-DE", "German (Germany)" }, + { "el-GR", "Greek (Greece)" }, { "en-GB", "English (United Kingdom)" }, { "en-US", "English (United States)" }, { "fi-FI", "Finnish (Finland)" }, diff --git a/src/qt/qt_translations.qrc.in b/src/qt/qt_translations.qrc.in index 46541b1033a..016160b52b3 100644 --- a/src/qt/qt_translations.qrc.in +++ b/src/qt/qt_translations.qrc.in @@ -3,6 +3,7 @@ 86box_ca-ES.qm 86box_cs-CZ.qm 86box_de-DE.qm + 86box_el-GR.qm 86box_en-US.qm 86box_en-GB.qm 86box_es-ES.qm From bf02cb7daa741ba98f4cc4c94fb89b2806596667 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 2 Jan 2026 02:16:58 +0500 Subject: [PATCH 201/320] Fix technical mistakes in the Greek translation (#6660) * Quick fix * Fix errors --- src/qt/languages/el-GR.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index ccc043030cf..34774eae8ee 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -966,8 +966,8 @@ msgstr "Νέα μηχανή…" msgid "New machine" msgstr "Νέα μηχανή" -msgid "&Check for updates..." -msgstr "&Έλεγχος για ενημερώσεις..." +msgid "&Check for updates…" +msgstr "&Έλεγχος για ενημερώσεις…" msgid "Exit" msgstr "Έξοδος" @@ -1033,7 +1033,7 @@ msgid "You are loading an unsupported configuration" msgstr "Προσπαθείτε να φορτώσετε μη υποστηριζόμενη προσαρμογή" msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." -msgstr "Το φιλτράρισμα τύπου CPU βασισμένο στην επιλεγμένη μηχανή είναι απενεργοποιημένο για αυτήν την εξομειωμένη μηχανή.\n\nΑυτό δίνει την δυνατότητα να επιλέξετε CPU που δεν είναι συμβατός με την επιλεγμένη μηχανή. Παρ'όλ' αυτά υπάρχει περίτωση να έχετε ασυμβατότητες με το BIOS της μηχανής ή άλλο λογισμικό.\n\Ενεργοποιώντας αυτή την ρύθμιση η οποία δεν υποστηρίζεται επίσημα και οι οποιεσδήποτε αναφορές σφαλμάτων θα κλείνουν ως μη έκγυρες. " +msgstr "Το φιλτράρισμα τύπου CPU βασισμένο στην επιλεγμένη μηχανή είναι απενεργοποιημένο για αυτήν την εξομειωμένη μηχανή.\n\nΑυτό δίνει την δυνατότητα να επιλέξετε CPU που δεν είναι συμβατός με την επιλεγμένη μηχανή. Παρ'όλ' αυτά υπάρχει περίτωση να έχετε ασυμβατότητες με το BIOS της μηχανής ή άλλο λογισμικό.\n\nΕνεργοποιώντας αυτή την ρύθμιση η οποία δεν υποστηρίζεται επίσημα και οι οποιεσδήποτε αναφορές σφαλμάτων θα κλείνουν ως μη έκγυρες. " msgid "Continue" msgstr "Συνέχεια" @@ -1138,7 +1138,7 @@ msgid "Use regular expressions in search box" msgstr "Χρήση συχνών εκφράσεων στην αναζήτηση" msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 μηχανής(ών)" είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" +msgstr "%1 μηχανής(ών) είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" msgid "Add new system wizard" msgstr "Οδηγός προσθήκης νέο συστήματος" @@ -1306,7 +1306,7 @@ msgid "&Kill" msgstr "&Εξαναγκαστικός τέρματισμός" msgid "Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?" -msgstr "Ο εξαναγκαστικός τέρματισμός της εικονικής μηχανής μπορεί να επιφέρει απώλεια δεδομένων. Εκτελέστε τον μόνο αν το 86Box εχει κολλήσει.\n\nΘέλετε οποσήποτε να κάνετε εξαναγκαστικό τέρματισμό της εικονικής μηχανής \"%1\;" +msgstr "Ο εξαναγκαστικός τέρματισμός της εικονικής μηχανής μπορεί να επιφέρει απώλεια δεδομένων. Εκτελέστε τον μόνο αν το 86Box εχει κολλήσει.\n\nΘέλετε οποσήποτε να κάνετε εξαναγκαστικό τέρματισμό της εικονικής μηχανής \"%1\";" msgid "&Delete" msgstr "&Διαγραφή" From 78a4287eb60ece881864fb7829055cddb17dfc91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= Date: Thu, 1 Jan 2026 22:51:33 +0000 Subject: [PATCH 202/320] Translated using Weblate (Czech) Currently translated at 100.0% (999 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/cs/ --- src/qt/languages/cs-CZ.po | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index a229f505c05..2c65067ab39 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2026-01-01 20:06+0000\n" +"PO-Revision-Date: 2026-01-02 21:56+0000\n" "Last-Translator: David Hrdlička \n" "Language-Team: Czech \n" "Language: cs-CZ\n" @@ -211,13 +211,13 @@ msgid "Take s&creenshot" msgstr "Pořídit &screenshot" msgid "Take &raw screenshot" -msgstr "Pořídit &surový screenshot" +msgstr "Pořídit n&ezpracovaný screenshot" msgid "C&opy screenshot" -msgstr "Z&kopírovat screenshot" +msgstr "&Zkopírovat screenshot" msgid "Copy r&aw screenshot" -msgstr "Zkopírovat s&urový screenshot" +msgstr "Zkopírovat nez&pracovaný screenshot" msgid "S&ound" msgstr "&Zvuk" From 6a518d4f57cdcb3b769ef878bbf8425ed42a50cd Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 1 Jan 2026 22:43:00 +0000 Subject: [PATCH 203/320] Translated using Weblate (Chinese (Traditional Han script)) Currently translated at 100.0% (999 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/zh_Hant/ --- src/qt/languages/zh-TW.po | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 635ce006a05..30392d6e1b7 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -1,8 +1,15 @@ msgid "" msgstr "" +"PO-Revision-Date: 2026-01-02 21:56+0000\n" +"Last-Translator: Alexander Babikov \n" +"Language-Team: Chinese (Traditional Han script) \n" +"Language: zh-TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: zh_TW\n" "X-Source-Language: en_US\n" @@ -211,7 +218,7 @@ msgid "C&opy screenshot" msgstr "擷取螢幕畫面至剪貼簿(&O)" msgid "Copy r&aw screenshot" -msgstr " 擷取原始螢幕畫面至剪貼薄(&A)" +msgstr "擷取原始螢幕畫面至剪貼薄(&A)" msgid "S&ound" msgstr "聲音(&O)" @@ -907,7 +914,7 @@ msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 附轉接器" msgid "Thrustmaster Formula T1/T2 without adapter" -msgstr "Thrustmaster Formula T1/T2 不附轉接器 " +msgstr "Thrustmaster Formula T1/T2 不附轉接器" msgid "None" msgstr "無" From babe6184a5fb9933c954875fafe2875bb90300d3 Mon Sep 17 00:00:00 2001 From: DimMan88 Date: Fri, 2 Jan 2026 16:50:29 +0000 Subject: [PATCH 204/320] Translated using Weblate (Greek) Currently translated at 63.8% (638 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/el/ --- src/qt/languages/el-GR.po | 282 +++++++++++++++++++++----------------- 1 file changed, 157 insertions(+), 125 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 34774eae8ee..acde02c5fde 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1,8 +1,14 @@ msgid "" msgstr "" +"PO-Revision-Date: 2026-01-02 21:56+0000\n" +"Last-Translator: DimMan88 \n" +"Language-Team: Greek \n" +"Language: el-GR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=2; plural=n != 1;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: el_GR\n" "X-Source-Language: en_US\n" @@ -10,13 +16,13 @@ msgid "&Action" msgstr "&Ενέργειες" msgid "&Keyboard requires capture" -msgstr "&Keyboard requires capture" +msgstr "&Το πληκτρολόγιο απαιτεί σύνδεση" msgid "&Right CTRL is left ALT" -msgstr "&Το Right CTRL είναι left ALT" +msgstr "&Αντιστοίχιση Right CTRL σε left ALT" msgid "&Hard reset" -msgstr "&Hard reset" +msgstr "&Ολική επανεκκίνηση" msgid "&Ctrl+Alt+Del" msgstr "&Ctrl+Alt+Del" @@ -205,13 +211,13 @@ msgid "Take s&creenshot" msgstr "Λήψη σ&τιγμιότυπου" msgid "Take &raw screenshot" -msgstr "" +msgstr "Λήψη &αρχικού στιγμιότυπου" msgid "C&opy screenshot" -msgstr "" +msgstr "&Αντιγραφή στιγμιότυπου" msgid "Copy r&aw screenshot" -msgstr "" +msgstr "Αντιγραφή α&ρχικού στιγμιότυπου" msgid "S&ound" msgstr "Ή&χος" @@ -220,7 +226,7 @@ msgid "&Preferences…" msgstr "&Προτιμήσεις…" msgid "Enable &Discord integration" -msgstr "Enable &Discord integration" +msgstr "Ενεργοποίηση διασύνδεσης &Discord" msgid "Sound &gain…" msgstr "&Ενίσχυση ήχου…" @@ -358,7 +364,7 @@ msgid "FPU:" msgstr "FPU" msgid "Wait states:" -msgstr "" +msgstr "Καταστάσεις αναμονής:" msgid "MB" msgstr "MB" @@ -526,7 +532,7 @@ msgid "Parallel port 4" msgstr "Παράλληλη θύρα 4" msgid "Floppy disk controller:" -msgstr "" +msgstr "Controller δισκέτας floppy:" msgid "CD-ROM controller:" msgstr "Ελεγκτής CD-ROM:" @@ -538,7 +544,7 @@ msgid "[ISA16] Quaternary IDE Controller" msgstr "[ISA16] Τεταρτογενής Ελεγκτής IDE" msgid "Hard disk controllers" -msgstr "" +msgstr "Controllers σκληρού δίσκου" msgid "SCSI controllers" msgstr "Ελεγκτές SCSI" @@ -766,13 +772,13 @@ msgid "Disks:" msgstr "Δίσκοι:" msgid "Floppy:" -msgstr "Floppy:" +msgstr "Δισκέτες:" msgid "Controllers:" msgstr "Ελεγκτές:" msgid "Floppy & CD-ROM drives" -msgstr "Οδηγοί Floppy & CD-ROM" +msgstr "Οδηγοί Δισκέτας & CD-ROM" msgid "Other removable devices" msgstr "Άλλες αφαιρούμενες συσκευές" @@ -916,10 +922,10 @@ msgid "%1 MB (CHS: %2, %3, %4)" msgstr "%1 MB (CHS: %2, %3, %4)" msgid "Floppy %1 (%2): %3" -msgstr "Floppy %1 (%2): %3" +msgstr "Δισκέτα %1 (%2): %3" msgid "&Floppy %1 (%2): %3" -msgstr "&Floppy %1 (%2): %3" +msgstr "&Δισκέτα %1 (%2): %3" msgid "Advanced sector images" msgstr "Εικόνες προχωρημένου τομέα" @@ -928,7 +934,9 @@ msgid "Flux images" msgstr "Εικόνες Flux" msgid "Are you sure you want to hard reset the emulated machine?" -msgstr "Είστε σίγουρος οτι θέλετε να κάνετε ολική επαναφορά του εξομειωμένου σύστηματος;" +msgstr "" +"Είστε σίγουρος οτι θέλετε να κάνετε ολική επανεκκίνηση του εξομειωμένου " +"σύστηματος;" msgid "Are you sure you want to exit 86Box?" msgstr "Είστε σίγουρος για την έξοδο απο το 86Box;" @@ -979,7 +987,7 @@ msgid "Do you want to save the settings?" msgstr "Επιθυμείτε να αποθηκεύσετε τις ρυθμίσεις;" msgid "This will hard reset the emulated machine." -msgstr "Αυτό θα οδηγήσει σε ολική επαναφορά της εξομειωμένης μηχανής." +msgstr "Αυτό θα οδηγήσει σε ολική επανεκκίνηση της εξομοιωμένης μηχανής." msgid "Save" msgstr "Αποθήκευση" @@ -1048,13 +1056,13 @@ msgid "Cassette images" msgstr "Εικόνες κασέτας" msgid "Cartridge %1: %2" -msgstr "Cartridge %1: %2" +msgstr "Κασέτα δεδομένων %1: %2" msgid "Car&tridge %1: %2" msgstr "Car&tridge %1: %2" msgid "Cartridge images" -msgstr "Εικόνες Cartridge" +msgstr "Εικόνες κασέτας δεδομένων" msgid "Resume execution" msgstr "Συνέχεια εκτέλεσης" @@ -1072,7 +1080,7 @@ msgid "Press Ctrl+Alt+Esc" msgstr "Πατήστε Ctrl+Alt+Esc" msgid "Hard reset" -msgstr "Ολική επαναφορά" +msgstr "Ολική επανεκκίνηση" msgid "Force shutdown" msgstr "Εξαναγκασμός τερματισμού" @@ -1087,10 +1095,10 @@ msgid "&Start" msgstr "&Εκκίνηση" msgid "Not running" -msgstr "Δεν τρέχει" +msgstr "Ανενεργή" msgid "Running" -msgstr "Τρέχει" +msgstr "Σε λειτουργία" msgid "Paused" msgstr "Σε παύση" @@ -1138,7 +1146,7 @@ msgid "Use regular expressions in search box" msgstr "Χρήση συχνών εκφράσεων στην αναζήτηση" msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 μηχανής(ών) είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" +msgstr "%1 μηχανής(ών) είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" msgid "Add new system wizard" msgstr "Οδηγός προσθήκης νέο συστήματος" @@ -1339,7 +1347,7 @@ msgid "Disk %1:" msgstr "Δισκέτα %1:" msgid "No disks" -msgstr "Καμία δισκέτα" +msgstr "Κανένας δίσκος" msgid "Audio" msgstr "Ήχος" @@ -1600,109 +1608,122 @@ msgid "&Auto-pause on focus loss" msgstr "&Αυτόματο-πάγωμα σε απώλεια εστίασης" msgid "WinBox is no longer supported" -msgstr "" +msgstr "Το WinBox δεν υποστηρίζεται πλέον" msgid "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behavior will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." msgstr "" +"Η ανάπτυξη του WinBox σταμάτησε το 2022 λόγω έλλειψης maintainers. Καθώς " +"καταβάλλουμε κάθε δυνατή προσπάθεια για να βελτιώσουμε ακόμη περισσότερο το " +"86Box, έχουμε λάβει την απόφαση να μην υποστηρίζουμε πλέον το WinBox ως " +"διαχειριστή μηχανών.\n" +"\n" +"Δεν θα παρέχονται περαιτέρω ενημερώσεις μέσω του WinBox και ενδέχεται να " +"αντιμετωπίσετε εσφαλμένη συμπεριφορά σε περίπτωση που συνεχίσετε να το " +"χρησιμοποιείτε με νεότερες εκδόσεις του 86Box. Οποιεσδήποτε αναφορές " +"σφαλμάτων που σχετίζονται με τη συμπεριφορά του WinBox θα κλείνουν ως άκυρες." +"\n" +"\n" +"Μεταβείτε στο 86box.net για την λίστα με τους διαχειριστές μηχανών που " +"μπορείτε να χρησιμοποιήσετε." msgid "Generate" -msgstr "" +msgstr "Δημιουργία" msgid "Joystick configuration" -msgstr "" +msgstr "Ρύθμιση Joystick" msgid "Device" -msgstr "" +msgstr "Συσκευή" msgid "%1 (X axis)" -msgstr "" +msgstr "%1 (άξονας X)" msgid "%1 (Y axis)" -msgstr "" +msgstr "%1 (άξονας Y)" msgid "MCA devices" -msgstr "" +msgstr "Συσκευές MCA" msgid "List of MCA devices:" -msgstr "" +msgstr "Λίστα συσκευών MCA:" msgid "&Tablet tool" -msgstr "" +msgstr "Εργαλείο &Tablet" msgid "About &Qt" -msgstr "" +msgstr "Σχετικά με το &Qt" msgid "&MCA devices…" -msgstr "" +msgstr "Συσκευές &MCA…" msgid "Show non-&primary monitors" -msgstr "" +msgstr "Εμφάνιση μη-&κύριων οθονών" msgid "Open screenshots &folder…" -msgstr "" +msgstr "Άνοιγμα &φακέλου στιγμιότυπων…" msgid "Appl&y fullscreen stretch mode when maximized" -msgstr "" +msgstr "Εφαρμο&γή πλήρους οθόνης σε τέντωμα κατα την μεγιστοποίηση" msgid "&Cursor/Puck" -msgstr "" +msgstr "&Cursor/Puck" msgid "&Pen" -msgstr "" +msgstr "&Γραφίδα" msgid "&Host CD/DVD Drive (%1:)" -msgstr "" +msgstr "&Host CD/DVD Drive (%1:)" msgid "&Connected" -msgstr "" +msgstr "&Συνδεδεμένο" msgid "Clear image &history" -msgstr "" +msgstr "Καθαρισμός &ιστορικού εικόνων" msgid "Create…" -msgstr "" +msgstr "Δημιουργία…" msgid "Host CD/DVD Drive (%1)" -msgstr "" +msgstr "Host CD/DVD Drive (%1)" msgid "Unknown Bus" -msgstr "" +msgstr "Άγνωστο Bus" msgid "Null Driver" -msgstr "" +msgstr "Κενός Οδηγός" msgid "NIC:" -msgstr "" +msgstr "NIC:" msgid "NIC %1 (%2) %3" -msgstr "" +msgstr "NIC %1 (%2) %3" msgid "&NIC %1 (%2) %3" -msgstr "" +msgstr "&NIC %1 (%2) %3" msgid "Render behavior" -msgstr "" +msgstr "Συμπεριφορά απεικόνισης" msgid "Use target framerate:" -msgstr "" +msgstr "Χρήση στόχου καρέ:" msgid " fps" -msgstr "" +msgstr " fps" msgid "VSync" -msgstr "" +msgstr "VSync" msgid "Synchronize with video" -msgstr "" +msgstr "Συγχρονισμός με βίντεο" msgid "Shaders" -msgstr "" +msgstr "Shaders" msgid "Remove" -msgstr "" +msgstr "Κατάργηση" msgid "Browse…" -msgstr "" +msgstr "Αναζήτηση…" msgid "Couldn't create OpenGL context." msgstr "" @@ -1711,139 +1732,145 @@ msgid "Couldn't switch to OpenGL context." msgstr "" msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" -msgstr "" +msgstr "Απαιτείται έκδοση OpenGL 3.0 ή νεότερη. Η τρέχουσα έκδοση είναι %1.%2" msgid "Error initializing OpenGL" -msgstr "" +msgstr "Σφάλμα αρχικοποίησης OpenGL" msgid "\nFalling back to software rendering." msgstr "" +"\n" +"Εναλλαγή σε απεικόνιση λογισμικού." msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" msgstr "" msgid "This machine might have been moved or copied." -msgstr "" +msgstr "Αυτή η μηχανή ίσως έχει μετακινηθεί ή αντιγραφεί." msgid "In order to ensure proper networking functionality, 86Box needs to know if this machine was moved or copied.\n\nSelect \"I Copied It\" if you are not sure." msgstr "" +"Για να διασφαλιστεί η σωστή λειτουργία δικτύου, το 86Box πρέπει να γνωρίζει " +"αν αυτή η μηχανή έχει μετακινηθεί ή αντιγραφεί.\n" +"\n" +"Επιλέξτε \"Αντιγράφηκε\" εάν δεν είστε σίγουρος." msgid "I Moved It" -msgstr "" +msgstr "Μετακινήθηκε" msgid "I Copied It" -msgstr "" +msgstr "Αντιγράφηκε" msgid "86Box Monitor #%1" -msgstr "" +msgstr "Οθόνη 86Box #%1" msgid "No MCA devices." -msgstr "" +msgstr "Καμία συσκευή MCA." msgid "MiB" -msgstr "" +msgstr "MiB" msgid "GiB" -msgstr "" +msgstr "GiB" msgid "Network Card #1" -msgstr "" +msgstr "Κάρτα δικτύου #1" msgid "Network Card #2" -msgstr "" +msgstr "Κάρτα δικτύου #2" msgid "Network Card #3" -msgstr "" +msgstr "Κάρτα δικτύου #3" msgid "Network Card #4" -msgstr "" +msgstr "Κάρτα δικτύου #4" msgid "Mode:" -msgstr "" +msgstr "Τύπος:" msgid "Interface:" -msgstr "" +msgstr "Διασύνδεση:" msgid "Adapter:" -msgstr "" +msgstr "Προσαρμογέας:" msgid "VDE Socket:" -msgstr "" +msgstr "VDE Socket:" msgid "TAP Bridge Device:" -msgstr "" +msgstr "Συσκευή TAP Γέφυρας:" msgid "86Box Unit Tester" -msgstr "" +msgstr "Μονάδα δοκιμής 86Box" msgid "Novell NetWare 2.x Key Card" -msgstr "" +msgstr "Novell NetWare 2.x Key Card" msgid "Serial port passthrough 1" -msgstr "" +msgstr "Διέλευση σειριακής πόρτας 1" msgid "Serial port passthrough 2" -msgstr "" +msgstr "Διέλευση σειριακής πόρτας 2" msgid "Serial port passthrough 3" -msgstr "" +msgstr "Διέλευση σειριακής πόρτας 3" msgid "Serial port passthrough 4" -msgstr "" +msgstr "Διέλευση σειριακής πόρτας 4" msgid "Renderer &options…" -msgstr "" +msgstr "%Επιλογές απεικόνισης…" msgid "PC/XT Keyboard" -msgstr "" +msgstr "Πληκτρολόγιο PC/XT" msgid "AT Keyboard" -msgstr "" +msgstr "Πληκτρολόγιο AT" msgid "AX Keyboard" -msgstr "" +msgstr "Πληκτρολόγιο AX" msgid "PS/2 Keyboard" -msgstr "" +msgstr "Πληκτρολόγιο PS/2" msgid "PS/55 Keyboard" -msgstr "" +msgstr "Πληκτρολόγιο PS/55" msgid "Keys" -msgstr "" +msgstr "Πλήκτρα" msgid "Logitech/Microsoft Bus Mouse" -msgstr "" +msgstr "Ποντίκι διαύλου Logitech/Microsoft" msgid "Microsoft Bus Mouse (InPort)" -msgstr "" +msgstr "Ποντίκι διαύλου Microsoft (InPort)" msgid "Mouse Systems Serial Mouse" -msgstr "" +msgstr "Σειριακό ποντίκι Mouse Systems" msgid "Mouse Systems Bus Mouse" -msgstr "" +msgstr "Ποντίκι διαύλου Mouse Systems" msgid "Microsoft Serial Mouse" -msgstr "" +msgstr "Σειριακό ποντίκι Microsoft" msgid "Microsoft Serial BallPoint" -msgstr "" +msgstr "Σειριακό ποντίκι Microsoft BallPoint" msgid "Logitech Serial Mouse" -msgstr "" +msgstr "Σειριακό ποντίκι Logitech" msgid "PS/2 Mouse" -msgstr "" +msgstr "Ποντίκι PS/2" msgid "PS/2 QuickPort Mouse" -msgstr "" +msgstr "Ποντίκι PS/2 QuickPort" msgid "3M MicroTouch (Serial)" -msgstr "" +msgstr "3M MicroTouch (Σειριακό)" msgid "Default Baud rate" -msgstr "" +msgstr "Προεπιλεγμένος ρυθμός Baud" msgid "[COM] Standard Hayes-compliant Modem" msgstr "" @@ -2218,16 +2245,16 @@ msgid "Enable 0x04 \"Exit 86Box\" command" msgstr "" msgid "Display type" -msgstr "" +msgstr "Τύπος εμφάνισης" msgid "Composite type" -msgstr "" +msgstr "Τύπος Composite" msgid "RGB type" msgstr "" msgid "Line doubling type" -msgstr "" +msgstr "Τύπος line doubling" msgid "Snow emulation" msgstr "" @@ -2449,7 +2476,7 @@ msgid "256 KB" msgstr "" msgid "Composite" -msgstr "" +msgstr "Composite" msgid "True color" msgstr "" @@ -2710,7 +2737,7 @@ msgid "Ask for confirmation before saving settings" msgstr "" msgid "Ask for confirmation before hard resetting" -msgstr "" +msgstr "Ερώτηση επιβεβαίωσης πριν από την ολική επανεκκίνηση" msgid "Ask for confirmation before quitting" msgstr "" @@ -2725,7 +2752,7 @@ msgid "Model:" msgstr "" msgid "Failed to initialize Vulkan renderer." -msgstr "" +msgstr "Αποτυχία αρχικοποίησης απεικόνισης Vulkan." msgid "GLSL Error" msgstr "" @@ -2803,7 +2830,7 @@ msgid "Screenshot" msgstr "" msgid "Release mouse pointer" -msgstr "" +msgstr "Απελευθέρωση δείκτη ποντικιού" msgid "Toggle pause" msgstr "" @@ -2869,13 +2896,18 @@ msgid "No Machines Found!" msgstr "" msgid "Check for updates on startup" -msgstr "" +msgstr "Έλεγχος για ενημερώσεις κατα την εκκίνηση" msgid "Unable to determine release information" msgstr "" msgid "There was an error checking for updates:\n\n%1\n\nPlease try again later." msgstr "" +"Υπήρξε σφάλμα κατα τον έλεγχο για ενημερώσεις :\n" +"\n" +"%1\n" +"\n" +"Παρακαλώ προσπαθήστε ξανά αργότερα." msgid "Update check complete" msgstr "" @@ -2917,7 +2949,7 @@ msgid "Update check" msgstr "" msgid "Checking for updates…" -msgstr "" +msgstr "Έλεγχος για ενημερώσεις…" msgid "86Box Update" msgstr "" @@ -2938,7 +2970,7 @@ msgid "The system will not be added." msgstr "" msgid "&Update mouse every CPU frame" -msgstr "" +msgstr "&Ανανέωση ποντικιού ανα καρέ CPU" msgid "Hue" msgstr "" @@ -2956,49 +2988,49 @@ msgid "Sharpness" msgstr "" msgid "&CGA composite settings…" -msgstr "" +msgstr "Ρυθμίσεις &CGA composite…" msgid "CGA composite settings" -msgstr "" +msgstr "Ρυθμίσεις CGA composite" msgid "Monitor EDID" -msgstr "" +msgstr "Οθόνη EDID" msgid "Export…" -msgstr "" +msgstr "Εξαγωγή…" msgid "Export EDID" -msgstr "" +msgstr "Εξαγωγή EDID" msgid "EDID file \"%ls\" is too large." -msgstr "" +msgstr "Το αρχείο EDID \"%ls\" είναι πολύ μεγάλο." msgid "OpenGL input scale" -msgstr "" +msgstr "Κλίμακα OpenGL input" msgid "OpenGL input stretch mode" -msgstr "" +msgstr "OpenGL input σε τύπο τεντώματος" msgid "Color scheme" -msgstr "" +msgstr "Συνδυασμός χρωμάτων" msgid "Light" -msgstr "" +msgstr "Φωτεινό" msgid "Dark" -msgstr "" +msgstr "Σκοτεινό" msgid "Search:" -msgstr "" +msgstr "Αναζήτηση:" msgid "Force interpretation" -msgstr "" +msgstr "Εξαναγκασμός ερμηνείας" msgid "Allow recompilation" -msgstr "" +msgstr "Να επιτρέπεται ανασύνταξη" msgid "&Force interpretation" -msgstr "" +msgstr "&Εξαναγκασμός ερμηνείας" msgid "&Allow recompilation" -msgstr "" +msgstr "&Να επιτρέπεται ανασύνταξη" From 979f13e7dca0c2b264667c7b093a31bcdd039178 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 1 Jan 2026 21:19:36 +0000 Subject: [PATCH 205/320] Translated using Weblate (Greek) Currently translated at 63.8% (638 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/el/ --- src/qt/languages/el-GR.po | 37 ++++++++++++++++++++++++------------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index acde02c5fde..c9e9616777e 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1,7 +1,7 @@ msgid "" msgstr "" "PO-Revision-Date: 2026-01-02 21:56+0000\n" -"Last-Translator: DimMan88 \n" +"Last-Translator: Alexander Babikov \n" "Language-Team: Greek \n" "Language: el-GR\n" "MIME-Version: 1.0\n" @@ -340,7 +340,7 @@ msgid "Lock to this size" msgstr "Κλείδωμα σε αυτό το μέγεθος" msgid "Machine type:" -msgstr "Τύπος συστήματος" +msgstr "Τύπος συστήματος:" msgid "Machine:" msgstr "Σύστημα:" @@ -361,7 +361,7 @@ msgid "Frequency:" msgstr "Συχνότητα:" msgid "FPU:" -msgstr "FPU" +msgstr "FPU:" msgid "Wait states:" msgstr "Καταστάσεις αναμονής:" @@ -751,7 +751,7 @@ msgid "Network" msgstr "Δίκτυο" msgid "Ports (COM & LPT)" -msgstr "Θύρες (COM & LPT) " +msgstr "Θύρες (COM & LPT)" msgid "Ports" msgstr "Θύρες" @@ -942,10 +942,10 @@ msgid "Are you sure you want to exit 86Box?" msgstr "Είστε σίγουρος για την έξοδο απο το 86Box;" msgid "Unable to initialize Ghostscript" -msgstr "Αδυναμία αρχικοποίησης Ghostscript " +msgstr "Αδυναμία αρχικοποίησης Ghostscript" msgid "Unable to initialize GhostPCL" -msgstr "Αδυναμία αρχικοποίησης GhostPCL " +msgstr "Αδυναμία αρχικοποίησης GhostPCL" msgid "MO %1 (%2): %3" msgstr "MO %1 (%2): %3" @@ -1041,7 +1041,16 @@ msgid "You are loading an unsupported configuration" msgstr "Προσπαθείτε να φορτώσετε μη υποστηριζόμενη προσαρμογή" msgid "CPU type filtering based on selected machine is disabled for this emulated machine.\n\nThis makes it possible to choose a CPU that is otherwise incompatible with the selected machine. However, you may run into incompatibilities with the machine BIOS or other software.\n\nEnabling this setting is not officially supported and any bug reports filed may be closed as invalid." -msgstr "Το φιλτράρισμα τύπου CPU βασισμένο στην επιλεγμένη μηχανή είναι απενεργοποιημένο για αυτήν την εξομειωμένη μηχανή.\n\nΑυτό δίνει την δυνατότητα να επιλέξετε CPU που δεν είναι συμβατός με την επιλεγμένη μηχανή. Παρ'όλ' αυτά υπάρχει περίτωση να έχετε ασυμβατότητες με το BIOS της μηχανής ή άλλο λογισμικό.\n\nΕνεργοποιώντας αυτή την ρύθμιση η οποία δεν υποστηρίζεται επίσημα και οι οποιεσδήποτε αναφορές σφαλμάτων θα κλείνουν ως μη έκγυρες. " +msgstr "" +"Το φιλτράρισμα τύπου CPU βασισμένο στην επιλεγμένη μηχανή είναι " +"απενεργοποιημένο για αυτήν την εξομειωμένη μηχανή.\n" +"\n" +"Αυτό δίνει την δυνατότητα να επιλέξετε CPU που δεν είναι συμβατός με την " +"επιλεγμένη μηχανή. Παρ'όλ' αυτά υπάρχει περίτωση να έχετε ασυμβατότητες με " +"το BIOS της μηχανής ή άλλο λογισμικό.\n" +"\n" +"Ενεργοποιώντας αυτή την ρύθμιση η οποία δεν υποστηρίζεται επίσημα και οι " +"οποιεσδήποτε αναφορές σφαλμάτων θα κλείνουν ως μη έκγυρες." msgid "Continue" msgstr "Συνέχεια" @@ -1125,7 +1134,7 @@ msgid "VMs: %1" msgstr "VMs: %1" msgid "System Directory:" -msgstr "Κατάλογος Συστήματος" +msgstr "Κατάλογος Συστήματος:" msgid "Choose directory" msgstr "Επιλέξτε κατάλογο" @@ -1200,7 +1209,7 @@ msgid "A new directory for the system will be created in the selected directory msgstr "Ένας νέος κατάλογος για το σύστημα θα δημιουργηθεί στον παραπάνω επιλεγμένο κατάλογο" msgid "System location:" -msgstr "Τοποθεσία συστήματος" +msgstr "Τοποθεσία συστήματος:" msgid "System name and location" msgstr "Όνομα και τοποθεσία συστήματος" @@ -1320,7 +1329,9 @@ msgid "&Delete" msgstr "&Διαγραφή" msgid "Do you really want to delete the virtual machine \"%1\" and all its files? This action cannot be undone!" -msgstr "Επιθυμείτε σίγουρα να διαγράψετε την εικονική μηχανή \"%1\" και όλα τα αρχεία της; Αυτή η ενέργεια είναι ανεπανόρθωτη" +msgstr "" +"Επιθυμείτε σίγουρα να διαγράψετε την εικονική μηχανή \"%1\" και όλα τα " +"αρχεία της; Αυτή η ενέργεια είναι ανεπανόρθωτη!" msgid "Show &config file" msgstr "Εμφάνιση αρχείου &προσαρμογής" @@ -1413,7 +1424,7 @@ msgid "Make sure the file is being saved to a writable directory." msgstr "Βεβαιωθείτε οτι το αρχείο αποθηκεύεται σε έναν εγγράψιμο κατάλογο." msgid "Disk image too large" -msgstr "Η εικόνα δίσκου είναι αρκετά μεγάλη." +msgstr "Η εικόνα δίσκου είναι αρκετά μεγάλη" msgid "Remember to partition and format the newly-created drive." msgstr "Μην ξεχάσετε να κάνετε partition και format τον νέο-δημιουργημένο δίσκο." @@ -1428,7 +1439,7 @@ msgid "Overwrite" msgstr "Επανεγγραφή" msgid "Don't overwrite" -msgstr "Να μην γίνει επανεγγραφή." +msgstr "Να μην γίνει επανεγγραφή" msgid "Raw image" msgstr "Εικόνα Raw" @@ -1587,7 +1598,7 @@ msgid "The network configuration will be switched to the null driver" msgstr "Η παραμετροποίηση δικτύου θα αλλάξει σε άκυρο οδηγό" msgid "Mouse sensitivity:" -msgstr "Ευαισθησία ποντικιού" +msgstr "Ευαισθησία ποντικιού:" msgid "Select media images from program working directory" msgstr "Επιλέξτε αρχεία πολυμέσων απο τον ενεργό κατάλογο προγράμματος" From 24e164c8627a2d8870c213c2267d96418556e855 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 3 Jan 2026 20:55:13 +0600 Subject: [PATCH 206/320] 1. Fix icon state bugginess on status bar 2. Remove excessive spam on Vulkan renderer --- src/qt/qt_mediamenu.cpp | 10 +++++----- src/qt/qt_vulkanrenderer.cpp | 7 ------- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index c5611ec2ee5..1868598ae9b 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -292,7 +292,7 @@ MediaMenu::cassetteMount(const QString &filename, bool wp) pc_cas_set_fname(cassette, cassette_fname); } - ui_sb_update_icon_state(SB_CASSETTE, filename.isEmpty() ? 1 : 0); + ui_sb_update_icon_state(SB_CASSETTE, cassette->fname == nullptr); ui_sb_update_icon_wp(SB_CASSETTE, cassette_ui_writeprot); mhm.addImageToHistory(0, ui::MediaType::Cassette, previous_image.filePath(), filename); cassetteUpdateMenu(); @@ -352,7 +352,7 @@ MediaMenu::cartridgeMount(int i, const QString &filename) QByteArray filenameBytes = filename.toUtf8(); cart_load(i, filenameBytes.data()); - ui_sb_update_icon_state(SB_CARTRIDGE | i, filename.isEmpty() ? 1 : 0); + ui_sb_update_icon_state(SB_CARTRIDGE | i, cart_fns[i][0] == 0); mhm.addImageToHistory(i, ui::MediaType::Cartridge, previous_image.filePath(), filename); cartridgeUpdateMenu(i); ui_sb_update_tip(SB_CARTRIDGE | i); @@ -468,7 +468,7 @@ MediaMenu::floppyMount(int i, const QString &filename, bool wp) mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), QString(filenameBytes)); } else mhm.addImageToHistory(i, ui::MediaType::Floppy, previous_image.filePath(), filename); - ui_sb_update_icon_state(SB_FLOPPY | i, filename.isEmpty() ? 1 : 0); + ui_sb_update_icon_state(SB_FLOPPY | i, drive_empty[i]); ui_sb_update_icon_wp(SB_FLOPPY | i, ui_writeprot[i]); floppyUpdateMenu(i); ui_sb_update_tip(SB_FLOPPY | i); @@ -902,7 +902,7 @@ MediaMenu::rdiskMount(int i, const QString &filename, bool wp) } mhm.addImageToHistory(i, ui::MediaType::RDisk, rdisk_drives[i].prev_image_path, rdisk_drives[i].image_path); - ui_sb_update_icon_state(SB_RDISK | i, filename.isEmpty() ? 1 : 0); + ui_sb_update_icon_state(SB_RDISK | i, dev->drv->fp == NULL); ui_sb_update_icon_wp(SB_RDISK | i, wp); rdiskUpdateMenu(i); ui_sb_update_tip(SB_RDISK | i); @@ -1082,7 +1082,7 @@ MediaMenu::moMount(int i, const QString &filename, bool wp) } mhm.addImageToHistory(i, ui::MediaType::Mo, mo_drives[i].prev_image_path, mo_drives[i].image_path); - ui_sb_update_icon_state(SB_MO | i, filename.isEmpty() ? 1 : 0); + ui_sb_update_icon_state(SB_MO | i, dev->drv->fp == nullptr); moUpdateMenu(i); ui_sb_update_tip(SB_MO | i); diff --git a/src/qt/qt_vulkanrenderer.cpp b/src/qt/qt_vulkanrenderer.cpp index be588a8d2a0..d34757ba7c9 100644 --- a/src/qt/qt_vulkanrenderer.cpp +++ b/src/qt/qt_vulkanrenderer.cpp @@ -428,8 +428,6 @@ VulkanRenderer2::updateSamplers() void VulkanRenderer2::initResources() { - qDebug("initResources"); - VkDevice dev = m_window->device(); m_devFuncs = m_window->vulkanInstance()->deviceFunctions(dev); @@ -811,8 +809,6 @@ VulkanRenderer2::initResources() void VulkanRenderer2::initSwapChainResources() { - qDebug("initSwapChainResources"); - // Projection matrix m_proj = m_window->clipCorrectionMatrix(); // adjust for Vulkan-OpenGL clip space differences } @@ -820,14 +816,11 @@ VulkanRenderer2::initSwapChainResources() void VulkanRenderer2::releaseSwapChainResources() { - qDebug("releaseSwapChainResources"); } void VulkanRenderer2::releaseResources() { - qDebug("releaseResources"); - VkDevice dev = m_window->device(); if (m_sampler) { From ebe651761b6c02b0e0e3fb01c37a1378be860a70 Mon Sep 17 00:00:00 2001 From: Domppari Date: Sat, 3 Jan 2026 21:24:33 +0200 Subject: [PATCH 207/320] Initial HDD sound implementation using IBM example drive --- src/disk/CMakeLists.txt | 1 + src/disk/hdd.c | 6 +- src/disk/hdd_audio.c | 232 +++++++++++++++++++++++++++++++++ src/floppy/fdd_audio.c | 108 ++------------- src/include/86box/fdd_audio.h | 17 --- src/include/86box/hdd_audio.h | 6 + src/include/86box/sound.h | 4 + src/include/86box/sound_util.h | 28 ++++ src/sound/CMakeLists.txt | 1 + src/sound/audio4.c | 20 ++- src/sound/openal.c | 58 ++++++--- src/sound/sndio.c | 14 +- src/sound/sound.c | 67 ++++++++++ src/sound/sound_util.c | 85 ++++++++++++ src/sound/xaudio2.c | 19 +++ 15 files changed, 523 insertions(+), 143 deletions(-) create mode 100644 src/disk/hdd_audio.c create mode 100644 src/include/86box/hdd_audio.h create mode 100644 src/include/86box/sound_util.h create mode 100644 src/sound/sound_util.c diff --git a/src/disk/CMakeLists.txt b/src/disk/CMakeLists.txt index 9b8d72f54c6..fff17a5e421 100644 --- a/src/disk/CMakeLists.txt +++ b/src/disk/CMakeLists.txt @@ -36,6 +36,7 @@ add_library(hdd OBJECT hdc_ide_sff8038i.c hdc_ide_um8673f.c hdc_ide_w83769f.c + hdd_audio.c ) add_library(rdisk OBJECT rdisk.c) diff --git a/src/disk/hdd.c b/src/disk/hdd.c index 357c787b8e0..f6d769b9e26 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -27,6 +27,7 @@ #include <86box/hdd.h> #include <86box/cdrom.h> #include <86box/video.h> +#include <86box/hdd_audio.h> #include "cpu.h" #define HDD_OVERHEAD_TIME 50.0 @@ -38,7 +39,7 @@ hdd_init(void) { /* Clear all global data. */ memset(hdd, 0x00, sizeof(hdd)); - + hdd_audio_init(); return 0; } @@ -196,6 +197,9 @@ hdd_seek_get_time(hard_disk_t *hdd, uint32_t dst_addr, uint8_t operation, uint8_ } if (!max_seek_time || seek_time <= max_seek_time) { + if (new_cylinder != hdd->cur_cylinder) + hdd_audio_seek(hdd, new_cylinder); + hdd->cur_addr = dst_addr; hdd->cur_track = new_track; hdd->cur_cylinder = new_cylinder; diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c new file mode 100644 index 00000000000..54419c24403 --- /dev/null +++ b/src/disk/hdd_audio.c @@ -0,0 +1,232 @@ +#include +#include +#include +#include <86box/86box.h> +#include <86box/hdd.h> +#include <86box/sound.h> +#include <86box/sound_util.h> +#include <86box/thread.h> + +/* Maximum number of simultaneous seek sounds */ +#define HDD_MAX_SEEK_VOICES 8 + +typedef struct { + int active; + int position; + float volume; +} hdd_seek_voice_t; + +static int16_t *hdd_spindle_sound_buffer = NULL; +static int16_t *hdd_seek_sound_buffer = NULL; +static int hdd_samples; +static int hdd_seek_samples; + +static hdd_seek_voice_t hdd_seek_voices[HDD_MAX_SEEK_VOICES]; +static mutex_t *hdd_audio_mutex = NULL; + +void +hdd_audio_init(void) +{ + hdd_spindle_sound_buffer = sound_load_wav( + "assets/sounds/hdd/1993 IBM H3171/1993_IBM_H3171_3.5_SPINDLE_RUNNING.wav", + &hdd_samples); + + if (hdd_spindle_sound_buffer) { + pclog("HDD Audio: Loaded spindle sound, %d frames\n", hdd_samples); + } else { + pclog("HDD Audio: Failed to load spindle sound!\n"); + } + + hdd_seek_sound_buffer = sound_load_wav( + "assets/sounds/hdd/1993 IBM H3171/1993_IBM_H3171_3.5_SEEK_1TRACK.wav", + &hdd_seek_samples); + + if (hdd_seek_sound_buffer) { + pclog("HDD Audio: Loaded seek sound, %d frames (%.1f ms)\n", + hdd_seek_samples, (float)hdd_seek_samples / 48.0f); + } else { + pclog("HDD Audio: Failed to load seek sound!\n"); + } + + for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { + hdd_seek_voices[i].active = 0; + hdd_seek_voices[i].position = 0; + hdd_seek_voices[i].volume = 1.0f; + } + + hdd_audio_mutex = thread_create_mutex(); + + sound_hdd_thread_init(); +} + +void +hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder) +{ + uint32_t cylinder_diff = abs((int) hdd->cur_cylinder - (int) new_cylinder); + + if (cylinder_diff == 0) + return; + + pclog("HDD Audio Seek: cur_cyl=%u -> new_cyl=%u, diff=%u, speed_preset=%d, cyl_switch_usec=%.1f\n", + hdd->cur_cylinder, new_cylinder, cylinder_diff, hdd->speed_preset, + hdd->cyl_switch_usec); + + if (hdd->speed_preset == 0) + return; + + if (!hdd_seek_sound_buffer || hdd_seek_samples == 0) { + pclog("HDD Audio Seek: No seek sound buffer loaded!\n"); + return; + } + + int min_seek_spacing = 0; + if (hdd->cyl_switch_usec > 0) + min_seek_spacing = (int)(hdd->cyl_switch_usec * 48000.0 / 1000000.0); + + thread_wait_mutex(hdd_audio_mutex); + + for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { + if (hdd_seek_voices[i].active) { + int pos = hdd_seek_voices[i].position; + if (pos >= 0 && pos < min_seek_spacing) { + thread_release_mutex(hdd_audio_mutex); + return; + } + } + } + + int active_count = 0; + + for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { + if (!hdd_seek_voices[i].active) { + hdd_seek_voices[i].active = 1; + hdd_seek_voices[i].position = 0; + hdd_seek_voices[i].volume = 0.5f; + pclog("HDD Audio Seek: Using free voice %d\n", i); + thread_release_mutex(hdd_audio_mutex); + return; + } + active_count++; + } + + pclog("HDD Audio Seek: All %d voices active, skipping seek\n", active_count); + + thread_release_mutex(hdd_audio_mutex); +} + +void +hdd_audio_callback(int16_t *buffer, int length) +{ + static int spindle_pos = 0; + static int debug_counter = 0; + const float spindle_volume = 0.2f; + const float seek_volume = 0.5f; + int frames_in_buffer = length / 2; + + if (sound_is_float) { + float *float_buffer = (float *) buffer; + + if (hdd_spindle_sound_buffer && hdd_samples > 0) { + for (int i = 0; i < frames_in_buffer; i++) { + float left_sample = (float) hdd_spindle_sound_buffer[spindle_pos * 2] / 131072.0f * spindle_volume; + float right_sample = (float) hdd_spindle_sound_buffer[spindle_pos * 2 + 1] / 131072.0f * spindle_volume; + float_buffer[i * 2] = left_sample; + float_buffer[i * 2 + 1] = right_sample; + + spindle_pos++; + if (spindle_pos >= hdd_samples) { + spindle_pos = 0; + } + } + } else { + for (int i = 0; i < length; i++) { + float_buffer[i] = 0.0f; + } + } + + if (hdd_seek_sound_buffer && hdd_seek_samples > 0 && hdd_audio_mutex) { + thread_wait_mutex(hdd_audio_mutex); + + for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { + if (!hdd_seek_voices[v].active) + continue; + + float voice_vol = hdd_seek_voices[v].volume; + int pos = hdd_seek_voices[v].position; + if (pos < 0) pos = 0; + + for (int i = 0; i < frames_in_buffer && pos < hdd_seek_samples; i++, pos++) { + float seek_left = (float) hdd_seek_sound_buffer[pos * 2] / 131072.0f * seek_volume * voice_vol; + float seek_right = (float) hdd_seek_sound_buffer[pos * 2 + 1] / 131072.0f * seek_volume * voice_vol; + + float_buffer[i * 2] += seek_left; + float_buffer[i * 2 + 1] += seek_right; + } + + if (pos >= hdd_seek_samples) { + hdd_seek_voices[v].active = 0; + hdd_seek_voices[v].position = 0; + } else { + hdd_seek_voices[v].position = pos; + } + } + + thread_release_mutex(hdd_audio_mutex); + } + + if (debug_counter++ % 100 == 0) { + pclog("HDD Audio: float_buffer[0]=%.6f, float_buffer[1]=%.6f, spindle_pos=%d, frames=%d\n", + float_buffer[0], float_buffer[1], spindle_pos, frames_in_buffer); + } + } else { + if (hdd_spindle_sound_buffer && hdd_samples > 0) { + for (int i = 0; i < frames_in_buffer; i++) { + buffer[i * 2] = hdd_spindle_sound_buffer[spindle_pos * 2]; + buffer[i * 2 + 1] = hdd_spindle_sound_buffer[spindle_pos * 2 + 1]; + + spindle_pos++; + if (spindle_pos >= hdd_samples) { + spindle_pos = 0; + } + } + } else { + for (int i = 0; i < length; i++) { + buffer[i] = 0; + } + } + + if (hdd_seek_sound_buffer && hdd_seek_samples > 0 && hdd_audio_mutex) { + thread_wait_mutex(hdd_audio_mutex); + + for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { + if (!hdd_seek_voices[v].active) + continue; + + int pos = hdd_seek_voices[v].position; + if (pos < 0) pos = 0; + + for (int i = 0; i < frames_in_buffer && pos < hdd_seek_samples; i++, pos++) { + int32_t left = buffer[i * 2] + hdd_seek_sound_buffer[pos * 2] / 2; + int32_t right = buffer[i * 2 + 1] + hdd_seek_sound_buffer[pos * 2 + 1] / 2; + + if (left > 32767) left = 32767; + if (left < -32768) left = -32768; + if (right > 32767) right = 32767; + if (right < -32768) right = -32768; + + buffer[i * 2] = (int16_t) left; + buffer[i * 2 + 1] = (int16_t) right; + } + + if (pos >= hdd_seek_samples) { + hdd_seek_voices[v].active = 0; + hdd_seek_voices[v].position = 0; + } else { + hdd_seek_voices[v].position = pos; + } + } + + thread_release_mutex(hdd_audio_mutex); + } + } +} \ No newline at end of file diff --git a/src/floppy/fdd_audio.c b/src/floppy/fdd_audio.c index 8cbebf20913..62e1881efe0 100644 --- a/src/floppy/fdd_audio.c +++ b/src/floppy/fdd_audio.c @@ -31,6 +31,7 @@ #include <86box/plat.h> #include <86box/path.h> #include <86box/ini.h> +#include <86box/sound_util.h> #ifndef DISABLE_FDD_AUDIO @@ -53,9 +54,6 @@ static multi_seek_state_t seek_state[FDD_NUM][MAX_CONCURRENT_SEEKS] = {}; extern uint64_t motoron[FDD_NUM]; extern char exe_path[2048]; -/* Forward declaration */ -static int16_t *load_wav(const char *filename, int *sample_count); - extern uint8_t *rom; extern uint32_t biosmask; extern uint32_t biosaddr; @@ -412,7 +410,7 @@ load_profile_samples(int profile_id) if (samples->spindlemotor_start.buffer == NULL && config->spindlemotor_start.filename[0]) { strcpy(samples->spindlemotor_start.filename, config->spindlemotor_start.filename); samples->spindlemotor_start.volume = config->spindlemotor_start.volume; - samples->spindlemotor_start.buffer = load_wav(config->spindlemotor_start.filename, + samples->spindlemotor_start.buffer = sound_load_wav(config->spindlemotor_start.filename, &samples->spindlemotor_start.samples); if (samples->spindlemotor_start.buffer) { fdd_log(" Loaded spindlemotor_start: %s (%d samples, volume %.2f)\n", @@ -428,7 +426,7 @@ load_profile_samples(int profile_id) if (samples->spindlemotor_loop.buffer == NULL && config->spindlemotor_loop.filename[0]) { strcpy(samples->spindlemotor_loop.filename, config->spindlemotor_loop.filename); samples->spindlemotor_loop.volume = config->spindlemotor_loop.volume; - samples->spindlemotor_loop.buffer = load_wav(config->spindlemotor_loop.filename, + samples->spindlemotor_loop.buffer = sound_load_wav(config->spindlemotor_loop.filename, &samples->spindlemotor_loop.samples); if (samples->spindlemotor_loop.buffer) { fdd_log(" Loaded spindlemotor_loop: %s (%d samples, volume %.2f)\n", @@ -444,7 +442,7 @@ load_profile_samples(int profile_id) if (samples->spindlemotor_stop.buffer == NULL && config->spindlemotor_stop.filename[0]) { strcpy(samples->spindlemotor_stop.filename, config->spindlemotor_stop.filename); samples->spindlemotor_stop.volume = config->spindlemotor_stop.volume; - samples->spindlemotor_stop.buffer = load_wav(config->spindlemotor_stop.filename, + samples->spindlemotor_stop.buffer = sound_load_wav(config->spindlemotor_stop.filename, &samples->spindlemotor_stop.samples); if (samples->spindlemotor_stop.buffer) { fdd_log(" Loaded spindlemotor_stop: %s (%d samples, volume %.2f)\n", @@ -466,7 +464,7 @@ load_profile_samples(int profile_id) if (samples->seek_up[idx].buffer == NULL && config->seek_up[idx].filename[0]) { strcpy(samples->seek_up[idx].filename, config->seek_up[idx].filename); samples->seek_up[idx].volume = config->seek_up[idx].volume; - samples->seek_up[idx].buffer = load_wav(config->seek_up[idx].filename, + samples->seek_up[idx].buffer = sound_load_wav(config->seek_up[idx].filename, &samples->seek_up[idx].samples); if (samples->seek_up[idx].buffer) { fdd_log(" Loaded seek_up[%d]: %s (%d samples, volume %.2f)\n", @@ -479,7 +477,7 @@ load_profile_samples(int profile_id) if (samples->seek_down[idx].buffer == NULL && config->seek_down[idx].filename[0]) { strcpy(samples->seek_down[idx].filename, config->seek_down[idx].filename); samples->seek_down[idx].volume = config->seek_down[idx].volume; - samples->seek_down[idx].buffer = load_wav(config->seek_down[idx].filename, + samples->seek_down[idx].buffer = sound_load_wav(config->seek_down[idx].filename, &samples->seek_down[idx].samples); if (samples->seek_down[idx].buffer) { fdd_log(" Loaded seek_down[%d]: %s (%d samples, volume %.2f)\n", @@ -493,7 +491,7 @@ load_profile_samples(int profile_id) if (samples->post_seek_up[idx].buffer == NULL) { strcpy(samples->post_seek_up[idx].filename, config->post_seek_up[idx].filename); samples->post_seek_up[idx].volume = config->post_seek_up[idx].volume; - samples->post_seek_up[idx].buffer = load_wav(config->post_seek_up[idx].filename, + samples->post_seek_up[idx].buffer = sound_load_wav(config->post_seek_up[idx].filename, &samples->post_seek_up[idx].samples); if (samples->post_seek_up[idx].buffer) { fdd_log(" Loaded POST seek_up[%d] (%d-track): %s (%d samples, volume %.2f)\n", @@ -507,7 +505,7 @@ load_profile_samples(int profile_id) if (samples->post_seek_down[idx].buffer == NULL) { strcpy(samples->post_seek_down[idx].filename, config->post_seek_down[idx].filename); samples->post_seek_down[idx].volume = config->post_seek_down[idx].volume; - samples->post_seek_down[idx].buffer = load_wav(config->post_seek_down[idx].filename, + samples->post_seek_down[idx].buffer = sound_load_wav(config->post_seek_down[idx].filename, &samples->post_seek_down[idx].samples); if (samples->post_seek_down[idx].buffer) { fdd_log(" Loaded POST seek_down[%d] (%d-track): %s (%d samples, volume %.2f)\n", @@ -529,7 +527,7 @@ load_profile_samples(int profile_id) if (samples->bios_post_seek_up[vendor][idx].buffer == NULL) { strcpy(samples->bios_post_seek_up[vendor][idx].filename, config->bios_post_seek_up[vendor][idx].filename); samples->bios_post_seek_up[vendor][idx].volume = config->bios_post_seek_up[vendor][idx].volume; - samples->bios_post_seek_up[vendor][idx].buffer = load_wav(config->bios_post_seek_up[vendor][idx].filename, + samples->bios_post_seek_up[vendor][idx].buffer = sound_load_wav(config->bios_post_seek_up[vendor][idx].filename, &samples->bios_post_seek_up[vendor][idx].samples); if (samples->bios_post_seek_up[vendor][idx].buffer) { fdd_log(" Loaded %s POST seek_up[%d] (%d-track): %s (%d samples, volume %.2f)\n", @@ -543,7 +541,7 @@ load_profile_samples(int profile_id) if (samples->bios_post_seek_down[vendor][idx].buffer == NULL) { strcpy(samples->bios_post_seek_down[vendor][idx].filename, config->bios_post_seek_down[vendor][idx].filename); samples->bios_post_seek_down[vendor][idx].volume = config->bios_post_seek_down[vendor][idx].volume; - samples->bios_post_seek_down[vendor][idx].buffer = load_wav(config->bios_post_seek_down[vendor][idx].filename, + samples->bios_post_seek_down[vendor][idx].buffer = sound_load_wav(config->bios_post_seek_down[vendor][idx].filename, &samples->bios_post_seek_down[vendor][idx].samples); if (samples->bios_post_seek_down[vendor][idx].buffer) { fdd_log(" Loaded %s POST seek_down[%d] (%d-track): %s (%d samples, volume %.2f)\n", @@ -947,92 +945,6 @@ fdd_audio_play_multi_track_seek(int drive, int from_track, int to_track) drive, slot, sample_to_use->samples); } -static int16_t * -load_wav(const char *filename, int *sample_count) -{ - if ((filename == NULL) || (strlen(filename) == 0)) - return NULL; - - if (strstr(filename, "..") != NULL) - return NULL; - - FILE *f = asset_fopen(filename, "rb"); - if (f == NULL) { - fdd_log("FDD Audio: Failed to open WAV file: %s\n", filename); - return NULL; - } - - wav_header_t hdr; - if (fread(&hdr, sizeof(hdr), 1, f) != 1) { - fdd_log("FDD Audio: Failed to read WAV header from: %s\n", filename); - fclose(f); - return NULL; - } - - if (memcmp(hdr.riff, "RIFF", 4) || memcmp(hdr.wave, "WAVE", 4) || memcmp(hdr.fmt, "fmt ", 4) || memcmp(hdr.data, "data", 4)) { - fdd_log("FDD Audio: Invalid WAV format in file: %s\n", filename); - fclose(f); - return NULL; - } - - /* Accept both mono and stereo, 16-bit PCM */ - if (hdr.audio_format != 1 || hdr.bits_per_sample != 16 || (hdr.num_channels != 1 && hdr.num_channels != 2)) { - fdd_log("FDD Audio: Unsupported WAV format in %s (format: %d, bits: %d, channels: %d)\n", - filename, hdr.audio_format, hdr.bits_per_sample, hdr.num_channels); - fclose(f); - return NULL; - } - - int input_samples = hdr.data_size / 2; /* 2 bytes per sample */ - int16_t *input_data = malloc(hdr.data_size); - if (!input_data) { - fdd_log("FDD Audio: Failed to allocate memory for WAV data: %s\n", filename); - fclose(f); - return NULL; - } - - if (fread(input_data, 1, hdr.data_size, f) != hdr.data_size) { - fdd_log("FDD Audio: Failed to read WAV data from: %s\n", filename); - free(input_data); - fclose(f); - return NULL; - } - fclose(f); - - int16_t *output_data; - int output_samples; - - if (hdr.num_channels == 1) { - /* Convert mono to stereo */ - output_samples = input_samples; /* Number of stereo sample pairs */ - output_data = malloc(input_samples * 2 * sizeof(int16_t)); /* Allocate for stereo */ - if (!output_data) { - fdd_log("FDD Audio: Failed to allocate stereo conversion buffer for: %s\n", filename); - free(input_data); - return NULL; - } - - /* Convert mono to stereo by duplicating each sample */ - for (int i = 0; i < input_samples; i++) { - output_data[i * 2] = input_data[i]; /* Left channel */ - output_data[i * 2 + 1] = input_data[i]; /* Right channel */ - } - - free(input_data); - fdd_log("FDD Audio: Loaded %s (mono->stereo, %d samples)\n", filename, output_samples); - } else { - /* Already stereo */ - output_data = input_data; - output_samples = input_samples / 2; /* Number of stereo sample pairs */ - fdd_log("FDD Audio: Loaded %s (stereo, %d samples)\n", filename, output_samples); - } - - if (sample_count) - *sample_count = output_samples; - - return output_data; -} - void fdd_audio_callback(int16_t *buffer, int length) { diff --git a/src/include/86box/fdd_audio.h b/src/include/86box/fdd_audio.h index 433aeaff819..ac6f225be73 100644 --- a/src/include/86box/fdd_audio.h +++ b/src/include/86box/fdd_audio.h @@ -71,23 +71,6 @@ typedef enum { MOTOR_STATE_STOPPING } motor_state_t; -/* WAV header structure */ -typedef struct { - char riff[4]; - uint32_t size; - char wave[4]; - char fmt[4]; - uint32_t fmt_size; - uint16_t audio_format; - uint16_t num_channels; - uint32_t sample_rate; - uint32_t byte_rate; - uint16_t block_align; - uint16_t bits_per_sample; - char data[4]; - uint32_t data_size; -} wav_header_t; - /* Audio sample structure */ typedef struct { char filename[512]; diff --git a/src/include/86box/hdd_audio.h b/src/include/86box/hdd_audio.h new file mode 100644 index 00000000000..1e6d7b103e4 --- /dev/null +++ b/src/include/86box/hdd_audio.h @@ -0,0 +1,6 @@ +#include +#include <86box/hdd.h> + +extern void hdd_audio_init(void); +extern void hdd_audio_callback(int16_t *buffer, int length); +extern void hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder); \ No newline at end of file diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index e35969ead84..f3cbaeea1f2 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -103,6 +103,9 @@ extern void sound_cd_thread_reset(void); extern void sound_fdd_thread_init(void); extern void sound_fdd_thread_end(void); +extern void sound_hdd_thread_init(void); +extern void sound_hdd_thread_end(void); + extern void closeal(void); extern void inital(void); extern void givealbuffer(const void *buf); @@ -110,6 +113,7 @@ extern void givealbuffer_music(const void *buf); extern void givealbuffer_wt(const void *buf); extern void givealbuffer_cd(const void *buf); extern void givealbuffer_fdd(const void *buf, const uint32_t size); +extern void givealbuffer_hdd(const void *buf, const uint32_t size); #define sb_vibra16c_onboard_relocate_base sb_vibra16s_onboard_relocate_base #define sb_vibra16cl_onboard_relocate_base sb_vibra16s_onboard_relocate_base diff --git a/src/include/86box/sound_util.h b/src/include/86box/sound_util.h new file mode 100644 index 00000000000..95e95a3607a --- /dev/null +++ b/src/include/86box/sound_util.h @@ -0,0 +1,28 @@ +#ifndef SOUND_UTIL_H +#define SOUND_UTIL_H + +#include + +/* WAV file header structure */ +typedef struct wav_header_t { + char riff[4]; + uint32_t file_size; + char wave[4]; + char fmt[4]; + uint32_t fmt_size; + uint16_t audio_format; + uint16_t num_channels; + uint32_t sample_rate; + uint32_t byte_rate; + uint16_t block_align; + uint16_t bits_per_sample; + char data[4]; + uint32_t data_size; +} wav_header_t; + +/* Load a WAV file and return stereo 16-bit samples + * Returns allocated buffer (caller must free) or NULL on error + * sample_count receives the number of stereo sample pairs */ +int16_t *sound_load_wav(const char *filename, int *sample_count); + +#endif /* SOUND_UTIL_H */ \ No newline at end of file diff --git a/src/sound/CMakeLists.txt b/src/sound/CMakeLists.txt index 2c039fa9260..3f6b1ef6202 100644 --- a/src/sound/CMakeLists.txt +++ b/src/sound/CMakeLists.txt @@ -54,6 +54,7 @@ add_library(snd OBJECT snd_opl_esfm.c snd_ymf701.c snd_ymf71x.c + sound_util.c ) # TODO: Should platform-specific audio driver be here? diff --git a/src/sound/audio4.c b/src/sound/audio4.c index 060e574e6fd..25ff5b1c208 100644 --- a/src/sound/audio4.c +++ b/src/sound/audio4.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include <86box/86box.h> @@ -37,17 +37,17 @@ #define I_WT 2 #define I_CD 3 #define I_FDD 4 -#define I_MIDI 5 +#define I_HDD 5 +#define I_MIDI 6 -static int audio[6] = {-1, -1, -1, -1, -1, -1}; +static int audio[7] = {-1, -1, -1, -1, -1, -1, -1}; #ifdef USE_NEW_API -static struct audio_swpar info[5]; +static struct audio_swpar info[7]; #else -static audio_info_t info[6]; +static audio_info_t info[7]; #endif -static int freqs[6] = {SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, 0}; - +static int freqs[7] = {SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, SOUND_FREQ, 0}; void closeal(void) { @@ -173,6 +173,12 @@ givealbuffer_fdd(const void *buf, const uint32_t size) givealbuffer_common(buf, I_FDD, (int) size); } +void +givealbuffer_hdd(const void *buf, const uint32_t size) +{ + givealbuffer_common(buf, I_HDD, (int) size); +} + void givealbuffer_midi(const void *buf, const uint32_t size) { diff --git a/src/sound/openal.c b/src/sound/openal.c index d163150af1c..598709de9f6 100644 --- a/src/sound/openal.c +++ b/src/sound/openal.c @@ -40,15 +40,17 @@ #define I_WT 2 #define I_CD 3 #define I_FDD 4 -#define I_MIDI 5 +#define I_HDD 5 +#define I_MIDI 6 ALuint buffers[4]; /* front and back buffers */ ALuint buffers_music[4]; /* front and back buffers */ ALuint buffers_wt[4]; /* front and back buffers */ ALuint buffers_cd[4]; /* front and back buffers */ ALuint buffers_fdd[4]; /* front and back buffers */ +ALuint buffers_hdd[4]; /* front and back buffers */ ALuint buffers_midi[4]; /* front and back buffers */ -static ALuint source[6]; /* audio source - CHANGED FROM 5 TO 6 */ +static ALuint source[7]; /* audio sources */ static int midi_freq = 44100; static int midi_buf_size = 4410; @@ -105,9 +107,10 @@ closeal(void) alSourceStopv(sources, source); alDeleteSources(sources, source); - if (sources >= 6) + if (sources >= 7) alDeleteBuffers(4, buffers_midi); alDeleteBuffers(4, buffers_fdd); + alDeleteBuffers(4, buffers_hdd); alDeleteBuffers(4, buffers_cd); alDeleteBuffers(4, buffers_music); alDeleteBuffers(4, buffers); @@ -126,12 +129,14 @@ inital(void) float *cd_buf = NULL; float *midi_buf = NULL; float *fdd_buf = NULL; + float *hdd_buf = NULL; int16_t *buf_int16 = NULL; int16_t *music_buf_int16 = NULL; int16_t *wt_buf_int16 = NULL; int16_t *cd_buf_int16 = NULL; int16_t *midi_buf_int16 = NULL; int16_t *fdd_buf_int16 = NULL; + int16_t *hdd_buf_int16 = NULL; int init_midi = 0; @@ -146,13 +151,14 @@ inital(void) init_midi = 1; /* If the device is neither none, nor system MIDI, initialize the MIDI buffer and source, otherwise, do not. */ - sources = 5 + !!init_midi; + sources = 6 + !!init_midi; if (sound_is_float) { buf = (float *) calloc((BUFLEN << 1), sizeof(float)); music_buf = (float *) calloc((MUSICBUFLEN << 1), sizeof(float)); wt_buf = (float *) calloc((WTBUFLEN << 1), sizeof(float)); cd_buf = (float *) calloc((CD_BUFLEN << 1), sizeof(float)); fdd_buf = (float *) calloc((BUFLEN << 1), sizeof(float)); + hdd_buf = (float *) calloc((BUFLEN << 1), sizeof(float)); if (init_midi) midi_buf = (float *) calloc(midi_buf_size, sizeof(float)); } else { @@ -161,6 +167,7 @@ inital(void) wt_buf_int16 = (int16_t *) calloc((WTBUFLEN << 1), sizeof(int16_t)); cd_buf_int16 = (int16_t *) calloc((CD_BUFLEN << 1), sizeof(int16_t)); fdd_buf_int16 = (int16_t *) calloc((BUFLEN << 1), sizeof(int16_t)); + hdd_buf_int16 = (int16_t *) calloc((BUFLEN << 1), sizeof(int16_t)); if (init_midi) midi_buf_int16 = (int16_t *) calloc(midi_buf_size, sizeof(int16_t)); } @@ -168,18 +175,17 @@ inital(void) alGenBuffers(4, buffers); alGenBuffers(4, buffers_cd); alGenBuffers(4, buffers_fdd); + alGenBuffers(4, buffers_hdd); alGenBuffers(4, buffers_music); alGenBuffers(4, buffers_wt); if (init_midi) alGenBuffers(4, buffers_midi); - // Create sources: 0=main, 1=music, 2=wt, 3=cd, 4=fdd, 5=midi(optional) - alGenSources(sources, source); - + // Create sources: 0=main, 1=music, 2=wt, 3=cd, 4=fdd, 5=hdd, 6=midi(optional) if (init_midi) - alGenSources(5, source); + alGenSources(7, source); else - alGenSources(4, source); + alGenSources(6, source); alSource3f(source[I_NORMAL], AL_POSITION, 0.0f, 0.0f, 0.0f); alSource3f(source[I_NORMAL], AL_VELOCITY, 0.0f, 0.0f, 0.0f); @@ -210,7 +216,13 @@ inital(void) alSource3f(source[I_FDD], AL_DIRECTION, 0.0f, 0.0f, 0.0f); alSourcef(source[I_FDD], AL_ROLLOFF_FACTOR, 0.0f); alSourcei(source[I_FDD], AL_SOURCE_RELATIVE, AL_TRUE); - + + alSource3f(source[I_HDD], AL_POSITION, 0.0f, 0.0f, 0.0f); + alSource3f(source[I_HDD], AL_VELOCITY, 0.0f, 0.0f, 0.0f); + alSource3f(source[I_HDD], AL_DIRECTION, 0.0f, 0.0f, 0.0f); + alSourcef(source[I_HDD], AL_ROLLOFF_FACTOR, 0.0f); + alSourcei(source[I_HDD], AL_SOURCE_RELATIVE, AL_TRUE); + if (init_midi) { alSource3f(source[I_MIDI], AL_POSITION, 0.0f, 0.0f, 0.0f); alSource3f(source[I_MIDI], AL_VELOCITY, 0.0f, 0.0f, 0.0f); @@ -225,6 +237,7 @@ inital(void) memset(music_buf, 0, MUSICBUFLEN * 2 * sizeof(float)); memset(wt_buf, 0, WTBUFLEN * 2 * sizeof(float)); memset(fdd_buf, 0, BUFLEN * 2 * sizeof(float)); + memset(hdd_buf, 0, BUFLEN * 2 * sizeof(float)); if (init_midi) memset(midi_buf, 0, midi_buf_size * sizeof(float)); } else { @@ -233,6 +246,7 @@ inital(void) memset(music_buf_int16, 0, MUSICBUFLEN * 2 * sizeof(int16_t)); memset(wt_buf_int16, 0, WTBUFLEN * 2 * sizeof(int16_t)); memset(fdd_buf_int16, 0, BUFLEN * 2 * sizeof(int16_t)); + memset(hdd_buf_int16, 0, BUFLEN * 2 * sizeof(int16_t)); if (init_midi) memset(midi_buf_int16, 0, midi_buf_size * sizeof(int16_t)); } @@ -244,6 +258,7 @@ inital(void) alBufferData(buffers_wt[c], AL_FORMAT_STEREO_FLOAT32, wt_buf, WTBUFLEN * 2 * sizeof(float), WT_FREQ); alBufferData(buffers_cd[c], AL_FORMAT_STEREO_FLOAT32, cd_buf, CD_BUFLEN * 2 * sizeof(float), CD_FREQ); alBufferData(buffers_fdd[c], AL_FORMAT_STEREO_FLOAT32, fdd_buf, BUFLEN * 2 * sizeof(float), FREQ); + alBufferData(buffers_hdd[c], AL_FORMAT_STEREO_FLOAT32, hdd_buf, BUFLEN * 2 * sizeof(float), FREQ); if (init_midi) alBufferData(buffers_midi[c], AL_FORMAT_STEREO_FLOAT32, midi_buf, midi_buf_size * (int) sizeof(float), midi_freq); } else { @@ -252,6 +267,7 @@ inital(void) alBufferData(buffers_wt[c], AL_FORMAT_STEREO16, wt_buf_int16, WTBUFLEN * 2 * sizeof(int16_t), WT_FREQ); alBufferData(buffers_cd[c], AL_FORMAT_STEREO16, cd_buf_int16, CD_BUFLEN * 2 * sizeof(int16_t), CD_FREQ); alBufferData(buffers_fdd[c], AL_FORMAT_STEREO16, fdd_buf_int16, BUFLEN * 2 * sizeof(int16_t), FREQ); + alBufferData(buffers_hdd[c], AL_FORMAT_STEREO16, hdd_buf_int16, BUFLEN * 2 * sizeof(int16_t), FREQ); if (init_midi) alBufferData(buffers_midi[c], AL_FORMAT_STEREO16, midi_buf_int16, midi_buf_size * (int) sizeof(int16_t), midi_freq); } @@ -262,6 +278,7 @@ inital(void) alSourceQueueBuffers(source[I_WT], 4, buffers_wt); alSourceQueueBuffers(source[I_CD], 4, buffers_cd); alSourceQueueBuffers(source[I_FDD], 4, buffers_fdd); + alSourceQueueBuffers(source[I_HDD], 4, buffers_hdd); if (init_midi) alSourceQueueBuffers(source[I_MIDI], 4, buffers_midi); alSourcePlay(source[I_NORMAL]); @@ -269,6 +286,7 @@ inital(void) alSourcePlay(source[I_WT]); alSourcePlay(source[I_CD]); alSourcePlay(source[I_FDD]); + alSourcePlay(source[I_HDD]); if (init_midi) alSourcePlay(source[I_MIDI]); @@ -280,6 +298,7 @@ inital(void) free(music_buf); free(buf); free(fdd_buf); + free(hdd_buf); } else { if (init_midi) free(midi_buf_int16); @@ -288,6 +307,7 @@ inital(void) free(music_buf_int16); free(buf_int16); free(fdd_buf_int16); + free(hdd_buf_int16); } initialized = 1; @@ -328,35 +348,41 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in void givealbuffer(const void *buf) { - givealbuffer_common(buf, 0, BUFLEN << 1, FREQ); + givealbuffer_common(buf, I_NORMAL, BUFLEN << 1, FREQ); } void givealbuffer_music(const void *buf) { - givealbuffer_common(buf, 1, MUSICBUFLEN << 1, MUSIC_FREQ); + givealbuffer_common(buf, I_MUSIC, MUSICBUFLEN << 1, MUSIC_FREQ); } void givealbuffer_wt(const void *buf) { - givealbuffer_common(buf, 2, WTBUFLEN << 1, WT_FREQ); + givealbuffer_common(buf, I_WT, WTBUFLEN << 1, WT_FREQ); } void givealbuffer_cd(const void *buf) { - givealbuffer_common(buf, 3, CD_BUFLEN << 1, CD_FREQ); + givealbuffer_common(buf, I_CD, CD_BUFLEN << 1, CD_FREQ); } void givealbuffer_midi(const void *buf, const uint32_t size) { - givealbuffer_common(buf, 5, (int) size, midi_freq); + givealbuffer_common(buf, I_MIDI, (int) size, midi_freq); } void givealbuffer_fdd(const void *buf, const uint32_t size) { - givealbuffer_common(buf, 4, (int) size, FREQ); + givealbuffer_common(buf, I_FDD, (int) size, FREQ); +} + +void +givealbuffer_hdd(const void *buf, const uint32_t size) +{ + givealbuffer_common(buf, I_HDD, (int) size, FREQ); } \ No newline at end of file diff --git a/src/sound/sndio.c b/src/sound/sndio.c index 6363163a218..d572652ae47 100644 --- a/src/sound/sndio.c +++ b/src/sound/sndio.c @@ -30,11 +30,11 @@ #define I_CD 3 #define I_MIDI 4 #define I_FDD 5 +#define I_HDD 6 -static struct sio_hdl* audio[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; -static struct sio_par info[6]; -static int freqs[6] = { SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, 0 }; - +static struct sio_hdl* audio[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; +static struct sio_par info[7]; +static int freqs[7] = { SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, SOUND_FREQ, 0 }; void closeal(void) { @@ -153,6 +153,12 @@ givealbuffer_fdd(const void *buf, const uint32_t size) { givealbuffer_common(buf, I_FDD, (int) size); } + +void +givealbuffer_hdd(const void *buf, const uint32_t size) +{ + givealbuffer_common(buf, I_HDD, (int) size); +} void al_set_midi(const int freq, UNUSED(const int buf_size)) diff --git a/src/sound/sound.c b/src/sound/sound.c index a5a7b07ed4e..cdb3ec51c33 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -37,6 +37,7 @@ #include <86box/snd_mpu401.h> #include <86box/sound.h> #include <86box/fdd_audio.h> +#include <86box/hdd_audio.h> typedef struct { const device_t *device; @@ -96,6 +97,12 @@ static event_t *sound_fdd_start_event; static volatile int fddaudioon = 0; static int fdd_thread_enable = 0; +static thread_t *sound_hdd_thread_h; +static event_t *sound_hdd_event; +static event_t *sound_hdd_start_event; +static volatile int hddaudioon = 0; +static int hdd_thread_enable = 0; + static void (*filter_cd_audio)(int channel, double *buffer, void *priv) = NULL; static void *filter_cd_audio_p = NULL; @@ -614,6 +621,10 @@ sound_poll(UNUSED(void *priv)) if (fdd_thread_enable) { thread_set_event(sound_fdd_event); } + + if (hdd_thread_enable) { + thread_set_event(sound_hdd_event); + } sound_pos_global = 0; } } @@ -857,3 +868,59 @@ sound_fdd_thread_end(void) } } } + +static void +sound_hdd_thread(UNUSED(void *param)) +{ + thread_set_event(sound_hdd_start_event); + while (hddaudioon) { + thread_wait_event(sound_hdd_event, -1); + thread_reset_event(sound_hdd_event); + + if (!hddaudioon) + break; + + static float hdd_float_buffer[SOUNDBUFLEN * 2]; + memset(hdd_float_buffer, 0, sizeof(hdd_float_buffer)); + hdd_audio_callback((int16_t*)hdd_float_buffer, SOUNDBUFLEN * 2); + givealbuffer_hdd(hdd_float_buffer, SOUNDBUFLEN * 2); + } +} + +void +sound_hdd_thread_init(void) +{ + if (!hddaudioon) { + hddaudioon = 1; + hdd_thread_enable = 1; + sound_hdd_start_event = thread_create_event(); + sound_hdd_event = thread_create_event(); + sound_hdd_thread_h = thread_create(sound_hdd_thread, NULL); + + thread_wait_event(sound_hdd_start_event, -1); + thread_reset_event(sound_hdd_start_event); + } +} + +void +sound_hdd_thread_end(void) +{ + if (hddaudioon) { + hddaudioon = 0; + hdd_thread_enable = 0; + thread_set_event(sound_hdd_event); + thread_wait(sound_hdd_thread_h); + + if (sound_hdd_event) { + thread_destroy_event(sound_hdd_event); + sound_hdd_event = NULL; + } + + sound_hdd_thread_h = NULL; + if (sound_hdd_start_event) { + thread_destroy_event(sound_hdd_start_event); + sound_hdd_start_event = NULL; + } + } +} + diff --git a/src/sound/sound_util.c b/src/sound/sound_util.c new file mode 100644 index 00000000000..d6d3e74953f --- /dev/null +++ b/src/sound/sound_util.c @@ -0,0 +1,85 @@ +#include +#include +#include +#include + +#include <86box/86box.h> +#include <86box/mem.h> +#include <86box/rom.h> +#include <86box/plat.h> +#include <86box/sound_util.h> + +int16_t * +sound_load_wav(const char *filename, int *sample_count) +{ + if ((filename == NULL) || (strlen(filename) == 0)) + return NULL; + + if (strstr(filename, "..") != NULL) + return NULL; + + FILE *f = asset_fopen(filename, "rb"); + if (f == NULL) + return NULL; + + wav_header_t hdr; + if (fread(&hdr, sizeof(hdr), 1, f) != 1) { + fclose(f); + return NULL; + } + + if (memcmp(hdr.riff, "RIFF", 4) || memcmp(hdr.wave, "WAVE", 4) || + memcmp(hdr.fmt, "fmt ", 4) || memcmp(hdr.data, "data", 4)) { + fclose(f); + return NULL; + } + + /* Accept both mono and stereo, 16-bit PCM */ + if (hdr.audio_format != 1 || hdr.bits_per_sample != 16 || + (hdr.num_channels != 1 && hdr.num_channels != 2)) { + fclose(f); + return NULL; + } + + int input_samples = hdr.data_size / 2; + int16_t *input_data = malloc(hdr.data_size); + if (!input_data) { + fclose(f); + return NULL; + } + + if (fread(input_data, 1, hdr.data_size, f) != hdr.data_size) { + free(input_data); + fclose(f); + return NULL; + } + fclose(f); + + int16_t *output_data; + int output_samples; + + if (hdr.num_channels == 1) { + /* Convert mono to stereo */ + output_samples = input_samples; + output_data = malloc(input_samples * 2 * sizeof(int16_t)); + if (!output_data) { + free(input_data); + return NULL; + } + + for (int i = 0; i < input_samples; i++) { + output_data[i * 2] = input_data[i]; + output_data[i * 2 + 1] = input_data[i]; + } + + free(input_data); + } else { + output_data = input_data; + output_samples = input_samples / 2; + } + + if (sample_count) + *sample_count = output_samples; + + return output_data; +} \ No newline at end of file diff --git a/src/sound/xaudio2.c b/src/sound/xaudio2.c index 8596c2a4943..7833af435b1 100644 --- a/src/sound/xaudio2.c +++ b/src/sound/xaudio2.c @@ -54,6 +54,7 @@ static IXAudio2SourceVoice *srcvoicewt = NULL; static IXAudio2SourceVoice *srcvoicemidi = NULL; static IXAudio2SourceVoice *srcvoicecd = NULL; static IXAudio2SourceVoice *srcvoicefdd = NULL; +static IXAudio2SourceVoice *srcvoicehdd = NULL; #define FREQ SOUND_FREQ #define BUFLEN SOUNDBUFLEN @@ -184,6 +185,7 @@ inital(void) fmt.nAvgBytesPerSec = fmt.nSamplesPerSec * fmt.nBlockAlign; (void) IXAudio2_CreateSourceVoice(xaudio2, &srcvoicefdd, &fmt, 0, 2.0f, &callbacks, NULL, NULL); + (void) IXAudio2_CreateSourceVoice(xaudio2, &srcvoicehdd, &fmt, 0, 2.0f, &callbacks, NULL, NULL); (void) IXAudio2SourceVoice_SetVolume(srcvoice, 1, XAUDIO2_COMMIT_NOW); (void) IXAudio2SourceVoice_Start(srcvoice, 0, XAUDIO2_COMMIT_NOW); @@ -191,6 +193,7 @@ inital(void) (void) IXAudio2SourceVoice_Start(srcvoicemusic, 0, XAUDIO2_COMMIT_NOW); (void) IXAudio2SourceVoice_Start(srcvoicewt, 0, XAUDIO2_COMMIT_NOW); (void) IXAudio2SourceVoice_Start(srcvoicefdd, 0, XAUDIO2_COMMIT_NOW); + (void) IXAudio2SourceVoice_Start(srcvoicehdd, 0, XAUDIO2_COMMIT_NOW); const char *mdn = midi_out_device_get_internal_name(midi_output_device_current); @@ -223,6 +226,8 @@ closeal(void) (void) IXAudio2SourceVoice_FlushSourceBuffers(srcvoicecd); (void) IXAudio2SourceVoice_Stop(srcvoicefdd, 0, XAUDIO2_COMMIT_NOW); (void) IXAudio2SourceVoice_FlushSourceBuffers(srcvoicefdd); + (void) IXAudio2SourceVoice_Stop(srcvoicehdd, 0, XAUDIO2_COMMIT_NOW); + (void) IXAudio2SourceVoice_FlushSourceBuffers(srcvoicehdd); if (srcvoicemidi) { (void) IXAudio2SourceVoice_Stop(srcvoicemidi, 0, XAUDIO2_COMMIT_NOW); (void) IXAudio2SourceVoice_FlushSourceBuffers(srcvoicemidi); @@ -231,6 +236,7 @@ closeal(void) IXAudio2SourceVoice_DestroyVoice(srcvoicewt); IXAudio2SourceVoice_DestroyVoice(srcvoicecd); IXAudio2SourceVoice_DestroyVoice(srcvoicefdd); + IXAudio2SourceVoice_DestroyVoice(srcvoicehdd); IXAudio2SourceVoice_DestroyVoice(srcvoicemusic); IXAudio2SourceVoice_DestroyVoice(srcvoice); IXAudio2MasteringVoice_DestroyVoice(mastervoice); @@ -239,6 +245,7 @@ closeal(void) srcvoicecd = NULL; srcvoicemidi = NULL; srcvoicefdd = NULL; + srcvoicehdd = NULL; mastervoice = NULL; xaudio2 = NULL; @@ -312,6 +319,18 @@ givealbuffer_fdd(const void *buf, const uint32_t size) givealbuffer_common(buf, srcvoicefdd, size); } +void +givealbuffer_hdd(const void *buf, const uint32_t size) +{ + if (!initialized) + return; + + if (!srcvoicefdd) + return; + + givealbuffer_common(buf, srcvoicehdd, size); +} + void al_set_midi(const int freq, const int buf_size) { From b13e4c44b44ddb952b79d16b87d1625d138cc7e0 Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 4 Jan 2026 08:59:43 +0200 Subject: [PATCH 208/320] HDD audio profile for settings, ui and using the selected profile --- src/86box.c | 6 + src/config.c | 19 ++ src/disk/hdd.c | 1 - src/disk/hdd_audio.c | 453 +++++++++++++++++++++++++++----- src/include/86box/hdd.h | 1 + src/include/86box/hdd_audio.h | 59 ++++- src/qt/qt_settingsharddisks.cpp | 47 +++- src/qt/qt_settingsharddisks.hpp | 1 + src/qt/qt_settingsharddisks.ui | 14 + 9 files changed, 532 insertions(+), 69 deletions(-) diff --git a/src/86box.c b/src/86box.c index b2311f0e23a..3d935646278 100644 --- a/src/86box.c +++ b/src/86box.c @@ -83,6 +83,7 @@ #include <86box/fdc.h> #include <86box/fdc_ext.h> #include <86box/hdd.h> +#include <86box/hdd_audio.h> #include <86box/hdc.h> #include <86box/hdc_ide.h> #include <86box/scsi.h> @@ -1476,6 +1477,8 @@ pc_init_modules(void) fdd_audio_load_profiles(); fdd_audio_init(); } + + hdd_audio_init(); sound_init(); @@ -1719,6 +1722,9 @@ pc_reset_hard_init(void) fdd_reset(); + /* Reset HDD audio to pick up any profile changes */ + hdd_audio_reset(); + /* Reset and reconfigure the SCSI layer. */ scsi_card_init(); diff --git a/src/config.c b/src/config.c index d5deded9dc7..6f8d1d6e6dc 100644 --- a/src/config.c +++ b/src/config.c @@ -51,6 +51,7 @@ #include <86box/lpt.h> #include <86box/serial.h> #include <86box/hdd.h> +#include <86box/hdd_audio.h> #include <86box/hdc.h> #include <86box/hdc_ide.h> #include <86box/fdd.h> @@ -1247,6 +1248,8 @@ load_hard_disks(void) uint32_t board = 0; uint32_t dev = 0; + hdd_audio_load_profiles(); + memset(temp, '\0', sizeof(temp)); for (uint8_t c = 0; c < HDD_NUM; c++) { sprintf(temp, "hdd_%02i_parameters", c + 1); @@ -1315,6 +1318,11 @@ load_hard_disks(void) p = ini_section_get_string(cat, temp, tmp2); hdd[c].speed_preset = hdd_preset_get_from_internal_name(p); + /* Audio Profile */ + sprintf(temp, "hdd_%02i_audio", c + 1); + p = ini_section_get_string(cat, temp, "none"); + hdd[c].audio_profile = hdd_audio_get_profile_by_internal_name(p); + /* MFM/RLL */ sprintf(temp, "hdd_%02i_mfm_channel", c + 1); if (hdd[c].bus_type == HDD_BUS_MFM) @@ -3458,6 +3466,17 @@ save_hard_disks(void) ini_section_delete_var(cat, temp); else ini_section_set_string(cat, temp, hdd_preset_get_internal_name(hdd[c].speed_preset)); + + sprintf(temp, "hdd_%02i_audio", c + 1); + if (!hdd_is_valid(c) || hdd[c].audio_profile == 0) { + ini_section_delete_var(cat, temp); + } else { + const char *internal_name = hdd_audio_get_profile_internal_name(hdd[c].audio_profile); + if (internal_name && strcmp(internal_name, "none") != 0) + ini_section_set_string(cat, temp, internal_name); + else + ini_section_delete_var(cat, temp); + } } ini_delete_section_if_empty(config, cat); diff --git a/src/disk/hdd.c b/src/disk/hdd.c index f6d769b9e26..cd34b66fa4d 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -39,7 +39,6 @@ hdd_init(void) { /* Clear all global data. */ memset(hdd, 0x00, sizeof(hdd)); - hdd_audio_init(); return 0; } diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index 54419c24403..bc3f9ed95d1 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -1,11 +1,33 @@ -#include +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Hard disk audio emulation. + * + * Authors: Toni Riikonen, + * + * Copyright 2026 Toni Riikonen. + */ + + #include #include #include +#include #include <86box/86box.h> #include <86box/hdd.h> +#include <86box/hdd_audio.h> #include <86box/sound.h> #include <86box/sound_util.h> #include <86box/thread.h> +#include <86box/plat.h> +#include <86box/path.h> +#include <86box/ini.h> +#include <86box/mem.h> +#include <86box/rom.h> /* Maximum number of simultaneous seek sounds */ #define HDD_MAX_SEEK_VOICES 8 @@ -16,36 +38,277 @@ typedef struct { float volume; } hdd_seek_voice_t; -static int16_t *hdd_spindle_sound_buffer = NULL; -static int16_t *hdd_seek_sound_buffer = NULL; -static int hdd_samples; -static int hdd_seek_samples; +/* Audio samples structure for a profile */ +typedef struct { + int16_t *spindle_start_buffer; + int spindle_start_samples; + int16_t *spindle_loop_buffer; + int spindle_loop_samples; + int16_t *spindle_stop_buffer; + int spindle_stop_samples; + int16_t *seek_buffer; + int seek_samples; + float spindle_volume; + float seek_volume; + int loaded; +} hdd_audio_samples_t; + +/* Global audio profile configurations */ +static hdd_audio_profile_config_t audio_profiles[HDD_AUDIO_PROFILE_MAX]; +static int audio_profile_count = 0; + +/* Per-profile loaded samples */ +static hdd_audio_samples_t profile_samples[HDD_AUDIO_PROFILE_MAX]; + +/* Active profile for audio playback (first HDD with valid profile) */ +static int active_audio_profile = 0; static hdd_seek_voice_t hdd_seek_voices[HDD_MAX_SEEK_VOICES]; static mutex_t *hdd_audio_mutex = NULL; +/* Load audio profiles from configuration file */ void -hdd_audio_init(void) +hdd_audio_load_profiles(void) { - hdd_spindle_sound_buffer = sound_load_wav( - "assets/sounds/hdd/1993 IBM H3171/1993_IBM_H3171_3.5_SPINDLE_RUNNING.wav", - &hdd_samples); + ini_t profiles_ini; + char cfg_fn[1024] = { 0 }; - if (hdd_spindle_sound_buffer) { - pclog("HDD Audio: Loaded spindle sound, %d frames\n", hdd_samples); - } else { - pclog("HDD Audio: Failed to load spindle sound!\n"); + int ret = asset_getfile("assets/sounds/hdd/hdd_audio_profiles.cfg", cfg_fn, 1024); + if (!ret) { + pclog("HDD Audio: Could not find hdd_audio_profiles.cfg\n"); + return; } - hdd_seek_sound_buffer = sound_load_wav( - "assets/sounds/hdd/1993 IBM H3171/1993_IBM_H3171_3.5_SEEK_1TRACK.wav", - &hdd_seek_samples); + profiles_ini = ini_read_ex(cfg_fn, 1); + if (profiles_ini == NULL) { + pclog("HDD Audio: Failed to load hdd_audio_profiles.cfg\n"); + return; + } - if (hdd_seek_sound_buffer) { - pclog("HDD Audio: Loaded seek sound, %d frames (%.1f ms)\n", - hdd_seek_samples, (float)hdd_seek_samples / 48.0f); - } else { - pclog("HDD Audio: Failed to load seek sound!\n"); + audio_profile_count = 0; + + /* Load profiles by trying known profile section names */ + for (int i = 0; i < HDD_AUDIO_PROFILE_MAX && audio_profile_count < HDD_AUDIO_PROFILE_MAX; i++) { + char section_name[64]; + sprintf(section_name, "Profile \"%d\"", i); + + ini_section_t cat = ini_find_section(profiles_ini, section_name); + if (cat == NULL) + continue; + + hdd_audio_profile_config_t *config = &audio_profiles[audio_profile_count]; + memset(config, 0, sizeof(hdd_audio_profile_config_t)); + + config->id = ini_section_get_int(cat, "id", i); + + const char *name = ini_section_get_string(cat, "name", "Unknown"); + strncpy(config->name, name, sizeof(config->name) - 1); + + const char *internal_name = ini_section_get_string(cat, "internal_name", "unknown"); + strncpy(config->internal_name, internal_name, sizeof(config->internal_name) - 1); + + /* Load spindle motor sample files */ + const char *file = ini_section_get_string(cat, "spindlemotor_start_file", ""); + strncpy(config->spindlemotor_start.filename, file, sizeof(config->spindlemotor_start.filename) - 1); + config->spindlemotor_start.volume = (float) ini_section_get_double(cat, "spindlemotor_start_volume", 1.0); + + file = ini_section_get_string(cat, "spindlemotor_loop_file", ""); + strncpy(config->spindlemotor_loop.filename, file, sizeof(config->spindlemotor_loop.filename) - 1); + config->spindlemotor_loop.volume = (float) ini_section_get_double(cat, "spindlemotor_loop_volume", 1.0); + + file = ini_section_get_string(cat, "spindlemotor_stop_file", ""); + strncpy(config->spindlemotor_stop.filename, file, sizeof(config->spindlemotor_stop.filename) - 1); + config->spindlemotor_stop.volume = (float) ini_section_get_double(cat, "spindlemotor_stop_volume", 1.0); + + /* Load seek sample file */ + file = ini_section_get_string(cat, "seek_track_file", ""); + strncpy(config->seek_track.filename, file, sizeof(config->seek_track.filename) - 1); + config->seek_track.volume = (float) ini_section_get_double(cat, "seek_track_volume", 1.0); + + pclog("HDD Audio: Loaded profile %d: %s (%s)\n", + audio_profile_count, config->name, config->internal_name); + + audio_profile_count++; + } + + ini_close(profiles_ini); + + pclog("HDD Audio: Loaded %d audio profiles\n", audio_profile_count); +} + +/* Public API functions */ +int +hdd_audio_get_profile_count(void) +{ + return audio_profile_count; +} + +const hdd_audio_profile_config_t * +hdd_audio_get_profile(int id) +{ + if (id < 0 || id >= audio_profile_count) + return NULL; + return &audio_profiles[id]; +} + +const char * +hdd_audio_get_profile_name(int id) +{ + if (id < 0 || id >= audio_profile_count) + return NULL; + return audio_profiles[id].name; +} + +const char * +hdd_audio_get_profile_internal_name(int id) +{ + if (id < 0 || id >= audio_profile_count) + return NULL; + return audio_profiles[id].internal_name; +} + +int +hdd_audio_get_profile_by_internal_name(const char *internal_name) +{ + if (!internal_name) + return 0; + + for (int i = 0; i < audio_profile_count; i++) { + if (strcmp(audio_profiles[i].internal_name, internal_name) == 0) + return i; + } + return 0; +} + +void +hdd_audio_close(void) +{ + /* Free all loaded profile samples */ + for (int i = 0; i < HDD_AUDIO_PROFILE_MAX; i++) { + if (profile_samples[i].spindle_start_buffer) { + free(profile_samples[i].spindle_start_buffer); + profile_samples[i].spindle_start_buffer = NULL; + } + if (profile_samples[i].spindle_loop_buffer) { + free(profile_samples[i].spindle_loop_buffer); + profile_samples[i].spindle_loop_buffer = NULL; + } + if (profile_samples[i].spindle_stop_buffer) { + free(profile_samples[i].spindle_stop_buffer); + profile_samples[i].spindle_stop_buffer = NULL; + } + if (profile_samples[i].seek_buffer) { + free(profile_samples[i].seek_buffer); + profile_samples[i].seek_buffer = NULL; + } + profile_samples[i].loaded = 0; + } + + if (hdd_audio_mutex) { + thread_close_mutex(hdd_audio_mutex); + hdd_audio_mutex = NULL; + } +} + +/* Load samples for a specific profile */ +static void +hdd_audio_load_profile_samples(int profile_id) +{ + if (profile_id < 0 || profile_id >= audio_profile_count) + return; + + hdd_audio_profile_config_t *config = &audio_profiles[profile_id]; + hdd_audio_samples_t *samples = &profile_samples[profile_id]; + + /* Already loaded? */ + if (samples->loaded) + return; + + /* Profile 0 is "None" - no audio */ + if (profile_id == 0 || strcmp(config->internal_name, "none") == 0) { + samples->loaded = 1; + return; + } + + pclog("HDD Audio: Loading samples for profile %d (%s)\n", profile_id, config->name); + + /* Load spindle loop (main running sound) */ + if (config->spindlemotor_loop.filename[0]) { + samples->spindle_loop_buffer = sound_load_wav( + config->spindlemotor_loop.filename, + &samples->spindle_loop_samples); + if (samples->spindle_loop_buffer) { + samples->spindle_volume = config->spindlemotor_loop.volume; + pclog("HDD Audio: Loaded spindle loop, %d frames\n", samples->spindle_loop_samples); + } else { + pclog("HDD Audio: Failed to load spindle loop: %s\n", config->spindlemotor_loop.filename); + } + } + + /* Load spindle start */ + if (config->spindlemotor_start.filename[0]) { + samples->spindle_start_buffer = sound_load_wav( + config->spindlemotor_start.filename, + &samples->spindle_start_samples); + if (samples->spindle_start_buffer) { + pclog("HDD Audio: Loaded spindle start, %d frames\n", samples->spindle_start_samples); + } + } + + /* Load spindle stop */ + if (config->spindlemotor_stop.filename[0]) { + samples->spindle_stop_buffer = sound_load_wav( + config->spindlemotor_stop.filename, + &samples->spindle_stop_samples); + if (samples->spindle_stop_buffer) { + pclog("HDD Audio: Loaded spindle stop, %d frames\n", samples->spindle_stop_samples); + } + } + + /* Load seek sound */ + if (config->seek_track.filename[0]) { + samples->seek_buffer = sound_load_wav( + config->seek_track.filename, + &samples->seek_samples); + if (samples->seek_buffer) { + samples->seek_volume = config->seek_track.volume; + pclog("HDD Audio: Loaded seek sound, %d frames (%.1f ms)\n", + samples->seek_samples, (float)samples->seek_samples / 48.0f); + } else { + pclog("HDD Audio: Failed to load seek sound: %s\n", config->seek_track.filename); + } + } + + samples->loaded = 1; +} + +void +hdd_audio_init(void) +{ + /* Initialize profile samples */ + memset(profile_samples, 0, sizeof(profile_samples)); + + pclog("HDD Audio Init: audio_profile_count=%d\n", audio_profile_count); + + /* Find first HDD with a valid audio profile and load its samples */ + active_audio_profile = 0; + for (int i = 0; i < HDD_NUM; i++) { + if (hdd[i].bus_type != HDD_BUS_DISABLED) { + pclog("HDD Audio Init: HDD %d bus_type=%d audio_profile=%d\n", + i, hdd[i].bus_type, hdd[i].audio_profile); + if (hdd[i].audio_profile > 0) { + active_audio_profile = hdd[i].audio_profile; + pclog("HDD Audio: Using profile %d from HDD %d\n", active_audio_profile, i); + break; + } + } + } + + pclog("HDD Audio Init: active_audio_profile=%d\n", active_audio_profile); + + /* Load samples for the active profile */ + if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { + hdd_audio_load_profile_samples(active_audio_profile); } for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { @@ -60,28 +323,87 @@ hdd_audio_init(void) } void -hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder) +hdd_audio_reset(void) +{ + pclog("HDD Audio: Reset\n"); + + /* Free previously loaded samples (but keep profiles) */ + for (int i = 0; i < HDD_AUDIO_PROFILE_MAX; i++) { + if (profile_samples[i].spindle_start_buffer) { + free(profile_samples[i].spindle_start_buffer); + profile_samples[i].spindle_start_buffer = NULL; + } + if (profile_samples[i].spindle_loop_buffer) { + free(profile_samples[i].spindle_loop_buffer); + profile_samples[i].spindle_loop_buffer = NULL; + } + if (profile_samples[i].spindle_stop_buffer) { + free(profile_samples[i].spindle_stop_buffer); + profile_samples[i].spindle_stop_buffer = NULL; + } + if (profile_samples[i].seek_buffer) { + free(profile_samples[i].seek_buffer); + profile_samples[i].seek_buffer = NULL; + } + profile_samples[i].loaded = 0; + } + + /* Reset seek voices */ + for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { + hdd_seek_voices[i].active = 0; + hdd_seek_voices[i].position = 0; + hdd_seek_voices[i].volume = 1.0f; + } + + /* Find new active profile from current HDD configuration */ + active_audio_profile = 0; + for (int i = 0; i < HDD_NUM; i++) { + if (hdd[i].bus_type != HDD_BUS_DISABLED) { + pclog("HDD Audio Reset: HDD %d audio_profile=%d\n", i, hdd[i].audio_profile); + if (hdd[i].audio_profile > 0) { + active_audio_profile = hdd[i].audio_profile; + pclog("HDD Audio: Reset with profile %d from HDD %d\n", active_audio_profile, i); + break; + } + } + } + + /* Load samples for the active profile */ + if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { + hdd_audio_load_profile_samples(active_audio_profile); + } +} + +void +hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) { - uint32_t cylinder_diff = abs((int) hdd->cur_cylinder - (int) new_cylinder); + uint32_t cylinder_diff = abs((int) hdd_drive->cur_cylinder - (int) new_cylinder); if (cylinder_diff == 0) return; - pclog("HDD Audio Seek: cur_cyl=%u -> new_cyl=%u, diff=%u, speed_preset=%d, cyl_switch_usec=%.1f\n", - hdd->cur_cylinder, new_cylinder, cylinder_diff, hdd->speed_preset, - hdd->cyl_switch_usec); - - if (hdd->speed_preset == 0) + /* Use the drive's audio profile, fallback to active profile */ + int profile_id = hdd_drive->audio_profile; + if (profile_id == 0) + profile_id = active_audio_profile; + + /* No audio profile selected */ + if (profile_id == 0 || profile_id >= audio_profile_count) return; - - if (!hdd_seek_sound_buffer || hdd_seek_samples == 0) { - pclog("HDD Audio Seek: No seek sound buffer loaded!\n"); + + /* Load samples if not already loaded */ + if (!profile_samples[profile_id].loaded) + hdd_audio_load_profile_samples(profile_id); + + hdd_audio_samples_t *samples = &profile_samples[profile_id]; + + if (!samples->seek_buffer || samples->seek_samples == 0) { return; } int min_seek_spacing = 0; - if (hdd->cyl_switch_usec > 0) - min_seek_spacing = (int)(hdd->cyl_switch_usec * 48000.0 / 1000000.0); + if (hdd_drive->cyl_switch_usec > 0) + min_seek_spacing = (int)(hdd_drive->cyl_switch_usec * 48000.0 / 1000000.0); thread_wait_mutex(hdd_audio_mutex); @@ -95,22 +417,16 @@ hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder) } } - int active_count = 0; - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { if (!hdd_seek_voices[i].active) { hdd_seek_voices[i].active = 1; hdd_seek_voices[i].position = 0; - hdd_seek_voices[i].volume = 0.5f; - pclog("HDD Audio Seek: Using free voice %d\n", i); + hdd_seek_voices[i].volume = samples->seek_volume; thread_release_mutex(hdd_audio_mutex); return; } - active_count++; } - pclog("HDD Audio Seek: All %d voices active, skipping seek\n", active_count); - thread_release_mutex(hdd_audio_mutex); } @@ -118,23 +434,28 @@ void hdd_audio_callback(int16_t *buffer, int length) { static int spindle_pos = 0; - static int debug_counter = 0; - const float spindle_volume = 0.2f; - const float seek_volume = 0.5f; int frames_in_buffer = length / 2; + /* Get active profile samples */ + hdd_audio_samples_t *samples = NULL; + if (active_audio_profile > 0 && active_audio_profile < HDD_AUDIO_PROFILE_MAX) { + samples = &profile_samples[active_audio_profile]; + } + if (sound_is_float) { float *float_buffer = (float *) buffer; - if (hdd_spindle_sound_buffer && hdd_samples > 0) { + /* Spindle sound from profile */ + if (samples && samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { + float spindle_volume = samples->spindle_volume; for (int i = 0; i < frames_in_buffer; i++) { - float left_sample = (float) hdd_spindle_sound_buffer[spindle_pos * 2] / 131072.0f * spindle_volume; - float right_sample = (float) hdd_spindle_sound_buffer[spindle_pos * 2 + 1] / 131072.0f * spindle_volume; + float left_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2] / 131072.0f * spindle_volume; + float right_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2 + 1] / 131072.0f * spindle_volume; float_buffer[i * 2] = left_sample; float_buffer[i * 2 + 1] = right_sample; spindle_pos++; - if (spindle_pos >= hdd_samples) { + if (spindle_pos >= samples->spindle_loop_samples) { spindle_pos = 0; } } @@ -144,7 +465,8 @@ hdd_audio_callback(int16_t *buffer, int length) } } - if (hdd_seek_sound_buffer && hdd_seek_samples > 0 && hdd_audio_mutex) { + /* Seek sounds from profile */ + if (samples && samples->seek_buffer && samples->seek_samples > 0 && hdd_audio_mutex) { thread_wait_mutex(hdd_audio_mutex); for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { @@ -155,15 +477,15 @@ hdd_audio_callback(int16_t *buffer, int length) int pos = hdd_seek_voices[v].position; if (pos < 0) pos = 0; - for (int i = 0; i < frames_in_buffer && pos < hdd_seek_samples; i++, pos++) { - float seek_left = (float) hdd_seek_sound_buffer[pos * 2] / 131072.0f * seek_volume * voice_vol; - float seek_right = (float) hdd_seek_sound_buffer[pos * 2 + 1] / 131072.0f * seek_volume * voice_vol; + for (int i = 0; i < frames_in_buffer && pos < samples->seek_samples; i++, pos++) { + float seek_left = (float) samples->seek_buffer[pos * 2] / 131072.0f * voice_vol; + float seek_right = (float) samples->seek_buffer[pos * 2 + 1] / 131072.0f * voice_vol; float_buffer[i * 2] += seek_left; float_buffer[i * 2 + 1] += seek_right; } - if (pos >= hdd_seek_samples) { + if (pos >= samples->seek_samples) { hdd_seek_voices[v].active = 0; hdd_seek_voices[v].position = 0; } else { @@ -173,19 +495,16 @@ hdd_audio_callback(int16_t *buffer, int length) thread_release_mutex(hdd_audio_mutex); } - - if (debug_counter++ % 100 == 0) { - pclog("HDD Audio: float_buffer[0]=%.6f, float_buffer[1]=%.6f, spindle_pos=%d, frames=%d\n", - float_buffer[0], float_buffer[1], spindle_pos, frames_in_buffer); - } } else { - if (hdd_spindle_sound_buffer && hdd_samples > 0) { + /* Spindle sound from profile */ + if (samples && samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { + float spindle_volume = samples->spindle_volume; for (int i = 0; i < frames_in_buffer; i++) { - buffer[i * 2] = hdd_spindle_sound_buffer[spindle_pos * 2]; - buffer[i * 2 + 1] = hdd_spindle_sound_buffer[spindle_pos * 2 + 1]; + buffer[i * 2] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2] * spindle_volume); + buffer[i * 2 + 1] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2 + 1] * spindle_volume); spindle_pos++; - if (spindle_pos >= hdd_samples) { + if (spindle_pos >= samples->spindle_loop_samples) { spindle_pos = 0; } } @@ -195,19 +514,21 @@ hdd_audio_callback(int16_t *buffer, int length) } } - if (hdd_seek_sound_buffer && hdd_seek_samples > 0 && hdd_audio_mutex) { + /* Seek sounds from profile */ + if (samples && samples->seek_buffer && samples->seek_samples > 0 && hdd_audio_mutex) { thread_wait_mutex(hdd_audio_mutex); for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { if (!hdd_seek_voices[v].active) continue; + float voice_vol = hdd_seek_voices[v].volume; int pos = hdd_seek_voices[v].position; if (pos < 0) pos = 0; - for (int i = 0; i < frames_in_buffer && pos < hdd_seek_samples; i++, pos++) { - int32_t left = buffer[i * 2] + hdd_seek_sound_buffer[pos * 2] / 2; - int32_t right = buffer[i * 2 + 1] + hdd_seek_sound_buffer[pos * 2 + 1] / 2; + for (int i = 0; i < frames_in_buffer && pos < samples->seek_samples; i++, pos++) { + int32_t left = buffer[i * 2] + (int32_t)(samples->seek_buffer[pos * 2] * voice_vol); + int32_t right = buffer[i * 2 + 1] + (int32_t)(samples->seek_buffer[pos * 2 + 1] * voice_vol); if (left > 32767) left = 32767; if (left < -32768) left = -32768; @@ -218,7 +539,7 @@ hdd_audio_callback(int16_t *buffer, int length) buffer[i * 2 + 1] = (int16_t) right; } - if (pos >= hdd_seek_samples) { + if (pos >= samples->seek_samples) { hdd_seek_voices[v].active = 0; hdd_seek_voices[v].position = 0; } else { diff --git a/src/include/86box/hdd.h b/src/include/86box/hdd.h index 88855552b9c..ddf8fdbe68e 100644 --- a/src/include/86box/hdd.h +++ b/src/include/86box/hdd.h @@ -172,6 +172,7 @@ typedef struct hard_disk_t { uint32_t hpc; uint32_t tracks; uint32_t speed_preset; + uint32_t audio_profile; uint32_t num_zones; uint32_t phy_cyl; diff --git a/src/include/86box/hdd_audio.h b/src/include/86box/hdd_audio.h index 1e6d7b103e4..050bff0a0f6 100644 --- a/src/include/86box/hdd_audio.h +++ b/src/include/86box/hdd_audio.h @@ -1,6 +1,63 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Definitions for the hard disk audio emulation. + * + * Authors: Toni Riikonen, + * + * Copyright 2026 Toni Riikonen. + */ +#ifndef EMU_HDD_AUDIO_H +#define EMU_HDD_AUDIO_H + #include #include <86box/hdd.h> +#ifdef __cplusplus +extern "C" { +#endif + +#define HDD_AUDIO_PROFILE_MAX 64 + +/* Audio sample configuration structure */ +typedef struct { + char filename[512]; + float volume; +} hdd_audio_sample_config_t; + +/* HDD audio profile configuration */ +typedef struct { + int id; + char name[128]; + char internal_name[64]; + hdd_audio_sample_config_t spindlemotor_start; + hdd_audio_sample_config_t spindlemotor_loop; + hdd_audio_sample_config_t spindlemotor_stop; + hdd_audio_sample_config_t seek_track; +} hdd_audio_profile_config_t; + +/* Functions for profile management */ +extern void hdd_audio_load_profiles(void); +extern int hdd_audio_get_profile_count(void); +extern const hdd_audio_profile_config_t *hdd_audio_get_profile(int id); +extern const char *hdd_audio_get_profile_name(int id); +extern const char *hdd_audio_get_profile_internal_name(int id); +extern int hdd_audio_get_profile_by_internal_name(const char *internal_name); + +/* HDD audio initialization and cleanup */ extern void hdd_audio_init(void); +extern void hdd_audio_reset(void); +extern void hdd_audio_close(void); extern void hdd_audio_callback(int16_t *buffer, int length); -extern void hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder); \ No newline at end of file +extern void hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder); + +#ifdef __cplusplus +} +#endif + +#endif /* EMU_HDD_AUDIO_H */ \ No newline at end of file diff --git a/src/qt/qt_settingsharddisks.cpp b/src/qt/qt_settingsharddisks.cpp index 0f12c8e6f65..7939cb989e2 100644 --- a/src/qt/qt_settingsharddisks.cpp +++ b/src/qt/qt_settingsharddisks.cpp @@ -20,6 +20,7 @@ extern "C" { #include <86box/86box.h> #include <86box/hdd.h> +#include <86box/hdd_audio.h> } #include @@ -36,6 +37,7 @@ const int ColumnHeads = 3; const int ColumnSectors = 4; const int ColumnSize = 5; const int ColumnSpeed = 6; +const int ColumnAudio = 7; const int DataBus = Qt::UserRole; const int DataBusChannel = Qt::UserRole + 1; @@ -103,6 +105,11 @@ addRow(QAbstractItemModel *model, hard_disk_t *hd) auto speedIndex = model->index(row, ColumnSpeed); model->setData(speedIndex, QObject::tr(hdd_preset_getname(hd->speed_preset))); model->setData(speedIndex, hd->speed_preset, Qt::UserRole); + + auto audioIndex = model->index(row, ColumnAudio); + const char *audioName = hdd_audio_get_profile_name(hd->audio_profile); + model->setData(audioIndex, audioName ? QObject::tr(audioName) : QObject::tr("None")); + model->setData(audioIndex, hd->audio_profile, Qt::UserRole); } SettingsHarddisks::SettingsHarddisks(QWidget *parent) @@ -113,7 +120,7 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent) hard_disk_icon = QIcon(":/settings/qt/icons/hard_disk.ico"); - QAbstractItemModel *model = new QStandardItemModel(0, 7, this); + QAbstractItemModel *model = new QStandardItemModel(0, 8, this); model->setHeaderData(ColumnBus, Qt::Horizontal, tr("Bus")); model->setHeaderData(ColumnFilename, Qt::Horizontal, tr("File")); model->setHeaderData(ColumnCylinders, Qt::Horizontal, tr("C")); @@ -121,6 +128,7 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent) model->setHeaderData(ColumnSectors, Qt::Horizontal, tr("S")); model->setHeaderData(ColumnSize, Qt::Horizontal, tr("MiB")); model->setHeaderData(ColumnSpeed, Qt::Horizontal, tr("Model")); + model->setHeaderData(ColumnAudio, Qt::Horizontal, tr("Audio")); ui->tableView->setModel(model); for (int i = 0; i < HDD_NUM; i++) { @@ -139,6 +147,16 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent) onTableRowChanged(QModelIndex()); Harddrives::populateBuses(ui->comboBoxBus->model()); + + /* Populate audio profile combobox */ + int profile_count = hdd_audio_get_profile_count(); + for (int i = 0; i < profile_count; i++) { + const char *name = hdd_audio_get_profile_name(i); + if (name) { + ui->comboBoxAudio->addItem(name, i); + } + } + on_comboBoxBus_currentIndexChanged(0); } @@ -162,6 +180,7 @@ SettingsHarddisks::save() hdd[i].hpc = idx.siblingAtColumn(ColumnHeads).data().toUInt(); hdd[i].spt = idx.siblingAtColumn(ColumnSectors).data().toUInt(); hdd[i].speed_preset = idx.siblingAtColumn(ColumnSpeed).data(Qt::UserRole).toUInt(); + hdd[i].audio_profile = idx.siblingAtColumn(ColumnAudio).data(Qt::UserRole).toUInt(); QByteArray fileName = idx.siblingAtColumn(ColumnFilename).data(Qt::UserRole).toString().toUtf8(); strncpy(hdd[i].fn, fileName.data(), sizeof(hdd[i].fn) - 1); @@ -272,6 +291,24 @@ SettingsHarddisks::on_comboBoxSpeed_currentIndexChanged(int index) } } +void +SettingsHarddisks::on_comboBoxAudio_currentIndexChanged(int index) +{ + if (index < 0) + return; + + auto idx = ui->tableView->selectionModel()->currentIndex(); + if (idx.isValid()) { + auto *model = ui->tableView->model(); + auto col = idx.siblingAtColumn(ColumnAudio); + int prof = ui->comboBoxAudio->currentData(Qt::UserRole).toInt(); + model->setData(col, prof, Qt::UserRole); + + const char *audioName = hdd_audio_get_profile_name(prof); + model->setData(col, audioName ? QObject::tr(audioName) : QObject::tr("None")); + } +} + void SettingsHarddisks::onTableRowChanged(const QModelIndex ¤t) { @@ -279,13 +316,16 @@ SettingsHarddisks::onTableRowChanged(const QModelIndex ¤t) ui->labelBus->setHidden(hidden); ui->labelChannel->setHidden(hidden); ui->labelSpeed->setHidden(hidden); + ui->labelAudio->setHidden(hidden); ui->comboBoxBus->setHidden(hidden); ui->comboBoxChannel->setHidden(hidden); ui->comboBoxSpeed->setHidden(hidden); + ui->comboBoxAudio->setHidden(hidden); uint32_t bus = current.siblingAtColumn(ColumnBus).data(DataBus).toUInt(); uint32_t busChannel = current.siblingAtColumn(ColumnBus).data(DataBusChannel).toUInt(); uint32_t speed = current.siblingAtColumn(ColumnSpeed).data(Qt::UserRole).toUInt(); + uint32_t audio = current.siblingAtColumn(ColumnAudio).data(Qt::UserRole).toUInt(); auto *model = ui->comboBoxBus->model(); auto match = model->match(model->index(0, 0), Qt::UserRole, bus); @@ -302,6 +342,11 @@ SettingsHarddisks::onTableRowChanged(const QModelIndex ¤t) if (!match.isEmpty()) ui->comboBoxSpeed->setCurrentIndex(match.first().row()); + model = ui->comboBoxAudio->model(); + match = model->match(model->index(0, 0), Qt::UserRole, audio); + if (!match.isEmpty()) + ui->comboBoxAudio->setCurrentIndex(match.first().row()); + reloadBusChannels(); } diff --git a/src/qt/qt_settingsharddisks.hpp b/src/qt/qt_settingsharddisks.hpp index f892a79cdd6..b8d298bb4ba 100644 --- a/src/qt/qt_settingsharddisks.hpp +++ b/src/qt/qt_settingsharddisks.hpp @@ -24,6 +24,7 @@ private slots: void on_comboBoxBus_currentIndexChanged(int index); void on_comboBoxChannel_currentIndexChanged(int index); void on_comboBoxSpeed_currentIndexChanged(int index); + void on_comboBoxAudio_currentIndexChanged(int index); void on_pushButtonNew_clicked(); void on_pushButtonExisting_clicked(); diff --git a/src/qt/qt_settingsharddisks.ui b/src/qt/qt_settingsharddisks.ui index d65b1d0c1a8..a6f134bdcb9 100644 --- a/src/qt/qt_settingsharddisks.ui +++ b/src/qt/qt_settingsharddisks.ui @@ -90,6 +90,20 @@
+ + + + Audio: + + + + + + + 30 + + +
From b4a5c76847f86507fa03e0ce4b31dc8647ada1fd Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 4 Jan 2026 09:32:25 +0200 Subject: [PATCH 209/320] HDD audio setting now populates audio profiles for selected HDD rpm --- src/disk/hdd.c | 8 +++++++ src/disk/hdd_audio.c | 10 ++++++++ src/include/86box/hdd.h | 1 + src/include/86box/hdd_audio.h | 2 ++ src/qt/qt_settingsharddisks.cpp | 41 +++++++++++++++++++++++++-------- src/qt/qt_settingsharddisks.hpp | 1 + 6 files changed, 54 insertions(+), 9 deletions(-) diff --git a/src/disk/hdd.c b/src/disk/hdd.c index cd34b66fa4d..bbbec0865c9 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -589,6 +589,14 @@ hdd_preset_get_internal_name(int preset) return hdd_speed_presets[preset].internal_name; } +uint32_t +hdd_preset_get_rpm(int preset) +{ + if (preset < 0 || preset >= hdd_preset_get_num()) + return 0; + return hdd_speed_presets[preset].rpm; +} + int hdd_preset_get_from_internal_name(char *s) { diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index bc3f9ed95d1..464f3e2244f 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -107,6 +107,8 @@ hdd_audio_load_profiles(void) const char *internal_name = ini_section_get_string(cat, "internal_name", "unknown"); strncpy(config->internal_name, internal_name, sizeof(config->internal_name) - 1); + config->rpm = ini_section_get_int(cat, "rpm", 0); + /* Load spindle motor sample files */ const char *file = ini_section_get_string(cat, "spindlemotor_start_file", ""); strncpy(config->spindlemotor_start.filename, file, sizeof(config->spindlemotor_start.filename) - 1); @@ -167,6 +169,14 @@ hdd_audio_get_profile_internal_name(int id) return audio_profiles[id].internal_name; } +uint32_t +hdd_audio_get_profile_rpm(int id) +{ + if (id < 0 || id >= audio_profile_count) + return 0; + return audio_profiles[id].rpm; +} + int hdd_audio_get_profile_by_internal_name(const char *internal_name) { diff --git a/src/include/86box/hdd.h b/src/include/86box/hdd.h index ddf8fdbe68e..d8f275de3fc 100644 --- a/src/include/86box/hdd.h +++ b/src/include/86box/hdd.h @@ -234,6 +234,7 @@ extern double hdd_seek_get_time(hard_disk_t *hdd, uint32_t dst_addr, uint8_ int hdd_preset_get_num(void); const char *hdd_preset_getname(int preset); extern const char *hdd_preset_get_internal_name(int preset); +extern uint32_t hdd_preset_get_rpm(int preset); extern int hdd_preset_get_from_internal_name(char *s); extern void hdd_preset_apply(int hdd_id); diff --git a/src/include/86box/hdd_audio.h b/src/include/86box/hdd_audio.h index 050bff0a0f6..8dfac0c00f6 100644 --- a/src/include/86box/hdd_audio.h +++ b/src/include/86box/hdd_audio.h @@ -35,6 +35,7 @@ typedef struct { int id; char name[128]; char internal_name[64]; + uint32_t rpm; hdd_audio_sample_config_t spindlemotor_start; hdd_audio_sample_config_t spindlemotor_loop; hdd_audio_sample_config_t spindlemotor_stop; @@ -47,6 +48,7 @@ extern int hdd_audio_get_profile_count(void); extern const hdd_audio_profile_config_t *hdd_audio_get_profile(int id); extern const char *hdd_audio_get_profile_name(int id); extern const char *hdd_audio_get_profile_internal_name(int id); +extern uint32_t hdd_audio_get_profile_rpm(int id); extern int hdd_audio_get_profile_by_internal_name(const char *internal_name); /* HDD audio initialization and cleanup */ diff --git a/src/qt/qt_settingsharddisks.cpp b/src/qt/qt_settingsharddisks.cpp index 7939cb989e2..849c3430520 100644 --- a/src/qt/qt_settingsharddisks.cpp +++ b/src/qt/qt_settingsharddisks.cpp @@ -148,15 +148,6 @@ SettingsHarddisks::SettingsHarddisks(QWidget *parent) Harddrives::populateBuses(ui->comboBoxBus->model()); - /* Populate audio profile combobox */ - int profile_count = hdd_audio_get_profile_count(); - for (int i = 0; i < profile_count; i++) { - const char *name = hdd_audio_get_profile_name(i); - if (name) { - ui->comboBoxAudio->addItem(name, i); - } - } - on_comboBoxBus_currentIndexChanged(0); } @@ -288,6 +279,35 @@ SettingsHarddisks::on_comboBoxSpeed_currentIndexChanged(int index) auto col = idx.siblingAtColumn(ColumnSpeed); model->setData(col, ui->comboBoxSpeed->currentData(Qt::UserRole), Qt::UserRole); model->setData(col, QObject::tr(hdd_preset_getname(ui->comboBoxSpeed->currentData(Qt::UserRole).toUInt()))); + + /* Reset audio profile to None when speed/model changes */ + auto audioCol = idx.siblingAtColumn(ColumnAudio); + model->setData(audioCol, 0, Qt::UserRole); + model->setData(audioCol, QObject::tr("None")); + } + + /* Repopulate audio profiles based on the selected speed preset's RPM */ + populateAudioProfiles(); +} + +void +SettingsHarddisks::populateAudioProfiles() +{ + ui->comboBoxAudio->clear(); + + /* Get RPM from currently selected speed preset */ + uint32_t target_rpm = hdd_preset_get_rpm(ui->comboBoxSpeed->currentData(Qt::UserRole).toUInt()); + + /* Populate audio profile combobox with matching RPM profiles */ + int profile_count = hdd_audio_get_profile_count(); + for (int i = 0; i < profile_count; i++) { + const char *name = hdd_audio_get_profile_name(i); + uint32_t profile_rpm = hdd_audio_get_profile_rpm(i); + + /* Include profile if it has no RPM set (0) or matches target RPM */ + if (name && (profile_rpm == 0 || profile_rpm == target_rpm)) { + ui->comboBoxAudio->addItem(name, i); + } } } @@ -342,6 +362,9 @@ SettingsHarddisks::onTableRowChanged(const QModelIndex ¤t) if (!match.isEmpty()) ui->comboBoxSpeed->setCurrentIndex(match.first().row()); + /* Populate audio profiles based on selected speed preset's RPM */ + populateAudioProfiles(); + model = ui->comboBoxAudio->model(); match = model->match(model->index(0, 0), Qt::UserRole, audio); if (!match.isEmpty()) diff --git a/src/qt/qt_settingsharddisks.hpp b/src/qt/qt_settingsharddisks.hpp index b8d298bb4ba..f082c7de636 100644 --- a/src/qt/qt_settingsharddisks.hpp +++ b/src/qt/qt_settingsharddisks.hpp @@ -35,6 +35,7 @@ private slots: private: Ui::SettingsHarddisks *ui; void enableCurrentlySelectedChannel(); + void populateAudioProfiles(); bool buschangeinprogress = false; }; From 419ee5cbd9a244615778aec12eac87955454fd42 Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 4 Jan 2026 11:15:22 +0200 Subject: [PATCH 210/320] HDD audio start/stop sample playback + some mutex deadlock fixes --- src/disk/hdd_audio.c | 284 +++++++++++++++++++++++++++------- src/include/86box/hdd_audio.h | 11 ++ 2 files changed, 243 insertions(+), 52 deletions(-) diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index 464f3e2244f..af93a334cb6 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -42,13 +42,15 @@ typedef struct { typedef struct { int16_t *spindle_start_buffer; int spindle_start_samples; + float spindle_start_volume; int16_t *spindle_loop_buffer; int spindle_loop_samples; + float spindle_loop_volume; int16_t *spindle_stop_buffer; int spindle_stop_samples; + float spindle_stop_volume; int16_t *seek_buffer; int seek_samples; - float spindle_volume; float seek_volume; int loaded; } hdd_audio_samples_t; @@ -66,6 +68,11 @@ static int active_audio_profile = 0; static hdd_seek_voice_t hdd_seek_voices[HDD_MAX_SEEK_VOICES]; static mutex_t *hdd_audio_mutex = NULL; +/* Spindle motor state */ +static hdd_spindle_state_t spindle_state = HDD_SPINDLE_STOPPED; +static int spindle_pos = 0; +static int spindle_transition_pos = 0; /* Position in start/stop sample */ + /* Load audio profiles from configuration file */ void hdd_audio_load_profiles(void) @@ -248,7 +255,7 @@ hdd_audio_load_profile_samples(int profile_id) config->spindlemotor_loop.filename, &samples->spindle_loop_samples); if (samples->spindle_loop_buffer) { - samples->spindle_volume = config->spindlemotor_loop.volume; + samples->spindle_loop_volume = config->spindlemotor_loop.volume; pclog("HDD Audio: Loaded spindle loop, %d frames\n", samples->spindle_loop_samples); } else { pclog("HDD Audio: Failed to load spindle loop: %s\n", config->spindlemotor_loop.filename); @@ -261,6 +268,7 @@ hdd_audio_load_profile_samples(int profile_id) config->spindlemotor_start.filename, &samples->spindle_start_samples); if (samples->spindle_start_buffer) { + samples->spindle_start_volume = config->spindlemotor_start.volume; pclog("HDD Audio: Loaded spindle start, %d frames\n", samples->spindle_start_samples); } } @@ -271,6 +279,7 @@ hdd_audio_load_profile_samples(int profile_id) config->spindlemotor_stop.filename, &samples->spindle_stop_samples); if (samples->spindle_stop_buffer) { + samples->spindle_stop_volume = config->spindlemotor_stop.volume; pclog("HDD Audio: Loaded spindle stop, %d frames\n", samples->spindle_stop_samples); } } @@ -316,18 +325,22 @@ hdd_audio_init(void) pclog("HDD Audio Init: active_audio_profile=%d\n", active_audio_profile); - /* Load samples for the active profile */ - if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { - hdd_audio_load_profile_samples(active_audio_profile); - } - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { hdd_seek_voices[i].active = 0; hdd_seek_voices[i].position = 0; hdd_seek_voices[i].volume = 1.0f; } - hdd_audio_mutex = thread_create_mutex(); + /* Create mutex BEFORE loading samples or calling spinup */ + if (!hdd_audio_mutex) + hdd_audio_mutex = thread_create_mutex(); + + /* Load samples for the active profile */ + if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { + hdd_audio_load_profile_samples(active_audio_profile); + /* Start spindle motor */ + hdd_audio_spinup(); + } sound_hdd_thread_init(); } @@ -337,6 +350,25 @@ hdd_audio_reset(void) { pclog("HDD Audio: Reset\n"); + /* Lock mutex to prevent audio callback from accessing buffers during reset */ + if (hdd_audio_mutex) + thread_wait_mutex(hdd_audio_mutex); + + /* Reset spindle state first to stop audio playback */ + spindle_state = HDD_SPINDLE_STOPPED; + spindle_pos = 0; + spindle_transition_pos = 0; + + /* Reset seek voices */ + for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { + hdd_seek_voices[i].active = 0; + hdd_seek_voices[i].position = 0; + hdd_seek_voices[i].volume = 1.0f; + } + + /* Reset active profile before freeing buffers */ + active_audio_profile = 0; + /* Free previously loaded samples (but keep profiles) */ for (int i = 0; i < HDD_AUDIO_PROFILE_MAX; i++) { if (profile_samples[i].spindle_start_buffer) { @@ -358,15 +390,10 @@ hdd_audio_reset(void) profile_samples[i].loaded = 0; } - /* Reset seek voices */ - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { - hdd_seek_voices[i].active = 0; - hdd_seek_voices[i].position = 0; - hdd_seek_voices[i].volume = 1.0f; - } + if (hdd_audio_mutex) + thread_release_mutex(hdd_audio_mutex); /* Find new active profile from current HDD configuration */ - active_audio_profile = 0; for (int i = 0; i < HDD_NUM; i++) { if (hdd[i].bus_type != HDD_BUS_DISABLED) { pclog("HDD Audio Reset: HDD %d audio_profile=%d\n", i, hdd[i].audio_profile); @@ -381,6 +408,8 @@ hdd_audio_reset(void) /* Load samples for the active profile */ if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { hdd_audio_load_profile_samples(active_audio_profile); + /* Start spindle motor */ + hdd_audio_spinup(); } } @@ -411,6 +440,10 @@ hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) return; } + /* Mutex must exist */ + if (!hdd_audio_mutex) + return; + int min_seek_spacing = 0; if (hdd_drive->cyl_switch_usec > 0) min_seek_spacing = (int)(hdd_drive->cyl_switch_usec * 48000.0 / 1000000.0); @@ -440,10 +473,47 @@ hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) thread_release_mutex(hdd_audio_mutex); } +void +hdd_audio_spinup(void) +{ + if (spindle_state == HDD_SPINDLE_RUNNING || spindle_state == HDD_SPINDLE_STARTING) + return; + + pclog("HDD Audio: Spinup requested (current state: %d)\n", spindle_state); + + if (hdd_audio_mutex) + thread_wait_mutex(hdd_audio_mutex); + spindle_state = HDD_SPINDLE_STARTING; + spindle_transition_pos = 0; + if (hdd_audio_mutex) + thread_release_mutex(hdd_audio_mutex); +} + +void +hdd_audio_spindown(void) +{ + if (spindle_state == HDD_SPINDLE_STOPPED || spindle_state == HDD_SPINDLE_STOPPING) + return; + + pclog("HDD Audio: Spindown requested (current state: %d)\n", spindle_state); + + if (hdd_audio_mutex) + thread_wait_mutex(hdd_audio_mutex); + spindle_state = HDD_SPINDLE_STOPPING; + spindle_transition_pos = 0; + if (hdd_audio_mutex) + thread_release_mutex(hdd_audio_mutex); +} + +hdd_spindle_state_t +hdd_audio_get_spindle_state(void) +{ + return spindle_state; +} + void hdd_audio_callback(int16_t *buffer, int length) { - static int spindle_pos = 0; int frames_in_buffer = length / 2; /* Get active profile samples */ @@ -455,28 +525,86 @@ hdd_audio_callback(int16_t *buffer, int length) if (sound_is_float) { float *float_buffer = (float *) buffer; - /* Spindle sound from profile */ - if (samples && samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { - float spindle_volume = samples->spindle_volume; - for (int i = 0; i < frames_in_buffer; i++) { - float left_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2] / 131072.0f * spindle_volume; - float right_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2 + 1] / 131072.0f * spindle_volume; - float_buffer[i * 2] = left_sample; - float_buffer[i * 2 + 1] = right_sample; - - spindle_pos++; - if (spindle_pos >= samples->spindle_loop_samples) { - spindle_pos = 0; - } - } - } else { - for (int i = 0; i < length; i++) { - float_buffer[i] = 0.0f; + /* Initialize buffer to silence */ + for (int i = 0; i < length; i++) { + float_buffer[i] = 0.0f; + } + + /* Handle spindle states */ + if (samples) { + switch (spindle_state) { + case HDD_SPINDLE_STARTING: + /* Play spinup sound */ + if (samples->spindle_start_buffer && samples->spindle_start_samples > 0) { + float start_volume = samples->spindle_start_volume; + for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_start_samples; i++) { + float left_sample = (float) samples->spindle_start_buffer[spindle_transition_pos * 2] / 131072.0f * start_volume; + float right_sample = (float) samples->spindle_start_buffer[spindle_transition_pos * 2 + 1] / 131072.0f * start_volume; + float_buffer[i * 2] = left_sample; + float_buffer[i * 2 + 1] = right_sample; + spindle_transition_pos++; + } + if (spindle_transition_pos >= samples->spindle_start_samples) { + spindle_state = HDD_SPINDLE_RUNNING; + spindle_pos = 0; + pclog("HDD Audio: Spinup complete, now running\n"); + } + } else { + /* No start sample, go directly to running */ + spindle_state = HDD_SPINDLE_RUNNING; + spindle_pos = 0; + } + break; + + case HDD_SPINDLE_RUNNING: + /* Play spindle loop */ + if (samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { + float spindle_volume = samples->spindle_loop_volume; + for (int i = 0; i < frames_in_buffer; i++) { + float left_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2] / 131072.0f * spindle_volume; + float right_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2 + 1] / 131072.0f * spindle_volume; + float_buffer[i * 2] = left_sample; + float_buffer[i * 2 + 1] = right_sample; + + spindle_pos++; + if (spindle_pos >= samples->spindle_loop_samples) { + spindle_pos = 0; + } + } + } + break; + + case HDD_SPINDLE_STOPPING: + /* Play spindown sound */ + if (samples->spindle_stop_buffer && samples->spindle_stop_samples > 0) { + float stop_volume = samples->spindle_stop_volume; + for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_stop_samples; i++) { + float left_sample = (float) samples->spindle_stop_buffer[spindle_transition_pos * 2] / 131072.0f * stop_volume; + float right_sample = (float) samples->spindle_stop_buffer[spindle_transition_pos * 2 + 1] / 131072.0f * stop_volume; + float_buffer[i * 2] = left_sample; + float_buffer[i * 2 + 1] = right_sample; + spindle_transition_pos++; + } + if (spindle_transition_pos >= samples->spindle_stop_samples) { + spindle_state = HDD_SPINDLE_STOPPED; + pclog("HDD Audio: Spindown complete, now stopped\n"); + } + } else { + /* No stop sample, go directly to stopped */ + spindle_state = HDD_SPINDLE_STOPPED; + } + break; + + case HDD_SPINDLE_STOPPED: + default: + /* Silence - buffer already zeroed */ + break; } } - /* Seek sounds from profile */ - if (samples && samples->seek_buffer && samples->seek_samples > 0 && hdd_audio_mutex) { + /* Seek sounds from profile - only play when spindle is running */ + if (samples && samples->seek_buffer && samples->seek_samples > 0 && + hdd_audio_mutex && spindle_state == HDD_SPINDLE_RUNNING) { thread_wait_mutex(hdd_audio_mutex); for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { @@ -506,26 +634,78 @@ hdd_audio_callback(int16_t *buffer, int length) thread_release_mutex(hdd_audio_mutex); } } else { - /* Spindle sound from profile */ - if (samples && samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { - float spindle_volume = samples->spindle_volume; - for (int i = 0; i < frames_in_buffer; i++) { - buffer[i * 2] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2] * spindle_volume); - buffer[i * 2 + 1] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2 + 1] * spindle_volume); - - spindle_pos++; - if (spindle_pos >= samples->spindle_loop_samples) { - spindle_pos = 0; - } - } - } else { - for (int i = 0; i < length; i++) { - buffer[i] = 0; + /* Initialize buffer to silence */ + for (int i = 0; i < length; i++) { + buffer[i] = 0; + } + + /* Handle spindle states */ + if (samples) { + switch (spindle_state) { + case HDD_SPINDLE_STARTING: + /* Play spinup sound */ + if (samples->spindle_start_buffer && samples->spindle_start_samples > 0) { + float start_volume = samples->spindle_start_volume; + for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_start_samples; i++) { + buffer[i * 2] = (int16_t)(samples->spindle_start_buffer[spindle_transition_pos * 2] * start_volume); + buffer[i * 2 + 1] = (int16_t)(samples->spindle_start_buffer[spindle_transition_pos * 2 + 1] * start_volume); + spindle_transition_pos++; + } + if (spindle_transition_pos >= samples->spindle_start_samples) { + spindle_state = HDD_SPINDLE_RUNNING; + spindle_pos = 0; + pclog("HDD Audio: Spinup complete, now running\n"); + } + } else { + spindle_state = HDD_SPINDLE_RUNNING; + spindle_pos = 0; + } + break; + + case HDD_SPINDLE_RUNNING: + /* Play spindle loop */ + if (samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { + float spindle_volume = samples->spindle_loop_volume; + for (int i = 0; i < frames_in_buffer; i++) { + buffer[i * 2] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2] * spindle_volume); + buffer[i * 2 + 1] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2 + 1] * spindle_volume); + + spindle_pos++; + if (spindle_pos >= samples->spindle_loop_samples) { + spindle_pos = 0; + } + } + } + break; + + case HDD_SPINDLE_STOPPING: + /* Play spindown sound */ + if (samples->spindle_stop_buffer && samples->spindle_stop_samples > 0) { + float stop_volume = samples->spindle_stop_volume; + for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_stop_samples; i++) { + buffer[i * 2] = (int16_t)(samples->spindle_stop_buffer[spindle_transition_pos * 2] * stop_volume); + buffer[i * 2 + 1] = (int16_t)(samples->spindle_stop_buffer[spindle_transition_pos * 2 + 1] * stop_volume); + spindle_transition_pos++; + } + if (spindle_transition_pos >= samples->spindle_stop_samples) { + spindle_state = HDD_SPINDLE_STOPPED; + pclog("HDD Audio: Spindown complete, now stopped\n"); + } + } else { + spindle_state = HDD_SPINDLE_STOPPED; + } + break; + + case HDD_SPINDLE_STOPPED: + default: + /* Silence - buffer already zeroed */ + break; } } - /* Seek sounds from profile */ - if (samples && samples->seek_buffer && samples->seek_samples > 0 && hdd_audio_mutex) { + /* Seek sounds from profile - only play when spindle is running */ + if (samples && samples->seek_buffer && samples->seek_samples > 0 && + hdd_audio_mutex && spindle_state == HDD_SPINDLE_RUNNING) { thread_wait_mutex(hdd_audio_mutex); for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { diff --git a/src/include/86box/hdd_audio.h b/src/include/86box/hdd_audio.h index 8dfac0c00f6..2bb19a70e7e 100644 --- a/src/include/86box/hdd_audio.h +++ b/src/include/86box/hdd_audio.h @@ -24,6 +24,14 @@ extern "C" { #define HDD_AUDIO_PROFILE_MAX 64 +/* Spindle motor states */ +typedef enum { + HDD_SPINDLE_STOPPED = 0, + HDD_SPINDLE_STARTING, + HDD_SPINDLE_RUNNING, + HDD_SPINDLE_STOPPING +} hdd_spindle_state_t; + /* Audio sample configuration structure */ typedef struct { char filename[512]; @@ -57,6 +65,9 @@ extern void hdd_audio_reset(void); extern void hdd_audio_close(void); extern void hdd_audio_callback(int16_t *buffer, int length); extern void hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder); +extern void hdd_audio_spinup(void); +extern void hdd_audio_spindown(void); +extern hdd_spindle_state_t hdd_audio_get_spindle_state(void); #ifdef __cplusplus } From 72dac6148b19ce22aa1220c60ad56fb0bfa3be90 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 4 Jan 2026 17:14:10 +0600 Subject: [PATCH 211/320] Fix high CPU usage on keyboard status icon updates --- src/qt/qt_main.cpp | 1 + src/qt/qt_mainwindow.cpp | 16 +++++++++++----- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 5526eee37c0..1d362dd62e7 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -889,6 +889,7 @@ main(int argc, char *argv[]) QObject::connect(&discordupdate, &QTimer::timeout, &app, [] { discord_run_callbacks(); }); + discordupdate.setInterval(1000); if (enable_discord) discordupdate.start(1000); } diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index cce6d9c9580..35fd05491cc 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -238,20 +238,26 @@ MainWindow::MainWindow(QWidget *parent) QTimer *ledKeyboardTimer = new QTimer(this); ledKeyboardTimer->setTimerType(Qt::CoarseTimer); - ledKeyboardTimer->setInterval(1); + ledKeyboardTimer->setInterval(20); connect(ledKeyboardTimer, &QTimer::timeout, this, [this]() { + uint8_t prev_caps = 255, prev_num = 255, prev_scroll = 255, prev_kana = 255; uint8_t caps, num, scroll, kana; keyboard_get_states(&caps, &num, &scroll, &kana); - if (num_label->isVisible()) + if (num_label->isVisible() && prev_num != num) num_label->setPixmap(num ? this->num_icon.pixmap(QSize(16, 16)) : this->num_icon_off.pixmap(QSize(16, 16))); - if (caps_label->isVisible()) + if (caps_label->isVisible() && prev_caps != caps) caps_label->setPixmap(caps ? this->caps_icon.pixmap(QSize(16, 16)) : this->caps_icon_off.pixmap(QSize(16, 16))); - if (scroll_label->isVisible()) + if (scroll_label->isVisible() && prev_scroll != scroll) scroll_label->setPixmap(scroll ? this->scroll_icon.pixmap(QSize(16, 16)) : this->scroll_icon_off.pixmap(QSize(16, 16))); - if (kana_label->isVisible()) + if (kana_label->isVisible() && prev_kana != kana) kana_label->setPixmap(kana ? this->kana_icon.pixmap(QSize(16, 16)) : this->kana_icon_off.pixmap(QSize(16, 16))); + + prev_caps = caps; + prev_num = num; + prev_scroll = scroll; + prev_kana = kana; }); ledKeyboardTimer->start(); From 484b1eea3edcc28f8a20f4647a0a2e468733480c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Hrdli=C4=8Dka?= <13226155+dhrdlicka@users.noreply.github.com> Date: Sun, 4 Jan 2026 16:21:45 +0100 Subject: [PATCH 212/320] Add translation status badge to README [skip ci] Added translation status badge to README. --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 506eba7948e..736e66779af 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,10 @@ ===== [![Build Status](https://ci.86box.net/job/86Box/badge/icon)](https://ci.86box.net/job/86Box/) -[![License](https://img.shields.io/github/license/86Box/86Box)](COPYING) [![Latest release](https://img.shields.io/github/release/86Box/86Box.svg)](https://github.com/86Box/86Box/releases) [![Downloads](https://img.shields.io/github/downloads/86Box/86Box/total.svg)](https://github.com/86Box/86Box/releases) +[![License](https://img.shields.io/github/license/86Box/86Box)](COPYING) +[![Latest release](https://img.shields.io/github/release/86Box/86Box.svg)](https://github.com/86Box/86Box/releases) +[![Downloads](https://img.shields.io/github/downloads/86Box/86Box/total.svg)](https://github.com/86Box/86Box/releases) +[![Translation status](https://weblate.86box.net/widget/86box/86box/language-badge.svg)](https://weblate.86box.net/engage/86box/) **86Box** is a low level x86 emulator that runs older operating systems and software designed for IBM PC systems and compatibles from 1981 through fairly recent system designs based on the PCI bus. From 4bc8f65a9f53d2b6792368228e618bc6651dc8d9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 5 Jan 2026 00:36:32 +0600 Subject: [PATCH 213/320] Qt: Display names of internal sound/video devices when possible --- src/qt/qt_settingsdisplay.cpp | 3 +++ src/qt/qt_settingssound.cpp | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/qt/qt_settingsdisplay.cpp b/src/qt/qt_settingsdisplay.cpp index 6df4d5edc51..d5fbe77d5a1 100644 --- a/src/qt/qt_settingsdisplay.cpp +++ b/src/qt/qt_settingsdisplay.cpp @@ -106,6 +106,9 @@ SettingsDisplay::onCurrentMachineChanged(int machineId) } if (video_card_available(c) && device_is_valid(video_dev, machineId)) { + if (c == 1 && machine_get_vid_device(machineId)) { + name += QString(" (%1)").arg(DeviceConfig::DeviceName(machine_get_vid_device(machineId), machine_get_vid_device(machineId)->internal_name, 0)); + } int row = Models::AddEntry(model, name, c); if (c == curVideoCard) { selectedRow = row - removeRows; diff --git a/src/qt/qt_settingssound.cpp b/src/qt/qt_settingssound.cpp index 6307451a5b5..cb5368def8a 100644 --- a/src/qt/qt_settingssound.cpp +++ b/src/qt/qt_settingssound.cpp @@ -89,8 +89,8 @@ SettingsSound::onCurrentMachineChanged(const int machineId) c = 0; while (true) { - const QString name = DeviceConfig::DeviceName(sound_card_getdevice(c), - sound_card_get_internal_name(c), 1); + QString name = DeviceConfig::DeviceName(sound_card_getdevice(c), + sound_card_get_internal_name(c), 1); if (name.isEmpty()) break; @@ -99,6 +99,9 @@ SettingsSound::onCurrentMachineChanged(const int machineId) if (device_is_valid(sound_card_getdevice(c), machineId)) { for (uint8_t i = 0; i < SOUND_CARD_MAX; ++i) { if ((c != 1) || ((i == 0) && m_has_snd)) { + if (i == 0 && c == 1 && m_has_snd && machine_get_snd_device(machineId)) { + name += QString(" (%1)").arg(DeviceConfig::DeviceName(machine_get_snd_device(machineId), machine_get_snd_device(machineId)->internal_name, 0)); + } int row = Models::AddEntry(models[i], name, c); if (c == sound_card_current[i]) From 63014d47c182b842a2d75ad23262a2bccbd659d3 Mon Sep 17 00:00:00 2001 From: DimMan88 Date: Sat, 3 Jan 2026 14:04:51 +0000 Subject: [PATCH 214/320] Translated using Weblate (Greek) Currently translated at 80.7% (807 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/el/ --- src/qt/languages/el-GR.po | 374 +++++++++++++++++++------------------- 1 file changed, 189 insertions(+), 185 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index c9e9616777e..274cd10ac8b 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1,7 +1,7 @@ msgid "" msgstr "" -"PO-Revision-Date: 2026-01-02 21:56+0000\n" -"Last-Translator: Alexander Babikov \n" +"PO-Revision-Date: 2026-01-04 13:56+0000\n" +"Last-Translator: DimMan88 \n" "Language-Team: Greek \n" "Language: el-GR\n" "MIME-Version: 1.0\n" @@ -16,7 +16,7 @@ msgid "&Action" msgstr "&Ενέργειες" msgid "&Keyboard requires capture" -msgstr "&Το πληκτρολόγιο απαιτεί σύνδεση" +msgstr "&Το πληκτρολόγιο απαιτεί αγκίστρωση" msgid "&Right CTRL is left ALT" msgstr "&Αντιστοίχιση Right CTRL σε left ALT" @@ -532,7 +532,7 @@ msgid "Parallel port 4" msgstr "Παράλληλη θύρα 4" msgid "Floppy disk controller:" -msgstr "Controller δισκέτας floppy:" +msgstr "Ελεγκτής δισκέτας:" msgid "CD-ROM controller:" msgstr "Ελεγκτής CD-ROM:" @@ -544,7 +544,7 @@ msgid "[ISA16] Quaternary IDE Controller" msgstr "[ISA16] Τεταρτογενής Ελεγκτής IDE" msgid "Hard disk controllers" -msgstr "Controllers σκληρού δίσκου" +msgstr "Ελεγκτές σκληρού δίσκου" msgid "SCSI controllers" msgstr "Ελεγκτές SCSI" @@ -580,7 +580,7 @@ msgid "&Remove" msgstr "&Κατάργηση" msgid "Bus:" -msgstr "Bus:" +msgstr "Δίαυλος:" msgid "Channel:" msgstr "Κανάλι:" @@ -640,10 +640,10 @@ msgid "ISA RTC:" msgstr "ISA RTC:" msgid "ISA Memory Expansion" -msgstr "ISA Επέκταση Μνήμης" +msgstr "Επέκταση Μνήμης ISA" msgid "ISA ROM Cards" -msgstr "ISA κάρτες ROM" +msgstr "Κάρτες ROM ISA" msgid "Card 1:" msgstr "Κάρτα 1:" @@ -658,16 +658,16 @@ msgid "Card 4:" msgstr "Κάρτα 4:" msgid "Generic ISA ROM Board" -msgstr "Γενική ROM πλακέτα ISA" +msgstr "Γενική ISA ROM πλακέτα" msgid "Generic Dual ISA ROM Board" -msgstr "Γενική διπλή ROM πλακέτα ISA" +msgstr "Γενική Διπλή ISA ROM πλακέτα" msgid "Generic Quad ISA ROM Board" -msgstr "Γενική τετραπλή ROM πλακέτα ISA" +msgstr "Γενική Τετραπλή ISA ROM πλακέτα" msgid "ISABugger device" -msgstr "ISABugger device" +msgstr "Συσκευή ISABugger" msgid "POST card" msgstr "κάρτα POST" @@ -790,16 +790,16 @@ msgid "Other devices" msgstr "Άλλες συσκευές" msgid "Click to capture mouse" -msgstr "Κλικ για σύνδεση ποντικιού" +msgstr "Κλικ για αγκίστρωση ποντικιού" msgid "Press %1 to release mouse" -msgstr "Πατήσε %1 για απελευθέρωση ποντικιού" +msgstr "Πατήστε %1 για απαγκίστρωση ποντικιού" msgid "Press %1 or middle button to release mouse" -msgstr "Πατήσε %1 ή το μεσαίο κουμπί για απελευθέρωση ποντικιού" +msgstr "Πατήστε %1 ή το μεσαίο κουμπί για απαγκίστρωση ποντικιού" msgid "Bus" -msgstr "Bus" +msgstr "Δίαυλος" msgid "File" msgstr "Αρχείο" @@ -1698,7 +1698,7 @@ msgid "Host CD/DVD Drive (%1)" msgstr "Host CD/DVD Drive (%1)" msgid "Unknown Bus" -msgstr "Άγνωστο Bus" +msgstr "Άγνωστος δίαυλος" msgid "Null Driver" msgstr "Κενός Οδηγός" @@ -1737,10 +1737,10 @@ msgid "Browse…" msgstr "Αναζήτηση…" msgid "Couldn't create OpenGL context." -msgstr "" +msgstr "Αδυναμία δημιουργίας περιεχομένου OpenGL." msgid "Couldn't switch to OpenGL context." -msgstr "" +msgstr "Αδυναμία εναλλαγής σε περιεχόμενο OpenGL." msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" msgstr "Απαιτείται έκδοση OpenGL 3.0 ή νεότερη. Η τρέχουσα έκδοση είναι %1.%2" @@ -1755,6 +1755,10 @@ msgstr "" msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" msgstr "" +"

Όταν επιλέγετε εικόνες πολυμέσων (CD-ROM, δισκέτα κλπ.)" +", το παράθυρο διαλόγου ανοίγματος θα ξεκινήσει στον ίδιο κατάλογο με το " +"αρχείο διαμόρφωσης του 86Box. Αυτή η ρύθμιση πιθανότατα θα κάνει τη διαφορά " +"μόνο σε macOS.

" msgid "This machine might have been moved or copied." msgstr "Αυτή η μηχανή ίσως έχει μετακινηθεί ή αντιγραφεί." @@ -1884,376 +1888,376 @@ msgid "Default Baud rate" msgstr "Προεπιλεγμένος ρυθμός Baud" msgid "[COM] Standard Hayes-compliant Modem" -msgstr "" +msgstr "[COM] Τυπικό μόντεμ συμβατό με Hayes" msgid "Roland MT-32 Emulation" -msgstr "" +msgstr "Εξομοίωση Roland MT-32" msgid "Roland MT-32 (New) Emulation" -msgstr "" +msgstr "Εξομοίωση Roland MT-32 (Νέο)" msgid "Roland CM-32L Emulation" -msgstr "" +msgstr "Εξομοίωση Roland CM-32L" msgid "Roland CM-32LN Emulation" -msgstr "" +msgstr "Εξομοίωση Roland CM-32LN" msgid "OPL4-ML Daughterboard" -msgstr "" +msgstr "Θυγατρική κάρτα OPL4-ML" msgid "System MIDI" -msgstr "" +msgstr "MIDI συστήματος" msgid "MIDI Input Device" -msgstr "" +msgstr "Συσκευή Εισαγωγής MIDI" msgid "BIOS file" -msgstr "" +msgstr "Αρχείο BIOS" msgid "BIOS file (ROM #1)" -msgstr "" +msgstr "Αρχείο BIOS (ROM #1)" msgid "BIOS file (ROM #2)" -msgstr "" +msgstr "Αρχείο BIOS (ROM #2)" msgid "BIOS file (ROM #3)" -msgstr "" +msgstr "Αρχείο BIOS (ROM #3)" msgid "BIOS file (ROM #4)" -msgstr "" +msgstr "Αρχείο BIOS (ROM #4)" msgid "BIOS address" -msgstr "" +msgstr "Διεύθυνση BIOS" msgid "BIOS address (ROM #1)" -msgstr "" +msgstr "Διεύθυνση BIOS (ROM #1)" msgid "BIOS address (ROM #2)" -msgstr "" +msgstr "Διεύθυνση BIOS (ROM #2)" msgid "BIOS address (ROM #3)" -msgstr "" +msgstr "Διεύθυνση BIOS (ROM #3)" msgid "BIOS address (ROM #4)" -msgstr "" +msgstr "Διεύθυνση BIOS (ROM #4)" msgid "Enable BIOS extension ROM Writes" -msgstr "" +msgstr "Ενεργοποίηση επέκτασης BIOS εγγραφών ROM" msgid "Enable BIOS extension ROM Writes (ROM #1)" -msgstr "" +msgstr "Ενεργοποίηση επέκτασης BIOS εγγραφών ROM (ROM #1)" msgid "Enable BIOS extension ROM Writes (ROM #2)" -msgstr "" +msgstr "Ενεργοποίηση επέκτασης BIOS εγγραφών ROM (ROM #2)" msgid "Enable BIOS extension ROM Writes (ROM #3)" -msgstr "" +msgstr "Ενεργοποίηση επέκτασης BIOS εγγραφών ROM (ROM #3)" msgid "Enable BIOS extension ROM Writes (ROM #4)" -msgstr "" +msgstr "Ενεργοποίηση επέκτασης BIOS εγγραφών ROM (ROM #4)" msgid "Linear framebuffer base" -msgstr "" +msgstr "Βάση γραμμικού framebuffer" msgid "Address" -msgstr "" +msgstr "Διεύθυνση" msgid "IRQ" -msgstr "" +msgstr "IRQ" msgid "Serial port IRQ" -msgstr "" +msgstr "IRQ σειριακής θύρας" msgid "Parallel port IRQ" -msgstr "" +msgstr "IRQ παράλληλης θύρας" msgid "Hard disk" msgstr "Σκληρός δίσκος" msgid "BIOS Revision" -msgstr "" +msgstr "Αναθεώρηση BIOS" msgid "BIOS Version" -msgstr "" +msgstr "Έκδοση BIOS" msgid "BIOS Language" -msgstr "" +msgstr "Γλώσσα BIOS" msgid "IBM 5161 Expansion Unit" -msgstr "" +msgstr "Επέκταση μονάδας IBM 5161" msgid "IBM Cassette Basic" -msgstr "" +msgstr "IBM Cassette Basic" msgid "Translate 26 -> 17" -msgstr "" +msgstr "Μετάφρασε 26 -> 17" msgid "Language" -msgstr "" +msgstr "Γλώσσα" msgid "Enable backlight" -msgstr "" +msgstr "Ενεργοποίηση οπίσθιου φωτισμού" msgid "Invert colors" -msgstr "" +msgstr "Αντιστροφή χρωμάτων" msgid "BIOS size" -msgstr "" +msgstr "Μέγεθος BIOS" msgid "BIOS size (ROM #1)" -msgstr "" +msgstr "Μέγεθος BIOS (ROM #1)" msgid "BIOS size (ROM #2)" -msgstr "" +msgstr "Μέγεθος BIOS (ROM #2)" msgid "BIOS size (ROM #3)" -msgstr "" +msgstr "Μέγεθος BIOS (ROM #3)" msgid "BIOS size (ROM #4)" -msgstr "" +msgstr "Μέγεθος BIOS (ROM #4)" msgid "Map C0000-C7FFF as UMB" -msgstr "" +msgstr "Ορισμός C0000-C7FFF ως UMB" msgid "Map C8000-CFFFF as UMB" -msgstr "" +msgstr "Ορισμός C8000-CFFFF ως UMB" msgid "Map D0000-D7FFF as UMB" -msgstr "" +msgstr "Ορισμός D0000-D7FFF ως UMB" msgid "Map D8000-DFFFF as UMB" -msgstr "" +msgstr "Ορισμός D8000-DFFFF ως UMB" msgid "Map E0000-E7FFF as UMB" -msgstr "" +msgstr "Ορισμός E0000-E7FFF ως UMB" msgid "Map E8000-EFFFF as UMB" -msgstr "" +msgstr "Ορισμός E8000-EFFFF ως UMB" msgid "JS9 Jumper (JIM)" -msgstr "" +msgstr "JS9 Jumper (JIM)" msgid "MIDI Output Device" -msgstr "" +msgstr "Συσκευή Εξόδου MIDI" msgid "MIDI Real time" -msgstr "" +msgstr "MIDI Πραγματικού χρόνου" msgid "MIDI Thru" -msgstr "" +msgstr "MIDI Thru" msgid "MIDI Clockout" -msgstr "" +msgstr "MIDI Clockout" msgid "Output Gain" -msgstr "" +msgstr "Ενίσχυση Έντασης" msgid "Chorus" -msgstr "" +msgstr "Chorus" msgid "Chorus Voices" -msgstr "" +msgstr "Chorus Voices" msgid "Chorus Level" -msgstr "" +msgstr "Επίπεδο Chorus" msgid "Chorus Speed" -msgstr "" +msgstr "Ταχύτητα Chorus" msgid "Chorus Depth" -msgstr "" +msgstr "Βάθος Chorus" msgid "Chorus Waveform" -msgstr "" +msgstr "Chorus Waveform" msgid "Reverb" -msgstr "" +msgstr "Reverb" msgid "Reverb Room Size" -msgstr "" +msgstr "Μέγεθος Δωματίου Reverb" msgid "Reverb Damping" -msgstr "" +msgstr "Απόσβεση Reverb" msgid "Reverb Width" -msgstr "" +msgstr "Πλάτος Reverb" msgid "Reverb Level" -msgstr "" +msgstr "Επίπεδο Reverb" msgid "Interpolation Method" -msgstr "" +msgstr "Μέθοδος παρεμβολής" msgid "Dynamic Sample Loading" -msgstr "" +msgstr "Φόρτωση Δυναμικού Δείγματος" msgid "Reverb Output Gain" -msgstr "" +msgstr "Ενίσχυση Εξόδου Reverb" msgid "Reversed stereo" -msgstr "" +msgstr "Αντίστροφο Στέρεο" msgid "Nice ramp" -msgstr "" +msgstr "Ωραία ράμπα" msgid "Hz" -msgstr "" +msgstr "Hz" msgid "Buttons" -msgstr "" +msgstr "Κουμπιά" msgid "Serial Port" -msgstr "" +msgstr "Σειριακή θύρα" msgid "RTS toggle" -msgstr "" +msgstr "RTS toggle" msgid "Revision" -msgstr "" +msgstr "Αναθεώρηση" msgid "Controller" -msgstr "" +msgstr "Controller" msgid "Show Crosshair" -msgstr "" +msgstr "Εμφάνιση στόχαστρου" msgid "DMA" -msgstr "" +msgstr "DMA" msgid "MAC Address" -msgstr "" +msgstr "Διεύθυνση MAC" msgid "MAC Address OUI" -msgstr "" +msgstr "Διεύθυνση MAC OUI" msgid "Enable BIOS" -msgstr "" +msgstr "Ενεργοποίηση BIOS" msgid "Baud Rate" -msgstr "" +msgstr "Τιμή Baud" msgid "TCP/IP listening port" -msgstr "" +msgstr "Θύρα ακρόασης TCP/IP" msgid "Phonebook File" -msgstr "" +msgstr "Αρχείο Τηλεφωνικού καταλόγου" msgid "Telnet emulation" -msgstr "" +msgstr "Εξομοίωση Telnet" msgid "RAM Address" -msgstr "" +msgstr "Διεύθυνση RAM" msgid "RAM size" -msgstr "" +msgstr "Μέγεθος RAM" msgid "Initial RAM size" -msgstr "" +msgstr "Αρχικό μέγεθος RAM" msgid "Serial Number" -msgstr "" +msgstr "Σειριακός Αριθμός" msgid "Host ID" -msgstr "" +msgstr "ID οικοδεσπότη" msgid "FDC Address" -msgstr "" +msgstr "Διεύθυνση FDC" msgid "MPU-401 Address" -msgstr "" +msgstr "Διεύθυνση MPU-401" msgid "MPU-401 IRQ" -msgstr "" +msgstr "MPU-401 IRQ" msgid "Receive MIDI input" -msgstr "" +msgstr "Λήψη εισαγωγής MIDI" msgid "Low DMA" -msgstr "" +msgstr "Χαμηλό DMA" msgid "Enable Game port" -msgstr "" +msgstr "Ενεργοποίηση Game port" msgid "Enable Adlib ports" -msgstr "" +msgstr "Ενεργοποίηση θυρών Adlib" msgid "SID Model" -msgstr "" +msgstr "Μοντέλο SID" msgid "SID Filter Strength" -msgstr "" +msgstr "Ισχύς Φίλτρου SID" msgid "Surround module" -msgstr "" +msgstr "Μονάδα Surround" msgid "SB Address" -msgstr "" +msgstr "Διεύθυνση SB" msgid "Adlib Address" -msgstr "" +msgstr "Διεύθυνση Adlib" msgid "Use EEPROM setting" -msgstr "" +msgstr "Χρήση ρύθμισης EEPROM" msgid "WSS IRQ" -msgstr "" +msgstr "WSS IRQ" msgid "WSS DMA" -msgstr "" +msgstr "WSS DMA" msgid "RTC IRQ" -msgstr "" +msgstr "RTC IRQ" msgid "RTC Port Address" -msgstr "" +msgstr "Διεύθυνση Θύρας RTC" msgid "Onboard RTC" -msgstr "" +msgstr "Ενσωματωμένο RTC" msgid "Not installed" -msgstr "" +msgstr "Μη εγκατεστημένο" msgid "Enable OPL" -msgstr "" +msgstr "Ενεργοποίηση OPL" msgid "Receive MIDI input (MPU-401)" -msgstr "" +msgstr "Λήψη εισαγωγής MIDI (MPU-401)" msgid "SB low DMA" -msgstr "" +msgstr "χαμηλό DMA της SB" msgid "6CH variant (6-channel)" -msgstr "" +msgstr "Παραλλαγή 6CH (6-κάναλο)" msgid "Enable CMS" -msgstr "" +msgstr "Ενεργοποίηση CMS" msgid "Mixer" -msgstr "" +msgstr "Μίκτης" msgid "High DMA" -msgstr "" +msgstr "Υψηλό DMA" msgid "Control PC speaker" -msgstr "" +msgstr "Έλεγχος ηχείου PC" msgid "Memory size" -msgstr "" +msgstr "Μέγεθος μνήμης" msgid "EMU8000 Address" -msgstr "" +msgstr "Διεύθυνση EMU8000" msgid "IDE Controller" -msgstr "" +msgstr "Ελεγκτής IDE" msgid "Codec" -msgstr "" +msgstr "Codec" msgid "GUS type" -msgstr "" +msgstr "Τύπος GUS" msgid "Enable 0x04 \"Exit 86Box\" command" -msgstr "" +msgstr "Ενεργοποίηση εντολής 0x04 \"Έξοδος 86Box\"" msgid "Display type" msgstr "Τύπος εμφάνισης" @@ -2262,127 +2266,127 @@ msgid "Composite type" msgstr "Τύπος Composite" msgid "RGB type" -msgstr "" +msgstr "Τύπος RGB" msgid "Line doubling type" msgstr "Τύπος line doubling" msgid "Snow emulation" -msgstr "" +msgstr "Εξομοίωση εφέ \"χιονιού\"" msgid "Monitor type" -msgstr "" +msgstr "Τύπος οθόνης" msgid "Character set" -msgstr "" +msgstr "Σετ χαρακτήρων" msgid "XGA type" -msgstr "" +msgstr "Τύπος XGA" msgid "Instance" -msgstr "" +msgstr "Παράδειγμα" msgid "MMIO Address" -msgstr "" +msgstr "Διεύθυνση MMIO" msgid "RAMDAC type" -msgstr "" +msgstr "Τύπος RAMDAC" msgid "Blend" -msgstr "" +msgstr "Ανάμιξη" msgid "Font" -msgstr "" +msgstr "Γραμματοσειρά" msgid "Bilinear filtering" -msgstr "" +msgstr "Διγραμμικό φίλτρο" msgid "Video chroma-keying" -msgstr "" +msgstr "Video chroma-keying" msgid "Dithering" -msgstr "" +msgstr "Χρωματική αντιπαράθεση" msgid "Enable NMI for CGA emulation" -msgstr "" +msgstr "Ενεργοποίηση NMI για εξομοίωση CGA" msgid "Voodoo type" -msgstr "" +msgstr "Τύπος Voodoo" msgid "Framebuffer memory size" -msgstr "" +msgstr "Μέγεθος μνήμης Framebuffer" msgid "Texture memory size" -msgstr "" +msgstr "Μέγεθος μνήμης υφών" msgid "Dither subtraction" -msgstr "" +msgstr "Αφαίρεση τρέμουλου" msgid "Screen Filter" -msgstr "" +msgstr "Φίλτρο οθόνης" msgid "Render threads" -msgstr "" +msgstr "Νήματα απεικονιστή" msgid "SLI" -msgstr "" +msgstr "SLI" msgid "Start Address" -msgstr "" +msgstr "Διεύθυνση εκκίνησης" msgid "Contiguous Size" -msgstr "" +msgstr "Μέγεθος συνέχειας" msgid "I/O Width" -msgstr "" +msgstr "Πλάτος I/O" msgid "Transfer Speed" -msgstr "" +msgstr "Ταχύτητα Μεταφοράς" msgid "EMS mode" -msgstr "" +msgstr "Τύπος EMS" msgid "EMS Address" -msgstr "" +msgstr "Διεύθυνση EMS" msgid "EMS 1 Address" -msgstr "" +msgstr "Διεύθυνση EMS 1" msgid "EMS 2 Address" -msgstr "" +msgstr "Διεύθυνση EMS 2" msgid "EMS Memory Size" -msgstr "" +msgstr "Μέγεθος μνήμης EMS" msgid "EMS 1 Memory Size" -msgstr "" +msgstr "Μέγεθος μνήμης EMS 1" msgid "EMS 2 Memory Size" -msgstr "" +msgstr "Μέγεθος μνήμης EMS 2" msgid "Enable EMS" -msgstr "" +msgstr "Ενεργοποίηση EMS" msgid "Enable EMS 1" -msgstr "" +msgstr "Ενεργοποίηση EMS 1" msgid "Enable EMS 2" -msgstr "" +msgstr "Ενεργοποίηση EMS 2" msgid "Address for > 2 MB" -msgstr "" +msgstr "Διεύθυνση για > 2 MB" msgid "Frame Address" -msgstr "" +msgstr "Διεύθυνση πλαισίου" msgid "USA" -msgstr "" +msgstr "ΗΠΑ" msgid "Danish" -msgstr "" +msgstr "Δανικά" msgid "Always at selected speed" -msgstr "" +msgstr "Πάντα στην επιλεγμένη ταχύτητα" msgid "BIOS setting + Hotkeys (off during POST)" msgstr "" @@ -2718,7 +2722,7 @@ msgid "[Generic] 2000 (7200 RPM)" msgstr "" msgid "IBM 8514/A clone (ISA)" -msgstr "" +msgstr "Κλώνος IBM 8514/A (ISA)" msgid "Vendor" msgstr "" @@ -2874,10 +2878,10 @@ msgid "Hostname:" msgstr "" msgid "ISA RAM:" -msgstr "" +msgstr "ISA RAM:" msgid "ISA ROM:" -msgstr "" +msgstr "ISA ROM:" msgid "&Wipe NVRAM" msgstr "" From 4b86bcc2bf7201d5b24a9a352d9a19c1c64c1204 Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 4 Jan 2026 21:35:59 +0200 Subject: [PATCH 215/320] Multiple HDD drive sounds support --- src/disk/hdd_audio.c | 799 ++++++++++++++++++++++------------ src/include/86box/hdd_audio.h | 7 + 2 files changed, 516 insertions(+), 290 deletions(-) diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index af93a334cb6..9098adf7839 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -29,15 +29,29 @@ #include <86box/mem.h> #include <86box/rom.h> -/* Maximum number of simultaneous seek sounds */ -#define HDD_MAX_SEEK_VOICES 8 +/* Maximum number of simultaneous seek sounds per HDD */ +#define HDD_MAX_SEEK_VOICES_PER_HDD 8 + +/* Maximum number of HDDs with audio emulation */ +#define HDD_AUDIO_MAX_DRIVES 8 typedef struct { int active; int position; float volume; + int profile_id; /* Which profile's seek sound to use */ } hdd_seek_voice_t; +/* Per-HDD audio state */ +typedef struct { + int hdd_index; /* Index into hdd[] array */ + int profile_id; /* Audio profile ID */ + hdd_spindle_state_t spindle_state; + int spindle_pos; + int spindle_transition_pos; + hdd_seek_voice_t seek_voices[HDD_MAX_SEEK_VOICES_PER_HDD]; +} hdd_audio_drive_state_t; + /* Audio samples structure for a profile */ typedef struct { int16_t *spindle_start_buffer; @@ -62,16 +76,11 @@ static int audio_profile_count = 0; /* Per-profile loaded samples */ static hdd_audio_samples_t profile_samples[HDD_AUDIO_PROFILE_MAX]; -/* Active profile for audio playback (first HDD with valid profile) */ -static int active_audio_profile = 0; +/* Per-HDD audio states */ +static hdd_audio_drive_state_t drive_states[HDD_AUDIO_MAX_DRIVES]; +static int active_drive_count = 0; -static hdd_seek_voice_t hdd_seek_voices[HDD_MAX_SEEK_VOICES]; -static mutex_t *hdd_audio_mutex = NULL; - -/* Spindle motor state */ -static hdd_spindle_state_t spindle_state = HDD_SPINDLE_STOPPED; -static int spindle_pos = 0; -static int spindle_transition_pos = 0; /* Position in start/stop sample */ +static mutex_t *hdd_audio_mutex = NULL; /* Load audio profiles from configuration file */ void @@ -301,45 +310,68 @@ hdd_audio_load_profile_samples(int profile_id) samples->loaded = 1; } +/* Find drive state for a given HDD index, or NULL if not tracked */ +static hdd_audio_drive_state_t * +hdd_audio_find_drive_state(int hdd_index) +{ + for (int i = 0; i < active_drive_count; i++) { + if (drive_states[i].hdd_index == hdd_index) + return &drive_states[i]; + } + return NULL; +} + void hdd_audio_init(void) { /* Initialize profile samples */ memset(profile_samples, 0, sizeof(profile_samples)); + memset(drive_states, 0, sizeof(drive_states)); + active_drive_count = 0; pclog("HDD Audio Init: audio_profile_count=%d\n", audio_profile_count); - /* Find first HDD with a valid audio profile and load its samples */ - active_audio_profile = 0; - for (int i = 0; i < HDD_NUM; i++) { - if (hdd[i].bus_type != HDD_BUS_DISABLED) { + /* Create mutex BEFORE loading samples or calling spinup */ + if (!hdd_audio_mutex) + hdd_audio_mutex = thread_create_mutex(); + + /* Find all HDDs with valid audio profiles and initialize their states */ + for (int i = 0; i < HDD_NUM && active_drive_count < HDD_AUDIO_MAX_DRIVES; i++) { + if (hdd[i].bus_type != HDD_BUS_DISABLED && hdd[i].audio_profile > 0) { pclog("HDD Audio Init: HDD %d bus_type=%d audio_profile=%d\n", i, hdd[i].bus_type, hdd[i].audio_profile); - if (hdd[i].audio_profile > 0) { - active_audio_profile = hdd[i].audio_profile; - pclog("HDD Audio: Using profile %d from HDD %d\n", active_audio_profile, i); - break; + + hdd_audio_drive_state_t *state = &drive_states[active_drive_count]; + state->hdd_index = i; + state->profile_id = hdd[i].audio_profile; + state->spindle_state = HDD_SPINDLE_STOPPED; + state->spindle_pos = 0; + state->spindle_transition_pos = 0; + + /* Initialize seek voices for this drive */ + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + state->seek_voices[v].active = 0; + state->seek_voices[v].position = 0; + state->seek_voices[v].volume = 1.0f; + state->seek_voices[v].profile_id = state->profile_id; } + + /* Load samples for this profile if not already loaded */ + hdd_audio_load_profile_samples(state->profile_id); + + pclog("HDD Audio: Initialized drive %d with profile %d (%s)\n", + i, state->profile_id, + hdd_audio_get_profile_name(state->profile_id)); + + active_drive_count++; } } - pclog("HDD Audio Init: active_audio_profile=%d\n", active_audio_profile); + pclog("HDD Audio Init: %d active drives with audio\n", active_drive_count); - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { - hdd_seek_voices[i].active = 0; - hdd_seek_voices[i].position = 0; - hdd_seek_voices[i].volume = 1.0f; - } - - /* Create mutex BEFORE loading samples or calling spinup */ - if (!hdd_audio_mutex) - hdd_audio_mutex = thread_create_mutex(); - - /* Load samples for the active profile */ - if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { - hdd_audio_load_profile_samples(active_audio_profile); - /* Start spindle motor */ - hdd_audio_spinup(); + /* Start spindle motors for all active drives */ + for (int i = 0; i < active_drive_count; i++) { + hdd_audio_spinup_drive(drive_states[i].hdd_index); } sound_hdd_thread_init(); @@ -354,20 +386,18 @@ hdd_audio_reset(void) if (hdd_audio_mutex) thread_wait_mutex(hdd_audio_mutex); - /* Reset spindle state first to stop audio playback */ - spindle_state = HDD_SPINDLE_STOPPED; - spindle_pos = 0; - spindle_transition_pos = 0; - - /* Reset seek voices */ - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { - hdd_seek_voices[i].active = 0; - hdd_seek_voices[i].position = 0; - hdd_seek_voices[i].volume = 1.0f; + /* Reset all drive states */ + for (int i = 0; i < active_drive_count; i++) { + drive_states[i].spindle_state = HDD_SPINDLE_STOPPED; + drive_states[i].spindle_pos = 0; + drive_states[i].spindle_transition_pos = 0; + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + drive_states[i].seek_voices[v].active = 0; + drive_states[i].seek_voices[v].position = 0; + drive_states[i].seek_voices[v].volume = 1.0f; + } } - - /* Reset active profile before freeing buffers */ - active_audio_profile = 0; + active_drive_count = 0; /* Free previously loaded samples (but keep profiles) */ for (int i = 0; i < HDD_AUDIO_PROFILE_MAX; i++) { @@ -393,23 +423,42 @@ hdd_audio_reset(void) if (hdd_audio_mutex) thread_release_mutex(hdd_audio_mutex); - /* Find new active profile from current HDD configuration */ - for (int i = 0; i < HDD_NUM; i++) { - if (hdd[i].bus_type != HDD_BUS_DISABLED) { + /* Find all HDDs with valid audio profiles and initialize their states */ + for (int i = 0; i < HDD_NUM && active_drive_count < HDD_AUDIO_MAX_DRIVES; i++) { + if (hdd[i].bus_type != HDD_BUS_DISABLED && hdd[i].audio_profile > 0) { pclog("HDD Audio Reset: HDD %d audio_profile=%d\n", i, hdd[i].audio_profile); - if (hdd[i].audio_profile > 0) { - active_audio_profile = hdd[i].audio_profile; - pclog("HDD Audio: Reset with profile %d from HDD %d\n", active_audio_profile, i); - break; + + hdd_audio_drive_state_t *state = &drive_states[active_drive_count]; + state->hdd_index = i; + state->profile_id = hdd[i].audio_profile; + state->spindle_state = HDD_SPINDLE_STOPPED; + state->spindle_pos = 0; + state->spindle_transition_pos = 0; + + /* Initialize seek voices for this drive */ + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + state->seek_voices[v].active = 0; + state->seek_voices[v].position = 0; + state->seek_voices[v].volume = 1.0f; + state->seek_voices[v].profile_id = state->profile_id; } + + /* Load samples for this profile if not already loaded */ + hdd_audio_load_profile_samples(state->profile_id); + + pclog("HDD Audio: Reset drive %d with profile %d (%s)\n", + i, state->profile_id, + hdd_audio_get_profile_name(state->profile_id)); + + active_drive_count++; } } - /* Load samples for the active profile */ - if (active_audio_profile > 0 && active_audio_profile < audio_profile_count) { - hdd_audio_load_profile_samples(active_audio_profile); - /* Start spindle motor */ - hdd_audio_spinup(); + pclog("HDD Audio Reset: %d active drives with audio\n", active_drive_count); + + /* Start spindle motors for all active drives */ + for (int i = 0; i < active_drive_count; i++) { + hdd_audio_spinup_drive(drive_states[i].hdd_index); } } @@ -421,10 +470,20 @@ hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) if (cylinder_diff == 0) return; - /* Use the drive's audio profile, fallback to active profile */ - int profile_id = hdd_drive->audio_profile; - if (profile_id == 0) - profile_id = active_audio_profile; + /* Find the drive state for this HDD */ + hdd_audio_drive_state_t *drive_state = NULL; + for (int i = 0; i < active_drive_count; i++) { + if (&hdd[drive_states[i].hdd_index] == hdd_drive) { + drive_state = &drive_states[i]; + break; + } + } + + /* If no drive state found, drive has no audio profile */ + if (!drive_state) + return; + + int profile_id = drive_state->profile_id; /* No audio profile selected */ if (profile_id == 0 || profile_id >= audio_profile_count) @@ -450,9 +509,10 @@ hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) thread_wait_mutex(hdd_audio_mutex); - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { - if (hdd_seek_voices[i].active) { - int pos = hdd_seek_voices[i].position; + /* Check if we should skip due to minimum spacing (per-drive) */ + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + if (drive_state->seek_voices[v].active) { + int pos = drive_state->seek_voices[v].position; if (pos >= 0 && pos < min_seek_spacing) { thread_release_mutex(hdd_audio_mutex); return; @@ -460,11 +520,13 @@ hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) } } - for (int i = 0; i < HDD_MAX_SEEK_VOICES; i++) { - if (!hdd_seek_voices[i].active) { - hdd_seek_voices[i].active = 1; - hdd_seek_voices[i].position = 0; - hdd_seek_voices[i].volume = samples->seek_volume; + /* Find a free seek voice for this drive */ + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + if (!drive_state->seek_voices[v].active) { + drive_state->seek_voices[v].active = 1; + drive_state->seek_voices[v].position = 0; + drive_state->seek_voices[v].volume = samples->seek_volume; + drive_state->seek_voices[v].profile_id = profile_id; thread_release_mutex(hdd_audio_mutex); return; } @@ -473,42 +535,400 @@ hdd_audio_seek(hard_disk_t *hdd_drive, uint32_t new_cylinder) thread_release_mutex(hdd_audio_mutex); } +/* Spinup a specific drive by HDD index */ void -hdd_audio_spinup(void) +hdd_audio_spinup_drive(int hdd_index) { - if (spindle_state == HDD_SPINDLE_RUNNING || spindle_state == HDD_SPINDLE_STARTING) + hdd_audio_drive_state_t *state = hdd_audio_find_drive_state(hdd_index); + if (!state) + return; + + if (state->spindle_state == HDD_SPINDLE_RUNNING || state->spindle_state == HDD_SPINDLE_STARTING) return; - pclog("HDD Audio: Spinup requested (current state: %d)\n", spindle_state); + pclog("HDD Audio: Spinup requested for drive %d (current state: %d)\n", hdd_index, state->spindle_state); if (hdd_audio_mutex) thread_wait_mutex(hdd_audio_mutex); - spindle_state = HDD_SPINDLE_STARTING; - spindle_transition_pos = 0; + state->spindle_state = HDD_SPINDLE_STARTING; + state->spindle_transition_pos = 0; if (hdd_audio_mutex) thread_release_mutex(hdd_audio_mutex); } +/* Spindown a specific drive by HDD index */ void -hdd_audio_spindown(void) +hdd_audio_spindown_drive(int hdd_index) { - if (spindle_state == HDD_SPINDLE_STOPPED || spindle_state == HDD_SPINDLE_STOPPING) + hdd_audio_drive_state_t *state = hdd_audio_find_drive_state(hdd_index); + if (!state) + return; + + if (state->spindle_state == HDD_SPINDLE_STOPPED || state->spindle_state == HDD_SPINDLE_STOPPING) return; - pclog("HDD Audio: Spindown requested (current state: %d)\n", spindle_state); + pclog("HDD Audio: Spindown requested for drive %d (current state: %d)\n", hdd_index, state->spindle_state); if (hdd_audio_mutex) thread_wait_mutex(hdd_audio_mutex); - spindle_state = HDD_SPINDLE_STOPPING; - spindle_transition_pos = 0; + state->spindle_state = HDD_SPINDLE_STOPPING; + state->spindle_transition_pos = 0; if (hdd_audio_mutex) thread_release_mutex(hdd_audio_mutex); } +/* Legacy functions for backward compatibility - operate on all drives */ +void +hdd_audio_spinup(void) +{ + for (int i = 0; i < active_drive_count; i++) { + hdd_audio_spinup_drive(drive_states[i].hdd_index); + } +} + +void +hdd_audio_spindown(void) +{ + for (int i = 0; i < active_drive_count; i++) { + hdd_audio_spindown_drive(drive_states[i].hdd_index); + } +} + hdd_spindle_state_t hdd_audio_get_spindle_state(void) { - return spindle_state; + /* Return running if any drive is running */ + for (int i = 0; i < active_drive_count; i++) { + if (drive_states[i].spindle_state == HDD_SPINDLE_RUNNING) + return HDD_SPINDLE_RUNNING; + } + for (int i = 0; i < active_drive_count; i++) { + if (drive_states[i].spindle_state == HDD_SPINDLE_STARTING) + return HDD_SPINDLE_STARTING; + } + for (int i = 0; i < active_drive_count; i++) { + if (drive_states[i].spindle_state == HDD_SPINDLE_STOPPING) + return HDD_SPINDLE_STOPPING; + } + return HDD_SPINDLE_STOPPED; +} + +hdd_spindle_state_t +hdd_audio_get_drive_spindle_state(int hdd_index) +{ + hdd_audio_drive_state_t *state = hdd_audio_find_drive_state(hdd_index); + if (!state) + return HDD_SPINDLE_STOPPED; + return state->spindle_state; +} + +/* Helper: Mix spindle start sound into float buffer */ +static void +hdd_audio_mix_spindle_start_float(hdd_audio_drive_state_t *state, hdd_audio_samples_t *samples, + float *float_buffer, int frames_in_buffer) +{ + if (!samples->spindle_start_buffer || samples->spindle_start_samples <= 0) { + state->spindle_state = HDD_SPINDLE_RUNNING; + state->spindle_pos = 0; + return; + } + + float start_volume = samples->spindle_start_volume; + for (int i = 0; i < frames_in_buffer && state->spindle_transition_pos < samples->spindle_start_samples; i++) { + float left_sample = (float) samples->spindle_start_buffer[state->spindle_transition_pos * 2] / 131072.0f * start_volume; + float right_sample = (float) samples->spindle_start_buffer[state->spindle_transition_pos * 2 + 1] / 131072.0f * start_volume; + float_buffer[i * 2] += left_sample; + float_buffer[i * 2 + 1] += right_sample; + state->spindle_transition_pos++; + } + + if (state->spindle_transition_pos >= samples->spindle_start_samples) { + state->spindle_state = HDD_SPINDLE_RUNNING; + state->spindle_pos = 0; + pclog("HDD Audio: Drive %d spinup complete, now running\n", state->hdd_index); + } +} + +/* Helper: Mix spindle loop sound into float buffer */ +static void +hdd_audio_mix_spindle_loop_float(hdd_audio_drive_state_t *state, hdd_audio_samples_t *samples, + float *float_buffer, int frames_in_buffer) +{ + if (!samples->spindle_loop_buffer || samples->spindle_loop_samples <= 0) + return; + + float spindle_volume = samples->spindle_loop_volume; + for (int i = 0; i < frames_in_buffer; i++) { + float left_sample = (float) samples->spindle_loop_buffer[state->spindle_pos * 2] / 131072.0f * spindle_volume; + float right_sample = (float) samples->spindle_loop_buffer[state->spindle_pos * 2 + 1] / 131072.0f * spindle_volume; + float_buffer[i * 2] += left_sample; + float_buffer[i * 2 + 1] += right_sample; + + state->spindle_pos++; + if (state->spindle_pos >= samples->spindle_loop_samples) { + state->spindle_pos = 0; + } + } +} + +/* Helper: Mix spindle stop sound into float buffer */ +static void +hdd_audio_mix_spindle_stop_float(hdd_audio_drive_state_t *state, hdd_audio_samples_t *samples, + float *float_buffer, int frames_in_buffer) +{ + if (!samples->spindle_stop_buffer || samples->spindle_stop_samples <= 0) { + state->spindle_state = HDD_SPINDLE_STOPPED; + return; + } + + float stop_volume = samples->spindle_stop_volume; + for (int i = 0; i < frames_in_buffer && state->spindle_transition_pos < samples->spindle_stop_samples; i++) { + float left_sample = (float) samples->spindle_stop_buffer[state->spindle_transition_pos * 2] / 131072.0f * stop_volume; + float right_sample = (float) samples->spindle_stop_buffer[state->spindle_transition_pos * 2 + 1] / 131072.0f * stop_volume; + float_buffer[i * 2] += left_sample; + float_buffer[i * 2 + 1] += right_sample; + state->spindle_transition_pos++; + } + + if (state->spindle_transition_pos >= samples->spindle_stop_samples) { + state->spindle_state = HDD_SPINDLE_STOPPED; + pclog("HDD Audio: Drive %d spindown complete, now stopped\n", state->hdd_index); + } +} + +/* Helper: Mix seek sounds into float buffer */ +static void +hdd_audio_mix_seek_float(hdd_audio_drive_state_t *state, float *float_buffer, int frames_in_buffer) +{ + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + if (!state->seek_voices[v].active) + continue; + + int seek_profile_id = state->seek_voices[v].profile_id; + hdd_audio_samples_t *seek_samples = &profile_samples[seek_profile_id]; + if (!seek_samples->seek_buffer || seek_samples->seek_samples == 0) + continue; + + float voice_vol = state->seek_voices[v].volume; + int pos = state->seek_voices[v].position; + if (pos < 0) pos = 0; + + for (int i = 0; i < frames_in_buffer && pos < seek_samples->seek_samples; i++, pos++) { + float seek_left = (float) seek_samples->seek_buffer[pos * 2] / 131072.0f * voice_vol; + float seek_right = (float) seek_samples->seek_buffer[pos * 2 + 1] / 131072.0f * voice_vol; + + float_buffer[i * 2] += seek_left; + float_buffer[i * 2 + 1] += seek_right; + } + + if (pos >= seek_samples->seek_samples) { + state->seek_voices[v].active = 0; + state->seek_voices[v].position = 0; + } else { + state->seek_voices[v].position = pos; + } + } +} + +/* Helper: Mix spindle start sound into int16 buffer */ +static void +hdd_audio_mix_spindle_start_int16(hdd_audio_drive_state_t *state, hdd_audio_samples_t *samples, + int16_t *buffer, int frames_in_buffer) +{ + if (!samples->spindle_start_buffer || samples->spindle_start_samples <= 0) { + state->spindle_state = HDD_SPINDLE_RUNNING; + state->spindle_pos = 0; + return; + } + + float start_volume = samples->spindle_start_volume; + for (int i = 0; i < frames_in_buffer && state->spindle_transition_pos < samples->spindle_start_samples; i++) { + int32_t left = buffer[i * 2] + (int32_t)(samples->spindle_start_buffer[state->spindle_transition_pos * 2] * start_volume); + int32_t right = buffer[i * 2 + 1] + (int32_t)(samples->spindle_start_buffer[state->spindle_transition_pos * 2 + 1] * start_volume); + if (left > 32767) left = 32767; + if (left < -32768) left = -32768; + if (right > 32767) right = 32767; + if (right < -32768) right = -32768; + buffer[i * 2] = (int16_t) left; + buffer[i * 2 + 1] = (int16_t) right; + state->spindle_transition_pos++; + } + + if (state->spindle_transition_pos >= samples->spindle_start_samples) { + state->spindle_state = HDD_SPINDLE_RUNNING; + state->spindle_pos = 0; + pclog("HDD Audio: Drive %d spinup complete, now running\n", state->hdd_index); + } +} + +/* Helper: Mix spindle loop sound into int16 buffer */ +static void +hdd_audio_mix_spindle_loop_int16(hdd_audio_drive_state_t *state, hdd_audio_samples_t *samples, + int16_t *buffer, int frames_in_buffer) +{ + if (!samples->spindle_loop_buffer || samples->spindle_loop_samples <= 0) + return; + + float spindle_volume = samples->spindle_loop_volume; + for (int i = 0; i < frames_in_buffer; i++) { + int32_t left = buffer[i * 2] + (int32_t)(samples->spindle_loop_buffer[state->spindle_pos * 2] * spindle_volume); + int32_t right = buffer[i * 2 + 1] + (int32_t)(samples->spindle_loop_buffer[state->spindle_pos * 2 + 1] * spindle_volume); + if (left > 32767) left = 32767; + if (left < -32768) left = -32768; + if (right > 32767) right = 32767; + if (right < -32768) right = -32768; + buffer[i * 2] = (int16_t) left; + buffer[i * 2 + 1] = (int16_t) right; + + state->spindle_pos++; + if (state->spindle_pos >= samples->spindle_loop_samples) { + state->spindle_pos = 0; + } + } +} + +/* Helper: Mix spindle stop sound into int16 buffer */ +static void +hdd_audio_mix_spindle_stop_int16(hdd_audio_drive_state_t *state, hdd_audio_samples_t *samples, + int16_t *buffer, int frames_in_buffer) +{ + if (!samples->spindle_stop_buffer || samples->spindle_stop_samples <= 0) { + state->spindle_state = HDD_SPINDLE_STOPPED; + return; + } + + float stop_volume = samples->spindle_stop_volume; + for (int i = 0; i < frames_in_buffer && state->spindle_transition_pos < samples->spindle_stop_samples; i++) { + int32_t left = buffer[i * 2] + (int32_t)(samples->spindle_stop_buffer[state->spindle_transition_pos * 2] * stop_volume); + int32_t right = buffer[i * 2 + 1] + (int32_t)(samples->spindle_stop_buffer[state->spindle_transition_pos * 2 + 1] * stop_volume); + if (left > 32767) left = 32767; + if (left < -32768) left = -32768; + if (right > 32767) right = 32767; + if (right < -32768) right = -32768; + buffer[i * 2] = (int16_t) left; + buffer[i * 2 + 1] = (int16_t) right; + state->spindle_transition_pos++; + } + + if (state->spindle_transition_pos >= samples->spindle_stop_samples) { + state->spindle_state = HDD_SPINDLE_STOPPED; + pclog("HDD Audio: Drive %d spindown complete, now stopped\n", state->hdd_index); + } +} + +/* Helper: Mix seek sounds into int16 buffer */ +static void +hdd_audio_mix_seek_int16(hdd_audio_drive_state_t *state, int16_t *buffer, int frames_in_buffer) +{ + for (int v = 0; v < HDD_MAX_SEEK_VOICES_PER_HDD; v++) { + if (!state->seek_voices[v].active) + continue; + + int seek_profile_id = state->seek_voices[v].profile_id; + hdd_audio_samples_t *seek_samples = &profile_samples[seek_profile_id]; + if (!seek_samples->seek_buffer || seek_samples->seek_samples == 0) + continue; + + float voice_vol = state->seek_voices[v].volume; + int pos = state->seek_voices[v].position; + if (pos < 0) pos = 0; + + for (int i = 0; i < frames_in_buffer && pos < seek_samples->seek_samples; i++, pos++) { + int32_t left = buffer[i * 2] + (int32_t)(seek_samples->seek_buffer[pos * 2] * voice_vol); + int32_t right = buffer[i * 2 + 1] + (int32_t)(seek_samples->seek_buffer[pos * 2 + 1] * voice_vol); + + if (left > 32767) left = 32767; + if (left < -32768) left = -32768; + if (right > 32767) right = 32767; + if (right < -32768) right = -32768; + + buffer[i * 2] = (int16_t) left; + buffer[i * 2 + 1] = (int16_t) right; + } + + if (pos >= seek_samples->seek_samples) { + state->seek_voices[v].active = 0; + state->seek_voices[v].position = 0; + } else { + state->seek_voices[v].position = pos; + } + } +} + +/* Process a single drive's audio in float mode */ +static void +hdd_audio_process_drive_float(hdd_audio_drive_state_t *state, float *float_buffer, int frames_in_buffer) +{ + int profile_id = state->profile_id; + + if (profile_id <= 0 || profile_id >= HDD_AUDIO_PROFILE_MAX) + return; + + hdd_audio_samples_t *samples = &profile_samples[profile_id]; + if (!samples->loaded) + return; + + /* Handle spindle states for this drive */ + switch (state->spindle_state) { + case HDD_SPINDLE_STARTING: + hdd_audio_mix_spindle_start_float(state, samples, float_buffer, frames_in_buffer); + break; + case HDD_SPINDLE_RUNNING: + hdd_audio_mix_spindle_loop_float(state, samples, float_buffer, frames_in_buffer); + break; + case HDD_SPINDLE_STOPPING: + hdd_audio_mix_spindle_stop_float(state, samples, float_buffer, frames_in_buffer); + break; + case HDD_SPINDLE_STOPPED: + default: + break; + } + + /* Seek sounds - only play when spindle is running */ + if (samples->seek_buffer && samples->seek_samples > 0 && + hdd_audio_mutex && state->spindle_state == HDD_SPINDLE_RUNNING) { + thread_wait_mutex(hdd_audio_mutex); + hdd_audio_mix_seek_float(state, float_buffer, frames_in_buffer); + thread_release_mutex(hdd_audio_mutex); + } +} + +/* Process a single drive's audio in int16 mode */ +static void +hdd_audio_process_drive_int16(hdd_audio_drive_state_t *state, int16_t *buffer, int frames_in_buffer) +{ + int profile_id = state->profile_id; + + if (profile_id <= 0 || profile_id >= HDD_AUDIO_PROFILE_MAX) + return; + + hdd_audio_samples_t *samples = &profile_samples[profile_id]; + if (!samples->loaded) + return; + + /* Handle spindle states for this drive */ + switch (state->spindle_state) { + case HDD_SPINDLE_STARTING: + hdd_audio_mix_spindle_start_int16(state, samples, buffer, frames_in_buffer); + break; + case HDD_SPINDLE_RUNNING: + hdd_audio_mix_spindle_loop_int16(state, samples, buffer, frames_in_buffer); + break; + case HDD_SPINDLE_STOPPING: + hdd_audio_mix_spindle_stop_int16(state, samples, buffer, frames_in_buffer); + break; + case HDD_SPINDLE_STOPPED: + default: + break; + } + + /* Seek sounds - only play when spindle is running */ + if (samples->seek_buffer && samples->seek_samples > 0 && + hdd_audio_mutex && state->spindle_state == HDD_SPINDLE_RUNNING) { + thread_wait_mutex(hdd_audio_mutex); + hdd_audio_mix_seek_int16(state, buffer, frames_in_buffer); + thread_release_mutex(hdd_audio_mutex); + } } void @@ -516,12 +936,6 @@ hdd_audio_callback(int16_t *buffer, int length) { int frames_in_buffer = length / 2; - /* Get active profile samples */ - hdd_audio_samples_t *samples = NULL; - if (active_audio_profile > 0 && active_audio_profile < HDD_AUDIO_PROFILE_MAX) { - samples = &profile_samples[active_audio_profile]; - } - if (sound_is_float) { float *float_buffer = (float *) buffer; @@ -530,108 +944,9 @@ hdd_audio_callback(int16_t *buffer, int length) float_buffer[i] = 0.0f; } - /* Handle spindle states */ - if (samples) { - switch (spindle_state) { - case HDD_SPINDLE_STARTING: - /* Play spinup sound */ - if (samples->spindle_start_buffer && samples->spindle_start_samples > 0) { - float start_volume = samples->spindle_start_volume; - for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_start_samples; i++) { - float left_sample = (float) samples->spindle_start_buffer[spindle_transition_pos * 2] / 131072.0f * start_volume; - float right_sample = (float) samples->spindle_start_buffer[spindle_transition_pos * 2 + 1] / 131072.0f * start_volume; - float_buffer[i * 2] = left_sample; - float_buffer[i * 2 + 1] = right_sample; - spindle_transition_pos++; - } - if (spindle_transition_pos >= samples->spindle_start_samples) { - spindle_state = HDD_SPINDLE_RUNNING; - spindle_pos = 0; - pclog("HDD Audio: Spinup complete, now running\n"); - } - } else { - /* No start sample, go directly to running */ - spindle_state = HDD_SPINDLE_RUNNING; - spindle_pos = 0; - } - break; - - case HDD_SPINDLE_RUNNING: - /* Play spindle loop */ - if (samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { - float spindle_volume = samples->spindle_loop_volume; - for (int i = 0; i < frames_in_buffer; i++) { - float left_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2] / 131072.0f * spindle_volume; - float right_sample = (float) samples->spindle_loop_buffer[spindle_pos * 2 + 1] / 131072.0f * spindle_volume; - float_buffer[i * 2] = left_sample; - float_buffer[i * 2 + 1] = right_sample; - - spindle_pos++; - if (spindle_pos >= samples->spindle_loop_samples) { - spindle_pos = 0; - } - } - } - break; - - case HDD_SPINDLE_STOPPING: - /* Play spindown sound */ - if (samples->spindle_stop_buffer && samples->spindle_stop_samples > 0) { - float stop_volume = samples->spindle_stop_volume; - for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_stop_samples; i++) { - float left_sample = (float) samples->spindle_stop_buffer[spindle_transition_pos * 2] / 131072.0f * stop_volume; - float right_sample = (float) samples->spindle_stop_buffer[spindle_transition_pos * 2 + 1] / 131072.0f * stop_volume; - float_buffer[i * 2] = left_sample; - float_buffer[i * 2 + 1] = right_sample; - spindle_transition_pos++; - } - if (spindle_transition_pos >= samples->spindle_stop_samples) { - spindle_state = HDD_SPINDLE_STOPPED; - pclog("HDD Audio: Spindown complete, now stopped\n"); - } - } else { - /* No stop sample, go directly to stopped */ - spindle_state = HDD_SPINDLE_STOPPED; - } - break; - - case HDD_SPINDLE_STOPPED: - default: - /* Silence - buffer already zeroed */ - break; - } - } - - /* Seek sounds from profile - only play when spindle is running */ - if (samples && samples->seek_buffer && samples->seek_samples > 0 && - hdd_audio_mutex && spindle_state == HDD_SPINDLE_RUNNING) { - thread_wait_mutex(hdd_audio_mutex); - - for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { - if (!hdd_seek_voices[v].active) - continue; - - float voice_vol = hdd_seek_voices[v].volume; - int pos = hdd_seek_voices[v].position; - if (pos < 0) pos = 0; - - for (int i = 0; i < frames_in_buffer && pos < samples->seek_samples; i++, pos++) { - float seek_left = (float) samples->seek_buffer[pos * 2] / 131072.0f * voice_vol; - float seek_right = (float) samples->seek_buffer[pos * 2 + 1] / 131072.0f * voice_vol; - - float_buffer[i * 2] += seek_left; - float_buffer[i * 2 + 1] += seek_right; - } - - if (pos >= samples->seek_samples) { - hdd_seek_voices[v].active = 0; - hdd_seek_voices[v].position = 0; - } else { - hdd_seek_voices[v].position = pos; - } - } - - thread_release_mutex(hdd_audio_mutex); + /* Process each active drive */ + for (int d = 0; d < active_drive_count; d++) { + hdd_audio_process_drive_float(&drive_states[d], float_buffer, frames_in_buffer); } } else { /* Initialize buffer to silence */ @@ -639,105 +954,9 @@ hdd_audio_callback(int16_t *buffer, int length) buffer[i] = 0; } - /* Handle spindle states */ - if (samples) { - switch (spindle_state) { - case HDD_SPINDLE_STARTING: - /* Play spinup sound */ - if (samples->spindle_start_buffer && samples->spindle_start_samples > 0) { - float start_volume = samples->spindle_start_volume; - for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_start_samples; i++) { - buffer[i * 2] = (int16_t)(samples->spindle_start_buffer[spindle_transition_pos * 2] * start_volume); - buffer[i * 2 + 1] = (int16_t)(samples->spindle_start_buffer[spindle_transition_pos * 2 + 1] * start_volume); - spindle_transition_pos++; - } - if (spindle_transition_pos >= samples->spindle_start_samples) { - spindle_state = HDD_SPINDLE_RUNNING; - spindle_pos = 0; - pclog("HDD Audio: Spinup complete, now running\n"); - } - } else { - spindle_state = HDD_SPINDLE_RUNNING; - spindle_pos = 0; - } - break; - - case HDD_SPINDLE_RUNNING: - /* Play spindle loop */ - if (samples->spindle_loop_buffer && samples->spindle_loop_samples > 0) { - float spindle_volume = samples->spindle_loop_volume; - for (int i = 0; i < frames_in_buffer; i++) { - buffer[i * 2] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2] * spindle_volume); - buffer[i * 2 + 1] = (int16_t)(samples->spindle_loop_buffer[spindle_pos * 2 + 1] * spindle_volume); - - spindle_pos++; - if (spindle_pos >= samples->spindle_loop_samples) { - spindle_pos = 0; - } - } - } - break; - - case HDD_SPINDLE_STOPPING: - /* Play spindown sound */ - if (samples->spindle_stop_buffer && samples->spindle_stop_samples > 0) { - float stop_volume = samples->spindle_stop_volume; - for (int i = 0; i < frames_in_buffer && spindle_transition_pos < samples->spindle_stop_samples; i++) { - buffer[i * 2] = (int16_t)(samples->spindle_stop_buffer[spindle_transition_pos * 2] * stop_volume); - buffer[i * 2 + 1] = (int16_t)(samples->spindle_stop_buffer[spindle_transition_pos * 2 + 1] * stop_volume); - spindle_transition_pos++; - } - if (spindle_transition_pos >= samples->spindle_stop_samples) { - spindle_state = HDD_SPINDLE_STOPPED; - pclog("HDD Audio: Spindown complete, now stopped\n"); - } - } else { - spindle_state = HDD_SPINDLE_STOPPED; - } - break; - - case HDD_SPINDLE_STOPPED: - default: - /* Silence - buffer already zeroed */ - break; - } - } - - /* Seek sounds from profile - only play when spindle is running */ - if (samples && samples->seek_buffer && samples->seek_samples > 0 && - hdd_audio_mutex && spindle_state == HDD_SPINDLE_RUNNING) { - thread_wait_mutex(hdd_audio_mutex); - - for (int v = 0; v < HDD_MAX_SEEK_VOICES; v++) { - if (!hdd_seek_voices[v].active) - continue; - - float voice_vol = hdd_seek_voices[v].volume; - int pos = hdd_seek_voices[v].position; - if (pos < 0) pos = 0; - - for (int i = 0; i < frames_in_buffer && pos < samples->seek_samples; i++, pos++) { - int32_t left = buffer[i * 2] + (int32_t)(samples->seek_buffer[pos * 2] * voice_vol); - int32_t right = buffer[i * 2 + 1] + (int32_t)(samples->seek_buffer[pos * 2 + 1] * voice_vol); - - if (left > 32767) left = 32767; - if (left < -32768) left = -32768; - if (right > 32767) right = 32767; - if (right < -32768) right = -32768; - - buffer[i * 2] = (int16_t) left; - buffer[i * 2 + 1] = (int16_t) right; - } - - if (pos >= samples->seek_samples) { - hdd_seek_voices[v].active = 0; - hdd_seek_voices[v].position = 0; - } else { - hdd_seek_voices[v].position = pos; - } - } - - thread_release_mutex(hdd_audio_mutex); + /* Process each active drive */ + for (int d = 0; d < active_drive_count; d++) { + hdd_audio_process_drive_int16(&drive_states[d], buffer, frames_in_buffer); } } } \ No newline at end of file diff --git a/src/include/86box/hdd_audio.h b/src/include/86box/hdd_audio.h index 2bb19a70e7e..b404efc381c 100644 --- a/src/include/86box/hdd_audio.h +++ b/src/include/86box/hdd_audio.h @@ -65,6 +65,13 @@ extern void hdd_audio_reset(void); extern void hdd_audio_close(void); extern void hdd_audio_callback(int16_t *buffer, int length); extern void hdd_audio_seek(hard_disk_t *hdd, uint32_t new_cylinder); + +/* Per-drive spindle control */ +extern void hdd_audio_spinup_drive(int hdd_index); +extern void hdd_audio_spindown_drive(int hdd_index); +extern hdd_spindle_state_t hdd_audio_get_drive_spindle_state(int hdd_index); + +/* Legacy functions for backward compatibility - operate on all drives */ extern void hdd_audio_spinup(void); extern void hdd_audio_spindown(void); extern hdd_spindle_state_t hdd_audio_get_spindle_state(void); From 3f26bc5fb812a214e39881cec970c2d9de86d0ae Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 4 Jan 2026 21:52:18 +0200 Subject: [PATCH 216/320] Fixed incorrect include header --- src/sound/audio4.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sound/audio4.c b/src/sound/audio4.c index 25ff5b1c208..dcff2068dcf 100644 --- a/src/sound/audio4.c +++ b/src/sound/audio4.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include <86box/86box.h> From a03316e98fd5d7d3325e7b7d89299fc1bc91983f Mon Sep 17 00:00:00 2001 From: Domppari Date: Sun, 4 Jan 2026 22:00:05 +0200 Subject: [PATCH 217/320] Possible fix for CodeQL error --- src/disk/hdd_audio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index 9098adf7839..04c27e11d18 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -89,13 +89,23 @@ hdd_audio_load_profiles(void) ini_t profiles_ini; char cfg_fn[1024] = { 0 }; + /* + * asset_getfile returns a path from the trusted asset search paths. + * The filename is hardcoded and validated against existing files. + */ int ret = asset_getfile("assets/sounds/hdd/hdd_audio_profiles.cfg", cfg_fn, 1024); if (!ret) { pclog("HDD Audio: Could not find hdd_audio_profiles.cfg\n"); return; } - profiles_ini = ini_read_ex(cfg_fn, 1); + /* Validate that the path does not contain path traversal sequences */ + if (strstr(cfg_fn, "..") != NULL) { + pclog("HDD Audio: Invalid path detected\n"); + return; + } + + profiles_ini = ini_read_ex(cfg_fn, 1); /* lgtm[cpp/path-injection] */ if (profiles_ini == NULL) { pclog("HDD Audio: Failed to load hdd_audio_profiles.cfg\n"); return; From ef34f7c1b22e0bed150ce1ef5dfceb6ffb4ac3d7 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 5 Jan 2026 01:03:04 +0100 Subject: [PATCH 218/320] Remove the raw screenshot buttons from the toolbar (they are still available in the menu). --- src/qt/qt_mainwindow.ui | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 7562391bb5d..e46bfca0bb1 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -310,9 +310,7 @@ - - From e1f7e3b7c9c779e78e91e7637c76d5bc4ffa777b Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 5 Jan 2026 01:03:27 +0100 Subject: [PATCH 219/320] Also remove the force interpretation button from the toolbar. --- src/qt/qt_mainwindow.ui | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index e46bfca0bb1..47744b38f3c 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -311,8 +311,6 @@ - - From c5d60d658feecd79d287bb9031641faec49d17fe Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 5 Jan 2026 01:10:52 +0100 Subject: [PATCH 220/320] HDD audio: Move logging to its own function. --- src/disk/hdd_audio.c | 94 ++++++++++++++++++++++++++------------------ 1 file changed, 56 insertions(+), 38 deletions(-) diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index 04c27e11d18..d1dfa1369de 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -82,6 +82,24 @@ static int active_drive_count = 0; static mutex_t *hdd_audio_mutex = NULL; +#ifdef ENABLE_HDD_AUDIO_LOG +int hdd_audio_do_log = ENABLE_HDD_AUDIO_LOG; + +static void +hdd_audio_log(const char *fmt, ...) +{ + va_list ap; + + if (hdd_audio_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +# define hdd_audio_log(fmt, ...) +#endif + /* Load audio profiles from configuration file */ void hdd_audio_load_profiles(void) @@ -95,19 +113,19 @@ hdd_audio_load_profiles(void) */ int ret = asset_getfile("assets/sounds/hdd/hdd_audio_profiles.cfg", cfg_fn, 1024); if (!ret) { - pclog("HDD Audio: Could not find hdd_audio_profiles.cfg\n"); + hdd_audio_log("HDD Audio: Could not find hdd_audio_profiles.cfg\n"); return; } /* Validate that the path does not contain path traversal sequences */ if (strstr(cfg_fn, "..") != NULL) { - pclog("HDD Audio: Invalid path detected\n"); + hdd_audio_log("HDD Audio: Invalid path detected\n"); return; } profiles_ini = ini_read_ex(cfg_fn, 1); /* lgtm[cpp/path-injection] */ if (profiles_ini == NULL) { - pclog("HDD Audio: Failed to load hdd_audio_profiles.cfg\n"); + hdd_audio_log("HDD Audio: Failed to load hdd_audio_profiles.cfg\n"); return; } @@ -153,15 +171,15 @@ hdd_audio_load_profiles(void) strncpy(config->seek_track.filename, file, sizeof(config->seek_track.filename) - 1); config->seek_track.volume = (float) ini_section_get_double(cat, "seek_track_volume", 1.0); - pclog("HDD Audio: Loaded profile %d: %s (%s)\n", - audio_profile_count, config->name, config->internal_name); + hdd_audio_log("HDD Audio: Loaded profile %d: %s (%s)\n", + audio_profile_count, config->name, config->internal_name); audio_profile_count++; } ini_close(profiles_ini); - pclog("HDD Audio: Loaded %d audio profiles\n", audio_profile_count); + hdd_audio_log("HDD Audio: Loaded %d audio profiles\n", audio_profile_count); } /* Public API functions */ @@ -265,8 +283,8 @@ hdd_audio_load_profile_samples(int profile_id) samples->loaded = 1; return; } - - pclog("HDD Audio: Loading samples for profile %d (%s)\n", profile_id, config->name); + + hdd_audio_log("HDD Audio: Loading samples for profile %d (%s)\n", profile_id, config->name); /* Load spindle loop (main running sound) */ if (config->spindlemotor_loop.filename[0]) { @@ -275,9 +293,9 @@ hdd_audio_load_profile_samples(int profile_id) &samples->spindle_loop_samples); if (samples->spindle_loop_buffer) { samples->spindle_loop_volume = config->spindlemotor_loop.volume; - pclog("HDD Audio: Loaded spindle loop, %d frames\n", samples->spindle_loop_samples); + hdd_audio_log("HDD Audio: Loaded spindle loop, %d frames\n", samples->spindle_loop_samples); } else { - pclog("HDD Audio: Failed to load spindle loop: %s\n", config->spindlemotor_loop.filename); + hdd_audio_log("HDD Audio: Failed to load spindle loop: %s\n", config->spindlemotor_loop.filename); } } @@ -288,7 +306,7 @@ hdd_audio_load_profile_samples(int profile_id) &samples->spindle_start_samples); if (samples->spindle_start_buffer) { samples->spindle_start_volume = config->spindlemotor_start.volume; - pclog("HDD Audio: Loaded spindle start, %d frames\n", samples->spindle_start_samples); + hdd_audio_log("HDD Audio: Loaded spindle start, %d frames\n", samples->spindle_start_samples); } } @@ -299,7 +317,7 @@ hdd_audio_load_profile_samples(int profile_id) &samples->spindle_stop_samples); if (samples->spindle_stop_buffer) { samples->spindle_stop_volume = config->spindlemotor_stop.volume; - pclog("HDD Audio: Loaded spindle stop, %d frames\n", samples->spindle_stop_samples); + hdd_audio_log("HDD Audio: Loaded spindle stop, %d frames\n", samples->spindle_stop_samples); } } @@ -310,10 +328,10 @@ hdd_audio_load_profile_samples(int profile_id) &samples->seek_samples); if (samples->seek_buffer) { samples->seek_volume = config->seek_track.volume; - pclog("HDD Audio: Loaded seek sound, %d frames (%.1f ms)\n", - samples->seek_samples, (float)samples->seek_samples / 48.0f); + hdd_audio_log("HDD Audio: Loaded seek sound, %d frames (%.1f ms)\n", + samples->seek_samples, (float)samples->seek_samples / 48.0f); } else { - pclog("HDD Audio: Failed to load seek sound: %s\n", config->seek_track.filename); + hdd_audio_log("HDD Audio: Failed to load seek sound: %s\n", config->seek_track.filename); } } @@ -339,7 +357,7 @@ hdd_audio_init(void) memset(drive_states, 0, sizeof(drive_states)); active_drive_count = 0; - pclog("HDD Audio Init: audio_profile_count=%d\n", audio_profile_count); + hdd_audio_log("HDD Audio Init: audio_profile_count=%d\n", audio_profile_count); /* Create mutex BEFORE loading samples or calling spinup */ if (!hdd_audio_mutex) @@ -348,8 +366,8 @@ hdd_audio_init(void) /* Find all HDDs with valid audio profiles and initialize their states */ for (int i = 0; i < HDD_NUM && active_drive_count < HDD_AUDIO_MAX_DRIVES; i++) { if (hdd[i].bus_type != HDD_BUS_DISABLED && hdd[i].audio_profile > 0) { - pclog("HDD Audio Init: HDD %d bus_type=%d audio_profile=%d\n", - i, hdd[i].bus_type, hdd[i].audio_profile); + hdd_audio_log("HDD Audio Init: HDD %d bus_type=%d audio_profile=%d\n", + i, hdd[i].bus_type, hdd[i].audio_profile); hdd_audio_drive_state_t *state = &drive_states[active_drive_count]; state->hdd_index = i; @@ -369,15 +387,15 @@ hdd_audio_init(void) /* Load samples for this profile if not already loaded */ hdd_audio_load_profile_samples(state->profile_id); - pclog("HDD Audio: Initialized drive %d with profile %d (%s)\n", - i, state->profile_id, - hdd_audio_get_profile_name(state->profile_id)); + hdd_audio_log("HDD Audio: Initialized drive %d with profile %d (%s)\n", + i, state->profile_id, + hdd_audio_get_profile_name(state->profile_id)); active_drive_count++; } } - pclog("HDD Audio Init: %d active drives with audio\n", active_drive_count); + hdd_audio_log("HDD Audio Init: %d active drives with audio\n", active_drive_count); /* Start spindle motors for all active drives */ for (int i = 0; i < active_drive_count; i++) { @@ -390,7 +408,7 @@ hdd_audio_init(void) void hdd_audio_reset(void) { - pclog("HDD Audio: Reset\n"); + hdd_audio_log("HDD Audio: Reset\n"); /* Lock mutex to prevent audio callback from accessing buffers during reset */ if (hdd_audio_mutex) @@ -436,7 +454,7 @@ hdd_audio_reset(void) /* Find all HDDs with valid audio profiles and initialize their states */ for (int i = 0; i < HDD_NUM && active_drive_count < HDD_AUDIO_MAX_DRIVES; i++) { if (hdd[i].bus_type != HDD_BUS_DISABLED && hdd[i].audio_profile > 0) { - pclog("HDD Audio Reset: HDD %d audio_profile=%d\n", i, hdd[i].audio_profile); + hdd_audio_log("HDD Audio Reset: HDD %d audio_profile=%d\n", i, hdd[i].audio_profile); hdd_audio_drive_state_t *state = &drive_states[active_drive_count]; state->hdd_index = i; @@ -456,15 +474,15 @@ hdd_audio_reset(void) /* Load samples for this profile if not already loaded */ hdd_audio_load_profile_samples(state->profile_id); - pclog("HDD Audio: Reset drive %d with profile %d (%s)\n", - i, state->profile_id, - hdd_audio_get_profile_name(state->profile_id)); + hdd_audio_log("HDD Audio: Reset drive %d with profile %d (%s)\n", + i, state->profile_id, + hdd_audio_get_profile_name(state->profile_id)); active_drive_count++; } } - pclog("HDD Audio Reset: %d active drives with audio\n", active_drive_count); + hdd_audio_log("HDD Audio Reset: %d active drives with audio\n", active_drive_count); /* Start spindle motors for all active drives */ for (int i = 0; i < active_drive_count; i++) { @@ -555,9 +573,9 @@ hdd_audio_spinup_drive(int hdd_index) if (state->spindle_state == HDD_SPINDLE_RUNNING || state->spindle_state == HDD_SPINDLE_STARTING) return; - - pclog("HDD Audio: Spinup requested for drive %d (current state: %d)\n", hdd_index, state->spindle_state); - + + hdd_audio_log("HDD Audio: Spinup requested for drive %d (current state: %d)\n", hdd_index, state->spindle_state); + if (hdd_audio_mutex) thread_wait_mutex(hdd_audio_mutex); state->spindle_state = HDD_SPINDLE_STARTING; @@ -576,9 +594,9 @@ hdd_audio_spindown_drive(int hdd_index) if (state->spindle_state == HDD_SPINDLE_STOPPED || state->spindle_state == HDD_SPINDLE_STOPPING) return; - - pclog("HDD Audio: Spindown requested for drive %d (current state: %d)\n", hdd_index, state->spindle_state); - + + hdd_audio_log("HDD Audio: Spindown requested for drive %d (current state: %d)\n", hdd_index, state->spindle_state); + if (hdd_audio_mutex) thread_wait_mutex(hdd_audio_mutex); state->spindle_state = HDD_SPINDLE_STOPPING; @@ -655,7 +673,7 @@ hdd_audio_mix_spindle_start_float(hdd_audio_drive_state_t *state, hdd_audio_samp if (state->spindle_transition_pos >= samples->spindle_start_samples) { state->spindle_state = HDD_SPINDLE_RUNNING; state->spindle_pos = 0; - pclog("HDD Audio: Drive %d spinup complete, now running\n", state->hdd_index); + hdd_audio_log("HDD Audio: Drive %d spinup complete, now running\n", state->hdd_index); } } @@ -702,7 +720,7 @@ hdd_audio_mix_spindle_stop_float(hdd_audio_drive_state_t *state, hdd_audio_sampl if (state->spindle_transition_pos >= samples->spindle_stop_samples) { state->spindle_state = HDD_SPINDLE_STOPPED; - pclog("HDD Audio: Drive %d spindown complete, now stopped\n", state->hdd_index); + hdd_audio_log("HDD Audio: Drive %d spindown complete, now stopped\n", state->hdd_index); } } @@ -767,7 +785,7 @@ hdd_audio_mix_spindle_start_int16(hdd_audio_drive_state_t *state, hdd_audio_samp if (state->spindle_transition_pos >= samples->spindle_start_samples) { state->spindle_state = HDD_SPINDLE_RUNNING; state->spindle_pos = 0; - pclog("HDD Audio: Drive %d spinup complete, now running\n", state->hdd_index); + hdd_audio_log("HDD Audio: Drive %d spinup complete, now running\n", state->hdd_index); } } @@ -822,7 +840,7 @@ hdd_audio_mix_spindle_stop_int16(hdd_audio_drive_state_t *state, hdd_audio_sampl if (state->spindle_transition_pos >= samples->spindle_stop_samples) { state->spindle_state = HDD_SPINDLE_STOPPED; - pclog("HDD Audio: Drive %d spindown complete, now stopped\n", state->hdd_index); + hdd_audio_log("HDD Audio: Drive %d spindown complete, now stopped\n", state->hdd_index); } } From e42f1359d807b8970b98beb3f847adcd3869e0a7 Mon Sep 17 00:00:00 2001 From: win2kgamer <47463859+win2kgamer@users.noreply.github.com> Date: Sun, 4 Jan 2026 21:28:12 -0600 Subject: [PATCH 221/320] Implement the Aztech AZTPR16 audio controller (and other Aztech improvements) (#6673) * Aztech: Clean up unused code and outdated comments, add a standard 86Box header comment and fix a warning in the logging code * Aztech: Implement gameport enable/disable for AZT1605 and AZT2316A * Aztech: Implement SBPro mixer restore from EEPROM for AZT2316A * Implement the Aztech Sound Galaxy Pro 16 (AZTPR16) sound card * AZTPR16: Right shift master volume by 1 during mixer update, fixes quiet audio in DOS WSS sound test * AZTPR16: Set the Panasonic CD-ROM bit in the config word, fixes CR56X.SYS on Packard Bell 141233 boot disk --- src/include/86box/snd_azt2316a.h | 2 + src/include/86box/snd_sb_dsp.h | 9 +- src/include/86box/sound.h | 1 + src/sound/snd_azt2316a.c | 850 ++++++++++++++++++++++++++----- src/sound/snd_sb.c | 101 ++++ src/sound/snd_sb_dsp.c | 17 +- src/sound/sound.c | 1 + 7 files changed, 855 insertions(+), 126 deletions(-) diff --git a/src/include/86box/snd_azt2316a.h b/src/include/86box/snd_azt2316a.h index 8aae3f1ff32..266193e55cf 100644 --- a/src/include/86box/snd_azt2316a.h +++ b/src/include/86box/snd_azt2316a.h @@ -2,5 +2,7 @@ #define SOUND_AZT2316A_H extern void azt2316a_enable_wss(uint8_t enable, void *priv); +extern void aztpr16_update_mixer(void *priv); +extern void aztpr16_wss_mode(uint8_t mode, void *priv); #endif /*SOUND_AZT2316A*/ diff --git a/src/include/86box/snd_sb_dsp.h b/src/include/86box/snd_sb_dsp.h index 0bc719d98fe..200912c4209 100644 --- a/src/include/86box/snd_sb_dsp.h +++ b/src/include/86box/snd_sb_dsp.h @@ -8,16 +8,17 @@ #define SB_SUBTYPE_CLONE_AZT2316A_0X11 1 /* Aztech Sound Galaxy Pro 16 AB, DSP 3.1 - SBPRO2 clone */ #define SB_SUBTYPE_CLONE_AZT1605_0X0C 2 /* Aztech Sound Galaxy Nova 16 Extra / Packard Bell Forte 16, DSP 2.1 - SBPRO2 clone */ -#define SB_SUBTYPE_ESS_ES688 3 /* ESS Technology ES688 */ -#define SB_SUBTYPE_ESS_ES1688 4 /* ESS Technology ES1688 */ +#define SB_SUBTYPE_CLONE_AZTPR16_0X09 3 /* Aztech Sound Galaxy Pro 16 Extra */ +#define SB_SUBTYPE_ESS_ES688 4 /* ESS Technology ES688 */ +#define SB_SUBTYPE_ESS_ES1688 5 /* ESS Technology ES1688 */ /* ESS-related */ #define IS_ESS(dsp) ((dsp)->sb_subtype >= SB_SUBTYPE_ESS_ES688) /* Check for future ESS cards here */ #define IS_NOT_ESS(dsp) ((dsp)->sb_subtype < SB_SUBTYPE_ESS_ES688) /* Check for future ESS cards here */ /* aztech-related */ -#define IS_AZTECH(dsp) ((dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZT2316A_0X11 || (dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZT1605_0X0C) /* check for future AZT cards here */ -#define AZTECH_EEPROM_SIZE 16 +#define IS_AZTECH(dsp) ((dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZT2316A_0X11 || (dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZT1605_0X0C || (dsp)->sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09) /* check for future AZT cards here */ +#define AZTECH_EEPROM_SIZE 36 typedef struct sb_dsp_t { int sb_type; diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index f3cbaeea1f2..9dec03231e2 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -134,6 +134,7 @@ extern const device_t azt2316a_device; extern const device_t acermagic_s20_device; extern const device_t mirosound_pcm10_device; extern const device_t azt1605_device; +extern const device_t aztpr16_device; /* C-Media CMI8x38 */ extern const device_t cmi8338_device; diff --git a/src/sound/snd_azt2316a.c b/src/sound/snd_azt2316a.c index 47cf0296bf3..08fca0f8790 100644 --- a/src/sound/snd_azt2316a.c +++ b/src/sound/snd_azt2316a.c @@ -1,4 +1,25 @@ /* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Aztech Sound Galaxy series audio controller emulation. + * + * Authors: Cacodemon345 + * Eluan Costa Miranda + * win2kgamer + * + * Copyright 2022 Cacodemon345. + * Copyright 2020 Eluan Costa Miranda. + * Copyright 2025-2026 win2kgamer + */ + +/* + * Original header and notes: + * * TYPE 0x11: (Washington) * Aztech MMPRO16AB, * Aztech Sound Galaxy Pro 16 AB @@ -66,7 +87,7 @@ * to call the original functions, except for initialization. * * TODO/Notes: - * -Some stuff still not understood on I/O addresses 0x624 and 0x530-0x533. + * -Some stuff still not understood on I/O address 0x624. * -Is the CS42xx dither mode used anywhere? Implement. * -What are the voice commands mode in Win95 mixer again? * -Configuration options not present on Aztech's CONFIG.EXE have been commented @@ -100,14 +121,6 @@ * this behaves like a card with a regular interface disabled by jumper and * the configuration just adds/removes the drivers (which will see other IDE * interfaces present) from the boot process. - * -Continue reverse engineering to see if the AZT1605 shares the SB DMA with - * WSS or if it is set separately by the TSR loaded on boot. Currently it is - * only set by PCem config and then saved to EEPROM (which would make it fixed - * if loading from EEPROM too). - * -Related to the previous note, part of the SBPROV2 emulation on the CLINTON - * family appears to be implemented with a TSR. It's better to remove the TSR - * for now. I need to investigate this. Mixer is also weird under DOS (and - * wants to save to EEPROM? I don't think the WASHINGTON does this). * -Search for TODO in this file. :-) * * Misc things I use to test for regressions: Windows sounds, Descent under @@ -147,6 +160,7 @@ #include <86box/nvr.h> #include <86box/pic.h> #include <86box/sound.h> +#include <86box/gameport.h> #include <86box/snd_ad1848.h> #include <86box/snd_azt2316a.h> #include <86box/snd_sb.h> @@ -159,7 +173,7 @@ int aztech_do_log = ENABLE_AZTECH_LOG; static void aztech_log(void *priv, const char *fmt, ...) { - if (aztech_log) { + if (aztech_do_log) { va_list ap; va_start(ap, fmt); log_out(priv, fmt, ap); @@ -187,6 +201,8 @@ static int azt2316a_wss_irq[8] = { 5, 7, 9, 10, 11, 12, 14, 15 }; /* W95 only us static uint16_t azt2316a_wss_addr[4] = {0x530, 0x604, 0xe80, 0xf40}; #endif +static double aztpr16_vols_5bits[32]; + typedef struct azt2316a_t { int type; @@ -200,8 +216,11 @@ typedef struct azt2316a_t { int cur_wss_enabled; int cur_wss_irq; int cur_wss_dma; + int cur_wss_dma16; /* AZTPR16 16-bit DMA */ int cur_mpu401_irq; int cur_mpu401_enabled; + int gameport_enabled; + void *gameport; uint32_t config_word; uint32_t config_word_unlocked; @@ -216,6 +235,24 @@ typedef struct azt2316a_t { void * log; /* New logging system */ } azt2316a_t; +void +aztpr16_update_mixer(void *priv) +{ + azt2316a_t *azt2316a = (azt2316a_t *) priv; + + aztech_log(azt2316a->log, "Aztech AZTPR16 Mixer update\n"); + + azt2316a->ad1848.regs[2] = ((~azt2316a->sb->mixer_sbpro.regs[0xa0]) & 0x1f); /* CD L */ + azt2316a->ad1848.cd_vol_l = aztpr16_vols_5bits[azt2316a->ad1848.regs[2] & 0x1f]; + azt2316a->ad1848.regs[3] = ((~azt2316a->sb->mixer_sbpro.regs[0xa2]) & 0x1f); /* CD R */ + azt2316a->ad1848.cd_vol_r = aztpr16_vols_5bits[azt2316a->ad1848.regs[3] & 0x1f]; + azt2316a->ad1848.regs[4] = ((~azt2316a->sb->mixer_sbpro.regs[0x8c]) & 0x1f); /* FM L */ + azt2316a->ad1848.regs[5] = ((~azt2316a->sb->mixer_sbpro.regs[0x8e]) & 0x1f); /* FM R */ + azt2316a->ad1848.regs[6] = (((~azt2316a->sb->mixer_sbpro.regs[0x84]) & 0x3f) >> 1); /* Master L */ + azt2316a->ad1848.regs[7] = (((~azt2316a->sb->mixer_sbpro.regs[0x86]) & 0x3f) >> 1); /* Master R */ + +} + static void azt1605_filter_opl(void *priv, double *out_l, double *out_r) { @@ -230,9 +267,6 @@ azt2316a_wss_read(uint16_t addr, void *priv) const azt2316a_t *azt2316a = (azt2316a_t *) priv; uint8_t temp; - /* TODO: when windows is initializing, writing 0x48, 0x58 and 0x60 to - 0x530 makes reading from 0x533 return 0x44, but writing 0x50 - makes this return 0x04. Why? */ if (addr & 1) temp = 4 | (azt2316a->wss_config & 0x40); else @@ -275,35 +309,207 @@ azt2316a_wss_write(uint16_t addr, uint8_t val, void *priv) /* generate a config word based on current settings */ static void -azt1605_create_config_word(void *priv) +aztpr16_create_config_word(void *priv) { azt2316a_t *azt2316a = (azt2316a_t *) priv; uint32_t temp = 0; /* not implemented / hardcoded */ - uint8_t game_enable = 1; - uint8_t cd_type = 0; /* TODO: see if the cd-rom was originally connected there on the real machines emulated by 86Box (Packard Bell Legend 100CD, Itautec Infoway Multimidia, etc) */ - uint8_t cd_dma8 = -1; + uint8_t cd_type = 1; uint8_t cd_irq = 0; switch (azt2316a->cur_addr) { case 0x220: // do nothing -#if 0 - temp += 0 << 0; -#endif break; case 0x240: temp += 1 << 0; break; -#if 0 - case 0x260: // TODO: INVALID? + case 0x260: temp += 2 << 0; break; - case 0x280: // TODO: INVALID? + case 0x280: temp += 3 << 0; break; -#endif + default: + break; + } + + switch (azt2316a->cur_irq) { + case 2: + temp += 1 << 8; + break; + case 5: + temp += 1 << 9; + break; + case 7: + temp += 1 << 10; + break; + case 10: + temp += 1 << 11; + break; + + default: + break; + } + + switch (azt2316a->cur_wss_addr) { + case 0x530: + // do nothing + break; + case 0x604: + temp += 1 << 16; + break; + case 0xE80: + temp += 2 << 16; + break; + case 0xF40: + temp += 3 << 16; + break; + + default: + break; + } + + if (azt2316a->cur_wss_enabled) + temp += 1 << 18; + + if (azt2316a->gameport_enabled) + temp += 1 << 4; + + switch (azt2316a->cur_mpu401_addr) { + case 0x300: + // do nothing + break; + case 0x330: + temp += 1 << 2; + break; + + default: + break; + } + + if (azt2316a->cur_mpu401_enabled) + temp += 1 << 3; + + switch (cd_type) { + case 0: // disabled + //do nothing + temp += 0 << 5; + break; + case 1: // panasonic + temp += 1 << 5; + break; + case 2: // mitsumi/sony/aztech + temp += 2 << 5; + break; + case 3: // all enabled + temp += 3 << 5; + break; + case 4: // unused + temp += 4 << 5; + break; + case 5: // unused + temp += 5 << 5; + break; + case 6: // unused + temp += 6 << 5; + break; + case 7: // unused + temp += 7 << 5; + break; + + default: + break; + } + + switch (azt2316a->cur_dma) { + case 0: + temp += 1 << 24; + break; + case 1: + temp += 1 << 25; + break; + case 3: + temp += 1 << 26; + break; + default: + break; + } + + switch (azt2316a->cur_wss_dma16) { + case 5: + temp += 1 << 27; + break; + case 6: + temp += 1 << 28; + break; + case 7: + temp += 1 << 29; + break; + default: + break; + } + + switch (azt2316a->cur_mpu401_irq) { + case 2: + temp += 1 << 12; + break; + case 5: + temp += 1 << 13; + break; + case 7: + temp += 1 << 14; + break; + case 10: + temp += 1 << 15; + break; + + default: + break; + } + + switch (cd_irq) { + case 0: // disabled + // do nothing + break; + case 11: + temp += 1 << 20; + break; + case 12: + temp += 1 << 21; + break; + case 15: + temp += 1 << 22; + break; + + default: + break; + } + + azt2316a->config_word = temp; + aztech_log(azt2316a->log, "Aztech PR16 Config Word Create: %08X\n", temp); +} + + +static void +azt1605_create_config_word(void *priv) +{ + azt2316a_t *azt2316a = (azt2316a_t *) priv; + uint32_t temp = 0; + + /* not implemented / hardcoded */ + uint8_t cd_type = 0; /* TODO: see if the cd-rom was originally connected there on the real machines emulated by 86Box (Packard Bell Legend 100CD, Itautec Infoway Multimidia, etc) */ + uint8_t cd_dma8 = -1; + uint8_t cd_irq = 0; + + switch (azt2316a->cur_addr) { + case 0x220: + // do nothing + break; + case 0x240: + temp += 1 << 0; + break; default: break; } @@ -329,9 +535,6 @@ azt1605_create_config_word(void *priv) switch (azt2316a->cur_wss_addr) { case 0x530: // do nothing -#if 0 - temp += 0 << 16; -#endif break; case 0x604: temp += 1 << 16; @@ -350,15 +553,12 @@ azt1605_create_config_word(void *priv) if (azt2316a->cur_wss_enabled) temp += 1 << 18; - if (game_enable) + if (azt2316a->gameport_enabled) temp += 1 << 4; switch (azt2316a->cur_mpu401_addr) { case 0x300: // do nothing -#if 0 - temp += 0 << 2; -#endif break; case 0x330: temp += 1 << 2; @@ -372,9 +572,8 @@ azt1605_create_config_word(void *priv) temp += 1 << 3; switch (cd_type) { - case 0: /* disabled - do nothing - temp += 0 << 5; */ + case 0: // disabled + // do nothing break; case 1: // panasonic temp += 1 << 5; @@ -403,9 +602,8 @@ azt1605_create_config_word(void *priv) } switch (cd_dma8) { - case 0xFF: /* -1 - do nothing - temp += 0 << 22;*/ + case 0xFF: // -1 + //do nothing break; case 0: temp += 1 << 22; @@ -468,7 +666,6 @@ azt2316a_create_config_word(void *priv) uint32_t temp = 0; /* not implemented / hardcoded */ - uint8_t game_enable = 1; uint16_t cd_addr = 0x310; uint8_t cd_type = 0; /* TODO: see if the cd-rom was originally connected there on the real machines emulated by 86Box (Packard Bell Legend 100CD, Itautec Infoway Multimidia, etc) */ uint8_t cd_dma8 = -1; @@ -480,24 +677,18 @@ azt2316a_create_config_word(void *priv) return; } + if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + aztpr16_create_config_word(priv); + return; + } + switch (azt2316a->cur_addr) { case 0x220: // do nothing -#if 0 - temp += 0 << 0; -#endif break; case 0x240: temp += 1 << 0; break; -#if 0 - case 0x260: // TODO: INVALID? - temp += 2 << 0; - break; - case 0x280: // TODO: INVALID? - temp += 3 << 0; - break; -#endif default: break; } @@ -521,13 +712,6 @@ azt2316a_create_config_word(void *priv) } switch (azt2316a->cur_dma) { -#if 0 - // TODO: INVALID? - case 0xFF: // -1 - // do nothing - //temp += 0 << 6; - break; -#endif case 0: temp += 1 << 6; break; @@ -545,9 +729,6 @@ azt2316a_create_config_word(void *priv) switch (azt2316a->cur_wss_addr) { case 0x530: // do nothing -#if 0 - temp += 0 << 8; -#endif break; case 0x604: temp += 1 << 8; @@ -564,14 +745,11 @@ azt2316a_create_config_word(void *priv) } if (azt2316a->cur_wss_enabled) temp += 1 << 10; - if (game_enable) + if (azt2316a->gameport_enabled) temp += 1 << 11; switch (azt2316a->cur_mpu401_addr) { case 0x300: // do nothing -#if 0 - temp += 0 << 12; -#endif break; case 0x330: temp += 1 << 12; @@ -587,9 +765,6 @@ azt2316a_create_config_word(void *priv) switch (cd_addr) { case 0x310: // do nothing -#if 0 - temp += 0 << 14; -#endif break; case 0x320: temp += 1 << 14; @@ -607,9 +782,6 @@ azt2316a_create_config_word(void *priv) switch (cd_type) { case 0: /* disabled */ // do nothing -#if 0 - temp += 0 << 16; */ -#endif break; case 1: /* panasonic */ temp += 1 << 16; @@ -638,18 +810,15 @@ azt2316a_create_config_word(void *priv) } switch (cd_dma8) { - case 0xFF: /* -1 - do nothing - temp += 0 << 20; */ + case 0xFF: // -1 + //do nothing break; case 0: temp += 1 << 20; break; -#if 0 - case 1: // TODO: INVALID? + case 1: temp += 2 << 20; break; -#endif case 3: temp += 3 << 20; break; @@ -659,9 +828,8 @@ azt2316a_create_config_word(void *priv) } switch (cd_dma16) { - case 0xFF: /* -1 - do nothing - temp += 0 << 22; */ + case 0xFF: // -1 + //do nothing break; case 5: temp += 1 << 22; @@ -789,41 +957,176 @@ azt2316a_config_read(uint16_t addr, void *priv) /* Some WSS config here + config change enable bit (setting bit 7 and writing back) */ - if (addr == (azt2316a->cur_addr + 0x404)) { - /* TODO: what is the real meaning of the read value? - I got a mention of bit 0x10 for WSS from disassembling the source - code of the driver, and when playing with the I/O ports on real - hardware after doing some configuration, but didn't dig into it. - Bit 0x08 seems to be a busy flag and generates a timeout - (continuous re-reading when initializing windows 98) */ - temp = azt2316a->cur_mode ? 0x07 : 0x0F; - if (azt2316a->config_word_unlocked) { - temp |= 0x80; - } - } else { - // Rest of config. These are documented in the Linux driver. - switch (addr & 0x3) { - case 0: - temp = azt2316a->config_word & 0xFF; + if (addr == (azt2316a->cur_addr + 0x404)) { + /* TODO: what is the real meaning of the read value? + I got a mention of bit 0x10 for WSS from disassembling the source + code of the driver, and when playing with the I/O ports on real + hardware after doing some configuration, but didn't dig into it. + Bit 0x08 seems to be a busy flag and generates a timeout + (continuous re-reading when initializing windows 98) */ + temp = azt2316a->cur_mode ? 0x07 : 0x0F; + if (azt2316a->config_word_unlocked) { + temp |= 0x80; + } + } else { + // Rest of config. These are documented in the Linux driver. + switch (addr & 0x3) { + case 0: + temp = azt2316a->config_word & 0xFF; + break; + case 1: + temp = (azt2316a->config_word >> 8); + break; + case 2: + temp = (azt2316a->config_word >> 16); + break; + case 3: + temp = (azt2316a->config_word >> 24); + break; + + default: + break; + } + } + + aztech_log(azt2316a->log, "Aztech 2316 Config Word Read: (%04X) = %02X\n", addr, temp); + + return temp; +} + +static void +aztpr16_config_write(uint16_t addr, uint8_t val, void *priv) +{ + azt2316a_t *azt2316a = (azt2316a_t *) priv; + uint8_t temp; + + aztech_log(azt2316a->log, "Aztech PR16 Config Word Write: (%04X) = %02X\n", addr, val); + + if (addr == (azt2316a->cur_addr + 0x404)) { + if (val & 0x80) + azt2316a->config_word_unlocked = 1; + else + azt2316a->config_word_unlocked = 0; + } else if (azt2316a->config_word_unlocked) { + if (val == 0xFF) { + return; + } + switch (addr & 3) { + case 0: + azt2316a->config_word = (azt2316a->config_word & 0xFFFFFF00) | val; + + temp = val & 3; + if (temp == 0) + azt2316a->cur_addr = 0x220; + else if (temp == 1) + azt2316a->cur_addr = 0x240; + else if (temp == 2) + azt2316a->cur_addr = 0x260; + else if (temp == 3) + azt2316a->cur_addr = 0x280; + + if (val & 0x4) + azt2316a->cur_mpu401_addr = 0x330; + else + azt2316a->cur_mpu401_addr = 0x300; + + if (val & 0x8) + azt2316a->cur_mpu401_enabled = 1; + else + azt2316a->cur_mpu401_enabled = 0; + + if (val & 0x10) + azt2316a->gameport_enabled = 1; + else + azt2316a->gameport_enabled = 0; break; case 1: - temp = (azt2316a->config_word >> 8); + azt2316a->config_word = (azt2316a->config_word & 0xFFFF00FF) | (val << 8); + + if (val & 0x1) + azt2316a->cur_irq = 2; + else if (val & 0x2) + azt2316a->cur_irq = 5; + else if (val & 0x4) + azt2316a->cur_irq = 7; + else if (val & 0x8) + azt2316a->cur_irq = 10; + /* else undefined? */ + + if (val & 0x10) + azt2316a->cur_mpu401_irq = 2; + else if (val & 0x20) + azt2316a->cur_mpu401_irq = 5; + else if (val & 0x40) + azt2316a->cur_mpu401_irq = 7; + else if (val & 0x80) + azt2316a->cur_mpu401_irq = 10; + /* else undefined? */ break; case 2: - temp = (azt2316a->config_word >> 16); + azt2316a->config_word = (azt2316a->config_word & 0xFF00FFFF) | (val << 16); + + io_removehandler(azt2316a->cur_wss_addr, 0x0004, azt2316a_wss_read, NULL, NULL, azt2316a_wss_write, NULL, NULL, azt2316a); + io_removehandler(azt2316a->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &azt2316a->ad1848); + + temp = val & 0x3; + if (temp == 0) + azt2316a->cur_wss_addr = 0x530; + else if (temp == 1) + azt2316a->cur_wss_addr = 0x604; + else if (temp == 2) + azt2316a->cur_wss_addr = 0xE80; + else if (temp == 3) + azt2316a->cur_wss_addr = 0xF40; + + io_sethandler(azt2316a->cur_wss_addr, 0x0004, azt2316a_wss_read, NULL, NULL, azt2316a_wss_write, NULL, NULL, azt2316a); + io_sethandler(azt2316a->cur_wss_addr + 0x0004, 0x0004, ad1848_read, NULL, NULL, ad1848_write, NULL, NULL, &azt2316a->ad1848); + + /* no actual effect */ + if (val & 0x4) + azt2316a->cur_wss_enabled = 1; + else + azt2316a->cur_wss_enabled = 0; break; case 3: - temp = (azt2316a->config_word >> 24); + azt2316a->config_word = (azt2316a->config_word & 0x00FFFFFF) | (val << 24); + + if (val & 0x01) { + azt2316a->cur_dma = 0; + azt2316a->cur_wss_dma = 0; + } else if (val & 0x02) { + azt2316a->cur_dma = 1; + azt2316a->cur_wss_dma = 1; + } else if (val & 0x04) { + azt2316a->cur_dma = 3; + azt2316a->cur_wss_dma = 3; + } + + if (val & 0x08) + azt2316a->cur_wss_dma16 = 5; + else if (val & 0x10) + azt2316a->cur_wss_dma16 = 6; + else if (val & 0x20) + azt2316a->cur_wss_dma16 = 7; break; default: break; } - } + /* update sbprov2 configs */ + sb_dsp_setaddr(&azt2316a->sb->dsp, azt2316a->cur_addr); + sb_dsp_setirq(&azt2316a->sb->dsp, azt2316a->cur_irq); + sb_dsp_setdma8(&azt2316a->sb->dsp, azt2316a->cur_dma); - aztech_log(azt2316a->log, "Aztech 2316 Config Word Read: (%04X) = %02X\n", addr, temp); + mpu401_change_addr(azt2316a->mpu, azt2316a->cur_mpu401_addr); + mpu401_setirq(azt2316a->mpu, azt2316a->cur_mpu401_irq); - return temp; + ad1848_setdma(&azt2316a->ad1848, azt2316a->cur_wss_dma); + ad1848_setirq(&azt2316a->ad1848, azt2316a->cur_irq); + azt2316a->cur_wss_irq = azt2316a->cur_irq; + + gameport_remap(azt2316a->gameport, (azt2316a->gameport_enabled) ? 0x200 : 0x00); + } } static void @@ -840,7 +1143,7 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *priv) else azt2316a->config_word_unlocked = 0; } else if (azt2316a->config_word_unlocked) { - if (val == 0xFF) { /* TODO: check if this still happens on eeprom.sys after having more complete emulation! */ + if (val == 0xFF) { return; } switch (addr & 3) { @@ -852,12 +1155,7 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *priv) azt2316a->cur_addr = 0x220; else if (temp == 1) azt2316a->cur_addr = 0x240; -#if 0 - else if (temp == 2) - azt2316a->cur_addr = 0x260; // TODO: INVALID - else if (temp == 3) - azt2316a->cur_addr = 0x280; // TODO: INVALID -#endif + if (val & 0x4) azt2316a->cur_mpu401_addr = 0x330; else @@ -867,6 +1165,11 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *priv) azt2316a->cur_mpu401_enabled = 1; else azt2316a->cur_mpu401_enabled = 0; + + if (val & 0x10) + azt2316a->gameport_enabled = 1; + else + azt2316a->gameport_enabled = 0; break; case 1: azt2316a->config_word = (azt2316a->config_word & 0xFFFF00FF) | (val << 8); @@ -929,6 +1232,8 @@ azt1605_config_write(uint16_t addr, uint8_t val, void *priv) mpu401_change_addr(azt2316a->mpu, azt2316a->cur_mpu401_addr); mpu401_setirq(azt2316a->mpu, azt2316a->cur_mpu401_irq); + + gameport_remap(azt2316a->gameport, (azt2316a->gameport_enabled) ? 0x200 : 0x00); } } @@ -1000,6 +1305,11 @@ azt2316a_config_write(uint16_t addr, uint8_t val, void *priv) else azt2316a->cur_wss_enabled = 0; + if (val & 0x8) + azt2316a->gameport_enabled = 1; + else + azt2316a->gameport_enabled = 0; + if (val & 0x10) azt2316a->cur_mpu401_addr = 0x330; else @@ -1037,6 +1347,8 @@ azt2316a_config_write(uint16_t addr, uint8_t val, void *priv) mpu401_change_addr(azt2316a->mpu, azt2316a->cur_mpu401_addr); mpu401_setirq(azt2316a->mpu, azt2316a->cur_mpu401_irq); + + gameport_remap(azt2316a->gameport, (azt2316a->gameport_enabled) ? 0x200 : 0x00); } } @@ -1062,6 +1374,33 @@ azt2316a_enable_wss(uint8_t enable, void *priv) } } +void +aztpr16_wss_mode(uint8_t mode, void *priv) +{ + azt2316a_t *azt2316a = (azt2316a_t *) priv; + + sound_set_cd_audio_filter(NULL, NULL); + + if (mode) { + azt2316a->cur_mode = 1; + sound_set_cd_audio_filter(ad1848_filter_cd_audio, &azt2316a->ad1848); + azt2316a->sb->opl_mixer = azt2316a; + azt2316a->sb->opl_mix = azt1605_filter_opl; + } + else { + azt2316a->cur_mode = 0; + sound_set_cd_audio_filter(sbpro_filter_cd_audio, azt2316a->sb); + azt2316a->sb->opl_mixer = NULL; + azt2316a->sb->opl_mix = NULL; + } + + if (mode == 0x03) + ad1848_setdma(&azt2316a->ad1848, azt2316a->cur_wss_dma16); + else + ad1848_setdma(&azt2316a->ad1848, azt2316a->cur_wss_dma); + +} + static void azt2316a_get_buffer(int32_t *buffer, int len, void *priv) { @@ -1097,6 +1436,8 @@ azt_init(const device_t *info) fn = "azt1605.nvr"; } else if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) { fn = "azt2316a.nvr"; + } else if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + fn = "aztpr16.nvr"; } /* config */ @@ -1121,13 +1462,13 @@ azt_init(const device_t *info) if (!loaded_from_eeprom) { if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) { - read_eeprom[0] = 0x00; - read_eeprom[1] = 0x00; - read_eeprom[2] = 0x00; - read_eeprom[3] = 0x00; - read_eeprom[4] = 0x00; - read_eeprom[5] = 0x00; - read_eeprom[6] = 0x00; + read_eeprom[0] = 0xee; /* SB Voice mixer value */ + read_eeprom[1] = 0x00; /* SB Mic mixer value (bits 2-0) */ + read_eeprom[2] = 0x00; /* SB Record Source */ + read_eeprom[3] = 0xee; /* SB Master mixer value */ + read_eeprom[4] = 0xee; /* SB FM mixer value */ + read_eeprom[5] = 0xee; /* SB CD mixer value */ + read_eeprom[6] = 0x00; /* SB Line mixer value */ read_eeprom[7] = 0x00; read_eeprom[8] = 0x00; read_eeprom[9] = 0x00; @@ -1154,6 +1495,28 @@ azt_init(const device_t *info) read_eeprom[13] = 0x14; read_eeprom[14] = 0x04; read_eeprom[15] = 0xFF; /* SBPro Master volume (EMUTSR) */ + } else if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + read_eeprom[0] = 0x00; + read_eeprom[1] = 0x00; + read_eeprom[2] = 0x00; + read_eeprom[3] = 0x3f; /* Master Volume L */ + read_eeprom[4] = 0x3f; /* Master Volume R */ + read_eeprom[5] = 0x1f; /* Wave Volume L */ + read_eeprom[6] = 0x1f; /* Wave Volume R */ + read_eeprom[7] = 0x1f; /* FM Volume L */ + read_eeprom[8] = 0x1f; /* FM Volume R */ + read_eeprom[9] = 0x1f; /* CD Volume L */ + read_eeprom[10] = 0x1f; /* CD Volume R */ + read_eeprom[11] = 0x1f; /* Line Volume L */ + read_eeprom[12] = 0x1f; /* Line Volume R */ + read_eeprom[13] = 0x1f; /* Mic Volume L */ + read_eeprom[14] = 0x1f; /* Mic Volume R */ + read_eeprom[15] = 0x1f; /* WSynth Volume L */ + read_eeprom[16] = 0x1f; /* WSynth Volume R */ + read_eeprom[32] = 0x1c; + read_eeprom[33] = 0x12; + read_eeprom[34] = 0x04; + read_eeprom[35] = 0x02; } } @@ -1218,6 +1581,11 @@ azt_init(const device_t *info) else azt2316a->cur_wss_enabled = 0; + if (azt2316a->config_word & (1 << 11)) + azt2316a->gameport_enabled = 1; + else + azt2316a->gameport_enabled = 0; + if (azt2316a->config_word & (1 << 12)) azt2316a->cur_mpu401_addr = 0x330; else @@ -1267,6 +1635,11 @@ azt_init(const device_t *info) else azt2316a->cur_mpu401_enabled = 0; + if (azt2316a->config_word & (1 << 4)) + azt2316a->gameport_enabled = 1; + else + azt2316a->gameport_enabled = 0; + if (azt2316a->config_word & (1 << 8)) azt2316a->cur_irq = 9; else if (azt2316a->config_word & (1 << 9)) @@ -1312,18 +1685,122 @@ azt_init(const device_t *info) azt2316a->cur_wss_enabled = 0; // these are not present on the EEPROM - azt2316a->cur_dma = device_get_config_int("sb_dma8"); // TODO: investigate TSR to make this work with it - there is no software configurable DMA8? + azt2316a->cur_dma = device_get_config_int("sb_dma8"); azt2316a->cur_wss_irq = device_get_config_int("wss_irq"); azt2316a->cur_wss_dma = device_get_config_int("wss_dma"); azt2316a->cur_mode = 0; + } else if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + azt2316a->config_word = read_eeprom[32] + (read_eeprom[33] << 8) + (read_eeprom[34] << 16) + (read_eeprom[35] << 24); + aztech_log(azt2316a->log, "AZTPR16 Config Word = %08X\n", azt2316a->config_word); + + switch (azt2316a->config_word & (3 << 0)) { + case 0: + azt2316a->cur_addr = 0x220; + break; + case 1: + azt2316a->cur_addr = 0x240; + break; + case 2: + azt2316a->cur_addr = 0x260; + break; + case 3: + azt2316a->cur_addr = 0x280; + break; + default: + fatal("AZTPR16: invalid sb addr in config word %08X\n", azt2316a->config_word); + break; + } + + if (azt2316a->config_word & (1 << 2)) + azt2316a->cur_mpu401_addr = 0x330; + else + azt2316a->cur_mpu401_addr = 0x300; + + if (azt2316a->config_word & (1 << 3)) + azt2316a->cur_mpu401_enabled = 1; + else + azt2316a->cur_mpu401_enabled = 0; + + if (azt2316a->config_word & (1 << 4)) + azt2316a->gameport_enabled = 1; + else + azt2316a->gameport_enabled = 0; + + if (azt2316a->config_word & (1 << 8)) + azt2316a->cur_irq = 2; + else if (azt2316a->config_word & (1 << 9)) + azt2316a->cur_irq = 5; + else if (azt2316a->config_word & (1 << 10)) + azt2316a->cur_irq = 7; + else if (azt2316a->config_word & (1 << 11)) + azt2316a->cur_irq = 10; + else + fatal("AZTPR16: invalid sb irq in config word %08X\n", azt2316a->config_word); + + if (azt2316a->config_word & (1 << 12)) + azt2316a->cur_mpu401_irq = 2; + else if (azt2316a->config_word & (1 << 13)) + azt2316a->cur_mpu401_irq = 5; + else if (azt2316a->config_word & (1 << 14)) + azt2316a->cur_mpu401_irq = 7; + else if (azt2316a->config_word & (1 << 15)) + azt2316a->cur_mpu401_irq = 10; + else + fatal("AZTPR16: invalid mpu401 irq in config word %08X\n", azt2316a->config_word); + switch (azt2316a->config_word & (3 << 16)) { + case 0: + azt2316a->cur_wss_addr = 0x530; + break; + case 1 << 16: + azt2316a->cur_wss_addr = 0x604; + break; + case 2 << 16: + azt2316a->cur_wss_addr = 0xE80; + break; + case 3 << 16: + azt2316a->cur_wss_addr = 0xF40; + break; + default: + fatal("AZTPR16: invalid wss addr in config word %08X\n", azt2316a->config_word); + break; + } + + if (azt2316a->config_word & (1 << 18)) + azt2316a->cur_wss_enabled = 1; + else + azt2316a->cur_wss_enabled = 0; + + if (azt2316a->config_word & (1 << 24)) + azt2316a->cur_dma = 0; + else if (azt2316a->config_word & (1 << 25)) + azt2316a->cur_dma = 1; + else if (azt2316a->config_word & (1 << 26)) + azt2316a->cur_dma = 3; + + if (azt2316a->config_word & (1 << 27)) + azt2316a->cur_wss_dma16 = 5; + else if (azt2316a->config_word & (1 << 28)) + azt2316a->cur_wss_dma16 = 6; + else if (azt2316a->config_word & (1 << 29)) + azt2316a->cur_wss_dma16 = 7; + + // these are not present on the EEPROM + azt2316a->cur_wss_irq = azt2316a->cur_irq; + azt2316a->cur_wss_dma = azt2316a->cur_dma; + azt2316a->cur_mode = 0; } - addr_setting = device_get_config_hex16("addr"); - if (addr_setting) - azt2316a->cur_addr = addr_setting; + if (azt2316a->type != SB_SUBTYPE_CLONE_AZTPR16_0X09) { + addr_setting = device_get_config_hex16("addr"); + if (addr_setting) + azt2316a->cur_addr = addr_setting; + } /* wss part */ - ad1848_init(&azt2316a->ad1848, device_get_config_int("codec")); + if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) + ad1848_init(&azt2316a->ad1848, AD1848_TYPE_DEFAULT); /* AZTPR16 has an internal AD1848-compatible (non-Mode 2 capable) WSS codec */ + else + ad1848_init(&azt2316a->ad1848, device_get_config_int("codec")); if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) ad1848_set_cd_audio_channel(&azt2316a->ad1848, (device_get_config_int("codec") == AD1848_TYPE_CS4248) ? AD1848_AUX1 : AD1848_LINE_IN); else @@ -1334,6 +1811,8 @@ azt_init(const device_t *info) if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) io_sethandler(azt2316a->cur_addr + 0x0400, 0x0040, azt2316a_config_read, NULL, NULL, azt2316a_config_write, NULL, NULL, azt2316a); + else if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) + io_sethandler(azt2316a->cur_addr + 0x0400, 0x0010, azt1605_config_read, NULL, NULL, aztpr16_config_write, NULL, NULL, azt2316a); else /* Aztech 1605 only needs 62x/64x */ io_sethandler(azt2316a->cur_addr + 0x0400, 0x0010, azt1605_config_read, NULL, NULL, azt1605_config_write, NULL, NULL, azt2316a); io_sethandler(azt2316a->cur_wss_addr, 0x0004, azt2316a_wss_read, NULL, NULL, azt2316a_wss_write, NULL, NULL, azt2316a); @@ -1395,6 +1874,17 @@ azt_init(const device_t *info) if (device_get_config_int("receive_input")) midi_in_handler(1, sb_dsp_input_msg, sb_dsp_input_sysex, &azt2316a->sb->dsp); + /* Restore SBPro mixer settings from EEPROM on AZT2316A cards */ + if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) { + azt2316a->sb->mixer_sbpro.regs[0x04] = read_eeprom[0]; /* SBPro Voice */ + azt2316a->sb->mixer_sbpro.regs[0x0a] = read_eeprom[1]; /* SBPro Mic */ + azt2316a->sb->mixer_sbpro.regs[0x0c] = read_eeprom[2]; /* SBPro Record Source */ + azt2316a->sb->mixer_sbpro.regs[0x22] = read_eeprom[3]; /* SBPro Master */ + azt2316a->sb->mixer_sbpro.regs[0x26] = read_eeprom[4]; /* SBPro FM */ + azt2316a->sb->mixer_sbpro.regs[0x28] = read_eeprom[5]; /* SBPro CD */ + azt2316a->sb->mixer_sbpro.regs[0x2e] = read_eeprom[6]; /* SBPro Line */ + } + /* Restore WSS mixer settings from EEPROM on AZT1605 cards */ if (azt2316a->type == SB_SUBTYPE_CLONE_AZT1605_0X0C) { azt2316a->ad1848.regs[0] = read_eeprom[0]; /* WSS ADC L */ @@ -1409,6 +1899,72 @@ azt_init(const device_t *info) azt2316a->ad1848.regs[19] = read_eeprom[9]; /* CS4231 LINE/SB Voice R */ azt2316a->ad1848.regs[26] = read_eeprom[10]; /* CS4231 Mic */ } + /* Restore mixer settings from EEPROM on AZTPR16 cards */ + if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + azt2316a->sb->mixer_sbpro.regs[0x84] = read_eeprom[3]; /* Master L */ + azt2316a->sb->mixer_sbpro.regs[0x86] = read_eeprom[4]; /* Master R */ + azt2316a->sb->mixer_sbpro.regs[0x88] = read_eeprom[5]; /* Wave L */ + azt2316a->sb->mixer_sbpro.regs[0x8a] = read_eeprom[6]; /* Wave R */ + azt2316a->sb->mixer_sbpro.regs[0x8c] = read_eeprom[7]; /* FM L */ + azt2316a->sb->mixer_sbpro.regs[0x8e] = read_eeprom[8]; /* FM R */ + azt2316a->sb->mixer_sbpro.regs[0xa0] = read_eeprom[9]; /* CD L */ + azt2316a->sb->mixer_sbpro.regs[0xa2] = read_eeprom[10]; /* CD R */ + azt2316a->sb->mixer_sbpro.regs[0xa4] = read_eeprom[11]; /* Line L */ + azt2316a->sb->mixer_sbpro.regs[0xa6] = read_eeprom[12]; /* Line R */ + azt2316a->sb->mixer_sbpro.regs[0xa8] = read_eeprom[13]; /* Mic L */ + azt2316a->sb->mixer_sbpro.regs[0xaa] = read_eeprom[14]; /* Mic R */ + azt2316a->sb->mixer_sbpro.regs[0xac] = read_eeprom[15]; /* WSynth L */ + azt2316a->sb->mixer_sbpro.regs[0xae] = read_eeprom[16]; /* WSynth R */ + azt2316a->sb->mixer_sbpro.regs[0xc2] = read_eeprom[18]; /* Speaker */ + azt2316a->sb->mixer_sbpro.regs[0xc4] = read_eeprom[19]; /* Bass */ + azt2316a->sb->mixer_sbpro.regs[0xc6] = read_eeprom[20]; /* Treble */ + azt2316a->sb->mixer_sbpro.regs[0xc8] = read_eeprom[21]; /* I/O settings byte 1 */ + azt2316a->sb->mixer_sbpro.regs[0xca] = read_eeprom[22]; /* I/O settings byte 2 */ + azt2316a->sb->mixer_sbpro.regs[0xcc] = read_eeprom[23]; /* I/O settings byte 3 */ + azt2316a->sb->mixer_sbpro.regs[0xce] = read_eeprom[24]; /* I/O settings byte 4 */ + azt2316a->sb->mixer_sbpro.regs[0xe0] = read_eeprom[25]; /* Record Gain R */ + azt2316a->sb->mixer_sbpro.regs[0xe2] = read_eeprom[26]; /* Record Gain L */ + azt2316a->sb->mixer_sbpro.regs[0xe4] = read_eeprom[27]; /* Output Gain L */ + azt2316a->sb->mixer_sbpro.regs[0xe6] = read_eeprom[28]; /* Output Gain L */ + azt2316a->sb->mixer_sbpro.regs[0xe8] = read_eeprom[29]; /* Output Gain L */ + + /* Sane initial WSS values */ + azt2316a->ad1848.regs[0] = 0x08; /* WSS ADC L */ + azt2316a->ad1848.regs[1] = 0x08; /* WSS ADC R */ + azt2316a->ad1848.regs[2] = 0x08; /* WSS AUX1/CD L */ + azt2316a->ad1848.regs[3] = 0x08; /* WSS AUX1/CD R */ + azt2316a->ad1848.regs[4] = 0x08; /* WSS AUX2/FM L */ + azt2316a->ad1848.regs[5] = 0x08; /* WSS AUX2/FM R */ + azt2316a->ad1848.regs[6] = 0x08; /* WSS DAC L */ + azt2316a->ad1848.regs[7] = 0x08; /* WSS DAC R */ + + /* Set up CD volume table */ + uint8_t c; + double attenuation; + + for (c = 0; c < 32; c++) { + attenuation = 12.0; + if (c & 0x01) + attenuation -= 1.5; + if (c & 0x02) + attenuation -= 3.0; + if (c & 0x04) + attenuation -= 6.0; + if (c & 0x08) + attenuation -= 12.0; + if (c & 0x10) + attenuation -= 24.0; + + attenuation = pow(10, attenuation / 10); + + aztpr16_vols_5bits[c] = (attenuation * 65536); + } + + aztpr16_update_mixer(azt2316a); + } + + azt2316a->gameport = gameport_add(&gameport_pnp_device); + gameport_remap(azt2316a->gameport, (azt2316a->gameport_enabled) ? 0x200: 0x00); return azt2316a; } @@ -1425,6 +1981,8 @@ azt_close(void *priv) fn = "azt1605.nvr"; } else if (azt2316a->type == SB_SUBTYPE_CLONE_AZT2316A_0X11) { fn = "azt2316a.nvr"; + } else if (azt2316a->type == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + fn = "aztpr16.nvr"; } /* always save to eeprom (recover from bad values) */ @@ -1434,7 +1992,6 @@ azt_close(void *priv) checksum += azt2316a->sb->dsp.azt_eeprom[i]; fwrite(azt2316a->sb->dsp.azt_eeprom, AZTECH_EEPROM_SIZE, 1, fp); - // TODO: confirm any models saving mixer settings to EEPROM and implement reading back // TODO: should remember to save wss duplex setting if 86Box has voice recording implemented in the future? Also, default azt2316a->wss_config // TODO: azt2316a->cur_mode is not saved to EEPROM? fwrite(&checksum, sizeof(checksum), 1, fp); @@ -1463,6 +2020,45 @@ azt_speed_changed(void *priv) sb_speed_changed(azt2316a->sb); } +static const device_config_t aztpr16_config[] = { + // clang-format off + { + .name = "opl", + .description = "Enable OPL", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 1, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, + { + .name = "receive_input", + .description = "Receive MIDI input", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 1, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, + { + .name = "receive_input401", + .description = "Receive MIDI input (MPU-401)", + .type = CONFIG_BINARY, + .default_string = NULL, + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { { 0 } } + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + static const device_config_t azt1605_config[] = { // clang-format off { @@ -1710,3 +2306,17 @@ const device_t azt1605_device = { .force_redraw = NULL, .config = azt1605_config }; + +const device_t aztpr16_device = { + .name = "Aztech Sound Galaxy Pro 16 (AZTPR16)", + .internal_name = "aztpr16", + .flags = DEVICE_ISA16, + .local = SB_SUBTYPE_CLONE_AZTPR16_0X09, + .init = azt_init, + .close = azt_close, + .reset = NULL, + .available = NULL, + .speed_changed = azt_speed_changed, + .force_redraw = NULL, + .config = aztpr16_config +}; diff --git a/src/sound/snd_sb.c b/src/sound/snd_sb.c index f041ebb8c2b..c2193869d1d 100644 --- a/src/sound/snd_sb.c +++ b/src/sound/snd_sb.c @@ -43,6 +43,7 @@ #include <86box/timer.h> #include <86box/snd_sb.h> #include <86box/plat_unused.h> +#include <86box/snd_azt2316a.h> #define SB_1 0 #define SB_15 1 @@ -863,6 +864,76 @@ sb_ct1345_mixer_write(uint16_t addr, uint8_t val, void *priv) mixer->regs[0x26] = mixer->regs[0x28] = 0xee; mixer->regs[0x2e] = 0x00; sb_dsp_set_stereo(&sb->dsp, mixer->regs[0x0e] & 2); + } else if (sb->dsp.sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + mixer->regs[mixer->index] = val; + sb_log("sb_ct1345: Register WRITE, AZTPR16: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); + aztpr16_update_mixer(sb->dsp.parent); + + switch (mixer->index) { + /* Compatibility: chain registers 0x02 and 0x22 as well as 0x06 and 0x26 */ + case 0x02: + case 0x06: + case 0x08: + mixer->regs[mixer->index + 0x20] = ((val & 0xe) << 4) | (val & 0xe); + break; + + case 0x22: + case 0x26: + case 0x28: + mixer->regs[mixer->index - 0x20] = (val & 0xe); + break; + + /* More compatibility: + SoundBlaster Pro selects register 020h for 030h, 022h for 032h, + 026h for 036h, and 028h for 038h. */ + case 0x30: + case 0x32: + case 0x36: + case 0x38: + mixer->regs[mixer->index - 0x10] = (val & 0xee); + break; + + case 0x00: + case 0x04: + case 0x0a: + case 0x0c: + case 0x0e: + case 0x2e: + break; + + /* Aztech AZTPR16 mixer */ + case 0x84: + case 0x86: + case 0x88: + case 0x8a: + case 0x8c: + case 0x8e: + case 0xa0: + case 0xa2: + case 0xa4: + case 0xa6: + case 0xa8: + case 0xaa: + case 0xac: + case 0xae: + case 0xc2: + case 0xc4: + case 0xc6: + case 0xc8: + case 0xca: + case 0xcc: + case 0xce: + case 0xe0: + case 0xe2: + case 0xe4: + case 0xe6: + case 0xe8: + break; + + default: + sb_log("sb_ct1345: Unknown register WRITE: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); + break; + } } else { mixer->regs[mixer->index] = val; @@ -967,6 +1038,36 @@ sb_ct1345_mixer_read(uint16_t addr, void *priv) case 0x38: return mixer->regs[mixer->index]; + /* Aztech AZTPR16 mixer */ + case 0x84: + case 0x86: + case 0x88: + case 0x8a: + case 0x8c: + case 0x8e: + case 0xa0: + case 0xa2: + case 0xa4: + case 0xa6: + case 0xa8: + case 0xaa: + case 0xac: + case 0xae: + case 0xc2: + case 0xc4: + case 0xc6: + case 0xc8: + case 0xca: + case 0xcc: + case 0xce: + case 0xe0: + case 0xe2: + case 0xe4: + case 0xe6: + case 0xe8: + if (sb->dsp.sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09) + return mixer->regs[mixer->index]; + default: sb_log("sb_ct1345: Unknown register READ: %02X\t%02X\n", mixer->index, mixer->regs[mixer->index]); break; diff --git a/src/sound/snd_sb_dsp.c b/src/sound/snd_sb_dsp.c index bfc2847edb4..8adb46c5d85 100644 --- a/src/sound/snd_sb_dsp.c +++ b/src/sound/snd_sb_dsp.c @@ -1287,6 +1287,8 @@ sb_exec_command(sb_dsp_t *dsp) sb_add_data(dsp, 0x11); /* AZTECH get type, WASHINGTON/latest - according to devkit. E.g.: The one in the Itautec Infoway Multimidia */ else if ((dsp->sb_data[0] == 0x05 || dsp->sb_data[0] == 0x55) && dsp->sb_subtype == SB_SUBTYPE_CLONE_AZT1605_0X0C) sb_add_data(dsp, 0x0C); /* AZTECH get type, CLINTON - according to devkit. E.g.: The one in the Packard Bell Legend 100CD */ + else if ((dsp->sb_data[0] == 0x05 || dsp->sb_data[0] == 0x55) && dsp->sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09) + sb_add_data(dsp, 0x09); /* AZTECH get type, AZTPR16 */ else if (dsp->sb_data[0] == 0x08) { /* EEPROM address to write followed by byte */ if (dsp->sb_data[1] < 0 || dsp->sb_data[1] >= AZTECH_EEPROM_SIZE) @@ -1307,6 +1309,9 @@ sb_exec_command(sb_dsp_t *dsp) /* HACK: Aztech HWSET seems to rely on RP being incremented for detection to work after EMUTSR is run */ dsp->sb_read_rp++; break; + } else if ((dsp->sb_data[0] == 0x0f) && (dsp->sb_data[1] == 0xff) && (dsp->sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09)) { + sb_dsp_log("AZTPR16: Command 0x08, Subcommand 0x0f/0xff\n"); + sb_add_data(dsp, 0x80); } else sb_dsp_log("AZT2316A: UNKNOWN 0x08 COMMAND: %02X\n", dsp->sb_data[0]); /* 0x08 (when shutting down, driver tries to read 1 byte of response), 0x55, 0x0D, 0x08D seen */ break; @@ -1324,6 +1329,9 @@ sb_exec_command(sb_dsp_t *dsp) } else if (dsp->sb_data[0] == 0x01) { sb_dsp_log("AZT2316A: SB8PROV2 MODE!\n"); azt2316a_enable_wss(0, dsp->parent); + } else if ((dsp->sb_data[0] == 0x0f) && (dsp->sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09)) { + sb_dsp_log("AZTPR16: Mode switch command, params = %02X, %02X\n", dsp->sb_data[0], dsp->sb_data[1]); + aztpr16_wss_mode(dsp->sb_data[1], dsp->parent); } else sb_dsp_log("AZT2316A: UNKNOWN MODE! = %02x\n", dsp->sb_data[0]); // sequences 0x02->0xFF, 0x04->0xFF seen } @@ -1738,6 +1746,9 @@ sb_exec_command(sb_dsp_t *dsp) } else if (dsp->sb_subtype == SB_SUBTYPE_CLONE_AZT1605_0X0C) { sb_add_data(dsp, 0x2); sb_add_data(dsp, 0x1); + } else if (dsp->sb_subtype == SB_SUBTYPE_CLONE_AZTPR16_0X09) { + sb_add_data(dsp, 0x2); + sb_add_data(dsp, 0x1); } break; } @@ -1948,7 +1959,9 @@ sb_write(uint16_t addr, uint8_t val, void *priv) /* variable length commands */ if (dsp->sb_command == 0x08 && dsp->sb_data_stat == 1 && dsp->sb_data[0] == 0x08) sb_commands[dsp->sb_command] = 3; - else if (dsp->sb_command == 0x08 && dsp->sb_data_stat == 1 && dsp->sb_data[0] == 0x07) + else if (dsp->sb_command == 0x08 && dsp->sb_data_stat == 1 && (dsp->sb_data[0] == 0x07 || dsp->sb_data[0] == 0x0f)) + sb_commands[dsp->sb_command] = 2; + else if (dsp->sb_command == 0x09 && dsp->sb_data_stat == 1 && dsp->sb_data[0] == 0x0f) sb_commands[dsp->sb_command] = 2; } } @@ -1957,7 +1970,7 @@ sb_write(uint16_t addr, uint8_t val, void *priv) dsp->sb_data_stat = -1; if (IS_AZTECH(dsp)) { /* variable length commands */ - if (dsp->sb_command == 0x08) + if (dsp->sb_command == 0x08 || dsp->sb_command == 0x09) sb_commands[dsp->sb_command] = 1; } } diff --git a/src/sound/sound.c b/src/sound/sound.c index cdb3ec51c33..cbf35832793 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -147,6 +147,7 @@ static const SOUND_CARD sound_cards[] = { { &ad1816_device }, { &azt2316a_device }, { &azt1605_device }, + { &aztpr16_device }, { &sb_goldfinch_device }, { &cs4232_device }, { &cs4235_device }, From 4ee804a5bf4f68791d3e1e7fbf1fac582161262c Mon Sep 17 00:00:00 2001 From: Domppari Date: Mon, 5 Jan 2026 10:50:02 +0200 Subject: [PATCH 222/320] Extra validation of input, for CodeQL --- src/disk/hdd_audio.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/disk/hdd_audio.c b/src/disk/hdd_audio.c index 04c27e11d18..ad9a08a80ef 100644 --- a/src/disk/hdd_audio.c +++ b/src/disk/hdd_audio.c @@ -105,6 +105,15 @@ hdd_audio_load_profiles(void) return; } + /* Validate the path ends with our expected filename */ + const char *expected_suffix = "hdd_audio_profiles.cfg"; + size_t cfg_len = strlen(cfg_fn); + size_t suffix_len = strlen(expected_suffix); + if (cfg_len < suffix_len || strcmp(cfg_fn + cfg_len - suffix_len, expected_suffix) != 0) { + pclog("HDD Audio: Unexpected config path\n"); + return; + } + profiles_ini = ini_read_ex(cfg_fn, 1); /* lgtm[cpp/path-injection] */ if (profiles_ini == NULL) { pclog("HDD Audio: Failed to load hdd_audio_profiles.cfg\n"); From a2c20d04ce66cfaffaa5383c6bce16fee4cc9843 Mon Sep 17 00:00:00 2001 From: DimMan88 Date: Sun, 4 Jan 2026 21:20:03 +0000 Subject: [PATCH 223/320] Translated using Weblate (Greek) Currently translated at 80.7% (807 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/el/ --- src/qt/languages/el-GR.po | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 274cd10ac8b..21a12c9c13f 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2026-01-04 13:56+0000\n" +"PO-Revision-Date: 2026-01-05 21:56+0000\n" "Last-Translator: DimMan88 \n" "Language-Team: Greek \n" "Language: el-GR\n" @@ -1834,7 +1834,7 @@ msgid "Serial port passthrough 4" msgstr "Διέλευση σειριακής πόρτας 4" msgid "Renderer &options…" -msgstr "%Επιλογές απεικόνισης…" +msgstr "&Επιλογές απεικόνισης…" msgid "PC/XT Keyboard" msgstr "Πληκτρολόγιο PC/XT" From 3f0b56d5cb99845a60b83265871a953536cbcecb Mon Sep 17 00:00:00 2001 From: OBattler Date: Wed, 7 Jan 2026 07:02:22 +0100 Subject: [PATCH 224/320] ACC2036: Fix several typos that were breaking EMS, fixes #6677. --- src/chipset/acc2036.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/chipset/acc2036.c b/src/chipset/acc2036.c index 3984f82e0ce..9f039c4b93a 100644 --- a/src/chipset/acc2036.c +++ b/src/chipset/acc2036.c @@ -123,7 +123,8 @@ acc2036_recalc(acc2036_t *dev) ram_page_t *ep = &dev->ems_pages[i - start_i]; mem_mapping_disable(&rp->mapping); - mem_mapping_set_addr(&ep->mapping, ep->virt, 0x000040000); + ep->virt = ((i << 14) + 0x000a0000); + mem_mapping_set_addr(&ep->mapping, ep->virt, 0x00004000); mem_mapping_set_exec(&ep->mapping, ram + ep->phys); mem_set_mem_state_both(ep->virt, 0x00004000, MEM_READ_INTERNAL | MEM_WRITE_INTERNAL); } else { @@ -135,7 +136,7 @@ acc2036_recalc(acc2036_t *dev) int flags; uint8_t val; - mem_mapping_set_addr(&rp->mapping, rp->virt, 0x000040000); + mem_mapping_set_addr(&rp->mapping, rp->virt, 0x00004000); mem_mapping_set_exec(&rp->mapping, ram + rp->phys); if ((i >= 8) && (i <= 15)) { @@ -203,6 +204,8 @@ acc2036_recalc(acc2036_t *dev) mem_remap_top(384); } + mem_mapping_disable(&ram_mid_mapping); + flushmmucache_nopc(); } From b60f5a7ef615177dbfc8aede6d371fcb8f11755c Mon Sep 17 00:00:00 2001 From: DimMan88 Date: Tue, 6 Jan 2026 17:22:38 +0000 Subject: [PATCH 225/320] Translated using Weblate (Greek) Currently translated at 96.9% (969 of 999 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/el/ --- src/qt/languages/el-GR.po | 350 ++++++++++++++++++++------------------ 1 file changed, 183 insertions(+), 167 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 21a12c9c13f..6b3e1299048 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2026-01-05 21:56+0000\n" +"PO-Revision-Date: 2026-01-07 16:56+0000\n" "Last-Translator: DimMan88 \n" "Language-Team: Greek \n" "Language: el-GR\n" @@ -136,19 +136,19 @@ msgid "&4:3" msgstr "&4:3" msgid "&Square pixels (Keep ratio)" -msgstr "&Square pixels (Διατήρηση αναλογίας)" +msgstr "&Τετράγωνα εικονοστοιχεία (Διατήρηση αναλογίας)" msgid "&Integer scale" -msgstr "&Integer scale" +msgstr "&Aκέραια κλίμακα" msgid "4:&3 Integer scale" -msgstr "4:&3 Integer scale" +msgstr "Aκέραια κλίμακα 4:&3" msgid "EGA/(S)&VGA settings" msgstr "Ρυθμίσε&ις EGA/(S)VGA" msgid "&Inverted VGA monitor" -msgstr "&Inverted VGA monitor" +msgstr "&Αντεστραμμένο VGA monitor" msgid "VGA screen &type" msgstr "Τύπος οθόνης& VGA" @@ -187,7 +187,7 @@ msgid "&Average" msgstr "&Σχετικό" msgid "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" -msgstr "CGA/PCjr/Tandy/E&GA/(S)VGA overscan" +msgstr "Υπερσάρωση CGA/PCjr/Tandy/E&GA/(S)VGA" msgid "Change contrast for &monochrome display" msgstr "Αλλαγή αντίθεσης γι&α μονόχρωμη οθόνη" @@ -388,13 +388,13 @@ msgid "Dynamic Recompiler" msgstr "Dynamic Recompiler" msgid "CPU frame size" -msgstr "CPU frame size" +msgstr "Μέγεθος πλαισίου CPU" msgid "Larger frames (less smooth)" -msgstr "Larger frames (less smooth)" +msgstr "Μεγαλύτερα πλαίσια (λιγότερο ομαλό)" msgid "Smaller frames (smoother)" -msgstr "Smaller frames (smoother)" +msgstr "Μικρότερα πλαίσια (πιο ομαλό)" msgid "Video:" msgstr "Κάρτα γραφικών:" @@ -2389,493 +2389,502 @@ msgid "Always at selected speed" msgstr "Πάντα στην επιλεγμένη ταχύτητα" msgid "BIOS setting + Hotkeys (off during POST)" -msgstr "" +msgstr "Ρύθμιση BIOS + Συντόμευση πλήκτρων (ανενεργά κατά το POST)" msgid "64 KB starting from F0000" -msgstr "" +msgstr "64 KB αρχή από F0000" msgid "128 KB starting from E0000 (address MSB inverted, last 64 KB first)" msgstr "" +"128 KB αρχή από E0000 (διεύθυνση MSB αντεστραμμένη, τελευταία 64 KB πρώτα)" msgid "Sine" -msgstr "" +msgstr "Ημίτονο" msgid "Triangle" -msgstr "" +msgstr "Τρίγωνο" msgid "Linear" -msgstr "" +msgstr "Γραμμικό" msgid "4th Order" -msgstr "" +msgstr "4η Τάξη" msgid "7th Order" -msgstr "" +msgstr "7η Τάξη" msgid "Non-timed (original)" -msgstr "" +msgstr "Χωρίς χρονικό περιορισμό (πρωτότυπο)" msgid "45 Hz (JMP2 not populated)" -msgstr "" +msgstr "45 Hz (JMP2 not populated)" msgid "Two" -msgstr "" +msgstr "Δύο" msgid "Three" -msgstr "" +msgstr "Τρία" msgid "Wheel" -msgstr "" +msgstr "Τροχό" msgid "Five + Wheel" -msgstr "" +msgstr "Πέντε + Τροχό" msgid "Five + 2 Wheels" -msgstr "" +msgstr "Πέντε + 2 Τροχοί" msgid "A3 - SMT2 Serial / SMT3(R)V" -msgstr "" +msgstr "A3 - SMT2 Serial / SMT3(R)V" msgid "Q1 - SMT3(R) Serial" -msgstr "" +msgstr "Q1 - SMT3(R) Serial" msgid "8 KB" -msgstr "" +msgstr "8 KB" msgid "32 KB" -msgstr "" +msgstr "32 KB" msgid "16 KB" -msgstr "" +msgstr "16 KB" msgid "64 KB" -msgstr "" +msgstr "64 KB" msgid "Disable BIOS" -msgstr "" +msgstr "Απενεργοποίηση BIOS" msgid "512 KB" -msgstr "" +msgstr "512 KB" msgid "2 MB" -msgstr "" +msgstr "2 MB" msgid "8 MB" -msgstr "" +msgstr "8 MB" msgid "28 MB" -msgstr "" +msgstr "28 MB" msgid "1 MB" -msgstr "" +msgstr "1 MB" msgid "4 MB" -msgstr "" +msgstr "4 MB" msgid "12 MB" -msgstr "" +msgstr "12 MB" msgid "16 MB" -msgstr "" +msgstr "16 MB" msgid "20 MB" -msgstr "" +msgstr "20 MB" msgid "24 MB" -msgstr "" +msgstr "24 MB" msgid "SigmaTel STAC9721T (stereo)" -msgstr "" +msgstr "SigmaTel STAC9721T (stereo)" msgid "256 KB" -msgstr "" +msgstr "256 KB" msgid "Composite" msgstr "Composite" msgid "True color" -msgstr "" +msgstr "Ζωντανά χρώματα" msgid "Old" -msgstr "" +msgstr "Παλαιό" msgid "New" -msgstr "" +msgstr "Νέο" msgid "Color (generic)" -msgstr "" +msgstr "Έγχρωμο (γενικό)" msgid "Green Monochrome" -msgstr "" +msgstr "Μονόχρωμο Πράσινο" msgid "Amber Monochrome" -msgstr "" +msgstr "Μονόχρωμο Κεχριμπάρι" msgid "Gray Monochrome" -msgstr "" +msgstr "Μονόχρωμο Γκρι" msgid "Color (no brown)" -msgstr "" +msgstr "Έγχρωμο (χωρίς το καφέ)" msgid "Color (IBM 5153)" -msgstr "" +msgstr "Έγχρωμο (IBM 5153)" msgid "Simple doubling" -msgstr "" +msgstr "Απλός διπλασιασμός" msgid "sRGB interpolation" -msgstr "" +msgstr "Παρεμβολή sRGB" msgid "Linear interpolation" -msgstr "" +msgstr "Γραμμική παρεμβολή" msgid "Has secondary 8x8 character set" -msgstr "" +msgstr "Έχει δευτερεύον σετ χαρακτήρων 8x8" msgid "Has Quadcolor II daughter board" -msgstr "" +msgstr "Έχει θυγατρική πλακέτα Quadcolor II" msgid "Alternate monochrome contrast" -msgstr "" +msgstr "Εναλλακτική μονόχρωμη αντίθεση" msgid "128 KB" -msgstr "" +msgstr "128 KB" msgid "Monochrome (5151/MDA) (white)" -msgstr "" +msgstr "Μονόχρωμο (5151/MDA) (λευκό)" msgid "Monochrome (5151/MDA) (green)" -msgstr "" +msgstr "Μονόχρωμο (5151/MDA) πράσινο)" msgid "Monochrome (5151/MDA) (amber)" -msgstr "" +msgstr "Μονόχρωμο (5151/MDA) (κεχριμπάρι)" msgid "Color 40x25 (5153/CGA)" -msgstr "" +msgstr "Έγχρωμο 40x25 (5153/CGA)" msgid "Color 80x25 (5153/CGA)" -msgstr "" +msgstr "Έγχρωμο 80x25 (5153/CGA)" msgid "Enhanced Color - Normal Mode (5154/ECD)" -msgstr "" +msgstr "Ενισχυμένο Έγχρωμο - Κανονικός Τύπος (5154/ECD)" msgid "Enhanced Color - Enhanced Mode (5154/ECD)" -msgstr "" +msgstr "Ενισχυμένο Έγχρωμο - Ενισχυμένος Τύπος (5154/ECD)" msgid "Green" -msgstr "" +msgstr "Πράσινο" msgid "Amber" -msgstr "" +msgstr "Κεχριμπάρι" msgid "Gray" -msgstr "" +msgstr "Γκρι" msgid "Grayscale" -msgstr "" +msgstr "Κλίμακα του γκρι" msgid "Color" -msgstr "" +msgstr "Έγχρωμο" msgid "U.S. English" -msgstr "" +msgstr "Αγγλικά Η.Π." msgid "Scandinavian" -msgstr "" +msgstr "Σκανδιναβικά" msgid "Other languages" -msgstr "" +msgstr "Άλλες γλώσσες" msgid "Bochs latest" -msgstr "" +msgstr "Τελευταία έκδοση Bochs" msgid "Apply overscan deltas" -msgstr "" +msgstr "Εφαρμογή υπερσάρωσης δέλτα" msgid "Mono Interlaced" -msgstr "" +msgstr "Μονόχρωμο πλεγμένο" msgid "Mono Non-Interlaced" -msgstr "" +msgstr "Μονόχρωμο Μη-πλεγμένο" msgid "Color Interlaced" -msgstr "" +msgstr "Έγχρωμο πλεγμένο" msgid "Color Non-Interlaced" -msgstr "" +msgstr "Έγχρωμο Μη-πλεγμένο" msgid "3Dfx Voodoo Graphics" -msgstr "" +msgstr "Γραφικά 3Dfx Voodoo" msgid "3Dfx Voodoo 2" -msgstr "" +msgstr "3Dfx Voodoo 2" msgid "Obsidian SB50 + Amethyst (2 TMUs)" -msgstr "" +msgstr "Obsidian SB50 + Amethyst (2 TMUs)" msgid "8-bit" -msgstr "" +msgstr "8-bit" msgid "16-bit" -msgstr "" +msgstr "16-bit" msgid "Standard (150ns)" -msgstr "" +msgstr "Κανονικό (150ns)" msgid "High-Speed (120ns)" -msgstr "" +msgstr "Υψηλής-Ταχύτητας (120ns)" msgid "Enabled" -msgstr "" +msgstr "Ενεργοποιημένο" msgid "Standard" -msgstr "" +msgstr "Κανονικό" msgid "High-Speed" -msgstr "" +msgstr "Υψηλής-Ταχύτητας" msgid "Stereo LPT DAC" -msgstr "" +msgstr "Στέρεο LPT DAC" msgid "Generic Text Printer" -msgstr "" +msgstr "Γενικός Εκτυπωτής Κειμένου" msgid "Generic ESC/P 2 Dot-Matrix Printer" -msgstr "" +msgstr "Γενικός Εκτυπωτής ESC/P 2 Dot-Matrix" msgid "Generic PostScript Printer" -msgstr "" +msgstr "Γενικός Εκτυπωτής PostScript" msgid "Generic PCL5e Printer" -msgstr "" +msgstr "Γενικός Εκτυπωτής PCL5e" msgid "Parallel Line Internet Protocol" -msgstr "" +msgstr "Πρωτόκολλο Παράλληλης Γραμμής Internet" msgid "Protection Dongle for Savage Quest" -msgstr "" +msgstr "Dongle προστασίας για το Savage Quest" msgid "Serial Passthrough Device" -msgstr "" +msgstr "Συσκευή Σειριακής Διέλευσης" msgid "Passthrough Mode" -msgstr "" +msgstr "Τύπος Διέλευσης" msgid "Host Serial Device" -msgstr "" +msgstr "Σειριακή Συσκευή Οικοδεσπότη" msgid "Name of pipe" -msgstr "" +msgstr "Όνομα pipe" msgid "Data bits" -msgstr "" +msgstr "Bits δεδομένων" msgid "Stop bits" -msgstr "" +msgstr "Bits σταματήματος" msgid "Baud Rate of Passthrough" -msgstr "" +msgstr "Ρυθμός Baud της Διέλευσης" msgid "Named Pipe (Server)" -msgstr "" +msgstr "Ονομασμένο Pipe (Διακομιστής)" msgid "Named Pipe (Client)" -msgstr "" +msgstr "Ονομασμένο Pipe (Πελάτης)" msgid "Host Serial Passthrough" -msgstr "" +msgstr "Σειριακή Διέλευση Οικοδεσπότη" msgid "E&ject %1" -msgstr "" +msgstr "&Εξαγωγή %1" msgid "&Unmute" -msgstr "" +msgstr "&Κατάργηση σίγασης" msgid "Softfloat FPU" -msgstr "" +msgstr "FPU Softfloat" msgid "High performance impact" -msgstr "" +msgstr "Μεγάλη επίπτωση στην απόδοση" msgid "[Generic] RAM Disk (max. speed)" -msgstr "" +msgstr "[Γενικό] RAM Disk (τέρμα ταχύτητα)" msgid "[Generic] 1989 (3500 RPM)" -msgstr "" +msgstr "[Γενικό] 1989 (3500 RPM)" msgid "[Generic] 1992 (3600 RPM)" -msgstr "" +msgstr "[Γενικό] 1992 (3600 RPM)" msgid "[Generic] 1994 (4500 RPM)" -msgstr "" +msgstr "[Γενικό] 1994 (4500 RPM)" msgid "[Generic] 1996 (5400 RPM)" -msgstr "" +msgstr "[Γενικό] 1996 (5400 RPM)" msgid "[Generic] 1997 (5400 RPM)" -msgstr "" +msgstr "[Γενικό] 1997 (5400 RPM)" msgid "[Generic] 1998 (5400 RPM)" -msgstr "" +msgstr "[Γενικό] 1998 (5400 RPM)" msgid "[Generic] 2000 (7200 RPM)" -msgstr "" +msgstr "[Γενικό] 2000 (7200 RPM)" msgid "IBM 8514/A clone (ISA)" msgstr "Κλώνος IBM 8514/A (ISA)" msgid "Vendor" -msgstr "" +msgstr "Πωλητής" msgid "30 Hz (JMP2 = 1)" -msgstr "" +msgstr "30 Hz (JMP2 = 1)" msgid "60 Hz (JMP2 = 2)" -msgstr "" +msgstr "60 Hz (JMP2 = 2)" msgid "Generic PC/XT Memory Expansion" -msgstr "" +msgstr "Γενική Επέκταση Μνήμης PC/XT" msgid "Generic PC/AT Memory Expansion" -msgstr "" +msgstr "Γενική Επέκταση Μνήμης PC/AT" msgid "Unable to find Dot-Matrix fonts" -msgstr "" +msgstr "Αδυναμία εύρεσης γραμματοσειρών Dot-Matrix" msgid "TrueType fonts in the \"roms/printer/fonts\" directory are required for the emulation of the Generic ESC/P 2 Dot-Matrix Printer." msgstr "" +"Απαιτούνται γραμματοσειρές TrueType στον κατάλογο \"roms/printer/fonts\" για " +"την εξομοίωση Γενικού εκτυπωτή ESC/P 2 Dot-Matrix." msgid "Inhibit multimedia keys" -msgstr "" +msgstr "Αναστολή πλήκτρων πολυμέσων" msgid "Ask for confirmation before saving settings" -msgstr "" +msgstr "Ερώτηση επιβεβαίωσης πριν από την αποθήκευση των ρυθμίσεων" msgid "Ask for confirmation before hard resetting" msgstr "Ερώτηση επιβεβαίωσης πριν από την ολική επανεκκίνηση" msgid "Ask for confirmation before quitting" -msgstr "" +msgstr "Ερώτηση επιβεβαίωσης κατά την έξοδο" msgid "Options" -msgstr "" +msgstr "Επιλογές" msgid "Model" -msgstr "" +msgstr "Μοντέλο" msgid "Model:" -msgstr "" +msgstr "Μοντέλο:" msgid "Failed to initialize Vulkan renderer." -msgstr "Αποτυχία αρχικοποίησης απεικόνισης Vulkan." +msgstr "Αποτυχία αρχικοποίησης απεικονιστή Vulkan." msgid "GLSL Error" -msgstr "" +msgstr "Σφάλμα GLSL" msgid "Could not load shader: %1" -msgstr "" +msgstr "Αδυναμία φόρτωσης σκίασης: %1" msgid "Could not load texture: %1" -msgstr "" +msgstr "Αδυναμία φόρτωσης υφής: %1" msgid "Could not compile shader:\n\n%1" msgstr "" +"Αδυναμία σύνταξης σκίασης:\n" +"\n" +"%1" msgid "Program not linked:\n\n%1" msgstr "" +"Το πρόγραμμα δεν είναι συνδεδεμένο:\n" +"\n" +"%1" msgid "Shader Manager" -msgstr "" +msgstr "Διαχειριστής Σκίασης" msgid "Shader Configuration" -msgstr "" +msgstr "Διαμόρφωση Σκίασης" msgid "Add" -msgstr "" +msgstr "Προσθήκη" msgid "Move up" -msgstr "" +msgstr "Μετακίνηση επάνω" msgid "Move down" -msgstr "" +msgstr "Μετακίνηση κάτω" msgid "Could not load file %1" -msgstr "" +msgstr "Αδυναμία φόρτωσης αρχείου %1" msgid "Key Bindings:" -msgstr "" +msgstr "Αντιστοιχίσεις Πλήκτρων:" msgid "Action" -msgstr "" +msgstr "Ενέργεια" msgid "Keybind" -msgstr "" +msgstr "Αντιστοιχία πλήκτρου" msgid "Clear binding" -msgstr "" +msgstr "Καθαρισμός αντιστοιχίας" msgid "Bind" -msgstr "" +msgstr "Αντιστοίχησε" msgid "Bind Key" -msgstr "" +msgstr "Αντιστοίχησε Πλήκτρο" msgid "Enter key combo:" -msgstr "" +msgstr "Εισαγωγή συνδυασμού πλήκτρων:" msgid "Bind conflict" -msgstr "" +msgstr "Αντίκρουση αντιστοιχίας" msgid "This key combo is already in use." -msgstr "" +msgstr "Αυτός ο συνδυασμός πλήκτρων χρησιμοποιείται ήδη." msgid "Send Control+Alt+Del" -msgstr "" +msgstr "Αποστολή Control+Alt+Del" msgid "Send Control+Alt+Escape" -msgstr "" +msgstr "Αποστολή Control+Alt+Escape" msgid "Toggle fullscreen" -msgstr "" +msgstr "Εναλλαγή σε πλήρη οθόνη" msgid "Toggle UI in fullscreen" -msgstr "" +msgstr "Εναλλαγή ΠΧ σε πλήρη οθόνη" msgid "Screenshot" -msgstr "" +msgstr "Λήψη στιγμιότυπου" msgid "Release mouse pointer" msgstr "Απελευθέρωση δείκτη ποντικιού" msgid "Toggle pause" -msgstr "" +msgstr "Εναλλαγή παύσης" msgid "Toggle mute" -msgstr "" +msgstr "Εναλλαγή σίγασης" msgid "Text files" -msgstr "" +msgstr "Αρχεία κειμένου" msgid "ROM files" -msgstr "" +msgstr "Αρχεία ROM" msgid "SoundFont files" -msgstr "" +msgstr "Αρχεία SoundFont" msgid "Local Switch" -msgstr "" +msgstr "Τοπικός Διακόπτης" msgid "Remote Switch" -msgstr "" +msgstr "Απομακρυσμένος Διακόπτης" msgid "Switch:" -msgstr "" +msgstr "Διακόπτης:" msgid "Hub Mode" -msgstr "" +msgstr "Λειτουργία Hub" msgid "Hostname:" -msgstr "" +msgstr "Όνομα οικοδεσπότη:" msgid "ISA RAM:" msgstr "ISA RAM:" @@ -2884,16 +2893,23 @@ msgid "ISA ROM:" msgstr "ISA ROM:" msgid "&Wipe NVRAM" -msgstr "" +msgstr "&Εκκαθάριση NVRAM" msgid "This will delete all NVRAM (and related) files of the virtual machine located in the \"nvr\" subdirectory. You'll have to reconfigure the BIOS (and possibly other devices inside the VM) settings again if applicable.\n\nAre you sure you want to wipe all NVRAM contents of the virtual machine \"%1\"?" msgstr "" +"Αυτό θα διαγράψει όλα τα αρχεία NVRAM (και τα σχετικά) της εικονικής μηχανής " +"που βρίσκονται στον υποκατάλογο \"nvr\". Θα πρέπει να επαναρυθμίσετε το BIOS " +"(και πιθανώς άλλε συσκευές εντός της εικονικής μηχανής), εάν είναι " +"απαραίτητο.\n" +"\n" +"Είστε βέβαιοι ότι θέλετε να διαγράψετε όλα τα περιεχόμενα NVRAM της " +"εικονικής μηχανής \"%1\";" msgid "Success" -msgstr "" +msgstr "Επιτυχία" msgid "Successfully wiped the NVRAM contents of the virtual machine \"%1\"" -msgstr "" +msgstr "Επιτυχής διαγραφή των περιεχομένων NVRAM της εικονικής μηχανής \"%1\"" msgid "An error occurred trying to wipe the NVRAM contents of the virtual machine \"%1\"" msgstr "" From 6c0b6c056c13663179af50305f9d0a76488fd2a6 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 20:51:55 -0300 Subject: [PATCH 226/320] Network switch rewrite with a simpler protocol and multiple host interface support --- src/config.c | 12 +- src/include/86box/network.h | 6 +- src/network/CMakeLists.txt | 7 +- src/network/net_netswitch.c | 497 -------- src/network/net_switch.c | 547 ++++++++ src/network/netswitch.c | 970 --------------- src/network/netswitch.h | 295 ----- src/network/network.c | 12 +- src/network/networkmessage.pb.c | 19 - src/network/networkmessage.pb.h | 140 --- src/network/networkmessage.proto.txt | 38 - src/network/pb.h | 917 -------------- src/network/pb_common.c | 388 ------ src/network/pb_common.h | 49 - src/network/pb_decode.c | 1727 -------------------------- src/network/pb_decode.h | 193 --- src/network/pb_encode.c | 1001 --------------- src/network/pb_encode.h | 185 --- src/qt/qt_mediamenu.cpp | 2 +- src/qt/qt_settingsnetwork.cpp | 8 +- src/qt/qt_vmmanager_system.cpp | 2 +- 21 files changed, 565 insertions(+), 6450 deletions(-) delete mode 100644 src/network/net_netswitch.c create mode 100644 src/network/net_switch.c delete mode 100644 src/network/netswitch.c delete mode 100644 src/network/netswitch.h delete mode 100644 src/network/networkmessage.pb.c delete mode 100644 src/network/networkmessage.pb.h delete mode 100644 src/network/networkmessage.proto.txt delete mode 100644 src/network/pb.h delete mode 100644 src/network/pb_common.c delete mode 100644 src/network/pb_common.h delete mode 100644 src/network/pb_decode.c delete mode 100644 src/network/pb_decode.h delete mode 100644 src/network/pb_encode.c delete mode 100644 src/network/pb_encode.h diff --git a/src/config.c b/src/config.c index d7b1bfda378..a6087e555c4 100644 --- a/src/config.c +++ b/src/config.c @@ -809,8 +809,8 @@ load_network(void) nc->net_type = NET_TYPE_VDE; else if (!strcmp(p, "tap") || !strcmp(p, "4")) nc->net_type = NET_TYPE_TAP; - else if (!strcmp(p, "nmswitch") || !strcmp(p, "5")) - nc->net_type = NET_TYPE_NMSWITCH; + else if (!strcmp(p, "nlswitch") || !strcmp(p, "nmswitch") || !strcmp(p, "5")) + nc->net_type = NET_TYPE_NLSWITCH; else if (!strcmp(p, "nrswitch") || !strcmp(p, "6")) nc->net_type = NET_TYPE_NRSWITCH; else @@ -861,8 +861,8 @@ load_network(void) nc->net_type = NET_TYPE_VDE; else if (!strcmp(p, "tap") || !strcmp(p, "4")) nc->net_type = NET_TYPE_TAP; - else if (!strcmp(p, "nmswitch") || !strcmp(p, "5")) - nc->net_type = NET_TYPE_NMSWITCH; + else if (!strcmp(p, "nlswitch") || !strcmp(p, "nmswitch") || !strcmp(p, "5")) + nc->net_type = NET_TYPE_NLSWITCH; else if (!strcmp(p, "nrswitch") || !strcmp(p, "6")) nc->net_type = NET_TYPE_NRSWITCH; else @@ -2961,8 +2961,8 @@ save_network(void) case NET_TYPE_TAP: ini_section_set_string(cat, temp, "tap"); break; - case NET_TYPE_NMSWITCH: - ini_section_set_string(cat, temp, "nmswitch"); + case NET_TYPE_NLSWITCH: + ini_section_set_string(cat, temp, "nlswitch"); break; case NET_TYPE_NRSWITCH: ini_section_set_string(cat, temp, "nrswitch"); diff --git a/src/include/86box/network.h b/src/include/86box/network.h index 9c906ef1a1c..cad7b9128b9 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -50,8 +50,8 @@ #define NET_TYPE_PCAP 2 /* use the (Win)Pcap API */ #define NET_TYPE_VDE 3 /* use the VDE plug API */ #define NET_TYPE_TAP 4 /* use a linux TAP device */ -#define NET_TYPE_NMSWITCH 5 /* use the network multicast switch provider */ -#define NET_TYPE_NRSWITCH 6 /* use the network remote switch provider */ +#define NET_TYPE_NLSWITCH 5 /* use the local switch provider */ +#define NET_TYPE_NRSWITCH 6 /* use the remote switch provider */ #define NET_MAX_FRAME 1518 /* Queue size must be a power of 2 */ @@ -132,7 +132,7 @@ extern const netdrv_t net_slirp_drv; extern const netdrv_t net_vde_drv; extern const netdrv_t net_tap_drv; extern const netdrv_t net_null_drv; -extern const netdrv_t net_netswitch_drv; +extern const netdrv_t net_switch_drv; struct _netcard_t { const device_t *device; diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 0943a9258a3..44465486e38 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -60,12 +60,7 @@ endif() if(NETSWITCH) add_compile_definitions(USE_NETSWITCH) list(APPEND net_sources - net_netswitch.c - netswitch.c - pb_common.c - pb_encode.c - pb_decode.c - networkmessage.pb.c + net_switch.c ) endif() diff --git a/src/network/net_netswitch.c b/src/network/net_netswitch.c deleted file mode 100644 index 1cd0a81a71f..00000000000 --- a/src/network/net_netswitch.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * 86Box A hypervisor and IBM PC system emulator that specializes in - * running old operating systems and software designed for IBM - * PC systems and compatibles from 1981 through fairly recent - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Network Switch network driver - * - * Authors: cold-brewed - * - * Copyright 2024 cold-brewed - */ -#include -#include -#include -#include -#include -#include -#include -#ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -# include -#else -# include -#endif - -#define HAVE_STDARG_H -#include <86box/86box.h> -#include <86box/device.h> -#include <86box/thread.h> -#include <86box/timer.h> -#include <86box/network.h> -#include <86box/net_event.h> -#include "netswitch.h" -#include "networkmessage.pb.h" - -enum { - NET_EVENT_STOP = 0, - NET_EVENT_TX, - NET_EVENT_RX, - NET_EVENT_SWITCH, - NET_EVENT_MAX -}; - -/* Special define for the windows portion. We only need to poll up to - * NET_EVENT_SWITCH. NET_EVENT_SWITCH gives us a different NET_EVENT_MAX - * excluding the others, and windows does not like polling events that - * do not exist. */ -#define NET_EVENT_WIN_MAX NET_EVENT_SWITCH - -#define SWITCH_PKT_BATCH NET_QUEUE_LEN -/* In µs, how often to send a keepalive and perform connection maintenance */ -#define SWITCH_KEEPALIVE_INTERVAL 5000000 -/* In ms, how long until we consider a connection gone? */ -#define SWITCH_MAX_INTERVAL 10000 - -typedef struct { - void *nsconn; - uint8_t mac_addr[6]; - netcard_t *card; - thread_t *poll_tid; - net_evt_t tx_event; - net_evt_t stop_event; - netpkt_t pktv[SWITCH_PKT_BATCH]; - pc_timer_t stats_timer; - pc_timer_t maintenance_timer; - ns_rx_packet_t rx_packet; - char switch_type[16]; -#ifdef _WIN32 - HANDLE sock_event; -#endif -} net_netswitch_t; - -// Used for debugging, needs to be moved to an official location -void print_packet(const netpkt_t netpkt) { -#ifdef NET_SWITCH_LOG - if(netpkt.len == 0) { - net_switch_log("Something is wrong, len is %d\n", netpkt.len); - return; - } - /* Temporarily disable log suppression for packet dumping to allow specific formatting */ - pclog_toggle_suppr(); - uint8_t linebuff[17] = "\0"; - char src_mac_buf[32] = ""; - char dst_mac_buf[32] = ""; - for(int m_i=0; m_i < 6; m_i++) { - char src_octet[4]; - char dst_octet[4]; - snprintf(src_octet, sizeof(src_octet), "%02X%s", netpkt.data[m_i+6], m_i < 5 ? ":" : ""); - strncat(src_mac_buf, src_octet, sizeof (src_mac_buf) - 1); - - snprintf(dst_octet, sizeof(dst_octet), "%02X%s", netpkt.data[m_i], m_i < 5 ? ":" : ""); - strncat(dst_mac_buf, dst_octet, sizeof (dst_mac_buf) - 1); - } - net_switch_log("%s -> %s\n\n", src_mac_buf, dst_mac_buf); - - // Payload length (bytes 12-13 with zero index) - uint16_t payload_length = (netpkt.data[12] & 0xFF) << 8; - payload_length |= (netpkt.data[13] & 0xFF); - const uint16_t actual_length = netpkt.len - 14; - if(payload_length <= 1500) { - // 802.3 / 802.2 - net_switch_log("Payload length according to frame: %i\n", payload_length); - // remaining length of packet (len - 14) to calculate padding - net_switch_log("Actual payload length: %i\n", actual_length); - if(payload_length <=46 ) { - net_switch_log("Likely has %d bytes padding\n", actual_length - payload_length); - } - } else { - // Type II - net_switch_log("EtherType: 0x%04X\n", payload_length); - } - // actual packet size - net_switch_log("Full frame size: %i\n", netpkt.len); - net_switch_log("\n"); - - for(int i=0; i< netpkt.len; i++) { - - net_switch_log("%02x ", netpkt.data[i]); - if ((netpkt.data[i] < 0x20) || (netpkt.data[i] > 0x7e)) { - linebuff[i % 16] = '.'; - } else { - linebuff[i % 16] = netpkt.data[i]; - } - - if( (i+1) % 8 == 0) { - net_switch_log(" "); - } - - if( (i+1) % 16 == 0) { - net_switch_log("| %s |\n", (char *)linebuff); - linebuff[0] = '\0'; - } - - // last char? - if(i+1 == netpkt.len) { - const int togo = 16 - (i % 16); - for(int remaining = 0; remaining < togo-1; remaining++) { - // This would represent the byte display and the space - net_switch_log(" "); - } - // spacing between byte groupings - if(togo > 8) { - net_switch_log(" "); - } - linebuff[(i % 16) +1] = '\0'; - net_switch_log(" | %s", (char *)linebuff); - - for(int remaining = 0; remaining < togo-1; remaining++) { - // This would represent the remaining bytes on the right - net_switch_log(" "); - } - net_switch_log(" |\n"); - } - } - net_switch_log("\n"); - pclog_toggle_suppr(); -#endif /* NET_SWITCH_LOG*/ -} - -#ifdef ENABLE_NET_SWITCH_STATS -static void -stats_timer(void *priv) -{ - /* Get the device state structure. */ - net_netswitch_t *netswitch = priv; - const NSCONN *nsconn = netswitch->nsconn; - net_switch_log("Max (frame / packet) TX (%zu/%zu) RX (%zu/%zu)\n", - nsconn->stats.max_tx_frame, nsconn->stats.max_tx_packet, - nsconn->stats.max_rx_frame, nsconn->stats.max_rx_packet); - net_switch_log("Last ethertype (TX/RX) (%02x%02x/%02x%02x)\n", nsconn->stats.last_tx_ethertype[0], nsconn->stats.last_tx_ethertype[1], - nsconn->stats.last_rx_ethertype[0], nsconn->stats.last_rx_ethertype[1]); - net_switch_log("Packet totals (all/tx/rx/would fragment/max vec) (%zu/%zu/%zu/%zu/%i)\n", nsconn->stats.total_tx_packets + nsconn->stats.total_rx_packets, - nsconn->stats.total_tx_packets, nsconn->stats.total_rx_packets, nsconn->stats.total_fragments, nsconn->stats.max_vec); - net_switch_log("---\n"); - /* Restart the timer */ - timer_on_auto(&netswitch->stats_timer, 60000000); -} -#endif - -static void -maintenance_timer(void *priv) -{ - /* Get the device state structure. */ - net_netswitch_t *netswitch = (net_netswitch_t *) priv; - NSCONN *nsconn = (NSCONN *) netswitch->nsconn; - if (!ns_send_control(nsconn, MessageType_MESSAGE_TYPE_KEEPALIVE)) { - net_switch_log("Failed to send keepalive packet\n"); - } - const int64_t interval = ns_get_current_millis() - nsconn->last_packet_stamp; -// net_switch_log("Last packet time: %lld ago\n", interval); -// net_switch_log("Last packet time: %lld ago\n", interval); - - /* A timeout has likely occurred, try to fix the connection if type is REMOTE */ - if((interval > SWITCH_MAX_INTERVAL) && nsconn->switch_type == SWITCH_TYPE_REMOTE) { - /* FIXME: This is really rough, needs moar logic */ - nsconn->client_state = CONNECTING; - net_switch_log("We appear to be disconnected, attempting to reconnect\n"); - /* TODO: Proper connect function! This is duplicated code */ - if(!ns_send_control(nsconn, MessageType_MESSAGE_TYPE_CONNECT_REQUEST)) { - /* TODO: Failure */ - } - } - /* Restart the timer */ - timer_on_auto(&netswitch->maintenance_timer, SWITCH_KEEPALIVE_INTERVAL); -} - -/* Lots of #ifdef madness here thanks to the polling differences on windows */ -static void -net_netswitch_thread(void *priv) -{ - net_netswitch_t *net_netswitch = (net_netswitch_t *) priv; - NSCONN *nsconn = (NSCONN *) net_netswitch->nsconn; - bool status; - char switch_type[32]; - snprintf(switch_type, sizeof(switch_type), "%s", nsconn->switch_type == SWITCH_TYPE_REMOTE ? "Remote" : "Local"); - - net_switch_log("%s Net Switch: polling started.\n", switch_type); - -#ifdef _WIN32 - WSAEventSelect(ns_pollfd(net_netswitch->nsconn), net_netswitch->sock_event, FD_READ); - - HANDLE events[NET_EVENT_MAX]; - events[NET_EVENT_STOP] = net_event_get_handle(&net_netswitch->stop_event); - events[NET_EVENT_TX] = net_event_get_handle(&net_netswitch->tx_event); - events[NET_EVENT_RX] = net_netswitch->sock_event; - - bool run = true; -#else - struct pollfd pfd[NET_EVENT_MAX]; - pfd[NET_EVENT_STOP].fd = net_event_get_fd(&net_netswitch->stop_event); - pfd[NET_EVENT_STOP].events = POLLIN | POLLPRI; - - pfd[NET_EVENT_TX].fd = net_event_get_fd(&net_netswitch->tx_event); - pfd[NET_EVENT_TX].events = POLLIN | POLLPRI; - - pfd[NET_EVENT_RX].fd = ns_pollfd(net_netswitch->nsconn); - pfd[NET_EVENT_RX].events = POLLIN | POLLPRI; -#endif - -#ifdef _WIN32 - while (run) { - int ret = WaitForMultipleObjects(NET_EVENT_WIN_MAX, events, FALSE, INFINITE); - - switch (ret - WAIT_OBJECT_0) { -#else - while (1) { - poll(pfd, NET_EVENT_MAX, -1); -#endif - -#ifdef _WIN32 - case NET_EVENT_STOP: - net_event_clear(&net_netswitch->stop_event); - run = false; - break; - case NET_EVENT_TX: -#else - if (pfd[NET_EVENT_STOP].revents & POLLIN) { - net_event_clear(&net_netswitch->stop_event); - break; - } - if (pfd[NET_EVENT_TX].revents & POLLIN) { -#endif - net_event_clear(&net_netswitch->tx_event); - - const int packets = network_tx_popv(net_netswitch->card, net_netswitch->pktv, SWITCH_PKT_BATCH); - if (packets > nsconn->stats.max_vec) { - nsconn->stats.max_vec = packets; - } - for (int i = 0; i < packets; i++) { - // net_switch_log("%d packet(s) to send\n", packets); -#if defined(NET_PRINT_PACKET_TX) || defined(NET_PRINT_PACKET_ALL) - data_packet_info_t packet_info = get_data_packet_info(&net_netswitch->pktv[i], net_netswitch->mac_addr); - /* Temporarily disable log suppression for packet logging */ - pclog_toggle_suppr(); - net_switch_log("%s Net Switch: TX: %s\n", switch_type, packet_info.printable); - pclog_toggle_suppr(); - print_packet(net_netswitch->pktv[i]); -#endif - /* Only send if we're in a connected state (always true for local) */ - if(ns_connected(net_netswitch->nsconn)) { - const ssize_t nc = ns_send_pb(net_netswitch->nsconn, &net_netswitch->pktv[i], 0); - if (nc < 1) { - perror("Got"); - net_switch_log("%s Net Switch: Problem, no bytes sent. Got back %i\n", switch_type, nc); - } - } - } -#ifdef _WIN32 - break; - case NET_EVENT_RX: -#else - } - if (pfd[NET_EVENT_RX].revents & POLLIN) { -#endif - - /* Packets are available for reading */ - status = ns_recv_pb(net_netswitch->nsconn, &net_netswitch->rx_packet, NET_MAX_FRAME, 0); - if (!status) { - net_switch_log("Receive packet failed. Skipping.\n"); - continue; - } - - /* These types are handled in the backend and don't need to be considered */ - if (is_control_packet(&net_netswitch->rx_packet) || is_fragment_packet(&net_netswitch->rx_packet)) { - continue; - } - data_packet_info_t packet_info = get_data_packet_info(&net_netswitch->rx_packet.pkt, net_netswitch->mac_addr); -#if defined(NET_PRINT_PACKET_RX) || defined(NET_PRINT_PACKET_ALL) - print_packet(net_netswitch->rx_packet.pkt); -#endif - /* - * Accept packets that are - * Unicast for us - * Broadcasts that are not from us - * All other packets *if* promiscuous mode is enabled (excluding our own) - */ - if (packet_info.is_packet_for_me || (packet_info.is_broadcast && !packet_info.is_packet_from_me)) { - /* Temporarily disable log suppression for packet logging */ - pclog_toggle_suppr(); - net_switch_log("%s Net Switch: RX: %s\n", switch_type, packet_info.printable); - pclog_toggle_suppr(); - network_rx_put_pkt(net_netswitch->card, &net_netswitch->rx_packet.pkt); - } else if (packet_info.is_packet_from_me) { - net_switch_log("%s Net Switch: Got my own packet... ignoring\n", switch_type); - } else { - /* Not our packet. Pass it along if promiscuous mode is enabled. */ - if (ns_flags(net_netswitch->nsconn) & FLAGS_PROMISC) { - net_switch_log("%s Net Switch: Got packet from %s (not mine, promiscuous is set, getting)\n", switch_type, packet_info.src_mac_h); - network_rx_put_pkt(net_netswitch->card, &net_netswitch->rx_packet.pkt); - } else { - net_switch_log("%s Net Switch: RX: %s (not mine, dest %s != %s, promiscuous not set, ignoring)\n", switch_type, packet_info.printable, packet_info.dest_mac_h, packet_info.my_mac_h); - } - } -#ifdef _WIN32 - break; - } -#else - } -#endif - } - - net_switch_log("%s Net Switch: polling stopped.\n", switch_type); -} - -void -net_netswitch_error(char *errbuf, const char *message) { - strncpy(errbuf, message, NET_DRV_ERRBUF_SIZE); - net_switch_log("Net Switch: %s\n", message); -} - -void * -net_netswitch_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf) -{ - net_switch_log("Net Switch: Init\n"); - - netcard_conf_t *netcard = (netcard_conf_t *) priv; - - ns_flags_t flags = FLAGS_NONE; - ns_type_t switch_type; - - const int net_type = netcard->net_type; - if(net_type == NET_TYPE_NRSWITCH) { - net_switch_log("Switch type: Remote\n"); - switch_type = SWITCH_TYPE_REMOTE; - } else if (net_type == NET_TYPE_NMSWITCH) { - net_switch_log("Switch type: Local Multicast\n"); - switch_type = SWITCH_TYPE_LOCAL; - if(netcard->promisc_mode) { - flags |= FLAGS_PROMISC; - } - } else { - net_switch_log("Failed: Unknown net switch type %d\n", net_type); - return NULL; - } - - // FIXME: Only here during dev. This would be an error otherwise (hostname not specified) - if(strlen(netcard->nrs_hostname) == 0) { - strncpy(netcard->nrs_hostname, "127.0.0.1", 128 - 1); - } - - net_netswitch_t *net_netswitch = calloc(1, sizeof(net_netswitch_t)); - net_netswitch->card = (netcard_t *) card; - memcpy(net_netswitch->mac_addr, mac_addr, sizeof(net_netswitch->mac_addr)); - snprintf(net_netswitch->switch_type, sizeof(net_netswitch->switch_type), "%s", net_type == NET_TYPE_NRSWITCH ? "Remote" : "Local"); - -// net_switch_log("%s Net Switch: mode: %d, group %d, hostname %s len %lu\n", net_netswitch->switch_type, netcard->promisc_mode, netcard->switch_group, netcard->nrs_hostname, strlen(netcard->nrs_hostname)); - - struct ns_open_args ns_args; - ns_args.type = switch_type; - /* Setting FLAGS_PROMISC here lets all packets through except the ones from us */ - ns_args.flags = flags; - /* This option sets which switch group you want to be a part of. - * Functionally equivalent to being plugged into a different switch */ - ns_args.group = netcard->switch_group; - /* You could also set the client_id here. If 0, it will be generated. */ - ns_args.client_id = 0; - memcpy(ns_args.mac_addr, net_netswitch->mac_addr, 6); - /* The remote switch hostname */ - strncpy(ns_args.nrs_hostname, netcard->nrs_hostname, sizeof(ns_args.nrs_hostname) - 1); - ns_args.nrs_hostname[127] = 0x00; - - net_switch_log("%s Net Switch: Starting up virtual switch with group %d, flags %d\n", net_netswitch->switch_type, ns_args.group, ns_args.flags); - - if ((net_netswitch->nsconn = ns_open(&ns_args)) == NULL) { - char buf[NET_DRV_ERRBUF_SIZE]; - /* We're using some errnos for our own purposes */ - switch (errno) { - case EFAULT: - snprintf(buf, NET_DRV_ERRBUF_SIZE, "Unable to open switch group %d: Cannot resolve remote switch hostname %s", ns_args.group, ns_args.nrs_hostname); - break; - default: - snprintf(buf, NET_DRV_ERRBUF_SIZE, "Unable to open switch group %d (%s)", ns_args.group, strerror(errno)); - break; - - } - net_netswitch_error(netdrv_errbuf, buf); - free(net_netswitch); - return NULL; - } - - for (int i = 0; i < SWITCH_PKT_BATCH; i++) { - net_netswitch->pktv[i].data = calloc(1, NET_MAX_FRAME); - } - net_netswitch->rx_packet.pkt.data = calloc(1, NET_MAX_FRAME); - - net_event_init(&net_netswitch->tx_event); - net_event_init(&net_netswitch->stop_event); -#ifdef _WIN32 - net_netswitch->sock_event = CreateEvent(NULL, FALSE, FALSE, NULL); -#endif - net_netswitch->poll_tid = thread_create(net_netswitch_thread, net_netswitch); - - /* Add the timers */ -#ifdef ENABLE_NET_SWITCH_STATS - timer_add(&net_netswitch->stats_timer, stats_timer, net_netswitch, 0); - timer_on_auto(&net_netswitch->stats_timer, 5000000); -#endif - timer_add(&net_netswitch->maintenance_timer, maintenance_timer, net_netswitch, 0); - timer_on_auto(&net_netswitch->maintenance_timer, SWITCH_KEEPALIVE_INTERVAL); - - /* Send join message. Return status not checked here. */ - ns_send_control(net_netswitch->nsconn, MessageType_MESSAGE_TYPE_JOIN); - - return net_netswitch; -} - -void -net_netswitch_in_available(void *priv) -{ - net_netswitch_t *net_netswitch = (net_netswitch_t *) priv; - net_event_set(&net_netswitch->tx_event); -} - -void -net_netswitch_close(void *priv) -{ - if (priv == NULL) - return; - - net_netswitch_t *net_netswitch = (net_netswitch_t *) priv; - - net_switch_log("%s Net Switch: closing.\n", net_netswitch->switch_type); - - /* Tell the thread to terminate. */ - net_event_set(&net_netswitch->stop_event); - - /* Wait for the thread to finish. */ - net_switch_log("%s Net Switch: waiting for thread to end...\n", net_netswitch->switch_type); - thread_wait(net_netswitch->poll_tid); - net_switch_log("%s Net Switch: thread ended\n", net_netswitch->switch_type); - - for (int i = 0; i < SWITCH_PKT_BATCH; i++) { - free(net_netswitch->pktv[i].data); - } - free(net_netswitch->rx_packet.pkt.data); - - net_event_close(&net_netswitch->tx_event); - net_event_close(&net_netswitch->stop_event); - -#ifdef _WIN32 - WSACleanup(); -#endif - - ns_close(net_netswitch->nsconn); - free(net_netswitch); -} - -const netdrv_t net_netswitch_drv = { - .notify_in = &net_netswitch_in_available, - .init = &net_netswitch_init, - .close = &net_netswitch_close, - .priv = NULL, -}; diff --git a/src/network/net_switch.c b/src/network/net_switch.c new file mode 100644 index 00000000000..feaa74793bd --- /dev/null +++ b/src/network/net_switch.c @@ -0,0 +1,547 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Network Switch network driver. + * + * Authors: RichardG, + * + * Copyright 2026 RichardG. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#ifdef _WIN32 +# define WIN32_LEAN_AND_MEAN +# include +# include +# include +# include +# define IFF_POINTOPOINT IFF_POINTTOPOINT +#else +# include +# include +# include +# include +# include +# include +# include +# include +#endif +#define HAVE_STDARG_H +#include <86box/86box.h> +#include <86box/device.h> +#include <86box/plat.h> +#include <86box/thread.h> +#include <86box/timer.h> +#include <86box/network.h> +#include <86box/machine.h> +#include <86box/ini.h> +#include <86box/config.h> +#include <86box/net_event.h> + +#define SWITCH_PKT_BATCH NET_QUEUE_LEN + +#define SWITCH_MULTICAST_GROUP 0xefff5656 /* 239.255.86.86 */ +#define SWITCH_MULTICAST_PORT 8086 + +enum { + NET_EVENT_STOP = 0, + NET_EVENT_TX, + NET_EVENT_RX, + NET_EVENT_MAX +}; + +typedef union { + struct sockaddr sa; + struct sockaddr_in sin; + struct sockaddr_in6 sin6; +} net_switch_sockaddr_t; + +typedef struct net_switch_hostaddr_t { + struct net_switch_hostaddr_t *next; + net_switch_sockaddr_t addr; + net_switch_sockaddr_t addr_tx; + int socket_tx; +} net_switch_hostaddr_t; + +typedef struct net_switch_t { + int socket_rx; + net_switch_hostaddr_t *hostaddrs; + uint16_t port_out; + + uint8_t promisc; + uint8_t mac_addr[6]; + netcard_t * card; /* netcard attached to us */ + thread_t * poll_tid; + net_evt_t tx_event; + net_evt_t stop_event; + netpkt_t pkt; + netpkt_t pkt_tx_v[SWITCH_PKT_BATCH]; + int during_tx; + int recv_on_tx; +#ifdef _WIN32 + HANDLE sock_event; +#endif +} net_switch_t; + +#ifdef ENABLE_NETSWITCH_LOG +int netswitch_do_log = ENABLE_NETSWITCH_LOG; + +static void +netswitch_log(const char *fmt, ...) +{ + va_list ap; + + if (netswitch_do_log) { + va_start(ap, fmt); + pclog_ex(fmt, ap); + va_end(ap); + } +} +#else +# define netswitch_log(fmt, ...) +#endif + +static void +net_switch_in_available(void *priv) +{ + net_switch_t *netswitch = (net_switch_t *) priv; + net_event_set(&netswitch->tx_event); +} + +static unsigned int +net_switch_add_hostaddr(net_switch_t *netswitch, net_switch_sockaddr_t *addr, net_switch_sockaddr_t *broadcast, net_switch_sockaddr_t *netmask, unsigned int flags) +{ + if (!addr || !(flags & IFF_UP)) + return 0; + + /* Iterate to the end of the list. */ + net_switch_hostaddr_t **p = &netswitch->hostaddrs; + for (; *p; p = &(*p)->next) { + /* Check for duplicates. */ + switch (addr->sa.sa_family) { + case AF_INET: + if ((*p)->addr.sin.sin_addr.s_addr == addr->sin.sin_addr.s_addr) + return 0; + break; +#ifdef UNUSED + case AF_INET6: + if (AS_U64((*p)->addr.sin6.sin6_addr.s6_addr[0]) == AS_U64(addr->sin6.sin6_addr.s6_addr[0]) && + AS_U64((*p)->addr.sin6.sin6_addr.s6_addr[8]) == AS_U64(addr->sin6.sin6_addr.s6_addr[8])) + return 0; + break; +#endif + default: + return 0; + } + } + + /* Handle address. */ + net_switch_hostaddr_t *hostaddr = (net_switch_hostaddr_t *) calloc(1, sizeof(net_switch_hostaddr_t)); + hostaddr->socket_tx = -1; + unsigned int ret = 1; + if (addr->sa.sa_family == AF_INET) { +#ifdef ENABLE_NETSWITCH_LOG + char buf[INET_ADDRSTRLEN]; + buf[0] = '\0'; + inet_ntop(addr->sin.sin_family, &addr->sin.sin_addr.s_addr, buf, sizeof(buf)); +#endif + + /* Initialize transmit socket for this interface. */ + hostaddr->socket_tx = socket(addr->sin.sin_family, SOCK_DGRAM, 0); + if (hostaddr->socket_tx < 0) { + netswitch_log("Network Switch: could not initialize transmit socket for interface %s\n", buf); + goto fail; + } + + /* Initialize addresses. */ + memcpy(&hostaddr->addr.sin, &addr->sin, sizeof(struct sockaddr_in)); + hostaddr->addr_tx.sin.sin_family = addr->sin.sin_family; + hostaddr->addr_tx.sin.sin_port = netswitch->port_out; + + /* The problem with multicasting through multiple interfaces is loopback, in which + all copies of the datagram get reflected back to us and to other instances on the + same host. Disabling IP_MULTICAST_LOOP on all but one transmit socket can mitigate + that, but not on Windows where that option applies to the receive socket, so we + instead disable loopback on all multicast sockets and use a broadcast for loopback. */ + if ((flags & (IFF_MULTICAST | IFF_LOOPBACK)) == IFF_MULTICAST) { + /* Set multicast interface for the transmit socket. */ + if (setsockopt(hostaddr->socket_tx, IPPROTO_IP, IP_MULTICAST_IF, (char *) &hostaddr->addr.sin.sin_addr.s_addr, sizeof(hostaddr->addr.sin.sin_addr.s_addr)) < 0) { + netswitch_log("Network Switch: could not configure multicast on interface %s\n", buf); + goto broadcast; + } + + /* Join IPv4 multicast group. */ + struct ip_mreq mreq = { + .imr_multiaddr = { .s_addr = htonl(SWITCH_MULTICAST_GROUP) }, + .imr_interface = { .s_addr = hostaddr->addr.sin.sin_addr.s_addr } + }; + if (setsockopt(netswitch->socket_rx, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mreq, sizeof(mreq)) < 0) { + netswitch_log("Network Switch: could not join multicast group on interface %s\n", buf); + goto broadcast; + } + + /* Destination address is multicast to our group. */ + hostaddr->addr_tx.sin.sin_addr.s_addr = mreq.imr_multiaddr.s_addr; + + /* Disable multicast loopback on non-Windows platforms. (no harm on Windows) */ + int val = 0; + setsockopt(hostaddr->socket_tx, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &val, sizeof(val)); + + netswitch_log("Network Switch: added multicast interface %s", buf); + } else { +broadcast: + /* Determine destination address. */ + if (flags & IFF_LOOPBACK) { + /* Loopback interfaces don't advertise broadcast support and therefore + the broadcast address is invalid, so we build one from the netmask. */ + hostaddr->addr_tx.sin.sin_addr.s_addr = hostaddr->addr.sin.sin_addr.s_addr | (netmask ? ~netmask->sin.sin_addr.s_addr : htonl(0x00ffffff)); + ret = 0; + } else if (!(flags & (IFF_BROADCAST | IFF_POINTOPOINT)) || + !broadcast || !broadcast->sin.sin_addr.s_addr || + (broadcast->sin.sin_addr.s_addr == hostaddr->addr.sin.sin_addr.s_addr)) { + /* This interface is unicast-only or P2P with a bad peer address, nothing we can do. */ + netswitch_log("Network Switch: ignored %s interface %s\n", (flags & (IFF_LOOPBACK | IFF_BROADCAST)) ? "broadcast" : "unicast", buf); + goto fail; + } else { + /* Valid broadcast/peer address. */ + hostaddr->addr_tx.sin.sin_addr.s_addr = broadcast->sin.sin_addr.s_addr; + } + + /* Enable broadcast on the transmit socket if required. */ + if (flags & (IFF_LOOPBACK | IFF_BROADCAST)) { + int val = 1; + if (setsockopt(hostaddr->socket_tx, SOL_SOCKET, SO_BROADCAST, (char *) &val, sizeof(val)) < 0) { + netswitch_log("Network Switch: could not configure broadcast on interface %s\n", buf); + goto fail; + } + } + + netswitch_log("Network Switch: added %s interface %s", (flags & (IFF_LOOPBACK | IFF_BROADCAST)) ? "broadcast" : "unicast", buf); + } +#ifdef ENABLE_NETSWITCH_LOG + buf[0] = '\0'; + inet_ntop(hostaddr->addr_tx.sin.sin_family, &hostaddr->addr_tx.sin.sin_addr.s_addr, buf, sizeof(buf)); + netswitch_log(" -> %s:%d\n", buf, ntohs(netswitch->port_out)); +#endif + } else { + goto fail; + } + + /* Add address to list. */ + *p = hostaddr; + return ret; + +fail: + if (hostaddr->socket_tx >= 0) + close(hostaddr->socket_tx); + free(hostaddr); + return 0; +} + +static void +net_switch_update_hostaddrs(net_switch_t *netswitch) +{ + unsigned int added = 0; +#ifdef _WIN32 + DWORD buf_size = 16 * sizeof(INTERFACE_INFO); + INTERFACE_INFO *buf; +retry: + buf = (INTERFACE_INFO *) malloc(buf_size); + DWORD returned; + if (WSAIoctl(netswitch->socket_rx, SIO_GET_INTERFACE_LIST, NULL, 0, buf, buf_size, &returned, NULL, NULL) == SOCKET_ERROR) { + free(buf); + if (WSAGetLastError() == WSAEFAULT) { + buf_size *= 2; + goto retry; + } + } else { + returned /= sizeof(INTERFACE_INFO); + for (int i = 0; i < returned; i++) { + added += net_switch_add_hostaddr(netswitch, + (net_switch_sockaddr_t *) &buf[i].iiAddress.Address, + (net_switch_sockaddr_t *) &buf[i].iiBroadcastAddress.Address, + (net_switch_sockaddr_t *) &buf[i].iiNetmask.Address, + buf[i].iiFlags); + } + free(buf); + } +#else + struct ifaddrs *buf; + if (getifaddrs(&buf) >= 0) { + for (struct ifaddrs *addr = buf; addr; addr = addr->ifa_next) { + added += net_switch_add_hostaddr(netswitch, + (net_switch_sockaddr_t *) addr->ifa_addr, + (net_switch_sockaddr_t *) ((addr->ifa_flags & IFF_POINTOPOINT) ? addr->ifa_dstaddr : addr->ifa_broadaddr), + (net_switch_sockaddr_t *) addr->ifa_netmask, + addr->ifa_flags); + } + freeifaddrs(buf); + } +#endif + + /* Add loopback if it's not present. */ + struct sockaddr_in fallback = { + .sin_family = AF_INET, + .sin_addr = { .s_addr = htonl(INADDR_LOOPBACK) } + }; + struct sockaddr_in fallback_broadcast = { + .sin_family = AF_INET, + .sin_addr = { .s_addr = htonl(INADDR_BROADCAST) } + }; + added += net_switch_add_hostaddr(netswitch, + (net_switch_sockaddr_t *) (struct sockaddr *) &fallback, + (net_switch_sockaddr_t *) (struct sockaddr *) &fallback_broadcast, + NULL, IFF_UP | IFF_LOOPBACK); + + /* If no non-loopback interfaces have been successfully added, + fall back to IPv4 multicast on a single OS-selected interface. */ + if (!added) { + fallback.sin_addr.s_addr = htonl(INADDR_ANY); + net_switch_add_hostaddr(netswitch, + (net_switch_sockaddr_t *) (struct sockaddr *) &fallback, + (net_switch_sockaddr_t *) (struct sockaddr *) &fallback_broadcast, + NULL, IFF_UP | IFF_MULTICAST); + } +} + +static void +net_switch_thread(void *priv) +{ + net_switch_t *netswitch = (net_switch_t *) priv; + + /* Start polling. */ + netswitch_log("Network Switch: polling started\n"); + +#ifdef _WIN32 + WSAEventSelect(netswitch->socket_rx, netswitch->sock_event, FD_READ); + + HANDLE events[NET_EVENT_MAX]; + events[NET_EVENT_STOP] = net_event_get_handle(&netswitch->stop_event); + events[NET_EVENT_TX] = net_event_get_handle(&netswitch->tx_event); + events[NET_EVENT_RX] = netswitch->sock_event; +#else + struct pollfd pfd[NET_EVENT_MAX]; + pfd[NET_EVENT_STOP].fd = net_event_get_fd(&netswitch->stop_event); + pfd[NET_EVENT_STOP].events = POLLIN | POLLPRI; + + pfd[NET_EVENT_TX].fd = net_event_get_fd(&netswitch->tx_event); + pfd[NET_EVENT_TX].events = POLLIN | POLLPRI; + + pfd[NET_EVENT_RX].fd = netswitch->socket_rx; + pfd[NET_EVENT_RX].events = POLLIN | POLLPRI; +#endif + + int packets; + ssize_t len; +#ifdef _WIN32 + uint8_t run = 1; + while (run) { + int ret = WaitForMultipleObjects(NET_EVENT_MAX, events, FALSE, INFINITE); + switch (ret - WAIT_OBJECT_0) { + case NET_EVENT_STOP: + run = 0; +#else + while (1) { + poll(pfd, NET_EVENT_MAX, -1); + if (pfd[NET_EVENT_STOP].revents & POLLIN) { +#endif + net_event_clear(&netswitch->stop_event); + break; +#ifdef _WIN32 + + case NET_EVENT_TX: +#else + } + if (pfd[NET_EVENT_TX].revents & POLLIN) { +#endif + net_event_clear(&netswitch->tx_event); + netswitch->during_tx = 1; + packets = network_tx_popv(netswitch->card, netswitch->pkt_tx_v, SWITCH_PKT_BATCH); + for (int i = 0; i < packets; i++) { +#define MAC_FORMAT "(%02X:%02X:%02X:%02X:%02X:%02X -> %02X:%02X:%02X:%02X:%02X:%02X)" +#define MAC_FORMAT_ARGS(p) (p)[6], (p)[7], (p)[8], (p)[9], (p)[10], (p)[11], (p)[0], (p)[1], (p)[2], (p)[3], (p)[4], (p)[5] + netswitch_log("Network Switch: sending %d-byte packet " MAC_FORMAT "\n", + netswitch->pkt_tx_v[i].len, MAC_FORMAT_ARGS(netswitch->pkt_tx_v[i].data)); + + /* Send through all known host interfaces. */ + for (net_switch_hostaddr_t *hostaddr = netswitch->hostaddrs; hostaddr; hostaddr = hostaddr->next) + sendto(hostaddr->socket_tx, + (char *) netswitch->pkt_tx_v[i].data, netswitch->pkt_tx_v[i].len, 0, + &hostaddr->addr_tx.sa, sizeof(hostaddr->addr_tx.sa)); + } + netswitch->during_tx = 0; + + if (netswitch->recv_on_tx) { + do { + packets = network_rx_on_tx_popv(netswitch->card, netswitch->pkt_tx_v, SWITCH_PKT_BATCH); + for (int i = 0; i < packets; i++) + network_rx_put_pkt(netswitch->card, &(netswitch->pkt_tx_v[i])); + } while (packets > 0); + netswitch->recv_on_tx = 0; + } +#ifdef _WIN32 + break; + + case NET_EVENT_RX: +#else + } + if (pfd[NET_EVENT_RX].revents & POLLIN) { +#endif + len = recv(netswitch->socket_rx, (char *) netswitch->pkt.data, NET_MAX_FRAME, 0); + if (len < 12) { + netswitch_log("Network Switch: recv error (%d)\n", len); + } else if (!memcmp(netswitch->mac_addr, &netswitch->pkt.data[6], 6)) { + /* A packet we've sent has looped back, drop it. */ + } else if (netswitch->promisc || /* promiscuous mode? */ + (netswitch->pkt.data[0] & 1) || /* broadcast packet? */ + !memcmp(netswitch->mac_addr, netswitch->pkt.data, 6)) { /* packet for me? */ + netswitch_log("Network Switch: receiving %d-byte packet " MAC_FORMAT "\n", + len, MAC_FORMAT_ARGS(netswitch->pkt.data)); + netswitch->pkt.len = len; + if (netswitch->during_tx) { + network_rx_on_tx_put_pkt(netswitch->card, &netswitch->pkt); + netswitch->recv_on_tx = 1; + } else { + network_rx_put_pkt(netswitch->card, &netswitch->pkt); + } + } else { + netswitch_log("Network Switch: dropping %d-byte packet " MAC_FORMAT "\n", + len, MAC_FORMAT_ARGS(netswitch->pkt.data)); + } +#ifdef _WIN32 + break; +#endif + } + } + + netswitch_log("Network Switch: polling stopped\n"); +} + +static void net_switch_close(void *priv); + +void * +net_switch_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char *netdrv_errbuf) +{ + netcard_conf_t *netcard = (netcard_conf_t *) priv; + + netswitch_log("Network Switch: initializing with group %d...\n", netcard->switch_group); + + net_switch_t *netswitch = calloc(1, sizeof(net_switch_t)); + memcpy(netswitch->mac_addr, mac_addr, sizeof(netswitch->mac_addr)); + netswitch->card = (netcard_t *) card; + netswitch->promisc = !!netcard->promisc_mode; + + /* Initialize receive socket. */ + netswitch->socket_rx = socket(AF_INET, SOCK_DGRAM, 0); + if (netswitch->socket_rx < 0) { + strncpy(netdrv_errbuf, "Could not initialize receive socket\n", NET_DRV_ERRBUF_SIZE); + goto fail; + } + + int val = 1; + if (setsockopt(netswitch->socket_rx, SOL_SOCKET, SO_REUSEADDR, (char *) &val, sizeof(val)) < 0) { + strncpy(netdrv_errbuf, "Could not set SO_REUSEADDR\n", NET_DRV_ERRBUF_SIZE); + goto fail; + } +#ifndef _WIN32 + if (setsockopt(netswitch->socket_rx, SOL_SOCKET, SO_REUSEPORT, (char *) &val, sizeof(val)) < 0) { + strncpy(netdrv_errbuf, "Could not set SO_REUSEPORT\n", NET_DRV_ERRBUF_SIZE); + goto fail; + } +#endif + + /* Disable multicast loopback on Windows. (no harm on other platforms) */ + val = 0; + setsockopt(netswitch->socket_rx, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &val, sizeof(val)); + + netswitch->port_out = htons(SWITCH_MULTICAST_PORT + netcard->switch_group); + struct sockaddr_in addr = { + .sin_family = AF_INET, + .sin_addr = { .s_addr = htonl(INADDR_ANY) }, + .sin_port = netswitch->port_out + }; + if (bind(netswitch->socket_rx, (struct sockaddr *) &addr, sizeof(addr)) < 0) { + snprintf(netdrv_errbuf, NET_DRV_ERRBUF_SIZE, "Could not bind to port %d\n", (int) addr.sin_port); + goto fail; + } + + /* Add host interfaces. */ + net_switch_update_hostaddrs(netswitch); + if (!netswitch->hostaddrs) { + strncpy(netdrv_errbuf, "Could not add any interfaces\n", NET_DRV_ERRBUF_SIZE); + goto fail; + } + + for (int i = 0; i < SWITCH_PKT_BATCH; i++) + netswitch->pkt_tx_v[i].data = calloc(1, NET_MAX_FRAME); + netswitch->pkt.data = calloc(1, NET_MAX_FRAME); + net_event_init(&netswitch->tx_event); + net_event_init(&netswitch->stop_event); +#ifdef _WIN32 + netswitch->sock_event = CreateEvent(NULL, FALSE, FALSE, NULL); +#endif + + netswitch_log("Network Switch: creating thread...\n"); + netswitch->poll_tid = thread_create(net_switch_thread, netswitch); + + return netswitch; + +fail: + net_switch_close(netswitch); + return NULL; +} + +void +net_switch_close(void *priv) +{ + if (!priv) + return; + + net_switch_t *netswitch = (net_switch_t *) priv; + + netswitch_log("Network Switch: closing\n"); + + if (netswitch->poll_tid) { + /* Tell the polling thread to shut down. */ + net_event_set(&netswitch->stop_event); + + /* Wait for the thread to finish. */ + netswitch_log("Network Switch: waiting for thread to end...\n"); + thread_wait(netswitch->poll_tid); + } + + net_switch_hostaddr_t *hostaddr = netswitch->hostaddrs; + while (hostaddr) { + if (hostaddr->socket_tx >= 0) + close(hostaddr->socket_tx); + net_switch_hostaddr_t *next = hostaddr->next; + free(hostaddr); + hostaddr = next; + } + if (netswitch->socket_rx >= 0) + close(netswitch->socket_rx); + net_event_close(&netswitch->stop_event); + net_event_close(&netswitch->tx_event); + for (int i = 0; i < SWITCH_PKT_BATCH; i++) + free(netswitch->pkt_tx_v[i].data); + free(netswitch->pkt.data); + free(netswitch); +} + +const netdrv_t net_switch_drv = { + .notify_in = &net_switch_in_available, + .init = &net_switch_init, + .close = &net_switch_close, + .priv = NULL +}; diff --git a/src/network/netswitch.c b/src/network/netswitch.c deleted file mode 100644 index 1ec2c5e6f7b..00000000000 --- a/src/network/netswitch.c +++ /dev/null @@ -1,970 +0,0 @@ -/* - * 86Box A hypervisor and IBM PC system emulator that specializes in - * running old operating systems and software designed for IBM - * PC systems and compatibles from 1981 through fairly recent - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Network Switch backend - * - * Authors: cold-brewed - * - * Copyright 2024 cold-brewed - */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#ifdef _WIN32 -# define WIN32_LEAN_AND_MEAN -# include -# include -#else -# include -# include -#endif - -#define HAVE_STDARG_H -#include <86box/86box.h> -#include <86box/device.h> -#include <86box/thread.h> -#include <86box/timer.h> -#include <86box/network.h> -#include <86box/net_event.h> -#include <86box/random.h> -#include -#include "netswitch.h" -#include "pb_encode.h" -#include "pb_decode.h" - -#include "networkmessage.pb.h" - -bool ns_socket_setup(NSCONN *conn) { - - if(conn == NULL) { - errno=EINVAL; - return false; - } - -#ifdef _WIN32 - // Initialize Windows Socket API with the given version. - WSADATA wsaData; - if (WSAStartup(MAKEWORD(2, 0), &wsaData)) { - perror("WSAStartup"); - return false; - } -#endif - - /* Create the "main" socket - * Local mode: the listener socket for multicast packets - * Remote mode: the "main" socket for send and receive */ - conn->fddata = socket(AF_INET, SOCK_DGRAM, 0); - if (conn->fddata < 0) { - perror("socket"); - return false; - } - - /* Here things diverge depending on local or remote type */ - if(conn->switch_type == SWITCH_TYPE_LOCAL) { - - /* Set socket options - allow multiple sockets to use the same address */ - u_int on = 1; - if (setsockopt(conn->fddata, SOL_SOCKET, SO_REUSEADDR, (char *) &on, sizeof(on)) < 0) { - perror("Reusing ADDR failed"); - return false; - } -#ifndef _WIN32 - /* ... and same port number - * Not needed on windows because SO_REUSEPORT doesn't exist there. However, the same - * functionality comes along with SO_REUSEADDR. */ - if (setsockopt(conn->fddata, SOL_SOCKET, SO_REUSEPORT, (char *) &on, sizeof(on)) < 0) { - perror("Reusing PORT failed"); - return false; - } -#endif - - memset(&conn->addr, 0, sizeof(conn->addr)); - conn->addr.sin_family = AF_INET; - conn->addr.sin_addr.s_addr = htonl(INADDR_ANY); - conn->addr.sin_port = htons(conn->local_multicast_port); - - /* Bind to receive address */ - if (bind(conn->fddata, (struct sockaddr *) &conn->addr, sizeof(conn->addr)) < 0) { - perror("bind"); - return false; - } - - /* Request to join multicast group */ - /*** NOTE: intermittent airplane (non-connected wifi) failures with 239.255.86.86 - needs more investigation */ - struct ip_mreq mreq; - mreq.imr_multiaddr.s_addr = inet_addr(conn->mcast_group); - mreq.imr_interface.s_addr = htonl(INADDR_ANY); - if (setsockopt(conn->fddata, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *) &mreq, sizeof(mreq)) < 0) { - perror("setsockopt"); - return false; - } - - /* Now create the outgoing data socket */ - conn->fdout = socket(AF_INET, SOCK_DGRAM, 0); - if (conn->fdout < 0) { - perror("out socket"); - return false; - } - - /* Set up destination address */ - memset(&conn->outaddr, 0, sizeof(conn->outaddr)); - conn->outaddr.sin_family = AF_INET; - conn->outaddr.sin_addr.s_addr = inet_addr(conn->mcast_group); - conn->outaddr.sin_port = htons(conn->local_multicast_port); - } else if (conn->switch_type == SWITCH_TYPE_REMOTE) { - /* Remote switch path */ - int status; - struct addrinfo hints; - struct addrinfo *servinfo; - char connect_ip[128] = "\0"; - - memset(&hints, 0, sizeof hints); - hints.ai_family = AF_INET; - hints.ai_socktype = SOCK_DGRAM; - hints.ai_flags = AI_PASSIVE; // not sure? - - if((status = getaddrinfo(conn->nrs_hostname, NULL, &hints, &servinfo)) != 0) { - net_switch_log("getaddrinfo error: %s\n", gai_strerror(status)); - errno=EFAULT; - return false; - } - - for(const struct addrinfo *p = servinfo; p != NULL; p = p->ai_next) { // NOLINT (only want the first result) - /* Take the first result, ipv4 since AF_INET was set in the hints */ - const struct sockaddr_in *ipv4 = (struct sockaddr_in *) p->ai_addr; - const void *addr = &(ipv4->sin_addr); - inet_ntop(p->ai_family, addr, connect_ip, sizeof connect_ip); - break; - } - freeaddrinfo(servinfo); - - if(strlen(connect_ip) == 0) { - /* Couldn't look up the hostname */ - net_switch_log("Hostname lookup failure?\n"); - errno=EFAULT; - return false; - } - - /* Set up local socket address and port */ - memset(&conn->addr, 0, sizeof(conn->addr)); - conn->addr.sin_family = AF_INET; - conn->addr.sin_addr.s_addr = htonl(INADDR_ANY); - conn->addr.sin_port = htons(conn->remote_source_port); - - /* Bind to receive address. Try the first 100 ports to allow the use of multiple systems simultaneously */ - for(int i=0; i<100; i++) { - if(i==99) { - net_switch_log("Unable to find an available port to bind\n"); - return false; - } - if (bind(conn->fddata, (struct sockaddr *) &conn->addr, sizeof(conn->addr)) < 0) { - net_switch_log("local port %d unavailable, trying next..\n", conn->remote_source_port); - conn->remote_source_port += 1; - conn->addr.sin_port = htons(conn->remote_source_port); - continue ; - } else { - net_switch_log("** Local port for net remote switch is %d\n", conn->remote_source_port); - break; - } - - } - - - /* Set up remote address and port */ - memset(&conn->outaddr, 0, sizeof(conn->outaddr)); - conn->outaddr.sin_family = AF_INET; - conn->outaddr.sin_addr.s_addr = inet_addr(connect_ip); - conn->outaddr.sin_port = htons(conn->remote_network_port); - - /* In remote mode the file descriptor for send (fdout) is the same as receive */ - conn->fdout = conn->fddata; - - } else { - errno=EINVAL; - return false; - } - - return true; -} - -NSCONN * -ns_open(struct ns_open_args *open_args) { - struct nsconn *conn=NULL; - - /* Each "group" is really just the base port + group number - * A different group effectively gets you a different switch - * Clamp the group at MAX_SWITCH_GROUP */ - if(open_args->group > MAX_SWITCH_GROUP) { - open_args->group = MAX_SWITCH_GROUP; - } - // FIXME: hardcoded for testing - char *mcast_group = "239.255.86.86"; // Admin scope - // char *mcast_group = "224.0.0.86"; // Local scope - - if ( (conn=calloc(1,sizeof(struct nsconn)))==NULL) { - errno=ENOMEM; - return NULL; - } - - /* Type */ - conn->switch_type = open_args->type; - - /* Allocate the fragment buffer */ - for (int i = 0; i < FRAGMENT_BUFFER_LENGTH; i++) { - conn->fragment_buffer[i] = calloc(1, sizeof(ns_fragment_t)); - /* Set the default size to 0 and null data buffer to indicate it is unused. - * The data buffer will be allocated as needed. */ - conn->fragment_buffer[i]->size = 0; - conn->fragment_buffer[i]->data = NULL; - } -// net_switch_log("Fragment buffers: %d total, %d each\n", FRAGMENT_BUFFER_LENGTH, MAX_FRAME_SEND_SIZE); - - snprintf(conn->mcast_group, MAX_MCAST_GROUP_LEN, "%s", mcast_group); - conn->flags = open_args->flags; - - /* Increment the multicast port by the switch group number. Each group is - * just a different port. */ - conn->local_multicast_port = open_args->group + NET_SWITCH_MULTICAST_PORT; - conn->remote_network_port = NET_SWITCH_REMOTE_PORT; - /* Source ports for remote switch will start here and be incremented until an available port is found */ - conn->remote_source_port = NET_SWITCH_REMOTE_PORT + NET_SWITCH_RECV_PORT_OFFSET; - - /* Remote switch hostname */ - strncpy(conn->nrs_hostname, open_args->nrs_hostname, sizeof(conn->nrs_hostname) - 1); - conn->nrs_hostname[127] = 0x00; - - /* Switch type */ - if(conn->switch_type == SWITCH_TYPE_REMOTE) { - net_switch_log("Connecting to remote %s:%d, initial local port %d, group %d\n", conn->nrs_hostname, conn->remote_network_port, conn->remote_source_port, open_args->group); - } else { - net_switch_log("Opening IP %s, port %d, group %d\n", mcast_group, conn->local_multicast_port, open_args->group); - } - - /* Client state, disconnected by default. - * Primarily used in remote mode */ - conn->client_state = DISCONNECTED; - - /* Client ID. Generate the ID if set to zero. */ - if(open_args->client_id == 0) { - conn->client_id = ns_gen_client_id(); - } - - /* MAC address is set from the emulated card */ - memcpy(conn->mac_addr, open_args->mac_addr, PB_MAC_ADDR_SIZE); - - /* Protocol version */ - conn->version = NS_PROTOCOL_VERSION; - - if(!ns_socket_setup(conn)) { - goto fail; - } - - if (conn->switch_type == SWITCH_TYPE_REMOTE) { - /* Perhaps one day do the entire handshake process here */ - if(!ns_send_control(conn, MessageType_MESSAGE_TYPE_CONNECT_REQUEST)) { - goto fail; - } - conn->client_state = CONNECTING; - net_switch_log("Client state is now CONNECTING\n"); - } else { - conn->client_state = LOCAL; - } - - /* Initialize sequence numbers */ - conn->sequence = 1; - conn->remote_sequence = 1; - - /* Initialize stats */ - conn->stats.max_tx_frame = 0; - conn->stats.max_tx_packet = 0; - conn->stats.max_rx_frame = 0; - conn->stats.max_rx_packet = 0; - conn->stats.total_rx_packets = 0; - conn->stats.total_tx_packets = 0; - conn->stats.total_fragments = 0; - conn->stats.max_vec = 0; - memcpy(conn->stats.last_tx_ethertype, (uint8_t []) { 0, 0}, sizeof(conn->stats.last_tx_ethertype)); - memcpy(conn->stats.last_rx_ethertype, (uint8_t []) { 0, 0}, sizeof(conn->stats.last_rx_ethertype)); - - /* Assuming all went well we have our sockets */ - return conn; - - /* Cleanup */ -fail: - for (int i = 0; i < FRAGMENT_BUFFER_LENGTH; i++) { - free(conn->fragment_buffer[i]); - } - return NULL; -} - -int -ns_pollfd(const NSCONN *conn) { - if (conn->fddata != 0) - return conn->fddata; - else { - errno=EBADF; - return -1; - } -} - -ssize_t -ns_sock_recv(const NSCONN *conn,void *buf, const size_t len, const int flags) { - if (fd_valid(conn->fddata)) - return recv(conn->fddata,buf,len,0); - else { - errno=EBADF; - return -1; - } -} - -ssize_t -ns_sock_send(NSCONN *conn,const void *buf, const size_t len, const int flags) { - if (fd_valid(conn->fddata)) { - /* Use the outgoing socket for sending, set elsewhere: - * Remote mode: same as sending - * Local mode: different from sending */ - return sendto(conn->fdout, buf, len, 0, (struct sockaddr *) &conn->outaddr, sizeof(conn->outaddr)); - } else { - errno=EBADF; - return -1; - } -} - -ssize_t -ns_send_pb(NSCONN *conn, const netpkt_t *packet,int flags) { - - NetworkMessage network_message = NetworkMessage_init_zero; - uint8_t fragment_count; - - /* Do we need to fragment? First, determine how many packets we will be sending */ - if(packet->len <= MAX_FRAME_SEND_SIZE) { - fragment_count = 1; -// net_switch_log("No Fragmentation. Frame size %d is less than max size %d\n", packet->len, MAX_FRAME_SEND_SIZE); - } else { - /* Since we're using integer math and the remainder is - * discarded we'll add one to the result *unless* the result can be evenly divided. */ - const uint8_t extra = (packet->len % MAX_FRAME_SEND_SIZE) == 0 ? 0 : 1; - fragment_count = (packet->len / MAX_FRAME_SEND_SIZE) + extra; -// net_switch_log("Fragmentation required, frame size %d exceeds max size %d\n", packet->len, MAX_FRAME_SEND_SIZE); - } - - /* Loop here for each fragment. Send each fragment. In the even that the packet is *not* a fragment (regular data packet) - * this will only execute once. */ - const uint32_t fragment_sequence = conn->sequence; - const int64_t packet_timestamp = ns_get_current_millis(); - for (uint8_t fragment_index = 0; fragment_index < fragment_count; fragment_index++) { - uint8_t buffer[NET_SWITCH_BUFFER_LENGTH]; - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); -#ifdef ENABLE_NET_SWITCH_PB_FILE_DEBUG - uint8_t file_buffer[NET_SWITCH_BUFFER_LENGTH]; - /* file_stream used for debugging and writing the message to a file */ - pb_ostream_t file_stream = pb_ostream_from_buffer(file_buffer, sizeof(file_buffer)); -#endif - /* Single frame is type DATA, fragments are FRAGMENT */ - network_message.message_type = fragment_count > 1 ? MessageType_MESSAGE_TYPE_FRAGMENT : MessageType_MESSAGE_TYPE_DATA; - network_message.client_id = conn->client_id; - network_message.timestamp = packet_timestamp; - network_message.version = conn->version; - - /* Need some additional data if we're a fragment */ - if(fragment_count > 1) { - network_message.fragment.total = fragment_count; - network_message.fragment.id = fragment_sequence; - network_message.fragment.sequence = fragment_index + 1; - network_message.has_fragment = true; - } - - /* TODO: Better / real ack logic. Needs its own function. Currently just putting in dummy data. */ - network_message.ack.id = 1; - network_message.ack.history = 1; - network_message.has_ack = true; - network_message.sequence = conn->sequence; - - /* Frame data must be allocated */ - network_message.frame = calloc(1, PB_BYTES_ARRAY_T_ALLOCSIZE(packet->len)); - - /* Calculate offsets based on our position in the fragment. - * For anything other than the *last* packet, we'll have a max frame size */ - uint16_t copy_length; - const uint16_t copy_offset = fragment_index * MAX_FRAME_SEND_SIZE; - if(fragment_index == (fragment_count - 1)) { - copy_length = packet->len % MAX_FRAME_SEND_SIZE == 0 ? MAX_FRAME_SEND_SIZE : packet->len % MAX_FRAME_SEND_SIZE; - } else { - copy_length = MAX_FRAME_SEND_SIZE; - } - if(fragment_count > 1) { -// net_switch_log("Fragment %d/%d, %d bytes\n", fragment_index + 1, fragment_count, copy_length); - } - network_message.frame->size = copy_length; - memcpy(network_message.frame->bytes, packet->data + copy_offset, copy_length); - - /* mac address must be allocated */ - network_message.mac = calloc(1, PB_BYTES_ARRAY_T_ALLOCSIZE(PB_MAC_ADDR_SIZE)); - network_message.mac->size = PB_MAC_ADDR_SIZE; - memcpy(network_message.mac->bytes, conn->mac_addr, PB_MAC_ADDR_SIZE); - - /* Encode the protobuf message */ - if (!pb_encode_ex(&stream, NetworkMessage_fields, &network_message,PB_ENCODE_DELIMITED)) { - net_switch_log("Encoding failed: %s\n", PB_GET_ERROR(&stream)); - errno = EBADF; - return -1; - } - - /* Send on the socket */ - const ssize_t nc = ns_sock_send(conn, buffer, stream.bytes_written, 0); - if(!nc) { - net_switch_log("Error sending data on the socket\n"); - errno=EBADF; - pb_release(NetworkMessage_fields, &network_message); - return -1; - } -#ifdef ENABLE_NET_SWITCH_PB_FILE_DEBUG - /* File writing for troubleshooting when needed */ - FILE *f = fopen("/var/tmp/pbuf", "wb"); - if (f) { - if (!pb_encode(&file_stream, NetworkMessage_fields, &network_message)) { - net_switch_log("File encoding failed: %s\n", PB_GET_ERROR(&file_stream)); - } - fwrite(file_buffer, file_stream.bytes_written, 1, f); - fclose(f); - } else { - net_switch_log("file open failed\n"); - } -#endif - - /* Stats */ - if(network_message.frame->size > conn->stats.max_tx_frame) { - conn->stats.max_tx_frame = network_message.frame->size; - } - if(nc > conn->stats.max_tx_packet) { - conn->stats.max_tx_packet = nc; - } - if(nc > MAX_FRAME_SEND_SIZE) { - conn->stats.total_fragments = fragment_count > 1 ? conn->stats.total_fragments + fragment_count : conn->stats.total_fragments; - } - conn->stats.total_tx_packets++; - memcpy(conn->stats.last_tx_ethertype, &packet->data[12], 2); - - /* Increment the sequence number */ - seq_increment(conn); - - /* nanopb will free all the allocated entries for us */ - pb_release(NetworkMessage_fields, &network_message); - - } - - return packet->len; -} - -bool store_fragment(const NSCONN *conn, const NetworkMessage *network_message) { - - if(conn == NULL || network_message == NULL) { - return false; - } - - /* The fragment sequence indicates which fragment this is in the overall fragment - * collection. This is used to index the fragments while being stored for reassembly - * (zero indexed locally) */ - const uint32_t fragment_index = network_message->fragment.sequence - 1; - const uint32_t fragment_size = network_message->frame->size; - - /* Make sure the fragments aren't too small - * (see header notes about size requirements for MIN_FRAG_RECV_SIZE and FRAGMENT_BUFFER_LENGTH) - * NOTE: The last packet is exempt from this rule because it can have a smaller amount. - * This is primarily to ensure there's enough space to fit all the fragments. */ - if(network_message->fragment.sequence != network_message->fragment.total) { - if (network_message->frame->size < MIN_FRAG_RECV_SIZE) { - net_switch_log("size: %d < %d\n", network_message->frame->size, MIN_FRAG_RECV_SIZE); - return false; - } - } - - /* Make sure we can handle the amount of incoming fragments */ - if (network_message->fragment.total > FRAGMENT_BUFFER_LENGTH) { - net_switch_log("buflen: %d > %d\n", network_message->fragment.total, FRAGMENT_BUFFER_LENGTH); - return false; - } - - /* Allocate or reallocate as needed. - * size > 0 indicates this buffer has already been allocated. */ - if(conn->fragment_buffer[fragment_index]->size > 0) { - conn->fragment_buffer[fragment_index]->data = realloc(conn->fragment_buffer[fragment_index]->data, sizeof(char) * fragment_size); - } else { - conn->fragment_buffer[fragment_index]->data = calloc(1, sizeof(char) * fragment_size); - } - - if (conn->fragment_buffer[fragment_index]->data == NULL) { - net_switch_log("Failed to allocate / reallocate fragment buffer space\n"); - return false; - } - - /* Each fragment will belong to a particular ID. All members will have the same ID, - * which is generally set to the sequence number of the first fragment */ - conn->fragment_buffer[fragment_index]->id = network_message->fragment.id; - /* The sequence here is set to the index of the packet in the total fragment collection - * (network_message->fragment.sequence) */ - conn->fragment_buffer[fragment_index]->sequence = fragment_index; - /* Total number of fragments in this set */ - conn->fragment_buffer[fragment_index]->total = network_message->fragment.total; - /* The sequence number from the packet that contained the fragment */ - conn->fragment_buffer[fragment_index]->packet_sequence = network_message->sequence; - /* Copy the fragment data and size */ - /* The size of fragment_buffer[fragment_index]->data is checked against MAX_FRAME_SEND_SIZE above */ - memcpy(conn->fragment_buffer[fragment_index]->data, network_message->frame->bytes, fragment_size); - conn->fragment_buffer[fragment_index]->size = fragment_size; - /* 10 seconds for a TTL */ - conn->fragment_buffer[fragment_index]->ttl = ns_get_current_millis() + 10000; - - return true; -} - -bool -reassemble_fragment(const NSCONN *conn, netpkt_t *pkt, const uint32_t packet_count) -{ - uint32_t total = 0; - - /* Make sure the reassembled packet doesn't exceed NET_MAX_FRAME */ -// if (packet_count * MAX_FRAME_SEND_SIZE > NET_MAX_FRAME) { -// return false; -// } - - /* Too many packets! */ - if (packet_count > FRAGMENT_BUFFER_LENGTH) { - return false; - } - - // TODO: Check fragment ID - // TODO: Check TTL - - /* Get the fragment size from the first entry. All fragments in a particular - * set must be of the same size except the last fragment, which may be smaller. - * The fragment size will be used to determine the offset. */ - const uint16_t fragment_size = conn->fragment_buffer[0]->size; - -// net_switch_log("Reassembling %d fragments\n", packet_count); - - for(int i = 0; i < packet_count; i++) { - /* Size of zero means we're trying to assemble from a bad fragment */ - if(conn->fragment_buffer[i]->size == 0) { - net_switch_log("Fragment size 0 when trying to reassemble (id %i/index %i/seq %i/ total %i)\n",conn->fragment_buffer[i]->id, i, conn->fragment_buffer[i]->sequence, conn->fragment_buffer[i]->total); - return false; - } - if(conn->fragment_buffer[i]->data == NULL) { - net_switch_log("Missing fragment data when trying to reassemble\n"); - return false; - } - - memcpy(pkt->data + (fragment_size * i), conn->fragment_buffer[i]->data, conn->fragment_buffer[i]->size); - total += conn->fragment_buffer[i]->size; - - /* Zero out the size to indicate the slot is unused */ - conn->fragment_buffer[i]->size = 0; - free(conn->fragment_buffer[i]->data); - conn->fragment_buffer[i]->data = NULL; - } - - /* Set the size, must cast due to netpkt_t (len is int) */ - pkt->len = (int) total; -// net_switch_log("%d bytes reassembled and converted to data packet.\n", pkt->len); - - return true; -} - -bool -ns_recv_pb(NSCONN *conn, ns_rx_packet_t *packet,size_t len,int flags) { - NetworkMessage network_message = NetworkMessage_init_zero; - ns_rx_packet_t *ns_packet = packet; - - uint8_t buffer[NET_SWITCH_BUFFER_LENGTH]; - - /* TODO: Use the passed len? Most likely not needed */ - const ssize_t nc = ns_sock_recv(conn, buffer, NET_SWITCH_BUFFER_LENGTH, 0); - if(!nc) { - net_switch_log("Error receiving data on the socket\n"); - errno=EBADF; - return false; - } - pb_istream_t stream = pb_istream_from_buffer(buffer, sizeof(buffer)); - - if (!pb_decode_delimited(&stream, NetworkMessage_fields, &network_message)) { - /* Decode failed */ - net_switch_log("PB decoding failed: %s\n", PB_GET_ERROR(&stream)); - /* Allocated fields are automatically released upon failure */ - return false; - } - - /* Basic checks for validity */ - if(network_message.mac == NULL || network_message.message_type == MessageType_MESSAGE_TYPE_UNSPECIFIED || - network_message.client_id == 0) { - net_switch_log("Invalid packet received! Skipping..\n"); - goto fail; - } - - /* These fields should always be set. Start copying into our packet structure. */ - ns_packet->client_id = network_message.client_id; - ns_packet->type = network_message.message_type; - memcpy(ns_packet->mac, network_message.mac->bytes, PB_MAC_ADDR_SIZE); - ns_packet->timestamp = network_message.timestamp; - ns_packet->version = network_message.version; - conn->remote_sequence = network_message.sequence; - conn->last_packet_stamp = network_message.timestamp; - - /* Control messages take a different path */ - if(network_message.message_type != MessageType_MESSAGE_TYPE_DATA && - network_message.message_type != MessageType_MESSAGE_TYPE_FRAGMENT) { - process_control_packet(conn, ns_packet); - pb_release(NetworkMessage_fields, &network_message); - return true; - } - - /* All packets should be DATA or FRAGMENT at this point and have a frame */ - if(network_message.frame == NULL) { - net_switch_log("Invalid data packet received! Frame is null. Skipping..\n"); - goto fail; - } - - /* Fragment path first */ - if(network_message.message_type == MessageType_MESSAGE_TYPE_FRAGMENT) { - - /* Store fragment */ - if(!store_fragment(conn, &network_message)) { - net_switch_log("Failed to store fragment\n"); - goto fail; - } - - /* Is this the last fragment? If not, return */ - if(network_message.fragment.sequence != network_message.fragment.total) { - // FIXME: Really dumb, needs to be smarter - pb_release(NetworkMessage_fields, &network_message); - return true; - } - - /* This is the last fragment. Attempt to reassemble */ - if(!reassemble_fragment(conn, &ns_packet->pkt, network_message.fragment.total)) { - net_switch_log("Failed to reassemble fragment\n"); - goto fail; - } - /* Change the type to DATA */ - ns_packet->type = MessageType_MESSAGE_TYPE_DATA; - - } else { - /* Standard DATA packet path. Copy frame from the message */ - memcpy(ns_packet->pkt.data, network_message.frame->bytes, network_message.frame->size); - ns_packet->pkt.len = network_message.frame->size; - } - - /* Stats */ - if(network_message.frame->size > conn->stats.max_rx_frame) { - conn->stats.max_rx_frame = network_message.frame->size; - } - if(nc > conn->stats.max_rx_packet) { - conn->stats.max_rx_packet = nc; - } - memcpy(conn->stats.last_rx_ethertype, &packet->pkt.data[12], 2); - conn->stats.total_rx_packets++; - /* End Stats */ - - /* nanopb allocates the necessary fields while serializing. - They need to be manually released once you are done with the message */ - pb_release(NetworkMessage_fields, &network_message); - return true; -fail: - pb_release(NetworkMessage_fields, &network_message); - return false; -} - -bool process_control_packet(NSCONN *conn, const ns_rx_packet_t *packet) { - - control_packet_info_t packet_info = get_control_packet_info(*packet, conn->mac_addr); -// net_switch_log("Last timestamp: %lld\n", ns_get_current_millis()); -// net_switch_log("(%lld ms) [%03d] ", ns_get_current_millis() - packet_info.timestamp, conn->sequence); - - /* I probably want to eventually differentiate between local and remote here, kind of basic now */ - if(!packet_info.is_packet_from_me) { /* in case of local mode */ - switch (packet_info.type) { - case MessageType_MESSAGE_TYPE_JOIN: - net_switch_log("Client ID 0x%08llx (MAC %s) has joined the chat\n", packet_info.client_id, packet_info.src_mac_h); - break; - case MessageType_MESSAGE_TYPE_LEAVE: - net_switch_log("Client ID 0x%08llx (MAC %s) has left us\n", packet_info.client_id, packet_info.src_mac_h); - break; - case MessageType_MESSAGE_TYPE_KEEPALIVE: -// net_switch_log("Client ID 0x%08llx (MAC %s) is still alive\n", packet_info.client_id, packet_info.src_mac_h); - break; - case MessageType_MESSAGE_TYPE_ACK: -// net_switch_log("Client ID 0x%08llx (MAC %s) has sent an ACK\n", packet_info.client_id, packet_info.src_mac_h); - break; - case MessageType_MESSAGE_TYPE_CONNECT_REPLY: - conn->client_state = CONNECTED; - net_switch_log("Client ID 0x%08llx (MAC %s) has sent a connection reply\n", packet_info.client_id, packet_info.src_mac_h); - net_switch_log("Client state is now CONNECTED\n"); - break; - case MessageType_MESSAGE_TYPE_FRAGMENT: - net_switch_log("Client ID 0x%08llx (MAC %s) has sent a fragment\n", packet_info.client_id, packet_info.src_mac_h); - break; - default: - net_switch_log("Client ID 0x%08llx (MAC %s) has sent a message that we don't understand (type %d)\n", packet_info.client_id, packet_info.src_mac_h, packet_info.type); - break; - } - } - return true; - -} - -bool -ns_send_control(NSCONN *conn, const MessageType type) { - - NetworkMessage network_message = NetworkMessage_init_zero; - uint8_t buffer[NET_SWITCH_BUFFER_LENGTH]; - - pb_ostream_t stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - network_message.message_type = type; - network_message.client_id = conn->client_id; - - /* No frame data so we only need to allocate mac address */ - network_message.mac = calloc(1, PB_BYTES_ARRAY_T_ALLOCSIZE(PB_MAC_ADDR_SIZE)); - network_message.mac->size = PB_MAC_ADDR_SIZE; - memcpy(network_message.mac->bytes, conn->mac_addr, PB_MAC_ADDR_SIZE); - - network_message.timestamp = ns_get_current_millis(); - network_message.version = conn->version; - network_message.sequence = conn->sequence; - - if (!pb_encode_ex(&stream, NetworkMessage_fields, &network_message, PB_ENCODE_DELIMITED)) { - net_switch_log("Encoding failed: %s\n", PB_GET_ERROR(&stream)); - errno = EBADF; - return false; - } - - const ssize_t nc = ns_sock_send(conn, buffer, stream.bytes_written, 0); - if(!nc) { - net_switch_log("Error sending control message on the socket\n"); - errno=EBADF; - pb_release(NetworkMessage_fields, &network_message); - return -1; - } - /* Increment the sequence number */ - seq_increment(conn); - - /* Stats */ - conn->stats.total_tx_packets++; - - /* Must release allocated data */ - pb_release(NetworkMessage_fields, &network_message); - - return true; -} - -uint32_t -ns_gen_client_id(void) { - uint32_t msb; - do { - msb = random_generate(); - } while (msb < 0x10); - return ( random_generate() | (random_generate() << 8) | (random_generate() << 16) | (msb << 24)); -} - -const char * -ns_printable_message_type(const MessageType type) -{ - switch (type) { - case MessageType_MESSAGE_TYPE_DATA: - return "Data"; - case MessageType_MESSAGE_TYPE_JOIN: - return "Join"; - case MessageType_MESSAGE_TYPE_LEAVE: - return "Leave"; - case MessageType_MESSAGE_TYPE_KEEPALIVE: - return "Keepalive"; - case MessageType_MESSAGE_TYPE_FRAGMENT: - return "Fragment"; - case MessageType_MESSAGE_TYPE_ACK: - return "Ack"; - case MessageType_MESSAGE_TYPE_UNSPECIFIED: - return "Unspecified (shouldn't get this)"; - default: - return "Unknown message type - probably hasn't been added yet!"; - } -} - -int64_t -ns_get_current_millis(void) { - struct timeval time; - gettimeofday(&time, NULL); - /* Windows won't properly promote integers so this is necessary */ - const int64_t seconds = (int64_t) time.tv_sec * 1000; - - return seconds + (time.tv_usec / 1000); -} - -int -ns_flags(const NSCONN *conn) { - return conn->flags; -} - -int -ns_close(NSCONN *conn) { - if(conn->switch_type == SWITCH_TYPE_REMOTE) { - /* TBD */ - } - /* No need to check the return here as we're closing out */ - ns_send_control(conn, MessageType_MESSAGE_TYPE_LEAVE); - for (int i = 0; i < FRAGMENT_BUFFER_LENGTH; i++) { - if (conn->fragment_buffer[i]->size > 0) { - free(conn->fragment_buffer[i]->data); - conn->fragment_buffer[i]->data = NULL; - } - free(conn->fragment_buffer[i]); - } - close(conn->fddata); - close(conn->fdout); - return 0; -} - -bool is_control_packet(const ns_rx_packet_t *packet) { - return packet->type != MessageType_MESSAGE_TYPE_DATA; -} - -bool is_fragment_packet(const ns_rx_packet_t *packet) { - return packet->type == MessageType_MESSAGE_TYPE_FRAGMENT; -} - -bool ns_connected(const NSCONN *conn) { - if(conn->switch_type == SWITCH_TYPE_LOCAL) { - return true; - } - - if(conn->switch_type == SWITCH_TYPE_REMOTE) { - if(conn->client_state == CONNECTED) { - return true; - } - } - - return false; -} - -char* formatted_mac(uint8_t mac_addr[6]) -{ - char *mac_h = calloc(1, sizeof(char)* 32); - for(int i=0; i < 6; i++) { - char octet[4]; - snprintf(octet, sizeof(octet), "%02X%s", mac_addr[i], i < 5 ? ":" : ""); - strncat(mac_h, octet, sizeof(mac_h) - 1); - } - return mac_h; -} - -control_packet_info_t get_control_packet_info(const ns_rx_packet_t packet, const uint8_t *my_mac) -{ - control_packet_info_t packet_info; - - packet_info.src_mac_h[0] = '\0'; - packet_info.printable[0] = '\0'; - packet_info.client_id = packet.client_id; - memcpy(packet_info.src_mac, &packet.mac, 6); - packet_info.type = packet.type; - packet_info.is_packet_from_me = (memcmp(my_mac, packet_info.src_mac, sizeof(uint8_t) * 6) == 0); - char *formatted_mac_h = formatted_mac(packet_info.src_mac); - strncpy(packet_info.src_mac_h, formatted_mac_h, MAX_PRINTABLE_MAC); - free(formatted_mac_h); - snprintf(packet_info.printable, sizeof(packet_info.printable), "%s", ns_printable_message_type(packet_info.type)); - packet_info.timestamp = packet.timestamp; - - return packet_info; -} - -data_packet_info_t -get_data_packet_info(const netpkt_t *packet, const uint8_t *my_mac) { - data_packet_info_t packet_info; - - packet_info.src_mac_h[0] = '\0'; - packet_info.dest_mac_h[0] = '\0'; - packet_info.my_mac_h[0] = '\0'; - packet_info.printable[0] = '\0'; - - memcpy(packet_info.dest_mac,&packet->data[0], 6); - memcpy(packet_info.src_mac, &packet->data[6], 6); - - /* Broadcast and multicast are treated the same at L2 and both will have the - * least significant bit of 1 in the first transmitted byte. - * The below test matches 0xFF for standard broadcast along with 0x01 and 0x33 for multicast */ - packet_info.is_broadcast = ((packet->data[0] & 1) == 1); - packet_info.is_packet_for_me = (memcmp(my_mac, packet_info.dest_mac, sizeof(uint8_t) * 6) == 0); - packet_info.is_packet_from_me = (memcmp(my_mac, packet_info.src_mac, sizeof(uint8_t) * 6) == 0); - packet_info.is_data_packet = packet->len > 0; - packet_info.size = packet->len; - - /* Since this function is applied to every packet, only enable the pretty formatting below - * if logging is specifically enabled. */ -#ifdef ENABLE_NET_SWITCH_LOG - /* Pretty formatting for hardware addresses */ - for(int i=0; i < 6; i++) { - char octet[4]; - snprintf(octet, sizeof(octet), "%02X%s", packet_info.src_mac[i], i < 5 ? ":" : ""); - strncat(packet_info.src_mac_h, octet, sizeof (packet_info.src_mac_h) - 1); - - snprintf(octet, sizeof(octet), "%02X%s", packet_info.dest_mac[i], i < 5 ? ":" : ""); - strncat(packet_info.dest_mac_h, octet, sizeof (packet_info.dest_mac_h) - 1); - - snprintf(octet, sizeof(octet), "%02X%s", my_mac[i], i < 5 ? ":" : ""); - strncat(packet_info.my_mac_h, octet, sizeof (packet_info.my_mac_h) - 1); - } - - /* Printable output formatting */ - if(packet_info.is_broadcast) { - if(packet_info.is_packet_from_me) { - snprintf(packet_info.printable, sizeof(packet_info.printable), "(broadcast)"); - } else { - snprintf(packet_info.printable, sizeof(packet_info.printable), "%s (broadcast)", packet_info.src_mac_h); - } - } else { - snprintf(packet_info.printable, sizeof(packet_info.printable), "%s%s -> %s%s", packet_info.src_mac_h, packet_info.is_packet_from_me ? " (me)" : " ", - packet_info.dest_mac_h, packet_info.is_packet_for_me ? " (me)" : ""); - } -#endif - return packet_info; -} - -bool -fd_valid(const int fd) -{ -#ifdef _WIN32 - int error_code; - int error_code_size = sizeof(error_code); - getsockopt(fd, SOL_SOCKET, SO_ERROR, (char *) &error_code, &error_code_size); - if (error_code == WSAENOTSOCK) { - return false; - } - return true; -#else - if (fcntl(fd, F_GETFD) == -1) { - return false; - } - /* All other values will be a valid fd */ - return true; -#endif -} - -bool -seq_increment(NSCONN *conn) -{ - if(conn == NULL) { - return false; - } - conn->sequence++; - if (conn->sequence == 0) { - conn->sequence = 1; - } - return true; -} diff --git a/src/network/netswitch.h b/src/network/netswitch.h deleted file mode 100644 index 69062b66c9d..00000000000 --- a/src/network/netswitch.h +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 86Box A hypervisor and IBM PC system emulator that specializes in - * running old operating systems and software designed for IBM - * PC systems and compatibles from 1981 through fairly recent - * system designs based on the PCI bus. - * - * This file is part of the 86Box distribution. - * - * Network Switch backend - * - * Authors: cold-brewed - * - * Copyright 2024 cold-brewed - */ -#ifndef NET_SWITCH_H -#define NET_SWITCH_H - -#ifdef _WIN32 -#include // before Windows.h, else Winsock 1 conflict -#include // needed for ip_mreq definition for multicast -#include -#else -#include -#include -#include -#include -#include -#endif -#include -#include "pb.h" -#include "networkmessage.pb.h" - -/* Local switch multicast port */ -#define NET_SWITCH_MULTICAST_PORT 8086 -/* Remote switch connect port */ -#define NET_SWITCH_REMOTE_PORT 8088 -/* Remove switch. This offset is where the local source ports will begin. */ -#define NET_SWITCH_RECV_PORT_OFFSET 198 -/* Multicast group (IP Address) maximum length. String representation. */ -#define MAX_MCAST_GROUP_LEN 32 -/* The buffer length used for both receiving on sockets and protobuf serialize / deserialize */ -#define NET_SWITCH_BUFFER_LENGTH 2048 - -/* Any frame above this size gets fragmented */ -#define MAX_FRAME_SEND_SIZE 1200 -/* Minimum fragment size we'll accept */ -#define MIN_FRAG_RECV_SIZE 12 -/* - Size of the fragment buffer - how many can we hold? - Note: FRAGMENT_BUFFER_LENGTH * MIN_FRAG_RECV_SIZE *must* be greater - than NET_MAX_FRAME or bad things will happen with large packets! -*/ -#define FRAGMENT_BUFFER_LENGTH 128 -/* Maximum number of switch groups */ -#define MAX_SWITCH_GROUP 31 -/* Size of a mac address in bytes. Used for the protobuf serializing / deserializing */ -#define PB_MAC_ADDR_SIZE 6 -/* This will define the version in use and the minimum required for communication */ -#define NS_PROTOCOL_VERSION 1 -/* Maximum string size for a printable (formatted) mac address */ -#define MAX_PRINTABLE_MAC 32 -/* Maximum hostname length for a remote switch host */ -#define MAX_HOSTNAME 128 - -typedef enum { - FLAGS_NONE = 0, - FLAGS_PROMISC = 1 << 0, -} ns_flags_t; - -typedef enum { - SWITCH_TYPE_LOCAL = 0, - SWITCH_TYPE_REMOTE, -} ns_type_t; - -typedef enum { - DISCONNECTED, - CONNECTING, - CONNECTED, - LOCAL, -} ns_client_state_t; - -struct ns_open_args { - uint8_t group; - ns_flags_t flags; - ns_type_t type; - char *client_id; - uint8_t mac_addr[6]; - char nrs_hostname[MAX_HOSTNAME]; -}; - -struct nsconn; - -typedef struct nsconn NSCONN; - -struct ns_stats { - size_t max_tx_frame; - size_t max_tx_packet; - size_t max_rx_frame; - size_t max_rx_packet; - uint8_t last_tx_ethertype[2]; - uint8_t last_rx_ethertype[2]; - u_long total_rx_packets; - u_long total_tx_packets; - u_long total_fragments; - uint8_t max_vec; -}; - -typedef struct { - /* The ID of the fragment. All fragments in a set should have the same ID. */ - uint32_t id; - /* The fragment index in the sequence of fragments. NOTE: one indexed, not zero! - * Example: the first fragment of three would be 1 in the sequence */ - uint32_t sequence; - /* Total number of fragments for the collection */ - uint32_t total; - /* The sequence number of the packet that delivered the fragment. Not the same as fragment sequence above! */ - uint32_t packet_sequence; - /* Frame data */ - char *data; - /* Frame size. A size of zero indicates an unused fragment slot and unallocated data field. */ - uint32_t size; - /* Epoch time (in ms) that the fragment is valid until */ - uint64_t ttl; -} ns_fragment_t; - -struct nsconn { - uint16_t flags; - int fdctl; - int fddata; - int fdout; - char mcast_group[MAX_MCAST_GROUP_LEN]; - struct sockaddr_in addr; - struct sockaddr_in outaddr; - size_t outlen; - struct sockaddr *sock; - struct sockaddr *outsock; - struct ns_stats stats; - uint32_t client_id; - uint8_t mac_addr[6]; - uint16_t sequence; - uint16_t remote_sequence; - uint8_t version; - uint8_t switch_type; - ns_client_state_t client_state; - int64_t last_packet_stamp; - /* Remote switch hostname */ - char nrs_hostname[MAX_HOSTNAME]; - /* Remote connect port for remote network switch */ - uint16_t remote_network_port; - /* Local multicast port for the local network switch */ - uint16_t local_multicast_port; - /* - * The source port to receive packets. Only applies to remote mode. - * This will also be the source port for sent packets in order to aid - * NAT - */ - uint16_t remote_source_port; - ns_fragment_t *fragment_buffer[FRAGMENT_BUFFER_LENGTH]; -}; - -typedef struct { - uint32_t id; - uint32_t history; -} ns_ack_t; - -typedef struct { - uint32_t id; - uint32_t sequence; - uint32_t total; -} ns_fragment_info_t; - -typedef struct { - netpkt_t pkt; - MessageType type; - uint32_t client_id; - uint8_t mac[6]; - uint32_t flags; - int64_t timestamp; - ns_ack_t ack; - ns_fragment_info_t fragment; - uint32_t version; -} ns_rx_packet_t; - -typedef struct { - size_t size; - char src_mac_h[MAX_PRINTABLE_MAC]; - char dest_mac_h[MAX_PRINTABLE_MAC]; - char my_mac_h[MAX_PRINTABLE_MAC]; - uint8_t src_mac[6]; - uint8_t dest_mac[6]; - bool is_packet_from_me; - bool is_broadcast; - bool is_packet_for_me; - bool is_data_packet; - char printable[128]; -} data_packet_info_t; - -typedef struct { - uint8_t src_mac[6]; - char src_mac_h[MAX_PRINTABLE_MAC]; - bool is_packet_from_me; - MessageType type; - char printable[128]; - uint64_t client_id; - int64_t timestamp; -} control_packet_info_t; - -/* Initializes and opens the Net Multicast Switch */ -NSCONN *ns_open(struct ns_open_args *open_args); - -/* Returns the flags */ -int ns_flags(const NSCONN *conn); - -/* Returns the file descriptor for polling */ -int ns_pollfd(const NSCONN *conn); - -/* This should be used to receive serialized protobuf packets - * and have the output placed in the packet struct */ -bool ns_recv_pb(NSCONN *conn, ns_rx_packet_t *packet,size_t len,int flags); - -/* Do not call directly! Used internally */ -ssize_t ns_sock_recv(const NSCONN *conn,void *buf,size_t len,int flags); - -/* This should be used to send serialized protobuf packets -* and have the output placed in the packet struct */ -ssize_t ns_send_pb(NSCONN *conn, const netpkt_t *packet,int flags); - -/* Send control messages */ -bool ns_send_control(NSCONN *conn, MessageType type); - -const char* ns_printable_message_type(MessageType type); - -/* Do not call directly! Used internally */ -ssize_t ns_sock_send(NSCONN *conn,const void *buf,size_t len,int flags); - -uint32_t ns_gen_client_id(void); - -/* Closes and cleans up */ -int ns_close(NSCONN *conn); - -/* Return current time in milliseconds */ -int64_t ns_get_current_millis(void); - -/* Is the packet a control packet? - * Any type other than DATA is a control packet, including fragments */ -bool is_control_packet(const ns_rx_packet_t *packet); - -/* Logic for handling control packets */ -bool process_control_packet(NSCONN *conn, const ns_rx_packet_t *packet); - -/* Is the packet a fragment packet? */ -bool is_fragment_packet(const ns_rx_packet_t *packet); - -/* Store a fragment in the fragment buffer */ -bool store_fragment(const NSCONN *conn, const NetworkMessage *network_message); - -/* Reassemble a fragment from the fragment buffer */ -bool reassemble_fragment(const NSCONN *conn, netpkt_t *pkt, uint32_t packet_count); - -/* Set up the socket. Accounts for the differences between local and remote modes */ -bool ns_socket_setup(NSCONN *conn); - -/* Is the switch in a connected state? Always returns true in local mode */ -bool ns_connected(const NSCONN *conn); - -/* Return a string with a properly formatted mac address. - * Note: Caller must free! */ -char* formatted_mac(uint8_t mac_addr[6]); - -/* Used for control packet info and logic */ -control_packet_info_t get_control_packet_info(ns_rx_packet_t packet, const uint8_t *my_mac); - -/* Used for data packet info and logic */ -data_packet_info_t get_data_packet_info(const netpkt_t *packet, const uint8_t *my_mac); - -/* Checks for a valid file descriptor */ -bool fd_valid(int fd); - -/* Wrapping increment for the sequence number */ -bool seq_increment(NSCONN *conn); - -#ifdef ENABLE_NET_SWITCH_LOG -static void -net_switch_log(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - pclog_ex(fmt, ap); - va_end(ap); -} -#else -# define net_switch_log(fmt, ...) -#endif - -#endif \ No newline at end of file diff --git a/src/network/network.c b/src/network/network.c index 8680d6c64a2..d99b997b010 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -500,9 +500,9 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin break; #endif #ifdef USE_NETSWITCH - case NET_TYPE_NMSWITCH: + case NET_TYPE_NLSWITCH: case NET_TYPE_NRSWITCH: - card->host_drv = net_netswitch_drv; + card->host_drv = net_switch_drv; card->host_drv.priv = card->host_drv.init(card, mac, &net_cards_conf[net_card_current], net_drv_error); break; #endif /* USE_NETSWITCH */ @@ -517,14 +517,6 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin if (!card->host_drv.priv) { if(net_cards_conf[net_card_current].net_type != NET_TYPE_NONE) { -#ifdef USE_NETSWITCH - // FIXME: Hardcoded during dev - // FIXME: Remove when done! - if((net_cards_conf[net_card_current].net_type == NET_TYPE_NMSWITCH) || - (net_cards_conf[net_card_current].net_type == NET_TYPE_NRSWITCH)) - fatal("%s", net_drv_error); -#endif /* USE_NETSWITCH */ - // We're here because of a failure swprintf(tempmsg, sizeof_w(tempmsg), L"%ls:\n\n%s\n\n%ls", plat_get_string(STRING_NET_ERROR), net_drv_error, plat_get_string(STRING_NET_ERROR_DESC)); ui_msgbox(MBX_ERROR, tempmsg); diff --git a/src/network/networkmessage.pb.c b/src/network/networkmessage.pb.c deleted file mode 100644 index c15f03e0165..00000000000 --- a/src/network/networkmessage.pb.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Automatically generated nanopb constant definitions */ -/* Generated by nanopb-0.4.8-dev */ - -#include "networkmessage.pb.h" -#if PB_PROTO_HEADER_VERSION != 40 -#error Regenerate this file with the current version of nanopb generator. -#endif - -PB_BIND(Fragment, Fragment, AUTO) - - -PB_BIND(Ack, Ack, AUTO) - - -PB_BIND(NetworkMessage, NetworkMessage, AUTO) - - - - diff --git a/src/network/networkmessage.pb.h b/src/network/networkmessage.pb.h deleted file mode 100644 index 0a74e55b9e1..00000000000 --- a/src/network/networkmessage.pb.h +++ /dev/null @@ -1,140 +0,0 @@ -/* Automatically generated nanopb header */ -/* Generated by nanopb-0.4.8-dev */ - -#ifndef PB_NETWORKMESSAGE_PB_H_INCLUDED -#define PB_NETWORKMESSAGE_PB_H_INCLUDED -#include "pb.h" - -#if PB_PROTO_HEADER_VERSION != 40 -#error Regenerate this file with the current version of nanopb generator. -#endif - -/* Enum definitions */ -typedef enum _MessageType { - MessageType_MESSAGE_TYPE_UNSPECIFIED = 0, - MessageType_MESSAGE_TYPE_DATA = 1, - MessageType_MESSAGE_TYPE_JOIN = 2, - MessageType_MESSAGE_TYPE_LEAVE = 3, - MessageType_MESSAGE_TYPE_KEEPALIVE = 4, - MessageType_MESSAGE_TYPE_FRAGMENT = 5, - MessageType_MESSAGE_TYPE_ACK = 6, - MessageType_MESSAGE_TYPE_CONNECT_REQUEST = 7, - MessageType_MESSAGE_TYPE_CONNECT_REPLY = 8 -} MessageType; - -/* Struct definitions */ -typedef struct _Fragment { - uint32_t id; - uint32_t sequence; - uint32_t total; -} Fragment; - -typedef struct _Ack { - uint32_t id; - uint32_t history; -} Ack; - -typedef struct _NetworkMessage { - MessageType message_type; - uint32_t client_id; - pb_bytes_array_t *mac; - pb_bytes_array_t *frame; - uint32_t flags; - uint32_t version; - bool has_ack; - Ack ack; - bool has_fragment; - Fragment fragment; - int64_t timestamp; - uint32_t sequence; -} NetworkMessage; - - -#ifdef __cplusplus -extern "C" { -#endif - -/* Helper constants for enums */ -#define _MessageType_MIN MessageType_MESSAGE_TYPE_UNSPECIFIED -#define _MessageType_MAX MessageType_MESSAGE_TYPE_CONNECT_REPLY -#define _MessageType_ARRAYSIZE ((MessageType)(MessageType_MESSAGE_TYPE_CONNECT_REPLY+1)) - - - -#define NetworkMessage_message_type_ENUMTYPE MessageType - - -/* Initializer values for message structs */ -#define Fragment_init_default {0, 0, 0} -#define Ack_init_default {0, 0} -#define NetworkMessage_init_default {_MessageType_MIN, 0, NULL, NULL, 0, 0, false, Ack_init_default, false, Fragment_init_default, 0, 0} -#define Fragment_init_zero {0, 0, 0} -#define Ack_init_zero {0, 0} -#define NetworkMessage_init_zero {_MessageType_MIN, 0, NULL, NULL, 0, 0, false, Ack_init_zero, false, Fragment_init_zero, 0, 0} - -/* Field tags (for use in manual encoding/decoding) */ -#define Fragment_id_tag 1 -#define Fragment_sequence_tag 2 -#define Fragment_total_tag 3 -#define Ack_id_tag 1 -#define Ack_history_tag 2 -#define NetworkMessage_message_type_tag 1 -#define NetworkMessage_client_id_tag 2 -#define NetworkMessage_mac_tag 3 -#define NetworkMessage_frame_tag 4 -#define NetworkMessage_flags_tag 5 -#define NetworkMessage_version_tag 6 -#define NetworkMessage_ack_tag 7 -#define NetworkMessage_fragment_tag 8 -#define NetworkMessage_timestamp_tag 9 -#define NetworkMessage_sequence_tag 10 - -/* Struct field encoding specification for nanopb */ -#define Fragment_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, id, 1) \ -X(a, STATIC, SINGULAR, UINT32, sequence, 2) \ -X(a, STATIC, SINGULAR, UINT32, total, 3) -#define Fragment_CALLBACK NULL -#define Fragment_DEFAULT NULL - -#define Ack_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UINT32, id, 1) \ -X(a, STATIC, SINGULAR, UINT32, history, 2) -#define Ack_CALLBACK NULL -#define Ack_DEFAULT NULL - -#define NetworkMessage_FIELDLIST(X, a) \ -X(a, STATIC, SINGULAR, UENUM, message_type, 1) \ -X(a, STATIC, SINGULAR, UINT32, client_id, 2) \ -X(a, POINTER, SINGULAR, BYTES, mac, 3) \ -X(a, POINTER, SINGULAR, BYTES, frame, 4) \ -X(a, STATIC, SINGULAR, UINT32, flags, 5) \ -X(a, STATIC, SINGULAR, UINT32, version, 6) \ -X(a, STATIC, OPTIONAL, MESSAGE, ack, 7) \ -X(a, STATIC, OPTIONAL, MESSAGE, fragment, 8) \ -X(a, STATIC, SINGULAR, INT64, timestamp, 9) \ -X(a, STATIC, SINGULAR, UINT32, sequence, 10) -#define NetworkMessage_CALLBACK NULL -#define NetworkMessage_DEFAULT NULL -#define NetworkMessage_ack_MSGTYPE Ack -#define NetworkMessage_fragment_MSGTYPE Fragment - -extern const pb_msgdesc_t Fragment_msg; -extern const pb_msgdesc_t Ack_msg; -extern const pb_msgdesc_t NetworkMessage_msg; - -/* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define Fragment_fields &Fragment_msg -#define Ack_fields &Ack_msg -#define NetworkMessage_fields &NetworkMessage_msg - -/* Maximum encoded size of messages (where known) */ -/* NetworkMessage_size depends on runtime parameters */ -#define Ack_size 12 -#define Fragment_size 18 - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/network/networkmessage.proto.txt b/src/network/networkmessage.proto.txt deleted file mode 100644 index 9511f17c89c..00000000000 --- a/src/network/networkmessage.proto.txt +++ /dev/null @@ -1,38 +0,0 @@ -syntax = "proto3"; -import "nanopb.proto"; - -enum MessageType { - MESSAGE_TYPE_UNSPECIFIED = 0; - MESSAGE_TYPE_DATA = 1; - MESSAGE_TYPE_JOIN = 2; - MESSAGE_TYPE_LEAVE = 3; - MESSAGE_TYPE_KEEPALIVE = 4; - MESSAGE_TYPE_FRAGMENT = 5; - MESSAGE_TYPE_ACK = 6; - MESSAGE_TYPE_CONNECT_REQUEST = 7; - MESSAGE_TYPE_CONNECT_REPLY = 8; -} - -message Fragment { - uint32 id = 1; - uint32 sequence = 2; - uint32 total = 3; -} - -message Ack { - uint32 id = 1; - uint32 history = 2; -} - -message NetworkMessage { - MessageType message_type = 1; - uint32 client_id = 2; - bytes mac = 3 [(nanopb).type = FT_POINTER]; - bytes frame = 4 [(nanopb).type = FT_POINTER]; - uint32 flags = 5; - uint32 version = 6; - Ack ack = 7; - Fragment fragment = 8; - int64 timestamp = 9; - uint32 sequence = 10; -} \ No newline at end of file diff --git a/src/network/pb.h b/src/network/pb.h deleted file mode 100644 index 7433ac24b08..00000000000 --- a/src/network/pb.h +++ /dev/null @@ -1,917 +0,0 @@ -/* Common parts of the nanopb library. Most of these are quite low-level - * stuff. For the high-level interface, see pb_encode.h and pb_decode.h. - */ - -#ifndef PB_H_INCLUDED -#define PB_H_INCLUDED - -/***************************************************************** - * Nanopb compilation time options. You can change these here by * - * uncommenting the lines, or on the compiler command line. * - *****************************************************************/ - -/* Enable support for dynamically allocated fields */ -#define PB_ENABLE_MALLOC 1 - -/* Define this if your CPU / compiler combination does not support - * unaligned memory access to packed structures. Note that packed - * structures are only used when requested in .proto options. */ -/* #define PB_NO_PACKED_STRUCTS 1 */ - -/* Increase the number of required fields that are tracked. - * A compiler warning will tell if you need this. */ -/* #define PB_MAX_REQUIRED_FIELDS 256 */ - -/* Add support for tag numbers > 65536 and fields larger than 65536 bytes. */ -/* #define PB_FIELD_32BIT 1 */ - -/* Disable support for error messages in order to save some code space. */ -/* #define PB_NO_ERRMSG 1 */ - -/* Disable support for custom streams (support only memory buffers). */ -#define PB_BUFFER_ONLY 1 - -/* Disable support for 64-bit datatypes, for compilers without int64_t - or to save some code space. */ -/* #define PB_WITHOUT_64BIT 1 */ - -/* Don't encode scalar arrays as packed. This is only to be used when - * the decoder on the receiving side cannot process packed scalar arrays. - * Such example is older protobuf.js. */ -/* #define PB_ENCODE_ARRAYS_UNPACKED 1 */ - -/* Enable conversion of doubles to floats for platforms that do not - * support 64-bit doubles. Most commonly AVR. */ -/* #define PB_CONVERT_DOUBLE_FLOAT 1 */ - -/* Check whether incoming strings are valid UTF-8 sequences. Slows down - * the string processing slightly and slightly increases code size. */ -/* #define PB_VALIDATE_UTF8 1 */ - -/* This can be defined if the platform is little-endian and has 8-bit bytes. - * Normally it is automatically detected based on __BYTE_ORDER__ macro. */ -/* #define PB_LITTLE_ENDIAN_8BIT 1 */ - -/* Configure static assert mechanism. Instead of changing these, set your - * compiler to C11 standard mode if possible. */ -/* #define PB_C99_STATIC_ASSERT 1 */ -/* #define PB_NO_STATIC_ASSERT 1 */ - -/****************************************************************** - * You usually don't need to change anything below this line. * - * Feel free to look around and use the defined macros, though. * - ******************************************************************/ - - -/* Version of the nanopb library. Just in case you want to check it in - * your own program. */ -#define NANOPB_VERSION "nanopb-0.4.8-dev" - -/* Include all the system headers needed by nanopb. You will need the - * definitions of the following: - * - strlen, memcpy, memset functions - * - [u]int_least8_t, uint_fast8_t, [u]int_least16_t, [u]int32_t, [u]int64_t - * - size_t - * - bool - * - * If you don't have the standard header files, you can instead provide - * a custom header that defines or includes all this. In that case, - * define PB_SYSTEM_HEADER to the path of this file. - */ -#ifdef PB_SYSTEM_HEADER -#include PB_SYSTEM_HEADER -#else -#include -#include -#include -#include -#include - -#ifdef PB_ENABLE_MALLOC -#include -#endif -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* Macro for defining packed structures (compiler dependent). - * This just reduces memory requirements, but is not required. - */ -#if defined(PB_NO_PACKED_STRUCTS) - /* Disable struct packing */ -# define PB_PACKED_STRUCT_START -# define PB_PACKED_STRUCT_END -# define pb_packed -#elif defined(__GNUC__) || defined(__clang__) - /* For GCC and clang */ -# define PB_PACKED_STRUCT_START -# define PB_PACKED_STRUCT_END -# define pb_packed __attribute__((packed)) -#elif defined(__ICCARM__) || defined(__CC_ARM) - /* For IAR ARM and Keil MDK-ARM compilers */ -# define PB_PACKED_STRUCT_START _Pragma("pack(push, 1)") -# define PB_PACKED_STRUCT_END _Pragma("pack(pop)") -# define pb_packed -#elif defined(_MSC_VER) && (_MSC_VER >= 1500) - /* For Microsoft Visual C++ */ -# define PB_PACKED_STRUCT_START __pragma(pack(push, 1)) -# define PB_PACKED_STRUCT_END __pragma(pack(pop)) -# define pb_packed -#else - /* Unknown compiler */ -# define PB_PACKED_STRUCT_START -# define PB_PACKED_STRUCT_END -# define pb_packed -#endif - -/* Detect endianness */ -#ifndef PB_LITTLE_ENDIAN_8BIT -#if ((defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \ - (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) || \ - defined(__LITTLE_ENDIAN__) || defined(__ARMEL__) || \ - defined(__THUMBEL__) || defined(__AARCH64EL__) || defined(_MIPSEL) || \ - defined(_M_IX86) || defined(_M_X64) || defined(_M_ARM)) \ - && CHAR_BIT == 8 -#define PB_LITTLE_ENDIAN_8BIT 1 -#endif -#endif - -/* Handly macro for suppressing unreferenced-parameter compiler warnings. */ -#ifndef PB_UNUSED -#define PB_UNUSED(x) (void)(x) -#endif - -/* Harvard-architecture processors may need special attributes for storing - * field information in program memory. */ -#ifndef PB_PROGMEM -#ifdef __AVR__ -#include -#define PB_PROGMEM PROGMEM -#define PB_PROGMEM_READU32(x) pgm_read_dword(&x) -#else -#define PB_PROGMEM -#define PB_PROGMEM_READU32(x) (x) -#endif -#endif - -/* Compile-time assertion, used for checking compatible compilation options. - * If this does not work properly on your compiler, use - * #define PB_NO_STATIC_ASSERT to disable it. - * - * But before doing that, check carefully the error message / place where it - * comes from to see if the error has a real cause. Unfortunately the error - * message is not always very clear to read, but you can see the reason better - * in the place where the PB_STATIC_ASSERT macro was called. - */ -#ifndef PB_NO_STATIC_ASSERT -# ifndef PB_STATIC_ASSERT -# if defined(__ICCARM__) - /* IAR has static_assert keyword but no _Static_assert */ -# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); -# elif defined(_MSC_VER) && (!defined(__STDC_VERSION__) || __STDC_VERSION__ < 201112) - /* MSVC in C89 mode supports static_assert() keyword anyway */ -# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); -# elif defined(PB_C99_STATIC_ASSERT) - /* Classic negative-size-array static assert mechanism */ -# define PB_STATIC_ASSERT(COND,MSG) typedef char PB_STATIC_ASSERT_MSG(MSG, __LINE__, __COUNTER__)[(COND)?1:-1]; -# define PB_STATIC_ASSERT_MSG(MSG, LINE, COUNTER) PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) -# define PB_STATIC_ASSERT_MSG_(MSG, LINE, COUNTER) pb_static_assertion_##MSG##_##LINE##_##COUNTER -# elif defined(__cplusplus) - /* C++11 standard static_assert mechanism */ -# define PB_STATIC_ASSERT(COND,MSG) static_assert(COND,#MSG); -# else - /* C11 standard _Static_assert mechanism */ -# define PB_STATIC_ASSERT(COND,MSG) _Static_assert(COND,#MSG); -# endif -# endif -#else - /* Static asserts disabled by PB_NO_STATIC_ASSERT */ -# define PB_STATIC_ASSERT(COND,MSG) -#endif - -/* Test that PB_STATIC_ASSERT works - * If you get errors here, you may need to do one of these: - * - Enable C11 standard support in your compiler - * - Define PB_C99_STATIC_ASSERT to enable C99 standard support - * - Define PB_NO_STATIC_ASSERT to disable static asserts altogether - */ -PB_STATIC_ASSERT(1, STATIC_ASSERT_IS_NOT_WORKING) - -/* Number of required fields to keep track of. */ -#ifndef PB_MAX_REQUIRED_FIELDS -#define PB_MAX_REQUIRED_FIELDS 64 -#endif - -#if PB_MAX_REQUIRED_FIELDS < 64 -#error You should not lower PB_MAX_REQUIRED_FIELDS from the default value (64). -#endif - -#ifdef PB_WITHOUT_64BIT -#ifdef PB_CONVERT_DOUBLE_FLOAT -/* Cannot use doubles without 64-bit types */ -#undef PB_CONVERT_DOUBLE_FLOAT -#endif -#endif - -/* List of possible field types. These are used in the autogenerated code. - * Least-significant 4 bits tell the scalar type - * Most-significant 4 bits specify repeated/required/packed etc. - */ - -typedef uint_least8_t pb_type_t; - -/**** Field data types ****/ - -/* Numeric types */ -#define PB_LTYPE_BOOL 0x00U /* bool */ -#define PB_LTYPE_VARINT 0x01U /* int32, int64, enum, bool */ -#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */ -#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */ -#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */ -#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */ - -/* Marker for last packable field type. */ -#define PB_LTYPE_LAST_PACKABLE 0x05U - -/* Byte array with pre-allocated buffer. - * data_size is the length of the allocated PB_BYTES_ARRAY structure. */ -#define PB_LTYPE_BYTES 0x06U - -/* String with pre-allocated buffer. - * data_size is the maximum length. */ -#define PB_LTYPE_STRING 0x07U - -/* Submessage - * submsg_fields is pointer to field descriptions */ -#define PB_LTYPE_SUBMESSAGE 0x08U - -/* Submessage with pre-decoding callback - * The pre-decoding callback is stored as pb_callback_t right before pSize. - * submsg_fields is pointer to field descriptions */ -#define PB_LTYPE_SUBMSG_W_CB 0x09U - -/* Extension pseudo-field - * The field contains a pointer to pb_extension_t */ -#define PB_LTYPE_EXTENSION 0x0AU - -/* Byte array with inline, pre-allocated byffer. - * data_size is the length of the inline, allocated buffer. - * This differs from PB_LTYPE_BYTES by defining the element as - * pb_byte_t[data_size] rather than pb_bytes_array_t. */ -#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0BU - -/* Number of declared LTYPES */ -#define PB_LTYPES_COUNT 0x0CU -#define PB_LTYPE_MASK 0x0FU - -/**** Field repetition rules ****/ - -#define PB_HTYPE_REQUIRED 0x00U -#define PB_HTYPE_OPTIONAL 0x10U -#define PB_HTYPE_SINGULAR 0x10U -#define PB_HTYPE_REPEATED 0x20U -#define PB_HTYPE_FIXARRAY 0x20U -#define PB_HTYPE_ONEOF 0x30U -#define PB_HTYPE_MASK 0x30U - -/**** Field allocation types ****/ - -#define PB_ATYPE_STATIC 0x00U -#define PB_ATYPE_POINTER 0x80U -#define PB_ATYPE_CALLBACK 0x40U -#define PB_ATYPE_MASK 0xC0U - -#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK) -#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK) -#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK) -#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \ - PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB) - -/* Data type used for storing sizes of struct fields - * and array counts. - */ -#if defined(PB_FIELD_32BIT) - typedef uint32_t pb_size_t; - typedef int32_t pb_ssize_t; -#else - typedef uint_least16_t pb_size_t; - typedef int_least16_t pb_ssize_t; -#endif -#define PB_SIZE_MAX ((pb_size_t)-1) - -/* Data type for storing encoded data and other byte streams. - * This typedef exists to support platforms where uint8_t does not exist. - * You can regard it as equivalent on uint8_t on other platforms. - */ -typedef uint_least8_t pb_byte_t; - -/* Forward declaration of struct types */ -typedef struct pb_istream_s pb_istream_t; -typedef struct pb_ostream_s pb_ostream_t; -typedef struct pb_field_iter_s pb_field_iter_t; - -/* This structure is used in auto-generated constants - * to specify struct fields. - */ -typedef struct pb_msgdesc_s pb_msgdesc_t; -struct pb_msgdesc_s { - const uint32_t *field_info; - const pb_msgdesc_t * const * submsg_info; - const pb_byte_t *default_value; - - bool (*field_callback)(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_iter_t *field); - - pb_size_t field_count; - pb_size_t required_field_count; - pb_size_t largest_tag; -}; - -/* Iterator for message descriptor */ -struct pb_field_iter_s { - const pb_msgdesc_t *descriptor; /* Pointer to message descriptor constant */ - void *message; /* Pointer to start of the structure */ - - pb_size_t index; /* Index of the field */ - pb_size_t field_info_index; /* Index to descriptor->field_info array */ - pb_size_t required_field_index; /* Index that counts only the required fields */ - pb_size_t submessage_index; /* Index that counts only submessages */ - - pb_size_t tag; /* Tag of current field */ - pb_size_t data_size; /* sizeof() of a single item */ - pb_size_t array_size; /* Number of array entries */ - pb_type_t type; /* Type of current field */ - - void *pField; /* Pointer to current field in struct */ - void *pData; /* Pointer to current data contents. Different than pField for arrays and pointers. */ - void *pSize; /* Pointer to count/has field */ - - const pb_msgdesc_t *submsg_desc; /* For submessage fields, pointer to field descriptor for the submessage. */ -}; - -/* For compatibility with legacy code */ -typedef pb_field_iter_t pb_field_t; - -/* Make sure that the standard integer types are of the expected sizes. - * Otherwise fixed32/fixed64 fields can break. - * - * If you get errors here, it probably means that your stdint.h is not - * correct for your platform. - */ -#ifndef PB_WITHOUT_64BIT -PB_STATIC_ASSERT(sizeof(int64_t) == 2 * sizeof(int32_t), INT64_T_WRONG_SIZE) -PB_STATIC_ASSERT(sizeof(uint64_t) == 2 * sizeof(uint32_t), UINT64_T_WRONG_SIZE) -#endif - -/* This structure is used for 'bytes' arrays. - * It has the number of bytes in the beginning, and after that an array. - * Note that actual structs used will have a different length of bytes array. - */ -#define PB_BYTES_ARRAY_T(n) struct { pb_size_t size; pb_byte_t bytes[n]; } -#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes)) - -struct pb_bytes_array_s { - pb_size_t size; - pb_byte_t bytes[1]; -}; -typedef struct pb_bytes_array_s pb_bytes_array_t; - -/* This structure is used for giving the callback function. - * It is stored in the message structure and filled in by the method that - * calls pb_decode. - * - * The decoding callback will be given a limited-length stream - * If the wire type was string, the length is the length of the string. - * If the wire type was a varint/fixed32/fixed64, the length is the length - * of the actual value. - * The function may be called multiple times (especially for repeated types, - * but also otherwise if the message happens to contain the field multiple - * times.) - * - * The encoding callback will receive the actual output stream. - * It should write all the data in one call, including the field tag and - * wire type. It can write multiple fields. - * - * The callback can be null if you want to skip a field. - */ -typedef struct pb_callback_s pb_callback_t; -struct pb_callback_s { - /* Callback functions receive a pointer to the arg field. - * You can access the value of the field as *arg, and modify it if needed. - */ - union { - bool (*decode)(pb_istream_t *stream, const pb_field_t *field, void **arg); - bool (*encode)(pb_ostream_t *stream, const pb_field_t *field, void * const *arg); - } funcs; - - /* Free arg for use by callback */ - void *arg; -}; - -extern bool pb_default_field_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field); - -/* Wire types. Library user needs these only in encoder callbacks. */ -typedef enum { - PB_WT_VARINT = 0, - PB_WT_64BIT = 1, - PB_WT_STRING = 2, - PB_WT_32BIT = 5, - PB_WT_PACKED = 255 /* PB_WT_PACKED is internal marker for packed arrays. */ -} pb_wire_type_t; - -/* Structure for defining the handling of unknown/extension fields. - * Usually the pb_extension_type_t structure is automatically generated, - * while the pb_extension_t structure is created by the user. However, - * if you want to catch all unknown fields, you can also create a custom - * pb_extension_type_t with your own callback. - */ -typedef struct pb_extension_type_s pb_extension_type_t; -typedef struct pb_extension_s pb_extension_t; -struct pb_extension_type_s { - /* Called for each unknown field in the message. - * If you handle the field, read off all of its data and return true. - * If you do not handle the field, do not read anything and return true. - * If you run into an error, return false. - * Set to NULL for default handler. - */ - bool (*decode)(pb_istream_t *stream, pb_extension_t *extension, - uint32_t tag, pb_wire_type_t wire_type); - - /* Called once after all regular fields have been encoded. - * If you have something to write, do so and return true. - * If you do not have anything to write, just return true. - * If you run into an error, return false. - * Set to NULL for default handler. - */ - bool (*encode)(pb_ostream_t *stream, const pb_extension_t *extension); - - /* Free field for use by the callback. */ - const void *arg; -}; - -struct pb_extension_s { - /* Type describing the extension field. Usually you'll initialize - * this to a pointer to the automatically generated structure. */ - const pb_extension_type_t *type; - - /* Destination for the decoded data. This must match the datatype - * of the extension field. */ - void *dest; - - /* Pointer to the next extension handler, or NULL. - * If this extension does not match a field, the next handler is - * automatically called. */ - pb_extension_t *next; - - /* The decoder sets this to true if the extension was found. - * Ignored for encoding. */ - bool found; -}; - -#define pb_extension_init_zero {NULL,NULL,NULL,false} - -/* Memory allocation functions to use. You can define pb_realloc and - * pb_free to custom functions if you want. */ -#ifdef PB_ENABLE_MALLOC -# ifndef pb_realloc -# define pb_realloc(ptr, size) realloc(ptr, size) -# endif -# ifndef pb_free -# define pb_free(ptr) free(ptr) -# endif -#endif - -/* This is used to inform about need to regenerate .pb.h/.pb.c files. */ -#define PB_PROTO_HEADER_VERSION 40 - -/* These macros are used to declare pb_field_t's in the constant array. */ -/* Size of a structure member, in bytes. */ -#define pb_membersize(st, m) (sizeof ((st*)0)->m) -/* Number of entries in an array. */ -#define pb_arraysize(st, m) (pb_membersize(st, m) / pb_membersize(st, m[0])) -/* Delta from start of one member to the start of another member. */ -#define pb_delta(st, m1, m2) ((int)offsetof(st, m1) - (int)offsetof(st, m2)) - -/* Force expansion of macro value */ -#define PB_EXPAND(x) x - -/* Binding of a message field set into a specific structure */ -#define PB_BIND(msgname, structname, width) \ - const uint32_t structname ## _field_info[] PB_PROGMEM = \ - { \ - msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ ## width, structname) \ - 0 \ - }; \ - const pb_msgdesc_t* const structname ## _submsg_info[] = \ - { \ - msgname ## _FIELDLIST(PB_GEN_SUBMSG_INFO, structname) \ - NULL \ - }; \ - const pb_msgdesc_t structname ## _msg = \ - { \ - structname ## _field_info, \ - structname ## _submsg_info, \ - msgname ## _DEFAULT, \ - msgname ## _CALLBACK, \ - 0 msgname ## _FIELDLIST(PB_GEN_FIELD_COUNT, structname), \ - 0 msgname ## _FIELDLIST(PB_GEN_REQ_FIELD_COUNT, structname), \ - 0 msgname ## _FIELDLIST(PB_GEN_LARGEST_TAG, structname), \ - }; \ - msgname ## _FIELDLIST(PB_GEN_FIELD_INFO_ASSERT_ ## width, structname) - -#define PB_GEN_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) +1 -#define PB_GEN_REQ_FIELD_COUNT(structname, atype, htype, ltype, fieldname, tag) \ - + (PB_HTYPE_ ## htype == PB_HTYPE_REQUIRED) -#define PB_GEN_LARGEST_TAG(structname, atype, htype, ltype, fieldname, tag) \ - * 0 + tag - -/* X-macro for generating the entries in struct_field_info[] array. */ -#define PB_GEN_FIELD_INFO_1(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_1(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_2(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_2(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_4(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_4(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_8(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_8(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_AUTO(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_AUTO2(PB_FIELDINFO_WIDTH_AUTO(_PB_ATYPE_ ## atype, _PB_HTYPE_ ## htype, _PB_LTYPE_ ## ltype), \ - tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_FIELDINFO_AUTO2(width, tag, type, data_offset, data_size, size_offset, array_size) \ - PB_FIELDINFO_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) - -#define PB_FIELDINFO_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) \ - PB_FIELDINFO_ ## width(tag, type, data_offset, data_size, size_offset, array_size) - -/* X-macro for generating asserts that entries fit in struct_field_info[] array. - * The structure of macros here must match the structure above in PB_GEN_FIELD_INFO_x(), - * but it is not easily reused because of how macro substitutions work. */ -#define PB_GEN_FIELD_INFO_ASSERT_1(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_ASSERT_1(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_ASSERT_2(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_ASSERT_2(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_ASSERT_4(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_ASSERT_4(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_ASSERT_8(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_ASSERT_8(tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_GEN_FIELD_INFO_ASSERT_AUTO(structname, atype, htype, ltype, fieldname, tag) \ - PB_FIELDINFO_ASSERT_AUTO2(PB_FIELDINFO_WIDTH_AUTO(_PB_ATYPE_ ## atype, _PB_HTYPE_ ## htype, _PB_LTYPE_ ## ltype), \ - tag, PB_ATYPE_ ## atype | PB_HTYPE_ ## htype | PB_LTYPE_MAP_ ## ltype, \ - PB_DATA_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_DATA_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_SIZE_OFFSET_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname), \ - PB_ARRAY_SIZE_ ## atype(_PB_HTYPE_ ## htype, structname, fieldname)) - -#define PB_FIELDINFO_ASSERT_AUTO2(width, tag, type, data_offset, data_size, size_offset, array_size) \ - PB_FIELDINFO_ASSERT_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) - -#define PB_FIELDINFO_ASSERT_AUTO3(width, tag, type, data_offset, data_size, size_offset, array_size) \ - PB_FIELDINFO_ASSERT_ ## width(tag, type, data_offset, data_size, size_offset, array_size) - -#define PB_DATA_OFFSET_STATIC(htype, structname, fieldname) PB_DO ## htype(structname, fieldname) -#define PB_DATA_OFFSET_POINTER(htype, structname, fieldname) PB_DO ## htype(structname, fieldname) -#define PB_DATA_OFFSET_CALLBACK(htype, structname, fieldname) PB_DO ## htype(structname, fieldname) -#define PB_DO_PB_HTYPE_REQUIRED(structname, fieldname) offsetof(structname, fieldname) -#define PB_DO_PB_HTYPE_SINGULAR(structname, fieldname) offsetof(structname, fieldname) -#define PB_DO_PB_HTYPE_ONEOF(structname, fieldname) offsetof(structname, PB_ONEOF_NAME(FULL, fieldname)) -#define PB_DO_PB_HTYPE_OPTIONAL(structname, fieldname) offsetof(structname, fieldname) -#define PB_DO_PB_HTYPE_REPEATED(structname, fieldname) offsetof(structname, fieldname) -#define PB_DO_PB_HTYPE_FIXARRAY(structname, fieldname) offsetof(structname, fieldname) - -#define PB_SIZE_OFFSET_STATIC(htype, structname, fieldname) PB_SO ## htype(structname, fieldname) -#define PB_SIZE_OFFSET_POINTER(htype, structname, fieldname) PB_SO_PTR ## htype(structname, fieldname) -#define PB_SIZE_OFFSET_CALLBACK(htype, structname, fieldname) PB_SO_CB ## htype(structname, fieldname) -#define PB_SO_PB_HTYPE_REQUIRED(structname, fieldname) 0 -#define PB_SO_PB_HTYPE_SINGULAR(structname, fieldname) 0 -#define PB_SO_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF2(structname, PB_ONEOF_NAME(FULL, fieldname), PB_ONEOF_NAME(UNION, fieldname)) -#define PB_SO_PB_HTYPE_ONEOF2(structname, fullname, unionname) PB_SO_PB_HTYPE_ONEOF3(structname, fullname, unionname) -#define PB_SO_PB_HTYPE_ONEOF3(structname, fullname, unionname) pb_delta(structname, fullname, which_ ## unionname) -#define PB_SO_PB_HTYPE_OPTIONAL(structname, fieldname) pb_delta(structname, fieldname, has_ ## fieldname) -#define PB_SO_PB_HTYPE_REPEATED(structname, fieldname) pb_delta(structname, fieldname, fieldname ## _count) -#define PB_SO_PB_HTYPE_FIXARRAY(structname, fieldname) 0 -#define PB_SO_PTR_PB_HTYPE_REQUIRED(structname, fieldname) 0 -#define PB_SO_PTR_PB_HTYPE_SINGULAR(structname, fieldname) 0 -#define PB_SO_PTR_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF(structname, fieldname) -#define PB_SO_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) 0 -#define PB_SO_PTR_PB_HTYPE_REPEATED(structname, fieldname) PB_SO_PB_HTYPE_REPEATED(structname, fieldname) -#define PB_SO_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) 0 -#define PB_SO_CB_PB_HTYPE_REQUIRED(structname, fieldname) 0 -#define PB_SO_CB_PB_HTYPE_SINGULAR(structname, fieldname) 0 -#define PB_SO_CB_PB_HTYPE_ONEOF(structname, fieldname) PB_SO_PB_HTYPE_ONEOF(structname, fieldname) -#define PB_SO_CB_PB_HTYPE_OPTIONAL(structname, fieldname) 0 -#define PB_SO_CB_PB_HTYPE_REPEATED(structname, fieldname) 0 -#define PB_SO_CB_PB_HTYPE_FIXARRAY(structname, fieldname) 0 - -#define PB_ARRAY_SIZE_STATIC(htype, structname, fieldname) PB_AS ## htype(structname, fieldname) -#define PB_ARRAY_SIZE_POINTER(htype, structname, fieldname) PB_AS_PTR ## htype(structname, fieldname) -#define PB_ARRAY_SIZE_CALLBACK(htype, structname, fieldname) 1 -#define PB_AS_PB_HTYPE_REQUIRED(structname, fieldname) 1 -#define PB_AS_PB_HTYPE_SINGULAR(structname, fieldname) 1 -#define PB_AS_PB_HTYPE_OPTIONAL(structname, fieldname) 1 -#define PB_AS_PB_HTYPE_ONEOF(structname, fieldname) 1 -#define PB_AS_PB_HTYPE_REPEATED(structname, fieldname) pb_arraysize(structname, fieldname) -#define PB_AS_PB_HTYPE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname) -#define PB_AS_PTR_PB_HTYPE_REQUIRED(structname, fieldname) 1 -#define PB_AS_PTR_PB_HTYPE_SINGULAR(structname, fieldname) 1 -#define PB_AS_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) 1 -#define PB_AS_PTR_PB_HTYPE_ONEOF(structname, fieldname) 1 -#define PB_AS_PTR_PB_HTYPE_REPEATED(structname, fieldname) 1 -#define PB_AS_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) pb_arraysize(structname, fieldname[0]) - -#define PB_DATA_SIZE_STATIC(htype, structname, fieldname) PB_DS ## htype(structname, fieldname) -#define PB_DATA_SIZE_POINTER(htype, structname, fieldname) PB_DS_PTR ## htype(structname, fieldname) -#define PB_DATA_SIZE_CALLBACK(htype, structname, fieldname) PB_DS_CB ## htype(structname, fieldname) -#define PB_DS_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname)) -#define PB_DS_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0]) -#define PB_DS_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0]) -#define PB_DS_PTR_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname[0]) -#define PB_DS_PTR_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname[0]) -#define PB_DS_PTR_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname[0]) -#define PB_DS_PTR_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname)[0]) -#define PB_DS_PTR_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname[0]) -#define PB_DS_PTR_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname[0][0]) -#define PB_DS_CB_PB_HTYPE_REQUIRED(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_CB_PB_HTYPE_SINGULAR(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_CB_PB_HTYPE_OPTIONAL(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_CB_PB_HTYPE_ONEOF(structname, fieldname) pb_membersize(structname, PB_ONEOF_NAME(FULL, fieldname)) -#define PB_DS_CB_PB_HTYPE_REPEATED(structname, fieldname) pb_membersize(structname, fieldname) -#define PB_DS_CB_PB_HTYPE_FIXARRAY(structname, fieldname) pb_membersize(structname, fieldname) - -#define PB_ONEOF_NAME(type, tuple) PB_EXPAND(PB_ONEOF_NAME_ ## type tuple) -#define PB_ONEOF_NAME_UNION(unionname,membername,fullname) unionname -#define PB_ONEOF_NAME_MEMBER(unionname,membername,fullname) membername -#define PB_ONEOF_NAME_FULL(unionname,membername,fullname) fullname - -#define PB_GEN_SUBMSG_INFO(structname, atype, htype, ltype, fieldname, tag) \ - PB_SUBMSG_INFO_ ## htype(_PB_LTYPE_ ## ltype, structname, fieldname) - -#define PB_SUBMSG_INFO_REQUIRED(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE) -#define PB_SUBMSG_INFO_SINGULAR(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE) -#define PB_SUBMSG_INFO_OPTIONAL(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE) -#define PB_SUBMSG_INFO_ONEOF(ltype, structname, fieldname) PB_SUBMSG_INFO_ONEOF2(ltype, structname, PB_ONEOF_NAME(UNION, fieldname), PB_ONEOF_NAME(MEMBER, fieldname)) -#define PB_SUBMSG_INFO_ONEOF2(ltype, structname, unionname, membername) PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername) -#define PB_SUBMSG_INFO_ONEOF3(ltype, structname, unionname, membername) PB_SI ## ltype(structname ## _ ## unionname ## _ ## membername ## _MSGTYPE) -#define PB_SUBMSG_INFO_REPEATED(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE) -#define PB_SUBMSG_INFO_FIXARRAY(ltype, structname, fieldname) PB_SI ## ltype(structname ## _ ## fieldname ## _MSGTYPE) -#define PB_SI_PB_LTYPE_BOOL(t) -#define PB_SI_PB_LTYPE_BYTES(t) -#define PB_SI_PB_LTYPE_DOUBLE(t) -#define PB_SI_PB_LTYPE_ENUM(t) -#define PB_SI_PB_LTYPE_UENUM(t) -#define PB_SI_PB_LTYPE_FIXED32(t) -#define PB_SI_PB_LTYPE_FIXED64(t) -#define PB_SI_PB_LTYPE_FLOAT(t) -#define PB_SI_PB_LTYPE_INT32(t) -#define PB_SI_PB_LTYPE_INT64(t) -#define PB_SI_PB_LTYPE_MESSAGE(t) PB_SUBMSG_DESCRIPTOR(t) -#define PB_SI_PB_LTYPE_MSG_W_CB(t) PB_SUBMSG_DESCRIPTOR(t) -#define PB_SI_PB_LTYPE_SFIXED32(t) -#define PB_SI_PB_LTYPE_SFIXED64(t) -#define PB_SI_PB_LTYPE_SINT32(t) -#define PB_SI_PB_LTYPE_SINT64(t) -#define PB_SI_PB_LTYPE_STRING(t) -#define PB_SI_PB_LTYPE_UINT32(t) -#define PB_SI_PB_LTYPE_UINT64(t) -#define PB_SI_PB_LTYPE_EXTENSION(t) -#define PB_SI_PB_LTYPE_FIXED_LENGTH_BYTES(t) -#define PB_SUBMSG_DESCRIPTOR(t) &(t ## _msg), - -/* The field descriptors use a variable width format, with width of either - * 1, 2, 4 or 8 of 32-bit words. The two lowest bytes of the first byte always - * encode the descriptor size, 6 lowest bits of field tag number, and 8 bits - * of the field type. - * - * Descriptor size is encoded as 0 = 1 word, 1 = 2 words, 2 = 4 words, 3 = 8 words. - * - * Formats, listed starting with the least significant bit of the first word. - * 1 word: [2-bit len] [6-bit tag] [8-bit type] [8-bit data_offset] [4-bit size_offset] [4-bit data_size] - * - * 2 words: [2-bit len] [6-bit tag] [8-bit type] [12-bit array_size] [4-bit size_offset] - * [16-bit data_offset] [12-bit data_size] [4-bit tag>>6] - * - * 4 words: [2-bit len] [6-bit tag] [8-bit type] [16-bit array_size] - * [8-bit size_offset] [24-bit tag>>6] - * [32-bit data_offset] - * [32-bit data_size] - * - * 8 words: [2-bit len] [6-bit tag] [8-bit type] [16-bit reserved] - * [8-bit size_offset] [24-bit tag>>6] - * [32-bit data_offset] - * [32-bit data_size] - * [32-bit array_size] - * [32-bit reserved] - * [32-bit reserved] - * [32-bit reserved] - */ - -#define PB_FIELDINFO_1(tag, type, data_offset, data_size, size_offset, array_size) \ - (0 | (((tag) << 2) & 0xFF) | ((type) << 8) | (((uint32_t)(data_offset) & 0xFF) << 16) | \ - (((uint32_t)(size_offset) & 0x0F) << 24) | (((uint32_t)(data_size) & 0x0F) << 28)), - -#define PB_FIELDINFO_2(tag, type, data_offset, data_size, size_offset, array_size) \ - (1 | (((tag) << 2) & 0xFF) | ((type) << 8) | (((uint32_t)(array_size) & 0xFFF) << 16) | (((uint32_t)(size_offset) & 0x0F) << 28)), \ - (((uint32_t)(data_offset) & 0xFFFF) | (((uint32_t)(data_size) & 0xFFF) << 16) | (((uint32_t)(tag) & 0x3c0) << 22)), - -#define PB_FIELDINFO_4(tag, type, data_offset, data_size, size_offset, array_size) \ - (2 | (((tag) << 2) & 0xFF) | ((type) << 8) | (((uint32_t)(array_size) & 0xFFFF) << 16)), \ - ((uint32_t)(int_least8_t)(size_offset) | (((uint32_t)(tag) << 2) & 0xFFFFFF00)), \ - (data_offset), (data_size), - -#define PB_FIELDINFO_8(tag, type, data_offset, data_size, size_offset, array_size) \ - (3 | (((tag) << 2) & 0xFF) | ((type) << 8)), \ - ((uint32_t)(int_least8_t)(size_offset) | (((uint32_t)(tag) << 2) & 0xFFFFFF00)), \ - (data_offset), (data_size), (array_size), 0, 0, 0, - -/* These assertions verify that the field information fits in the allocated space. - * The generator tries to automatically determine the correct width that can fit all - * data associated with a message. These asserts will fail only if there has been a - * problem in the automatic logic - this may be worth reporting as a bug. As a workaround, - * you can increase the descriptor width by defining PB_FIELDINFO_WIDTH or by setting - * descriptorsize option in .options file. - */ -#define PB_FITS(value,bits) ((uint32_t)(value) < ((uint32_t)1<2GB messages with nanopb anyway. - */ -#define PB_FIELDINFO_ASSERT_4(tag, type, data_offset, data_size, size_offset, array_size) \ - PB_STATIC_ASSERT(PB_FITS(tag,30) && PB_FITS(data_offset,31) && PB_FITS(size_offset,8) && PB_FITS(data_size,31) && PB_FITS(array_size,16), FIELDINFO_DOES_NOT_FIT_width4_field ## tag) - -#define PB_FIELDINFO_ASSERT_8(tag, type, data_offset, data_size, size_offset, array_size) \ - PB_STATIC_ASSERT(PB_FITS(tag,30) && PB_FITS(data_offset,31) && PB_FITS(size_offset,8) && PB_FITS(data_size,31) && PB_FITS(array_size,31), FIELDINFO_DOES_NOT_FIT_width8_field ## tag) -#endif - - -/* Automatic picking of FIELDINFO width: - * Uses width 1 when possible, otherwise resorts to width 2. - * This is used when PB_BIND() is called with "AUTO" as the argument. - * The generator will give explicit size argument when it knows that a message - * structure grows beyond 1-word format limits. - */ -#define PB_FIELDINFO_WIDTH_AUTO(atype, htype, ltype) PB_FI_WIDTH ## atype(htype, ltype) -#define PB_FI_WIDTH_PB_ATYPE_STATIC(htype, ltype) PB_FI_WIDTH ## htype(ltype) -#define PB_FI_WIDTH_PB_ATYPE_POINTER(htype, ltype) PB_FI_WIDTH ## htype(ltype) -#define PB_FI_WIDTH_PB_ATYPE_CALLBACK(htype, ltype) 2 -#define PB_FI_WIDTH_PB_HTYPE_REQUIRED(ltype) PB_FI_WIDTH ## ltype -#define PB_FI_WIDTH_PB_HTYPE_SINGULAR(ltype) PB_FI_WIDTH ## ltype -#define PB_FI_WIDTH_PB_HTYPE_OPTIONAL(ltype) PB_FI_WIDTH ## ltype -#define PB_FI_WIDTH_PB_HTYPE_ONEOF(ltype) PB_FI_WIDTH ## ltype -#define PB_FI_WIDTH_PB_HTYPE_REPEATED(ltype) 2 -#define PB_FI_WIDTH_PB_HTYPE_FIXARRAY(ltype) 2 -#define PB_FI_WIDTH_PB_LTYPE_BOOL 1 -#define PB_FI_WIDTH_PB_LTYPE_BYTES 2 -#define PB_FI_WIDTH_PB_LTYPE_DOUBLE 1 -#define PB_FI_WIDTH_PB_LTYPE_ENUM 1 -#define PB_FI_WIDTH_PB_LTYPE_UENUM 1 -#define PB_FI_WIDTH_PB_LTYPE_FIXED32 1 -#define PB_FI_WIDTH_PB_LTYPE_FIXED64 1 -#define PB_FI_WIDTH_PB_LTYPE_FLOAT 1 -#define PB_FI_WIDTH_PB_LTYPE_INT32 1 -#define PB_FI_WIDTH_PB_LTYPE_INT64 1 -#define PB_FI_WIDTH_PB_LTYPE_MESSAGE 2 -#define PB_FI_WIDTH_PB_LTYPE_MSG_W_CB 2 -#define PB_FI_WIDTH_PB_LTYPE_SFIXED32 1 -#define PB_FI_WIDTH_PB_LTYPE_SFIXED64 1 -#define PB_FI_WIDTH_PB_LTYPE_SINT32 1 -#define PB_FI_WIDTH_PB_LTYPE_SINT64 1 -#define PB_FI_WIDTH_PB_LTYPE_STRING 2 -#define PB_FI_WIDTH_PB_LTYPE_UINT32 1 -#define PB_FI_WIDTH_PB_LTYPE_UINT64 1 -#define PB_FI_WIDTH_PB_LTYPE_EXTENSION 1 -#define PB_FI_WIDTH_PB_LTYPE_FIXED_LENGTH_BYTES 2 - -/* The mapping from protobuf types to LTYPEs is done using these macros. */ -#define PB_LTYPE_MAP_BOOL PB_LTYPE_BOOL -#define PB_LTYPE_MAP_BYTES PB_LTYPE_BYTES -#define PB_LTYPE_MAP_DOUBLE PB_LTYPE_FIXED64 -#define PB_LTYPE_MAP_ENUM PB_LTYPE_VARINT -#define PB_LTYPE_MAP_UENUM PB_LTYPE_UVARINT -#define PB_LTYPE_MAP_FIXED32 PB_LTYPE_FIXED32 -#define PB_LTYPE_MAP_FIXED64 PB_LTYPE_FIXED64 -#define PB_LTYPE_MAP_FLOAT PB_LTYPE_FIXED32 -#define PB_LTYPE_MAP_INT32 PB_LTYPE_VARINT -#define PB_LTYPE_MAP_INT64 PB_LTYPE_VARINT -#define PB_LTYPE_MAP_MESSAGE PB_LTYPE_SUBMESSAGE -#define PB_LTYPE_MAP_MSG_W_CB PB_LTYPE_SUBMSG_W_CB -#define PB_LTYPE_MAP_SFIXED32 PB_LTYPE_FIXED32 -#define PB_LTYPE_MAP_SFIXED64 PB_LTYPE_FIXED64 -#define PB_LTYPE_MAP_SINT32 PB_LTYPE_SVARINT -#define PB_LTYPE_MAP_SINT64 PB_LTYPE_SVARINT -#define PB_LTYPE_MAP_STRING PB_LTYPE_STRING -#define PB_LTYPE_MAP_UINT32 PB_LTYPE_UVARINT -#define PB_LTYPE_MAP_UINT64 PB_LTYPE_UVARINT -#define PB_LTYPE_MAP_EXTENSION PB_LTYPE_EXTENSION -#define PB_LTYPE_MAP_FIXED_LENGTH_BYTES PB_LTYPE_FIXED_LENGTH_BYTES - -/* These macros are used for giving out error messages. - * They are mostly a debugging aid; the main error information - * is the true/false return value from functions. - * Some code space can be saved by disabling the error - * messages if not used. - * - * PB_SET_ERROR() sets the error message if none has been set yet. - * msg must be a constant string literal. - * PB_GET_ERROR() always returns a pointer to a string. - * PB_RETURN_ERROR() sets the error and returns false from current - * function. - */ -#ifdef PB_NO_ERRMSG -#define PB_SET_ERROR(stream, msg) PB_UNUSED(stream) -#define PB_GET_ERROR(stream) "(errmsg disabled)" -#else -#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg)) -#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)") -#endif - -#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#ifdef __cplusplus -#if __cplusplus >= 201103L -#define PB_CONSTEXPR constexpr -#else // __cplusplus >= 201103L -#define PB_CONSTEXPR -#endif // __cplusplus >= 201103L - -#if __cplusplus >= 201703L -#define PB_INLINE_CONSTEXPR inline constexpr -#else // __cplusplus >= 201703L -#define PB_INLINE_CONSTEXPR PB_CONSTEXPR -#endif // __cplusplus >= 201703L - -extern "C++" -{ -namespace nanopb { -// Each type will be partially specialized by the generator. -template struct MessageDescriptor; -} // namespace nanopb -} -#endif /* __cplusplus */ - -#endif diff --git a/src/network/pb_common.c b/src/network/pb_common.c deleted file mode 100644 index 6aee76b1efa..00000000000 --- a/src/network/pb_common.c +++ /dev/null @@ -1,388 +0,0 @@ -/* pb_common.c: Common support functions for pb_encode.c and pb_decode.c. - * - * 2014 Petteri Aimonen - */ - -#include "pb_common.h" - -static bool load_descriptor_values(pb_field_iter_t *iter) -{ - uint32_t word0; - uint32_t data_offset; - int_least8_t size_offset; - - if (iter->index >= iter->descriptor->field_count) - return false; - - word0 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]); - iter->type = (pb_type_t)((word0 >> 8) & 0xFF); - - switch(word0 & 3) - { - case 0: { - /* 1-word format */ - iter->array_size = 1; - iter->tag = (pb_size_t)((word0 >> 2) & 0x3F); - size_offset = (int_least8_t)((word0 >> 24) & 0x0F); - data_offset = (word0 >> 16) & 0xFF; - iter->data_size = (pb_size_t)((word0 >> 28) & 0x0F); - break; - } - - case 1: { - /* 2-word format */ - uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]); - - iter->array_size = (pb_size_t)((word0 >> 16) & 0x0FFF); - iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 28) << 6)); - size_offset = (int_least8_t)((word0 >> 28) & 0x0F); - data_offset = word1 & 0xFFFF; - iter->data_size = (pb_size_t)((word1 >> 16) & 0x0FFF); - break; - } - - case 2: { - /* 4-word format */ - uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]); - uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]); - uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]); - - iter->array_size = (pb_size_t)(word0 >> 16); - iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6)); - size_offset = (int_least8_t)(word1 & 0xFF); - data_offset = word2; - iter->data_size = (pb_size_t)word3; - break; - } - - default: { - /* 8-word format */ - uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]); - uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]); - uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]); - uint32_t word4 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 4]); - - iter->array_size = (pb_size_t)word4; - iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6)); - size_offset = (int_least8_t)(word1 & 0xFF); - data_offset = word2; - iter->data_size = (pb_size_t)word3; - break; - } - } - - if (!iter->message) - { - /* Avoid doing arithmetic on null pointers, it is undefined */ - iter->pField = NULL; - iter->pSize = NULL; - } - else - { - iter->pField = (char*)iter->message + data_offset; - - if (size_offset) - { - iter->pSize = (char*)iter->pField - size_offset; - } - else if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED && - (PB_ATYPE(iter->type) == PB_ATYPE_STATIC || - PB_ATYPE(iter->type) == PB_ATYPE_POINTER)) - { - /* Fixed count array */ - iter->pSize = &iter->array_size; - } - else - { - iter->pSize = NULL; - } - - if (PB_ATYPE(iter->type) == PB_ATYPE_POINTER && iter->pField != NULL) - { - iter->pData = *(void**)iter->pField; - } - else - { - iter->pData = iter->pField; - } - } - - if (PB_LTYPE_IS_SUBMSG(iter->type)) - { - iter->submsg_desc = iter->descriptor->submsg_info[iter->submessage_index]; - } - else - { - iter->submsg_desc = NULL; - } - - return true; -} - -static void advance_iterator(pb_field_iter_t *iter) -{ - iter->index++; - - if (iter->index >= iter->descriptor->field_count) - { - /* Restart */ - iter->index = 0; - iter->field_info_index = 0; - iter->submessage_index = 0; - iter->required_field_index = 0; - } - else - { - /* Increment indexes based on previous field type. - * All field info formats have the following fields: - * - lowest 2 bits tell the amount of words in the descriptor (2^n words) - * - bits 2..7 give the lowest bits of tag number. - * - bits 8..15 give the field type. - */ - uint32_t prev_descriptor = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]); - pb_type_t prev_type = (prev_descriptor >> 8) & 0xFF; - pb_size_t descriptor_len = (pb_size_t)(1 << (prev_descriptor & 3)); - - /* Add to fields. - * The cast to pb_size_t is needed to avoid -Wconversion warning. - * Because the data is is constants from generator, there is no danger of overflow. - */ - iter->field_info_index = (pb_size_t)(iter->field_info_index + descriptor_len); - iter->required_field_index = (pb_size_t)(iter->required_field_index + (PB_HTYPE(prev_type) == PB_HTYPE_REQUIRED)); - iter->submessage_index = (pb_size_t)(iter->submessage_index + PB_LTYPE_IS_SUBMSG(prev_type)); - } -} - -bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message) -{ - memset(iter, 0, sizeof(*iter)); - - iter->descriptor = desc; - iter->message = message; - - return load_descriptor_values(iter); -} - -bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension) -{ - const pb_msgdesc_t *msg = (const pb_msgdesc_t*)extension->type->arg; - bool status; - - uint32_t word0 = PB_PROGMEM_READU32(msg->field_info[0]); - if (PB_ATYPE(word0 >> 8) == PB_ATYPE_POINTER) - { - /* For pointer extensions, the pointer is stored directly - * in the extension structure. This avoids having an extra - * indirection. */ - status = pb_field_iter_begin(iter, msg, &extension->dest); - } - else - { - status = pb_field_iter_begin(iter, msg, extension->dest); - } - - iter->pSize = &extension->found; - return status; -} - -bool pb_field_iter_next(pb_field_iter_t *iter) -{ - advance_iterator(iter); - (void)load_descriptor_values(iter); - return iter->index != 0; -} - -bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag) -{ - if (iter->tag == tag) - { - return true; /* Nothing to do, correct field already. */ - } - else if (tag > iter->descriptor->largest_tag) - { - return false; - } - else - { - pb_size_t start = iter->index; - uint32_t fieldinfo; - - if (tag < iter->tag) - { - /* Fields are in tag number order, so we know that tag is between - * 0 and our start position. Setting index to end forces - * advance_iterator() call below to restart from beginning. */ - iter->index = iter->descriptor->field_count; - } - - do - { - /* Advance iterator but don't load values yet */ - advance_iterator(iter); - - /* Do fast check for tag number match */ - fieldinfo = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]); - - if (((fieldinfo >> 2) & 0x3F) == (tag & 0x3F)) - { - /* Good candidate, check further */ - (void)load_descriptor_values(iter); - - if (iter->tag == tag && - PB_LTYPE(iter->type) != PB_LTYPE_EXTENSION) - { - /* Found it */ - return true; - } - } - } while (iter->index != start); - - /* Searched all the way back to start, and found nothing. */ - (void)load_descriptor_values(iter); - return false; - } -} - -bool pb_field_iter_find_extension(pb_field_iter_t *iter) -{ - if (PB_LTYPE(iter->type) == PB_LTYPE_EXTENSION) - { - return true; - } - else - { - pb_size_t start = iter->index; - uint32_t fieldinfo; - - do - { - /* Advance iterator but don't load values yet */ - advance_iterator(iter); - - /* Do fast check for field type */ - fieldinfo = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]); - - if (PB_LTYPE((fieldinfo >> 8) & 0xFF) == PB_LTYPE_EXTENSION) - { - return load_descriptor_values(iter); - } - } while (iter->index != start); - - /* Searched all the way back to start, and found nothing. */ - (void)load_descriptor_values(iter); - return false; - } -} - -static void *pb_const_cast(const void *p) -{ - /* Note: this casts away const, in order to use the common field iterator - * logic for both encoding and decoding. The cast is done using union - * to avoid spurious compiler warnings. */ - union { - void *p1; - const void *p2; - } t; - t.p2 = p; - return t.p1; -} - -bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message) -{ - return pb_field_iter_begin(iter, desc, pb_const_cast(message)); -} - -bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension) -{ - return pb_field_iter_begin_extension(iter, (pb_extension_t*)pb_const_cast(extension)); -} - -bool pb_default_field_callback(pb_istream_t *istream, pb_ostream_t *ostream, const pb_field_t *field) -{ - if (field->data_size == sizeof(pb_callback_t)) - { - pb_callback_t *pCallback = (pb_callback_t*)field->pData; - - if (pCallback != NULL) - { - if (istream != NULL && pCallback->funcs.decode != NULL) - { - return pCallback->funcs.decode(istream, field, &pCallback->arg); - } - - if (ostream != NULL && pCallback->funcs.encode != NULL) - { - return pCallback->funcs.encode(ostream, field, &pCallback->arg); - } - } - } - - return true; /* Success, but didn't do anything */ - -} - -#ifdef PB_VALIDATE_UTF8 - -/* This function checks whether a string is valid UTF-8 text. - * - * Algorithm is adapted from https://www.cl.cam.ac.uk/~mgk25/ucs/utf8_check.c - * Original copyright: Markus Kuhn 2005-03-30 - * Licensed under "Short code license", which allows use under MIT license or - * any compatible with it. - */ - -bool pb_validate_utf8(const char *str) -{ - const pb_byte_t *s = (const pb_byte_t*)str; - while (*s) - { - if (*s < 0x80) - { - /* 0xxxxxxx */ - s++; - } - else if ((s[0] & 0xe0) == 0xc0) - { - /* 110XXXXx 10xxxxxx */ - if ((s[1] & 0xc0) != 0x80 || - (s[0] & 0xfe) == 0xc0) /* overlong? */ - return false; - else - s += 2; - } - else if ((s[0] & 0xf0) == 0xe0) - { - /* 1110XXXX 10Xxxxxx 10xxxxxx */ - if ((s[1] & 0xc0) != 0x80 || - (s[2] & 0xc0) != 0x80 || - (s[0] == 0xe0 && (s[1] & 0xe0) == 0x80) || /* overlong? */ - (s[0] == 0xed && (s[1] & 0xe0) == 0xa0) || /* surrogate? */ - (s[0] == 0xef && s[1] == 0xbf && - (s[2] & 0xfe) == 0xbe)) /* U+FFFE or U+FFFF? */ - return false; - else - s += 3; - } - else if ((s[0] & 0xf8) == 0xf0) - { - /* 11110XXX 10XXxxxx 10xxxxxx 10xxxxxx */ - if ((s[1] & 0xc0) != 0x80 || - (s[2] & 0xc0) != 0x80 || - (s[3] & 0xc0) != 0x80 || - (s[0] == 0xf0 && (s[1] & 0xf0) == 0x80) || /* overlong? */ - (s[0] == 0xf4 && s[1] > 0x8f) || s[0] > 0xf4) /* > U+10FFFF? */ - return false; - else - s += 4; - } - else - { - return false; - } - } - - return true; -} - -#endif - diff --git a/src/network/pb_common.h b/src/network/pb_common.h deleted file mode 100644 index 58aa90f76d5..00000000000 --- a/src/network/pb_common.h +++ /dev/null @@ -1,49 +0,0 @@ -/* pb_common.h: Common support functions for pb_encode.c and pb_decode.c. - * These functions are rarely needed by applications directly. - */ - -#ifndef PB_COMMON_H_INCLUDED -#define PB_COMMON_H_INCLUDED - -#include "pb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Initialize the field iterator structure to beginning. - * Returns false if the message type is empty. */ -bool pb_field_iter_begin(pb_field_iter_t *iter, const pb_msgdesc_t *desc, void *message); - -/* Get a field iterator for extension field. */ -bool pb_field_iter_begin_extension(pb_field_iter_t *iter, pb_extension_t *extension); - -/* Same as pb_field_iter_begin(), but for const message pointer. - * Note that the pointers in pb_field_iter_t will be non-const but shouldn't - * be written to when using these functions. */ -bool pb_field_iter_begin_const(pb_field_iter_t *iter, const pb_msgdesc_t *desc, const void *message); -bool pb_field_iter_begin_extension_const(pb_field_iter_t *iter, const pb_extension_t *extension); - -/* Advance the iterator to the next field. - * Returns false when the iterator wraps back to the first field. */ -bool pb_field_iter_next(pb_field_iter_t *iter); - -/* Advance the iterator until it points at a field with the given tag. - * Returns false if no such field exists. */ -bool pb_field_iter_find(pb_field_iter_t *iter, uint32_t tag); - -/* Find a field with type PB_LTYPE_EXTENSION, or return false if not found. - * There can be only one extension range field per message. */ -bool pb_field_iter_find_extension(pb_field_iter_t *iter); - -#ifdef PB_VALIDATE_UTF8 -/* Validate UTF-8 text string */ -bool pb_validate_utf8(const char *s); -#endif - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif - diff --git a/src/network/pb_decode.c b/src/network/pb_decode.c deleted file mode 100644 index 788998eb962..00000000000 --- a/src/network/pb_decode.c +++ /dev/null @@ -1,1727 +0,0 @@ -/* pb_decode.c -- decode a protobuf using minimal resources - * - * 2011 Petteri Aimonen - */ - -/* Use the GCC warn_unused_result attribute to check that all return values - * are propagated correctly. On other compilers and gcc before 3.4.0 just - * ignore the annotation. - */ -#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) - #define checkreturn -#else - #define checkreturn __attribute__((warn_unused_result)) -#endif - -#include "pb.h" -#include "pb_decode.h" -#include "pb_common.h" - -/************************************** - * Declarations internal to this file * - **************************************/ - -static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); -static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *dest, bool *eof); -static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size); -static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field); -static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field); -static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field); -static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field); -static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field); -static bool checkreturn default_extension_decoder(pb_istream_t *stream, pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type); -static bool checkreturn decode_extension(pb_istream_t *stream, uint32_t tag, pb_wire_type_t wire_type, pb_extension_t *extension); -static bool pb_field_set_to_default(pb_field_iter_t *field); -static bool pb_message_set_to_defaults(pb_field_iter_t *iter); -static bool checkreturn pb_dec_bool(pb_istream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_dec_fixed_length_bytes(pb_istream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_skip_varint(pb_istream_t *stream); -static bool checkreturn pb_skip_string(pb_istream_t *stream); - -#ifdef PB_ENABLE_MALLOC -static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size); -static void initialize_pointer_field(void *pItem, pb_field_iter_t *field); -static bool checkreturn pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *field); -static void pb_release_single_field(pb_field_iter_t *field); -#endif - -#ifdef PB_WITHOUT_64BIT -#define pb_int64_t int32_t -#define pb_uint64_t uint32_t -#else -#define pb_int64_t int64_t -#define pb_uint64_t uint64_t -#endif - -typedef struct { - uint32_t bitfield[(PB_MAX_REQUIRED_FIELDS + 31) / 32]; -} pb_fields_seen_t; - -/******************************* - * pb_istream_t implementation * - *******************************/ - -static bool checkreturn buf_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) -{ - const pb_byte_t *source = (const pb_byte_t*)stream->state; - stream->state = (pb_byte_t*)stream->state + count; - - if (buf != NULL) - { - memcpy(buf, source, count * sizeof(pb_byte_t)); - } - - return true; -} - -bool checkreturn pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count) -{ - if (count == 0) - return true; - -#ifndef PB_BUFFER_ONLY - if (buf == NULL && stream->callback != buf_read) - { - /* Skip input bytes */ - pb_byte_t tmp[16]; - while (count > 16) - { - if (!pb_read(stream, tmp, 16)) - return false; - - count -= 16; - } - - return pb_read(stream, tmp, count); - } -#endif - - if (stream->bytes_left < count) - PB_RETURN_ERROR(stream, "end-of-stream"); - -#ifndef PB_BUFFER_ONLY - if (!stream->callback(stream, buf, count)) - PB_RETURN_ERROR(stream, "io error"); -#else - if (!buf_read(stream, buf, count)) - return false; -#endif - - if (stream->bytes_left < count) - stream->bytes_left = 0; - else - stream->bytes_left -= count; - - return true; -} - -/* Read a single byte from input stream. buf may not be NULL. - * This is an optimization for the varint decoding. */ -static bool checkreturn pb_readbyte(pb_istream_t *stream, pb_byte_t *buf) -{ - if (stream->bytes_left == 0) - PB_RETURN_ERROR(stream, "end-of-stream"); - -#ifndef PB_BUFFER_ONLY - if (!stream->callback(stream, buf, 1)) - PB_RETURN_ERROR(stream, "io error"); -#else - *buf = *(const pb_byte_t*)stream->state; - stream->state = (pb_byte_t*)stream->state + 1; -#endif - - stream->bytes_left--; - - return true; -} - -pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen) -{ - pb_istream_t stream; - /* Cast away the const from buf without a compiler error. We are - * careful to use it only in a const manner in the callbacks. - */ - union { - void *state; - const void *c_state; - } state; -#ifdef PB_BUFFER_ONLY - stream.callback = NULL; -#else - stream.callback = &buf_read; -#endif - state.c_state = buf; - stream.state = state.state; - stream.bytes_left = msglen; -#ifndef PB_NO_ERRMSG - stream.errmsg = NULL; -#endif - return stream; -} - -/******************** - * Helper functions * - ********************/ - -static bool checkreturn pb_decode_varint32_eof(pb_istream_t *stream, uint32_t *dest, bool *eof) -{ - pb_byte_t byte; - uint32_t result; - - if (!pb_readbyte(stream, &byte)) - { - if (stream->bytes_left == 0) - { - if (eof) - { - *eof = true; - } - } - - return false; - } - - if ((byte & 0x80) == 0) - { - /* Quick case, 1 byte value */ - result = byte; - } - else - { - /* Multibyte case */ - uint_fast8_t bitpos = 7; - result = byte & 0x7F; - - do - { - if (!pb_readbyte(stream, &byte)) - return false; - - if (bitpos >= 32) - { - /* Note: The varint could have trailing 0x80 bytes, or 0xFF for negative. */ - pb_byte_t sign_extension = (bitpos < 63) ? 0xFF : 0x01; - bool valid_extension = ((byte & 0x7F) == 0x00 || - ((result >> 31) != 0 && byte == sign_extension)); - - if (bitpos >= 64 || !valid_extension) - { - PB_RETURN_ERROR(stream, "varint overflow"); - } - } - else if (bitpos == 28) - { - if ((byte & 0x70) != 0 && (byte & 0x78) != 0x78) - { - PB_RETURN_ERROR(stream, "varint overflow"); - } - result |= (uint32_t)(byte & 0x0F) << bitpos; - } - else - { - result |= (uint32_t)(byte & 0x7F) << bitpos; - } - bitpos = (uint_fast8_t)(bitpos + 7); - } while (byte & 0x80); - } - - *dest = result; - return true; -} - -bool checkreturn pb_decode_varint32(pb_istream_t *stream, uint32_t *dest) -{ - return pb_decode_varint32_eof(stream, dest, NULL); -} - -#ifndef PB_WITHOUT_64BIT -bool checkreturn pb_decode_varint(pb_istream_t *stream, uint64_t *dest) -{ - pb_byte_t byte; - uint_fast8_t bitpos = 0; - uint64_t result = 0; - - do - { - if (!pb_readbyte(stream, &byte)) - return false; - - if (bitpos >= 63 && (byte & 0xFE) != 0) - PB_RETURN_ERROR(stream, "varint overflow"); - - result |= (uint64_t)(byte & 0x7F) << bitpos; - bitpos = (uint_fast8_t)(bitpos + 7); - } while (byte & 0x80); - - *dest = result; - return true; -} -#endif - -bool checkreturn pb_skip_varint(pb_istream_t *stream) -{ - pb_byte_t byte; - do - { - if (!pb_read(stream, &byte, 1)) - return false; - } while (byte & 0x80); - return true; -} - -bool checkreturn pb_skip_string(pb_istream_t *stream) -{ - uint32_t length; - if (!pb_decode_varint32(stream, &length)) - return false; - - if ((size_t)length != length) - { - PB_RETURN_ERROR(stream, "size too large"); - } - - return pb_read(stream, NULL, (size_t)length); -} - -bool checkreturn pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof) -{ - uint32_t temp; - *eof = false; - *wire_type = (pb_wire_type_t) 0; - *tag = 0; - - if (!pb_decode_varint32_eof(stream, &temp, eof)) - { - return false; - } - - *tag = temp >> 3; - *wire_type = (pb_wire_type_t)(temp & 7); - return true; -} - -bool checkreturn pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type) -{ - switch (wire_type) - { - case PB_WT_VARINT: return pb_skip_varint(stream); - case PB_WT_64BIT: return pb_read(stream, NULL, 8); - case PB_WT_STRING: return pb_skip_string(stream); - case PB_WT_32BIT: return pb_read(stream, NULL, 4); - default: PB_RETURN_ERROR(stream, "invalid wire_type"); - } -} - -/* Read a raw value to buffer, for the purpose of passing it to callback as - * a substream. Size is maximum size on call, and actual size on return. - */ -static bool checkreturn read_raw_value(pb_istream_t *stream, pb_wire_type_t wire_type, pb_byte_t *buf, size_t *size) -{ - size_t max_size = *size; - switch (wire_type) - { - case PB_WT_VARINT: - *size = 0; - do - { - (*size)++; - if (*size > max_size) - PB_RETURN_ERROR(stream, "varint overflow"); - - if (!pb_read(stream, buf, 1)) - return false; - } while (*buf++ & 0x80); - return true; - - case PB_WT_64BIT: - *size = 8; - return pb_read(stream, buf, 8); - - case PB_WT_32BIT: - *size = 4; - return pb_read(stream, buf, 4); - - case PB_WT_STRING: - /* Calling read_raw_value with a PB_WT_STRING is an error. - * Explicitly handle this case and fallthrough to default to avoid - * compiler warnings. - */ - - default: PB_RETURN_ERROR(stream, "invalid wire_type"); - } -} - -/* Decode string length from stream and return a substream with limited length. - * Remember to close the substream using pb_close_string_substream(). - */ -bool checkreturn pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream) -{ - uint32_t size; - if (!pb_decode_varint32(stream, &size)) - return false; - - *substream = *stream; - if (substream->bytes_left < size) - PB_RETURN_ERROR(stream, "parent stream too short"); - - substream->bytes_left = (size_t)size; - stream->bytes_left -= (size_t)size; - return true; -} - -bool checkreturn pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream) -{ - if (substream->bytes_left) { - if (!pb_read(substream, NULL, substream->bytes_left)) - return false; - } - - stream->state = substream->state; - -#ifndef PB_NO_ERRMSG - stream->errmsg = substream->errmsg; -#endif - return true; -} - -/************************* - * Decode a single field * - *************************/ - -static bool checkreturn decode_basic_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field) -{ - switch (PB_LTYPE(field->type)) - { - case PB_LTYPE_BOOL: - if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_dec_bool(stream, field); - - case PB_LTYPE_VARINT: - case PB_LTYPE_UVARINT: - case PB_LTYPE_SVARINT: - if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_dec_varint(stream, field); - - case PB_LTYPE_FIXED32: - if (wire_type != PB_WT_32BIT && wire_type != PB_WT_PACKED) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_decode_fixed32(stream, field->pData); - - case PB_LTYPE_FIXED64: - if (wire_type != PB_WT_64BIT && wire_type != PB_WT_PACKED) - PB_RETURN_ERROR(stream, "wrong wire type"); - -#ifdef PB_CONVERT_DOUBLE_FLOAT - if (field->data_size == sizeof(float)) - { - return pb_decode_double_as_float(stream, (float*)field->pData); - } -#endif - -#ifdef PB_WITHOUT_64BIT - PB_RETURN_ERROR(stream, "invalid data_size"); -#else - return pb_decode_fixed64(stream, field->pData); -#endif - - case PB_LTYPE_BYTES: - if (wire_type != PB_WT_STRING) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_dec_bytes(stream, field); - - case PB_LTYPE_STRING: - if (wire_type != PB_WT_STRING) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_dec_string(stream, field); - - case PB_LTYPE_SUBMESSAGE: - case PB_LTYPE_SUBMSG_W_CB: - if (wire_type != PB_WT_STRING) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_dec_submessage(stream, field); - - case PB_LTYPE_FIXED_LENGTH_BYTES: - if (wire_type != PB_WT_STRING) - PB_RETURN_ERROR(stream, "wrong wire type"); - - return pb_dec_fixed_length_bytes(stream, field); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -static bool checkreturn decode_static_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field) -{ - switch (PB_HTYPE(field->type)) - { - case PB_HTYPE_REQUIRED: - return decode_basic_field(stream, wire_type, field); - - case PB_HTYPE_OPTIONAL: - if (field->pSize != NULL) - *(bool*)field->pSize = true; - return decode_basic_field(stream, wire_type, field); - - case PB_HTYPE_REPEATED: - if (wire_type == PB_WT_STRING - && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE) - { - /* Packed array */ - bool status = true; - pb_istream_t substream; - pb_size_t *size = (pb_size_t*)field->pSize; - field->pData = (char*)field->pField + field->data_size * (*size); - - if (!pb_make_string_substream(stream, &substream)) - return false; - - while (substream.bytes_left > 0 && *size < field->array_size) - { - if (!decode_basic_field(&substream, PB_WT_PACKED, field)) - { - status = false; - break; - } - (*size)++; - field->pData = (char*)field->pData + field->data_size; - } - - if (substream.bytes_left != 0) - PB_RETURN_ERROR(stream, "array overflow"); - if (!pb_close_string_substream(stream, &substream)) - return false; - - return status; - } - else - { - /* Repeated field */ - pb_size_t *size = (pb_size_t*)field->pSize; - field->pData = (char*)field->pField + field->data_size * (*size); - - if ((*size)++ >= field->array_size) - PB_RETURN_ERROR(stream, "array overflow"); - - return decode_basic_field(stream, wire_type, field); - } - - case PB_HTYPE_ONEOF: - if (PB_LTYPE_IS_SUBMSG(field->type) && - *(pb_size_t*)field->pSize != field->tag) - { - /* We memset to zero so that any callbacks are set to NULL. - * This is because the callbacks might otherwise have values - * from some other union field. - * If callbacks are needed inside oneof field, use .proto - * option submsg_callback to have a separate callback function - * that can set the fields before submessage is decoded. - * pb_dec_submessage() will set any default values. */ - memset(field->pData, 0, (size_t)field->data_size); - - /* Set default values for the submessage fields. */ - if (field->submsg_desc->default_value != NULL || - field->submsg_desc->field_callback != NULL || - field->submsg_desc->submsg_info[0] != NULL) - { - pb_field_iter_t submsg_iter; - if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData)) - { - if (!pb_message_set_to_defaults(&submsg_iter)) - PB_RETURN_ERROR(stream, "failed to set defaults"); - } - } - } - *(pb_size_t*)field->pSize = field->tag; - - return decode_basic_field(stream, wire_type, field); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -#ifdef PB_ENABLE_MALLOC -/* Allocate storage for the field and store the pointer at iter->pData. - * array_size is the number of entries to reserve in an array. - * Zero size is not allowed, use pb_free() for releasing. - */ -static bool checkreturn allocate_field(pb_istream_t *stream, void *pData, size_t data_size, size_t array_size) -{ - void *ptr = *(void**)pData; - - if (data_size == 0 || array_size == 0) - PB_RETURN_ERROR(stream, "invalid size"); - -#ifdef __AVR__ - /* Workaround for AVR libc bug 53284: http://savannah.nongnu.org/bugs/?53284 - * Realloc to size of 1 byte can cause corruption of the malloc structures. - */ - if (data_size == 1 && array_size == 1) - { - data_size = 2; - } -#endif - - /* Check for multiplication overflows. - * This code avoids the costly division if the sizes are small enough. - * Multiplication is safe as long as only half of bits are set - * in either multiplicand. - */ - { - const size_t check_limit = (size_t)1 << (sizeof(size_t) * 4); - if (data_size >= check_limit || array_size >= check_limit) - { - const size_t size_max = (size_t)-1; - if (size_max / array_size < data_size) - { - PB_RETURN_ERROR(stream, "size too large"); - } - } - } - - /* Allocate new or expand previous allocation */ - /* Note: on failure the old pointer will remain in the structure, - * the message must be freed by caller also on error return. */ - ptr = pb_realloc(ptr, array_size * data_size); - if (ptr == NULL) - PB_RETURN_ERROR(stream, "realloc failed"); - - *(void**)pData = ptr; - return true; -} - -/* Clear a newly allocated item in case it contains a pointer, or is a submessage. */ -static void initialize_pointer_field(void *pItem, pb_field_iter_t *field) -{ - if (PB_LTYPE(field->type) == PB_LTYPE_STRING || - PB_LTYPE(field->type) == PB_LTYPE_BYTES) - { - *(void**)pItem = NULL; - } - else if (PB_LTYPE_IS_SUBMSG(field->type)) - { - /* We memset to zero so that any callbacks are set to NULL. - * Default values will be set by pb_dec_submessage(). */ - memset(pItem, 0, field->data_size); - } -} -#endif - -static bool checkreturn decode_pointer_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field) -{ -#ifndef PB_ENABLE_MALLOC - PB_UNUSED(wire_type); - PB_UNUSED(field); - PB_RETURN_ERROR(stream, "no malloc support"); -#else - switch (PB_HTYPE(field->type)) - { - case PB_HTYPE_REQUIRED: - case PB_HTYPE_OPTIONAL: - case PB_HTYPE_ONEOF: - if (PB_LTYPE_IS_SUBMSG(field->type) && *(void**)field->pField != NULL) - { - /* Duplicate field, have to release the old allocation first. */ - /* FIXME: Does this work correctly for oneofs? */ - pb_release_single_field(field); - } - - if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF) - { - *(pb_size_t*)field->pSize = field->tag; - } - - if (PB_LTYPE(field->type) == PB_LTYPE_STRING || - PB_LTYPE(field->type) == PB_LTYPE_BYTES) - { - /* pb_dec_string and pb_dec_bytes handle allocation themselves */ - field->pData = field->pField; - return decode_basic_field(stream, wire_type, field); - } - else - { - if (!allocate_field(stream, field->pField, field->data_size, 1)) - return false; - - field->pData = *(void**)field->pField; - initialize_pointer_field(field->pData, field); - return decode_basic_field(stream, wire_type, field); - } - - case PB_HTYPE_REPEATED: - if (wire_type == PB_WT_STRING - && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE) - { - /* Packed array, multiple items come in at once. */ - bool status = true; - pb_size_t *size = (pb_size_t*)field->pSize; - size_t allocated_size = *size; - pb_istream_t substream; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - while (substream.bytes_left) - { - if (*size == PB_SIZE_MAX) - { -#ifndef PB_NO_ERRMSG - stream->errmsg = "too many array entries"; -#endif - status = false; - break; - } - - if ((size_t)*size + 1 > allocated_size) - { - /* Allocate more storage. This tries to guess the - * number of remaining entries. Round the division - * upwards. */ - size_t remain = (substream.bytes_left - 1) / field->data_size + 1; - if (remain < PB_SIZE_MAX - allocated_size) - allocated_size += remain; - else - allocated_size += 1; - - if (!allocate_field(&substream, field->pField, field->data_size, allocated_size)) - { - status = false; - break; - } - } - - /* Decode the array entry */ - field->pData = *(char**)field->pField + field->data_size * (*size); - if (field->pData == NULL) - { - /* Shouldn't happen, but satisfies static analyzers */ - status = false; - break; - } - initialize_pointer_field(field->pData, field); - if (!decode_basic_field(&substream, PB_WT_PACKED, field)) - { - status = false; - break; - } - - (*size)++; - } - if (!pb_close_string_substream(stream, &substream)) - return false; - - return status; - } - else - { - /* Normal repeated field, i.e. only one item at a time. */ - pb_size_t *size = (pb_size_t*)field->pSize; - - if (*size == PB_SIZE_MAX) - PB_RETURN_ERROR(stream, "too many array entries"); - - if (!allocate_field(stream, field->pField, field->data_size, (size_t)(*size + 1))) - return false; - - field->pData = *(char**)field->pField + field->data_size * (*size); - (*size)++; - initialize_pointer_field(field->pData, field); - return decode_basic_field(stream, wire_type, field); - } - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -#endif -} - -static bool checkreturn decode_callback_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field) -{ - if (!field->descriptor->field_callback) - return pb_skip_field(stream, wire_type); - - if (wire_type == PB_WT_STRING) - { - pb_istream_t substream; - size_t prev_bytes_left; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - do - { - prev_bytes_left = substream.bytes_left; - if (!field->descriptor->field_callback(&substream, NULL, field)) - { - PB_SET_ERROR(stream, substream.errmsg ? substream.errmsg : "callback failed"); - return false; - } - } while (substream.bytes_left > 0 && substream.bytes_left < prev_bytes_left); - - if (!pb_close_string_substream(stream, &substream)) - return false; - - return true; - } - else - { - /* Copy the single scalar value to stack. - * This is required so that we can limit the stream length, - * which in turn allows to use same callback for packed and - * not-packed fields. */ - pb_istream_t substream; - pb_byte_t buffer[10]; - size_t size = sizeof(buffer); - - if (!read_raw_value(stream, wire_type, buffer, &size)) - return false; - substream = pb_istream_from_buffer(buffer, size); - - return field->descriptor->field_callback(&substream, NULL, field); - } -} - -static bool checkreturn decode_field(pb_istream_t *stream, pb_wire_type_t wire_type, pb_field_iter_t *field) -{ -#ifdef PB_ENABLE_MALLOC - /* When decoding an oneof field, check if there is old data that must be - * released first. */ - if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF) - { - if (!pb_release_union_field(stream, field)) - return false; - } -#endif - - switch (PB_ATYPE(field->type)) - { - case PB_ATYPE_STATIC: - return decode_static_field(stream, wire_type, field); - - case PB_ATYPE_POINTER: - return decode_pointer_field(stream, wire_type, field); - - case PB_ATYPE_CALLBACK: - return decode_callback_field(stream, wire_type, field); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -/* Default handler for extension fields. Expects to have a pb_msgdesc_t - * pointer in the extension->type->arg field, pointing to a message with - * only one field in it. */ -static bool checkreturn default_extension_decoder(pb_istream_t *stream, - pb_extension_t *extension, uint32_t tag, pb_wire_type_t wire_type) -{ - pb_field_iter_t iter; - - if (!pb_field_iter_begin_extension(&iter, extension)) - PB_RETURN_ERROR(stream, "invalid extension"); - - if (iter.tag != tag || !iter.message) - return true; - - extension->found = true; - return decode_field(stream, wire_type, &iter); -} - -/* Try to decode an unknown field as an extension field. Tries each extension - * decoder in turn, until one of them handles the field or loop ends. */ -static bool checkreturn decode_extension(pb_istream_t *stream, - uint32_t tag, pb_wire_type_t wire_type, pb_extension_t *extension) -{ - size_t pos = stream->bytes_left; - - while (extension != NULL && pos == stream->bytes_left) - { - bool status; - if (extension->type->decode) - status = extension->type->decode(stream, extension, tag, wire_type); - else - status = default_extension_decoder(stream, extension, tag, wire_type); - - if (!status) - return false; - - extension = extension->next; - } - - return true; -} - -/* Initialize message fields to default values, recursively */ -static bool pb_field_set_to_default(pb_field_iter_t *field) -{ - pb_type_t type; - type = field->type; - - if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) - { - pb_extension_t *ext = *(pb_extension_t* const *)field->pData; - while (ext != NULL) - { - pb_field_iter_t ext_iter; - if (pb_field_iter_begin_extension(&ext_iter, ext)) - { - ext->found = false; - if (!pb_message_set_to_defaults(&ext_iter)) - return false; - } - ext = ext->next; - } - } - else if (PB_ATYPE(type) == PB_ATYPE_STATIC) - { - bool init_data = true; - if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && field->pSize != NULL) - { - /* Set has_field to false. Still initialize the optional field - * itself also. */ - *(bool*)field->pSize = false; - } - else if (PB_HTYPE(type) == PB_HTYPE_REPEATED || - PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - /* REPEATED: Set array count to 0, no need to initialize contents. - ONEOF: Set which_field to 0. */ - *(pb_size_t*)field->pSize = 0; - init_data = false; - } - - if (init_data) - { - if (PB_LTYPE_IS_SUBMSG(field->type) && - (field->submsg_desc->default_value != NULL || - field->submsg_desc->field_callback != NULL || - field->submsg_desc->submsg_info[0] != NULL)) - { - /* Initialize submessage to defaults. - * Only needed if it has default values - * or callback/submessage fields. */ - pb_field_iter_t submsg_iter; - if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData)) - { - if (!pb_message_set_to_defaults(&submsg_iter)) - return false; - } - } - else - { - /* Initialize to zeros */ - memset(field->pData, 0, (size_t)field->data_size); - } - } - } - else if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - /* Initialize the pointer to NULL. */ - *(void**)field->pField = NULL; - - /* Initialize array count to 0. */ - if (PB_HTYPE(type) == PB_HTYPE_REPEATED || - PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - *(pb_size_t*)field->pSize = 0; - } - } - else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK) - { - /* Don't overwrite callback */ - } - - return true; -} - -static bool pb_message_set_to_defaults(pb_field_iter_t *iter) -{ - pb_istream_t defstream = PB_ISTREAM_EMPTY; - uint32_t tag = 0; - pb_wire_type_t wire_type = PB_WT_VARINT; - bool eof; - - if (iter->descriptor->default_value) - { - defstream = pb_istream_from_buffer(iter->descriptor->default_value, (size_t)-1); - if (!pb_decode_tag(&defstream, &wire_type, &tag, &eof)) - return false; - } - - do - { - if (!pb_field_set_to_default(iter)) - return false; - - if (tag != 0 && iter->tag == tag) - { - /* We have a default value for this field in the defstream */ - if (!decode_field(&defstream, wire_type, iter)) - return false; - if (!pb_decode_tag(&defstream, &wire_type, &tag, &eof)) - return false; - - if (iter->pSize) - *(bool*)iter->pSize = false; - } - } while (pb_field_iter_next(iter)); - - return true; -} - -/********************* - * Decode all fields * - *********************/ - -static bool checkreturn pb_decode_inner(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int flags) -{ - uint32_t extension_range_start = 0; - pb_extension_t *extensions = NULL; - - /* 'fixed_count_field' and 'fixed_count_size' track position of a repeated fixed - * count field. This can only handle _one_ repeated fixed count field that - * is unpacked and unordered among other (non repeated fixed count) fields. - */ - pb_size_t fixed_count_field = PB_SIZE_MAX; - pb_size_t fixed_count_size = 0; - pb_size_t fixed_count_total_size = 0; - - pb_fields_seen_t fields_seen = {{0, 0}}; - const uint32_t allbits = ~(uint32_t)0; - pb_field_iter_t iter; - - if (pb_field_iter_begin(&iter, fields, dest_struct)) - { - if ((flags & PB_DECODE_NOINIT) == 0) - { - if (!pb_message_set_to_defaults(&iter)) - PB_RETURN_ERROR(stream, "failed to set defaults"); - } - } - - while (stream->bytes_left) - { - uint32_t tag; - pb_wire_type_t wire_type; - bool eof; - - if (!pb_decode_tag(stream, &wire_type, &tag, &eof)) - { - if (eof) - break; - else - return false; - } - - if (tag == 0) - { - if (flags & PB_DECODE_NULLTERMINATED) - { - break; - } - else - { - PB_RETURN_ERROR(stream, "zero tag"); - } - } - - if (!pb_field_iter_find(&iter, tag) || PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION) - { - /* No match found, check if it matches an extension. */ - if (extension_range_start == 0) - { - if (pb_field_iter_find_extension(&iter)) - { - extensions = *(pb_extension_t* const *)iter.pData; - extension_range_start = iter.tag; - } - - if (!extensions) - { - extension_range_start = (uint32_t)-1; - } - } - - if (tag >= extension_range_start) - { - size_t pos = stream->bytes_left; - - if (!decode_extension(stream, tag, wire_type, extensions)) - return false; - - if (pos != stream->bytes_left) - { - /* The field was handled */ - continue; - } - } - - /* No match found, skip data */ - if (!pb_skip_field(stream, wire_type)) - return false; - continue; - } - - /* If a repeated fixed count field was found, get size from - * 'fixed_count_field' as there is no counter contained in the struct. - */ - if (PB_HTYPE(iter.type) == PB_HTYPE_REPEATED && iter.pSize == &iter.array_size) - { - if (fixed_count_field != iter.index) { - /* If the new fixed count field does not match the previous one, - * check that the previous one is NULL or that it finished - * receiving all the expected data. - */ - if (fixed_count_field != PB_SIZE_MAX && - fixed_count_size != fixed_count_total_size) - { - PB_RETURN_ERROR(stream, "wrong size for fixed count field"); - } - - fixed_count_field = iter.index; - fixed_count_size = 0; - fixed_count_total_size = iter.array_size; - } - - iter.pSize = &fixed_count_size; - } - - if (PB_HTYPE(iter.type) == PB_HTYPE_REQUIRED - && iter.required_field_index < PB_MAX_REQUIRED_FIELDS) - { - uint32_t tmp = ((uint32_t)1 << (iter.required_field_index & 31)); - fields_seen.bitfield[iter.required_field_index >> 5] |= tmp; - } - - if (!decode_field(stream, wire_type, &iter)) - return false; - } - - /* Check that all elements of the last decoded fixed count field were present. */ - if (fixed_count_field != PB_SIZE_MAX && - fixed_count_size != fixed_count_total_size) - { - PB_RETURN_ERROR(stream, "wrong size for fixed count field"); - } - - /* Check that all required fields were present. */ - { - pb_size_t req_field_count = iter.descriptor->required_field_count; - - if (req_field_count > 0) - { - pb_size_t i; - - if (req_field_count > PB_MAX_REQUIRED_FIELDS) - req_field_count = PB_MAX_REQUIRED_FIELDS; - - /* Check the whole words */ - for (i = 0; i < (req_field_count >> 5); i++) - { - if (fields_seen.bitfield[i] != allbits) - PB_RETURN_ERROR(stream, "missing required field"); - } - - /* Check the remaining bits (if any) */ - if ((req_field_count & 31) != 0) - { - if (fields_seen.bitfield[req_field_count >> 5] != - (allbits >> (uint_least8_t)(32 - (req_field_count & 31)))) - { - PB_RETURN_ERROR(stream, "missing required field"); - } - } - } - } - - return true; -} - -bool checkreturn pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int flags) -{ - bool status; - - if ((flags & PB_DECODE_DELIMITED) == 0) - { - status = pb_decode_inner(stream, fields, dest_struct, flags); - } - else - { - pb_istream_t substream; - if (!pb_make_string_substream(stream, &substream)) - return false; - - status = pb_decode_inner(&substream, fields, dest_struct, flags); - - if (!pb_close_string_substream(stream, &substream)) - return false; - } - -#ifdef PB_ENABLE_MALLOC - if (!status) - pb_release(fields, dest_struct); -#endif - - return status; -} - -bool checkreturn pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct) -{ - bool status; - - status = pb_decode_inner(stream, fields, dest_struct, 0); - -#ifdef PB_ENABLE_MALLOC - if (!status) - pb_release(fields, dest_struct); -#endif - - return status; -} - -#ifdef PB_ENABLE_MALLOC -/* Given an oneof field, if there has already been a field inside this oneof, - * release it before overwriting with a different one. */ -static bool pb_release_union_field(pb_istream_t *stream, pb_field_iter_t *field) -{ - pb_field_iter_t old_field = *field; - pb_size_t old_tag = *(pb_size_t*)field->pSize; /* Previous which_ value */ - pb_size_t new_tag = field->tag; /* New which_ value */ - - if (old_tag == 0) - return true; /* Ok, no old data in union */ - - if (old_tag == new_tag) - return true; /* Ok, old data is of same type => merge */ - - /* Release old data. The find can fail if the message struct contains - * invalid data. */ - if (!pb_field_iter_find(&old_field, old_tag)) - PB_RETURN_ERROR(stream, "invalid union tag"); - - pb_release_single_field(&old_field); - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { - /* Initialize the pointer to NULL to make sure it is valid - * even in case of error return. */ - *(void**)field->pField = NULL; - field->pData = NULL; - } - - return true; -} - -static void pb_release_single_field(pb_field_iter_t *field) -{ - pb_type_t type; - type = field->type; - - if (PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - if (*(pb_size_t*)field->pSize != field->tag) - return; /* This is not the current field in the union */ - } - - /* Release anything contained inside an extension or submsg. - * This has to be done even if the submsg itself is statically - * allocated. */ - if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) - { - /* Release fields from all extensions in the linked list */ - pb_extension_t *ext = *(pb_extension_t**)field->pData; - while (ext != NULL) - { - pb_field_iter_t ext_iter; - if (pb_field_iter_begin_extension(&ext_iter, ext)) - { - pb_release_single_field(&ext_iter); - } - ext = ext->next; - } - } - else if (PB_LTYPE_IS_SUBMSG(type) && PB_ATYPE(type) != PB_ATYPE_CALLBACK) - { - /* Release fields in submessage or submsg array */ - pb_size_t count = 1; - - if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - field->pData = *(void**)field->pField; - } - else - { - field->pData = field->pField; - } - - if (PB_HTYPE(type) == PB_HTYPE_REPEATED) - { - count = *(pb_size_t*)field->pSize; - - if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > field->array_size) - { - /* Protect against corrupted _count fields */ - count = field->array_size; - } - } - - if (field->pData) - { - for (; count > 0; count--) - { - pb_release(field->submsg_desc, field->pData); - field->pData = (char*)field->pData + field->data_size; - } - } - } - - if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - if (PB_HTYPE(type) == PB_HTYPE_REPEATED && - (PB_LTYPE(type) == PB_LTYPE_STRING || - PB_LTYPE(type) == PB_LTYPE_BYTES)) - { - /* Release entries in repeated string or bytes array */ - void **pItem = *(void***)field->pField; - pb_size_t count = *(pb_size_t*)field->pSize; - for (; count > 0; count--) - { - pb_free(*pItem); - *pItem++ = NULL; - } - } - - if (PB_HTYPE(type) == PB_HTYPE_REPEATED) - { - /* We are going to release the array, so set the size to 0 */ - *(pb_size_t*)field->pSize = 0; - } - - /* Release main pointer */ - pb_free(*(void**)field->pField); - *(void**)field->pField = NULL; - } -} - -void pb_release(const pb_msgdesc_t *fields, void *dest_struct) -{ - pb_field_iter_t iter; - - if (!dest_struct) - return; /* Ignore NULL pointers, similar to free() */ - - if (!pb_field_iter_begin(&iter, fields, dest_struct)) - return; /* Empty message type */ - - do - { - pb_release_single_field(&iter); - } while (pb_field_iter_next(&iter)); -} -#else -void pb_release(const pb_msgdesc_t *fields, void *dest_struct) -{ - /* Nothing to release without PB_ENABLE_MALLOC. */ - PB_UNUSED(fields); - PB_UNUSED(dest_struct); -} -#endif - -/* Field decoders */ - -bool pb_decode_bool(pb_istream_t *stream, bool *dest) -{ - uint32_t value; - if (!pb_decode_varint32(stream, &value)) - return false; - - *(bool*)dest = (value != 0); - return true; -} - -bool pb_decode_svarint(pb_istream_t *stream, pb_int64_t *dest) -{ - pb_uint64_t value; - if (!pb_decode_varint(stream, &value)) - return false; - - if (value & 1) - *dest = (pb_int64_t)(~(value >> 1)); - else - *dest = (pb_int64_t)(value >> 1); - - return true; -} - -bool pb_decode_fixed32(pb_istream_t *stream, void *dest) -{ - union { - uint32_t fixed32; - pb_byte_t bytes[4]; - } u; - - if (!pb_read(stream, u.bytes, 4)) - return false; - -#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1 - /* fast path - if we know that we're on little endian, assign directly */ - *(uint32_t*)dest = u.fixed32; -#else - *(uint32_t*)dest = ((uint32_t)u.bytes[0] << 0) | - ((uint32_t)u.bytes[1] << 8) | - ((uint32_t)u.bytes[2] << 16) | - ((uint32_t)u.bytes[3] << 24); -#endif - return true; -} - -#ifndef PB_WITHOUT_64BIT -bool pb_decode_fixed64(pb_istream_t *stream, void *dest) -{ - union { - uint64_t fixed64; - pb_byte_t bytes[8]; - } u; - - if (!pb_read(stream, u.bytes, 8)) - return false; - -#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1 - /* fast path - if we know that we're on little endian, assign directly */ - *(uint64_t*)dest = u.fixed64; -#else - *(uint64_t*)dest = ((uint64_t)u.bytes[0] << 0) | - ((uint64_t)u.bytes[1] << 8) | - ((uint64_t)u.bytes[2] << 16) | - ((uint64_t)u.bytes[3] << 24) | - ((uint64_t)u.bytes[4] << 32) | - ((uint64_t)u.bytes[5] << 40) | - ((uint64_t)u.bytes[6] << 48) | - ((uint64_t)u.bytes[7] << 56); -#endif - return true; -} -#endif - -static bool checkreturn pb_dec_bool(pb_istream_t *stream, const pb_field_iter_t *field) -{ - return pb_decode_bool(stream, (bool*)field->pData); -} - -static bool checkreturn pb_dec_varint(pb_istream_t *stream, const pb_field_iter_t *field) -{ - if (PB_LTYPE(field->type) == PB_LTYPE_UVARINT) - { - pb_uint64_t value, clamped; - if (!pb_decode_varint(stream, &value)) - return false; - - /* Cast to the proper field size, while checking for overflows */ - if (field->data_size == sizeof(pb_uint64_t)) - clamped = *(pb_uint64_t*)field->pData = value; - else if (field->data_size == sizeof(uint32_t)) - clamped = *(uint32_t*)field->pData = (uint32_t)value; - else if (field->data_size == sizeof(uint_least16_t)) - clamped = *(uint_least16_t*)field->pData = (uint_least16_t)value; - else if (field->data_size == sizeof(uint_least8_t)) - clamped = *(uint_least8_t*)field->pData = (uint_least8_t)value; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - if (clamped != value) - PB_RETURN_ERROR(stream, "integer too large"); - - return true; - } - else - { - pb_uint64_t value; - pb_int64_t svalue; - pb_int64_t clamped; - - if (PB_LTYPE(field->type) == PB_LTYPE_SVARINT) - { - if (!pb_decode_svarint(stream, &svalue)) - return false; - } - else - { - if (!pb_decode_varint(stream, &value)) - return false; - - /* See issue 97: Google's C++ protobuf allows negative varint values to - * be cast as int32_t, instead of the int64_t that should be used when - * encoding. Nanopb versions before 0.2.5 had a bug in encoding. In order to - * not break decoding of such messages, we cast <=32 bit fields to - * int32_t first to get the sign correct. - */ - if (field->data_size == sizeof(pb_int64_t)) - svalue = (pb_int64_t)value; - else - svalue = (int32_t)value; - } - - /* Cast to the proper field size, while checking for overflows */ - if (field->data_size == sizeof(pb_int64_t)) - clamped = *(pb_int64_t*)field->pData = svalue; - else if (field->data_size == sizeof(int32_t)) - clamped = *(int32_t*)field->pData = (int32_t)svalue; - else if (field->data_size == sizeof(int_least16_t)) - clamped = *(int_least16_t*)field->pData = (int_least16_t)svalue; - else if (field->data_size == sizeof(int_least8_t)) - clamped = *(int_least8_t*)field->pData = (int_least8_t)svalue; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - if (clamped != svalue) - PB_RETURN_ERROR(stream, "integer too large"); - - return true; - } -} - -static bool checkreturn pb_dec_bytes(pb_istream_t *stream, const pb_field_iter_t *field) -{ - uint32_t size; - size_t alloc_size; - pb_bytes_array_t *dest; - - if (!pb_decode_varint32(stream, &size)) - return false; - - if (size > PB_SIZE_MAX) - PB_RETURN_ERROR(stream, "bytes overflow"); - - alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size); - if (size > alloc_size) - PB_RETURN_ERROR(stream, "size too large"); - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { -#ifndef PB_ENABLE_MALLOC - PB_RETURN_ERROR(stream, "no malloc support"); -#else - if (stream->bytes_left < size) - PB_RETURN_ERROR(stream, "end-of-stream"); - - if (!allocate_field(stream, field->pData, alloc_size, 1)) - return false; - dest = *(pb_bytes_array_t**)field->pData; -#endif - } - else - { - if (alloc_size > field->data_size) - PB_RETURN_ERROR(stream, "bytes overflow"); - dest = (pb_bytes_array_t*)field->pData; - } - - dest->size = (pb_size_t)size; - return pb_read(stream, dest->bytes, (size_t)size); -} - -static bool checkreturn pb_dec_string(pb_istream_t *stream, const pb_field_iter_t *field) -{ - uint32_t size; - size_t alloc_size; - pb_byte_t *dest = (pb_byte_t*)field->pData; - - if (!pb_decode_varint32(stream, &size)) - return false; - - if (size == (uint32_t)-1) - PB_RETURN_ERROR(stream, "size too large"); - - /* Space for null terminator */ - alloc_size = (size_t)(size + 1); - - if (alloc_size < size) - PB_RETURN_ERROR(stream, "size too large"); - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { -#ifndef PB_ENABLE_MALLOC - PB_RETURN_ERROR(stream, "no malloc support"); -#else - if (stream->bytes_left < size) - PB_RETURN_ERROR(stream, "end-of-stream"); - - if (!allocate_field(stream, field->pData, alloc_size, 1)) - return false; - dest = *(pb_byte_t**)field->pData; -#endif - } - else - { - if (alloc_size > field->data_size) - PB_RETURN_ERROR(stream, "string overflow"); - } - - dest[size] = 0; - - if (!pb_read(stream, dest, (size_t)size)) - return false; - -#ifdef PB_VALIDATE_UTF8 - if (!pb_validate_utf8((const char*)dest)) - PB_RETURN_ERROR(stream, "invalid utf8"); -#endif - - return true; -} - -static bool checkreturn pb_dec_submessage(pb_istream_t *stream, const pb_field_iter_t *field) -{ - bool status = true; - bool submsg_consumed = false; - pb_istream_t substream; - - if (!pb_make_string_substream(stream, &substream)) - return false; - - if (field->submsg_desc == NULL) - PB_RETURN_ERROR(stream, "invalid field descriptor"); - - /* Submessages can have a separate message-level callback that is called - * before decoding the message. Typically it is used to set callback fields - * inside oneofs. */ - if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL) - { - /* Message callback is stored right before pSize. */ - pb_callback_t *callback = (pb_callback_t*)field->pSize - 1; - if (callback->funcs.decode) - { - status = callback->funcs.decode(&substream, field, &callback->arg); - - if (substream.bytes_left == 0) - { - submsg_consumed = true; - } - } - } - - /* Now decode the submessage contents */ - if (status && !submsg_consumed) - { - unsigned int flags = 0; - - /* Static required/optional fields are already initialized by top-level - * pb_decode(), no need to initialize them again. */ - if (PB_ATYPE(field->type) == PB_ATYPE_STATIC && - PB_HTYPE(field->type) != PB_HTYPE_REPEATED) - { - flags = PB_DECODE_NOINIT; - } - - status = pb_decode_inner(&substream, field->submsg_desc, field->pData, flags); - } - - if (!pb_close_string_substream(stream, &substream)) - return false; - - return status; -} - -static bool checkreturn pb_dec_fixed_length_bytes(pb_istream_t *stream, const pb_field_iter_t *field) -{ - uint32_t size; - - if (!pb_decode_varint32(stream, &size)) - return false; - - if (size > PB_SIZE_MAX) - PB_RETURN_ERROR(stream, "bytes overflow"); - - if (size == 0) - { - /* As a special case, treat empty bytes string as all zeros for fixed_length_bytes. */ - memset(field->pData, 0, (size_t)field->data_size); - return true; - } - - if (size != field->data_size) - PB_RETURN_ERROR(stream, "incorrect fixed length bytes size"); - - return pb_read(stream, (pb_byte_t*)field->pData, (size_t)field->data_size); -} - -#ifdef PB_CONVERT_DOUBLE_FLOAT -bool pb_decode_double_as_float(pb_istream_t *stream, float *dest) -{ - uint_least8_t sign; - int exponent; - uint32_t mantissa; - uint64_t value; - union { float f; uint32_t i; } out; - - if (!pb_decode_fixed64(stream, &value)) - return false; - - /* Decompose input value */ - sign = (uint_least8_t)((value >> 63) & 1); - exponent = (int)((value >> 52) & 0x7FF) - 1023; - mantissa = (value >> 28) & 0xFFFFFF; /* Highest 24 bits */ - - /* Figure if value is in range representable by floats. */ - if (exponent == 1024) - { - /* Special value */ - exponent = 128; - mantissa >>= 1; - } - else - { - if (exponent > 127) - { - /* Too large, convert to infinity */ - exponent = 128; - mantissa = 0; - } - else if (exponent < -150) - { - /* Too small, convert to zero */ - exponent = -127; - mantissa = 0; - } - else if (exponent < -126) - { - /* Denormalized */ - mantissa |= 0x1000000; - mantissa >>= (-126 - exponent); - exponent = -127; - } - - /* Round off mantissa */ - mantissa = (mantissa + 1) >> 1; - - /* Check if mantissa went over 2.0 */ - if (mantissa & 0x800000) - { - exponent += 1; - mantissa &= 0x7FFFFF; - mantissa >>= 1; - } - } - - /* Combine fields */ - out.i = mantissa; - out.i |= (uint32_t)(exponent + 127) << 23; - out.i |= (uint32_t)sign << 31; - - *dest = out.f; - return true; -} -#endif diff --git a/src/network/pb_decode.h b/src/network/pb_decode.h deleted file mode 100644 index ae1d3ccf2eb..00000000000 --- a/src/network/pb_decode.h +++ /dev/null @@ -1,193 +0,0 @@ -/* pb_decode.h: Functions to decode protocol buffers. Depends on pb_decode.c. - * The main function is pb_decode. You also need an input stream, and the - * field descriptions created by nanopb_generator.py. - */ - -#ifndef PB_DECODE_H_INCLUDED -#define PB_DECODE_H_INCLUDED - -#include "pb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Structure for defining custom input streams. You will need to provide - * a callback function to read the bytes from your storage, which can be - * for example a file or a network socket. - * - * The callback must conform to these rules: - * - * 1) Return false on IO errors. This will cause decoding to abort. - * 2) You can use state to store your own data (e.g. buffer pointer), - * and rely on pb_read to verify that no-body reads past bytes_left. - * 3) Your callback may be used with substreams, in which case bytes_left - * is different than from the main stream. Don't use bytes_left to compute - * any pointers. - */ -struct pb_istream_s -{ -#ifdef PB_BUFFER_ONLY - /* Callback pointer is not used in buffer-only configuration. - * Having an int pointer here allows binary compatibility but - * gives an error if someone tries to assign callback function. - */ - int *callback; -#else - bool (*callback)(pb_istream_t *stream, pb_byte_t *buf, size_t count); -#endif - - void *state; /* Free field for use by callback implementation */ - size_t bytes_left; - -#ifndef PB_NO_ERRMSG - const char *errmsg; -#endif -}; - -#ifndef PB_NO_ERRMSG -#define PB_ISTREAM_EMPTY {0,0,0,0} -#else -#define PB_ISTREAM_EMPTY {0,0,0} -#endif - -/*************************** - * Main decoding functions * - ***************************/ - -/* Decode a single protocol buffers message from input stream into a C structure. - * Returns true on success, false on any failure. - * The actual struct pointed to by dest must match the description in fields. - * Callback fields of the destination structure must be initialized by caller. - * All other fields will be initialized by this function. - * - * Example usage: - * MyMessage msg = {}; - * uint8_t buffer[64]; - * pb_istream_t stream; - * - * // ... read some data into buffer ... - * - * stream = pb_istream_from_buffer(buffer, count); - * pb_decode(&stream, MyMessage_fields, &msg); - */ -bool pb_decode(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct); - -/* Extended version of pb_decode, with several options to control - * the decoding process: - * - * PB_DECODE_NOINIT: Do not initialize the fields to default values. - * This is slightly faster if you do not need the default - * values and instead initialize the structure to 0 using - * e.g. memset(). This can also be used for merging two - * messages, i.e. combine already existing data with new - * values. - * - * PB_DECODE_DELIMITED: Input message starts with the message size as varint. - * Corresponds to parseDelimitedFrom() in Google's - * protobuf API. - * - * PB_DECODE_NULLTERMINATED: Stop reading when field tag is read as 0. This allows - * reading null terminated messages. - * NOTE: Until nanopb-0.4.0, pb_decode() also allows - * null-termination. This behaviour is not supported in - * most other protobuf implementations, so PB_DECODE_DELIMITED - * is a better option for compatibility. - * - * Multiple flags can be combined with bitwise or (| operator) - */ -#define PB_DECODE_NOINIT 0x01U -#define PB_DECODE_DELIMITED 0x02U -#define PB_DECODE_NULLTERMINATED 0x04U -bool pb_decode_ex(pb_istream_t *stream, const pb_msgdesc_t *fields, void *dest_struct, unsigned int flags); - -/* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define pb_decode_noinit(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_NOINIT) -#define pb_decode_delimited(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_DELIMITED) -#define pb_decode_delimited_noinit(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_DELIMITED | PB_DECODE_NOINIT) -#define pb_decode_nullterminated(s,f,d) pb_decode_ex(s,f,d, PB_DECODE_NULLTERMINATED) - -/* Release any allocated pointer fields. If you use dynamic allocation, you should - * call this for any successfully decoded message when you are done with it. If - * pb_decode() returns with an error, the message is already released. - */ -void pb_release(const pb_msgdesc_t *fields, void *dest_struct); - -/************************************** - * Functions for manipulating streams * - **************************************/ - -/* Create an input stream for reading from a memory buffer. - * - * msglen should be the actual length of the message, not the full size of - * allocated buffer. - * - * Alternatively, you can use a custom stream that reads directly from e.g. - * a file or a network socket. - */ -pb_istream_t pb_istream_from_buffer(const pb_byte_t *buf, size_t msglen); - -/* Function to read from a pb_istream_t. You can use this if you need to - * read some custom header data, or to read data in field callbacks. - */ -bool pb_read(pb_istream_t *stream, pb_byte_t *buf, size_t count); - - -/************************************************ - * Helper functions for writing field callbacks * - ************************************************/ - -/* Decode the tag for the next field in the stream. Gives the wire type and - * field tag. At end of the message, returns false and sets eof to true. */ -bool pb_decode_tag(pb_istream_t *stream, pb_wire_type_t *wire_type, uint32_t *tag, bool *eof); - -/* Skip the field payload data, given the wire type. */ -bool pb_skip_field(pb_istream_t *stream, pb_wire_type_t wire_type); - -/* Decode an integer in the varint format. This works for enum, int32, - * int64, uint32 and uint64 field types. */ -#ifndef PB_WITHOUT_64BIT -bool pb_decode_varint(pb_istream_t *stream, uint64_t *dest); -#else -#define pb_decode_varint pb_decode_varint32 -#endif - -/* Decode an integer in the varint format. This works for enum, int32, - * and uint32 field types. */ -bool pb_decode_varint32(pb_istream_t *stream, uint32_t *dest); - -/* Decode a bool value in varint format. */ -bool pb_decode_bool(pb_istream_t *stream, bool *dest); - -/* Decode an integer in the zig-zagged svarint format. This works for sint32 - * and sint64. */ -#ifndef PB_WITHOUT_64BIT -bool pb_decode_svarint(pb_istream_t *stream, int64_t *dest); -#else -bool pb_decode_svarint(pb_istream_t *stream, int32_t *dest); -#endif - -/* Decode a fixed32, sfixed32 or float value. You need to pass a pointer to - * a 4-byte wide C variable. */ -bool pb_decode_fixed32(pb_istream_t *stream, void *dest); - -#ifndef PB_WITHOUT_64BIT -/* Decode a fixed64, sfixed64 or double value. You need to pass a pointer to - * a 8-byte wide C variable. */ -bool pb_decode_fixed64(pb_istream_t *stream, void *dest); -#endif - -#ifdef PB_CONVERT_DOUBLE_FLOAT -/* Decode a double value into float variable. */ -bool pb_decode_double_as_float(pb_istream_t *stream, float *dest); -#endif - -/* Make a limited-length substream for reading a PB_WT_STRING field. */ -bool pb_make_string_substream(pb_istream_t *stream, pb_istream_t *substream); -bool pb_close_string_substream(pb_istream_t *stream, pb_istream_t *substream); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/network/pb_encode.c b/src/network/pb_encode.c deleted file mode 100644 index a4e30b47102..00000000000 --- a/src/network/pb_encode.c +++ /dev/null @@ -1,1001 +0,0 @@ -/* pb_encode.c -- encode a protobuf using minimal resources - * - * 2011 Petteri Aimonen - */ - -#include "pb.h" -#include "pb_encode.h" -#include "pb_common.h" - -/* Use the GCC warn_unused_result attribute to check that all return values - * are propagated correctly. On other compilers and gcc before 3.4.0 just - * ignore the annotation. - */ -#if !defined(__GNUC__) || ( __GNUC__ < 3) || (__GNUC__ == 3 && __GNUC_MINOR__ < 4) - #define checkreturn -#else - #define checkreturn __attribute__((warn_unused_result)) -#endif - -/************************************** - * Declarations internal to this file * - **************************************/ -static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); -static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *field); -static bool checkreturn pb_check_proto3_default_value(const pb_field_iter_t *field); -static bool checkreturn encode_basic_field(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn encode_callback_field(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn encode_field(pb_ostream_t *stream, pb_field_iter_t *field); -static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *extension); -static bool checkreturn pb_encode_varint_32(pb_ostream_t *stream, uint32_t low, uint32_t high); -static bool checkreturn pb_enc_bool(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_enc_fixed(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_iter_t *field); -static bool checkreturn pb_enc_fixed_length_bytes(pb_ostream_t *stream, const pb_field_iter_t *field); - -#ifdef PB_WITHOUT_64BIT -#define pb_int64_t int32_t -#define pb_uint64_t uint32_t -#else -#define pb_int64_t int64_t -#define pb_uint64_t uint64_t -#endif - -/******************************* - * pb_ostream_t implementation * - *******************************/ - -static bool checkreturn buf_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count) -{ - pb_byte_t *dest = (pb_byte_t*)stream->state; - stream->state = dest + count; - - if ((dest != NULL) && (buf != NULL)) - memcpy(dest, buf, count * sizeof(pb_byte_t)); - - return true; -} - -pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize) -{ - pb_ostream_t stream; -#ifdef PB_BUFFER_ONLY - /* In PB_BUFFER_ONLY configuration the callback pointer is just int*. - * NULL pointer marks a sizing field, so put a non-NULL value to mark a buffer stream. - */ - static const int marker = 0; - stream.callback = ▮ -#else - stream.callback = &buf_write; -#endif - stream.state = buf; - stream.max_size = bufsize; - stream.bytes_written = 0; -#ifndef PB_NO_ERRMSG - stream.errmsg = NULL; -#endif - return stream; -} - -bool checkreturn pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count) -{ - if (count > 0 && stream->callback != NULL) - { - if (stream->bytes_written + count < stream->bytes_written || - stream->bytes_written + count > stream->max_size) - { - PB_RETURN_ERROR(stream, "stream full"); - } - -#ifdef PB_BUFFER_ONLY - if (!buf_write(stream, buf, count)) - PB_RETURN_ERROR(stream, "io error"); -#else - if (!stream->callback(stream, buf, count)) - PB_RETURN_ERROR(stream, "io error"); -#endif - } - - stream->bytes_written += count; - return true; -} - -/************************* - * Encode a single field * - *************************/ - -/* Read a bool value without causing undefined behavior even if the value - * is invalid. See issue #434 and - * https://stackoverflow.com/questions/27661768/weird-results-for-conditional - */ -static bool safe_read_bool(const void *pSize) -{ - const char *p = (const char *)pSize; - size_t i; - for (i = 0; i < sizeof(bool); i++) - { - if (p[i] != 0) - return true; - } - return false; -} - -/* Encode a static array. Handles the size calculations and possible packing. */ -static bool checkreturn encode_array(pb_ostream_t *stream, pb_field_iter_t *field) -{ - pb_size_t i; - pb_size_t count; -#ifndef PB_ENCODE_ARRAYS_UNPACKED - size_t size; -#endif - - count = *(pb_size_t*)field->pSize; - - if (count == 0) - return true; - - if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size) - PB_RETURN_ERROR(stream, "array max size exceeded"); - -#ifndef PB_ENCODE_ARRAYS_UNPACKED - /* We always pack arrays if the datatype allows it. */ - if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE) - { - if (!pb_encode_tag(stream, PB_WT_STRING, field->tag)) - return false; - - /* Determine the total size of packed array. */ - if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32) - { - size = 4 * (size_t)count; - } - else if (PB_LTYPE(field->type) == PB_LTYPE_FIXED64) - { - size = 8 * (size_t)count; - } - else - { - pb_ostream_t sizestream = PB_OSTREAM_SIZING; - void *pData_orig = field->pData; - for (i = 0; i < count; i++) - { - if (!pb_enc_varint(&sizestream, field)) - PB_RETURN_ERROR(stream, PB_GET_ERROR(&sizestream)); - field->pData = (char*)field->pData + field->data_size; - } - field->pData = pData_orig; - size = sizestream.bytes_written; - } - - if (!pb_encode_varint(stream, (pb_uint64_t)size)) - return false; - - if (stream->callback == NULL) - return pb_write(stream, NULL, size); /* Just sizing.. */ - - /* Write the data */ - for (i = 0; i < count; i++) - { - if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32 || PB_LTYPE(field->type) == PB_LTYPE_FIXED64) - { - if (!pb_enc_fixed(stream, field)) - return false; - } - else - { - if (!pb_enc_varint(stream, field)) - return false; - } - - field->pData = (char*)field->pData + field->data_size; - } - } - else /* Unpacked fields */ -#endif - { - for (i = 0; i < count; i++) - { - /* Normally the data is stored directly in the array entries, but - * for pointer-type string and bytes fields, the array entries are - * actually pointers themselves also. So we have to dereference once - * more to get to the actual data. */ - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER && - (PB_LTYPE(field->type) == PB_LTYPE_STRING || - PB_LTYPE(field->type) == PB_LTYPE_BYTES)) - { - bool status; - void *pData_orig = field->pData; - field->pData = *(void* const*)field->pData; - - if (!field->pData) - { - /* Null pointer in array is treated as empty string / bytes */ - status = pb_encode_tag_for_field(stream, field) && - pb_encode_varint(stream, 0); - } - else - { - status = encode_basic_field(stream, field); - } - - field->pData = pData_orig; - - if (!status) - return false; - } - else - { - if (!encode_basic_field(stream, field)) - return false; - } - field->pData = (char*)field->pData + field->data_size; - } - } - - return true; -} - -/* In proto3, all fields are optional and are only encoded if their value is "non-zero". - * This function implements the check for the zero value. */ -static bool checkreturn pb_check_proto3_default_value(const pb_field_iter_t *field) -{ - pb_type_t type = field->type; - - if (PB_ATYPE(type) == PB_ATYPE_STATIC) - { - if (PB_HTYPE(type) == PB_HTYPE_REQUIRED) - { - /* Required proto2 fields inside proto3 submessage, pretty rare case */ - return false; - } - else if (PB_HTYPE(type) == PB_HTYPE_REPEATED) - { - /* Repeated fields inside proto3 submessage: present if count != 0 */ - return *(const pb_size_t*)field->pSize == 0; - } - else if (PB_HTYPE(type) == PB_HTYPE_ONEOF) - { - /* Oneof fields */ - return *(const pb_size_t*)field->pSize == 0; - } - else if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && field->pSize != NULL) - { - /* Proto2 optional fields inside proto3 message, or proto3 - * submessage fields. */ - return safe_read_bool(field->pSize) == false; - } - else if (field->descriptor->default_value) - { - /* Proto3 messages do not have default values, but proto2 messages - * can contain optional fields without has_fields (generator option 'proto3'). - * In this case they must always be encoded, to make sure that the - * non-zero default value is overwritten. - */ - return false; - } - - /* Rest is proto3 singular fields */ - if (PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE) - { - /* Simple integer / float fields */ - pb_size_t i; - const char *p = (const char*)field->pData; - for (i = 0; i < field->data_size; i++) - { - if (p[i] != 0) - { - return false; - } - } - - return true; - } - else if (PB_LTYPE(type) == PB_LTYPE_BYTES) - { - const pb_bytes_array_t *bytes = (const pb_bytes_array_t*)field->pData; - return bytes->size == 0; - } - else if (PB_LTYPE(type) == PB_LTYPE_STRING) - { - return *(const char*)field->pData == '\0'; - } - else if (PB_LTYPE(type) == PB_LTYPE_FIXED_LENGTH_BYTES) - { - /* Fixed length bytes is only empty if its length is fixed - * as 0. Which would be pretty strange, but we can check - * it anyway. */ - return field->data_size == 0; - } - else if (PB_LTYPE_IS_SUBMSG(type)) - { - /* Check all fields in the submessage to find if any of them - * are non-zero. The comparison cannot be done byte-per-byte - * because the C struct may contain padding bytes that must - * be skipped. Note that usually proto3 submessages have - * a separate has_field that is checked earlier in this if. - */ - pb_field_iter_t iter; - if (pb_field_iter_begin(&iter, field->submsg_desc, field->pData)) - { - do - { - if (!pb_check_proto3_default_value(&iter)) - { - return false; - } - } while (pb_field_iter_next(&iter)); - } - return true; - } - } - else if (PB_ATYPE(type) == PB_ATYPE_POINTER) - { - return field->pData == NULL; - } - else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK) - { - if (PB_LTYPE(type) == PB_LTYPE_EXTENSION) - { - const pb_extension_t *extension = *(const pb_extension_t* const *)field->pData; - return extension == NULL; - } - else if (field->descriptor->field_callback == pb_default_field_callback) - { - pb_callback_t *pCallback = (pb_callback_t*)field->pData; - return pCallback->funcs.encode == NULL; - } - else - { - return field->descriptor->field_callback == NULL; - } - } - - return false; /* Not typically reached, safe default for weird special cases. */ -} - -/* Encode a field with static or pointer allocation, i.e. one whose data - * is available to the encoder directly. */ -static bool checkreturn encode_basic_field(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - if (!field->pData) - { - /* Missing pointer field */ - return true; - } - - if (!pb_encode_tag_for_field(stream, field)) - return false; - - switch (PB_LTYPE(field->type)) - { - case PB_LTYPE_BOOL: - return pb_enc_bool(stream, field); - - case PB_LTYPE_VARINT: - case PB_LTYPE_UVARINT: - case PB_LTYPE_SVARINT: - return pb_enc_varint(stream, field); - - case PB_LTYPE_FIXED32: - case PB_LTYPE_FIXED64: - return pb_enc_fixed(stream, field); - - case PB_LTYPE_BYTES: - return pb_enc_bytes(stream, field); - - case PB_LTYPE_STRING: - return pb_enc_string(stream, field); - - case PB_LTYPE_SUBMESSAGE: - case PB_LTYPE_SUBMSG_W_CB: - return pb_enc_submessage(stream, field); - - case PB_LTYPE_FIXED_LENGTH_BYTES: - return pb_enc_fixed_length_bytes(stream, field); - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } -} - -/* Encode a field with callback semantics. This means that a user function is - * called to provide and encode the actual data. */ -static bool checkreturn encode_callback_field(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - if (field->descriptor->field_callback != NULL) - { - if (!field->descriptor->field_callback(NULL, stream, field)) - PB_RETURN_ERROR(stream, "callback error"); - } - return true; -} - -/* Encode a single field of any callback, pointer or static type. */ -static bool checkreturn encode_field(pb_ostream_t *stream, pb_field_iter_t *field) -{ - /* Check field presence */ - if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF) - { - if (*(const pb_size_t*)field->pSize != field->tag) - { - /* Different type oneof field */ - return true; - } - } - else if (PB_HTYPE(field->type) == PB_HTYPE_OPTIONAL) - { - if (field->pSize) - { - if (safe_read_bool(field->pSize) == false) - { - /* Missing optional field */ - return true; - } - } - else if (PB_ATYPE(field->type) == PB_ATYPE_STATIC) - { - /* Proto3 singular field */ - if (pb_check_proto3_default_value(field)) - return true; - } - } - - if (!field->pData) - { - if (PB_HTYPE(field->type) == PB_HTYPE_REQUIRED) - PB_RETURN_ERROR(stream, "missing required field"); - - /* Pointer field set to NULL */ - return true; - } - - /* Then encode field contents */ - if (PB_ATYPE(field->type) == PB_ATYPE_CALLBACK) - { - return encode_callback_field(stream, field); - } - else if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED) - { - return encode_array(stream, field); - } - else - { - return encode_basic_field(stream, field); - } -} - -/* Default handler for extension fields. Expects to have a pb_msgdesc_t - * pointer in the extension->type->arg field, pointing to a message with - * only one field in it. */ -static bool checkreturn default_extension_encoder(pb_ostream_t *stream, const pb_extension_t *extension) -{ - pb_field_iter_t iter; - - if (!pb_field_iter_begin_extension_const(&iter, extension)) - PB_RETURN_ERROR(stream, "invalid extension"); - - return encode_field(stream, &iter); -} - - -/* Walk through all the registered extensions and give them a chance - * to encode themselves. */ -static bool checkreturn encode_extension_field(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - const pb_extension_t *extension = *(const pb_extension_t* const *)field->pData; - - while (extension) - { - bool status; - if (extension->type->encode) - status = extension->type->encode(stream, extension); - else - status = default_extension_encoder(stream, extension); - - if (!status) - return false; - - extension = extension->next; - } - - return true; -} - -/********************* - * Encode all fields * - *********************/ - -bool checkreturn pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct) -{ - pb_field_iter_t iter; - if (!pb_field_iter_begin_const(&iter, fields, src_struct)) - return true; /* Empty message type */ - - do { - if (PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION) - { - /* Special case for the extension field placeholder */ - if (!encode_extension_field(stream, &iter)) - return false; - } - else - { - /* Regular field */ - if (!encode_field(stream, &iter)) - return false; - } - } while (pb_field_iter_next(&iter)); - - return true; -} - -bool checkreturn pb_encode_ex(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct, unsigned int flags) -{ - if ((flags & PB_ENCODE_DELIMITED) != 0) - { - return pb_encode_submessage(stream, fields, src_struct); - } - else if ((flags & PB_ENCODE_NULLTERMINATED) != 0) - { - const pb_byte_t zero = 0; - - if (!pb_encode(stream, fields, src_struct)) - return false; - - return pb_write(stream, &zero, 1); - } - else - { - return pb_encode(stream, fields, src_struct); - } -} - -bool pb_get_encoded_size(size_t *size, const pb_msgdesc_t *fields, const void *src_struct) -{ - pb_ostream_t stream = PB_OSTREAM_SIZING; - - if (!pb_encode(&stream, fields, src_struct)) - return false; - - *size = stream.bytes_written; - return true; -} - -/******************** - * Helper functions * - ********************/ - -/* This function avoids 64-bit shifts as they are quite slow on many platforms. */ -static bool checkreturn pb_encode_varint_32(pb_ostream_t *stream, uint32_t low, uint32_t high) -{ - size_t i = 0; - pb_byte_t buffer[10]; - pb_byte_t byte = (pb_byte_t)(low & 0x7F); - low >>= 7; - - while (i < 4 && (low != 0 || high != 0)) - { - byte |= 0x80; - buffer[i++] = byte; - byte = (pb_byte_t)(low & 0x7F); - low >>= 7; - } - - if (high) - { - byte = (pb_byte_t)(byte | ((high & 0x07) << 4)); - high >>= 3; - - while (high) - { - byte |= 0x80; - buffer[i++] = byte; - byte = (pb_byte_t)(high & 0x7F); - high >>= 7; - } - } - - buffer[i++] = byte; - - return pb_write(stream, buffer, i); -} - -bool checkreturn pb_encode_varint(pb_ostream_t *stream, pb_uint64_t value) -{ - if (value <= 0x7F) - { - /* Fast path: single byte */ - pb_byte_t byte = (pb_byte_t)value; - return pb_write(stream, &byte, 1); - } - else - { -#ifdef PB_WITHOUT_64BIT - return pb_encode_varint_32(stream, value, 0); -#else - return pb_encode_varint_32(stream, (uint32_t)value, (uint32_t)(value >> 32)); -#endif - } -} - -bool checkreturn pb_encode_svarint(pb_ostream_t *stream, pb_int64_t value) -{ - pb_uint64_t zigzagged; - pb_uint64_t mask = ((pb_uint64_t)-1) >> 1; /* Satisfy clang -fsanitize=integer */ - if (value < 0) - zigzagged = ~(((pb_uint64_t)value & mask) << 1); - else - zigzagged = (pb_uint64_t)value << 1; - - return pb_encode_varint(stream, zigzagged); -} - -bool checkreturn pb_encode_fixed32(pb_ostream_t *stream, const void *value) -{ -#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1 - /* Fast path if we know that we're on little endian */ - return pb_write(stream, (const pb_byte_t*)value, 4); -#else - uint32_t val = *(const uint32_t*)value; - pb_byte_t bytes[4]; - bytes[0] = (pb_byte_t)(val & 0xFF); - bytes[1] = (pb_byte_t)((val >> 8) & 0xFF); - bytes[2] = (pb_byte_t)((val >> 16) & 0xFF); - bytes[3] = (pb_byte_t)((val >> 24) & 0xFF); - return pb_write(stream, bytes, 4); -#endif -} - -#ifndef PB_WITHOUT_64BIT -bool checkreturn pb_encode_fixed64(pb_ostream_t *stream, const void *value) -{ -#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1 - /* Fast path if we know that we're on little endian */ - return pb_write(stream, (const pb_byte_t*)value, 8); -#else - uint64_t val = *(const uint64_t*)value; - pb_byte_t bytes[8]; - bytes[0] = (pb_byte_t)(val & 0xFF); - bytes[1] = (pb_byte_t)((val >> 8) & 0xFF); - bytes[2] = (pb_byte_t)((val >> 16) & 0xFF); - bytes[3] = (pb_byte_t)((val >> 24) & 0xFF); - bytes[4] = (pb_byte_t)((val >> 32) & 0xFF); - bytes[5] = (pb_byte_t)((val >> 40) & 0xFF); - bytes[6] = (pb_byte_t)((val >> 48) & 0xFF); - bytes[7] = (pb_byte_t)((val >> 56) & 0xFF); - return pb_write(stream, bytes, 8); -#endif -} -#endif - -bool checkreturn pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number) -{ - pb_uint64_t tag = ((pb_uint64_t)field_number << 3) | wiretype; - return pb_encode_varint(stream, tag); -} - -bool pb_encode_tag_for_field ( pb_ostream_t* stream, const pb_field_iter_t* field ) -{ - pb_wire_type_t wiretype; - switch (PB_LTYPE(field->type)) - { - case PB_LTYPE_BOOL: - case PB_LTYPE_VARINT: - case PB_LTYPE_UVARINT: - case PB_LTYPE_SVARINT: - wiretype = PB_WT_VARINT; - break; - - case PB_LTYPE_FIXED32: - wiretype = PB_WT_32BIT; - break; - - case PB_LTYPE_FIXED64: - wiretype = PB_WT_64BIT; - break; - - case PB_LTYPE_BYTES: - case PB_LTYPE_STRING: - case PB_LTYPE_SUBMESSAGE: - case PB_LTYPE_SUBMSG_W_CB: - case PB_LTYPE_FIXED_LENGTH_BYTES: - wiretype = PB_WT_STRING; - break; - - default: - PB_RETURN_ERROR(stream, "invalid field type"); - } - - return pb_encode_tag(stream, wiretype, field->tag); -} - -bool checkreturn pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size) -{ - if (!pb_encode_varint(stream, (pb_uint64_t)size)) - return false; - - return pb_write(stream, buffer, size); -} - -bool checkreturn pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct) -{ - /* First calculate the message size using a non-writing substream. */ - pb_ostream_t substream = PB_OSTREAM_SIZING; - size_t size; - bool status; - - if (!pb_encode(&substream, fields, src_struct)) - { -#ifndef PB_NO_ERRMSG - stream->errmsg = substream.errmsg; -#endif - return false; - } - - size = substream.bytes_written; - - if (!pb_encode_varint(stream, (pb_uint64_t)size)) - return false; - - if (stream->callback == NULL) - return pb_write(stream, NULL, size); /* Just sizing */ - - if (stream->bytes_written + size > stream->max_size) - PB_RETURN_ERROR(stream, "stream full"); - - /* Use a substream to verify that a callback doesn't write more than - * what it did the first time. */ - substream.callback = stream->callback; - substream.state = stream->state; - substream.max_size = size; - substream.bytes_written = 0; -#ifndef PB_NO_ERRMSG - substream.errmsg = NULL; -#endif - - status = pb_encode(&substream, fields, src_struct); - - stream->bytes_written += substream.bytes_written; - stream->state = substream.state; -#ifndef PB_NO_ERRMSG - stream->errmsg = substream.errmsg; -#endif - - if (substream.bytes_written != size) - PB_RETURN_ERROR(stream, "submsg size changed"); - - return status; -} - -/* Field encoders */ - -static bool checkreturn pb_enc_bool(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - uint32_t value = safe_read_bool(field->pData) ? 1 : 0; - PB_UNUSED(field); - return pb_encode_varint(stream, value); -} - -static bool checkreturn pb_enc_varint(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - if (PB_LTYPE(field->type) == PB_LTYPE_UVARINT) - { - /* Perform unsigned integer extension */ - pb_uint64_t value = 0; - - if (field->data_size == sizeof(uint_least8_t)) - value = *(const uint_least8_t*)field->pData; - else if (field->data_size == sizeof(uint_least16_t)) - value = *(const uint_least16_t*)field->pData; - else if (field->data_size == sizeof(uint32_t)) - value = *(const uint32_t*)field->pData; - else if (field->data_size == sizeof(pb_uint64_t)) - value = *(const pb_uint64_t*)field->pData; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - return pb_encode_varint(stream, value); - } - else - { - /* Perform signed integer extension */ - pb_int64_t value = 0; - - if (field->data_size == sizeof(int_least8_t)) - value = *(const int_least8_t*)field->pData; - else if (field->data_size == sizeof(int_least16_t)) - value = *(const int_least16_t*)field->pData; - else if (field->data_size == sizeof(int32_t)) - value = *(const int32_t*)field->pData; - else if (field->data_size == sizeof(pb_int64_t)) - value = *(const pb_int64_t*)field->pData; - else - PB_RETURN_ERROR(stream, "invalid data_size"); - - if (PB_LTYPE(field->type) == PB_LTYPE_SVARINT) - return pb_encode_svarint(stream, value); -#ifdef PB_WITHOUT_64BIT - else if (value < 0) - return pb_encode_varint_32(stream, (uint32_t)value, (uint32_t)-1); -#endif - else - return pb_encode_varint(stream, (pb_uint64_t)value); - - } -} - -static bool checkreturn pb_enc_fixed(pb_ostream_t *stream, const pb_field_iter_t *field) -{ -#ifdef PB_CONVERT_DOUBLE_FLOAT - if (field->data_size == sizeof(float) && PB_LTYPE(field->type) == PB_LTYPE_FIXED64) - { - return pb_encode_float_as_double(stream, *(float*)field->pData); - } -#endif - - if (field->data_size == sizeof(uint32_t)) - { - return pb_encode_fixed32(stream, field->pData); - } -#ifndef PB_WITHOUT_64BIT - else if (field->data_size == sizeof(uint64_t)) - { - return pb_encode_fixed64(stream, field->pData); - } -#endif - else - { - PB_RETURN_ERROR(stream, "invalid data_size"); - } -} - -static bool checkreturn pb_enc_bytes(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - const pb_bytes_array_t *bytes = NULL; - - bytes = (const pb_bytes_array_t*)field->pData; - - if (bytes == NULL) - { - /* Treat null pointer as an empty bytes field */ - return pb_encode_string(stream, NULL, 0); - } - - if (PB_ATYPE(field->type) == PB_ATYPE_STATIC && - bytes->size > field->data_size - offsetof(pb_bytes_array_t, bytes)) - { - PB_RETURN_ERROR(stream, "bytes size exceeded"); - } - - return pb_encode_string(stream, bytes->bytes, (size_t)bytes->size); -} - -static bool checkreturn pb_enc_string(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - size_t size = 0; - size_t max_size = (size_t)field->data_size; - const char *str = (const char*)field->pData; - - if (PB_ATYPE(field->type) == PB_ATYPE_POINTER) - { - max_size = (size_t)-1; - } - else - { - /* pb_dec_string() assumes string fields end with a null - * terminator when the type isn't PB_ATYPE_POINTER, so we - * shouldn't allow more than max-1 bytes to be written to - * allow space for the null terminator. - */ - if (max_size == 0) - PB_RETURN_ERROR(stream, "zero-length string"); - - max_size -= 1; - } - - - if (str == NULL) - { - size = 0; /* Treat null pointer as an empty string */ - } - else - { - const char *p = str; - - /* strnlen() is not always available, so just use a loop */ - while (size < max_size && *p != '\0') - { - size++; - p++; - } - - if (*p != '\0') - { - PB_RETURN_ERROR(stream, "unterminated string"); - } - } - -#ifdef PB_VALIDATE_UTF8 - if (!pb_validate_utf8(str)) - PB_RETURN_ERROR(stream, "invalid utf8"); -#endif - - return pb_encode_string(stream, (const pb_byte_t*)str, size); -} - -static bool checkreturn pb_enc_submessage(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - if (field->submsg_desc == NULL) - PB_RETURN_ERROR(stream, "invalid field descriptor"); - - if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL) - { - /* Message callback is stored right before pSize. */ - pb_callback_t *callback = (pb_callback_t*)field->pSize - 1; - if (callback->funcs.encode) - { - if (!callback->funcs.encode(stream, field, &callback->arg)) - return false; - } - } - - return pb_encode_submessage(stream, field->submsg_desc, field->pData); -} - -static bool checkreturn pb_enc_fixed_length_bytes(pb_ostream_t *stream, const pb_field_iter_t *field) -{ - return pb_encode_string(stream, (const pb_byte_t*)field->pData, (size_t)field->data_size); -} - -#ifdef PB_CONVERT_DOUBLE_FLOAT -bool pb_encode_float_as_double(pb_ostream_t *stream, float value) -{ - union { float f; uint32_t i; } in; - uint_least8_t sign; - int exponent; - uint64_t mantissa; - - in.f = value; - - /* Decompose input value */ - sign = (uint_least8_t)((in.i >> 31) & 1); - exponent = (int)((in.i >> 23) & 0xFF) - 127; - mantissa = in.i & 0x7FFFFF; - - if (exponent == 128) - { - /* Special value (NaN etc.) */ - exponent = 1024; - } - else if (exponent == -127) - { - if (!mantissa) - { - /* Zero */ - exponent = -1023; - } - else - { - /* Denormalized */ - mantissa <<= 1; - while (!(mantissa & 0x800000)) - { - mantissa <<= 1; - exponent--; - } - mantissa &= 0x7FFFFF; - } - } - - /* Combine fields */ - mantissa <<= 29; - mantissa |= (uint64_t)(exponent + 1023) << 52; - mantissa |= (uint64_t)sign << 63; - - return pb_encode_fixed64(stream, &mantissa); -} -#endif diff --git a/src/network/pb_encode.h b/src/network/pb_encode.h deleted file mode 100644 index 891368322f4..00000000000 --- a/src/network/pb_encode.h +++ /dev/null @@ -1,185 +0,0 @@ -/* pb_encode.h: Functions to encode protocol buffers. Depends on pb_encode.c. - * The main function is pb_encode. You also need an output stream, and the - * field descriptions created by nanopb_generator.py. - */ - -#ifndef PB_ENCODE_H_INCLUDED -#define PB_ENCODE_H_INCLUDED - -#include "pb.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/* Structure for defining custom output streams. You will need to provide - * a callback function to write the bytes to your storage, which can be - * for example a file or a network socket. - * - * The callback must conform to these rules: - * - * 1) Return false on IO errors. This will cause encoding to abort. - * 2) You can use state to store your own data (e.g. buffer pointer). - * 3) pb_write will update bytes_written after your callback runs. - * 4) Substreams will modify max_size and bytes_written. Don't use them - * to calculate any pointers. - */ -struct pb_ostream_s -{ -#ifdef PB_BUFFER_ONLY - /* Callback pointer is not used in buffer-only configuration. - * Having an int pointer here allows binary compatibility but - * gives an error if someone tries to assign callback function. - * Also, NULL pointer marks a 'sizing stream' that does not - * write anything. - */ - const int *callback; -#else - bool (*callback)(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); -#endif - void *state; /* Free field for use by callback implementation. */ - size_t max_size; /* Limit number of output bytes written (or use SIZE_MAX). */ - size_t bytes_written; /* Number of bytes written so far. */ - -#ifndef PB_NO_ERRMSG - const char *errmsg; -#endif -}; - -/*************************** - * Main encoding functions * - ***************************/ - -/* Encode a single protocol buffers message from C structure into a stream. - * Returns true on success, false on any failure. - * The actual struct pointed to by src_struct must match the description in fields. - * All required fields in the struct are assumed to have been filled in. - * - * Example usage: - * MyMessage msg = {}; - * uint8_t buffer[64]; - * pb_ostream_t stream; - * - * msg.field1 = 42; - * stream = pb_ostream_from_buffer(buffer, sizeof(buffer)); - * pb_encode(&stream, MyMessage_fields, &msg); - */ -bool pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct); - -/* Extended version of pb_encode, with several options to control the - * encoding process: - * - * PB_ENCODE_DELIMITED: Prepend the length of message as a varint. - * Corresponds to writeDelimitedTo() in Google's - * protobuf API. - * - * PB_ENCODE_NULLTERMINATED: Append a null byte to the message for termination. - * NOTE: This behaviour is not supported in most other - * protobuf implementations, so PB_ENCODE_DELIMITED - * is a better option for compatibility. - */ -#define PB_ENCODE_DELIMITED 0x02U -#define PB_ENCODE_NULLTERMINATED 0x04U -bool pb_encode_ex(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct, unsigned int flags); - -/* Defines for backwards compatibility with code written before nanopb-0.4.0 */ -#define pb_encode_delimited(s,f,d) pb_encode_ex(s,f,d, PB_ENCODE_DELIMITED) -#define pb_encode_nullterminated(s,f,d) pb_encode_ex(s,f,d, PB_ENCODE_NULLTERMINATED) - -/* Encode the message to get the size of the encoded data, but do not store - * the data. */ -bool pb_get_encoded_size(size_t *size, const pb_msgdesc_t *fields, const void *src_struct); - -/************************************** - * Functions for manipulating streams * - **************************************/ - -/* Create an output stream for writing into a memory buffer. - * The number of bytes written can be found in stream.bytes_written after - * encoding the message. - * - * Alternatively, you can use a custom stream that writes directly to e.g. - * a file or a network socket. - */ -pb_ostream_t pb_ostream_from_buffer(pb_byte_t *buf, size_t bufsize); - -/* Pseudo-stream for measuring the size of a message without actually storing - * the encoded data. - * - * Example usage: - * MyMessage msg = {}; - * pb_ostream_t stream = PB_OSTREAM_SIZING; - * pb_encode(&stream, MyMessage_fields, &msg); - * printf("Message size is %d\n", stream.bytes_written); - */ -#ifndef PB_NO_ERRMSG -#define PB_OSTREAM_SIZING {0,0,0,0,0} -#else -#define PB_OSTREAM_SIZING {0,0,0,0} -#endif - -/* Function to write into a pb_ostream_t stream. You can use this if you need - * to append or prepend some custom headers to the message. - */ -bool pb_write(pb_ostream_t *stream, const pb_byte_t *buf, size_t count); - - -/************************************************ - * Helper functions for writing field callbacks * - ************************************************/ - -/* Encode field header based on type and field number defined in the field - * structure. Call this from the callback before writing out field contents. */ -bool pb_encode_tag_for_field(pb_ostream_t *stream, const pb_field_iter_t *field); - -/* Encode field header by manually specifying wire type. You need to use this - * if you want to write out packed arrays from a callback field. */ -bool pb_encode_tag(pb_ostream_t *stream, pb_wire_type_t wiretype, uint32_t field_number); - -/* Encode an integer in the varint format. - * This works for bool, enum, int32, int64, uint32 and uint64 field types. */ -#ifndef PB_WITHOUT_64BIT -bool pb_encode_varint(pb_ostream_t *stream, uint64_t value); -#else -bool pb_encode_varint(pb_ostream_t *stream, uint32_t value); -#endif - -/* Encode an integer in the zig-zagged svarint format. - * This works for sint32 and sint64. */ -#ifndef PB_WITHOUT_64BIT -bool pb_encode_svarint(pb_ostream_t *stream, int64_t value); -#else -bool pb_encode_svarint(pb_ostream_t *stream, int32_t value); -#endif - -/* Encode a string or bytes type field. For strings, pass strlen(s) as size. */ -bool pb_encode_string(pb_ostream_t *stream, const pb_byte_t *buffer, size_t size); - -/* Encode a fixed32, sfixed32 or float value. - * You need to pass a pointer to a 4-byte wide C variable. */ -bool pb_encode_fixed32(pb_ostream_t *stream, const void *value); - -#ifndef PB_WITHOUT_64BIT -/* Encode a fixed64, sfixed64 or double value. - * You need to pass a pointer to a 8-byte wide C variable. */ -bool pb_encode_fixed64(pb_ostream_t *stream, const void *value); -#endif - -#ifdef PB_CONVERT_DOUBLE_FLOAT -/* Encode a float value so that it appears like a double in the encoded - * message. */ -bool pb_encode_float_as_double(pb_ostream_t *stream, float value); -#endif - -/* Encode a submessage field. - * You need to pass the pb_field_t array and pointer to struct, just like - * with pb_encode(). This internally encodes the submessage twice, first to - * calculate message size and then to actually write it out. - */ -bool pb_encode_submessage(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct); - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index 1868598ae9b..abadc7a782b 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -1176,7 +1176,7 @@ MediaMenu::nicUpdateMenu(int i) case NET_TYPE_TAP: netType = "TAP"; break; - case NET_TYPE_NMSWITCH: + case NET_TYPE_NLSWITCH: netType = "Local Switch"; break; case NET_TYPE_NRSWITCH: diff --git a/src/qt/qt_settingsnetwork.cpp b/src/qt/qt_settingsnetwork.cpp index fec607b9760..bd4ea80bd6e 100644 --- a/src/qt/qt_settingsnetwork.cpp +++ b/src/qt/qt_settingsnetwork.cpp @@ -138,7 +138,7 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) #endif #ifdef USE_NETSWITCH - case NET_TYPE_NMSWITCH: + case NET_TYPE_NLSWITCH: // option_list_label->setText("Local Switch Options"); option_list_label->setVisible(true); option_list_line->setVisible(true); @@ -236,7 +236,7 @@ SettingsNetwork::save() memset(net_cards_conf[i].nrs_hostname, '\0', sizeof(net_cards_conf[i].nrs_hostname)); strncpy(net_cards_conf[i].nrs_hostname, hostname_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].nrs_hostname) - 1); net_cards_conf[i].switch_group = switch_group_value->value() - 1; - } else if (net_cards_conf[i].net_type == NET_TYPE_NMSWITCH) { + } else if (net_cards_conf[i].net_type == NET_TYPE_NLSWITCH) { net_cards_conf[i].promisc_mode = promisc_value->isChecked(); net_cards_conf[i].switch_group = switch_group_value->value() - 1; } @@ -314,7 +314,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) #endif #ifdef USE_NETSWITCH - Models::AddEntry(model, "Local Switch", NET_TYPE_NMSWITCH); + Models::AddEntry(model, "Local Switch", NET_TYPE_NLSWITCH); # ifdef ENABLE_NET_NRSWITCH Models::AddEntry(model, "Remote Switch", NET_TYPE_NRSWITCH); # endif /* ENABLE_NET_NRSWITCH */ @@ -355,7 +355,7 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) editline->setText(currentTapDevice); #endif #ifdef USE_NETSWITCH - } else if (net_cards_conf[i].net_type == NET_TYPE_NMSWITCH) { + } else if (net_cards_conf[i].net_type == NET_TYPE_NLSWITCH) { auto *promisc_value = findChild(QString("boxPromisc%1").arg(i + 1)); promisc_value->setCheckState(net_cards_conf[i].promisc_mode == 1 ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); diff --git a/src/qt/qt_vmmanager_system.cpp b/src/qt/qt_vmmanager_system.cpp index 7528ad44eeb..eb91ef2203d 100644 --- a/src/qt/qt_vmmanager_system.cpp +++ b/src/qt/qt_vmmanager_system.cpp @@ -892,7 +892,7 @@ VMManagerSystem::setupVars() net_type = "SLiRP"; else if (net_type == "pcap") net_type = "PCap"; - else if (net_type == "nmswitch") + else if ((net_type == "nlswitch") || (net_type == "nmswitch")) net_type = tr("Local Switch"); else if (net_type == "nrswitch") net_type = tr("Remote Switch"); From 0aac48d6f2f024a253c93679707f15df3a0554c4 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 20:55:32 -0300 Subject: [PATCH 227/320] Fix untranslated switch network types on NIC tooltips --- src/qt/qt_mediamenu.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index abadc7a782b..c9defba9615 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -1160,9 +1160,10 @@ MediaMenu::nicUpdateMenu(int i) if (!netMenus.contains(i)) return; - QString netType = tr("Null Driver"); + QString netType; switch (net_cards_conf[i].net_type) { default: + netType = tr("Null Driver"); break; case NET_TYPE_SLIRP: netType = "SLiRP"; @@ -1177,10 +1178,10 @@ MediaMenu::nicUpdateMenu(int i) netType = "TAP"; break; case NET_TYPE_NLSWITCH: - netType = "Local Switch"; + netType = tr("Local Switch"); break; case NET_TYPE_NRSWITCH: - netType = "Remote Switch"; + netType = tr("Remote Switch"); break; } From 4ab6c318ed52023b641fd9f5dfd04213620431a8 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 21:00:22 -0300 Subject: [PATCH 228/320] Un-devbranch the network switch --- CMakeLists.txt | 1 - src/network/CMakeLists.txt | 8 +------- src/network/network.c | 2 -- src/qt/CMakeLists.txt | 4 ---- src/qt/qt_settingsnetwork.cpp | 14 ++------------ 5 files changed, 3 insertions(+), 26 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index afc981b0a03..667df522148 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -184,7 +184,6 @@ cmake_dependent_option(PCL "Generic PCL5e Printer" cmake_dependent_option(SIO_DETECT "Super I/O Detection Helper" ON "DEV_BRANCH" OFF) cmake_dependent_option(WACOM "Wacom Input Devices" ON "DEV_BRANCH" OFF) cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF) -cmake_dependent_option(NETSWITCH "Network Switch Support" ON "DEV_BRANCH" OFF) cmake_dependent_option(VFIO "Virtual Function I/O" ON "DEV_BRANCH" OFF) cmake_dependent_option(SOFTMODEM "AC'97 Softmodem" ON "DEV_BRANCH" OFF) diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt index 44465486e38..627535d53a2 100644 --- a/src/network/CMakeLists.txt +++ b/src/network/CMakeLists.txt @@ -19,6 +19,7 @@ list(APPEND net_sources network.c net_pcap.c net_slirp.c + net_switch.c net_dp8390.c net_3c501.c net_3c503.c @@ -57,13 +58,6 @@ if(WIN32) target_link_libraries(86Box ws2_32) endif() -if(NETSWITCH) - add_compile_definitions(USE_NETSWITCH) - list(APPEND net_sources - net_switch.c - ) -endif() - if (UNIX) if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") set_source_files_properties(net_slirp.c PROPERTIES COMPILE_FLAGS "-I/usr/local/include") diff --git a/src/network/network.c b/src/network/network.c index d99b997b010..1a23c428090 100644 --- a/src/network/network.c +++ b/src/network/network.c @@ -499,13 +499,11 @@ network_attach(void *card_drv, uint8_t *mac, NETRXCB rx, NETSETLINKSTATE set_lin card->host_drv.priv = card->host_drv.init(card, mac, net_cards_conf[net_card_current].host_dev_name, net_drv_error); break; #endif -#ifdef USE_NETSWITCH case NET_TYPE_NLSWITCH: case NET_TYPE_NRSWITCH: card->host_drv = net_switch_drv; card->host_drv.priv = card->host_drv.init(card, mac, &net_cards_conf[net_card_current], net_drv_error); break; -#endif /* USE_NETSWITCH */ default: card->host_drv.priv = NULL; break; diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 1c61f555985..b7d39109e50 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -275,10 +275,6 @@ if(EMU_BUILD_NUM) ) endif() -if(NETSWITCH) - target_compile_definitions(ui PRIVATE USE_NETSWITCH) -endif() - if(RTMIDI) target_compile_definitions(ui PRIVATE USE_RTMIDI) endif() diff --git a/src/qt/qt_settingsnetwork.cpp b/src/qt/qt_settingsnetwork.cpp index bd4ea80bd6e..9297810751e 100644 --- a/src/qt/qt_settingsnetwork.cpp +++ b/src/qt/qt_settingsnetwork.cpp @@ -137,7 +137,6 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) break; #endif -#ifdef USE_NETSWITCH case NET_TYPE_NLSWITCH: // option_list_label->setText("Local Switch Options"); option_list_label->setVisible(true); @@ -167,7 +166,6 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) hostname_label->setVisible(true); hostname_value->setVisible(true); break; -#endif /* USE_NETSWITCH */ case NET_TYPE_SLIRP: default: @@ -215,11 +213,9 @@ SettingsNetwork::save() cbox = findChild(QString("comboBoxNet%1").arg(i + 1)); net_cards_conf[i].net_type = cbox->currentData().toInt(); cbox = findChild(QString("comboBoxIntf%1").arg(i + 1)); -#ifdef USE_NETSWITCH auto *hostname_value = findChild(QString("hostnameSwitch%1").arg(i + 1)); auto *promisc_value = findChild(QString("boxPromisc%1").arg(i + 1)); auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); -#endif /* USE_NETSWITCH */ memset(net_cards_conf[i].host_dev_name, '\0', sizeof(net_cards_conf[i].host_dev_name)); if (net_cards_conf[i].net_type == NET_TYPE_PCAP) strncpy(net_cards_conf[i].host_dev_name, network_devs[cbox->currentData().toInt()].device, sizeof(net_cards_conf[i].host_dev_name) - 1); @@ -231,7 +227,6 @@ SettingsNetwork::save() else if (net_cards_conf[i].net_type == NET_TYPE_TAP) strncpy(net_cards_conf[i].host_dev_name, bridge_line->text().toUtf8().constData(), sizeof(net_cards_conf[i].host_dev_name)); #endif -#ifdef USE_NETSWITCH else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) { memset(net_cards_conf[i].nrs_hostname, '\0', sizeof(net_cards_conf[i].nrs_hostname)); strncpy(net_cards_conf[i].nrs_hostname, hostname_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].nrs_hostname) - 1); @@ -240,7 +235,6 @@ SettingsNetwork::save() net_cards_conf[i].promisc_mode = promisc_value->isChecked(); net_cards_conf[i].switch_group = switch_group_value->value() - 1; } -#endif /* USE_NETSWITCH */ } } @@ -313,12 +307,10 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) Models::AddEntry(model, "TAP", NET_TYPE_TAP); #endif -#ifdef USE_NETSWITCH Models::AddEntry(model, "Local Switch", NET_TYPE_NLSWITCH); -# ifdef ENABLE_NET_NRSWITCH +#ifdef ENABLE_NET_NRSWITCH Models::AddEntry(model, "Remote Switch", NET_TYPE_NRSWITCH); -# endif /* ENABLE_NET_NRSWITCH */ -#endif /* USE_NETSWITCH */ +#endif /* ENABLE_NET_NRSWITCH */ model->removeRows(0, removeRows); cbox->setCurrentIndex(cbox->findData(net_cards_conf[i].net_type)); @@ -354,7 +346,6 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) auto editline = findChild(QString("bridgeTAPNIC%1").arg(i + 1)); editline->setText(currentTapDevice); #endif -#ifdef USE_NETSWITCH } else if (net_cards_conf[i].net_type == NET_TYPE_NLSWITCH) { auto *promisc_value = findChild(QString("boxPromisc%1").arg(i + 1)); promisc_value->setCheckState(net_cards_conf[i].promisc_mode == 1 ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); @@ -365,7 +356,6 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) hostname_value->setText(net_cards_conf[i].nrs_hostname); auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); switch_group_value->setValue(net_cards_conf[i].switch_group + 1); -#endif /* USE_NETSWITCH */ } } } From c9f095cbbf8ca4675ff26363db39d0ddaed7ae45 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 21:10:50 -0300 Subject: [PATCH 229/320] Switch: Rename logging scope --- src/network/net_switch.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/network/net_switch.c b/src/network/net_switch.c index feaa74793bd..2d0463e8846 100644 --- a/src/network/net_switch.c +++ b/src/network/net_switch.c @@ -94,15 +94,15 @@ typedef struct net_switch_t { #endif } net_switch_t; -#ifdef ENABLE_NETSWITCH_LOG -int netswitch_do_log = ENABLE_NETSWITCH_LOG; +#ifdef ENABLE_SWITCH_LOG +int switch_do_log = ENABLE_SWITCH_LOG; static void netswitch_log(const char *fmt, ...) { va_list ap; - if (netswitch_do_log) { + if (switch_do_log) { va_start(ap, fmt); pclog_ex(fmt, ap); va_end(ap); @@ -151,7 +151,7 @@ net_switch_add_hostaddr(net_switch_t *netswitch, net_switch_sockaddr_t *addr, ne hostaddr->socket_tx = -1; unsigned int ret = 1; if (addr->sa.sa_family == AF_INET) { -#ifdef ENABLE_NETSWITCH_LOG +#ifdef ENABLE_SWITCH_LOG char buf[INET_ADDRSTRLEN]; buf[0] = '\0'; inet_ntop(addr->sin.sin_family, &addr->sin.sin_addr.s_addr, buf, sizeof(buf)); @@ -229,7 +229,7 @@ net_switch_add_hostaddr(net_switch_t *netswitch, net_switch_sockaddr_t *addr, ne netswitch_log("Network Switch: added %s interface %s", (flags & (IFF_LOOPBACK | IFF_BROADCAST)) ? "broadcast" : "unicast", buf); } -#ifdef ENABLE_NETSWITCH_LOG +#ifdef ENABLE_SWITCH_LOG buf[0] = '\0'; inet_ntop(hostaddr->addr_tx.sin.sin_family, &hostaddr->addr_tx.sin.sin_addr.s_addr, buf, sizeof(buf)); netswitch_log(" -> %s:%d\n", buf, ntohs(netswitch->port_out)); From 0884f9f28b9c51a79a6c322f30e807041188a593 Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 21:38:27 -0300 Subject: [PATCH 230/320] Switch: Streamline MAC address comparisons --- src/network/net_switch.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/network/net_switch.c b/src/network/net_switch.c index 2d0463e8846..2f24735d3c0 100644 --- a/src/network/net_switch.c +++ b/src/network/net_switch.c @@ -48,6 +48,7 @@ #include <86box/ini.h> #include <86box/config.h> #include <86box/net_event.h> +#include <86box/bswap.h> #define SWITCH_PKT_BATCH NET_QUEUE_LEN @@ -80,7 +81,10 @@ typedef struct net_switch_t { uint16_t port_out; uint8_t promisc; - uint8_t mac_addr[6]; + union { + uint8_t mac_addr[6]; + uint64_t mac_addr_u64; + }; netcard_t * card; /* netcard attached to us */ thread_t * poll_tid; net_evt_t tx_event; @@ -208,8 +212,8 @@ net_switch_add_hostaddr(net_switch_t *netswitch, net_switch_sockaddr_t *addr, ne hostaddr->addr_tx.sin.sin_addr.s_addr = hostaddr->addr.sin.sin_addr.s_addr | (netmask ? ~netmask->sin.sin_addr.s_addr : htonl(0x00ffffff)); ret = 0; } else if (!(flags & (IFF_BROADCAST | IFF_POINTOPOINT)) || - !broadcast || !broadcast->sin.sin_addr.s_addr || - (broadcast->sin.sin_addr.s_addr == hostaddr->addr.sin.sin_addr.s_addr)) { + !broadcast || !broadcast->sin.sin_addr.s_addr || + (broadcast->sin.sin_addr.s_addr == hostaddr->addr.sin.sin_addr.s_addr)) { /* This interface is unicast-only or P2P with a bad peer address, nothing we can do. */ netswitch_log("Network Switch: ignored %s interface %s\n", (flags & (IFF_LOOPBACK | IFF_BROADCAST)) ? "broadcast" : "unicast", buf); goto fail; @@ -401,11 +405,11 @@ net_switch_thread(void *priv) len = recv(netswitch->socket_rx, (char *) netswitch->pkt.data, NET_MAX_FRAME, 0); if (len < 12) { netswitch_log("Network Switch: recv error (%d)\n", len); - } else if (!memcmp(netswitch->mac_addr, &netswitch->pkt.data[6], 6)) { + } else if ((AS_U64(netswitch->pkt.data[6]) & le64_to_cpu(0xffffffffffffULL)) == netswitch->mac_addr_u64) { /* A packet we've sent has looped back, drop it. */ } else if (netswitch->promisc || /* promiscuous mode? */ (netswitch->pkt.data[0] & 1) || /* broadcast packet? */ - !memcmp(netswitch->mac_addr, netswitch->pkt.data, 6)) { /* packet for me? */ + ((AS_U64(netswitch->pkt.data[0]) & le64_to_cpu(0xffffffffffffULL)) == netswitch->mac_addr_u64)) { /* packet for me? */ netswitch_log("Network Switch: receiving %d-byte packet " MAC_FORMAT "\n", len, MAC_FORMAT_ARGS(netswitch->pkt.data)); netswitch->pkt.len = len; From 026ce292fb242a1e084ec60c9b1a1bcc69b0452c Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 21:51:19 -0300 Subject: [PATCH 231/320] Switch: Fix config defaults saving --- src/config.c | 35 ++++++++++++++--------------------- 1 file changed, 14 insertions(+), 21 deletions(-) diff --git a/src/config.c b/src/config.c index a6087e555c4..4455f4ae4dc 100644 --- a/src/config.c +++ b/src/config.c @@ -886,18 +886,15 @@ load_network(void) } else strcpy(nc->host_dev_name, "none"); - sprintf(temp, "net_%02i_switch_group", c + 1); - net_cards_conf[c].switch_group = ini_section_get_int(cat, temp, 0); + sprintf(temp, "net_%02i_switch_group", c + 1); + nc->switch_group = ini_section_get_int(cat, temp, 0); - sprintf(temp, "net_%02i_promisc", c + 1); - net_cards_conf[c].promisc_mode = ini_section_get_int(cat, temp, 0); + sprintf(temp, "net_%02i_promisc", c + 1); + nc->promisc_mode = ini_section_get_int(cat, temp, 0); - sprintf(temp, "net_%02i_nrs_host", c + 1); - p = ini_section_get_string(cat, temp, NULL); - if (p != NULL) - strncpy(net_cards_conf[c].nrs_hostname, p, sizeof(net_cards_conf[c].nrs_hostname) - 1); - else - strncpy(net_cards_conf[c].nrs_hostname, "", sizeof(net_cards_conf[c].nrs_hostname) - 1); + sprintf(temp, "net_%02i_nrs_host", c + 1); + p = ini_section_get_string(cat, temp, NULL); + strncpy(nc->nrs_hostname, p ? p : "", sizeof(nc->nrs_hostname) - 1); sprintf(temp, "net_%02i_link", c + 1); nc->link_state = ini_section_get_int(cat, temp, @@ -2989,26 +2986,22 @@ save_network(void) ini_section_set_int(cat, temp, nc->link_state); sprintf(temp, "net_%02i_switch_group", c + 1); - if (nc->device_num == 0) + if (nc->switch_group == 0) ini_section_delete_var(cat, temp); else - ini_section_set_int(cat, temp, net_cards_conf[c].switch_group); + ini_section_set_int(cat, temp, nc->switch_group); sprintf(temp, "net_%02i_promisc", c + 1); - if (nc->device_num == 0) + if (nc->promisc_mode == 0) ini_section_delete_var(cat, temp); else - ini_section_set_int(cat, temp, net_cards_conf[c].promisc_mode); + ini_section_set_int(cat, temp, nc->promisc_mode); sprintf(temp, "net_%02i_nrs_host", c + 1); - if (nc->device_num == 0) + if (nc->nrs_hostname[0] == '\0') ini_section_delete_var(cat, temp); - else { - if (nc->nrs_hostname[0] != '\0') - ini_section_set_string(cat, temp, net_cards_conf[c].nrs_hostname); - else - ini_section_delete_var(cat, temp); - } + else + ini_section_set_string(cat, temp, net_cards_conf[c].nrs_hostname); } ini_delete_section_if_empty(config, cat); From 06c3186858f1f1faad7003bbe51712cf52e86fff Mon Sep 17 00:00:00 2001 From: RichardG867 Date: Wed, 7 Jan 2026 22:07:00 -0300 Subject: [PATCH 232/320] Switch: Store the actual 1-based group number on the config file, and add min/max group defines --- src/config.c | 6 ++++-- src/include/86box/network.h | 2 ++ src/network/net_switch.c | 2 +- src/qt/qt_settingsnetwork.cpp | 12 ++++++------ 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/config.c b/src/config.c index 4455f4ae4dc..52eb05daeb9 100644 --- a/src/config.c +++ b/src/config.c @@ -887,7 +887,9 @@ load_network(void) strcpy(nc->host_dev_name, "none"); sprintf(temp, "net_%02i_switch_group", c + 1); - nc->switch_group = ini_section_get_int(cat, temp, 0); + nc->switch_group = ini_section_get_int(cat, temp, NET_SWITCH_GRP_MIN); + if (nc->switch_group < NET_SWITCH_GRP_MIN) + nc->switch_group = NET_SWITCH_GRP_MIN; sprintf(temp, "net_%02i_promisc", c + 1); nc->promisc_mode = ini_section_get_int(cat, temp, 0); @@ -2986,7 +2988,7 @@ save_network(void) ini_section_set_int(cat, temp, nc->link_state); sprintf(temp, "net_%02i_switch_group", c + 1); - if (nc->switch_group == 0) + if (nc->switch_group == NET_SWITCH_GRP_MIN) ini_section_delete_var(cat, temp); else ini_section_set_int(cat, temp, nc->switch_group); diff --git a/src/include/86box/network.h b/src/include/86box/network.h index cad7b9128b9..0642c3f53cf 100644 --- a/src/include/86box/network.h +++ b/src/include/86box/network.h @@ -60,6 +60,8 @@ #define NET_QUEUE_COUNT 4 #define NET_CARD_MAX 4 #define NET_HOST_INTF_MAX 64 +#define NET_SWITCH_GRP_MIN 1 +#define NET_SWITCH_GRP_MAX 10 #define NET_PERIOD_10M 0.8 #define NET_PERIOD_100M 0.08 diff --git a/src/network/net_switch.c b/src/network/net_switch.c index 2f24735d3c0..5fc3a209178 100644 --- a/src/network/net_switch.c +++ b/src/network/net_switch.c @@ -469,7 +469,7 @@ net_switch_init(const netcard_t *card, const uint8_t *mac_addr, void *priv, char val = 0; setsockopt(netswitch->socket_rx, IPPROTO_IP, IP_MULTICAST_LOOP, (char *) &val, sizeof(val)); - netswitch->port_out = htons(SWITCH_MULTICAST_PORT + netcard->switch_group); + netswitch->port_out = htons(SWITCH_MULTICAST_PORT - NET_SWITCH_GRP_MIN + netcard->switch_group); struct sockaddr_in addr = { .sin_family = AF_INET, .sin_addr = { .s_addr = htonl(INADDR_ANY) }, diff --git a/src/qt/qt_settingsnetwork.cpp b/src/qt/qt_settingsnetwork.cpp index 9297810751e..878944e6005 100644 --- a/src/qt/qt_settingsnetwork.cpp +++ b/src/qt/qt_settingsnetwork.cpp @@ -54,8 +54,8 @@ SettingsNetwork::enableElements(Ui::SettingsNetwork *ui) // auto *switch_group_hlayout = findChild(QString("HLayoutSwitch%1").arg(i + 1)); // auto *switch_group_hspacer = findChild(QString("horizontalSpacerSwitch%1").arg(i + 1)); auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); - switch_group_value->setMinimum(1); - switch_group_value->setMaximum(10); + switch_group_value->setMinimum(NET_SWITCH_GRP_MIN); + switch_group_value->setMaximum(NET_SWITCH_GRP_MAX); // Promiscuous option auto *promisc_label = findChild(QString("labelPromisc%1").arg(i + 1)); @@ -230,10 +230,10 @@ SettingsNetwork::save() else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) { memset(net_cards_conf[i].nrs_hostname, '\0', sizeof(net_cards_conf[i].nrs_hostname)); strncpy(net_cards_conf[i].nrs_hostname, hostname_value->text().toUtf8().constData(), sizeof(net_cards_conf[i].nrs_hostname) - 1); - net_cards_conf[i].switch_group = switch_group_value->value() - 1; + net_cards_conf[i].switch_group = switch_group_value->value(); } else if (net_cards_conf[i].net_type == NET_TYPE_NLSWITCH) { net_cards_conf[i].promisc_mode = promisc_value->isChecked(); - net_cards_conf[i].switch_group = switch_group_value->value() - 1; + net_cards_conf[i].switch_group = switch_group_value->value(); } } } @@ -350,12 +350,12 @@ SettingsNetwork::onCurrentMachineChanged(int machineId) auto *promisc_value = findChild(QString("boxPromisc%1").arg(i + 1)); promisc_value->setCheckState(net_cards_conf[i].promisc_mode == 1 ? Qt::CheckState::Checked : Qt::CheckState::Unchecked); auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); - switch_group_value->setValue(net_cards_conf[i].switch_group + 1); + switch_group_value->setValue(net_cards_conf[i].switch_group); } else if (net_cards_conf[i].net_type == NET_TYPE_NRSWITCH) { auto *hostname_value = findChild(QString("hostnameSwitch%1").arg(i + 1)); hostname_value->setText(net_cards_conf[i].nrs_hostname); auto *switch_group_value = findChild(QString("spinnerSwitch%1").arg(i + 1)); - switch_group_value->setValue(net_cards_conf[i].switch_group + 1); + switch_group_value->setValue(net_cards_conf[i].switch_group); } } } From 023763d0a8c4606bde43ad6807899db718efd9b1 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 8 Jan 2026 16:41:50 +0600 Subject: [PATCH 233/320] DEC Tulip: Make PCI bars instanced --- src/network/net_tulip.c | 62 ++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/src/network/net_tulip.c b/src/network/net_tulip.c index a575a4cfbf1..298cda23292 100644 --- a/src/network/net_tulip.c +++ b/src/network/net_tulip.c @@ -291,8 +291,6 @@ #define ETH_ALEN 6 -static bar_t tulip_pci_bar[3]; - struct tulip_descriptor { uint32_t status; uint32_t control; @@ -338,6 +336,8 @@ struct TULIPState { uint32_t bios_addr; uint8_t filter[16][6]; int has_bios; + + bar_t tulip_pci_bar[3]; }; typedef struct TULIPState TULIPState; @@ -1228,34 +1228,34 @@ tulip_pci_read(UNUSED(int func), int addr, void *priv) ret = 0x02; break; case 0x10: - ret = (tulip_pci_bar[0].addr_regs[0] & 0x80) | 0x01; + ret = (s->tulip_pci_bar[0].addr_regs[0] & 0x80) | 0x01; break; case 0x11: - ret = tulip_pci_bar[0].addr_regs[1]; + ret = s->tulip_pci_bar[0].addr_regs[1]; break; case 0x12: - ret = tulip_pci_bar[0].addr_regs[2]; + ret = s->tulip_pci_bar[0].addr_regs[2]; break; case 0x13: - ret = tulip_pci_bar[0].addr_regs[3]; + ret = s->tulip_pci_bar[0].addr_regs[3]; break; #ifdef USE_128_BYTE_BAR case 0x14: - ret = (tulip_pci_bar[1].addr_regs[0] & 0x80); + ret = (s->tulip_pci_bar[1].addr_regs[0] & 0x80); break; #endif case 0x15: #ifdef USE_128_BYTE_BAR - ret = tulip_pci_bar[1].addr_regs[1]; + ret = s->tulip_pci_bar[1].addr_regs[1]; #else - ret = tulip_pci_bar[1].addr_regs[1] & 0xf0; + ret = s->tulip_pci_bar[1].addr_regs[1] & 0xf0; #endif break; case 0x16: - ret = tulip_pci_bar[1].addr_regs[2]; + ret = s->tulip_pci_bar[1].addr_regs[2]; break; case 0x17: - ret = tulip_pci_bar[1].addr_regs[3]; + ret = s->tulip_pci_bar[1].addr_regs[3]; break; case 0x2C: ret = s->subsys_ven_id & 0xFF; @@ -1270,16 +1270,16 @@ tulip_pci_read(UNUSED(int func), int addr, void *priv) ret = s->subsys_id >> 8; break; case 0x30: - ret = (tulip_pci_bar[2].addr_regs[0] & 0x01); + ret = (s->tulip_pci_bar[2].addr_regs[0] & 0x01); break; case 0x31: - ret = tulip_pci_bar[2].addr_regs[1]; + ret = s->tulip_pci_bar[2].addr_regs[1]; break; case 0x32: - ret = tulip_pci_bar[2].addr_regs[2]; + ret = s->tulip_pci_bar[2].addr_regs[2]; break; case 0x33: - ret = tulip_pci_bar[2].addr_regs[3]; + ret = s->tulip_pci_bar[2].addr_regs[3]; break; case 0x3C: ret = s->pci_conf[0x3C]; @@ -1333,9 +1333,9 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) tulip_readb_io, tulip_readw_io, tulip_readl_io, tulip_writeb_io, tulip_writew_io, tulip_writel_io, priv); - tulip_pci_bar[0].addr_regs[addr & 3] = val; - tulip_pci_bar[0].addr &= 0xffffff80; - s->PCIBase = tulip_pci_bar[0].addr; + s->tulip_pci_bar[0].addr_regs[addr & 3] = val; + s->tulip_pci_bar[0].addr &= 0xffffff80; + s->PCIBase = s->tulip_pci_bar[0].addr; if (s->pci_conf[0x4] & PCI_COMMAND_IO) { //pclog("PCI write=%02x, base=%04x, io?=%x.\n", addr, s->PCIBase, s->pci_conf[0x4] & PCI_COMMAND_IO); if (s->PCIBase != 0) @@ -1352,13 +1352,13 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) case 0x16: case 0x17: mem_mapping_disable(&s->memory); - tulip_pci_bar[1].addr_regs[addr & 3] = val; + s->tulip_pci_bar[1].addr_regs[addr & 3] = val; #ifdef USE_128_BYTE_BAR - tulip_pci_bar[1].addr &= 0xffffff80; + s->tulip_pci_bar[1].addr &= 0xffffff80; #else - tulip_pci_bar[1].addr &= 0xfffff000; + s->tulip_pci_bar[1].addr &= 0xfffff000; #endif - s->MMIOBase = tulip_pci_bar[1].addr; + s->MMIOBase = s->tulip_pci_bar[1].addr; if (s->pci_conf[0x4] & PCI_COMMAND_MEM) { //pclog("PCI write=%02x, mmiobase=%08x, mmio?=%x.\n", addr, s->PCIBase, s->pci_conf[0x4] & PCI_COMMAND_MEM); if (s->MMIOBase != 0) @@ -1377,10 +1377,10 @@ tulip_pci_write(UNUSED(int func), int addr, uint8_t val, void *priv) return; mem_mapping_disable(&s->bios_rom.mapping); - tulip_pci_bar[2].addr_regs[addr & 3] = val; - tulip_pci_bar[2].addr &= 0xffff0001; - s->bios_addr = tulip_pci_bar[2].addr & 0xffff0000; - if (tulip_pci_bar[2].addr_regs[0] & 0x01) { + s->tulip_pci_bar[2].addr_regs[addr & 3] = val; + s->tulip_pci_bar[2].addr &= 0xffff0001; + s->bios_addr = s->tulip_pci_bar[2].addr & 0xffff0000; + if (s->tulip_pci_bar[2].addr_regs[0] & 0x01) { if (s->bios_addr != 0) mem_mapping_set_addr(&s->bios_rom.mapping, s->bios_addr, 0x10000); } @@ -1652,16 +1652,16 @@ nic_init(const device_t *info) } } - tulip_pci_bar[0].addr_regs[0] = 1; - tulip_pci_bar[1].addr_regs[0] = 0; - s->pci_conf[0x04] = 7; + s->tulip_pci_bar[0].addr_regs[0] = 1; + s->tulip_pci_bar[1].addr_regs[0] = 0; + s->pci_conf[0x04] = 7; /* Enable our BIOS space in PCI, if needed. */ if (s->has_bios) { rom_init(&s->bios_rom, ROM_PATH_DEC21140, s->bios_addr, 0x10000, 0xffff, 0, MEM_MAPPING_EXTERNAL); - tulip_pci_bar[2].addr = 0xffff0000; + s->tulip_pci_bar[2].addr = 0xffff0000; } else - tulip_pci_bar[2].addr = 0; + s->tulip_pci_bar[2].addr = 0; mem_mapping_disable(&s->bios_rom.mapping); eeprom_data = (info->local == 3) ? s->eeprom_data : (uint8_t *) &nmc93cxx_eeprom_data(s->eeprom)[0]; From 75cfe2bc7d53ad3801ad3fa323cffcc55ef8ecf9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 8 Jan 2026 18:46:23 +0600 Subject: [PATCH 234/320] Add fast forward option --- src/qt/languages/86box.pot | 3 +++ src/qt/qt_main.cpp | 6 ++++-- src/qt/qt_mainwindow.cpp | 7 +++++++ src/qt/qt_mainwindow.hpp | 1 + src/qt/qt_mainwindow.ui | 16 ++++++++++++++++ src/sound/audio4.c | 4 +++- src/sound/openal.c | 6 ++++-- src/sound/sndio.c | 4 +++- src/sound/xaudio2.c | 5 ++++- src/unix/unix.c | 5 +++-- 10 files changed, 48 insertions(+), 9 deletions(-) diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index e04c73f2ac1..cbf086210b4 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -3002,3 +3002,6 @@ msgstr "" msgid "&Allow recompilation" msgstr "" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/qt_main.cpp b/src/qt/qt_main.cpp index 1d362dd62e7..9d55ba7caa7 100644 --- a/src/qt/qt_main.cpp +++ b/src/qt/qt_main.cpp @@ -100,6 +100,7 @@ extern int qt_nvr_save(void); extern void exit_pause(void); bool cpu_thread_running = false; +bool fast_forward = false; } #include @@ -452,7 +453,7 @@ main_thread_fn() #endif drawits += static_cast(new_time - old_time); old_time = new_time; - if (drawits > 0 && !dopause) { + if ((drawits > 0 || fast_forward) && !dopause) { /* Yes, so run frames now. */ do { #ifdef USE_INSTRUMENT @@ -478,8 +479,9 @@ main_thread_fn() } drawits -= force_10ms ? 10 : 1; - if (drawits > 50) + if (drawits > 50 || fast_forward) drawits = 0; + } while (drawits > 0); } else { /* Just so we dont overload the host OS. */ diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 35fd05491cc..79380ecb406 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -65,6 +65,7 @@ extern int qt_nvr_save(void); #endif extern bool cpu_thread_running; +extern bool fast_forward; }; #include @@ -2135,6 +2136,12 @@ MainWindow::on_actionUpdate_mouse_every_CPU_frame_triggered() config_save(); } +void +MainWindow::on_action_Fast_forward_triggered() +{ + fast_forward ^= 1; +} + void MainWindow::on_actionRemember_size_and_position_triggered() { diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index e1c0c7409b8..98096a54a7d 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -141,6 +141,7 @@ private slots: void on_actionPreferences_triggered(); void on_actionEnable_Discord_integration_triggered(bool checked); void on_actionRenderer_options_triggered(); + void on_action_Fast_forward_triggered(); void refreshMediaMenu(); void showMessage_(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool *done = nullptr); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 47744b38f3c..4592f1ed65c 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -78,6 +78,8 @@ + + @@ -311,6 +313,8 @@ + + @@ -1069,6 +1073,18 @@ &8x + + + true + + + + :/settings/qt/icons/fast_forward.ico:/settings/qt/icons/fast_forward.ico + + + &Fast forward + + diff --git a/src/sound/audio4.c b/src/sound/audio4.c index dcff2068dcf..48b0a6ce1db 100644 --- a/src/sound/audio4.c +++ b/src/sound/audio4.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -41,6 +42,7 @@ #define I_MIDI 6 static int audio[7] = {-1, -1, -1, -1, -1, -1, -1}; +extern bool fast_forward; #ifdef USE_NEW_API static struct audio_swpar info[7]; @@ -104,7 +106,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size) double gain; int target_rate; - if(audio[src] == -1) + if(audio[src] == -1 || fast_forward) return; gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0); diff --git a/src/sound/openal.c b/src/sound/openal.c index 598709de9f6..399e4ac8e24 100644 --- a/src/sound/openal.c +++ b/src/sound/openal.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #undef AL_API #undef ALC_API @@ -313,6 +314,7 @@ inital(void) initialized = 1; } +extern bool fast_forward; void givealbuffer_common(const void *buf, const uint8_t src, const int size, const int freq) { @@ -320,7 +322,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in int state; ALuint buffer; - if (!initialized) + if (!initialized || fast_forward) return; alGetSourcei(source[src], AL_SOURCE_STATE, &state); @@ -331,7 +333,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size, const in alGetSourcei(source[src], AL_BUFFERS_PROCESSED, &processed); if (processed >= 1) { - const double gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0); + const double gain = (sound_muted) ? 0.0 : pow(10.0, (double) sound_gain / 20.0); alListenerf(AL_GAIN, (float) gain); alSourceUnqueueBuffers(source[src], 1, &buffer); diff --git a/src/sound/sndio.c b/src/sound/sndio.c index d572652ae47..3f8c90b897a 100644 --- a/src/sound/sndio.c +++ b/src/sound/sndio.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,7 @@ #define I_FDD 5 #define I_HDD 6 +extern bool fast_forward; static struct sio_hdl* audio[7] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL}; static struct sio_par info[7]; static int freqs[7] = { SOUND_FREQ, MUSIC_FREQ, WT_FREQ, CD_FREQ, SOUND_FREQ, SOUND_FREQ, 0 }; @@ -83,7 +85,7 @@ givealbuffer_common(const void *buf, const uint8_t src, const int size) int conv_size; double gain; int target_rate; - if (audio[src] == NULL) + if (audio[src] == NULL || fast_forward) return; gain = sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0); diff --git a/src/sound/xaudio2.c b/src/sound/xaudio2.c index 7833af435b1..4d109bce9ec 100644 --- a/src/sound/xaudio2.c +++ b/src/sound/xaudio2.c @@ -14,6 +14,7 @@ */ #include #include +#include #include #include #include @@ -56,6 +57,8 @@ static IXAudio2SourceVoice *srcvoicecd = NULL; static IXAudio2SourceVoice *srcvoicefdd = NULL; static IXAudio2SourceVoice *srcvoicehdd = NULL; +extern bool fast_forward; + #define FREQ SOUND_FREQ #define BUFLEN SOUNDBUFLEN @@ -258,7 +261,7 @@ closeal(void) void givealbuffer_common(const void *buf, IXAudio2SourceVoice *sourcevoice, const size_t buflen) { - if (!initialized) + if (!initialized || fast_forward) return; (void) IXAudio2MasteringVoice_SetVolume(mastervoice, sound_muted ? 0.0 : pow(10.0, (double) sound_gain / 20.0), diff --git a/src/unix/unix.c b/src/unix/unix.c index b417d38bd9d..ed16c20c619 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -63,6 +63,7 @@ int update_icons; int kbd_req_capture; int hide_status_bar; int hide_tool_bar; +bool fast_forward = false; // Technically unused. int fixed_size_x = 640; int fixed_size_y = 480; extern int title_set; @@ -596,10 +597,10 @@ main_thread(UNUSED(void *param)) #endif old_time = new_time; - if (drawits > 0 && !dopause) { + if ((drawits > 0 || fast_forward) && !dopause) { /* Yes, so do one frame now. */ drawits -= force_10ms ? 10 : 1; - if (drawits > 50) + if (drawits > 50 || fast_forward) drawits = 0; /* Run a block of code. */ From 0a367bdfc6044d2cfc5502d5df314487c3f64459 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Thu, 8 Jan 2026 22:11:39 +0600 Subject: [PATCH 235/320] Fix some crashes on hard reset if cassette is enabled --- src/qt/qt_machinestatus.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/qt_machinestatus.cpp b/src/qt/qt_machinestatus.cpp index 9773c404db4..e6f6c824e81 100644 --- a/src/qt/qt_machinestatus.cpp +++ b/src/qt/qt_machinestatus.cpp @@ -542,7 +542,7 @@ void MachineStatus::refreshIcons() { /* Always show record/play statuses of cassette even if icon updates are disabled, since it's important to indicate play/record modes. */ - if (cassette_enable) { + if (cassette_enable && cassette) { d->cassette.setRecord(!!cassette->save); d->cassette.setPlay(!cassette->save); } From 3b336dd0b02c0c838455e495569154c685ef5c73 Mon Sep 17 00:00:00 2001 From: OBattler Date: Thu, 8 Jan 2026 18:05:51 +0100 Subject: [PATCH 236/320] Regroup the toolbar buttons more sensibly. --- src/qt/qt_mainwindow.cpp | 2 +- src/qt/qt_mainwindow.hpp | 2 +- src/qt/qt_mainwindow.ui | 8 +++----- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 79380ecb406..231d49112e7 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -2137,7 +2137,7 @@ MainWindow::on_actionUpdate_mouse_every_CPU_frame_triggered() } void -MainWindow::on_action_Fast_forward_triggered() +MainWindow::on_actionFast_forward_triggered() { fast_forward ^= 1; } diff --git a/src/qt/qt_mainwindow.hpp b/src/qt/qt_mainwindow.hpp index 98096a54a7d..2fa2ab3b981 100644 --- a/src/qt/qt_mainwindow.hpp +++ b/src/qt/qt_mainwindow.hpp @@ -141,7 +141,7 @@ private slots: void on_actionPreferences_triggered(); void on_actionEnable_Discord_integration_triggered(bool checked); void on_actionRenderer_options_triggered(); - void on_action_Fast_forward_triggered(); + void on_actionFast_forward_triggered(); void refreshMediaMenu(); void showMessage_(int flags, const QString &header, const QString &message, bool richText, std::atomic_bool *done = nullptr); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 4592f1ed65c..ec5d245cb64 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -78,7 +78,7 @@ - + @@ -302,8 +302,8 @@ false + - @@ -313,8 +313,6 @@ - - @@ -1073,7 +1071,7 @@ &8x - + true From f5fd37bbf128350bf969f3eaa64fac4fe36a80b2 Mon Sep 17 00:00:00 2001 From: GreaseMonkey Date: Fri, 9 Jan 2026 10:01:17 +1300 Subject: [PATCH 237/320] Add [i440EX] HP Brio 83xx machine I personally own a Brio 8314 and have run tests on it. --- src/include/86box/machine.h | 1 + src/machine/m_at_slot1.c | 39 +++++++++++++++++++++++++++++ src/machine/machine_table.c | 49 +++++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 982abda3fbe..c648ea4f40c 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1203,6 +1203,7 @@ extern int machine_at_spitfire_init(const machine_t *); extern int machine_at_ma30d_init(const machine_t *); /* i440EX */ +extern int machine_at_brio83xx_init(const machine_t *); extern int machine_at_p6i440e2_init(const machine_t *); /* i440BX */ diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 8708377136f..578814a8f7a 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -344,6 +344,45 @@ machine_at_ma30d_init(const machine_t *model) } /* i440EX */ +int +machine_at_brio83xx_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/brio83xx/QHL0700.rom", + 0x000c0000, 262144, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + // Actual settings! + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 1, 2, 3, 4); /* Onboard */ + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); /* Onboard */ + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); /* Onboard */ + pci_register_slot(0x0F, PCI_CARD_NORMAL, 1, 2, 3, 4); /* Slot 01 */ + pci_register_slot(0x10, PCI_CARD_NORMAL, 2, 3, 4, 1); /* Slot 02 */ + pci_register_slot(0x12, PCI_CARD_NORMAL, 3, 4, 1, 2); /* Slot 03 */ + pci_register_slot(0x14, PCI_CARD_VIDEO, 1, 2, 3, 4); /* Onboard */ + + if (gfxcard[0] == VID_INTERNAL) + device_add(&s3_trio64v2_dx_onboard_pci_device); + + device_add(&i440ex_device); + device_add(&piix4_device); + + device_add_params(&fdc37c67x_device, (void *) (FDC37XXX5)); + + /* Chip not quite confirmed, but this does operate fine. */ + device_add(&sst_flash_29ee020_device); + + spd_register(SPD_TYPE_SDRAM, 0x3, 256); + + return ret; +} + int machine_at_p6i440e2_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index fcfc83839a3..a1feb86f621 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -18265,6 +18265,55 @@ const machine_t machines[] = { }, /* 440EX */ + /* Has a SM(S)C FDC37C675 Super I/O chip with on-chip KBC with Phoenix + MultiKey/42 (version 1.38) KBC firmware. */ + { + .name = "[i440EX] HP Brio 83xx", + .internal_name = "brio83xx", + .type = MACHINE_TYPE_SLOT1, + .chipset = MACHINE_CHIPSET_INTEL_440EX, + .init = machine_at_brio83xx_init, + .p1_handler = NULL, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SLOT1, + .block = CPU_BLOCK_NONE, + .min_bus = 66666667, + .max_bus = 66666667, + /* NOTE: Range not confirmed. */ + .min_voltage = 1800, + .max_voltage = 3500, + .min_multi = 1.5, + .max_multi = 8.0 + }, + .bus_flags = MACHINE_PS2_AGP | MACHINE_BUS_USB, + .flags = MACHINE_IDE_DUAL | MACHINE_VIDEO | MACHINE_APM | MACHINE_ACPI | MACHINE_USB, + .ram = { + /* PC manual says 128 MB max, but 256 MB confirmed to work + and 512 MB confirmed to not work. */ + .min = 8192, + .max = 262144, + .step = 8192 + }, + .nvrmask = 255, + .jumpered_ecp_dma = 0, + .default_jumpered_ecp_dma = -1, + .kbc_device = NULL, + .kbc_params = 0x00000000, + .kbc_p1 = 0x00000cf0, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = NULL, + .kbd_device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = &s3_trio64v2_dx_onboard_pci_device, + .snd_device = NULL, + .net_device = NULL + }, + /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ { From 40c00d7878d41239661bbe7c395f3a00b5318265 Mon Sep 17 00:00:00 2001 From: GreaseMonkey Date: Fri, 9 Jan 2026 10:59:47 +1300 Subject: [PATCH 238/320] Update Brio 83xx KBC p1 handler information This is probably closer to how it's supposed to be. I think I had some freak accident happen while testing and hard disk accesses were broken somehow, but things seem to be working fine now? --- src/machine/machine_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index a1feb86f621..86729cd66d8 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -18273,7 +18273,7 @@ const machine_t machines[] = { .type = MACHINE_TYPE_SLOT1, .chipset = MACHINE_CHIPSET_INTEL_440EX, .init = machine_at_brio83xx_init, - .p1_handler = NULL, + .p1_handler = machine_generic_p1_handler, .gpio_handler = NULL, .available_flag = MACHINE_AVAILABLE, .gpio_acpi_handler = NULL, From e0de4c7f87e127fbc5288a95a350849d95265841 Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Thu, 8 Jan 2026 23:48:37 +0100 Subject: [PATCH 239/320] Refactor dirty line calculation --- src/video/vid_voodoo_render.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/video/vid_voodoo_render.c b/src/video/vid_voodoo_render.c index b25f4250775..19dedfa7aaa 100644 --- a/src/video/vid_voodoo_render.c +++ b/src/video/vid_voodoo_render.c @@ -1389,8 +1389,11 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * voodoo->texel_count[odd_even] += state->texel_count; voodoo->fbiPixelsIn += state->pixel_count; - if (voodoo->params.draw_offset == voodoo->params.front_offset && (real_y >> 1) < 2048) - voodoo->dirty_line[real_y >> 1] = 1; + if (voodoo->params.draw_offset == voodoo->params.front_offset) { + int dirty_idx = SLI_ENABLED ? (real_y >> 1) : real_y; + if (dirty_idx < 2048) + voodoo->dirty_line[dirty_idx] = 1; + } next_line: if (SLI_ENABLED) { From c4b482234eebd31c95e52351c8cba9e5b2ab14cb Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Fri, 9 Jan 2026 13:32:48 +0700 Subject: [PATCH 240/320] Alphabetize the video card/chip order properly Also slightly correct the name for TriGem --- src/video/vid_et4000.c | 8 +++---- src/video/vid_table.c | 48 +++++++++++++++++++++--------------------- 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/video/vid_et4000.c b/src/video/vid_et4000.c index c17495c1e89..608cc9601d5 100644 --- a/src/video/vid_et4000.c +++ b/src/video/vid_et4000.c @@ -57,7 +57,7 @@ #define ET4000_TYPE_ISA 1 /* ISA ET4000AX */ #define ET4000_TYPE_MCA 2 /* MCA ET4000AX */ #define ET4000_TYPE_KOREAN 3 /* Korean ET4000 */ -#define ET4000_TYPE_TRIGEM 4 /* Trigem 286M ET4000 */ +#define ET4000_TYPE_TRIGEM 4 /* TriGem 286M ET4000 */ #define ET4000_TYPE_KASAN 5 /* Kasan ET4000 */ #define BIOS_ROM_PATH "roms/video/et4000/ET4000.BIN" @@ -829,7 +829,7 @@ et4000_init(const device_t *info) break; case ET4000_TYPE_KOREAN: /* Korean ET4000 */ - case ET4000_TYPE_TRIGEM: /* Trigem 286M ET4000 */ + case ET4000_TYPE_TRIGEM: /* TriGem 286M ET4000 */ dev->vram_size = device_get_config_int("memory") << 10; dev->port_22cb_val = 0x60; dev->port_32cb_val = 0; @@ -1133,7 +1133,7 @@ const device_t et4000_mca_device = { }; const device_t et4000k_isa_device = { - .name = "Trigem Korean VGA (Tseng Labs ET4000AX Korean)", + .name = "TriGem Korean VGA (Tseng Labs ET4000AX Korean)", .internal_name = "tgkorvga", .flags = DEVICE_ISA, .local = ET4000_TYPE_KOREAN, @@ -1147,7 +1147,7 @@ const device_t et4000k_isa_device = { }; const device_t et4000k_tg286_isa_device = { - .name = "Trigem Korean VGA (Trigem 286M)", + .name = "TriGem Korean VGA (TriGem 286M)", .internal_name = "et4000k_tg286_isa", .flags = DEVICE_ISA, .local = ET4000_TYPE_TRIGEM, diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 3e637f158a7..096bfd6eeec 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -73,6 +73,7 @@ video_cards[] = { { .device = &compaq_cga_2_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &cpqega_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &g2_gc205_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &genius_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &hercules_device, .flags = VIDEO_FLAG_TYPE_MDA }, { .device = &herculesplus_device, .flags = VIDEO_FLAG_TYPE_MDA }, { .device = &incolor_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -85,7 +86,6 @@ video_cards[] = { { .device = &iskra_ega_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &jega_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &et4000_kasan_isa_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &genius_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &nga_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &nec_sv9000_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &ogc_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -183,6 +183,10 @@ video_cards[] = { { .device = &tgui9400cxi_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &tgui9440_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, /* PCI */ + { .device = &voodoo_banshee_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &voodoo_3_1000_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &voodoo_3_2000_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &voodoo_3_3000_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &mach32_pci_device, .flags = VIDEO_FLAG_TYPE_8514 }, { .device = &mach64gx_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &mach64ct_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -197,10 +201,12 @@ video_cards[] = { { .device = &gd5446_pci_device, .flags = VIDEO_FLAG_TYPE_SECONDARY }, { .device = &gd5446_stb_pci_device, .flags = VIDEO_FLAG_TYPE_SECONDARY }, { .device = &gd5480_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_cardex_revc_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_generic_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_cardex_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_diamond_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &creative_voodoo_banshee_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &millennium_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &millennium_ii_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &mystique_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &mystique_220_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &quantum3d_raven_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_elsa_winner1000_86c928_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_spea_mercury_lite_86c928_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_diamond_stealth64_964_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -234,36 +240,30 @@ video_cards[] = { { .device = &s3_virge_385_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_virge_357_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_trio3d2x_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &millennium_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &millennium_ii_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &mystique_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &mystique_220_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &tgui9440_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &tgui9660_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &tgui9680_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_banshee_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &creative_voodoo_banshee_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &quantum3d_raven_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_3_1000_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_3_2000_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_3_3000_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_cardex_revc_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_generic_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_cardex_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_diamond_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, /* AGP */ - { .device = &s3_virge_357_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &s3_diamond_stealth_4000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &s3_trio3d2x_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, -#ifdef USE_G100 - { .device = &productiva_g100_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, -#endif /*USE_G100 */ + { .device = &voodoo_3_3500_agp_pal_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &compaq_voodoo_3_3500_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &voodoo_3_3500_se_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &velocity_100_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &velocity_200_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_1000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_2000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_agp_ntsc_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_3_3500_agp_pal_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &compaq_voodoo_3_3500_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_3_3500_se_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_si_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, +#ifdef USE_G100 + { .device = &productiva_g100_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, +#endif /*USE_G100 */ + { .device = &s3_virge_357_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &s3_diamond_stealth_4000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &s3_trio3d2x_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = NULL, .flags = VIDEO_FLAG_TYPE_NONE } // clang-format on }; From 727568bb91dd7fafda87605d4e861a6cea3b6e8e Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Fri, 9 Jan 2026 13:36:58 +0700 Subject: [PATCH 241/320] Fixed the alphabetization for Voodoo3 3500 (PAL) --- src/video/vid_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 096bfd6eeec..8a2ae888056 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -248,7 +248,6 @@ video_cards[] = { { .device = &et4000w32p_cardex_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &et4000w32p_diamond_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, /* AGP */ - { .device = &voodoo_3_3500_agp_pal_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &compaq_voodoo_3_3500_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_se_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &velocity_100_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -257,6 +256,7 @@ video_cards[] = { { .device = &voodoo_3_2000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_agp_ntsc_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &voodoo_3_3500_agp_pal_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_si_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, #ifdef USE_G100 { .device = &productiva_g100_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, From 30284bee3656e43f685ed318a378fdd06b107bfa Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Fri, 9 Jan 2026 14:43:25 +0600 Subject: [PATCH 242/320] Add placeholder translation strings --- src/qt/languages/ca-ES.po | 3 +++ src/qt/languages/cs-CZ.po | 3 +++ src/qt/languages/de-DE.po | 3 +++ src/qt/languages/el-GR.po | 3 +++ src/qt/languages/es-ES.po | 3 +++ src/qt/languages/fi-FI.po | 3 +++ src/qt/languages/fr-FR.po | 3 +++ src/qt/languages/hr-HR.po | 3 +++ src/qt/languages/it-IT.po | 3 +++ src/qt/languages/ja-JP.po | 3 +++ src/qt/languages/ko-KR.po | 3 +++ src/qt/languages/nb-NO.po | 3 +++ src/qt/languages/nl-NL.po | 3 +++ src/qt/languages/pl-PL.po | 3 +++ src/qt/languages/pt-BR.po | 3 +++ src/qt/languages/pt-PT.po | 3 +++ src/qt/languages/ru-RU.po | 3 +++ src/qt/languages/sk-SK.po | 3 +++ src/qt/languages/sl-SI.po | 3 +++ src/qt/languages/sv-SE.po | 3 +++ src/qt/languages/tr-TR.po | 3 +++ src/qt/languages/uk-UA.po | 3 +++ src/qt/languages/vi-VN.po | 3 +++ src/qt/languages/zh-CN.po | 3 +++ src/qt/languages/zh-TW.po | 3 +++ 25 files changed, 75 insertions(+) diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index 314b12e3ea1..d7e279110af 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -3008,3 +3008,6 @@ msgstr "&Força interpretació" msgid "&Allow recompilation" msgstr "&Permetre recompilació" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 2c65067ab39..e82f95f2681 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -3008,3 +3008,6 @@ msgstr "&Vynutit interpretaci" msgid "&Allow recompilation" msgstr "&Povolit rekompilaci" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 634069dd7d5..ad7e66b08d2 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -3008,3 +3008,6 @@ msgstr "&Erzwingen der Interpretation" msgid "&Allow recompilation" msgstr "Recompilierung &zulassen" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 6b3e1299048..db28daa81aa 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -3065,3 +3065,6 @@ msgstr "&Εξαναγκασμός ερμηνείας" msgid "&Allow recompilation" msgstr "&Να επιτρέπεται ανασύνταξη" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 83bdb5d3f5b..f64574e713a 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -3008,3 +3008,6 @@ msgstr "&Forzar interpretación" msgid "&Allow recompilation" msgstr "&Permitir recompilación" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index f5cd64b9094..987e73529fd 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -3008,3 +3008,6 @@ msgstr "&Pakota tulkinta" msgid "&Allow recompilation" msgstr "&Salli uudelleenkääntäminen" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index bb1857e9975..976d9afb094 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -3008,3 +3008,6 @@ msgstr "&Forcer l'interprétation" msgid "&Allow recompilation" msgstr "&Permettre la recompilation" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 882da52b5e3..15c2b39cb69 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -3010,3 +3010,6 @@ msgstr "&Prisilna interpretacija" msgid "&Allow recompilation" msgstr "&Omogući rekompilaciju" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 7c76f0cbec0..0a675ac1add 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -3008,3 +3008,6 @@ msgstr "&Forza interpretazione" msgid "&Allow recompilation" msgstr "&Permetti ricompilazione" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index d9eba264666..8371ac36e8f 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -3009,3 +3009,6 @@ msgstr "解釈を強制する(&F)" msgid "&Allow recompilation" msgstr "再コンパイルを許可する(&A)" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 51b77209d4a..12f67f14f4f 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -3002,3 +3002,6 @@ msgstr "강제 해석(&F)" msgid "&Allow recompilation" msgstr "재컴파일 허용(&A)" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index 4da9f607370..c6c27836bf9 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -3002,3 +3002,6 @@ msgstr "&Tving tolkning" msgid "&Allow recompilation" msgstr "&Tillat rekompilering" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index abaae4a9873..3b10383f726 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -3002,3 +3002,6 @@ msgstr "Interpretatie &afdwingen" msgid "&Allow recompilation" msgstr "Recompilatie &toestaan" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 02a24fa2ca7..2b9610084d7 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -3009,3 +3009,6 @@ msgstr "&Wymuś interpretację" msgid "&Allow recompilation" msgstr "&Zezwól na rekompilację" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 02e13e571b6..b82c1a7c98a 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -3002,3 +3002,6 @@ msgstr "&Forçar interpretação" msgid "&Allow recompilation" msgstr "&Permitir recompilação" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 5b3aaececa7..b68b91a8b5e 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -3009,3 +3009,6 @@ msgstr "&Forçar interpretação" msgid "&Allow recompilation" msgstr "&Permitir recompilação" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 8f3e611ad03..b39d0d84c43 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -3021,3 +3021,6 @@ msgstr "&Принудительная интерпретация" msgid "&Allow recompilation" msgstr "&Разрешить рекомпиляцию" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 0310f6938cc..3586f6c127b 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -3008,3 +3008,6 @@ msgstr "&Vynútiť interpretáciu" msgid "&Allow recompilation" msgstr "&Povoliť rekompiláciu" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 4e31b36da71..a7cf7dc29bb 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -3010,3 +3010,6 @@ msgstr "&Vsili interpretacijo" msgid "&Allow recompilation" msgstr "&Dovoli prevajanje" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index d937828f9e3..3cac62eaf79 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -3002,3 +3002,6 @@ msgstr "&Tvinga tolkning" msgid "&Allow recompilation" msgstr "&Tillåt omkompilering" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 036cf72bb99..22ccc4910ef 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -3008,3 +3008,6 @@ msgstr "&Yorumlanmasını zorla" msgid "&Allow recompilation" msgstr "&Derlenmesine izin ver" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index f9ff3e4674b..0fb2c803377 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -3010,3 +3010,6 @@ msgstr "&Примусове тлумачення" msgid "&Allow recompilation" msgstr "&Дозволити рекомпіляцію" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index e4d7a806de4..35782e86d4c 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -3002,3 +3002,6 @@ msgstr "&Buộc giải thích" msgid "&Allow recompilation" msgstr "&Cho phép biên dịch lại" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index cea569a6f8e..d99fb54d5c1 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -3002,3 +3002,6 @@ msgstr "强制解释执行(&F)" msgid "&Allow recompilation" msgstr "允许重编译(&A)" + +msgid "&Fast forward" +msgstr "" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 30392d6e1b7..299e68b7067 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -3009,3 +3009,6 @@ msgstr "強制解譯執行(&F)" msgid "&Allow recompilation" msgstr "允許重編譯(&A)" + +msgid "&Fast forward" +msgstr "" From 39734bfe2649ab96afd4452ea452e7e05d50ae64 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Fri, 9 Jan 2026 16:10:43 +0700 Subject: [PATCH 243/320] Forgotten VLB alphabetization. --- src/video/vid_table.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 8a2ae888056..2ac10c1dc42 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -145,13 +145,6 @@ video_cards[] = { /* VLB */ { .device = &mach32_vlb_device, .flags = VIDEO_FLAG_TYPE_8514 }, { .device = &mach64gx_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32_machspeed_vga_gui_2400s_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32i_hercules_dynamite_pro_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_videomagic_revb_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_cardex_revc_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_generic_revd_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_cardex_revd_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &et4000w32p_diamond_revd_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5424_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5426_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5428_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -160,6 +153,7 @@ video_cards[] = { { .device = &gd5430_diamond_speedstar_pro_se_a8_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5430_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &gd5434_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &ht216_32_standalone_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_elsa_winner1000_86c928_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_metheus_86c928_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_mirocrystal_8s_805_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -179,9 +173,15 @@ video_cards[] = { { .device = &s3_spea_mirage_p64_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_diamond_stealth64_968_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &s3_stb_powergraph_64_video_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &ht216_32_standalone_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &tgui9400cxi_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &tgui9440_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32_machspeed_vga_gui_2400s_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32i_hercules_dynamite_pro_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_videomagic_revb_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_cardex_revc_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_generic_revd_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_cardex_revd_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &et4000w32p_diamond_revd_vlb_device, .flags = VIDEO_FLAG_TYPE_NONE }, /* PCI */ { .device = &voodoo_banshee_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_1000_device, .flags = VIDEO_FLAG_TYPE_NONE }, From b6a616194391be7b689ffc95ee8bd84153edeef1 Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Fri, 9 Jan 2026 12:58:22 +0100 Subject: [PATCH 244/320] Refactor dirty line calculation for rendering --- src/video/vid_voodoo_render.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/video/vid_voodoo_render.c b/src/video/vid_voodoo_render.c index 19dedfa7aaa..1c0edf77516 100644 --- a/src/video/vid_voodoo_render.c +++ b/src/video/vid_voodoo_render.c @@ -1389,10 +1389,9 @@ voodoo_half_triangle(voodoo_t *voodoo, voodoo_params_t *params, voodoo_state_t * voodoo->texel_count[odd_even] += state->texel_count; voodoo->fbiPixelsIn += state->pixel_count; - if (voodoo->params.draw_offset == voodoo->params.front_offset) { - int dirty_idx = SLI_ENABLED ? (real_y >> 1) : real_y; - if (dirty_idx < 2048) - voodoo->dirty_line[dirty_idx] = 1; + if (voodoo->params.draw_offset == voodoo->params.front_offset && !SLI_ENABLED) { + if (real_y < 2048) + voodoo->dirty_line[real_y] = 1; } next_line: From 43c419ecdb94b37887dce7c7031e573a08304e6e Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Fri, 9 Jan 2026 13:00:11 +0100 Subject: [PATCH 245/320] Enhance VGA pass-through handling in vid_voodoo.c Added logic to handle VGA pass-through state changes and mark lines dirty for refresh. --- src/video/vid_voodoo.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 960b913a9ce..6920ece5c94 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -516,6 +516,7 @@ voodoo_writel(uint32_t addr, uint32_t val, void *priv) break; case SST_fbiInit0: if (voodoo->initEnable & 0x01) { + int old_vga_pass = voodoo->fbiInit0 & FBIINIT0_VGA_PASS; voodoo->fbiInit0 = val; thread_wait_mutex(voodoo->force_blit_mutex); voodoo->can_blit = (voodoo->fbiInit0 & FBIINIT0_VGA_PASS) ? 1 : 0; @@ -523,6 +524,10 @@ voodoo_writel(uint32_t addr, uint32_t val, void *priv) voodoo->force_blit_count = 0; thread_release_mutex(voodoo->force_blit_mutex); + /* When VGA pass-through becomes active, mark all lines dirty to force full refresh */ + if (!old_vga_pass && (val & FBIINIT0_VGA_PASS)) + memset(voodoo->dirty_line, 1, sizeof(voodoo->dirty_line)); + if (voodoo->set->nr_cards == 2) svga_set_override(voodoo->svga, (voodoo->set->voodoos[0]->fbiInit0 | voodoo->set->voodoos[1]->fbiInit0) & 1); else From fe4bce275897a7950a11882feb66da2f31ca6fe1 Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Fri, 9 Jan 2026 13:02:43 +0100 Subject: [PATCH 246/320] Implement dirty line marking in vid_voodoo_blitter Added dirty line marking for single buffer mode. --- src/video/vid_voodoo_blitter.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/video/vid_voodoo_blitter.c b/src/video/vid_voodoo_blitter.c index d4b316dc59c..619e18b7460 100644 --- a/src/video/vid_voodoo_blitter.c +++ b/src/video/vid_voodoo_blitter.c @@ -506,6 +506,9 @@ voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params) for (int x = params->clipLeft; x < params->clipRight; x++) cbuf[x] = col; } + /* Mark line dirty for single buffer mode */ + if (params->draw_offset == params->front_offset && y < 2048) + voodoo->dirty_line[y] = 1; } } } @@ -535,4 +538,5 @@ voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params) } } } + } From ae857e6ef727d82e002bee6f561d0dcbffc3bba6 Mon Sep 17 00:00:00 2001 From: AITUS95 <48457684+AITUS95@users.noreply.github.com> Date: Fri, 9 Jan 2026 13:23:08 +0100 Subject: [PATCH 247/320] Remove unnecessary blank line --- src/video/vid_voodoo_blitter.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/video/vid_voodoo_blitter.c b/src/video/vid_voodoo_blitter.c index 619e18b7460..87127a949b4 100644 --- a/src/video/vid_voodoo_blitter.c +++ b/src/video/vid_voodoo_blitter.c @@ -538,5 +538,4 @@ voodoo_fastfill(voodoo_t *voodoo, voodoo_params_t *params) } } } - } From b31afcad05b4480c7084c83b346d62f8e44ba2f8 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Fri, 9 Jan 2026 21:09:49 +0700 Subject: [PATCH 248/320] OOPS... Forgot to alphabetize Voodoo3 properly --- src/video/vid_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/video/vid_table.c b/src/video/vid_table.c index 2ac10c1dc42..368ee825467 100644 --- a/src/video/vid_table.c +++ b/src/video/vid_table.c @@ -248,8 +248,6 @@ video_cards[] = { { .device = &et4000w32p_cardex_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &et4000w32p_diamond_revd_pci_device, .flags = VIDEO_FLAG_TYPE_NONE }, /* AGP */ - { .device = &compaq_voodoo_3_3500_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, - { .device = &voodoo_3_3500_se_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &velocity_100_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &velocity_200_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_1000_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, @@ -258,6 +256,8 @@ video_cards[] = { { .device = &voodoo_3_3500_agp_ntsc_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_agp_pal_device, .flags = VIDEO_FLAG_TYPE_NONE }, { .device = &voodoo_3_3500_si_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &compaq_voodoo_3_3500_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, + { .device = &voodoo_3_3500_se_agp_device, .flags = VIDEO_FLAG_TYPE_NONE }, #ifdef USE_G100 { .device = &productiva_g100_device, .flags = VIDEO_FLAG_TYPE_SPECIAL }, #endif /*USE_G100 */ From b857e809bf4c9364896a0ad4517edfd63be78814 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 02:25:25 +0100 Subject: [PATCH 249/320] The actual code changes. --- src/86box.c | 14 +++- src/cpu/386.c | 4 +- src/cpu/386_dynarec.c | 8 +-- src/cpu/808x.c | 2 +- src/disk/hdd.c | 4 +- src/include/86box/timer.h | 80 ++++++++++++---------- src/mem/mem.c | 12 ---- src/mem/nmc93cxx.c | 1 + src/timer.c | 140 ++++++++++++++++++++------------------ src/video/vid_cga.c | 8 +++ src/video/vid_genius.c | 9 +-- 11 files changed, 155 insertions(+), 127 deletions(-) diff --git a/src/86box.c b/src/86box.c index 93ab491bc77..67ad2929710 100644 --- a/src/86box.c +++ b/src/86box.c @@ -1578,12 +1578,22 @@ pc_send_cae(void) extern void softresetx86(void); extern void hardresetx86(void); + extern void biu_set_bus_cycle(int bus_cycle); + extern void biu_set_bus_state(int bus_state); + extern void biu_set_bus_next_state(int bus_next_state); + extern void biu_set_cycle_t1(void); + extern void biu_set_next_cycle(void); + extern int biu_get_bus_cycle(void); + extern int biu_get_bus_state(void); + extern int biu_get_bus_next_state(void); extern void prefetch_queue_set_pos(int pos); extern void prefetch_queue_set_ip(uint16_t ip); - extern void prefetch_queue_set_prefetching(int p); + extern void prefetch_queue_set_in(uint16_t in); + extern void prefetch_queue_set_suspended(int p); extern int prefetch_queue_get_pos(void); extern uint16_t prefetch_queue_get_ip(void); - extern int prefetch_queue_get_prefetching(void); + extern uint16_t prefetch_queue_get_in(void); + extern int prefetch_queue_get_suspended(void); extern int prefetch_queue_get_size(void); */ static void diff --git a/src/cpu/386.c b/src/cpu/386.c index ed4b40ab2f8..7c352ea1943 100644 --- a/src/cpu/386.c +++ b/src/cpu/386.c @@ -237,7 +237,7 @@ exec386_2386(int32_t cycs) cycles += cycs; while (cycles > 0) { - cycle_period = (timer_target - (uint32_t) tsc) + 1; + cycle_period = (timer_target - (uint64_t) tsc) + 1; x86_was_reset = 0; cycdiff = 0; @@ -411,7 +411,7 @@ exec386_2386(int32_t cycs) fatal("Life expired\n"); } - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint64_t) tsc)) timer_process(); #ifdef USE_GDBSTUB diff --git a/src/cpu/386_dynarec.c b/src/cpu/386_dynarec.c index 852c25427f4..c3ca9a8defc 100644 --- a/src/cpu/386_dynarec.c +++ b/src/cpu/386_dynarec.c @@ -280,7 +280,7 @@ update_tsc(void) tsc += cycdiff; if (cycdiff > 0) { - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint64_t) tsc)) timer_process(); } } @@ -865,7 +865,7 @@ exec386_dynarec(int32_t cycs) } if (cycdiff > 0) { - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint64_t) tsc)) timer_process(); } @@ -894,7 +894,7 @@ exec386(int32_t cycs) cycles += cycs; while (cycles > 0) { - cycle_period = (timer_target - (uint32_t) tsc) + 1; + cycle_period = (timer_target - (uint64_t) tsc) + 1; x86_was_reset = 0; cycdiff = 0; @@ -1078,7 +1078,7 @@ exec386(int32_t cycs) fatal("Life expired\n"); } - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint64_t) tsc)) timer_process(); #ifdef USE_GDBSTUB diff --git a/src/cpu/808x.c b/src/cpu/808x.c index 14e56f23a35..4e2e830d0e7 100644 --- a/src/cpu/808x.c +++ b/src/cpu/808x.c @@ -272,7 +272,7 @@ clock_end(void) /* On 808x systems, clock speed is usually crystal frequency divided by an integer. */ tsc += (uint64_t) diff * ((uint64_t) xt_cpu_multi >> 32ULL); /* Shift xt_cpu_multi by 32 bits to the right and then multiply. */ - if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint32_t) tsc)) + if (TIMER_VAL_LESS_THAN_VAL(timer_target, (uint64_t) tsc)) timer_process(); } diff --git a/src/disk/hdd.c b/src/disk/hdd.c index bbbec0865c9..c323bf7e32e 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -313,7 +313,7 @@ hdd_timing_write(hard_disk_t *hdd, uint32_t addr, uint32_t len) } } - hdd->cache.write_start_time = tsc + (uint32_t) (seek_time * cpuclock / 1000000.0); + hdd->cache.write_start_time = tsc + (uint64_t) (seek_time * cpuclock / 1000000.0); return seek_time; } @@ -383,7 +383,7 @@ hdd_timing_read(hard_disk_t *hdd, uint32_t addr, uint32_t len) cache->ra_ongoing = 1; cache->ra_segment = active_seg->id; - cache->ra_start_time = tsc + (uint32_t) (seek_time * cpuclock / 1000000.0); + cache->ra_start_time = tsc + (uint64_t) (seek_time * cpuclock / 1000000.0); return seek_time; } diff --git a/src/include/86box/timer.h b/src/include/86box/timer.h index 37a03d9caaa..a5ecf72fc2c 100644 --- a/src/include/86box/timer.h +++ b/src/include/86box/timer.h @@ -1,6 +1,14 @@ #ifndef _TIMER_H_ #define _TIMER_H_ +#ifndef int128_t +#define int128_t __int128 +#endif + +#ifndef uint128_t +#define uint128_t unsigned __int128 +#endif + extern uint64_t tsc; /* Maximum period, currently 1 second. */ @@ -11,18 +19,6 @@ extern uint64_t tsc; #define TIMER_SPLIT 2 #define TIMER_ENABLED 1 -#pragma pack(push, 1) -typedef struct ts_struct_t { - uint32_t frac; - uint32_t integer; -} ts_struct_t; -#pragma pack(pop) - -typedef union ts_t { - uint64_t ts64; - ts_struct_t ts32; -} ts_t; - /*Timers are based on the CPU Time Stamp Counter. Timer timestamps are in a 32:32 fixed point format, with the integer part compared against the TSC. The fractional part is used when advancing the timestamp to ensure a more accurate @@ -36,12 +32,8 @@ typedef union ts_t { to repeat, the callback must call timer_advance_u64(). This is a change from the old timer API.*/ typedef struct pc_timer_t { -#ifdef USE_PCEM_TIMER - uint32_t ts_integer; + uint64_t ts_integer; uint32_t ts_frac; -#else - ts_t ts; -#endif int flags; /* The flags are defined above. */ int in_callback; double period; /* This is used for large period timers to count @@ -60,7 +52,7 @@ extern "C" { /*Timestamp of nearest enabled timer. CPU emulation must call timer_process() when TSC matches or exceeds this.*/ -extern uint32_t timer_target; +extern uint64_t timer_target; /*Enable timer, without updating timestamp*/ extern void timer_enable(pc_timer_t *timer); @@ -82,18 +74,33 @@ extern void timer_add(pc_timer_t *timer, void (*callback)(void *priv), void *pri extern uint64_t TIMER_USEC; /*True if timer a expires before timer b*/ -#define TIMER_LESS_THAN(a, b) ((int64_t) ((a)->ts.ts64 - (b)->ts.ts64) <= 0) +#define TIMER_LESS_THAN(a, b) ((int64_t) ((a)->ts_integer - (b)->ts_integer) <= 0) /*True if timer a expires before 32 bit integer timestamp b*/ -#define TIMER_LESS_THAN_VAL(a, b) ((int32_t) ((a)->ts.ts32.integer - (b)) <= 0) +#define TIMER_LESS_THAN_VAL(a, b) ((int64_t) ((a)->ts_integer - (b)) <= 0) /*True if 32 bit integer timestamp a expires before 32 bit integer timestamp b*/ -#define TIMER_VAL_LESS_THAN_VAL(a, b) ((int32_t) ((a) - (b)) <= 0) +#define TIMER_VAL_LESS_THAN_VAL(a, b) ((int64_t) ((a) - (b)) <= 0) + +#ifndef printf +#include +#endif /*Advance timer by delay, specified in 32:32 format. This should be used to resume a recurring timer in a callback routine*/ static __inline void timer_advance_u64(pc_timer_t *timer, uint64_t delay) { - timer->ts.ts64 += delay; + uint64_t int_delay = delay >> 32; + uint32_t frac_delay = delay & 0xffffffff; + + if (int_delay & 0x0000000080000000ULL) { + printf("timer_advance_u64(): Negative delay: %08X%08X!\n", (uint32_t) (int_delay), frac_delay); + int_delay |= 0xffffffff00000000ULL; + } + + if ((frac_delay + timer->ts_frac) < frac_delay) + timer->ts_integer++; + timer->ts_frac += frac_delay; + timer->ts_integer += int_delay; timer_enable(timer); } @@ -103,9 +110,16 @@ timer_advance_u64(pc_timer_t *timer, uint64_t delay) static __inline void timer_set_delay_u64(pc_timer_t *timer, uint64_t delay) { - timer->ts.ts64 = 0ULL; - timer->ts.ts32.integer = tsc; - timer->ts.ts64 += delay; + uint64_t int_delay = delay >> 32; + uint32_t frac_delay = delay & 0xffffffff; + + if (int_delay & 0x0000000080000000ULL) { + printf("timer_set_delay_u64(): Negative delay: %08X%08X!\n", (uint32_t) (int_delay), frac_delay); + int_delay |= 0xffffffff00000000ULL; + } + + timer->ts_frac = frac_delay; + timer->ts_integer = int_delay + (uint64_t)tsc; timer_enable(timer); } @@ -125,21 +139,19 @@ timer_is_on(pc_timer_t *timer) } /*Return integer timestamp of timer*/ -static __inline uint32_t +static __inline uint64_t timer_get_ts_int(pc_timer_t *timer) { - return timer->ts.ts32.integer; + return timer->ts_integer; } /*Return remaining time before timer expires, in us. If the timer has already expired then return 0*/ -static __inline uint32_t +static __inline uint64_t timer_get_remaining_us(pc_timer_t *timer) { - int64_t remaining; - if (timer->flags & TIMER_ENABLED) { - remaining = (int64_t) (timer->ts.ts64 - (uint64_t) (tsc << 32)); + int128_t remaining = (((uint128_t)timer->ts_integer << 32) | timer->ts_frac) - ((uint128_t)tsc << 32); if (remaining < 0) return 0; @@ -151,13 +163,11 @@ timer_get_remaining_us(pc_timer_t *timer) /*Return remaining time before timer expires, in 32:32 timestamp format. If the timer has already expired then return 0*/ -static __inline uint64_t +static __inline uint128_t timer_get_remaining_u64(pc_timer_t *timer) { - int64_t remaining; - if (timer->flags & TIMER_ENABLED) { - remaining = (int64_t) (timer->ts.ts64 - (uint64_t) (tsc << 32)); + int128_t remaining = (((uint128_t)timer->ts_integer << 32) | timer->ts_frac) - ((uint128_t)tsc << 32); if (remaining < 0) return 0; diff --git a/src/mem/mem.c b/src/mem/mem.c index 80803e6a2f4..91fa277be95 100644 --- a/src/mem/mem.c +++ b/src/mem/mem.c @@ -668,7 +668,6 @@ read_mem_b(uint32_t addr) { mem_mapping_t *map; uint8_t ret = 0xff; - int old_cycles = cycles; mem_logical_addr = addr; addr &= rammask; @@ -677,8 +676,6 @@ read_mem_b(uint32_t addr) if (map && map->read_b) ret = map->read_b(addr, map->priv); - resub_cycles(old_cycles); - return ret; } @@ -687,7 +684,6 @@ read_mem_w(uint32_t addr) { mem_mapping_t *map; uint16_t ret = 0xffff; - int old_cycles = cycles; mem_logical_addr = addr; addr &= rammask; @@ -703,8 +699,6 @@ read_mem_w(uint32_t addr) ret = map->read_b(addr, map->priv) | (map->read_b(addr + 1, map->priv) << 8); } - resub_cycles(old_cycles); - return ret; } @@ -712,7 +706,6 @@ void write_mem_b(uint32_t addr, uint8_t val) { mem_mapping_t *map; - int old_cycles = cycles; mem_logical_addr = addr; addr &= rammask; @@ -720,15 +713,12 @@ write_mem_b(uint32_t addr, uint8_t val) map = write_mapping[addr >> MEM_GRANULARITY_BITS]; if (map && map->write_b) map->write_b(addr, val, map->priv); - - resub_cycles(old_cycles); } void write_mem_w(uint32_t addr, uint16_t val) { mem_mapping_t *map; - int old_cycles = cycles; mem_logical_addr = addr; addr &= rammask; @@ -747,8 +737,6 @@ write_mem_w(uint32_t addr, uint16_t val) } } } - - resub_cycles(old_cycles); } uint8_t diff --git a/src/mem/nmc93cxx.c b/src/mem/nmc93cxx.c index 17d97591edb..8f958fa5e69 100644 --- a/src/mem/nmc93cxx.c +++ b/src/mem/nmc93cxx.c @@ -29,6 +29,7 @@ #include <86box/nmc93cxx.h> #include <86box/plat_unused.h> +#define ENABLE_NMC93CXX_EEPROM_LOG 1 #ifdef ENABLE_NMC93CXX_EEPROM_LOG int nmc93cxx_eeprom_do_log = ENABLE_NMC93CXX_EEPROM_LOG; diff --git a/src/timer.c b/src/timer.c index 03908890f8d..9f47f86086d 100644 --- a/src/timer.c +++ b/src/timer.c @@ -8,7 +8,7 @@ #include <86box/nv/vid_nv_rivatimer.h> uint64_t TIMER_USEC; -uint32_t timer_target; +uint64_t timer_target; /*Enabled timers are stored in a linked list, with the first timer to expire at the head.*/ @@ -23,68 +23,55 @@ void timer_enable(pc_timer_t *timer) { pc_timer_t *timer_node = timer_head; - int ret = 0; - - if (!timer_inited || (timer == NULL)) - return; if (timer->flags & TIMER_ENABLED) timer_disable(timer); if (timer->next || timer->prev) - fatal("timer_disable(): Attempting to enable a non-isolated " - "timer incorrectly marked as disabled\n"); + fatal("timer_enable - timer->next\n"); + + timer->flags |= TIMER_ENABLED; /*List currently empty - add to head*/ if (!timer_head) { - timer_head = timer; + timer_head = timer; timer->next = timer->prev = NULL; - timer_target = timer_head->ts.ts32.integer; - ret = 1; - } else if (TIMER_LESS_THAN(timer, timer_head)) { - timer->next = timer_head; - timer->prev = NULL; - timer_head->prev = timer; - timer_head = timer; - timer_target = timer_head->ts.ts32.integer; - ret = 1; - } else if (!timer_head->next) { - timer_head->next = timer; - timer->prev = timer_head; - ret = 1; + timer_target = timer_head->ts_integer; + return; } - if (ret == 0) { - pc_timer_t *prev = timer_head; - timer_node = timer_head->next; - - while (1) { - /*Timer expires before timer_node. Add to list in front of timer_node*/ - if (TIMER_LESS_THAN(timer, timer_node)) { - timer->next = timer_node; - timer->prev = prev; - timer_node->prev = timer; - prev->next = timer; - ret = 1; - break; - } + timer_node = timer_head; - /*timer_node is last in the list. Add timer to end of list*/ - if (!timer_node->next) { - timer_node->next = timer; - timer->prev = timer_node; - ret = 1; - break; + while (1) { + /* + Timer expires before timer_node. + Add to list in front of timer_node + */ + if (TIMER_LESS_THAN(timer, timer_node)) { + timer->next = timer_node; + timer->prev = timer_node->prev; + timer_node->prev = timer; + if (timer->prev) + timer->prev->next = timer; + else { + timer_head = timer; + timer_target = timer_head->ts_integer; } + return; + } - prev = timer_node; - timer_node = timer_node->next; + /* + timer_node is last in the list. + Add timer to end of list + */ + if (!timer_node->next) { + timer_node->next = timer; + timer->prev = timer_node; + return; } - } - /* Do not mark it as enabled if it has failed every single condition. */ - if (ret == 1) - timer->flags |= TIMER_ENABLED; + timer_node = timer_node->next; + } } void @@ -93,9 +80,12 @@ timer_disable(pc_timer_t *timer) if (!timer_inited || (timer == NULL) || !(timer->flags & TIMER_ENABLED)) return; - if (!timer->next && !timer->prev && timer != timer_head) + if (!timer->next && !timer->prev && timer != timer_head) { + uint32_t *p = NULL; + *p = 5; /* Crash deliberately. */ fatal("timer_disable(): Attempting to disable an isolated " "non-head timer incorrectly marked as enabled\n"); + } timer->flags &= ~TIMER_ENABLED; timer->in_callback = 0; @@ -109,41 +99,60 @@ timer_disable(pc_timer_t *timer) timer->prev = timer->next = NULL; } +static void +timer_remove_head(void) +{ + if (timer_head) { + pc_timer_t *timer = timer_head; + timer_head = timer->next; + timer_head->prev = NULL; + timer->next = timer->prev = NULL; + timer->flags &= ~TIMER_ENABLED; + } +} + void timer_process(void) { - pc_timer_t *timer; + int num = 0; if (!timer_head) return; + uint64_t old_target = timer_target; + while (1) { - timer = timer_head; + pc_timer_t *timer = timer_head; - if (!TIMER_LESS_THAN_VAL(timer, (uint32_t) tsc)) + if (!TIMER_LESS_THAN_VAL(timer, (uint64_t) tsc)) { + if (num == 0) + pclog("No processing because all timers expire later\n"); break; + } - timer_head = timer->next; - if (timer_head) - timer_head->prev = NULL; - - timer->next = timer->prev = NULL; - timer->flags &= ~TIMER_ENABLED; + timer_remove_head(); if (timer->flags & TIMER_SPLIT) timer_advance_ex(timer, 0); /* We're splitting a > 1 s period into - multiple <= 1 s periods. */ + multiple <= 1 s periods. */ else if (timer->callback != NULL) { - /* Make sure it's not NULL, so that we can + /* + Make sure it's not NULL, so that we can have a NULL callback when no operation - is needed. */ + is needed. + */ timer->in_callback = 1; timer->callback(timer->priv); timer->in_callback = 0; } + + num++; } - timer_target = timer_head->ts.ts32.integer; + timer_target = timer_head->ts_integer; + + if (old_target > timer_target) + pclog("Timer wraparound!\n"); } void @@ -200,7 +209,8 @@ timer_stop(pc_timer_t *timer) return; timer->period = 0.0; - timer_disable(timer); + if (timer->flags & TIMER_ENABLED) + timer_disable(timer); timer->flags &= ~TIMER_SPLIT; timer->in_callback = 0; } @@ -277,11 +287,11 @@ timer_set_new_tsc(uint64_t new_tsc) } timer = timer_head; - timer_target = new_tsc + (int32_t)(timer_get_ts_int(timer_head) - (uint32_t)tsc); + timer_target = new_tsc + (int64_t)(timer_get_ts_int(timer_head) - (uint64_t)tsc); while (timer) { - int32_t offset_from_current_tsc = (int32_t)(timer_get_ts_int(timer) - (uint32_t)tsc); - timer->ts.ts32.integer = new_tsc + offset_from_current_tsc; + int64_t offset_from_current_tsc = (int64_t)(timer_get_ts_int(timer) - (uint64_t)tsc); + timer->ts_integer = new_tsc + offset_from_current_tsc; timer = timer->next; } diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index f4c93e9c4d6..2cb5fe6fa17 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -239,15 +239,23 @@ cga_recalctimings(cga_t *cga) if (cga->cgamode & CGA_MODE_FLAG_HIGHRES) { disptime = (double) (cga->crtc[CGA_CRTC_HTOTAL] + 1); _dispontime = (double) cga->crtc[CGA_CRTC_HDISP]; + if (_dispontime >= disptime) + _dispontime = disptime - 1; } else { disptime = (double) ((cga->crtc[CGA_CRTC_HTOTAL] + 1) << 1); _dispontime = (double) (cga->crtc[CGA_CRTC_HDISP] << 1); + if (_dispontime >= disptime) + _dispontime = disptime - 2; } _dispofftime = disptime - _dispontime; _dispontime = _dispontime * CGACONST; _dispofftime = _dispofftime * CGACONST; cga->dispontime = (uint64_t) (_dispontime); + if (cga->dispontime > 0x7fffffffffffffffULL) + pclog("CGA: Negative display on time (%i, %i, %i)\n", cga->cgamode & CGA_MODE_FLAG_HIGHRES, cga->crtc[CGA_CRTC_HTOTAL] + 1, cga->crtc[CGA_CRTC_HDISP]); cga->dispofftime = (uint64_t) (_dispofftime); + if (cga->dispofftime > 0x7fffffffffffffffULL) + pclog("CGA: Negative display off time (%i, %i, %i)\n", cga->cgamode & CGA_MODE_FLAG_HIGHRES, cga->crtc[CGA_CRTC_HTOTAL] + 1, cga->crtc[CGA_CRTC_HDISP]); } static void diff --git a/src/video/vid_genius.c b/src/video/vid_genius.c index 5dd3d2ade46..0289e1104ac 100644 --- a/src/video/vid_genius.c +++ b/src/video/vid_genius.c @@ -329,12 +329,13 @@ genius_recalctimings(genius_t *genius) double disptime; double _dispontime; double _dispofftime; + double crtcconst = (cpuclock / 53216000.0 * (double) (1ULL << 32)) * 9.0; - disptime = 0x31; - _dispontime = 0x28; + disptime = 0x62; + _dispontime = 0x50; _dispofftime = disptime - _dispontime; - _dispontime *= MDACONST; - _dispofftime *= MDACONST; + _dispontime *= crtcconst; + _dispofftime *= crtcconst; genius->dispontime = (uint64_t) (_dispontime); genius->dispofftime = (uint64_t) (_dispofftime); } From ca2a5a1e990dd504d90a0acc698ae8f76cbc46f4 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 04:47:01 +0100 Subject: [PATCH 250/320] Remove excess logging. --- src/include/86box/timer.h | 8 ++------ src/timer.c | 8 +------- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/src/include/86box/timer.h b/src/include/86box/timer.h index a5ecf72fc2c..38784e154f7 100644 --- a/src/include/86box/timer.h +++ b/src/include/86box/timer.h @@ -92,10 +92,8 @@ timer_advance_u64(pc_timer_t *timer, uint64_t delay) uint64_t int_delay = delay >> 32; uint32_t frac_delay = delay & 0xffffffff; - if (int_delay & 0x0000000080000000ULL) { - printf("timer_advance_u64(): Negative delay: %08X%08X!\n", (uint32_t) (int_delay), frac_delay); + if (int_delay & 0x0000000080000000ULL) int_delay |= 0xffffffff00000000ULL; - } if ((frac_delay + timer->ts_frac) < frac_delay) timer->ts_integer++; @@ -113,10 +111,8 @@ timer_set_delay_u64(pc_timer_t *timer, uint64_t delay) uint64_t int_delay = delay >> 32; uint32_t frac_delay = delay & 0xffffffff; - if (int_delay & 0x0000000080000000ULL) { - printf("timer_set_delay_u64(): Negative delay: %08X%08X!\n", (uint32_t) (int_delay), frac_delay); + if (int_delay & 0x0000000080000000ULL) int_delay |= 0xffffffff00000000ULL; - } timer->ts_frac = frac_delay; timer->ts_integer = int_delay + (uint64_t)tsc; diff --git a/src/timer.c b/src/timer.c index 9f47f86086d..7eacf36f6bb 100644 --- a/src/timer.c +++ b/src/timer.c @@ -124,11 +124,8 @@ timer_process(void) while (1) { pc_timer_t *timer = timer_head; - if (!TIMER_LESS_THAN_VAL(timer, (uint64_t) tsc)) { - if (num == 0) - pclog("No processing because all timers expire later\n"); + if (!TIMER_LESS_THAN_VAL(timer, (uint64_t) tsc)) break; - } timer_remove_head(); @@ -150,9 +147,6 @@ timer_process(void) } timer_target = timer_head->ts_integer; - - if (old_target > timer_target) - pclog("Timer wraparound!\n"); } void From 667963aa56744786ee5963393171ad046c992966 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 04:51:24 +0100 Subject: [PATCH 251/320] More fixes. --- src/timer.c | 2 -- src/video/vid_voodoo.c | 10 +++++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/timer.c b/src/timer.c index 7eacf36f6bb..34c1e74f5ca 100644 --- a/src/timer.c +++ b/src/timer.c @@ -119,8 +119,6 @@ timer_process(void) if (!timer_head) return; - uint64_t old_target = timer_target; - while (1) { pc_timer_t *timer = timer_head; diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 6920ece5c94..745347cd43d 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -338,11 +338,11 @@ voodoo_readl(uint32_t addr, void *priv) break; case SST_hvRetrace: { - uint32_t line_time = (uint32_t) (voodoo->line_time >> 32); - uint32_t diff = (timer_get_ts_int(&voodoo->timer) > (tsc & 0xffffffff)) ? (timer_get_ts_int(&voodoo->timer) - (tsc & 0xffffffff)) : 0; - uint32_t pre_div = diff * voodoo->h_total; - uint32_t post_div = pre_div / line_time; - uint32_t h_pos = (voodoo->h_total - 1) - post_div; + uint64_t line_time = (uint64_t) (voodoo->line_time >> 32); + uint64_t diff = (timer_get_ts_int(&voodoo->timer) > tsc) ? (timer_get_ts_int(&voodoo->timer) - tsc) : 0; + uint64_t pre_div = diff * voodoo->h_total; + uint64_t post_div = pre_div / line_time; + uint64_t h_pos = (voodoo->h_total - 1) - post_div; if (h_pos >= voodoo->h_total) h_pos = 0; From 7508f0b8ceb62fa05ae3494eb351f2f788e2e365 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 07:30:39 +0100 Subject: [PATCH 252/320] Improve some sanity check and convert any pending output to a PDF file on printer reset and timeout. --- src/printer/prt_ps.c | 58 ++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index 3a32303949f..9caff0d8a5d 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -78,6 +78,7 @@ typedef struct ps_t { bool autofeed; bool pcl; bool pcl_escape; + bool pending; uint8_t ctrl; char printer_path[260]; @@ -116,21 +117,6 @@ static dllimp_t ghostscript_imports[] = { static void *ghostscript_handle = NULL; -static void -reset_ps(ps_t *dev) -{ - if (dev == NULL) - return; - - dev->ack = false; - - dev->buffer[0] = 0; - dev->buffer_pos = 0; - - timer_disable(&dev->pulse_timer); - timer_stop(&dev->timeout_timer); -} - static void pulse_timer(void *priv) { @@ -198,13 +184,37 @@ convert_to_pdf(ps_t *dev) return code; } +static void +reset_ps(ps_t *dev) +{ + if (dev == NULL) + return; + + dev->ack = false; + + if (dev->pending) { + if (ghostscript_handle != NULL) + convert_to_pdf(dev); + + dev->filename[0] = 0; + + dev->pending = false; + } + + dev->buffer[0] = 0; + dev->buffer_pos = 0; + + timer_disable(&dev->pulse_timer); + timer_stop(&dev->timeout_timer); +} + static void write_buffer(ps_t *dev, bool finish) { char path[1024]; FILE *fp; - if (dev->buffer[0] == 0) + if (dev->buffer_pos == 0) return; if (dev->filename[0] == 0) @@ -235,7 +245,10 @@ write_buffer(ps_t *dev, bool finish) convert_to_pdf(dev); dev->filename[0] = 0; - } + + dev->pending = false; + } else + dev->pending = true; } static void @@ -243,7 +256,16 @@ timeout_timer(void *priv) { ps_t *dev = (ps_t *) priv; - write_buffer(dev, true); + if (dev->buffer_pos != 0) + write_buffer(dev, true); + else if (dev->pending) { + if (ghostscript_handle != NULL) + convert_to_pdf(dev); + + dev->filename[0] = 0; + + dev->pending = false; + } timer_stop(&dev->timeout_timer); } From 41cbb0e27f495cf3b6003fed405956d0d2fe9e47 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 07:31:31 +0100 Subject: [PATCH 253/320] NM93Cxx: Disable logging. --- src/mem/nmc93cxx.c | 1 - 1 file changed, 1 deletion(-) diff --git a/src/mem/nmc93cxx.c b/src/mem/nmc93cxx.c index 8f958fa5e69..17d97591edb 100644 --- a/src/mem/nmc93cxx.c +++ b/src/mem/nmc93cxx.c @@ -29,7 +29,6 @@ #include <86box/nmc93cxx.h> #include <86box/plat_unused.h> -#define ENABLE_NMC93CXX_EEPROM_LOG 1 #ifdef ENABLE_NMC93CXX_EEPROM_LOG int nmc93cxx_eeprom_do_log = ENABLE_NMC93CXX_EEPROM_LOG; From 53ead845ba1505f1a3982a35255fe62c6734fba9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 07:35:33 +0100 Subject: [PATCH 254/320] Improve some sanity check and convert any pending output to a PDF file on printer reset and timeout. --- src/printer/prt_ps.c | 58 ++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index 3a32303949f..9caff0d8a5d 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -78,6 +78,7 @@ typedef struct ps_t { bool autofeed; bool pcl; bool pcl_escape; + bool pending; uint8_t ctrl; char printer_path[260]; @@ -116,21 +117,6 @@ static dllimp_t ghostscript_imports[] = { static void *ghostscript_handle = NULL; -static void -reset_ps(ps_t *dev) -{ - if (dev == NULL) - return; - - dev->ack = false; - - dev->buffer[0] = 0; - dev->buffer_pos = 0; - - timer_disable(&dev->pulse_timer); - timer_stop(&dev->timeout_timer); -} - static void pulse_timer(void *priv) { @@ -198,13 +184,37 @@ convert_to_pdf(ps_t *dev) return code; } +static void +reset_ps(ps_t *dev) +{ + if (dev == NULL) + return; + + dev->ack = false; + + if (dev->pending) { + if (ghostscript_handle != NULL) + convert_to_pdf(dev); + + dev->filename[0] = 0; + + dev->pending = false; + } + + dev->buffer[0] = 0; + dev->buffer_pos = 0; + + timer_disable(&dev->pulse_timer); + timer_stop(&dev->timeout_timer); +} + static void write_buffer(ps_t *dev, bool finish) { char path[1024]; FILE *fp; - if (dev->buffer[0] == 0) + if (dev->buffer_pos == 0) return; if (dev->filename[0] == 0) @@ -235,7 +245,10 @@ write_buffer(ps_t *dev, bool finish) convert_to_pdf(dev); dev->filename[0] = 0; - } + + dev->pending = false; + } else + dev->pending = true; } static void @@ -243,7 +256,16 @@ timeout_timer(void *priv) { ps_t *dev = (ps_t *) priv; - write_buffer(dev, true); + if (dev->buffer_pos != 0) + write_buffer(dev, true); + else if (dev->pending) { + if (ghostscript_handle != NULL) + convert_to_pdf(dev); + + dev->filename[0] = 0; + + dev->pending = false; + } timer_stop(&dev->timeout_timer); } From a84a13d74500ab2819fe37f8670b674ba62730e2 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 10 Jan 2026 07:37:12 +0100 Subject: [PATCH 255/320] CGA: Remove excess logging. --- src/video/vid_cga.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/video/vid_cga.c b/src/video/vid_cga.c index 2cb5fe6fa17..65c85480a4b 100644 --- a/src/video/vid_cga.c +++ b/src/video/vid_cga.c @@ -251,11 +251,7 @@ cga_recalctimings(cga_t *cga) _dispontime = _dispontime * CGACONST; _dispofftime = _dispofftime * CGACONST; cga->dispontime = (uint64_t) (_dispontime); - if (cga->dispontime > 0x7fffffffffffffffULL) - pclog("CGA: Negative display on time (%i, %i, %i)\n", cga->cgamode & CGA_MODE_FLAG_HIGHRES, cga->crtc[CGA_CRTC_HTOTAL] + 1, cga->crtc[CGA_CRTC_HDISP]); cga->dispofftime = (uint64_t) (_dispofftime); - if (cga->dispofftime > 0x7fffffffffffffffULL) - pclog("CGA: Negative display off time (%i, %i, %i)\n", cga->cgamode & CGA_MODE_FLAG_HIGHRES, cga->crtc[CGA_CRTC_HTOTAL] + 1, cga->crtc[CGA_CRTC_HDISP]); } static void From 0d06181b30ab089be06828752d19ac4b815721f2 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Fri, 9 Jan 2026 12:41:42 +0000 Subject: [PATCH 256/320] Translated using Weblate (Russian) Currently translated at 100.0% (1000 of 1000 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/ru/ --- src/qt/languages/ru-RU.po | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index b39d0d84c43..112c53360cf 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2025-12-30 13:56+0000\n" +"PO-Revision-Date: 2026-01-10 12:56+0000\n" "Last-Translator: Alexander Babikov \n" "Language-Team: Russian \n" "Language: ru-RU\n" @@ -20,7 +20,7 @@ msgid "&Keyboard requires capture" msgstr "&Клавиатура требует захвата" msgid "&Right CTRL is left ALT" -msgstr "&Правый CTRL - это левый ALT" +msgstr "П&равый CTRL - это левый ALT" msgid "&Hard reset" msgstr "&Холодная перезагрузка" @@ -3017,10 +3017,10 @@ msgid "Allow recompilation" msgstr "Разрешить рекомпиляцию" msgid "&Force interpretation" -msgstr "&Принудительная интерпретация" +msgstr "Пр&инудительная интерпретация" msgid "&Allow recompilation" -msgstr "&Разрешить рекомпиляцию" +msgstr "Разреш&ить рекомпиляцию" msgid "&Fast forward" -msgstr "" +msgstr "П&еремотка вперёд" From e43f0e78dd77aa87d7b6bf38d1830dfd0de703ad Mon Sep 17 00:00:00 2001 From: DimMan88 Date: Fri, 9 Jan 2026 17:48:55 +0000 Subject: [PATCH 257/320] Translated using Weblate (Greek) Currently translated at 96.9% (969 of 1000 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/el/ --- src/qt/languages/el-GR.po | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index db28daa81aa..10197ff38de 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1,6 +1,6 @@ msgid "" msgstr "" -"PO-Revision-Date: 2026-01-07 16:56+0000\n" +"PO-Revision-Date: 2026-01-10 12:56+0000\n" "Last-Translator: DimMan88 \n" "Language-Team: Greek \n" "Language: el-GR\n" @@ -127,7 +127,7 @@ msgid "&Fullscreen" msgstr "&Πλήρης οθόνη" msgid "Fullscreen &stretch mode" -msgstr "Πλήρης οθόνη &σε τύπο τεντώματος" +msgstr "Πλήρης οθόνη &σε λειτουργία τεντώματος" msgid "&Full screen stretch" msgstr "&Τέντωμα πλήρους οθόνης" @@ -325,7 +325,7 @@ msgid "Disk size:" msgstr "Μέγεθος δίσκου:" msgid "RPM mode:" -msgstr "Τύπος RPM:" +msgstr "Λειτουργία RPM:" msgid "Progress:" msgstr "Πρόοδος:" @@ -1032,7 +1032,7 @@ msgid "%1 Device Configuration" msgstr "%1 Προσαρμογή Συσκευής" msgid "Monitor in sleep mode" -msgstr "Οθόνη σε sleep mode" +msgstr "Οθόνη σε λειτουργία αναμονής" msgid "GLSL shaders" msgstr "GLSL shaders" @@ -1604,7 +1604,7 @@ msgid "Select media images from program working directory" msgstr "Επιλέξτε αρχεία πολυμέσων απο τον ενεργό κατάλογο προγράμματος" msgid "PIT mode:" -msgstr "PIT mode:" +msgstr "Λειτουργία PIT:" msgid "Auto" msgstr "Αυτόματο" @@ -1674,7 +1674,7 @@ msgid "Open screenshots &folder…" msgstr "Άνοιγμα &φακέλου στιγμιότυπων…" msgid "Appl&y fullscreen stretch mode when maximized" -msgstr "Εφαρμο&γή πλήρους οθόνης σε τέντωμα κατα την μεγιστοποίηση" +msgstr "&Εφαρμογή πλήρους οθόνης σε τέντωμα κατα την μεγιστοποίηση" msgid "&Cursor/Puck" msgstr "&Cursor/Puck" @@ -1801,7 +1801,7 @@ msgid "Network Card #4" msgstr "Κάρτα δικτύου #4" msgid "Mode:" -msgstr "Τύπος:" +msgstr "Λειτουργία:" msgid "Interface:" msgstr "Διασύνδεση:" @@ -2344,7 +2344,7 @@ msgid "Transfer Speed" msgstr "Ταχύτητα Μεταφοράς" msgid "EMS mode" -msgstr "Τύπος EMS" +msgstr "Λειτουργία EMS" msgid "EMS Address" msgstr "Διεύθυνση EMS" @@ -2558,10 +2558,10 @@ msgid "Color 80x25 (5153/CGA)" msgstr "Έγχρωμο 80x25 (5153/CGA)" msgid "Enhanced Color - Normal Mode (5154/ECD)" -msgstr "Ενισχυμένο Έγχρωμο - Κανονικός Τύπος (5154/ECD)" +msgstr "Ενισχυμένο Έγχρωμο - Κανονική Λειτουργία (5154/ECD)" msgid "Enhanced Color - Enhanced Mode (5154/ECD)" -msgstr "Ενισχυμένο Έγχρωμο - Ενισχυμένος Τύπος (5154/ECD)" +msgstr "Ενισχυμένο Έγχρωμο - Ενισχυμένη Λειτουργία (5154/ECD)" msgid "Green" msgstr "Πράσινο" @@ -2660,7 +2660,7 @@ msgid "Serial Passthrough Device" msgstr "Συσκευή Σειριακής Διέλευσης" msgid "Passthrough Mode" -msgstr "Τύπος Διέλευσης" +msgstr "Λειτουργία Διέλευσης" msgid "Host Serial Device" msgstr "Σειριακή Συσκευή Οικοδεσπότη" @@ -3040,7 +3040,7 @@ msgid "OpenGL input scale" msgstr "Κλίμακα OpenGL input" msgid "OpenGL input stretch mode" -msgstr "OpenGL input σε τύπο τεντώματος" +msgstr "OpenGL input σε λειτουργία τεντώματος" msgid "Color scheme" msgstr "Συνδυασμός χρωμάτων" From aea62c9aee38c0b7f0c0b6a6533a55c8ff57a3e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Sat, 10 Jan 2026 23:36:12 +0100 Subject: [PATCH 258/320] Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 736e66779af..2d73824e413 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,8 @@ We operate an IRC channel and a Discord server for discussing 86Box, its develop [![Visit our Discord server](https://discordapp.com/api/guilds/262614059009048590/embed.png)](https://discord.gg/QXK9XTv) +We also operate our official forum at https://forum.softhistory.org/ and our official wiki at https://wiki.softhistory.org/ . + Contributions ------------- From 42c8989936661ac14d970ebcdd2194d6fe023b75 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miran=20Gr=C4=8Da?= Date: Sat, 10 Jan 2026 23:38:25 +0100 Subject: [PATCH 259/320] Update README.md --- README.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2d73824e413..4a248782934 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,13 @@ We operate an IRC channel and a Discord server for discussing 86Box, its develop [![Visit our Discord server](https://discordapp.com/api/guilds/262614059009048590/embed.png)](https://discord.gg/QXK9XTv) -We also operate our official forum at https://forum.softhistory.org/ and our official wiki at https://wiki.softhistory.org/ . +[Forum: SoftHistory](https://forum.softhistory.org/) + +[Wiki: SoftHistory](https://wiki.softhistory.org/) + +[Twitter: @86BoxEmulator](https://twitter.com/86BoxEmulator) + +[YouTube: 86Box](https://youtube.com/c/86Box) Contributions ------------- @@ -79,6 +85,5 @@ Donations We do not charge you for the emulator but donations are still welcome: . - You can also support the project on Patreon: . From e5d2995352dd852dfbb88e74c480cfdd3f16e423 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 11 Jan 2026 07:32:22 +0100 Subject: [PATCH 260/320] PCL printer: filter out all the HP PJL stuff in order to produce clean prints using Windows 3.1x drivers. --- src/printer/prt_ps.c | 77 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 61 insertions(+), 16 deletions(-) diff --git a/src/printer/prt_ps.c b/src/printer/prt_ps.c index 9caff0d8a5d..adf57a52376 100644 --- a/src/printer/prt_ps.c +++ b/src/printer/prt_ps.c @@ -77,9 +77,12 @@ typedef struct ps_t { bool error; bool autofeed; bool pcl; - bool pcl_escape; bool pending; + bool pjl; + bool pjl_command; uint8_t ctrl; + uint8_t pcl_escape; + uint16_t pjl_command_start; char printer_path[260]; @@ -286,23 +289,65 @@ process_data(ps_t *dev) { /* On PCL, check for escape sequences. */ if (dev->pcl) { - if (dev->data == 0x1B) - dev->pcl_escape = true; - else if (dev->pcl_escape) { - dev->pcl_escape = false; - if (dev->data == 0xE) { - dev->buffer[dev->buffer_pos++] = dev->data; - dev->buffer[dev->buffer_pos] = 0; - - if (dev->buffer_pos > 2) - write_buffer(dev, true); - - return; + if (dev->pjl) { + dev->buffer[dev->buffer_pos++] = dev->data; + + /* Filter out any PJL commands. */ + if (dev->pjl_command && (dev->data == '\n')) { + dev->pjl_command = false; + if (!memcmp(&(dev->buffer[dev->pjl_command_start]), "@PJL ENTER LANGUAGE=PCL", 0x17)) + dev->pjl = false; + else if (!memcmp(&(dev->buffer[dev->pjl_command_start]), "@PJL ENTER LANGUAGE=POSTSCRIPT", 0x1e)) + fatal("Printing PostScript using the PCL printer is not (yet) supported!\n"); + dev->buffer_pos = dev->pjl_command_start; + } else if (!dev->pjl_command && (dev->buffer_pos >= 0x05) && !memcmp(&(dev->buffer[dev->buffer_pos - 0x5]), "@PJL ", 0x05)) { + dev->pjl_command = true; + dev->pjl_command_start = dev->buffer_pos - 0x05; } + + dev->buffer[dev->buffer_pos] = 0; + return; + } else if (dev->data == 0x1b) + dev->pcl_escape = 1; + else switch (dev->pcl_escape) { + case 1: + dev->pcl_escape = (dev->data == 0x25) ? 2 : 0; + if (dev->data == 0x0e) { + dev->buffer[dev->buffer_pos++] = dev->data; + dev->buffer[dev->buffer_pos] = 0; + + if (dev->buffer_pos > 2) + write_buffer(dev, true); + + return; + } + break; + case 2: + dev->pcl_escape = (dev->data == 0x2d) ? 3 : 0; + break; + case 3: + dev->pcl_escape = (dev->data == 0x31) ? 4 : 0; + break; + case 4: + dev->pcl_escape = (dev->data == 0x32) ? 5 : 0; + break; + case 5: + dev->pcl_escape = (dev->data == 0x33) ? 6 : 0; + break; + case 6: + dev->pcl_escape = (dev->data == 0x34) ? 7 : 0; + break; + case 7: + dev->pcl_escape = (dev->data == 0x35) ? 8 : 0; + break; + case 8: + dev->pcl_escape = 0; + if (dev->data == 0x58) + dev->pjl = true; + break; } - } - /* On PostScript, check for non-printable characters. */ - else if ((dev->data < 0x20) || (dev->data == 0x7f)) { + } else if ((dev->data < 0x20) || (dev->data == 0x7f)) { + /* On PostScript, check for non-printable characters. */ switch (dev->data) { /* The following characters are considered white-space by the PostScript specification */ From 85d902ef7ac63e6483f7a1eea28966f5a7bab1b9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sun, 11 Jan 2026 17:40:30 +0600 Subject: [PATCH 261/320] Add TriGem Como 440EX machine --- src/include/86box/machine.h | 1 + src/machine/m_at_slot1.c | 33 ++++++++++++++++++++++++++ src/machine/machine_table.c | 46 +++++++++++++++++++++++++++++++++++++ src/video/vid_cl54xx.c | 6 +++++ 4 files changed, 86 insertions(+) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index c648ea4f40c..71a1c9867a3 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1205,6 +1205,7 @@ extern int machine_at_ma30d_init(const machine_t *); /* i440EX */ extern int machine_at_brio83xx_init(const machine_t *); extern int machine_at_p6i440e2_init(const machine_t *); +extern int machine_at_como_init(const machine_t *); /* i440BX */ extern int machine_at_bf6_init(const machine_t *); diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 578814a8f7a..0cbca139c09 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -383,6 +383,39 @@ machine_at_brio83xx_init(const machine_t *model) return ret; } +int +machine_at_como_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear("roms/machines/como/COMO.ROM", + 0x000c0000, 262144, 0); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 4); + pci_register_slot(0x0B, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x12, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x13, PCI_CARD_NORMAL, 1, 2, 3, 4); + + device_add(&i440ex_device); + device_add(&piix4e_device); + device_add_params(&fdc37m60x_device, (void*)(FDC37XXX2 | FDC37C93X_NO_NVR | FDC37XXXX_370)); + device_add(&intel_flash_bxt_device); + device_add(&lm78_device); + + if (sound_card_current[0] == SOUND_INTERNAL) + device_add(&cs4235_onboard_device); + + return ret; +} + int machine_at_p6i440e2_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 86729cd66d8..f24682db6bc 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -18360,6 +18360,52 @@ const machine_t machines[] = { .net_device = NULL }, + /* Has a SMC FDC37M60x Super I/O chip with on-chip KBC with AMIKey-2 KBC + firmware. */ + { + .name = "[i440EX] TriGem Como", + .internal_name = "como", + .type = MACHINE_TYPE_SLOT1, + .chipset = MACHINE_CHIPSET_INTEL_440EX, + .init = machine_at_como_init, + .p1_handler = machine_generic_p1_handler, + .gpio_handler = machine_ap440fx_vs440fx_gpio_handler, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SLOT1, + .block = CPU_BLOCK(CPU_CYRIX3S), + .min_bus = 66666667, + .max_bus = 83333333, + .min_voltage = 2050, + .max_voltage = 3100, + .min_multi = 3.5, + .max_multi = 5.0 + }, + .bus_flags = MACHINE_PS2_PCI | MACHINE_BUS_USB, + .flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_ACPI | MACHINE_USB, + .ram = { + .min = 8192, + .max = 262144, + .step = 8192 + }, + .nvrmask = 255, + .jumpered_ecp_dma = 0, + .default_jumpered_ecp_dma = -1, + .kbc_device = NULL, + .kbc_params = 0x00000000, + .kbc_p1 = 0x00000cf0, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = NULL, + .kbd_device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = NULL, + .snd_device = &cs4235_onboard_device, + .net_device = NULL + }, + /* 440BX */ /* Has a Winbond W83977EF Super I/O chip with on-chip KBC with AMIKey-2 KBC firmware. */ diff --git a/src/video/vid_cl54xx.c b/src/video/vid_cl54xx.c index 95f9e7bf6ca..4161e223e82 100644 --- a/src/video/vid_cl54xx.c +++ b/src/video/vid_cl54xx.c @@ -768,6 +768,8 @@ gd54xx_out(uint16_t addr, uint8_t val, void *priv) svga->seqregs[6] = 0x0f; if (svga->crtc[0x27] < CIRRUS_ID_CLGD5429) gd54xx->unlocked = (svga->seqregs[6] == 0x12); + else + gd54xx->unlocked = 1; break; case 0x08: if (gd54xx->i2c) @@ -1643,6 +1645,10 @@ gd54xx_in(uint16_t addr, void *priv) case 0x24: /*Attribute controller toggle readback (R)*/ ret = svga->attrff << 7; break; + case 0x25: /* Part ID */ + if (svga->crtc[0x27] == CIRRUS_ID_CLGD5434) + ret = 0xb0; + break; case 0x26: /*Attribute controller index readback (R)*/ ret = svga->attraddr & 0x3f; break; From 1be6e241b4f90cbdc1c2c40f41e6a28b4b8c6c48 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 11 Jan 2026 18:42:04 +0100 Subject: [PATCH 262/320] Device: Split off bus string obtaining into device_get_bus_name(). --- src/device.c | 103 ++++++++++++++++++++++++++++----------------------- 1 file changed, 56 insertions(+), 47 deletions(-) diff --git a/src/device.c b/src/device.c index 98d4794cfed..857103fa107 100644 --- a/src/device.c +++ b/src/device.c @@ -483,6 +483,61 @@ device_has_config(const device_t *dev) return (c > 0) ? 1 : 0; } +static const char * +device_get_bus_name(const device_t *dev) +{ + const char *sbus = NULL; + + if ((dev->flags & (DEVICE_SIDECAR | DEVICE_ISA)) == (DEVICE_SIDECAR | DEVICE_ISA)) + sbus = "ISA/Sidecar"; + else if (dev->flags & DEVICE_SIDECAR) + sbus = "Sidecar"; + else if (dev->flags & DEVICE_XT_KBC) + sbus = "XT KBC"; + else if (dev->flags & DEVICE_ISA16) + sbus = "ISA16"; + else if (dev->flags & DEVICE_AT_KBC) + sbus = "AT KBC"; + else if (dev->flags & DEVICE_PS2_KBC) + sbus = "PS/2 KBC"; + else if (dev->flags & DEVICE_ISA) + sbus = "ISA"; + else if (dev->flags & DEVICE_CBUS) + sbus = "C-BUS"; + else if (dev->flags & DEVICE_PCMCIA) + sbus = "PCMCIA"; + else if (dev->flags & DEVICE_MCA) + sbus = "MCA"; + else if (dev->flags & DEVICE_MCA32) + sbus = "MCA32"; + else if (dev->flags & DEVICE_HIL) + sbus = "HP HIL"; + else if (dev->flags & DEVICE_EISA) + sbus = "EISA"; + else if (dev->flags & DEVICE_AT32) + sbus = "AT/32"; + else if (dev->flags & DEVICE_OLB) + sbus = "OLB"; + else if (dev->flags & DEVICE_VLB) + sbus = "VLB"; + else if (dev->flags & DEVICE_PCI) + sbus = "PCI"; + else if (dev->flags & DEVICE_CARDBUS) + sbus = "CardBus"; + else if (dev->flags & DEVICE_USB) + sbus = "USB"; + else if (dev->flags & DEVICE_AGP) + sbus = "AGP"; + else if (dev->flags & DEVICE_AC97) + sbus = "AMR"; + else if (dev->flags & DEVICE_COM) + sbus = "COM"; + else if (dev->flags & DEVICE_LPT) + sbus = "LPT"; + + return sbus; +} + void device_get_name(const device_t *dev, int bus, char *name) { @@ -497,53 +552,7 @@ device_get_name(const device_t *dev, int bus, char *name) name[0] = 0x00; if (bus) { - if ((dev->flags & (DEVICE_SIDECAR | DEVICE_ISA)) == - (DEVICE_SIDECAR | DEVICE_ISA)) - sbus = "ISA/Sidecar"; - else if (dev->flags & DEVICE_SIDECAR) - sbus = "Sidecar"; - else if (dev->flags & DEVICE_XT_KBC) - sbus = "XT KBC"; - else if (dev->flags & DEVICE_ISA16) - sbus = "ISA16"; - else if (dev->flags & DEVICE_AT_KBC) - sbus = "AT KBC"; - else if (dev->flags & DEVICE_PS2_KBC) - sbus = "PS/2 KBC"; - else if (dev->flags & DEVICE_ISA) - sbus = "ISA"; - else if (dev->flags & DEVICE_CBUS) - sbus = "C-BUS"; - else if (dev->flags & DEVICE_PCMCIA) - sbus = "PCMCIA"; - else if (dev->flags & DEVICE_MCA) - sbus = "MCA"; - else if (dev->flags & DEVICE_MCA32) - sbus = "MCA32"; - else if (dev->flags & DEVICE_HIL) - sbus = "HP HIL"; - else if (dev->flags & DEVICE_EISA) - sbus = "EISA"; - else if (dev->flags & DEVICE_AT32) - sbus = "AT/32"; - else if (dev->flags & DEVICE_OLB) - sbus = "OLB"; - else if (dev->flags & DEVICE_VLB) - sbus = "VLB"; - else if (dev->flags & DEVICE_PCI) - sbus = "PCI"; - else if (dev->flags & DEVICE_CARDBUS) - sbus = "CardBus"; - else if (dev->flags & DEVICE_USB) - sbus = "USB"; - else if (dev->flags & DEVICE_AGP) - sbus = "AGP"; - else if (dev->flags & DEVICE_AC97) - sbus = "AMR"; - else if (dev->flags & DEVICE_COM) - sbus = "COM"; - else if (dev->flags & DEVICE_LPT) - sbus = "LPT"; + sbus = device_get_bus_name(dev); if (sbus != NULL) { /* First concatenate [] before the device's name. */ From 6b8a841ef909265b1ca06d36b5997888a911f738 Mon Sep 17 00:00:00 2001 From: Bozo Scum Date: Mon, 12 Jan 2026 11:40:22 +0800 Subject: [PATCH 263/320] Update zh-TW.po --- src/qt/languages/zh-TW.po | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 299e68b7067..4da19a8c3d0 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -266,7 +266,7 @@ msgid "&Rewind to the beginning" msgstr "倒帶至起點(&R)" msgid "&Fast forward to the end" -msgstr "快進至終點(&F)" +msgstr "快轉至終點(&F)" msgid "E&ject" msgstr "退出(&J)" @@ -2987,7 +2987,7 @@ msgid "OpenGL input stretch mode" msgstr "OpenGL 的輸入延展模式" msgid "Color scheme" -msgstr "配色方案" +msgstr "色彩配置" msgid "Light" msgstr "亮色" @@ -3011,4 +3011,4 @@ msgid "&Allow recompilation" msgstr "允許重編譯(&A)" msgid "&Fast forward" -msgstr "" +msgstr "快轉(&F)" From 695033be7eb79895c768aa2488be5ddd1cfa5bab Mon Sep 17 00:00:00 2001 From: BlueRain-debug <68976789+BlueRain-debug@users.noreply.github.com> Date: Mon, 12 Jan 2026 18:04:06 +0800 Subject: [PATCH 264/320] Update zh-CN.po Filled in the empty string and adjusted some translations. --- src/qt/languages/zh-CN.po | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index d99fb54d5c1..a74ddbbbafc 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -1657,7 +1657,7 @@ msgid "&Connected" msgstr "已连接(&C)" msgid "Clear image &history" -msgstr "清除映像历史记录(&H)" +msgstr "清除镜像文件历史记录(&H)" msgid "Create…" msgstr "创建…" @@ -1720,7 +1720,7 @@ msgid "\nFalling back to software rendering." msgstr "\n回到软件渲染。" msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" -msgstr "

选择媒体图像(光盘、软盘等)时,打开对话框将从与 86Box 配置文件相同的目录开始。这一设置可能只会在 macOS 上产生影响。

" +msgstr "

选择媒体镜像(光盘、软盘等)时,打开对话框将从与 86Box 配置文件相同的目录开始。这一设置可能只会在 macOS 上产生影响。

" msgid "This machine might have been moved or copied." msgstr "这台机器可能被移动或复制过。" @@ -1762,7 +1762,7 @@ msgid "Mode:" msgstr "模式:" msgid "Interface:" -msgstr "界面:" +msgstr "接口:" msgid "Adapter:" msgstr "适配器:" @@ -2569,7 +2569,7 @@ msgid "3Dfx Voodoo 2" msgstr "3Dfx Voodoo 2" msgid "Obsidian SB50 + Amethyst (2 TMUs)" -msgstr "Obsidian SB50 + Amethyst(2 个 TMU)" +msgstr "Obsidian SB50 + Amethyst(双TMU)" msgid "8-bit" msgstr "8 位" @@ -2923,7 +2923,7 @@ msgid "86Box Update" msgstr "86Box 更新" msgid "Release notes:" -msgstr "发行版说明:" +msgstr "发行说明:" msgid "%1 Hz" msgstr "%1 Hz" @@ -3004,4 +3004,4 @@ msgid "&Allow recompilation" msgstr "允许重编译(&A)" msgid "&Fast forward" -msgstr "" +msgstr "快进(&F)" From 527fb269e2321c4e6377238aeede23e895cd4d48 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Mon, 12 Jan 2026 16:20:32 +0600 Subject: [PATCH 265/320] Auto-load `gm.dls` on Windows if FluidSynth 2.5.0 or later is detected and no soundfont is specified Windows builds should generally use it or later --- src/include/86box/plat.h | 3 +++ src/qt/qt_platform.cpp | 10 ++++++++++ src/sound/midi_fluidsynth.c | 13 +++++++++++++ 3 files changed, 26 insertions(+) diff --git a/src/include/86box/plat.h b/src/include/86box/plat.h index 316825f1073..efbd068989e 100644 --- a/src/include/86box/plat.h +++ b/src/include/86box/plat.h @@ -151,6 +151,9 @@ extern void plat_resize_request(int x, int y, int monitor_index); extern int plat_language_code(char *langcode); extern void plat_language_code_r(int id, char *outbuf, int len); extern void plat_get_cpu_string(char *outbuf, uint8_t len); +#ifdef _WIN32 +extern void plat_get_system_directory(char *outbuf); +#endif extern void plat_set_thread_name(void *thread, const char *name); extern void plat_break(void); extern void plat_send_to_clipboard(unsigned char *rgb, int width, int height); diff --git a/src/qt/qt_platform.cpp b/src/qt/qt_platform.cpp index 9fd16d3f15b..3ecff875a0f 100644 --- a/src/qt/qt_platform.cpp +++ b/src/qt/qt_platform.cpp @@ -752,6 +752,16 @@ plat_chdir(char *path) return QDir::setCurrent(QString(path)) ? 0 : -1; } +#ifdef _WIN32 +void plat_get_system_directory(char *outbuf) +{ + wchar_t wc[512]; + GetSystemWindowsDirectoryW(wc, 512); + QString str = QString::fromWCharArray(wc); + strcpy(outbuf, str.toUtf8()); +} +#endif + void plat_get_global_config_dir(char *outbuf, const size_t len) { diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index 1afefd90568..f1f977f0937 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -16,6 +16,7 @@ #include <86box/thread.h> #include <86box/sound.h> #include <86box/plat_unused.h> +#include <86box/plat.h> #define RENDER_RATE 100 #define BUFFER_SEGMENTS 10 @@ -154,6 +155,7 @@ fluidsynth_init(UNUSED(const device_t *info)) { fluidsynth_t *data = &fsdev; midi_device_t *dev; + char path[4096] = { 0 }; memset(data, 0, sizeof(fluidsynth_t)); @@ -170,6 +172,17 @@ fluidsynth_init(UNUSED(const device_t *info)) if (!sound_font || sound_font[0] == 0) sound_font = (access("/usr/share/sounds/sf2/FluidR3_GM.sf2", F_OK) == 0 ? "/usr/share/sounds/sf2/FluidR3_GM.sf2" : (access("/usr/share/soundfonts/default.sf2", F_OK) == 0 ? "/usr/share/soundfonts/default.sf2" : "")); +#elif defined _WIN32 + if (!sound_font || sound_font[0] == 0) { + // FluidSynth 2.5.x and later supports DLS without libinstpatch. + int major, minor, patch; + fluid_version(&major, &minor, &patch); + if ((major == 2 && minor >= 5) || (major >= 3)) { + plat_get_system_directory(path); + strcat(path, "\\system32\\drivers\\gm.dls"); + sound_font = plat_file_check(path) ? path : ""; + } + } #endif data->sound_font = fluid_synth_sfload(data->synth, sound_font, 1); From 9407c281a6ccdd3406d9fa99c499c60ba31a982e Mon Sep 17 00:00:00 2001 From: mw308 <34479591+mw308@users.noreply.github.com> Date: Mon, 12 Jan 2026 12:17:48 +0000 Subject: [PATCH 266/320] Added F1 BIOS to GA-686BX --- src/machine/m_at_slot1.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 0cbca139c09..7b62b4a8182 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -790,7 +790,16 @@ static const device_config_t ga686_config[] = { .files = { "roms/machines/686bx/31nologo.bin", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision F2a", + .name = "Award Modular BIOS v4.51PG - Revision F1 (Latest)", + .internal_name = "686bx", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 262144, + .files = { "roms/machines/686bx/6BX.F1", "" } + }, + { + .name = "Award Modular BIOS v4.51PG - Revision F2a (Beta)", .internal_name = "686bx", .bios_type = BIOS_NORMAL, .files_no = 1, From d03660870733970d1e45b6140b71e82de1ccd27e Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Tue, 13 Jan 2026 00:50:42 +0600 Subject: [PATCH 267/320] Fix texture loading --- src/qt/qt_openglrenderer.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qt/qt_openglrenderer.cpp b/src/qt/qt_openglrenderer.cpp index 22e400c6571..788a7474462 100644 --- a/src/qt/qt_openglrenderer.cpp +++ b/src/qt/qt_openglrenderer.cpp @@ -600,7 +600,7 @@ load_texture(const char *f, struct shader_texture *tex) const GLubyte *rgb = img.constBits(); - int bpp = 4; + int bpp = 3; GLubyte *data = (GLubyte *) malloc((size_t) width * height * bpp); @@ -611,7 +611,6 @@ load_texture(const char *f, struct shader_texture *tex) data[(y * width + x) * bpp + 0] = rgb[(Y * width + x) * 3 + 0]; data[(y * width + x) * bpp + 1] = rgb[(Y * width + x) * 3 + 1]; data[(y * width + x) * bpp + 2] = rgb[(Y * width + x) * 3 + 2]; - data[(y * width + x) * bpp + 3] = rgb[(Y * width + x) * 3 + 3]; } } From c4ba299d7ffdb20233bc589680ecd614463d4098 Mon Sep 17 00:00:00 2001 From: kotochi98 <185547947+kotochi98@users.noreply.github.com> Date: Tue, 13 Jan 2026 13:21:57 +0300 Subject: [PATCH 268/320] Add the MSI MS-6117 and its OEM/foreign language BIOS variants --- src/include/86box/machine.h | 4 + src/machine/m_at_slot1.c | 161 ++++++++++++++++++++++++++++++++++++ src/machine/machine_table.c | 45 ++++++++++ 3 files changed, 210 insertions(+) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index 71a1c9867a3..a7920bad082 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -1224,6 +1224,10 @@ extern const device_t ga686_device; #endif extern int machine_at_ga686_init(const machine_t *); #ifdef EMU_DEVICE_H +extern const device_t ms6117_device; +#endif +extern int machine_at_ms6117_init(const machine_t *); +#ifdef EMU_DEVICE_H extern const device_t ms6119_device; #endif extern int machine_at_ms6119_init(const machine_t *); diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 7b62b4a8182..92e1a119549 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -307,6 +307,167 @@ machine_at_spitfire_init(const machine_t *model) return ret; } +static const device_config_t ms6117_config[] = { + // clang-format off + { + .name = "bios", + .description = "BIOS Version", + .type = CONFIG_BIOS, + .default_string = "ms6117a", + .default_int = 0, + .file_filter = NULL, + .spinner = { 0 }, + .selection = { { 0 } }, + .bios = { + { + .name = "AMIBIOS 6 (071595) - Revision 2.0 (latest)", + .internal_name = "ms6117a", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/A617MS20.ROM", "" } + }, + { + .name = "AMIBIOS 6 (071595) - Revision 4.10tc (Traditional Chinese)", + .internal_name = "ms6117atc", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/A617C410.ROM", "" } + }, + { + .name = "AMIBIOS 6 (071595) - Revision 3.11sc (Simplified Chinese)", + .internal_name = "ms6117asc", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/A617C311.ROM", "" } + }, + { + .name = "AMIBIOS 6 (071595) - Revision 1.10j (Japanese)", + .internal_name = "ms6117aj", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/A617J110.ROM", "" } + }, + { + .name = "AwardBIOS v4.51PG - Revision 3.2 (Latest)", + .internal_name = "ms6117w", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 262144, + .files = { "roms/machines/ms6117/W617MS32.BIN", "" } + }, + { + .name = "AwardBIOS v4.51PG - Revision 3.2 (Patched for large HDDs)", + .internal_name = "ms6117wp", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 262144, + .files = { "roms/machines/ms6117/611732x_patched.BIN", "" } + }, + { + .name = "AwardBIOS v4.51PG - Revision 1.5 (Viglen OEM)", + .internal_name = "ms6117wvi", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/w617v115.BIN", "" } + }, + { + .name = "AwardBIOS v4.51PG - Revision 1.4 (Fujitsu-Siemens OEM)", + .internal_name = "ms6117wfs", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/AWARD 1.04 .BIN", "" } + }, + { + .name = "AwardBIOS v4.51PG - Revision 1.02 (LG IBM OEM)", + .internal_name = "ms6117wlg", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 262144, + .files = { "roms/machines/ms6117/BIOS.BIN", "" } + }, + { .files_no = 0 } + } + }, + { .name = "", .description = "", .type = CONFIG_END } + // clang-format on +}; + +const device_t ms6117_device = { + .name = "MSI MS-6117", + .internal_name = "ms6117", + .flags = 0, + .local = 0, + .init = NULL, + .close = NULL, + .reset = NULL, + .available = NULL, + .speed_changed = NULL, + .force_redraw = NULL, + .config = ms6117_config +}; + +int +machine_at_ms6117_init(const machine_t *model) +{ + int ret = 0; + const char *fn; + + /* No ROMs available */ + if (!device_available(model->device)) + return ret; + + device_context(model->device); + fn = device_get_bios_file(machine_get_device(machine), device_get_config_bios("bios"), 0); + if (!strcmp(fn, "roms/machines/ms6117/W617MS32.BIN") || !strcmp(fn, "roms/machines/ms6117/611732x_patched.BIN") || !strcmp(fn, "roms/machines/ms6117/BIOS.BIN")) + ret = bios_load_linear(fn, 0x000c0000, 262144, 0); + else + ret = bios_load_linear(fn, 0x000e0000, 131072, 0); + device_context_restore(); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + pci_init(PCI_CONFIG_TYPE_1); + pci_register_slot(0x00, PCI_CARD_NORTHBRIDGE, 0, 0, 0, 0); + pci_register_slot(0x0E, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x0F, PCI_CARD_NORMAL, 2, 3, 4, 1); + pci_register_slot(0x10, PCI_CARD_NORMAL, 3, 4, 1, 2); + pci_register_slot(0x11, PCI_CARD_NORMAL, 4, 1, 2, 3); + pci_register_slot(0x12, PCI_CARD_NORMAL, 1, 2, 3, 4); + pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 1, 2, 3, 4); + pci_register_slot(0x01, PCI_CARD_AGPBRIDGE, 1, 2, 3, 4); + + device_add(&i440lx_device); + device_add(&piix4e_device); + device_add_params(&w83977_device, (void *) (W83977TF | W83977_AMI | W83977_NO_NVR)); + + if (!strcmp(fn, "roms/machines/ms6117/W617MS32.BIN") || !strcmp(fn, "roms/machines/ms6117/611732x_patched.BIN") || !strcmp(fn, "roms/machines/ms6117/BIOS.BIN")) + device_add(&winbond_flash_w29c020_device); /* assumed */ + else + device_add(&winbond_flash_w29c011a_device); + + spd_register(SPD_TYPE_SDRAM, 0xF, 256); + + return ret; +} + int machine_at_ma30d_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index f24682db6bc..0533af51e43 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -18218,6 +18218,51 @@ const machine_t machines[] = { .snd_device = NULL, .net_device = NULL }, + /* Has a Winbond W83977TF Super I/O chip with on-chip KBC with AMIKey-2 KBC + firmware. */ + { + .name = "[i440LX] MSI MS-6117", + .internal_name = "ms6117", + .type = MACHINE_TYPE_SLOT1, + .chipset = MACHINE_CHIPSET_INTEL_440LX, + .init = machine_at_ms6117_init, + .p1_handler = machine_generic_p1_handler, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SLOT1, + .block = CPU_BLOCK_NONE, + .min_bus = 60000000, + .max_bus = 83333333, + .min_voltage = 1500, + .max_voltage = 3500, + .min_multi = 2.0, + .max_multi = 5.5 + }, + .bus_flags = MACHINE_PS2_AGP | MACHINE_BUS_USB, + .flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_USB, + .ram = { + .min = 8192, + .max = 786432, + .step = 8192 + }, + .nvrmask = 255, + .jumpered_ecp_dma = 0, + .default_jumpered_ecp_dma = -1, + .kbc_device = NULL, + .kbc_params = 0x00000000, + .kbc_p1 = 0x00000cf0, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = &ms6117_device, + .kbd_device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = NULL, + .snd_device = NULL, + .net_device = NULL + }, /* Has a SM(S)C FDC37C67x Super I/O chip with on-chip KBC with Phoenix or AMIKey-2 KBC firmware. */ { From b9f9a747a1514679c0be9d40a8d0ce8e229a4c8a Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Tue, 13 Jan 2026 17:48:37 +0700 Subject: [PATCH 269/320] Fixed the BIOS internal name for GA-686BX Also BIOS name changes for MS-6117. --- src/machine/m_at_slot1.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index 92e1a119549..eb975de7eb2 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -356,7 +356,7 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/A617J110.ROM", "" } }, { - .name = "AwardBIOS v4.51PG - Revision 3.2 (Latest)", + .name = "Award Modular BIOS v4.51PG - Revision 3.2 (Latest)", .internal_name = "ms6117w", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -365,7 +365,7 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/W617MS32.BIN", "" } }, { - .name = "AwardBIOS v4.51PG - Revision 3.2 (Patched for large HDDs)", + .name = "Award Modular BIOS v4.51PG - Revision 3.2 [Patched for larger drives]", .internal_name = "ms6117wp", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -374,7 +374,7 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/611732x_patched.BIN", "" } }, { - .name = "AwardBIOS v4.51PG - Revision 1.5 (Viglen OEM)", + .name = "Award Modular BIOS v4.51PG - Revision 1.5 (Viglen Vig67M)", .internal_name = "ms6117wvi", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -383,7 +383,7 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/w617v115.BIN", "" } }, { - .name = "AwardBIOS v4.51PG - Revision 1.4 (Fujitsu-Siemens OEM)", + .name = "Award Modular BIOS v4.51PG - Revision 1.4 (Fujitsu-Siemens OEM)", .internal_name = "ms6117wfs", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -392,7 +392,7 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/AWARD 1.04 .BIN", "" } }, { - .name = "AwardBIOS v4.51PG - Revision 1.02 (LG IBM OEM)", + .name = "Award Modular BIOS v4.51PG - Revision 1.02 (LG IBM Multinet x7E)", .internal_name = "ms6117wlg", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -952,7 +952,7 @@ static const device_config_t ga686_config[] = { }, { .name = "Award Modular BIOS v4.51PG - Revision F1 (Latest)", - .internal_name = "686bx", + .internal_name = "686bx_f1", .bios_type = BIOS_NORMAL, .files_no = 1, .local = 0, @@ -1079,7 +1079,7 @@ static const device_config_t ms6119_config[] = { .files = { "roms/machines/ms6119/vig69m.212", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision 3.30b1 (LG IBM Multinet i x7G)", + .name = "Award Modular BIOS v4.51PG - Revision 3.30b1 (LG IBM Multinet x7G)", .internal_name = "lgibmx7g", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -1708,7 +1708,7 @@ static const device_config_t ms6199va_config[] = { .files = { "roms/machines/ms6199va/W6199VC8.BIN", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq OEM) [patched for large drives]", + .name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq OEM) [Patched for larger drives]", .internal_name = "ms6199va_200p", .bios_type = BIOS_NORMAL, .files_no = 1, From bb83a5c1fb2ad58979940396a88956eae53b0dfe Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 00:56:35 +0700 Subject: [PATCH 270/320] MS-6117 corrections + BIOS names sorted According to this machine's manual. --- src/machine/m_at_slot1.c | 36 ++++++++++++++++++------------------ src/machine/machine_table.c | 10 +++++----- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index eb975de7eb2..a05642e9b9f 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -320,7 +320,7 @@ static const device_config_t ms6117_config[] = { .selection = { { 0 } }, .bios = { { - .name = "AMIBIOS 6 (071595) - Revision 2.0 (latest)", + .name = "AMIBIOS 6 (071595) - Revision 2.0", .internal_name = "ms6117a", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -329,13 +329,13 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/A617MS20.ROM", "" } }, { - .name = "AMIBIOS 6 (071595) - Revision 4.10tc (Traditional Chinese)", - .internal_name = "ms6117atc", + .name = "AMIBIOS 6 (071595) - Revision 1.10j (Japanese)", + .internal_name = "ms6117aj", .bios_type = BIOS_NORMAL, .files_no = 1, .local = 0, .size = 131072, - .files = { "roms/machines/ms6117/A617C410.ROM", "" } + .files = { "roms/machines/ms6117/A617J110.ROM", "" } }, { .name = "AMIBIOS 6 (071595) - Revision 3.11sc (Simplified Chinese)", @@ -347,16 +347,16 @@ static const device_config_t ms6117_config[] = { .files = { "roms/machines/ms6117/A617C311.ROM", "" } }, { - .name = "AMIBIOS 6 (071595) - Revision 1.10j (Japanese)", - .internal_name = "ms6117aj", + .name = "AMIBIOS 6 (071595) - Revision 4.10tc (Traditional Chinese)", + .internal_name = "ms6117atc", .bios_type = BIOS_NORMAL, .files_no = 1, .local = 0, .size = 131072, - .files = { "roms/machines/ms6117/A617J110.ROM", "" } + .files = { "roms/machines/ms6117/A617C410.ROM", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision 3.2 (Latest)", + .name = "Award Modular BIOS v4.51PG - Revision 3.2", .internal_name = "ms6117w", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -373,15 +373,6 @@ static const device_config_t ms6117_config[] = { .size = 262144, .files = { "roms/machines/ms6117/611732x_patched.BIN", "" } }, - { - .name = "Award Modular BIOS v4.51PG - Revision 1.5 (Viglen Vig67M)", - .internal_name = "ms6117wvi", - .bios_type = BIOS_NORMAL, - .files_no = 1, - .local = 0, - .size = 131072, - .files = { "roms/machines/ms6117/w617v115.BIN", "" } - }, { .name = "Award Modular BIOS v4.51PG - Revision 1.4 (Fujitsu-Siemens OEM)", .internal_name = "ms6117wfs", @@ -400,6 +391,15 @@ static const device_config_t ms6117_config[] = { .size = 262144, .files = { "roms/machines/ms6117/BIOS.BIN", "" } }, + { + .name = "Award Modular BIOS v4.51PG - Revision 1.5 (Viglen Vig67M)", + .internal_name = "ms6117wvi", + .bios_type = BIOS_NORMAL, + .files_no = 1, + .local = 0, + .size = 131072, + .files = { "roms/machines/ms6117/w617v115.BIN", "" } + }, { .files_no = 0 } } }, @@ -951,7 +951,7 @@ static const device_config_t ga686_config[] = { .files = { "roms/machines/686bx/31nologo.bin", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision F1 (Latest)", + .name = "Award Modular BIOS v4.51PG - Revision F1", .internal_name = "686bx_f1", .bios_type = BIOS_NORMAL, .files_no = 1, diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 0533af51e43..51ff3a30f34 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -18233,18 +18233,18 @@ const machine_t machines[] = { .cpu = { .package = CPU_PKG_SLOT1, .block = CPU_BLOCK_NONE, - .min_bus = 60000000, - .max_bus = 83333333, - .min_voltage = 1500, + .min_bus = 66666667, + .max_bus = 75000000, + .min_voltage = 1800, .max_voltage = 3500, .min_multi = 2.0, - .max_multi = 5.5 + .max_multi = 8.0 }, .bus_flags = MACHINE_PS2_AGP | MACHINE_BUS_USB, .flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_USB, .ram = { .min = 8192, - .max = 786432, + .max = 1048576, .step = 8192 }, .nvrmask = 255, From e7198230e50703d3dd807a2ce57d0a8a4bcf9a2d Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 01:09:50 +0700 Subject: [PATCH 271/320] Onboard devices update to existing machines --- src/machine/m_at_286.c | 4 ++-- src/machine/m_at_386sx.c | 2 +- src/machine/m_at_socket2.c | 9 +++++---- src/machine/m_at_socket7.c | 2 +- src/machine/machine_table.c | 16 ++++++++-------- src/network/net_pcnet.c | 2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/machine/m_at_286.c b/src/machine/m_at_286.c index 499f0653ac1..ad36e3245ad 100644 --- a/src/machine/m_at_286.c +++ b/src/machine/m_at_286.c @@ -938,7 +938,7 @@ machine_at_pc7286_init(const machine_t *model) machine_at_common_init_ex(model, 2); if (gfxcard[0] == VID_INTERNAL) - device_add(&gd5401_onboard_device); + device_add(machine_get_vid_device(machine)); device_add_params(&dw90c50_device, (void *) DW90C50_IDE); device_add(&vl82c113_device); /* The keyboard controller is part of the VL82c113. */ @@ -1161,7 +1161,7 @@ machine_at_spc4620p_init(const machine_t *model) return ret; if (gfxcard[0] == VID_INTERNAL) - device_add(&ati28800k_spc4620p_device); + device_add(machine_get_vid_device(machine)); machine_at_scat_init(model, 1, 1); diff --git a/src/machine/m_at_386sx.c b/src/machine/m_at_386sx.c index ae9870c77e5..9ad29e2e87d 100644 --- a/src/machine/m_at_386sx.c +++ b/src/machine/m_at_386sx.c @@ -750,7 +750,7 @@ machine_at_wd76c10_init(const machine_t *model) machine_at_common_init_ex(model, 2); if (gfxcard[0] == VID_INTERNAL) - device_add(¶dise_wd90c11_megapc_device); + device_add(machine_get_vid_device(machine)); device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params); diff --git a/src/machine/m_at_socket2.c b/src/machine/m_at_socket2.c index 8ea151f5300..673794fcc66 100644 --- a/src/machine/m_at_socket2.c +++ b/src/machine/m_at_socket2.c @@ -343,8 +343,12 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 machine_at_common_ide_init(model); device_add(&sis_85c461_device); + if (gfxcard[0] == VID_INTERNAL) - device_add(&et4000w32_onboard_device); + device_add(machine_get_vid_device(machine)); + else { + for (uint16_t i = 0; i < 32768; i++) + rom[i] = mem_readb_phys(0x000c0000 + i); device_add_params(&fdc37c6xx_device, (void *) (FDC37C661 | FDC37C6XX_IDE_PRI)); @@ -353,9 +357,6 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 if (fdc_current[0] == FDC_INTERNAL) device_add(&fdc_at_device); - if (gfxcard[0] != VID_INTERNAL) { - for (uint16_t i = 0; i < 32768; i++) - rom[i] = mem_readb_phys(0x000c0000 + i); } mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000); mem_mapping_set_exec(&bios_mapping, rom); diff --git a/src/machine/m_at_socket7.c b/src/machine/m_at_socket7.c index 31580e6e358..7261e2616ae 100644 --- a/src/machine/m_at_socket7.c +++ b/src/machine/m_at_socket7.c @@ -1211,7 +1211,7 @@ machine_at_pb810_init(const machine_t *model) pci_register_slot(0x07, PCI_CARD_SOUTHBRIDGE, 0, 0, 0, 0); if (sound_card_current[0] == SOUND_INTERNAL) - device_add(&cs4237b_device); + machine_snd = device_add(machine_get_snd_device(machine)); device_add(&i430vx_device); device_add(&piix3_device); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 51ff3a30f34..4da66054819 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -4442,7 +4442,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = NULL, + .vid_device = &gd5401_onboard_device, .snd_device = NULL, .net_device = NULL }, @@ -4884,7 +4884,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = NULL, + .vid_device = &ati28800k_spc4620p_device, .snd_device = NULL, .net_device = NULL }, @@ -5373,7 +5373,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = &tvga8900d_device, + .vid_device = &tvga8900d_device, /* Onboard variant not yet emulated */ .snd_device = NULL, .net_device = NULL }, @@ -6043,7 +6043,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = NULL, + .vid_device = ¶dise_wd90c11_megapc_device, .snd_device = NULL, .net_device = NULL }, @@ -8445,7 +8445,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = NULL, + .vid_device = &et4000w32_onboard_device, .snd_device = NULL, .net_device = NULL }, @@ -10632,7 +10632,7 @@ const machine_t machines[] = { .fdc_device = NULL, .sio_device = NULL, .vid_device = &gd5430_onboard_pci_device, - .snd_device = &ess_1688_device, + .snd_device = &ess_1688_device, /* Onboard variant not yet emulated */ .net_device = NULL }, /* This has an AMIKey-2, which is an updated version of type 'H'. */ @@ -15721,7 +15721,7 @@ const machine_t machines[] = { .fdc_device = NULL, .sio_device = NULL, .vid_device = NULL, - .snd_device = NULL, + .snd_device = &cs4237b_device, .net_device = NULL }, /* This has the AMIKey 'H' firmware, possibly AMIKey-2. Photos show it with a BestKey, so it @@ -16044,7 +16044,7 @@ const machine_t machines[] = { .fdc_device = NULL, .sio_device = NULL, .vid_device = &s3_trio64v2_dx_onboard_pci_device, - .snd_device = &cs4236b_device, + .snd_device = &cs4236b_onboard_device, .net_device = &pcnet_am79c973_onboard_device }, /* This has the Phoenix MultiKey KBC firmware on the NSC Super I/O chip. */ diff --git a/src/network/net_pcnet.c b/src/network/net_pcnet.c index 0c97d1078ad..2d9aa88bbf6 100644 --- a/src/network/net_pcnet.c +++ b/src/network/net_pcnet.c @@ -3317,7 +3317,7 @@ const device_t pcnet_am79c973_device = { }; const device_t pcnet_am79c973_onboard_device = { - .name = "AMD PCnet-FAST III", + .name = "AMD PCnet-FAST III (On-Board)", .internal_name = "pcnetfast_onboard", .flags = DEVICE_PCI, .local = DEV_AM79C973 | 0x0100, From 819a6a35072eb7a5a66924f7a6763f38e83b9bb2 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 01:42:08 +0700 Subject: [PATCH 272/320] Machine onboard device fixes --- src/machine/m_at_socket2.c | 7 ++++--- src/machine/machine_table.c | 2 +- src/sound/snd_cs423x.c | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/machine/m_at_socket2.c b/src/machine/m_at_socket2.c index 673794fcc66..7a73baf4a2a 100644 --- a/src/machine/m_at_socket2.c +++ b/src/machine/m_at_socket2.c @@ -92,7 +92,7 @@ machine_at_acera1g_init(const machine_t *model) device_add(&ali1429g_device); if (gfxcard[0] == VID_INTERNAL) - device_add(&gd5428_onboard_device); + device_add(machine_get_vid_device(machine)); device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params); @@ -345,8 +345,9 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 device_add(&sis_85c461_device); if (gfxcard[0] == VID_INTERNAL) - device_add(machine_get_vid_device(machine)); - else { + device_add(&et4000w32_onboard_device); + + if (gfxcard[0] == VID_INTERNAL) for (uint16_t i = 0; i < 32768; i++) rom[i] = mem_readb_phys(0x000c0000 + i); diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 4da66054819..4500dd1cb42 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -12069,7 +12069,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = &s3_phoenix_vision864_pci_device, + .vid_device = &s3_phoenix_vision864_pci_device, /* Onboard variant not yet emulated */ .snd_device = NULL, .net_device = NULL }, diff --git a/src/sound/snd_cs423x.c b/src/sound/snd_cs423x.c index 4fd630e07c9..b9004454e8c 100644 --- a/src/sound/snd_cs423x.c +++ b/src/sound/snd_cs423x.c @@ -1203,7 +1203,7 @@ const device_t cs4236b_device = { }; const device_t cs4236b_onboard_device = { - .name = "Crystal CS4236B", + .name = "Crystal CS4236B (On-Board)", .internal_name = "cs4236b", .flags = DEVICE_ISA16, .local = CRYSTAL_CS4236B | CRYSTAL_NOEEPROM, From c09793eb71d0d6666af16f562d300ca0b1019ea8 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 01:57:05 +0700 Subject: [PATCH 273/320] Fixed a compile-breaking mistake --- src/machine/m_at_socket2.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/machine/m_at_socket2.c b/src/machine/m_at_socket2.c index 7a73baf4a2a..e2786abc7b0 100644 --- a/src/machine/m_at_socket2.c +++ b/src/machine/m_at_socket2.c @@ -347,10 +347,6 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 if (gfxcard[0] == VID_INTERNAL) device_add(&et4000w32_onboard_device); - if (gfxcard[0] == VID_INTERNAL) - for (uint16_t i = 0; i < 32768; i++) - rom[i] = mem_readb_phys(0x000c0000 + i); - device_add_params(&fdc37c6xx_device, (void *) (FDC37C661 | FDC37C6XX_IDE_PRI)); device_add_params(machine_get_kbc_device(machine), (void *) model->kbc_params); @@ -358,6 +354,9 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 if (fdc_current[0] == FDC_INTERNAL) device_add(&fdc_at_device); + if (gfxcard[0] == VID_INTERNAL) { + for (uint16_t i = 0; i < 32768; i++) + rom[i] = mem_readb_phys(0x000c0000 + i); } mem_mapping_set_addr(&bios_mapping, 0x0c0000, 0x40000); mem_mapping_set_exec(&bios_mapping, rom); From 0f160acb685c4ed010120a8299e3e3a047fe7aa9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 14 Jan 2026 01:17:10 +0600 Subject: [PATCH 274/320] Make internal floppy disk controller the default --- src/floppy/fdc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/floppy/fdc.c b/src/floppy/fdc.c index fb1b0c31e7a..d6d27da3bb8 100644 --- a/src/floppy/fdc.c +++ b/src/floppy/fdc.c @@ -77,7 +77,7 @@ int lastbyte = 0; int floppymodified[4]; int floppyrate[4]; -int fdc_current[FDC_MAX] = { 0, 0 }; +int fdc_current[FDC_MAX] = { FDC_INTERNAL, 0 }; volatile int fdcinited = 0; @@ -2882,4 +2882,4 @@ const device_t fdc_ps2_mca_device = { .speed_changed = NULL, .force_redraw = NULL, .config = NULL -}; \ No newline at end of file +}; From fa4ea1353e7f1248021cf6289650b0b1f39fedbf Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 02:23:24 +0700 Subject: [PATCH 275/320] Onboard name updates --- src/machine/m_amstrad.c | 16 ++++++++-------- src/machine/m_xt_olivetti.c | 2 +- src/machine/machine_table.c | 4 ++-- src/video/vid_ati28800.c | 4 ++-- src/video/vid_ati_mach64.c | 2 +- src/video/vid_cga_olivetti.c | 2 +- src/video/vid_ht216.c | 2 +- src/video/vid_oak_oti.c | 10 +++++----- src/video/vid_paradise.c | 8 ++++---- src/video/vid_tandy.c | 6 +++--- 10 files changed, 28 insertions(+), 28 deletions(-) diff --git a/src/machine/m_amstrad.c b/src/machine/m_amstrad.c index f056397a10b..8e4a16c60af 100644 --- a/src/machine/m_amstrad.c +++ b/src/machine/m_amstrad.c @@ -784,7 +784,7 @@ const device_config_t vid_1512_config[] = { }; const device_t vid_1512_device = { - .name = "Amstrad PC1512 (video)", + .name = "Amstrad PC1512 (Video)", .internal_name = "vid_1512", .flags = 0, .local = 0, @@ -985,7 +985,7 @@ const device_config_t vid_1640_config[] = { }; const device_t vid_1640_device = { - .name = "Amstrad PC1640 (video)", + .name = "Amstrad PC1640 (Video)", .internal_name = "vid_1640", .flags = 0, .local = 0, @@ -1911,7 +1911,7 @@ const device_config_t vid_200_config[] = { }; const device_t vid_200_device = { - .name = "Amstrad PC200 (video)", + .name = "Amstrad PC200 (Video)", .internal_name = "vid_200", .flags = 0, .local = 0, @@ -2019,7 +2019,7 @@ const device_config_t vid_ppc512_config[] = { }; const device_t vid_ppc512_device = { - .name = "Amstrad PPC512 (video)", + .name = "Amstrad PPC512 (Video)", .internal_name = "vid_ppc512", .flags = 0, .local = 0, @@ -2036,7 +2036,7 @@ const device_config_t vid_pc2086_config[] = { // clang-format off { .name = "language", - .description = "BIOS language", + .description = "BIOS Language", .type = CONFIG_SELECTION, .default_string = NULL, .default_int = 7, @@ -2054,7 +2054,7 @@ const device_config_t vid_pc2086_config[] = { }; const device_t vid_pc2086_device = { - .name = "Amstrad PC2086", + .name = "Amstrad PC2086 (Video)", .internal_name = "vid_pc2086", .flags = 0, .local = 0, @@ -2071,7 +2071,7 @@ const device_config_t vid_pc3086_config[] = { // clang-format off { .name = "language", - .description = "BIOS language", + .description = "BIOS Language", .type = CONFIG_SELECTION, .default_string = NULL, .default_int = 7, @@ -2089,7 +2089,7 @@ const device_config_t vid_pc3086_config[] = { }; const device_t vid_pc3086_device = { - .name = "Amstrad PC3086", + .name = "Amstrad PC3086 (Video)", .internal_name = "vid_pc3086", .flags = 0, .local = 0, diff --git a/src/machine/m_xt_olivetti.c b/src/machine/m_xt_olivetti.c index e6c64cf951b..d8cb819560d 100644 --- a/src/machine/m_xt_olivetti.c +++ b/src/machine/m_xt_olivetti.c @@ -2119,7 +2119,7 @@ const device_config_t m19_vid_config[] = { }; const device_t m19_vid_device = { - .name = "Olivetti M19 graphics card", + .name = "Olivetti M19 (Video)", .internal_name = "m19_vid", .flags = 0, .local = 0, diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 4500dd1cb42..7ece45782c2 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -2685,7 +2685,7 @@ const machine_t machines[] = { .kbd_device = &keyboard_pc_xt_device, .fdc_device = NULL, .sio_device = NULL, - .vid_device = NULL, + .vid_device = NULL, /* Discrete onboard video card? */ .snd_device = NULL, .net_device = NULL }, @@ -5684,7 +5684,7 @@ const machine_t machines[] = { .kbd_device = NULL, .fdc_device = NULL, .sio_device = NULL, - .vid_device = NULL, + .vid_device = &if386jega_device, .snd_device = NULL, .net_device = NULL }, diff --git a/src/video/vid_ati28800.c b/src/video/vid_ati28800.c index 70b360c1e09..6a6b0723d9f 100644 --- a/src/video/vid_ati28800.c +++ b/src/video/vid_ati28800.c @@ -838,7 +838,7 @@ const device_t ati28800k_device = { }; const device_t ati28800k_spc4620p_device = { - .name = "ATI Korean VGA On-Board SPC-4620P", + .name = "ATI Korean VGA On-Board (Samsung SPC-4620P)", .internal_name = "ati28800k_spc4620p", .flags = DEVICE_ISA, .local = 1, @@ -852,7 +852,7 @@ const device_t ati28800k_spc4620p_device = { }; const device_t ati28800k_spc6033p_device = { - .name = "ATI Korean VGA On-Board SPC-6033P", + .name = "ATI Korean VGA On-Board (Samsung SPC-6033P)", .internal_name = "ati28800k_spc6033p", .flags = DEVICE_ISA, .local = 2, diff --git a/src/video/vid_ati_mach64.c b/src/video/vid_ati_mach64.c index 4cecf6cf4b7..ceaf4224b84 100644 --- a/src/video/vid_ati_mach64.c +++ b/src/video/vid_ati_mach64.c @@ -5809,7 +5809,7 @@ const device_t mach64vt2_device = { }; const device_t mach64vt3_onboard_device = { - .name = "ATI Mach64VT3 (Onboard)", + .name = "ATI Mach64VT3 (On-Board)", .internal_name = "mach64vt3_onboard", .flags = DEVICE_PCI, .local = MACH64_VT3 | (1 << 19), diff --git a/src/video/vid_cga_olivetti.c b/src/video/vid_cga_olivetti.c index bd565c0d780..0279621a181 100644 --- a/src/video/vid_cga_olivetti.c +++ b/src/video/vid_cga_olivetti.c @@ -664,7 +664,7 @@ const device_config_t ogc_m24_config[] = { }; const device_t ogc_m24_device = { - .name = "Olivetti M21/M24/M28 (GO317/318/380/709) video card", + .name = "Olivetti M21/M24/M28 (GO317/318/380/709)", .internal_name = "ogc_m24", .flags = DEVICE_ISA, .local = 0, diff --git a/src/video/vid_ht216.c b/src/video/vid_ht216.c index 42a3376748d..45f8766ef30 100644 --- a/src/video/vid_ht216.c +++ b/src/video/vid_ht216.c @@ -1917,7 +1917,7 @@ const device_t v7_vga_1024i_device = { }; const device_t ht216_32_pb410a_device = { - .name = "Headland HT216-32 (Packard Bell PB410A)", + .name = "Headland HT216-32 On-Board (Packard Bell PB410A)", .internal_name = "ht216_32_pb410a", .flags = DEVICE_VLB, .local = 0x7861, /*HT216-32*/ diff --git a/src/video/vid_oak_oti.c b/src/video/vid_oak_oti.c index d8e3a89e462..e2ef1fbbbf4 100644 --- a/src/video/vid_oak_oti.c +++ b/src/video/vid_oak_oti.c @@ -702,7 +702,7 @@ const device_t oti037c_device = { }; const device_t oti037_pbl300sx_device = { - .name = "Oak OTI-037 (Packard Bell Legend 300SX)", + .name = "Oak OTI-037 On-Board (Packard Bell PB300/PB320)", .internal_name = "oti037_pbl300sx", .flags = DEVICE_ISA, .local = 1, @@ -730,7 +730,7 @@ const device_t oti067_device = { }; const device_t oti067_ama932j_device = { - .name = "Oak OTI-067 (AMA-932J)", + .name = "Oak OTI-067 On-Board (Arche AMA-932J)", .internal_name = "oti067_ama932j", .flags = DEVICE_ISA, .local = 3, @@ -744,7 +744,7 @@ const device_t oti067_ama932j_device = { }; const device_t oti067_m300_device = { - .name = "Oak OTI-067 (Olivetti M300-08/15)", + .name = "Oak OTI-067 On-Board (Olivetti M300-08/15)", .internal_name = "oti067_m300", .flags = DEVICE_ISA, .local = 4, @@ -772,7 +772,7 @@ const device_t oti077_device = { }; const device_t oti077_acer100t_device = { - .name = "Oak OTI-077 (Acer 100T)", + .name = "Oak OTI-077 On-Board (Acer 100T)", .internal_name = "oti077_acer100t", .flags = DEVICE_ISA, .local = 6, @@ -785,7 +785,7 @@ const device_t oti077_acer100t_device = { .config = oti077_acer100t_config }; const device_t oti077_pcs44c_device = { - .name = "Oak OTI-077 (Olivetti PCS 44/C)", + .name = "Oak OTI-077 On-Board (Olivetti PCS 44/C)", .internal_name = "oti077_pcs44c", .flags = DEVICE_ISA, .local = 7, diff --git a/src/video/vid_paradise.c b/src/video/vid_paradise.c index 4d8442d7a66..8d178dbd5f3 100644 --- a/src/video/vid_paradise.c +++ b/src/video/vid_paradise.c @@ -964,7 +964,7 @@ paradise_force_redraw(void *priv) } const device_t paradise_pvga1a_pc2086_device = { - .name = "Paradise PVGA1A (Amstrad PC2086)", + .name = "Paradise PVGA1A On-Board (Amstrad PC2086)", .internal_name = "pvga1a_pc2086", .flags = 0, .local = PVGA1A, @@ -978,7 +978,7 @@ const device_t paradise_pvga1a_pc2086_device = { }; const device_t paradise_pvga1a_pc3086_device = { - .name = "Paradise PVGA1A (Amstrad PC3086)", + .name = "Paradise PVGA1A On-Board (Amstrad PC3086)", .internal_name = "pvga1a_pc3086", .flags = 0, .local = PVGA1A, @@ -1013,7 +1013,7 @@ static const device_config_t paradise_pvga1a_config[] = { }; const device_t paradise_pvga1a_ncr3302_device = { - .name = "Paradise PVGA1A (NCR 3302)", + .name = "Paradise PVGA1A On-Board (NCR 3302)", .internal_name = "pvga1a_ncr3302", .flags = 0, .local = PVGA1A, @@ -1041,7 +1041,7 @@ const device_t paradise_pvga1a_device = { }; const device_t paradise_wd90c11_megapc_device = { - .name = "Paradise WD90C11 (Amstrad MegaPC)", + .name = "Paradise WD90C11 On-Board (Amstrad MegaPC)", .internal_name = "wd90c11_megapc", .flags = 0, .local = WD90C11, diff --git a/src/video/vid_tandy.c b/src/video/vid_tandy.c index 0130fb7be5d..741719cd05b 100644 --- a/src/video/vid_tandy.c +++ b/src/video/vid_tandy.c @@ -1029,7 +1029,7 @@ const device_config_t sl_vid_config[] = { }; const device_t tandy_1000_video_device = { - .name = "Tandy 1000", + .name = "Tandy 1000 SX (Video)", .internal_name = "tandy1000_video", .flags = 0, .local = 0, @@ -1043,7 +1043,7 @@ const device_t tandy_1000_video_device = { }; const device_t tandy_1000hx_video_device = { - .name = "Tandy 1000 HX", + .name = "Tandy 1000 HX (Video)", .internal_name = "tandy1000_hx_video", .flags = 0, .local = 0, @@ -1057,7 +1057,7 @@ const device_t tandy_1000hx_video_device = { }; const device_t tandy_1000sl_video_device = { - .name = "Tandy 1000SL2", + .name = "Tandy 1000SL2 (Video)", .internal_name = "tandy1000_sl_video", .flags = 0, .local = 1, From 7024c6e0f34807b048b049080290dd86efe48c8f Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 02:37:51 +0700 Subject: [PATCH 276/320] Fix onboard video on 433DX/Si for real --- src/machine/m_at_socket2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/m_at_socket2.c b/src/machine/m_at_socket2.c index e2786abc7b0..d338eddaf99 100644 --- a/src/machine/m_at_socket2.c +++ b/src/machine/m_at_socket2.c @@ -354,7 +354,7 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 if (fdc_current[0] == FDC_INTERNAL) device_add(&fdc_at_device); - if (gfxcard[0] == VID_INTERNAL) { + if (gfxcard[0] != VID_INTERNAL) { for (uint16_t i = 0; i < 32768; i++) rom[i] = mem_readb_phys(0x000c0000 + i); } From e0e484339932d8a9bdc542483a92ab59d4b8c207 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 02:52:23 +0700 Subject: [PATCH 277/320] Added "On-Board" name to JEGA (if386AX) --- src/video/vid_jega.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/video/vid_jega.c b/src/video/vid_jega.c index 8a34b9f6181..5f38df23ca5 100644 --- a/src/video/vid_jega.c +++ b/src/video/vid_jega.c @@ -1042,7 +1042,7 @@ if386jega_available(void) } const device_t if386jega_device = { - .name = "JEGA (if386AX)", + .name = "JEGA On-Board (OKI if386AX30L)", .internal_name = "if386jega", .flags = DEVICE_ISA, .local = 0, From 857e5d99cc779df0e328fdc1b0dc1623313d2c88 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Wed, 14 Jan 2026 16:57:11 +0700 Subject: [PATCH 278/320] Sort out the sound card list Also added the forgotten "(Video)" name to IBM PCjr configuration. --- src/include/86box/sound.h | 4 ++-- src/machine/m_pcjr.c | 2 +- src/sound/sound.c | 16 ++++++++-------- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/include/86box/sound.h b/src/include/86box/sound.h index 9dec03231e2..71cd65e5ad0 100644 --- a/src/include/86box/sound.h +++ b/src/include/86box/sound.h @@ -131,8 +131,6 @@ extern const device_t ad1816_device; /* Aztech Sound Galaxy 16 */ extern const device_t azt2316a_device; -extern const device_t acermagic_s20_device; -extern const device_t mirosound_pcm10_device; extern const device_t azt1605_device; extern const device_t aztpr16_device; @@ -231,6 +229,8 @@ extern const device_t entertainer_device; extern const device_t mmb_device; /* OPTi 82c93x */ +extern const device_t acermagic_s20_device; +extern const device_t mirosound_pcm10_device; extern const device_t opti_82c930_device; extern const device_t opti_82c931_device; diff --git a/src/machine/m_pcjr.c b/src/machine/m_pcjr.c index 10d2d0c7b30..d26dae71fa1 100644 --- a/src/machine/m_pcjr.c +++ b/src/machine/m_pcjr.c @@ -848,7 +848,7 @@ static const device_config_t pcjr_config[] = { }; const device_t pcjr_device = { - .name = "IBM PCjr", + .name = "IBM PCjr (Video)", .internal_name = "pcjr", .flags = 0, .local = 0, diff --git a/src/sound/sound.c b/src/sound/sound.c index cbf35832793..c7aefc746b2 100644 --- a/src/sound/sound.c +++ b/src/sound/sound.c @@ -123,12 +123,10 @@ static const SOUND_CARD sound_cards[] = { { &ess_ess0968_pnp_device }, { &ssi2001_device }, { &mmb_device }, +#ifdef USE_LIBSERIALPORT /*The following devices required LIBSERIALPORT*/ + { &opl2board_device }, +#endif { &pasplus_device }, - { &voicemasterkey_device }, - { &soundmasterplus_device }, - { &soundman_device }, - { &isadacr0_device }, - { &isadacr1_device }, { &sb_1_device }, { &sb_15_device }, { &sb_2_device }, @@ -137,11 +135,13 @@ static const SOUND_CARD sound_cards[] = { { &entertainer_device }, { &pssj_isa_device }, { &tndy_device }, -#ifdef USE_LIBSERIALPORT /*The following devices required LIBSERIALPORT*/ - { &opl2board_device }, -#endif /* ISA/Sidecar */ { &adlib_device }, + { &soundmasterplus_device }, + { &voicemasterkey_device }, + { &isadacr0_device }, + { &isadacr1_device }, + { &soundman_device }, /* ISA16 */ { &acermagic_s20_device }, { &ad1816_device }, From 987f11ecf268a4281e5435e2f54d74b6cb61e62c Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Mon, 12 Jan 2026 22:20:36 +0500 Subject: [PATCH 279/320] Add keybinds for all screenshot commands (unset by default) --- src/86box.c | 17 ++++++++++++++++- src/include/86box/86box.h | 2 +- src/qt/languages/86box.pot | 15 ++++++++++++--- src/qt/languages/ca-ES.po | 15 ++++++++++++--- src/qt/languages/cs-CZ.po | 15 ++++++++++++--- src/qt/languages/de-DE.po | 15 ++++++++++++--- src/qt/languages/el-GR.po | 15 ++++++++++++--- src/qt/languages/es-ES.po | 15 ++++++++++++--- src/qt/languages/fi-FI.po | 15 ++++++++++++--- src/qt/languages/fr-FR.po | 15 ++++++++++++--- src/qt/languages/hr-HR.po | 17 +++++++++++++---- src/qt/languages/it-IT.po | 15 ++++++++++++--- src/qt/languages/ja-JP.po | 15 ++++++++++++--- src/qt/languages/ko-KR.po | 15 ++++++++++++--- src/qt/languages/nb-NO.po | 15 ++++++++++++--- src/qt/languages/nl-NL.po | 15 ++++++++++++--- src/qt/languages/pl-PL.po | 15 ++++++++++++--- src/qt/languages/pt-BR.po | 15 ++++++++++++--- src/qt/languages/pt-PT.po | 15 ++++++++++++--- src/qt/languages/ru-RU.po | 15 ++++++++++++--- src/qt/languages/sk-SK.po | 15 ++++++++++++--- src/qt/languages/sl-SI.po | 15 ++++++++++++--- src/qt/languages/sv-SE.po | 15 ++++++++++++--- src/qt/languages/tr-TR.po | 15 ++++++++++++--- src/qt/languages/uk-UA.po | 23 ++++++++++++++++------- src/qt/languages/vi-VN.po | 15 ++++++++++++--- src/qt/languages/zh-CN.po | 15 ++++++++++++--- src/qt/languages/zh-TW.po | 15 ++++++++++++--- src/qt/qt_mainwindow.cpp | 24 ++++++++++++++++++++++++ src/qt/qt_mainwindow.ui | 12 ++++++++++++ 30 files changed, 370 insertions(+), 85 deletions(-) diff --git a/src/86box.c b/src/86box.c index 67ad2929710..89e619cdef8 100644 --- a/src/86box.c +++ b/src/86box.c @@ -272,9 +272,24 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { }, { .name="screenshot", - .desc="Screenshot", + .desc="Take screenshot", .seq="Ctrl+F11" }, + { + .name="raw_screenshot", + .desc="Take raw screenshot", + .seq="" + }, + { + .name="copy_screenshot", + .desc="Copy screenshot", + .seq="" + }, + { + .name="copy_raw_screenshot", + .desc="Copy raw screenshot", + .seq="" + }, { .name="release_mouse", .desc="Release mouse pointer", diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 0a6b2461a0f..8ec191f7255 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -331,7 +331,7 @@ struct accelKey { char desc[64]; char seq[64]; }; -#define NUM_ACCELS 10 +#define NUM_ACCELS 13 extern struct accelKey acc_keys[NUM_ACCELS]; extern struct accelKey def_acc_keys[NUM_ACCELS]; extern int FindAccelerator(const char *name); diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index cbf086210b4..c500d2c69b7 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -204,15 +204,27 @@ msgstr "" msgid "Take s&creenshot" msgstr "" +msgid "Take screenshot" +msgstr "" + msgid "Take &raw screenshot" msgstr "" +msgid "Take raw screenshot" +msgstr "" + msgid "C&opy screenshot" msgstr "" +msgid "Copy screenshot" +msgstr "" + msgid "Copy r&aw screenshot" msgstr "" +msgid "Copy raw screenshot" +msgstr "" + msgid "S&ound" msgstr "" @@ -2799,9 +2811,6 @@ msgstr "" msgid "Toggle UI in fullscreen" msgstr "" -msgid "Screenshot" -msgstr "" - msgid "Release mouse pointer" msgstr "" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index d7e279110af..c9495b4509f 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -210,15 +210,27 @@ msgstr "&Actualitza icones a la barra d'estat" msgid "Take s&creenshot" msgstr "Desa captura de &pantalla" +msgid "Take screenshot" +msgstr "Desa captura de pantalla" + msgid "Take &raw screenshot" msgstr "Desa captura en &brut de pantalla" +msgid "Take raw screenshot" +msgstr "Desa captura en brut de pantalla" + msgid "C&opy screenshot" msgstr "C&opia captura de pantalla" +msgid "Copy screenshot" +msgstr "Copia captura de pantalla" + msgid "Copy r&aw screenshot" msgstr "Copy captura en b&rut de pantalla" +msgid "Copy raw screenshot" +msgstr "Copy captura en brut de pantalla" + msgid "S&ound" msgstr "S&o" @@ -2805,9 +2817,6 @@ msgstr "Alternar pantalla completa" msgid "Toggle UI in fullscreen" msgstr "Alternar interfície d'usuari en modalitat de pantalla completa" -msgid "Screenshot" -msgstr "Captura de pantalla" - msgid "Release mouse pointer" msgstr "Allibera el punter del ratolí" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index e82f95f2681..390aeaac176 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -210,15 +210,27 @@ msgstr "&Aktualizovat ikony stavového řádku" msgid "Take s&creenshot" msgstr "Pořídit &screenshot" +msgid "Take screenshot" +msgstr "Pořídit screenshot" + msgid "Take &raw screenshot" msgstr "Pořídit n&ezpracovaný screenshot" +msgid "Take raw screenshot" +msgstr "Pořídit nezpracovaný screenshot" + msgid "C&opy screenshot" msgstr "&Zkopírovat screenshot" +msgid "Copy screenshot" +msgstr "Zkopírovat screenshot" + msgid "Copy r&aw screenshot" msgstr "Zkopírovat nez&pracovaný screenshot" +msgid "Copy raw screenshot" +msgstr "Zkopírovat nezpracovaný screenshot" + msgid "S&ound" msgstr "&Zvuk" @@ -2805,9 +2817,6 @@ msgstr "Přepnout režim celé obrazovky" msgid "Toggle UI in fullscreen" msgstr "Přepnout rozhraní při celé obrazovce" -msgid "Screenshot" -msgstr "Pořídit snímek obrazovky" - msgid "Release mouse pointer" msgstr "Uvolnit kurzor myši" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index ad7e66b08d2..565345fc41a 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -210,15 +210,27 @@ msgstr "&Statusleistenicons aktualisieren" msgid "Take s&creenshot" msgstr "S&creenshot aufnehmen" +msgid "Take screenshot" +msgstr "Screenshot aufnehmen" + msgid "Take &raw screenshot" msgstr "&Roh-Screenshot aufnehmen" +msgid "Take raw screenshot" +msgstr "Roh-Screenshot aufnehmen" + msgid "C&opy screenshot" msgstr "Screenshot k&opieren" +msgid "Copy screenshot" +msgstr "Screenshot kopieren" + msgid "Copy r&aw screenshot" msgstr "R&oh-Screenshot kopieren" +msgid "Copy raw screenshot" +msgstr "Roh-Screenshot kopieren" + msgid "S&ound" msgstr "&Ton" @@ -2805,9 +2817,6 @@ msgstr "Vollbild umschalten" msgid "Toggle UI in fullscreen" msgstr "UI im Vollbildmodus umschalten" -msgid "Screenshot" -msgstr "Bildschirmaufnahme" - msgid "Release mouse pointer" msgstr "Mauszeiger freigeben" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 10197ff38de..d7e887b823e 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -210,15 +210,27 @@ msgstr "&Ανανέωση εικονιδίων γραμμής κατάσταση msgid "Take s&creenshot" msgstr "Λήψη σ&τιγμιότυπου" +msgid "Take screenshot" +msgstr "Λήψη στιγμιότυπου" + msgid "Take &raw screenshot" msgstr "Λήψη &αρχικού στιγμιότυπου" +msgid "Take raw screenshot" +msgstr "Λήψη αρχικού στιγμιότυπου" + msgid "C&opy screenshot" msgstr "&Αντιγραφή στιγμιότυπου" +msgid "Copy screenshot" +msgstr "Αντιγραφή στιγμιότυπου" + msgid "Copy r&aw screenshot" msgstr "Αντιγραφή α&ρχικού στιγμιότυπου" +msgid "Copy raw screenshot" +msgstr "Αντιγραφή αρχικού στιγμιότυπου" + msgid "S&ound" msgstr "Ή&χος" @@ -2850,9 +2862,6 @@ msgstr "Εναλλαγή σε πλήρη οθόνη" msgid "Toggle UI in fullscreen" msgstr "Εναλλαγή ΠΧ σε πλήρη οθόνη" -msgid "Screenshot" -msgstr "Λήψη στιγμιότυπου" - msgid "Release mouse pointer" msgstr "Απελευθέρωση δείκτη ποντικιού" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index f64574e713a..c7db61a44ef 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -210,15 +210,27 @@ msgstr "&Actualizar iconos en barra de estado" msgid "Take s&creenshot" msgstr "Tomar cap&tura" +msgid "Take screenshot" +msgstr "Tomar captura" + msgid "Take &raw screenshot" msgstr "Tomar captura &plana" +msgid "Take raw screenshot" +msgstr "Tomar captura plana" + msgid "C&opy screenshot" msgstr "C&opiar captura" +msgid "Copy screenshot" +msgstr "Copiar captura" + msgid "Copy r&aw screenshot" msgstr "Copiar captura p&lana" +msgid "Copy raw screenshot" +msgstr "Copiar captura plana" + msgid "S&ound" msgstr "S&onido" @@ -2805,9 +2817,6 @@ msgstr "Alternar pantalla completa" msgid "Toggle UI in fullscreen" msgstr "Alternar interfaz de usuario en modo de pantalla completa" -msgid "Screenshot" -msgstr "Captura de pantalla" - msgid "Release mouse pointer" msgstr "Soltar el puntero del ratón" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 987e73529fd..4a7128c45c9 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -210,15 +210,27 @@ msgstr "&Päivitä tilapalkin kuvakkeita" msgid "Take s&creenshot" msgstr "Ota &kuvakaappaus" +msgid "Take screenshot" +msgstr "Ota kuvakaappaus" + msgid "Take &raw screenshot" msgstr "Ota &raaka kuvakaappaus" +msgid "Take raw screenshot" +msgstr "Ota raaka kuvakaappaus" + msgid "C&opy screenshot" msgstr "K&opioi kuvakaappaus" +msgid "Copy screenshot" +msgstr "Kopioi kuvakaappaus" + msgid "Copy r&aw screenshot" msgstr "Kopioi r&aaka kuvakaappaus" +msgid "Copy raw screenshot" +msgstr "Kopioi raaka kuvakaappaus" + msgid "S&ound" msgstr "&Ääni" @@ -2805,9 +2817,6 @@ msgstr "Koko näyttö" msgid "Toggle UI in fullscreen" msgstr "Käyttöliittymä koko näyttö-tilassa" -msgid "Screenshot" -msgstr "Kuvakaappaus" - msgid "Release mouse pointer" msgstr "Vapauta hiiren osoitin" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 976d9afb094..99ae7b646a1 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -210,15 +210,27 @@ msgstr "Mettre à jour la barre de stat&us" msgid "Take s&creenshot" msgstr "Faire copie d'é&cran" +msgid "Take screenshot" +msgstr "Faire copie d'écran" + msgid "Take &raw screenshot" msgstr "Faire copie &brute d'écran" +msgid "Take raw screenshot" +msgstr "Faire copie brute d'écran" + msgid "C&opy screenshot" msgstr "C&opier copie d'écran" +msgid "Copy screenshot" +msgstr "Copier copie d'écran" + msgid "Copy r&aw screenshot" msgstr "Copier copie b&rute d'écran" +msgid "Copy raw screenshot" +msgstr "Copier copie brute d'écran" + msgid "S&ound" msgstr "S&on" @@ -2805,9 +2817,6 @@ msgstr "Activer/désactiver le mode plein écran" msgid "Toggle UI in fullscreen" msgstr "Basculer l'interface utilisateur en mode plein écran" -msgid "Screenshot" -msgstr "Capture d'écran" - msgid "Release mouse pointer" msgstr "Relâcher le pointeur de la souris" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 15c2b39cb69..9709530dba2 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -212,15 +212,27 @@ msgstr "&Ažuriraj ikone statusnog redka" msgid "Take s&creenshot" msgstr "Napravi &snimku zaslona" +msgid "Take screenshot" +msgstr "Napravi snimku zaslona" + msgid "Take &raw screenshot" msgstr "Napravi &neobrađenu snimku zaslona" +msgid "Take raw screenshot" +msgstr "Napravi neobrađenu snimku zaslona" + msgid "C&opy screenshot" -msgstr "K&opiraj snimku zalsona" +msgstr "K&opiraj snimku zaslona" + +msgid "Copy screenshot" +msgstr "Kopiraj snimku zaslona" msgid "Copy r&aw screenshot" msgstr "Kopiraj n&eobrađenu snimku zaslona" +msgid "Copy raw screenshot" +msgstr "Kopiraj neobrađenu snimku zaslona" + msgid "S&ound" msgstr "&Zvuk" @@ -2807,9 +2819,6 @@ msgstr "Uključi/isključi cijelozaslonski način" msgid "Toggle UI in fullscreen" msgstr "Prebaci korisničko sučelje u načinu cijelog zaslona" -msgid "Screenshot" -msgstr "Snimka zaslona" - msgid "Release mouse pointer" msgstr "Otpusti pokazivač miša" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 0a675ac1add..6468d7f2f0e 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -210,15 +210,27 @@ msgstr "&Aggiorna icone della barra di stato" msgid "Take s&creenshot" msgstr "&Cattura schermata" +msgid "Take screenshot" +msgstr "Cattura schermata" + msgid "Take &raw screenshot" msgstr "Cattura &grezza della schermata" +msgid "Take raw screenshot" +msgstr "Cattura grezza della schermata" + msgid "C&opy screenshot" msgstr "C&opia cattura della schermata" +msgid "Copy screenshot" +msgstr "Copia cattura della schermata" + msgid "Copy r&aw screenshot" msgstr "Copia cattura g&rezza della schermata" +msgid "Copy raw screenshot" +msgstr "Copia cattura grezza della schermata" + msgid "S&ound" msgstr "A&udio" @@ -2805,9 +2817,6 @@ msgstr "Attiva/disattiva schermo intero" msgid "Toggle UI in fullscreen" msgstr "Attivare/disattivare interfaccia utente in modalità a schermo intero" -msgid "Screenshot" -msgstr "Istantanea dello schermo" - msgid "Release mouse pointer" msgstr "Rilascia il puntatore del mouse" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 8371ac36e8f..6f5bbf5e251 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -211,15 +211,27 @@ msgstr "ステータスバーのアイコンを更新(&U)" msgid "Take s&creenshot" msgstr "スクリーンショットを撮る(&C)" +msgid "Take screenshot" +msgstr "スクリーンショットを撮る" + msgid "Take &raw screenshot" msgstr "生のスクリーンショットを撮る(&R)" +msgid "Take raw screenshot" +msgstr "生のスクリーンショットを撮る" + msgid "C&opy screenshot" msgstr "スクリーンショットをコピーする(&O)" +msgid "Copy screenshot" +msgstr "スクリーンショットをコピーする" + msgid "Copy r&aw screenshot" msgstr "生のスクリーンショットをコピーする(&A)" +msgid "Copy raw screenshot" +msgstr "生のスクリーンショットをコピーする" + msgid "S&ound" msgstr "サウンド(&O)" @@ -2806,9 +2818,6 @@ msgstr "フルスクリーン表示を切り替える" msgid "Toggle UI in fullscreen" msgstr "全画面表示時にUIを切り替える" -msgid "Screenshot" -msgstr "スクリーンショット" - msgid "Release mouse pointer" msgstr "マウスポインターを解放する" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 12f67f14f4f..8d50003e383 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -204,15 +204,27 @@ msgstr "상태 바 아이콘 갱신하기(&U)" msgid "Take s&creenshot" msgstr "스크린샷 찍기(&C)" +msgid "Take screenshot" +msgstr "스크린샷 찍기" + msgid "Take &raw screenshot" msgstr "원본 스크린샷 찍기(&R)" +msgid "Take raw screenshot" +msgstr "원본 스크린샷 찍기" + msgid "C&opy screenshot" msgstr "스크린샷 복사하세요(&O)" +msgid "Copy screenshot" +msgstr "스크린샷 복사하세요" + msgid "Copy r&aw screenshot" msgstr "원본 스크린샷 복사하세요(&A)" +msgid "Copy raw screenshot" +msgstr "원본 스크린샷 복사하세요" + msgid "S&ound" msgstr "사운드(&O)" @@ -2799,9 +2811,6 @@ msgstr "전체 화면 모드 전환" msgid "Toggle UI in fullscreen" msgstr "" -msgid "Screenshot" -msgstr "스크린샷" - msgid "Release mouse pointer" msgstr "마우스 포인터를 해제합니다" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index c6c27836bf9..c03f05bea64 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -204,15 +204,27 @@ msgstr "&Oppdater statuslinjeikoner" msgid "Take s&creenshot" msgstr "Ta s&kjermbilde" +msgid "Take screenshot" +msgstr "Ta skjermbilde" + msgid "Take &raw screenshot" msgstr "Ta &rå skjermbilde" +msgid "Take raw screenshot" +msgstr "Ta rå skjermbilde" + msgid "C&opy screenshot" msgstr "K&opiera skjermbilde" +msgid "Copy screenshot" +msgstr "Kopiera skjermbilde" + msgid "Copy r&aw screenshot" msgstr "Kopiera r&å skjermbilde" +msgid "Copy raw screenshot" +msgstr "Kopiera rå skjermbilde" + msgid "S&ound" msgstr "L&yd" @@ -2799,9 +2811,6 @@ msgstr "Veksle fullskjerm" msgid "Toggle UI in fullscreen" msgstr "" -msgid "Screenshot" -msgstr "Skjermbilde" - msgid "Release mouse pointer" msgstr "Frigi musepeker" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 3b10383f726..630e89bbcb4 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -204,15 +204,27 @@ msgstr "&Statusbalkpictogrammen bijwerken" msgid "Take s&creenshot" msgstr "Maak een s&chermafbeelding" +msgid "Take screenshot" +msgstr "Maak een schermafbeelding" + msgid "Take &raw screenshot" msgstr "Maak een &ruw schermafbeelding" +msgid "Take raw screenshot" +msgstr "Maak een ruw schermafbeelding" + msgid "C&opy screenshot" msgstr "K&opieer een schermafbeelding" +msgid "Copy screenshot" +msgstr "Kopieer een schermafbeelding" + msgid "Copy r&aw screenshot" msgstr "Kopieer een r&uw schermafbeelding" +msgid "Copy raw screenshot" +msgstr "Kopieer een ruw schermafbeelding" + msgid "S&ound" msgstr "&Geluid" @@ -2799,9 +2811,6 @@ msgstr "Volledig scherm omschakelen" msgid "Toggle UI in fullscreen" msgstr "" -msgid "Screenshot" -msgstr "Schermafbeelding" - msgid "Release mouse pointer" msgstr "Geef muis vrij" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 2b9610084d7..d1bb617fb17 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -211,15 +211,27 @@ msgstr "&Aktualizuj ikony na pasku statusu" msgid "Take s&creenshot" msgstr "Zrób &zrzut ekranu" +msgid "Take screenshot" +msgstr "Zrób zrzut ekranu" + msgid "Take &raw screenshot" msgstr "Zrób &surowy zrzut ekranu" +msgid "Take raw screenshot" +msgstr "Zrób surowy zrzut ekranu" + msgid "C&opy screenshot" msgstr "S&kopiuj zrzut ekranu" +msgid "Copy screenshot" +msgstr "Skopiuj zrzut ekranu" + msgid "Copy r&aw screenshot" msgstr "Skopiuj s&urowy zrzut ekranu" +msgid "Copy raw screenshot" +msgstr "Skopiuj surowy zrzut ekranu" + msgid "S&ound" msgstr "Dź&więk" @@ -2806,9 +2818,6 @@ msgstr "Przełącz pełny ekran" msgid "Toggle UI in fullscreen" msgstr "Przełącz UI w pełnym ekranie" -msgid "Screenshot" -msgstr "Zrzut ekranu" - msgid "Release mouse pointer" msgstr "Wypuść wskaźnik myszy" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index b82c1a7c98a..74cb5896603 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -204,15 +204,27 @@ msgstr "&Atualizar ícones da barra de status" msgid "Take s&creenshot" msgstr "Capturar &tela" +msgid "Take screenshot" +msgstr "Capturar tela" + msgid "Take &raw screenshot" msgstr "Fazer captura &bruta da tela" +msgid "Take raw screenshot" +msgstr "Fazer captura bruta da tela" + msgid "C&opy screenshot" msgstr "C&opiar captura da tela" +msgid "Copy screenshot" +msgstr "Copiar captura da tela" + msgid "Copy r&aw screenshot" msgstr "Copiar captura b&ruta da tela" +msgid "Copy raw screenshot" +msgstr "Copiar captura bruta da tela" + msgid "S&ound" msgstr "&Som" @@ -2799,9 +2811,6 @@ msgstr "Alternar tela cheia" msgid "Toggle UI in fullscreen" msgstr "Alternar interface em tela cheia" -msgid "Screenshot" -msgstr "Captura de tela" - msgid "Release mouse pointer" msgstr "Liberar ponteiro do mouse" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index b68b91a8b5e..96aa31057b2 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -211,15 +211,27 @@ msgstr "&Atualizar ícones da barra de estado" msgid "Take s&creenshot" msgstr "Gravar imagem de &ecrã" +msgid "Take screenshot" +msgstr "Gravar imagem de ecrã" + msgid "Take &raw screenshot" msgstr "Gravar imagem &bruta de ecrã" +msgid "Take raw screenshot" +msgstr "Gravar imagem bruta de ecrã" + msgid "C&opy screenshot" +msgstr "&Copiar imagem de ecrã" + +msgid "Copy screenshot" msgstr "Copiar imagem de ecrã" msgid "Copy r&aw screenshot" msgstr "Copiar imagem b&ruta de ecrã" +msgid "Copy raw screenshot" +msgstr "Copiar imagem bruta de ecrã" + msgid "S&ound" msgstr "&Som" @@ -2806,9 +2818,6 @@ msgstr "Alternar o modo em ecrã cheio" msgid "Toggle UI in fullscreen" msgstr "Alternar interface do utilizador em ecrã inteiro" -msgid "Screenshot" -msgstr "Captura de ecrã" - msgid "Release mouse pointer" msgstr "Soltar o ponteiro do rato" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 112c53360cf..7df2fb11b80 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -211,15 +211,27 @@ msgstr "&Обновление значков строки состояния" msgid "Take s&creenshot" msgstr "Сделать с&криншот" +msgid "Take screenshot" +msgstr "Сделать скриншот" + msgid "Take &raw screenshot" msgstr "Сделать н&еобработанный скриншот" +msgid "Take raw screenshot" +msgstr "Сделать необработанный скриншот" + msgid "C&opy screenshot" msgstr "Ско&пировать скриншот" +msgid "Copy screenshot" +msgstr "Скопировать скриншот" + msgid "Copy r&aw screenshot" msgstr "Скопировать необработанный скрин&шот" +msgid "Copy raw screenshot" +msgstr "Скопировать необработанный скриншот" + msgid "S&ound" msgstr "&Звук" @@ -2818,9 +2830,6 @@ msgstr "Переключить полноэкранный режим" msgid "Toggle UI in fullscreen" msgstr "Переключить UI в полноэкранном режиме" -msgid "Screenshot" -msgstr "Скриншот" - msgid "Release mouse pointer" msgstr "Отпустить указатель мыши" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 3586f6c127b..c355636f5ee 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -210,15 +210,27 @@ msgstr "&Aktualizovať ikony na stavovom riadku" msgid "Take s&creenshot" msgstr "Urobiť snímku &obrazovky" +msgid "Take screenshot" +msgstr "Urobiť snímku obrazovky" + msgid "Take &raw screenshot" msgstr "Urobiť &surovú snímku obrazovky" +msgid "Take raw screenshot" +msgstr "Urobiť surovú snímku obrazovky" + msgid "C&opy screenshot" msgstr "S&kopírovať snímku obrazovky" +msgid "Copy screenshot" +msgstr "Skopírovať snímku obrazovky" + msgid "Copy r&aw screenshot" msgstr "Skopírovať s&urovú snímku obrazovky" +msgid "Copy raw screenshot" +msgstr "Skopírovať surovú snímku obrazovky" + msgid "S&ound" msgstr "&Zvuk" @@ -2805,9 +2817,6 @@ msgstr "Prepnúť režim celej obrazovky" msgid "Toggle UI in fullscreen" msgstr "Prepnúť používateľské rozhranie v režime celej obrazovky" -msgid "Screenshot" -msgstr "Zhotoviť snímku obrazovky" - msgid "Release mouse pointer" msgstr "Uvoľniť kurzor myši" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index a7cf7dc29bb..de269fff9a5 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -212,15 +212,27 @@ msgstr "&Posodabljaj ikone statusne vrstice" msgid "Take s&creenshot" msgstr "&Zajemi posnetek zaslona" +msgid "Take screenshot" +msgstr "Zajemi posnetek zaslona" + msgid "Take &raw screenshot" msgstr "Zajemi &neobdelan posnetek zaslona" +msgid "Take raw screenshot" +msgstr "Zajemi neobdelan posnetek zaslona" + msgid "C&opy screenshot" msgstr "K&opiraj posnetek zaslona" +msgid "Copy screenshot" +msgstr "Kopiraj posnetek zaslona" + msgid "Copy r&aw screenshot" msgstr "Kopriaj n&eobdelan posenetk zaslona" +msgid "Copy raw screenshot" +msgstr "Kopriaj neobdelan posenetk zaslona" + msgid "S&ound" msgstr "Z&vok" @@ -2807,9 +2819,6 @@ msgstr "Preklopi celozaslonski način" msgid "Toggle UI in fullscreen" msgstr "Preklopi uporabniški vmesnik v načinu polnega zaslona" -msgid "Screenshot" -msgstr "Zajem zaslona" - msgid "Release mouse pointer" msgstr "Izpusti kazalec miške" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 3cac62eaf79..38ed1191e40 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -204,15 +204,27 @@ msgstr "&Uppdatera statusfältets ikoner" msgid "Take s&creenshot" msgstr "Tag s&kärmbild" +msgid "Take screenshot" +msgstr "Tag skärmbild" + msgid "Take &raw screenshot" msgstr "Tag &rå skärmbild" +msgid "Take raw screenshot" +msgstr "Tag rå skärmbild" + msgid "C&opy screenshot" +msgstr "&Kopiera skärmbild" + +msgid "Copy screenshot" msgstr "Kopiera skärmbild" msgid "Copy r&aw screenshot" msgstr "Kopera r&å skärmbild" +msgid "Copy raw screenshot" +msgstr "Kopera rå skärmbild" + msgid "S&ound" msgstr "L&jud" @@ -2799,9 +2811,6 @@ msgstr "Helskärm" msgid "Toggle UI in fullscreen" msgstr "" -msgid "Screenshot" -msgstr "Skärmbild" - msgid "Release mouse pointer" msgstr "Släpp muspekare" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 22ccc4910ef..cacd7c41f3f 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -210,15 +210,27 @@ msgstr "Durum &çubuğu simgelerini güncelle" msgid "Take s&creenshot" msgstr "&Ekran görüntüsü al" +msgid "Take screenshot" +msgstr "Ekran görüntüsü al" + msgid "Take &raw screenshot" msgstr "Ekran &ham görüntüsü al" +msgid "Take raw screenshot" +msgstr "Ekran ham görüntüsü al" + msgid "C&opy screenshot" msgstr "Ekran görüntüsü k&opyala" +msgid "Copy screenshot" +msgstr "Ekran görüntüsü kopyala" + msgid "Copy r&aw screenshot" msgstr "Ekran h&am görüntüsü kopyala" +msgid "Copy raw screenshot" +msgstr "Ekran ham görüntüsü kopyala" + msgid "S&ound" msgstr "&Ses" @@ -2805,9 +2817,6 @@ msgstr "Tam ekran modunu ayarla" msgid "Toggle UI in fullscreen" msgstr "Arayüzü tam ekranda ayarla" -msgid "Screenshot" -msgstr "Ekran görüntüsü" - msgid "Release mouse pointer" msgstr "Fare imlecini serbest bırak" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 0fb2c803377..b9305f5a142 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -210,16 +210,28 @@ msgid "&Update status bar icons" msgstr "&Обновлення значків рядка стану" msgid "Take s&creenshot" -msgstr "Зробити &знімок" +msgstr "&Зробити скріншот" + +msgid "Take screenshot" +msgstr "Зробити скріншот" msgid "Take &raw screenshot" -msgstr "Зробити &сирий знімок" +msgstr "Зробити &сирий скріншот" + +msgid "Take raw screenshot" +msgstr "Зробити сирий скріншот" msgid "C&opy screenshot" -msgstr "С&копійовати знімок" +msgstr "С&копійовати скріншот" + +msgid "Copy screenshot" +msgstr "Скопійовати скріншот" msgid "Copy r&aw screenshot" -msgstr "Скопійовати с&ирий знімок" +msgstr "Скопійовати с&ирий скріншот" + +msgid "Copy raw screenshot" +msgstr "Скопійовати сирий скріншот" msgid "S&ound" msgstr "&Звук" @@ -2807,9 +2819,6 @@ msgstr "Переключити повноекранний режим" msgid "Toggle UI in fullscreen" msgstr "Переключити UI в повноекранному режимі" -msgid "Screenshot" -msgstr "Скріншот" - msgid "Release mouse pointer" msgstr "Відпустити вказівник миші" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 35782e86d4c..0d7f0cb754c 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -204,15 +204,27 @@ msgstr "Cậ&p nhật biểu tượng thanh trạng thái" msgid "Take s&creenshot" msgstr "Chụp &màn hình" +msgid "Take screenshot" +msgstr "Chụp màn hình" + msgid "Take &raw screenshot" msgstr "Chụp màn hình &thô" +msgid "Take raw screenshot" +msgstr "Chụp màn hình thô" + msgid "C&opy screenshot" msgstr "S&ao chép ảnh chụp màn hình" +msgid "Copy screenshot" +msgstr "Sao chép ảnh chụp màn hình" + msgid "Copy r&aw screenshot" msgstr "Sao chép ảnh chụp màn hình t&hô" +msgid "Copy raw screenshot" +msgstr "Sao chép ảnh chụp màn hình thô" + msgid "S&ound" msgstr "&Âm thanh" @@ -2799,9 +2811,6 @@ msgstr "Bật/tắt toàn màn hình" msgid "Toggle UI in fullscreen" msgstr "" -msgid "Screenshot" -msgstr "Chụp màn hình" - msgid "Release mouse pointer" msgstr "Thả con trỏ chuột" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index a74ddbbbafc..884540416f0 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -204,15 +204,27 @@ msgstr "更新状态栏图标(&U)" msgid "Take s&creenshot" msgstr "截图(&C)" +msgid "Take screenshot" +msgstr "截图" + msgid "Take &raw screenshot" msgstr "原始截图(&R)" +msgid "Take raw screenshot" +msgstr "原始截图" + msgid "C&opy screenshot" msgstr "复制截图(&O)" +msgid "Copy screenshot" +msgstr "复制截图" + msgid "Copy r&aw screenshot" msgstr "复制原始截图(&A)" +msgid "Copy raw screenshot" +msgstr "复制原始截图" + msgid "S&ound" msgstr "声音(&O)" @@ -2799,9 +2811,6 @@ msgstr "切换全屏" msgid "Toggle UI in fullscreen" msgstr "在全屏模式下激活菜单栏" -msgid "Screenshot" -msgstr "截图" - msgid "Release mouse pointer" msgstr "释放鼠标" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 4da19a8c3d0..b3300e3786e 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -211,15 +211,27 @@ msgstr "更新狀態列圖示(&U)" msgid "Take s&creenshot" msgstr "擷取螢幕畫面(&C)" +msgid "Take screenshot" +msgstr "擷取螢幕畫面" + msgid "Take &raw screenshot" msgstr "擷取原始螢幕畫面(&R)" +msgid "Take raw screenshot" +msgstr "擷取原始螢幕畫面" + msgid "C&opy screenshot" msgstr "擷取螢幕畫面至剪貼簿(&O)" +msgid "Copy screenshot" +msgstr "擷取螢幕畫面至剪貼簿" + msgid "Copy r&aw screenshot" msgstr "擷取原始螢幕畫面至剪貼薄(&A)" +msgid "Copy raw screenshot" +msgstr "擷取原始螢幕畫面至剪貼薄" + msgid "S&ound" msgstr "聲音(&O)" @@ -2806,9 +2818,6 @@ msgstr "切換全螢幕" msgid "Toggle UI in fullscreen" msgstr "全螢幕模式下切換使用者介面顯示" -msgid "Screenshot" -msgstr "螢幕畫面擷取" - msgid "Release mouse pointer" msgstr "放開滑鼠游標" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 231d49112e7..16e84cb8c94 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1018,6 +1018,18 @@ MainWindow::updateShortcuts() seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionTake_screenshot->setShortcut(seq); + accID = FindAccelerator("raw_screenshot"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionTake_raw_screenshot->setShortcut(seq); + + accID = FindAccelerator("copy_screenshot"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionCopy_screenshot->setShortcut(seq); + + accID = FindAccelerator("copy_raw_screenshot"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionCopy_raw_screenshot->setShortcut(seq); + accID = FindAccelerator("send_ctrl_alt_del"); seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionCtrl_Alt_Del->setShortcut(seq); @@ -1550,6 +1562,18 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("screenshot")) { ui->actionTake_screenshot->trigger(); } + if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("raw_screenshot") + || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("raw_screenshot")) { + ui->actionTake_raw_screenshot->trigger(); + } + if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("copy_screenshot") + || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("copy_screenshot")) { + ui->actionCopy_screenshot->trigger(); + } + if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("copy_raw_screenshot") + || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("copy_raw_screenshot")) { + ui->actionCopy_raw_screenshot->trigger(); + } if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("fullscreen") || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("fullscreen")) { ui->actionFullscreen->trigger(); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index ec5d245cb64..1d8d0680c08 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -744,6 +744,9 @@ Take s&creenshot + + Take screenshot + :/menuicons/qt/icons/take_screenshot.ico:/menuicons/qt/icons/take_screenshot.ico @@ -753,6 +756,9 @@ Take &raw screenshot + + Take raw screenshot + :/menuicons/qt/icons/take_raw_screenshot.ico:/menuicons/qt/icons/take_raw_screenshot.ico @@ -762,6 +768,9 @@ C&opy screenshot + + Copy screenshot + :/menuicons/qt/icons/copy_screenshot.ico:/menuicons/qt/icons/copy_screenshot.ico @@ -771,6 +780,9 @@ Copy r&aw screenshot + + Copy raw screenshot + :/menuicons/qt/icons/copy_raw_screenshot.ico:/menuicons/qt/icons/copy_raw_screenshot.ico From e8d473af23c594f0999f0afa7496a13948849d26 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 04:02:39 +0500 Subject: [PATCH 280/320] Add keybind for fast forward --- src/86box.c | 5 +++++ src/include/86box/86box.h | 2 +- src/qt/languages/86box.pot | 3 +++ src/qt/languages/ca-ES.po | 3 +++ src/qt/languages/cs-CZ.po | 3 +++ src/qt/languages/de-DE.po | 3 +++ src/qt/languages/el-GR.po | 3 +++ src/qt/languages/es-ES.po | 3 +++ src/qt/languages/fi-FI.po | 3 +++ src/qt/languages/fr-FR.po | 3 +++ src/qt/languages/hr-HR.po | 3 +++ src/qt/languages/it-IT.po | 3 +++ src/qt/languages/ja-JP.po | 3 +++ src/qt/languages/ko-KR.po | 3 +++ src/qt/languages/nb-NO.po | 3 +++ src/qt/languages/nl-NL.po | 3 +++ src/qt/languages/pl-PL.po | 3 +++ src/qt/languages/pt-BR.po | 3 +++ src/qt/languages/pt-PT.po | 3 +++ src/qt/languages/ru-RU.po | 3 +++ src/qt/languages/sk-SK.po | 3 +++ src/qt/languages/sl-SI.po | 3 +++ src/qt/languages/sv-SE.po | 3 +++ src/qt/languages/tr-TR.po | 3 +++ src/qt/languages/uk-UA.po | 3 +++ src/qt/languages/vi-VN.po | 3 +++ src/qt/languages/zh-CN.po | 3 +++ src/qt/languages/zh-TW.po | 3 +++ src/qt/qt_mainwindow.cpp | 8 ++++++++ src/qt/qt_mainwindow.ui | 3 +++ 30 files changed, 95 insertions(+), 1 deletion(-) diff --git a/src/86box.c b/src/86box.c index 89e619cdef8..ce9a3d96ea1 100644 --- a/src/86box.c +++ b/src/86box.c @@ -290,6 +290,11 @@ struct accelKey def_acc_keys[NUM_ACCELS] = { .desc="Copy raw screenshot", .seq="" }, + { + .name="fast_forward", + .desc="Fast forward", + .seq="Ctrl+Alt+F" + }, { .name="release_mouse", .desc="Release mouse pointer", diff --git a/src/include/86box/86box.h b/src/include/86box/86box.h index 8ec191f7255..d32e13895da 100644 --- a/src/include/86box/86box.h +++ b/src/include/86box/86box.h @@ -331,7 +331,7 @@ struct accelKey { char desc[64]; char seq[64]; }; -#define NUM_ACCELS 13 +#define NUM_ACCELS 14 extern struct accelKey acc_keys[NUM_ACCELS]; extern struct accelKey def_acc_keys[NUM_ACCELS]; extern int FindAccelerator(const char *name); diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index c500d2c69b7..e1cec700543 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -3014,3 +3014,6 @@ msgstr "" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index c9495b4509f..ddec0bc60ee 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -3020,3 +3020,6 @@ msgstr "&Permetre recompilació" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 390aeaac176..fc78c76bdf1 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -3020,3 +3020,6 @@ msgstr "&Povolit rekompilaci" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 565345fc41a..4ed3a4fbf3b 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -3020,3 +3020,6 @@ msgstr "Recompilierung &zulassen" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index d7e887b823e..b49a1411ad8 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -3077,3 +3077,6 @@ msgstr "&Να επιτρέπεται ανασύνταξη" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index c7db61a44ef..efa17fa4b3e 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -3020,3 +3020,6 @@ msgstr "&Permitir recompilación" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 4a7128c45c9..1a4b65df4d6 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -3020,3 +3020,6 @@ msgstr "&Salli uudelleenkääntäminen" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 99ae7b646a1..38f4672cb19 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -3020,3 +3020,6 @@ msgstr "&Permettre la recompilation" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 9709530dba2..c3d793f136e 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -3022,3 +3022,6 @@ msgstr "&Omogući rekompilaciju" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 6468d7f2f0e..a3c182f8e73 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -3020,3 +3020,6 @@ msgstr "&Permetti ricompilazione" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 6f5bbf5e251..cec605d9013 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -3021,3 +3021,6 @@ msgstr "再コンパイルを許可する(&A)" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 8d50003e383..690bc84917f 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -3014,3 +3014,6 @@ msgstr "재컴파일 허용(&A)" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index c03f05bea64..d35c292c616 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -3014,3 +3014,6 @@ msgstr "&Tillat rekompilering" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 630e89bbcb4..c1ac985e52a 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -3014,3 +3014,6 @@ msgstr "Recompilatie &toestaan" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index d1bb617fb17..ec0cc9f8750 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -3021,3 +3021,6 @@ msgstr "&Zezwól na rekompilację" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 74cb5896603..8a432d6ca6d 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -3014,3 +3014,6 @@ msgstr "&Permitir recompilação" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 96aa31057b2..0cc722e8453 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -3021,3 +3021,6 @@ msgstr "&Permitir recompilação" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 7df2fb11b80..e1d8816c861 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -3033,3 +3033,6 @@ msgstr "Разреш&ить рекомпиляцию" msgid "&Fast forward" msgstr "П&еремотка вперёд" + +msgid "Fast forward" +msgstr "Перемотка вперёд" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index c355636f5ee..b6172ee9ce9 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -3020,3 +3020,6 @@ msgstr "&Povoliť rekompiláciu" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index de269fff9a5..431685decda 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -3022,3 +3022,6 @@ msgstr "&Dovoli prevajanje" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 38ed1191e40..6005a49c68e 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -3014,3 +3014,6 @@ msgstr "&Tillåt omkompilering" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index cacd7c41f3f..ede62240bab 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -3020,3 +3020,6 @@ msgstr "&Derlenmesine izin ver" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index b9305f5a142..9644aa5fe23 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -3022,3 +3022,6 @@ msgstr "&Дозволити рекомпіляцію" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 0d7f0cb754c..9c4f56d46e1 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -3014,3 +3014,6 @@ msgstr "&Cho phép biên dịch lại" msgid "&Fast forward" msgstr "" + +msgid "Fast forward" +msgstr "" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 884540416f0..ea491586c35 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -3014,3 +3014,6 @@ msgstr "允许重编译(&A)" msgid "&Fast forward" msgstr "快进(&F)" + +msgid "Fast forward" +msgstr "快进" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index b3300e3786e..a27bc13c2c5 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -3021,3 +3021,6 @@ msgstr "允許重編譯(&A)" msgid "&Fast forward" msgstr "快轉(&F)" + +msgid "Fast forward" +msgstr "快轉" diff --git a/src/qt/qt_mainwindow.cpp b/src/qt/qt_mainwindow.cpp index 16e84cb8c94..229e9f788df 100644 --- a/src/qt/qt_mainwindow.cpp +++ b/src/qt/qt_mainwindow.cpp @@ -1042,6 +1042,10 @@ MainWindow::updateShortcuts() seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionHard_Reset->setShortcut(seq); + accID = FindAccelerator("fast_forward"); + seq = QKeySequence::fromString(acc_keys[accID].seq); + ui->actionFast_forward->setShortcut(seq); + accID = FindAccelerator("fullscreen"); seq = QKeySequence::fromString(acc_keys[accID].seq); ui->actionFullscreen->setShortcut(seq); @@ -1582,6 +1586,10 @@ MainWindow::eventFilter(QObject *receiver, QEvent *event) || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("hard_reset")) { ui->actionHard_Reset->trigger(); } + if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("fast_forward") + || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("fast_forward")) { + ui->actionFast_forward->trigger(); + } if ((QKeySequence) (ke->key() | (ke->modifiers() & ~Qt::KeypadModifier)) == FindAcceleratorSeq("send_ctrl_alt_del") || (QKeySequence) (ke->key() | ke->modifiers()) == FindAcceleratorSeq("send_ctrl_alt_del")) { ui->actionCtrl_Alt_Del->trigger(); diff --git a/src/qt/qt_mainwindow.ui b/src/qt/qt_mainwindow.ui index 1d8d0680c08..2dead393bbe 100644 --- a/src/qt/qt_mainwindow.ui +++ b/src/qt/qt_mainwindow.ui @@ -1094,6 +1094,9 @@ &Fast forward + + Fast forward +
From 30c77b69ac1c10b33d6ecc4e720a2fedc8bf24f9 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 04:03:02 +0500 Subject: [PATCH 281/320] Legacy SDL UI: Add monitor command for fast forward --- src/unix/unix.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/unix/unix.c b/src/unix/unix.c index ed16c20c619..50b7f0f98d0 100644 --- a/src/unix/unix.c +++ b/src/unix/unix.c @@ -63,7 +63,7 @@ int update_icons; int kbd_req_capture; int hide_status_bar; int hide_tool_bar; -bool fast_forward = false; // Technically unused. +bool fast_forward = false; int fixed_size_x = 640; int fixed_size_y = 480; extern int title_set; @@ -1105,6 +1105,7 @@ unix_executeLine(char *line) "moeject - eject image from MO drive .\n\n" "hardreset - hard reset the emulated system.\n" "pause - pause the the emulated system.\n" + "fastfwd - toggle fast forward.\n" "screenshot - save a screenshot.\n" "fullscreen - toggle fullscreen.\n" "version - print version and license information.\n" @@ -1154,6 +1155,9 @@ unix_executeLine(char *line) } else if (strncasecmp(xargv[0], "pause", 5) == 0) { plat_pause(dopause ^ 1); printf("%s", dopause ? "Paused.\n" : "Unpaused.\n"); + } else if (strncasecmp(xargv[0], "fastfwd", 7) == 0) { + fast_forward ^= 1; + printf("%s", fast_forward ? "Fast forward on.\n" : "Fast forward off.\n"); } else if (strncasecmp(xargv[0], "hardreset", 9) == 0) { pc_reset_hard(); } else if (strncasecmp(xargv[0], "cdload", 6) == 0 && cmdargc >= 3) { From cee9e8373665b6e6f7541aa39336eb04b74d1401 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 03:19:40 +0500 Subject: [PATCH 282/320] HDD presets: rename `version_ex` field to `version` --- src/disk/hdc_ide.c | 4 ++-- src/disk/hdd.c | 12 ++++++------ src/include/86box/hdd.h | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/disk/hdc_ide.c b/src/disk/hdc_ide.c index fb844da8ff3..7b2b7681629 100644 --- a/src/disk/hdc_ide.c +++ b/src/disk/hdc_ide.c @@ -552,8 +552,8 @@ ide_hd_identify(const ide_t *ide) /* Serial Number */ ide_padstr((char *) (ide->buffer + 10), "", 20); /* Firmware */ - if (hdd[ide->hdd_num].version_ex) - ide_padstr((char *) (ide->buffer + 23), hdd[ide->hdd_num].version_ex, 8); + if (hdd[ide->hdd_num].version) + ide_padstr((char *) (ide->buffer + 23), hdd[ide->hdd_num].version, 8); else ide_padstr((char *) (ide->buffer + 23), EMU_VERSION_EX, 8); /* Model */ diff --git a/src/disk/hdd.c b/src/disk/hdd.c index c323bf7e32e..62f3494309d 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -438,7 +438,7 @@ static hdd_preset_t hdd_speed_presets[] = { { .name = "[Generic] 1998 (5400 RPM)", .internal_name = "1998_5400rpm", .zones = 16, .avg_spt = 300, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 32 }, { .name = "[Generic] 2000 (7200 RPM)", .internal_name = "2000_7200rpm", .zones = 16, .avg_spt = 350, .heads = 6, .rpm = 7200, .full_stroke_ms = 15, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 32 }, { .name = "[PIO IDE] IBM WDA-L42", .internal_name = "WDAL42", .model = "WDA-L42", .zones = 1, .avg_spt = 85, .heads = 2, .rpm = 3600, .full_stroke_ms = 33, .track_seek_ms = 2.5, .rcache_num_seg = 1, .rcache_seg_size = 32, .max_multiple = 1 }, - { .name = "[PIO-2] IBM DSAA-3270", .internal_name = "DSAA3270", .model = "DSAA-3270", .zones = 8, .avg_spt = 268, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2.1, .rcache_num_seg = 3, .rcache_seg_size = 32, .max_multiple = 8, .version_ex = "25505120" }, + { .name = "[PIO-2] IBM DSAA-3270", .internal_name = "DSAA3270", .model = "DSAA-3270", .version = "25505120", .zones = 8, .avg_spt = 268, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2.1, .rcache_num_seg = 3, .rcache_seg_size = 32, .max_multiple = 8 }, { .name = "[ATA-1] Conner CP3024", .internal_name = "CP3024", .model = "Conner Peripherals 20MB - CP3024", .zones = 1, .avg_spt = 33, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work { .name = "[ATA-1] Conner CP3044", .internal_name = "CP3044", .model = "Conner Peripherals 40MB - CP3044", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work { .name = "[ATA-1] Conner CP3104", .internal_name = "CP3104", .model = "Conner Peripherals 104MB - CP3104", .zones = 1, .avg_spt = 33, .heads = 8, .rpm = 3500, .full_stroke_ms = 45, .track_seek_ms = 8, .rcache_num_seg = 4, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work @@ -526,8 +526,8 @@ static hdd_preset_t hdd_speed_presets[] = { { .name = "[ATA-4] Quantum Fireball SE4.3A", .internal_name = "SE43A011", .model = "QUANTUM FIREBALL SE4.3A", .zones = 2, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, { .name = "[ATA-4] Quantum Fireball SE6.4A", .internal_name = "SE64A011", .model = "QUANTUM FIREBALL SE6.4A", .zones = 3, .avg_spt = 200, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, { .name = "[ATA-4] Quantum Fireball SE8.4A", .internal_name = "SE84A011", .model = "QUANTUM FIREBALL SE8.4A", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Quantum Fireball EX12.7A", .internal_name = "EX12A012", .model = "QUANTUM FIREBALL EX12.7A", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16, .version_ex = "A0A.0D00" }, - { .name = "[ATA-4] Quantum Fireball LCT-08 (LA04A011)", .internal_name = "LA04A011", .model = "QUANTUM FIREBALLlct08 04", .zones = 8, .avg_spt = 280, .heads = 6, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16, .version_ex = "A05.0X00" }, + { .name = "[ATA-4] Quantum Fireball EX12.7A", .internal_name = "EX12A012", .model = "QUANTUM FIREBALL EX12.7A", .version = "A0A.0D00", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Quantum Fireball LCT-08 (LA04A011)", .internal_name = "LA04A011", .model = "QUANTUM FIREBALLlct08 04", .version = "A05.0X00", .zones = 8, .avg_spt = 280, .heads = 6, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, { .name = "[ATA-4] Seagate Medalist 2122", .internal_name = "ST32122A", .model = "ST32122A", .zones = 16, .avg_spt = 215, .heads = 2, .rpm = 4500, .full_stroke_ms = 23, .track_seek_ms = 3.8, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, { .name = "[ATA-4] Seagate Medalist 3321", .internal_name = "ST33221A", .model = "ST33221A", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1.7, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, { .name = "[ATA-4] Seagate Medalist 4321", .internal_name = "ST34321A", .model = "ST34321A", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, @@ -540,7 +540,7 @@ static hdd_preset_t hdd_speed_presets[] = { { .name = "[ATA-4] Western Digital Caviar 23200", .internal_name = "AC23200", .model = "WDC AC23200LB", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, { .name = "[ATA-4] Western Digital Caviar 26400", .internal_name = "AC26400", .model = "WDC AC26400RN", .zones = 16, .avg_spt = 295, .heads = 5, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, { .name = "[ATA-4] Western Digital Caviar 33200", .internal_name = "AC33200", .model = "WDC AC33200LA", .zones = 16, .avg_spt = 310, .heads = 5, .rpm = 5200, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Western Digital Caviar 35100", .internal_name = "AC35100", .model = "WDC AC35100L", .zones = 16, .avg_spt = 315, .heads = 5, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32, .version_ex = "09.09M08" }, + { .name = "[ATA-4] Western Digital Caviar 35100", .internal_name = "AC35100", .model = "WDC AC35100L", .version = "09.09M08", .zones = 16, .avg_spt = 315, .heads = 5, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, { .name = "[ATA-5] IBM Travelstar 6GN", .internal_name = "DARA206000", .model = "IBM-DARA-206000", .zones = 12, .avg_spt = 292, .heads = 2, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, { .name = "[ATA-5] IBM Travelstar 9GN", .internal_name = "DARA209000", .model = "IBM-DARA-209000", .zones = 12, .avg_spt = 292, .heads = 3, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, { .name = "[ATA-5] IBM/Hitachi Travelstar 12GN", .internal_name = "DARA212000", .model = "IBM-DARA-212000", .zones = 12, .avg_spt = 292, .heads = 4, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, // Either Hitachi or IBM OEM @@ -636,8 +636,8 @@ hdd_preset_apply(int hdd_id) if (preset->model) hd->model = preset->model; - if (preset->version_ex) - hd->version_ex = preset->version_ex; + if (preset->version) + hd->version = preset->version; if (!hd->speed_preset) return; diff --git a/src/include/86box/hdd.h b/src/include/86box/hdd.h index d8f275de3fc..dc45bb9ec73 100644 --- a/src/include/86box/hdd.h +++ b/src/include/86box/hdd.h @@ -90,6 +90,7 @@ typedef struct hdd_preset_t { const char *name; const char *internal_name; const char *model; + const char *version; uint32_t zones; uint32_t avg_spt; uint32_t heads; @@ -99,7 +100,6 @@ typedef struct hdd_preset_t { uint32_t max_multiple; double full_stroke_ms; double track_seek_ms; - const char *version_ex; } hdd_preset_t; typedef struct hdd_cache_seg_t { @@ -188,7 +188,7 @@ typedef struct hard_disk_t { const char *model; - const char *version_ex; + const char *version; hdd_zone_t zones[HDD_MAX_ZONES]; From 5f2e8e09fecb9158c99e19947acc0d58f94b3a9e Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 03:23:44 +0500 Subject: [PATCH 283/320] HDD presets: Fix table alignment --- src/disk/hdd.c | 278 ++++++++++++++++++++++++------------------------- 1 file changed, 139 insertions(+), 139 deletions(-) diff --git a/src/disk/hdd.c b/src/disk/hdd.c index 62f3494309d..da4d703d80b 100644 --- a/src/disk/hdd.c +++ b/src/disk/hdd.c @@ -429,145 +429,145 @@ hdd_zones_init(hard_disk_t *hdd) static hdd_preset_t hdd_speed_presets[] = { // clang-format off - { .name = "[Generic] RAM Disk (max. speed)", .internal_name = "ramdisk", .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 32 }, - { .name = "[Generic] 1989 (3500 RPM)", .internal_name = "1989_3500rpm", .zones = 1, .avg_spt = 35, .heads = 2, .rpm = 3500, .full_stroke_ms = 40, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 16, .max_multiple = 8 }, - { .name = "[Generic] 1992 (3600 RPM)", .internal_name = "1992_3600rpm", .zones = 1, .avg_spt = 45, .heads = 2, .rpm = 3600, .full_stroke_ms = 30, .track_seek_ms = 6, .rcache_num_seg = 4, .rcache_seg_size = 16, .max_multiple = 8 }, - { .name = "[Generic] 1994 (4500 RPM)", .internal_name = "1994_4500rpm", .zones = 8, .avg_spt = 80, .heads = 4, .rpm = 4500, .full_stroke_ms = 26, .track_seek_ms = 5, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 16 }, - { .name = "[Generic] 1996 (5400 RPM)", .internal_name = "1996_5400rpm", .zones = 16, .avg_spt = 135, .heads = 4, .rpm = 5400, .full_stroke_ms = 24, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 16 }, - { .name = "[Generic] 1997 (5400 RPM)", .internal_name = "1997_5400rpm", .zones = 16, .avg_spt = 185, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 32 }, - { .name = "[Generic] 1998 (5400 RPM)", .internal_name = "1998_5400rpm", .zones = 16, .avg_spt = 300, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 32 }, - { .name = "[Generic] 2000 (7200 RPM)", .internal_name = "2000_7200rpm", .zones = 16, .avg_spt = 350, .heads = 6, .rpm = 7200, .full_stroke_ms = 15, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 32 }, - { .name = "[PIO IDE] IBM WDA-L42", .internal_name = "WDAL42", .model = "WDA-L42", .zones = 1, .avg_spt = 85, .heads = 2, .rpm = 3600, .full_stroke_ms = 33, .track_seek_ms = 2.5, .rcache_num_seg = 1, .rcache_seg_size = 32, .max_multiple = 1 }, - { .name = "[PIO-2] IBM DSAA-3270", .internal_name = "DSAA3270", .model = "DSAA-3270", .version = "25505120", .zones = 8, .avg_spt = 268, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2.1, .rcache_num_seg = 3, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-1] Conner CP3024", .internal_name = "CP3024", .model = "Conner Peripherals 20MB - CP3024", .zones = 1, .avg_spt = 33, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work - { .name = "[ATA-1] Conner CP3044", .internal_name = "CP3044", .model = "Conner Peripherals 40MB - CP3044", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work - { .name = "[ATA-1] Conner CP3104", .internal_name = "CP3104", .model = "Conner Peripherals 104MB - CP3104", .zones = 1, .avg_spt = 33, .heads = 8, .rpm = 3500, .full_stroke_ms = 45, .track_seek_ms = 8, .rcache_num_seg = 4, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work - { .name = "[ATA-1] Conner CFS420A", .internal_name = "CFS420A", .model = "Conner Peripherals 420MB - CFS420A", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3600, .full_stroke_ms = 33, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-1] HP Kittyhawk", .internal_name = "C3014A", .model = "HP C3014A", .zones = 6, .avg_spt = 80, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 16, .max_multiple = 8 }, - { .name = "[ATA-1] IBM H3256-A3", .internal_name = "H3256A3", .model = "H3256-A3", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3600, .full_stroke_ms = 32, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 8 }, - { .name = "[ATA-1] IBM H3342-A4", .internal_name = "H3342A4", .model = "H3342-A4", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3600, .full_stroke_ms = 30, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 8 }, - { .name = "[ATA-1] Kalok KL343", .internal_name = "KL343", .model = "KALOK KL-343", .zones = 1, .avg_spt = 80, .heads = 6, .rpm = 3600, .full_stroke_ms = 50, .track_seek_ms = 2, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, - { .name = "[ATA-1] Kalok KL3100", .internal_name = "KL3100", .model = "KALOK KL-3100", .zones = 1, .avg_spt = 100, .heads = 6, .rpm = 3662, .full_stroke_ms = 50, .track_seek_ms = 2, .rcache_num_seg = 1, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-1] Maxtor 7060AT", .internal_name = "7060AT", .model = "Maxtor 7060 AT", .zones = 1, .avg_spt = 62, .heads = 2, .rpm = 3524, .full_stroke_ms = 30, .track_seek_ms = 3.6, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-1] Maxtor 7131AT", .internal_name = "7131AT", .model = "Maxtor 7131 AT", .zones = 2, .avg_spt = 54, .heads = 2, .rpm = 3551, .full_stroke_ms = 27, .track_seek_ms = 4.5, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-1] Maxtor 7213AT", .internal_name = "7213AT", .model = "Maxtor 7213 AT", .zones = 4, .avg_spt = 55, .heads = 4, .rpm = 3551, .full_stroke_ms = 28, .track_seek_ms = 6.5, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-1] Maxtor 7245AT", .internal_name = "7245AT", .model = "Maxtor 7245 AT", .zones = 4, .avg_spt = 49, .heads = 4, .rpm = 3551, .full_stroke_ms = 27, .track_seek_ms = 4.4, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-1] Quantum ProDrive LPS 105", .internal_name = "LPS105AT", .model = "QUANTUM PRODRIVE 105", .zones = 1, .avg_spt = 70, .heads = 2, .rpm = 3662, .full_stroke_ms = 45, .track_seek_ms = 5, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-1] Quantum ProDrive LPS 120AT", .internal_name = "GM12A012", .model = "QUANTUM PRODRIVE 120AT", .zones = 1, .avg_spt = 50, .heads = 2, .rpm = 3605, .full_stroke_ms = 45, .track_seek_ms = 4, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-1] Seagate ST3243A", .internal_name = "ST3243A", .model = "ST3243A", .zones = 1, .avg_spt = 40, .heads = 4, .rpm = 3811, .full_stroke_ms = 32, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-1] Western Digital Caviar 140", .internal_name = "AC140", .model = "WDC AC140", .zones = 4, .avg_spt = 70, .heads = 2, .rpm = 3551, .full_stroke_ms = 28, .track_seek_ms = 6, .rcache_num_seg = 8, .rcache_seg_size = 8, .max_multiple = 8 }, - { .name = "[ATA-1] Western Digital Caviar 280", .internal_name = "AC280", .model = "WDC AC280", .zones = 4, .avg_spt = 70, .heads = 4, .rpm = 3595, .full_stroke_ms = 28, .track_seek_ms = 6, .rcache_num_seg = 8, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-1] Western Digital Caviar 1210", .internal_name = "AC1210", .model = "WDC AC1210F", .zones = 4, .avg_spt = 30, .heads = 2, .rpm = 3314, .full_stroke_ms = 33, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-1] Western Digital Caviar 2120", .internal_name = "AC2120", .model = "WDC AC2120M", .zones = 4, .avg_spt = 40, .heads = 2, .rpm = 3605, .full_stroke_ms = 28, .track_seek_ms = 2.8, .rcache_num_seg = 8, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-2] IBM DBOA-2720", .internal_name = "DBOA2720", .model = "DBOA-2720", .zones = 2, .avg_spt = 135, .heads = 2, .rpm = 4000, .full_stroke_ms = 30, .track_seek_ms = 5, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-2] IBM DeskStar 4 (DCAA-32880)", .internal_name = "DCAA32880", .model = "IBM-DCAA-32880", .zones = 8, .avg_spt = 185, .heads = 2, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.7, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 16 }, - { .name = "[ATA-2] IBM DeskStar 4 (DCAA-33610)", .internal_name = "DCAA33610", .model = "IBM-DCAA-33610", .zones = 8, .avg_spt = 185, .heads = 3, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.7, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 16 }, - { .name = "[ATA-2] IBM DeskStar 4 (DCAA-34330)", .internal_name = "DCAA34330", .model = "IBM-DCAA-34330", .zones = 8, .avg_spt = 185, .heads = 3, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.7, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 16 }, - { .name = "[ATA-2] Maxtor 7540AV", .internal_name = "7540AV", .model = "Maxtor 7540 AV", .zones = 2, .avg_spt = 120, .heads = 4, .rpm = 3551, .full_stroke_ms = 31, .track_seek_ms = 4.3, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 8 }, - { .name = "[ATA-2] Maxtor 7546AT", .internal_name = "7546AT", .model = "Maxtor 7546 AT", .zones = 2, .avg_spt = 100, .heads = 4, .rpm = 4500, .full_stroke_ms = 28, .track_seek_ms = 2.3, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 8 }, - { .name = "[ATA-2] Maxtor 7850AV", .internal_name = "7850AV", .model = "Maxtor 7850 AV", .zones = 4, .avg_spt = 120, .heads = 4, .rpm = 3551, .full_stroke_ms = 31, .track_seek_ms = 3.7, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-2] Maxtor 71336AP", .internal_name = "71336AP", .model = "Maxtor 71336 AP", .zones = 4, .avg_spt = 105, .heads = 4, .rpm = 4480, .full_stroke_ms = 12, .track_seek_ms = 3.4, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Quantum Bigfoot 1.2AT", .internal_name = "BF12A011", .model = "QUANTUM BIGFOOT BF1.2A", .zones = 2, .avg_spt = 155, .heads = 2, .rpm = 3600, .full_stroke_ms = 30, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Quantum Bigfoot (CY4320A)", .internal_name = "CY4320A", .model = "QUANTUM BIGFOOT_CY4320A", .zones = 2, .avg_spt = 130, .heads = 2, .rpm = 4000, .full_stroke_ms = 29, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, // from Hardcore Windows NT Final Segment by Kugee - { .name = "[ATA-2] Quantum Fireball 640AT", .internal_name = "FB64A341", .model = "QUANTUM FIREBALL 640AT", .zones = 2, .avg_spt = 120, .heads = 2, .rpm = 5400, .full_stroke_ms = 24, .track_seek_ms = 3.1, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Quantum Fireball TM1080AT", .internal_name = "TM10A462", .model = "QUANTUM FIREBALL TM1.0A", .zones = 2, .avg_spt = 120, .heads = 2, .rpm = 4500, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Quantum Fireball TM1.2AT", .internal_name = "TM12A012", .model = "QUANTUM FIREBALL TM1.2A", .zones = 4, .avg_spt = 120, .heads = 2, .rpm = 4500, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Samsung PLS-31274A", .internal_name = "PLS31274A", .model = "SAMSUNG PLS-31274A", .zones = 4, .avg_spt = 110, .heads = 4, .rpm = 4500, .full_stroke_ms = 45, .track_seek_ms = 4.5, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 8 }, - { .name = "[ATA-2] Samsung Winner-1", .internal_name = "WNR31601A", .model = "SAMSUNG WNR-31601A", .zones = 8, .avg_spt = 110, .heads = 4, .rpm = 5400, .full_stroke_ms = 22, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Seagate Medalist (ST3780A)", .internal_name = "ST3780A", .model = "ST3780A", .zones = 8, .avg_spt = 120, .heads = 4, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 16 }, - { .name = "[ATA-2] Seagate Medalist (ST31220A)", .internal_name = "ST31220A", .model = "ST31220A", .zones = 8, .avg_spt = 140, .heads = 6, .rpm = 4500, .full_stroke_ms = 27, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 16 }, - { .name = "[ATA-2] Seagate Medalist 210xe", .internal_name = "ST3250A", .model = "ST3250A", .zones = 4, .avg_spt = 148, .heads = 2, .rpm = 3811, .full_stroke_ms = 30, .track_seek_ms = 4.1, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, - { .name = "[ATA-2] Seagate Medalist 275xe", .internal_name = "ST3295A", .model = "ST3295A", .zones = 4, .avg_spt = 130, .heads = 2, .rpm = 3811, .full_stroke_ms = 30, .track_seek_ms = 3.4, .rcache_num_seg = 3, .rcache_seg_size = 120, .max_multiple = 8 }, - { .name = "[ATA-2] Seagate Medalist 545xe", .internal_name = "ST3660A", .model = "ST3660A", .zones = 4, .avg_spt = 130, .heads = 4, .rpm = 3811, .full_stroke_ms = 34, .track_seek_ms = 3.4, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, - { .name = "[ATA-2] Seagate Medalist 640xe", .internal_name = "ST3630A", .model = "ST3630A", .zones = 4, .avg_spt = 130, .heads = 4, .rpm = 3811, .full_stroke_ms = 34, .track_seek_ms = 3.5, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, - { .name = "[ATA-2] Seagate Medalist 850xe", .internal_name = "ST3850A", .model = "ST3850A", .zones = 8, .avg_spt = 150, .heads = 4, .rpm = 3811, .full_stroke_ms = 34, .track_seek_ms = 3.8, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, - { .name = "[ATA-2] Seagate Medalist 1270SL", .internal_name = "ST51270A", .model = "ST51270A", .zones = 8, .avg_spt = 205, .heads = 3, .rpm = 5736, .full_stroke_ms = 25, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Seagate Medalist 3240", .internal_name = "ST33240A", .model = "ST33240A", .zones = 16, .avg_spt = 225, .heads = 8, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Toshiba MK2101MAN (HDD2616)", .internal_name = "HDD2616", .model = "TOSHIBA MK2101MAN", .zones = 8, .avg_spt = 130, .heads = 10, .rpm = 4200, .full_stroke_ms = 36, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Western Digital Caviar 2540", .internal_name = "AC2540", .model = "WDC AC2540H", .zones = 4, .avg_spt = 150, .heads = 2, .rpm = 4500, .full_stroke_ms = 12, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Western Digital Caviar 2850", .internal_name = "AC2850", .model = "WDC AC2850F", .zones = 4, .avg_spt = 130, .heads = 2, .rpm = 5200, .full_stroke_ms = 12, .track_seek_ms = 4, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Western Digital Caviar 11000", .internal_name = "AC11000", .model = "WDC AC11000H", .zones = 4, .avg_spt = 120, .heads = 2, .rpm = 5200, .full_stroke_ms = 12, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Western Digital Caviar 21200", .internal_name = "AC21200", .model = "WDC AC21200H", .zones = 4, .avg_spt = 110, .heads = 4, .rpm = 5200, .full_stroke_ms = 39, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Western Digital Caviar 21600", .internal_name = "AC21600", .model = "WDC AC21600H", .zones = 8, .avg_spt = 140, .heads = 4, .rpm = 5200, .full_stroke_ms = 30, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Western Digital Caviar 22000", .internal_name = "AC22000", .model = "WDC AC22000LA", .zones = 8, .avg_spt = 130, .heads = 3, .rpm = 5200, .full_stroke_ms = 33, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, - { .name = "[ATA-2] Western Digital Caviar 22100", .internal_name = "AC22100", .model = "WDC AC22100H", .zones = 8, .avg_spt = 140, .heads = 4, .rpm = 5200, .full_stroke_ms = 30, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-2] Western Digital Caviar 31200", .internal_name = "AC31200", .model = "WDC AC31200F", .zones = 8, .avg_spt = 210, .heads = 4, .rpm = 4500, .full_stroke_ms = 12, .track_seek_ms = 4, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 16 }, - { .name = "[ATA-3] Conner CFS1275A", .internal_name = "CFS1275A", .model = "Conner Peripherals 1275MB - CFS1275A", .zones = 4, .avg_spt = 130, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 16 }, // Either ATA-2 or ATA-3 - { .name = "[ATA-3] Fujitsu MPA3017AT", .internal_name = "MPA3017AT", .model = "FUJITSU MPA3017AT", .zones = 5, .avg_spt = 195, .heads = 2, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Fujitsu MPA3026AT", .internal_name = "MPA3026AT", .model = "FUJITSU MPA3026AT", .zones = 8, .avg_spt = 195, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Fujitsu MPA3035AT", .internal_name = "MPA3035AT", .model = "FUJITSU MPA3035AT", .zones = 11, .avg_spt = 195, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Fujitsu MPA3043AT", .internal_name = "MPA3043AT", .model = "FUJITSU MPA3043AT", .zones = 15, .avg_spt = 195, .heads = 5, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Fujitsu MPA3052AT", .internal_name = "MPA3052AT", .model = "FUJITSU MPA3052AT", .zones = 16, .avg_spt = 195, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Samsung Voyager 6", .internal_name = "SV0844A", .model = "SAMSUNG SV0844A", .zones = 8, .avg_spt = 205, .heads = 4, .rpm = 5400, .full_stroke_ms = 22, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-3] Samsung Winner 5X", .internal_name = "WU33205A", .model = "SAMSUNG WU33205A", .zones = 16, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Seagate Medalist 636", .internal_name = "ST3636A", .model = "Seagate Technology 636MB - ST3636A", .zones = 2, .avg_spt = 130, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-3] Seagate Medalist 1082", .internal_name = "ST31082A", .model = "Seagate Technology 1082MB - ST31082A", .zones = 4, .avg_spt = 130, .heads = 3, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, - { .name = "[ATA-3] Seagate Medalist 1276", .internal_name = "ST31276A", .model = "Seagate Technology 1275MB - ST31276A", .zones = 4, .avg_spt = 130, .heads = 3, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 16 }, - { .name = "[ATA-3] Seagate Medalist 1720", .internal_name = "ST31720A", .model = "ST31720A", .zones = 4, .avg_spt = 120, .heads = 4, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-3] Seagate Medalist 2132", .internal_name = "ST32132A", .model = "ST32132A", .zones = 8, .avg_spt = 125, .heads = 6, .rpm = 4500, .full_stroke_ms = 30, .track_seek_ms = 2.3, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 16 }, - { .name = "[ATA-3] Western Digital Caviar 21700", .internal_name = "AC21700", .model = "WDC AC21700H", .zones = 8, .avg_spt = 185, .heads = 3, .rpm = 5200, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, // Apple Computer OEM only, not retail version - { .name = "[ATA-4] Fujitsu MPB3021AT", .internal_name = "MPB3021AT", .model = "FUJITSU MPB3021AT", .zones = 7, .avg_spt = 200, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 16 }, - { .name = "[ATA-4] Fujitsu MPD3043AT", .internal_name = "MPD3043AT", .model = "FUJITSU MPD3043AT", .zones = 5, .avg_spt = 195, .heads = 2, .rpm = 5400, .full_stroke_ms = 29, .track_seek_ms = 1.5, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-4] Fujitsu MPD3064AT", .internal_name = "MPD3064AT", .model = "FUJITSU MPD3064AT", .zones = 7, .avg_spt = 195, .heads = 3, .rpm = 5400, .full_stroke_ms = 30, .track_seek_ms = 1.5, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-4] Fujitsu MPD3084AT", .internal_name = "MPD3084AT", .model = "FUJITSU MPD3084AT", .zones = 7, .avg_spt = 195, .heads = 4, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-4] Fujitsu MPE3064AT", .internal_name = "MPE3064AT", .model = "FUJITSU MPE3064AT", .zones = 7, .avg_spt = 295, .heads = 2, .rpm = 5400, .full_stroke_ms = 30, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax 2160", .internal_name = "86480D6", .model = "Maxtor 86480D6", .zones = 8, .avg_spt = 197, .heads = 4, .rpm = 5200, .full_stroke_ms = 18, .track_seek_ms = 1, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax 2880", .internal_name = "90432D3", .model = "Maxtor 90432D3", .zones = 16, .avg_spt = 190, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax 3400", .internal_name = "90644D3", .model = "Maxtor 90644D3", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 0.9, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax 4320 (90432D2)", .internal_name = "90432D2", .model = "Maxtor 90432D2", .zones = 16, .avg_spt = 290, .heads = 2, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 0.9, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax 4320 (90845D4)", .internal_name = "90845D4", .model = "Maxtor 90845D4", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 0.9, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (90683U2)", .internal_name = "90683U2", .model = "Maxtor 90683U2", .zones = 16, .avg_spt = 290, .heads = 2, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (91024U3)", .internal_name = "91024U3", .model = "Maxtor 91024U3", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (91366U4)", .internal_name = "91366U4", .model = "Maxtor 91366U4", .zones = 16, .avg_spt = 290, .heads = 4, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (92049U6)", .internal_name = "92049U6", .model = "Maxtor 92049U6", .zones = 16, .avg_spt = 290, .heads = 6, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (92732U8)", .internal_name = "92732U8", .model = "Maxtor 92732U8", .zones = 16, .avg_spt = 290, .heads = 8, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Quantum Bigfoot TX4.3AT", .internal_name = "TX043A011", .model = "QUANTUM BIGFOOT TX4.3A", .zones = 2, .avg_spt = 220, .heads = 2, .rpm = 4000, .full_stroke_ms = 30, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 32 }, - { .name = "[ATA-4] Quantum Fireball ST3.2AT", .internal_name = "ST32A461", .model = "QUANTUM FIREBALL ST3.2A", .zones = 4, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Quantum Fireball SE4.3A", .internal_name = "SE43A011", .model = "QUANTUM FIREBALL SE4.3A", .zones = 2, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Quantum Fireball SE6.4A", .internal_name = "SE64A011", .model = "QUANTUM FIREBALL SE6.4A", .zones = 3, .avg_spt = 200, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Quantum Fireball SE8.4A", .internal_name = "SE84A011", .model = "QUANTUM FIREBALL SE8.4A", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Quantum Fireball EX12.7A", .internal_name = "EX12A012", .model = "QUANTUM FIREBALL EX12.7A", .version = "A0A.0D00", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Quantum Fireball LCT-08 (LA04A011)", .internal_name = "LA04A011", .model = "QUANTUM FIREBALLlct08 04", .version = "A05.0X00", .zones = 8, .avg_spt = 280, .heads = 6, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-4] Seagate Medalist 2122", .internal_name = "ST32122A", .model = "ST32122A", .zones = 16, .avg_spt = 215, .heads = 2, .rpm = 4500, .full_stroke_ms = 23, .track_seek_ms = 3.8, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Seagate Medalist 3321", .internal_name = "ST33221A", .model = "ST33221A", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1.7, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Seagate Medalist 4321", .internal_name = "ST34321A", .model = "ST34321A", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Seagate Medalist 6531", .internal_name = "ST36531A", .model = "ST36531A", .zones = 16, .avg_spt = 215, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1.7, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, - { .name = "[ATA-4] Seagate Medalist 8420", .internal_name = "ST38420A", .model = "ST38420A", .zones = 16, .avg_spt = 290, .heads = 4, .rpm = 5400, .full_stroke_ms = 16, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Seagate Medalist 13030", .internal_name = "ST313030A", .model = "ST313030A", .zones = 16, .avg_spt = 290, .heads = 6, .rpm = 5400, .full_stroke_ms = 16, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Seagate Medalist 17240", .internal_name = "ST317240A", .model = "ST317240A", .zones = 16, .avg_spt = 290, .heads = 8, .rpm = 5400, .full_stroke_ms = 16, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Toshiba MK4006MAV", .internal_name = "MK4006MAV", .model = "TOSHIBA MK4006MAV", .zones = 8, .avg_spt = 230, .heads = 6, .rpm = 4200, .full_stroke_ms = 25, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Western Digital Caviar 14300", .internal_name = "AC14300", .model = "WDC AC14300RT", .zones = 16, .avg_spt = 195, .heads = 2, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 5.5, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-4] Western Digital Caviar 23200", .internal_name = "AC23200", .model = "WDC AC23200LB", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Western Digital Caviar 26400", .internal_name = "AC26400", .model = "WDC AC26400RN", .zones = 16, .avg_spt = 295, .heads = 5, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-4] Western Digital Caviar 33200", .internal_name = "AC33200", .model = "WDC AC33200LA", .zones = 16, .avg_spt = 310, .heads = 5, .rpm = 5200, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-4] Western Digital Caviar 35100", .internal_name = "AC35100", .model = "WDC AC35100L", .version = "09.09M08", .zones = 16, .avg_spt = 315, .heads = 5, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-5] IBM Travelstar 6GN", .internal_name = "DARA206000", .model = "IBM-DARA-206000", .zones = 12, .avg_spt = 292, .heads = 2, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] IBM Travelstar 9GN", .internal_name = "DARA209000", .model = "IBM-DARA-209000", .zones = 12, .avg_spt = 292, .heads = 3, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] IBM/Hitachi Travelstar 12GN", .internal_name = "DARA212000", .model = "IBM-DARA-212000", .zones = 12, .avg_spt = 292, .heads = 4, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, // Either Hitachi or IBM OEM - { .name = "[ATA-5] Maxtor DiamondMax VL 17", .internal_name = "90871U2", .model = "Maxtor 90871U2", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 0.9, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, - { .name = "[ATA-5] Maxtor DiamondMax VL 20 (91021U2)", .internal_name = "91021U2", .model = "Maxtor 91021U2", .zones = 16, .avg_spt = 295, .heads = 2, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Maxtor DiamondMax VL 20 (91531U3)", .internal_name = "91531U3", .model = "Maxtor 91531U3", .zones = 16, .avg_spt = 295, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Maxtor DiamondMax VL 20 (92041U4)", .internal_name = "92041U4", .model = "Maxtor 92041U4", .zones = 16, .avg_spt = 295, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Quantum Fireball EX3.2A", .internal_name = "EX32A012", .model = "QUANTUM FIREBALL EX3.2A", .zones = 1, .avg_spt = 210, .heads = 2, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball EX5.1A", .internal_name = "EX51A012", .model = "QUANTUM FIREBALL EX5.1A", .zones = 2, .avg_spt = 210, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball EX6.4A", .internal_name = "EX64A012", .model = "QUANTUM FIREBALL EX6.4A", .zones = 2, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball EX10.2A", .internal_name = "EX10A011", .model = "QUANTUM FIREBALL EX10.2A", .zones = 3, .avg_spt = 210, .heads = 6, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball EX12.7A", .internal_name = "EX12A011", .model = "QUANTUM FIREBALL EX12.7A", .zones = 4, .avg_spt = 210, .heads = 8, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball CR4.3A", .internal_name = "CR43A013", .model = "QUANTUM FIREBALL CR4.3A", .zones = 2, .avg_spt = 310, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball CR6.4A", .internal_name = "CR64A011", .model = "QUANTUM FIREBALL CR6.4A", .zones = 2, .avg_spt = 310, .heads = 4, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball CR8.4A", .internal_name = "CR84A011", .model = "QUANTUM FIREBALL CR8.4A", .zones = 3, .avg_spt = 310, .heads = 6, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Quantum Fireball CR13.0A", .internal_name = "CR13A011", .model = "QUANTUM FIREBALL CR13.0A", .zones = 4, .avg_spt = 310, .heads = 8, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, - { .name = "[ATA-5] Samsung SpinPoint V6800 (SV0682D)", .internal_name = "SV0682D", .model = "SAMSUNG SV0682D", .zones = 8, .avg_spt = 295, .heads = 2, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Samsung SpinPoint V6800 (SV1023D)", .internal_name = "SV1023D", .model = "SAMSUNG SV1023D", .zones = 8, .avg_spt = 295, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Samsung SpinPoint V6800 (SV1364D)", .internal_name = "SV1364D", .model = "SAMSUNG SV1364D", .zones = 8, .avg_spt = 295, .heads = 4, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Samsung SpinPoint V6800 (SV1705D)", .internal_name = "SV1705D", .model = "SAMSUNG SV1705D", .zones = 8, .avg_spt = 295, .heads = 5, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Samsung SpinPoint V6800 (SV2046D)", .internal_name = "SV2046D", .model = "SAMSUNG SV2046D", .zones = 8, .avg_spt = 295, .heads = 6, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Seagate U8 - 4.3gb", .internal_name = "ST34313A", .model = "ST34313A", .zones = 16, .avg_spt = 289, .heads = 1, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Seagate U8 - 8.4gb", .internal_name = "ST38410A", .model = "ST38410A", .zones = 16, .avg_spt = 289, .heads = 2, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Seagate U8 - 13gb", .internal_name = "ST313021A", .model = "ST313021A", .zones = 16, .avg_spt = 289, .heads = 4, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Seagate U8 - 17.2gb", .internal_name = "ST317221A", .model = "ST317221A", .zones = 16, .avg_spt = 289, .heads = 3, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Western Digital Caviar 102AA", .internal_name = "WD102AA", .model = "WDC WD102AA-00ANA0", .zones = 16, .avg_spt = 295, .heads = 8, .rpm = 5400, .full_stroke_ms = 12, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, - { .name = "[ATA-5] Western Digital Expert", .internal_name = "WD135BA", .model = "WDC WD135BA-60AK", .zones = 16, .avg_spt = 350, .heads = 6, .rpm = 7200, .full_stroke_ms = 15, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 1920, .max_multiple = 32 }, + { .name = "[Generic] RAM Disk (max. speed)", .internal_name = "ramdisk", .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 32 }, + { .name = "[Generic] 1989 (3500 RPM)", .internal_name = "1989_3500rpm", .zones = 1, .avg_spt = 35, .heads = 2, .rpm = 3500, .full_stroke_ms = 40, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 16, .max_multiple = 8 }, + { .name = "[Generic] 1992 (3600 RPM)", .internal_name = "1992_3600rpm", .zones = 1, .avg_spt = 45, .heads = 2, .rpm = 3600, .full_stroke_ms = 30, .track_seek_ms = 6, .rcache_num_seg = 4, .rcache_seg_size = 16, .max_multiple = 8 }, + { .name = "[Generic] 1994 (4500 RPM)", .internal_name = "1994_4500rpm", .zones = 8, .avg_spt = 80, .heads = 4, .rpm = 4500, .full_stroke_ms = 26, .track_seek_ms = 5, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 16 }, + { .name = "[Generic] 1996 (5400 RPM)", .internal_name = "1996_5400rpm", .zones = 16, .avg_spt = 135, .heads = 4, .rpm = 5400, .full_stroke_ms = 24, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 16 }, + { .name = "[Generic] 1997 (5400 RPM)", .internal_name = "1997_5400rpm", .zones = 16, .avg_spt = 185, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 32 }, + { .name = "[Generic] 1998 (5400 RPM)", .internal_name = "1998_5400rpm", .zones = 16, .avg_spt = 300, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 32 }, + { .name = "[Generic] 2000 (7200 RPM)", .internal_name = "2000_7200rpm", .zones = 16, .avg_spt = 350, .heads = 6, .rpm = 7200, .full_stroke_ms = 15, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 32 }, + { .name = "[PIO IDE] IBM WDA-L42", .internal_name = "WDAL42", .model = "WDA-L42", .zones = 1, .avg_spt = 85, .heads = 2, .rpm = 3600, .full_stroke_ms = 33, .track_seek_ms = 2.5, .rcache_num_seg = 1, .rcache_seg_size = 32, .max_multiple = 1 }, + { .name = "[PIO-2] IBM DSAA-3270", .internal_name = "DSAA3270", .model = "DSAA-3270", .version = "25505120", .zones = 8, .avg_spt = 268, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2.1, .rcache_num_seg = 3, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-1] Conner CP3024", .internal_name = "CP3024", .model = "Conner Peripherals 20MB - CP3024", .zones = 1, .avg_spt = 33, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work + { .name = "[ATA-1] Conner CP3044", .internal_name = "CP3044", .model = "Conner Peripherals 40MB - CP3044", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3500, .full_stroke_ms = 50, .track_seek_ms = 8, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work + { .name = "[ATA-1] Conner CP3104", .internal_name = "CP3104", .model = "Conner Peripherals 104MB - CP3104", .zones = 1, .avg_spt = 33, .heads = 8, .rpm = 3500, .full_stroke_ms = 45, .track_seek_ms = 8, .rcache_num_seg = 4, .rcache_seg_size = 8, .max_multiple = 8 }, // Needed for GRiDcase 1520 to work + { .name = "[ATA-1] Conner CFS420A", .internal_name = "CFS420A", .model = "Conner Peripherals 420MB - CFS420A", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3600, .full_stroke_ms = 33, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-1] HP Kittyhawk", .internal_name = "C3014A", .model = "HP C3014A", .zones = 6, .avg_spt = 80, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 16, .max_multiple = 8 }, + { .name = "[ATA-1] IBM H3256-A3", .internal_name = "H3256A3", .model = "H3256-A3", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3600, .full_stroke_ms = 32, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 8 }, + { .name = "[ATA-1] IBM H3342-A4", .internal_name = "H3342A4", .model = "H3342-A4", .zones = 1, .avg_spt = 40, .heads = 2, .rpm = 3600, .full_stroke_ms = 30, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 8 }, + { .name = "[ATA-1] Kalok KL343", .internal_name = "KL343", .model = "KALOK KL-343", .zones = 1, .avg_spt = 80, .heads = 6, .rpm = 3600, .full_stroke_ms = 50, .track_seek_ms = 2, .rcache_num_seg = 1, .rcache_seg_size = 8, .max_multiple = 8 }, + { .name = "[ATA-1] Kalok KL3100", .internal_name = "KL3100", .model = "KALOK KL-3100", .zones = 1, .avg_spt = 100, .heads = 6, .rpm = 3662, .full_stroke_ms = 50, .track_seek_ms = 2, .rcache_num_seg = 1, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-1] Maxtor 7060AT", .internal_name = "7060AT", .model = "Maxtor 7060 AT", .zones = 1, .avg_spt = 62, .heads = 2, .rpm = 3524, .full_stroke_ms = 30, .track_seek_ms = 3.6, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-1] Maxtor 7131AT", .internal_name = "7131AT", .model = "Maxtor 7131 AT", .zones = 2, .avg_spt = 54, .heads = 2, .rpm = 3551, .full_stroke_ms = 27, .track_seek_ms = 4.5, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-1] Maxtor 7213AT", .internal_name = "7213AT", .model = "Maxtor 7213 AT", .zones = 4, .avg_spt = 55, .heads = 4, .rpm = 3551, .full_stroke_ms = 28, .track_seek_ms = 6.5, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-1] Maxtor 7245AT", .internal_name = "7245AT", .model = "Maxtor 7245 AT", .zones = 4, .avg_spt = 49, .heads = 4, .rpm = 3551, .full_stroke_ms = 27, .track_seek_ms = 4.4, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-1] Quantum ProDrive LPS 105", .internal_name = "LPS105AT", .model = "QUANTUM PRODRIVE 105", .zones = 1, .avg_spt = 70, .heads = 2, .rpm = 3662, .full_stroke_ms = 45, .track_seek_ms = 5, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-1] Quantum ProDrive LPS 120AT", .internal_name = "GM12A012", .model = "QUANTUM PRODRIVE 120AT", .zones = 1, .avg_spt = 50, .heads = 2, .rpm = 3605, .full_stroke_ms = 45, .track_seek_ms = 4, .rcache_num_seg = 1, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-1] Seagate ST3243A", .internal_name = "ST3243A", .model = "ST3243A", .zones = 1, .avg_spt = 40, .heads = 4, .rpm = 3811, .full_stroke_ms = 32, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-1] Western Digital Caviar 140", .internal_name = "AC140", .model = "WDC AC140", .zones = 4, .avg_spt = 70, .heads = 2, .rpm = 3551, .full_stroke_ms = 28, .track_seek_ms = 6, .rcache_num_seg = 8, .rcache_seg_size = 8, .max_multiple = 8 }, + { .name = "[ATA-1] Western Digital Caviar 280", .internal_name = "AC280", .model = "WDC AC280", .zones = 4, .avg_spt = 70, .heads = 4, .rpm = 3595, .full_stroke_ms = 28, .track_seek_ms = 6, .rcache_num_seg = 8, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-1] Western Digital Caviar 1210", .internal_name = "AC1210", .model = "WDC AC1210F", .zones = 4, .avg_spt = 30, .heads = 2, .rpm = 3314, .full_stroke_ms = 33, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-1] Western Digital Caviar 2120", .internal_name = "AC2120", .model = "WDC AC2120M", .zones = 4, .avg_spt = 40, .heads = 2, .rpm = 3605, .full_stroke_ms = 28, .track_seek_ms = 2.8, .rcache_num_seg = 8, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-2] IBM DBOA-2720", .internal_name = "DBOA2720", .model = "DBOA-2720", .zones = 2, .avg_spt = 135, .heads = 2, .rpm = 4000, .full_stroke_ms = 30, .track_seek_ms = 5, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-2] IBM DeskStar 4 (DCAA-32880)", .internal_name = "DCAA32880", .model = "IBM-DCAA-32880", .zones = 8, .avg_spt = 185, .heads = 2, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.7, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 16 }, + { .name = "[ATA-2] IBM DeskStar 4 (DCAA-33610)", .internal_name = "DCAA33610", .model = "IBM-DCAA-33610", .zones = 8, .avg_spt = 185, .heads = 3, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.7, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 16 }, + { .name = "[ATA-2] IBM DeskStar 4 (DCAA-34330)", .internal_name = "DCAA34330", .model = "IBM-DCAA-34330", .zones = 8, .avg_spt = 185, .heads = 3, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.7, .rcache_num_seg = 4, .rcache_seg_size = 96, .max_multiple = 16 }, + { .name = "[ATA-2] Maxtor 7540AV", .internal_name = "7540AV", .model = "Maxtor 7540 AV", .zones = 2, .avg_spt = 120, .heads = 4, .rpm = 3551, .full_stroke_ms = 31, .track_seek_ms = 4.3, .rcache_num_seg = 4, .rcache_seg_size = 32, .max_multiple = 8 }, + { .name = "[ATA-2] Maxtor 7546AT", .internal_name = "7546AT", .model = "Maxtor 7546 AT", .zones = 2, .avg_spt = 100, .heads = 4, .rpm = 4500, .full_stroke_ms = 28, .track_seek_ms = 2.3, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 8 }, + { .name = "[ATA-2] Maxtor 7850AV", .internal_name = "7850AV", .model = "Maxtor 7850 AV", .zones = 4, .avg_spt = 120, .heads = 4, .rpm = 3551, .full_stroke_ms = 31, .track_seek_ms = 3.7, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-2] Maxtor 71336AP", .internal_name = "71336AP", .model = "Maxtor 71336 AP", .zones = 4, .avg_spt = 105, .heads = 4, .rpm = 4480, .full_stroke_ms = 12, .track_seek_ms = 3.4, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Quantum Bigfoot 1.2AT", .internal_name = "BF12A011", .model = "QUANTUM BIGFOOT BF1.2A", .zones = 2, .avg_spt = 155, .heads = 2, .rpm = 3600, .full_stroke_ms = 30, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Quantum Bigfoot (CY4320A)", .internal_name = "CY4320A", .model = "QUANTUM BIGFOOT_CY4320A", .zones = 2, .avg_spt = 130, .heads = 2, .rpm = 4000, .full_stroke_ms = 29, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, // from Hardcore Windows NT Final Segment by Kugee + { .name = "[ATA-2] Quantum Fireball 640AT", .internal_name = "FB64A341", .model = "QUANTUM FIREBALL 640AT", .zones = 2, .avg_spt = 120, .heads = 2, .rpm = 5400, .full_stroke_ms = 24, .track_seek_ms = 3.1, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Quantum Fireball TM1080AT", .internal_name = "TM10A462", .model = "QUANTUM FIREBALL TM1.0A", .zones = 2, .avg_spt = 120, .heads = 2, .rpm = 4500, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Quantum Fireball TM1.2AT", .internal_name = "TM12A012", .model = "QUANTUM FIREBALL TM1.2A", .zones = 4, .avg_spt = 120, .heads = 2, .rpm = 4500, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Samsung PLS-31274A", .internal_name = "PLS31274A", .model = "SAMSUNG PLS-31274A", .zones = 4, .avg_spt = 110, .heads = 4, .rpm = 4500, .full_stroke_ms = 45, .track_seek_ms = 4.5, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 8 }, + { .name = "[ATA-2] Samsung Winner-1", .internal_name = "WNR31601A", .model = "SAMSUNG WNR-31601A", .zones = 8, .avg_spt = 110, .heads = 4, .rpm = 5400, .full_stroke_ms = 22, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Seagate Medalist (ST3780A)", .internal_name = "ST3780A", .model = "ST3780A", .zones = 8, .avg_spt = 120, .heads = 4, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 16 }, + { .name = "[ATA-2] Seagate Medalist (ST31220A)", .internal_name = "ST31220A", .model = "ST31220A", .zones = 8, .avg_spt = 140, .heads = 6, .rpm = 4500, .full_stroke_ms = 27, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 256, .max_multiple = 16 }, + { .name = "[ATA-2] Seagate Medalist 210xe", .internal_name = "ST3250A", .model = "ST3250A", .zones = 4, .avg_spt = 148, .heads = 2, .rpm = 3811, .full_stroke_ms = 30, .track_seek_ms = 4.1, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, + { .name = "[ATA-2] Seagate Medalist 275xe", .internal_name = "ST3295A", .model = "ST3295A", .zones = 4, .avg_spt = 130, .heads = 2, .rpm = 3811, .full_stroke_ms = 30, .track_seek_ms = 3.4, .rcache_num_seg = 3, .rcache_seg_size = 120, .max_multiple = 8 }, + { .name = "[ATA-2] Seagate Medalist 545xe", .internal_name = "ST3660A", .model = "ST3660A", .zones = 4, .avg_spt = 130, .heads = 4, .rpm = 3811, .full_stroke_ms = 34, .track_seek_ms = 3.4, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, + { .name = "[ATA-2] Seagate Medalist 640xe", .internal_name = "ST3630A", .model = "ST3630A", .zones = 4, .avg_spt = 130, .heads = 4, .rpm = 3811, .full_stroke_ms = 34, .track_seek_ms = 3.5, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, + { .name = "[ATA-2] Seagate Medalist 850xe", .internal_name = "ST3850A", .model = "ST3850A", .zones = 8, .avg_spt = 150, .heads = 4, .rpm = 3811, .full_stroke_ms = 34, .track_seek_ms = 3.8, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 8 }, + { .name = "[ATA-2] Seagate Medalist 1270SL", .internal_name = "ST51270A", .model = "ST51270A", .zones = 8, .avg_spt = 205, .heads = 3, .rpm = 5736, .full_stroke_ms = 25, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Seagate Medalist 3240", .internal_name = "ST33240A", .model = "ST33240A", .zones = 16, .avg_spt = 225, .heads = 8, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Toshiba MK2101MAN (HDD2616)", .internal_name = "HDD2616", .model = "TOSHIBA MK2101MAN", .zones = 8, .avg_spt = 130, .heads = 10, .rpm = 4200, .full_stroke_ms = 36, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Western Digital Caviar 2540", .internal_name = "AC2540", .model = "WDC AC2540H", .zones = 4, .avg_spt = 150, .heads = 2, .rpm = 4500, .full_stroke_ms = 12, .track_seek_ms = 4, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Western Digital Caviar 2850", .internal_name = "AC2850", .model = "WDC AC2850F", .zones = 4, .avg_spt = 130, .heads = 2, .rpm = 5200, .full_stroke_ms = 12, .track_seek_ms = 4, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Western Digital Caviar 11000", .internal_name = "AC11000", .model = "WDC AC11000H", .zones = 4, .avg_spt = 120, .heads = 2, .rpm = 5200, .full_stroke_ms = 12, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Western Digital Caviar 21200", .internal_name = "AC21200", .model = "WDC AC21200H", .zones = 4, .avg_spt = 110, .heads = 4, .rpm = 5200, .full_stroke_ms = 39, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Western Digital Caviar 21600", .internal_name = "AC21600", .model = "WDC AC21600H", .zones = 8, .avg_spt = 140, .heads = 4, .rpm = 5200, .full_stroke_ms = 30, .track_seek_ms = 3, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Western Digital Caviar 22000", .internal_name = "AC22000", .model = "WDC AC22000LA", .zones = 8, .avg_spt = 130, .heads = 3, .rpm = 5200, .full_stroke_ms = 33, .track_seek_ms = 3.5, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 8 }, + { .name = "[ATA-2] Western Digital Caviar 22100", .internal_name = "AC22100", .model = "WDC AC22100H", .zones = 8, .avg_spt = 140, .heads = 4, .rpm = 5200, .full_stroke_ms = 30, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-2] Western Digital Caviar 31200", .internal_name = "AC31200", .model = "WDC AC31200F", .zones = 8, .avg_spt = 210, .heads = 4, .rpm = 4500, .full_stroke_ms = 12, .track_seek_ms = 4, .rcache_num_seg = 8, .rcache_seg_size = 64, .max_multiple = 16 }, + { .name = "[ATA-3] Conner CFS1275A", .internal_name = "CFS1275A", .model = "Conner Peripherals 1275MB - CFS1275A", .zones = 4, .avg_spt = 130, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 16 }, // Either ATA-2 or ATA-3 + { .name = "[ATA-3] Fujitsu MPA3017AT", .internal_name = "MPA3017AT", .model = "FUJITSU MPA3017AT", .zones = 5, .avg_spt = 195, .heads = 2, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Fujitsu MPA3026AT", .internal_name = "MPA3026AT", .model = "FUJITSU MPA3026AT", .zones = 8, .avg_spt = 195, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Fujitsu MPA3035AT", .internal_name = "MPA3035AT", .model = "FUJITSU MPA3035AT", .zones = 11, .avg_spt = 195, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Fujitsu MPA3043AT", .internal_name = "MPA3043AT", .model = "FUJITSU MPA3043AT", .zones = 15, .avg_spt = 195, .heads = 5, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Fujitsu MPA3052AT", .internal_name = "MPA3052AT", .model = "FUJITSU MPA3052AT", .zones = 16, .avg_spt = 195, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3.2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Samsung Voyager 6", .internal_name = "SV0844A", .model = "SAMSUNG SV0844A", .zones = 8, .avg_spt = 205, .heads = 4, .rpm = 5400, .full_stroke_ms = 22, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-3] Samsung Winner 5X", .internal_name = "WU33205A", .model = "SAMSUNG WU33205A", .zones = 6, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Seagate Medalist 636", .internal_name = "ST3636A", .model = "Seagate Technology 636MB - ST3636A", .zones = 2, .avg_spt = 130, .heads = 2, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-3] Seagate Medalist 1082", .internal_name = "ST31082A", .model = "Seagate Technology 1082MB - ST31082A", .zones = 4, .avg_spt = 130, .heads = 3, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 8 }, + { .name = "[ATA-3] Seagate Medalist 1276", .internal_name = "ST31276A", .model = "Seagate Technology 1275MB - ST31276A", .zones = 4, .avg_spt = 130, .heads = 3, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 3.8, .rcache_num_seg = 4, .rcache_seg_size = 64, .max_multiple = 16 }, + { .name = "[ATA-3] Seagate Medalist 1720", .internal_name = "ST31720A", .model = "ST31720A", .zones = 4, .avg_spt = 120, .heads = 4, .rpm = 4500, .full_stroke_ms = 25, .track_seek_ms = 2, .rcache_num_seg = 4, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-3] Seagate Medalist 2132", .internal_name = "ST32132A", .model = "ST32132A", .zones = 8, .avg_spt = 125, .heads = 6, .rpm = 4500, .full_stroke_ms = 30, .track_seek_ms = 2.3, .rcache_num_seg = 8, .rcache_seg_size = 120, .max_multiple = 16 }, + { .name = "[ATA-3] Western Digital Caviar 21700", .internal_name = "AC21700", .model = "WDC AC21700H", .zones = 8, .avg_spt = 185, .heads = 3, .rpm = 5200, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, // Apple Computer OEM only, not retail version + { .name = "[ATA-4] Fujitsu MPB3021AT", .internal_name = "MPB3021AT", .model = "FUJITSU MPB3021AT", .zones = 7, .avg_spt = 200, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 16 }, + { .name = "[ATA-4] Fujitsu MPD3043AT", .internal_name = "MPD3043AT", .model = "FUJITSU MPD3043AT", .zones = 5, .avg_spt = 195, .heads = 2, .rpm = 5400, .full_stroke_ms = 29, .track_seek_ms = 1.5, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-4] Fujitsu MPD3064AT", .internal_name = "MPD3064AT", .model = "FUJITSU MPD3064AT", .zones = 7, .avg_spt = 195, .heads = 3, .rpm = 5400, .full_stroke_ms = 30, .track_seek_ms = 1.5, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-4] Fujitsu MPD3084AT", .internal_name = "MPD3084AT", .model = "FUJITSU MPD3084AT", .zones = 7, .avg_spt = 195, .heads = 4, .rpm = 5400, .full_stroke_ms = 19, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-4] Fujitsu MPE3064AT", .internal_name = "MPE3064AT", .model = "FUJITSU MPE3064AT", .zones = 7, .avg_spt = 295, .heads = 2, .rpm = 5400, .full_stroke_ms = 30, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax 2160", .internal_name = "86480D6", .model = "Maxtor 86480D6", .zones = 8, .avg_spt = 197, .heads = 4, .rpm = 5200, .full_stroke_ms = 18, .track_seek_ms = 1, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax 2880", .internal_name = "90432D3", .model = "Maxtor 90432D3", .zones = 16, .avg_spt = 190, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax 3400", .internal_name = "90644D3", .model = "Maxtor 90644D3", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 0.9, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax 4320 (90432D2)", .internal_name = "90432D2", .model = "Maxtor 90432D2", .zones = 16, .avg_spt = 290, .heads = 2, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 0.9, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax 4320 (90845D4)", .internal_name = "90845D4", .model = "Maxtor 90845D4", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 0.9, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (90683U2)", .internal_name = "90683U2", .model = "Maxtor 90683U2", .zones = 16, .avg_spt = 290, .heads = 2, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (91024U3)", .internal_name = "91024U3", .model = "Maxtor 91024U3", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (91366U4)", .internal_name = "91366U4", .model = "Maxtor 91366U4", .zones = 16, .avg_spt = 290, .heads = 4, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (92049U6)", .internal_name = "92049U6", .model = "Maxtor 92049U6", .zones = 16, .avg_spt = 290, .heads = 6, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Maxtor DiamondMax Plus 6800 (92732U8)", .internal_name = "92732U8", .model = "Maxtor 92732U8", .zones = 16, .avg_spt = 290, .heads = 8, .rpm = 7200, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Quantum Bigfoot TX4.3AT", .internal_name = "TX043A011", .model = "QUANTUM BIGFOOT TX4.3A", .zones = 2, .avg_spt = 220, .heads = 2, .rpm = 4000, .full_stroke_ms = 30, .track_seek_ms = 2.5, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 32 }, + { .name = "[ATA-4] Quantum Fireball ST3.2AT", .internal_name = "ST32A461", .model = "QUANTUM FIREBALL ST3.2A", .zones = 4, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Quantum Fireball SE4.3A", .internal_name = "SE43A011", .model = "QUANTUM FIREBALL SE4.3A", .zones = 2, .avg_spt = 200, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Quantum Fireball SE6.4A", .internal_name = "SE64A011", .model = "QUANTUM FIREBALL SE6.4A", .zones = 3, .avg_spt = 200, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Quantum Fireball SE8.4A", .internal_name = "SE84A011", .model = "QUANTUM FIREBALL SE8.4A", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Quantum Fireball EX12.7A", .internal_name = "EX12A012", .model = "QUANTUM FIREBALL EX12.7A", .version = "A0A.0D00", .zones = 4, .avg_spt = 200, .heads = 8, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Quantum Fireball LCT-08 (LA04A011)", .internal_name = "LA04A011", .model = "QUANTUM FIREBALLlct08 04", .version = "A05.0X00", .zones = 8, .avg_spt = 280, .heads = 6, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-4] Seagate Medalist 2122", .internal_name = "ST32122A", .model = "ST32122A", .zones = 16, .avg_spt = 215, .heads = 2, .rpm = 4500, .full_stroke_ms = 23, .track_seek_ms = 3.8, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Seagate Medalist 3321", .internal_name = "ST33221A", .model = "ST33221A", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1.7, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Seagate Medalist 4321", .internal_name = "ST34321A", .model = "ST34321A", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 2.2, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Seagate Medalist 6531", .internal_name = "ST36531A", .model = "ST36531A", .zones = 16, .avg_spt = 215, .heads = 6, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1.7, .rcache_num_seg = 16, .rcache_seg_size = 128, .max_multiple = 16 }, + { .name = "[ATA-4] Seagate Medalist 8420", .internal_name = "ST38420A", .model = "ST38420A", .zones = 16, .avg_spt = 290, .heads = 4, .rpm = 5400, .full_stroke_ms = 16, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Seagate Medalist 13030", .internal_name = "ST313030A", .model = "ST313030A", .zones = 16, .avg_spt = 290, .heads = 6, .rpm = 5400, .full_stroke_ms = 16, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Seagate Medalist 17240", .internal_name = "ST317240A", .model = "ST317240A", .zones = 16, .avg_spt = 290, .heads = 8, .rpm = 5400, .full_stroke_ms = 16, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Toshiba MK4006MAV", .internal_name = "MK4006MAV", .model = "TOSHIBA MK4006MAV", .zones = 8, .avg_spt = 230, .heads = 6, .rpm = 4200, .full_stroke_ms = 25, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Western Digital Caviar 14300", .internal_name = "AC14300", .model = "WDC AC14300RT", .zones = 16, .avg_spt = 195, .heads = 2, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 5.5, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-4] Western Digital Caviar 23200", .internal_name = "AC23200", .model = "WDC AC23200LB", .zones = 16, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Western Digital Caviar 26400", .internal_name = "AC26400", .model = "WDC AC26400RN", .zones = 16, .avg_spt = 295, .heads = 5, .rpm = 5400, .full_stroke_ms = 21, .track_seek_ms = 3, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-4] Western Digital Caviar 33200", .internal_name = "AC33200", .model = "WDC AC33200LA", .zones = 16, .avg_spt = 310, .heads = 5, .rpm = 5200, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-4] Western Digital Caviar 35100", .internal_name = "AC35100", .model = "WDC AC35100L", .version = "09.09M08", .zones = 16, .avg_spt = 315, .heads = 5, .rpm = 5400, .full_stroke_ms = 40, .track_seek_ms = 3, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-5] IBM Travelstar 6GN", .internal_name = "DARA206000", .model = "IBM-DARA-206000", .zones = 12, .avg_spt = 292, .heads = 2, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] IBM Travelstar 9GN", .internal_name = "DARA209000", .model = "IBM-DARA-209000", .zones = 12, .avg_spt = 292, .heads = 3, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] IBM/Hitachi Travelstar 12GN", .internal_name = "DARA212000", .model = "IBM-DARA-212000", .zones = 12, .avg_spt = 292, .heads = 4, .rpm = 4200, .full_stroke_ms = 31, .track_seek_ms = 4, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, // Either Hitachi or IBM OEM + { .name = "[ATA-5] Maxtor DiamondMax VL 17", .internal_name = "90871U2", .model = "Maxtor 90871U2", .zones = 16, .avg_spt = 290, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 0.9, .rcache_num_seg = 16, .rcache_seg_size = 256, .max_multiple = 32 }, + { .name = "[ATA-5] Maxtor DiamondMax VL 20 (91021U2)", .internal_name = "91021U2", .model = "Maxtor 91021U2", .zones = 16, .avg_spt = 295, .heads = 2, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Maxtor DiamondMax VL 20 (91531U3)", .internal_name = "91531U3", .model = "Maxtor 91531U3", .zones = 16, .avg_spt = 295, .heads = 3, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Maxtor DiamondMax VL 20 (92041U4)", .internal_name = "92041U4", .model = "Maxtor 92041U4", .zones = 16, .avg_spt = 295, .heads = 4, .rpm = 5400, .full_stroke_ms = 20, .track_seek_ms = 1, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Quantum Fireball EX3.2A", .internal_name = "EX32A012", .model = "QUANTUM FIREBALL EX3.2A", .zones = 1, .avg_spt = 210, .heads = 2, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball EX5.1A", .internal_name = "EX51A012", .model = "QUANTUM FIREBALL EX5.1A", .zones = 2, .avg_spt = 210, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball EX6.4A", .internal_name = "EX64A012", .model = "QUANTUM FIREBALL EX6.4A", .zones = 2, .avg_spt = 210, .heads = 4, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball EX10.2A", .internal_name = "EX10A011", .model = "QUANTUM FIREBALL EX10.2A", .zones = 3, .avg_spt = 210, .heads = 6, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball EX12.7A", .internal_name = "EX12A011", .model = "QUANTUM FIREBALL EX12.7A", .zones = 4, .avg_spt = 210, .heads = 8, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball CR4.3A", .internal_name = "CR43A013", .model = "QUANTUM FIREBALL CR4.3A", .zones = 2, .avg_spt = 310, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball CR6.4A", .internal_name = "CR64A011", .model = "QUANTUM FIREBALL CR6.4A", .zones = 2, .avg_spt = 310, .heads = 4, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball CR8.4A", .internal_name = "CR84A011", .model = "QUANTUM FIREBALL CR8.4A", .zones = 3, .avg_spt = 310, .heads = 6, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Quantum Fireball CR13.0A", .internal_name = "CR13A011", .model = "QUANTUM FIREBALL CR13.0A", .zones = 4, .avg_spt = 310, .heads = 8, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 2, .rcache_num_seg = 8, .rcache_seg_size = 512, .max_multiple = 16 }, + { .name = "[ATA-5] Samsung SpinPoint V6800 (SV0682D)", .internal_name = "SV0682D", .model = "SAMSUNG SV0682D", .zones = 8, .avg_spt = 295, .heads = 2, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Samsung SpinPoint V6800 (SV1023D)", .internal_name = "SV1023D", .model = "SAMSUNG SV1023D", .zones = 8, .avg_spt = 295, .heads = 3, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Samsung SpinPoint V6800 (SV1364D)", .internal_name = "SV1364D", .model = "SAMSUNG SV1364D", .zones = 8, .avg_spt = 295, .heads = 4, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Samsung SpinPoint V6800 (SV1705D)", .internal_name = "SV1705D", .model = "SAMSUNG SV1705D", .zones = 8, .avg_spt = 295, .heads = 5, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Samsung SpinPoint V6800 (SV2046D)", .internal_name = "SV2046D", .model = "SAMSUNG SV2046D", .zones = 8, .avg_spt = 295, .heads = 6, .rpm = 5400, .full_stroke_ms = 18, .track_seek_ms = 1.3, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Seagate U8 - 4.3gb", .internal_name = "ST34313A", .model = "ST34313A", .zones = 16, .avg_spt = 289, .heads = 1, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Seagate U8 - 8.4gb", .internal_name = "ST38410A", .model = "ST38410A", .zones = 16, .avg_spt = 289, .heads = 2, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Seagate U8 - 13gb", .internal_name = "ST313021A", .model = "ST313021A", .zones = 16, .avg_spt = 289, .heads = 4, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Seagate U8 - 17.2gb", .internal_name = "ST317221A", .model = "ST317221A", .zones = 16, .avg_spt = 289, .heads = 3, .rpm = 5400, .full_stroke_ms = 25, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Western Digital Caviar 102AA", .internal_name = "WD102AA", .model = "WDC WD102AA-00ANA0", .zones = 16, .avg_spt = 295, .heads = 8, .rpm = 5400, .full_stroke_ms = 12, .track_seek_ms = 1.5, .rcache_num_seg = 16, .rcache_seg_size = 512, .max_multiple = 32 }, + { .name = "[ATA-5] Western Digital Expert", .internal_name = "WD135BA", .model = "WDC WD135BA-60AK", .zones = 16, .avg_spt = 350, .heads = 6, .rpm = 7200, .full_stroke_ms = 15, .track_seek_ms = 2, .rcache_num_seg = 16, .rcache_seg_size = 1920, .max_multiple = 32 }, // clang-format on }; From d7d2dffe7bb398a04c01c485da943f3fbd106c6d Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 03:27:16 +0500 Subject: [PATCH 284/320] Manager: Reset the details area to initial state manually instead of re-creating the widget when no machines are present --- src/qt/qt_vmmanager_details.cpp | 68 ++++++++++++++++++++++++++++++--- src/qt/qt_vmmanager_details.hpp | 2 + src/qt/qt_vmmanager_main.cpp | 7 +--- 3 files changed, 66 insertions(+), 11 deletions(-) diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index 396997e7d38..c6d5631e113 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -122,6 +122,13 @@ VMManagerDetails::VMManagerDetails(QWidget *parent) } ui->ssNavTBHolder->setStyleSheet(toolButtonStyleSheet); + // Margins are a little different on macos +#ifdef Q_OS_MACOS + ui->systemLabel->setMargin(15); +#else + ui->systemLabel->setMargin(10); +#endif + pauseIcon = QIcon(":/menuicons/qt/icons/pause.ico"); runIcon = QIcon(":/menuicons/qt/icons/run.ico"); @@ -178,6 +185,61 @@ VMManagerDetails::~VMManagerDetails() delete ui; } +void +VMManagerDetails::reset() +{ + systemSection->clear(); + videoSection->clear(); + storageSection->clear(); + audioSection->clear(); + networkSection->clear(); + inputSection->clear(); + portsSection->clear(); + otherSection->clear(); + systemSection->setSections(); + videoSection->setSections(); + storageSection->setSections(); + audioSection->setSections(); + networkSection->setSections(); + inputSection->setSections(); + portsSection->setSections(); + otherSection->setSections(); + + ui->screenshotNext->setEnabled(false); + ui->screenshotPrevious->setEnabled(false); + ui->screenshotNextTB->setEnabled(false); + ui->screenshotPreviousTB->setEnabled(false); + ui->screenshot->setPixmap(QString()); + ui->screenshot->setFixedSize(240, 160); + ui->screenshot->setFrameStyle(QFrame::Box | QFrame::Sunken); + ui->screenshot->setText(tr("No screenshot")); + ui->screenshot->setEnabled(false); + ui->screenshot->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); +#ifdef Q_OS_WINDOWS + if (!util::isWindowsLightTheme()) { + ui->screenshot->setStyleSheet(SCREENSHOTBORDER_STYLESHEET_DARK); + } else { + ui->screenshot->setStyleSheet(""); + } +#endif + + startPauseButton->setEnabled(false); + resetButton->setEnabled(false); + stopButton->setEnabled(false); + configureButton->setEnabled(false); + cadButton->setEnabled(false); + + ui->systemLabel->setText(tr("No Machines Found!")); + ui->systemLabel->setStyleSheet(""); + ui->statusLabel->setText(""); + ui->scrollArea->setStyleSheet(""); + + ui->notesTextEdit->setPlainText(""); + ui->notesTextEdit->setEnabled(false); + + sysconfig = new VMManagerSystem(); +} + void VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig) { @@ -191,12 +253,6 @@ VMManagerDetails::updateData(VMManagerSystem *passed_sysconfig) ui->scrollArea->setStyleSheet(SCROLLAREA_STYLESHEET_LIGHT); ui->systemLabel->setStyleSheet(SYSTEMLABEL_STYLESHEET_LIGHT); } - // Margins are a little different on macos -#ifdef Q_OS_MACOS - ui->systemLabel->setMargin(15); -#else - ui->systemLabel->setMargin(10); -#endif // disconnect old signals before assigning the passed systemconfig object disconnect(startPauseButton, &QToolButton::clicked, sysconfig, &VMManagerSystem::startButtonPressed); diff --git a/src/qt/qt_vmmanager_details.hpp b/src/qt/qt_vmmanager_details.hpp index efd2ec6cdac..489f74a2596 100644 --- a/src/qt/qt_vmmanager_details.hpp +++ b/src/qt/qt_vmmanager_details.hpp @@ -35,6 +35,8 @@ class VMManagerDetails : public QWidget { ~VMManagerDetails() override; + void reset(); + void updateData(VMManagerSystem *passed_sysconfig); void updateProcessStatus(); diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 25e6e3775a4..7337aa20fb1 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -734,12 +734,9 @@ VMManagerMain::deleteSystem(VMManagerSystem *sysconfig) delete sysconfig; if (vm_model->rowCount(QModelIndex()) <= 0) { - selected_sysconfig = new VMManagerSystem(); /* no machines left - get rid of the last machine's leftovers */ - ui->detailsArea->layout()->removeWidget(vm_details); - delete vm_details; - vm_details = new VMManagerDetails(); - ui->detailsArea->layout()->addWidget(vm_details); + selected_sysconfig = new VMManagerSystem(); + vm_details->reset(); /* tell the mainwindow to disable the toolbar buttons */ emit selectionOrStateChanged(nullptr); } From 304d84326796730a8dac1f56e1f2962e4747ce63 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 8 Jan 2026 14:36:24 +0500 Subject: [PATCH 285/320] Manager: Don't allow changing the system directory when machines are running --- src/qt/qt_vmmanager_mainwindow.cpp | 3 ++- src/qt/qt_vmmanager_preferences.cpp | 8 +++++++- src/qt/qt_vmmanager_preferences.hpp | 2 +- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 3418519e545..2155799f5b0 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -202,7 +202,8 @@ VMManagerMainWindow::vmmStateChanged(const VMManagerSystem *sysconfig) const void VMManagerMainWindow::preferencesTriggered() { - const auto prefs = new VMManagerPreferences(); + bool machinesRunning = (vmm->getActiveMachineCount() > 0); + const auto prefs = new VMManagerPreferences(this, machinesRunning); if (prefs->exec() == QDialog::Accepted) { emit preferencesUpdated(); updateLanguage(); diff --git a/src/qt/qt_vmmanager_preferences.cpp b/src/qt/qt_vmmanager_preferences.cpp index 2de133254c0..77d5d1657bc 100644 --- a/src/qt/qt_vmmanager_preferences.cpp +++ b/src/qt/qt_vmmanager_preferences.cpp @@ -33,7 +33,7 @@ extern "C" { } VMManagerPreferences:: - VMManagerPreferences(QWidget *parent) + VMManagerPreferences(QWidget *parent, bool machinesRunning) : ui(new Ui::VMManagerPreferences) { ui->setupUi(this); @@ -50,6 +50,12 @@ VMManagerPreferences:: ui->systemDirectory->setText(QDir::toNativeSeparators(QDir(vmm_path).path())); } + if (machinesRunning) { + ui->systemDirectory->setEnabled(false); + ui->dirSelectButton->setEnabled(false); + ui->dirSelectButton->setToolTip(tr("To change the system directory, stop all running machines.")); + } + ui->comboBoxLanguage->setItemData(0, 0); for (int i = 1; i < ProgSettings::languages.length(); i++) { ui->comboBoxLanguage->addItem(ProgSettings::languages[i].second, i); diff --git a/src/qt/qt_vmmanager_preferences.hpp b/src/qt/qt_vmmanager_preferences.hpp index 4215eb76892..1ddeedb51fa 100644 --- a/src/qt/qt_vmmanager_preferences.hpp +++ b/src/qt/qt_vmmanager_preferences.hpp @@ -26,7 +26,7 @@ QT_END_NAMESPACE class VMManagerPreferences final : public QDialog { Q_OBJECT public: - explicit VMManagerPreferences(QWidget *parent = nullptr); + explicit VMManagerPreferences(QWidget *parent = nullptr, bool machinesRunning = false); ~VMManagerPreferences() override; private: From 535a87a0e144ece234d34f38969e83042f4a9d78 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 03:30:07 +0500 Subject: [PATCH 286/320] Manager: Reload VMs if the system directory has been changed --- src/qt/languages/86box.pot | 3 ++ src/qt/languages/ca-ES.po | 3 ++ src/qt/languages/cs-CZ.po | 3 ++ src/qt/languages/de-DE.po | 3 ++ src/qt/languages/el-GR.po | 3 ++ src/qt/languages/es-ES.po | 3 ++ src/qt/languages/fi-FI.po | 3 ++ src/qt/languages/fr-FR.po | 3 ++ src/qt/languages/hr-HR.po | 3 ++ src/qt/languages/it-IT.po | 3 ++ src/qt/languages/ja-JP.po | 3 ++ src/qt/languages/ko-KR.po | 3 ++ src/qt/languages/nb-NO.po | 3 ++ src/qt/languages/nl-NL.po | 3 ++ src/qt/languages/pl-PL.po | 3 ++ src/qt/languages/pt-BR.po | 3 ++ src/qt/languages/pt-PT.po | 3 ++ src/qt/languages/ru-RU.po | 3 ++ src/qt/languages/sk-SK.po | 3 ++ src/qt/languages/sl-SI.po | 3 ++ src/qt/languages/sv-SE.po | 3 ++ src/qt/languages/tr-TR.po | 3 ++ src/qt/languages/uk-UA.po | 3 ++ src/qt/languages/vi-VN.po | 3 ++ src/qt/languages/zh-CN.po | 3 ++ src/qt/languages/zh-TW.po | 3 ++ src/qt/qt_vmmanager_main.cpp | 50 ++++++++++++++++++++++++++++++ src/qt/qt_vmmanager_main.hpp | 1 + src/qt/qt_vmmanager_mainwindow.cpp | 8 +++++ 29 files changed, 137 insertions(+) diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index e1cec700543..f751df83186 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index ddec0bc60ee..153c94d9d33 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index fc78c76bdf1..f5bc66ff27c 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 4ed3a4fbf3b..03d4f65ded2 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index b49a1411ad8..91c6d91065b 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -3080,3 +3080,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index efa17fa4b3e..6db0fdd01d2 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 1a4b65df4d6..72a92c8bc1c 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 38f4672cb19..43fe30b558c 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index c3d793f136e..44774dc96b3 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -3025,3 +3025,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index a3c182f8e73..5ba79be02ba 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index cec605d9013..5e3b3225f71 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -3024,3 +3024,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 690bc84917f..ecb7268073f 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index d35c292c616..6231a2d1572 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index c1ac985e52a..014c12c8207 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index ec0cc9f8750..d4a3ff58063 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -3024,3 +3024,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 8a432d6ca6d..f7db7363dbb 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 0cc722e8453..0ebf59ba7d9 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -3024,3 +3024,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index e1d8816c861..b3db8f3dcb3 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -3036,3 +3036,6 @@ msgstr "П&еремотка вперёд" msgid "Fast forward" msgstr "Перемотка вперёд" + +msgid "To change the system directory, stop all running machines." +msgstr "Чтобы изменить системную папку, остановите все запущенные машины." diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index b6172ee9ce9..672d8b68ac9 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 431685decda..0ad1d4e875f 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -3025,3 +3025,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 6005a49c68e..9b6c07e9bf4 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index ede62240bab..07f79d33579 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -3023,3 +3023,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 9644aa5fe23..bf147cc4e6a 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -3025,3 +3025,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 9c4f56d46e1..7f0e2b1dc58 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -3017,3 +3017,6 @@ msgstr "" msgid "Fast forward" msgstr "" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index ea491586c35..b4e9a751234 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -3017,3 +3017,6 @@ msgstr "快进(&F)" msgid "Fast forward" msgstr "快进" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index a27bc13c2c5..628ec8929b2 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -3024,3 +3024,6 @@ msgstr "快轉(&F)" msgid "Fast forward" msgstr "快轉" + +msgid "To change the system directory, stop all running machines." +msgstr "" diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 7337aa20fb1..e844b7da159 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -451,6 +451,56 @@ VMManagerMain::~VMManagerMain() delete vm_model; } +void +VMManagerMain::reload() +{ + // Disconnect and save the old selection mdoel to be deleted later + QItemSelectionModel *old_selection_model = ui->listView->selectionModel(); + disconnect(old_selection_model, &QItemSelectionModel::currentChanged, this, &VMManagerMain::currentSelectionChanged); + // Disconnect and delete the model and proxy model + disconnect(vm_model, &VMManagerModel::systemDataChanged, this, &VMManagerMain::modelDataChange); + disconnect(vm_model, &VMManagerModel::globalConfigurationChanged, this, nullptr); + delete proxy_model; + delete vm_model; + + // Reset the details view and toolbar to initial state + selected_sysconfig = new VMManagerSystem(); + vm_details->reset(); + emit selectionOrStateChanged(nullptr); + + // Create the new model and proxy model + vm_model = new VMManagerModel; + proxy_model = new StringListProxyModel(this); + proxy_model->setSourceModel(vm_model); + ui->listView->setModel(proxy_model); + // Delete the old selection model + delete old_selection_model; + + // Set up the new models + proxy_model->setSortCaseSensitivity(Qt::CaseInsensitive); + ui->listView->model()->sort(0, Qt::AscendingOrder); + connect(vm_model, &VMManagerModel::systemDataChanged, this, &VMManagerMain::modelDataChange); + connect(vm_model, &VMManagerModel::globalConfigurationChanged, this, []() { + vmm_main_window->updateSettings(); + }); + const QItemSelectionModel *selection_model = ui->listView->selectionModel(); + connect(selection_model, &QItemSelectionModel::currentChanged, this, &VMManagerMain::currentSelectionChanged); + + // Update the search completer + auto *completerModel = new QStringListModel(getSearchCompletionList(), ui->searchBar->completer()); + ui->searchBar->completer()->setModel(completerModel); + + // If machines are found, set the selection to the first one + if (proxy_model->rowCount(QModelIndex()) > 0) { + const QModelIndex first_index = proxy_model->index(0, 0); + ui->listView->setCurrentIndex(first_index); + emit selectionOrStateChanged(selected_sysconfig); + } + + // Notify the status bar + emit updateStatusRight(machineCountString()); +} + void VMManagerMain::updateGlobalSettings() { diff --git a/src/qt/qt_vmmanager_main.hpp b/src/qt/qt_vmmanager_main.hpp index c8e8822ad00..f313fbb042c 100644 --- a/src/qt/qt_vmmanager_main.hpp +++ b/src/qt/qt_vmmanager_main.hpp @@ -61,6 +61,7 @@ class VMManagerMain final : public QWidget { void updateStatusRight(const QString &text); public slots: + void reload(); void startButtonPressed() const; void settingsButtonPressed(); void restartButtonPressed() const; diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 2155799f5b0..378c8cbcc61 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -203,10 +203,18 @@ void VMManagerMainWindow::preferencesTriggered() { bool machinesRunning = (vmm->getActiveMachineCount() > 0); + auto old_vmm_path = QString(vmm_path_cfg); const auto prefs = new VMManagerPreferences(this, machinesRunning); if (prefs->exec() == QDialog::Accepted) { emit preferencesUpdated(); updateLanguage(); + + auto new_vmm_path = QString(vmm_path_cfg); + if (!machinesRunning && (new_vmm_path != old_vmm_path)) { + qDebug() << "Machine path changed: old path " << old_vmm_path << ", new path " << new_vmm_path; + strncpy(vmm_path, vmm_path_cfg, sizeof(vmm_path)); + vmm->reload(); + } } } From b1264fa03f91e11ef2f019e469785490dfa558d7 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 07:34:41 +0500 Subject: [PATCH 287/320] Manager: Fix total machine count not increasing when adding or cloning a machine --- src/qt/qt_vmmanager_main.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index e844b7da159..38f9e273848 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -288,6 +288,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) // Get the index of the newly-created system and select it const QModelIndex mapped_index = proxy_model->mapFromSource(created_object); ui->listView->setCurrentIndex(mapped_index); + modelDataChange(); } else { QDir(dstPath).removeRecursively(); QMessageBox::critical(this, tr("Clone"), tr("Failed to clone VM."), QMessageBox::Ok); @@ -764,6 +765,7 @@ VMManagerMain::addNewSystem(const QString &name, const QString &dir, const QStri const QModelIndex mapped_index = proxy_model->mapFromSource(created_object); ui->listView->setCurrentIndex(mapped_index); delete new_system; + modelDataChange(); }); } From 5619dcd81a9d7743f880a16d61968eb5f02aa6ce Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 17:48:16 +0500 Subject: [PATCH 288/320] Change %1 to %n in a string --- src/qt/languages/86box.pot | 2 +- src/qt/languages/ca-ES.po | 4 ++-- src/qt/languages/cs-CZ.po | 4 ++-- src/qt/languages/de-DE.po | 4 ++-- src/qt/languages/el-GR.po | 4 ++-- src/qt/languages/es-ES.po | 4 ++-- src/qt/languages/fi-FI.po | 4 ++-- src/qt/languages/fr-FR.po | 4 ++-- src/qt/languages/hr-HR.po | 4 ++-- src/qt/languages/it-IT.po | 4 ++-- src/qt/languages/ja-JP.po | 4 ++-- src/qt/languages/ko-KR.po | 4 ++-- src/qt/languages/nb-NO.po | 4 ++-- src/qt/languages/nl-NL.po | 4 ++-- src/qt/languages/pl-PL.po | 4 ++-- src/qt/languages/pt-BR.po | 4 ++-- src/qt/languages/pt-PT.po | 4 ++-- src/qt/languages/ru-RU.po | 4 ++-- src/qt/languages/sk-SK.po | 4 ++-- src/qt/languages/sl-SI.po | 4 ++-- src/qt/languages/sv-SE.po | 4 ++-- src/qt/languages/tr-TR.po | 4 ++-- src/qt/languages/uk-UA.po | 4 ++-- src/qt/languages/vi-VN.po | 4 ++-- src/qt/languages/zh-CN.po | 4 ++-- src/qt/qt_vmmanager_mainwindow.cpp | 2 +- 26 files changed, 50 insertions(+), 50 deletions(-) diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index cbf086210b4..29a6c91ec3a 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -1137,7 +1137,7 @@ msgstr "" msgid "Use regular expressions in search box" msgstr "" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" msgstr "" msgid "Add new system wizard" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index d7e279110af..7d807b86656 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -1143,8 +1143,8 @@ msgstr "No fou possible obrir el fitxer de configuració seleccionat per llegir: msgid "Use regular expressions in search box" msgstr "Utilitzeu expressions regulars a la caixa de cerca" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 màquina(es) són actives en aquest moment. Segur que voleu sortir de l'administrador de MV?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n màquina(es) són actives en aquest moment. Segur que voleu sortir de l'administrador de MV?" msgid "Add new system wizard" msgstr "Auxiliar d'addició de un nou sistema" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index e82f95f2681..6853a71a7c0 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -1143,8 +1143,8 @@ msgstr "Nebylo možné otevřít vybraný konfigurační soubor pro čtení: %1" msgid "Use regular expressions in search box" msgstr "Použít ve vyhledávacím poli regulární výrazy" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 počítač(ů) je stále aktivních. Opravdu chcete ukončit správce virtuálních počítačů?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n počítač(ů) je stále aktivních. Opravdu chcete ukončit správce virtuálních počítačů?" msgid "Add new system wizard" msgstr "Průvodce přidáním nového systému" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index ad7e66b08d2..932059c4327 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -1143,8 +1143,8 @@ msgstr "Die ausgewählte Konfigurationsdatei konnte nicht eingelesen werden: %1" msgid "Use regular expressions in search box" msgstr "Benutze reguläre Ausdrücke in der Suche" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 Maschinen sind aktuell aktiv. Bist du sicher, dass du den VM Manager trotzdem schließen möchtest?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n Maschinen sind aktuell aktiv. Bist du sicher, dass du den VM Manager trotzdem schließen möchtest?" msgid "Add new system wizard" msgstr "Assistent für ein neues System" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 10197ff38de..7c920b0d98d 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1154,8 +1154,8 @@ msgstr "Αδυναμία ανοίγματος επιλεγμένου αρχεί msgid "Use regular expressions in search box" msgstr "Χρήση συχνών εκφράσεων στην αναζήτηση" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 μηχανής(ών) είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n μηχανής(ών) είναι εν ενεργεία. Είστε σίγουγος για την έξοδο απο το VM manager;" msgid "Add new system wizard" msgstr "Οδηγός προσθήκης νέο συστήματος" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index f64574e713a..658d750f092 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -1143,8 +1143,8 @@ msgstr "No fúe posible abrir el archivo de configuración seleccionado para lee msgid "Use regular expressions in search box" msgstr "Utilizar expresiones regulares en la caja de búsqueda" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 máquina(s) son activas en este momento. ¿Está seguro de que quiere salir del administrador de MV?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n máquina(s) son activas en este momento. ¿Está seguro de que quiere salir del administrador de MV?" msgid "Add new system wizard" msgstr "Asistente para la adición de un nuevo sistema" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 987e73529fd..b82884fcddf 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -1143,8 +1143,8 @@ msgstr "Valittua määritystä ei voitu avata: %1" msgid "Use regular expressions in search box" msgstr "Käytä säännöllisiä lausekkeita (regex) hakukentässä" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 konetta on tällä hetkellä aktiivisena. Haluatko silti sulkea virtuaalikoneiden hallinnan?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n konetta on tällä hetkellä aktiivisena. Haluatko silti sulkea virtuaalikoneiden hallinnan?" msgid "Add new system wizard" msgstr "Koneenlisäysohjelma" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 976d9afb094..409d2604160 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -1143,8 +1143,8 @@ msgstr "Impossible d'ouvrir le fichier de configuration sélectionné pour lectu msgid "Use regular expressions in search box" msgstr "Utilisez des expressions régulières dans le champ de recherche" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 machine(s) sont actuellement actives. Êtes-vous sûr de vouloir quitter le gestionnaire de machines virtuelles malgré tout ?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n machine(s) sont actuellement actives. Êtes-vous sûr de vouloir quitter le gestionnaire de machines virtuelles malgré tout ?" msgid "Add new system wizard" msgstr "Assistant pour ajouter un nouveau système" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 15c2b39cb69..aa3f45f1591 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -1145,8 +1145,8 @@ msgstr "Nije moguće otvoriti odabranu konfiguracijsku datoteku za čitanje: %1" msgid "Use regular expressions in search box" msgstr "U polju za pretraživanje koristite regularne izraze" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "Broj trenutno aktivnih računala je %1. Jeste li sigurni da ipak želite izaći iz upravitelja virtualnih sistema?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "Broj trenutno aktivnih računala je %n. Jeste li sigurni da ipak želite izaći iz upravitelja virtualnih sistema?" msgid "Add new system wizard" msgstr "Čarobnjak za dodavanje novog sistema" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index 0a675ac1add..fe257ad572d 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -1143,8 +1143,8 @@ msgstr "Impossibile aprire il file di configurazione selezionato per la lettura: msgid "Use regular expressions in search box" msgstr "Utilizza espressioni regolari nella casella di ricerca" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "Sono attualmente attive %1 macchina/e. Vuoi comunque uscire dal gestore delle macchine virtuali?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "Sono attualmente attive %n macchina/e. Vuoi comunque uscire dal gestore delle macchine virtuali?" msgid "Add new system wizard" msgstr "Procedura guidata nuovo sistema" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 8371ac36e8f..a5fb3c7a643 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -1144,8 +1144,8 @@ msgstr "選択した設定ファイルを読み込むことができませんで msgid "Use regular expressions in search box" msgstr "検索ボックスで正規表現を使用する" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "現在、%1台の仮想マシンがアクティブです。それでもVMマネージャーを終了しますか?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "現在、%n台の仮想マシンがアクティブです。それでもVMマネージャーを終了しますか?" msgid "Add new system wizard" msgstr "新しいシステムを追加するためのウィザード" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 12f67f14f4f..5d96a9bf070 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -1137,8 +1137,8 @@ msgstr "선택한 구성 파일을 읽기 위해 열 수 없습니다: %1" msgid "Use regular expressions in search box" msgstr "검색 상자에 정규 표현식 사용" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "현재 %1대의 머신이 활성화되어 있습니다. 가상 머신 관리자를 종료하시겠습니까?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "현재 %n대의 머신이 활성화되어 있습니다. 가상 머신 관리자를 종료하시겠습니까?" msgid "Add new system wizard" msgstr "새로운 시스템을 추가하는 마법사" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index c6c27836bf9..1662926b7ac 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -1137,8 +1137,8 @@ msgstr "Kan ikke åpne valgt konfigurasjonsfil for lesing: %1" msgid "Use regular expressions in search box" msgstr "Bruk regulære uttrykk i søkeboksen" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 maskin(er) er for øyeblikket aktive. Er du sikker på at du vil avslutte VM-administratoren uansett?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n maskin(er) er for øyeblikket aktive. Er du sikker på at du vil avslutte VM-administratoren uansett?" msgid "Add new system wizard" msgstr "Legg til ny system-veiviser" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 3b10383f726..9449f9a51ec 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -1137,8 +1137,8 @@ msgstr "Openen van geselecteerd configuratiebestand voor lezen niet mogelijk: %1 msgid "Use regular expressions in search box" msgstr "Gebruik reguliere expressies in zoekveld" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 machine(s) zijn nu actief. Weet je zeker dat je de VM manager wil afsluiten?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n machine(s) zijn nu actief. Weet je zeker dat je de VM manager wil afsluiten?" msgid "Add new system wizard" msgstr "Wizard toevoegen van nieuw systeem" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 2b9610084d7..5cc13543164 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -1144,8 +1144,8 @@ msgstr "Nie udało się otworzyć wybranego pliku konfiguracyjnego do odczytu: % msgid "Use regular expressions in search box" msgstr "Użyj wyrażeń regularnych w polu wyszukiwania" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "Liczba obecnie aktywnych maszyn: %1. Czy na pewno chcesz, mimo to, wyjść z menedżera maszyn wirtualnych?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "Liczba obecnie aktywnych maszyn: %n. Czy na pewno chcesz, mimo to, wyjść z menedżera maszyn wirtualnych?" msgid "Add new system wizard" msgstr "Kreator dodawania nowego systemu" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index b82c1a7c98a..91484567620 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -1137,8 +1137,8 @@ msgstr "Não foi possível abrir o arquivo de configuração selecionado para le msgid "Use regular expressions in search box" msgstr "Usar expressões regulares na caixa de pesquisa" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 máquina(s) está(ão) ativa(s) no momento. Tem certeza de que deseja sair do gerenciador de MVs mesmo assim?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n máquina(s) está(ão) ativa(s) no momento. Tem certeza de que deseja sair do gerenciador de MVs mesmo assim?" msgid "Add new system wizard" msgstr "Assistente para novo sistema" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index b68b91a8b5e..291280e2f50 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -1144,8 +1144,8 @@ msgstr "Não foi possível abrir o ficheir de configurção seleccionado para le msgid "Use regular expressions in search box" msgstr "Usa expressões regulares na caixa de procura" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 máquina(s) estão actualmente activas. Quer mesmo sair do gerenciador de MVs?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n máquina(s) estão actualmente activas. Quer mesmo sair do gerenciador de MVs?" msgid "Add new system wizard" msgstr "Assistende de adicionamento do novo sistema" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 112c53360cf..02537d7e40d 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -1156,8 +1156,8 @@ msgstr "Невозможно открыть выбранный файл конф msgid "Use regular expressions in search box" msgstr "Использовать регулярные выражения в поле поиска" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 машина(ы) в настоящее время активна(ы). Вы уверены, что всё равно хотите выйти из менеджера виртуальной машины?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n машина(ы) в настоящее время активна(ы). Вы уверены, что всё равно хотите выйти из менеджера виртуальной машины?" msgid "Add new system wizard" msgstr "Мастер добавления новой системы" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 3586f6c127b..8e00dee9a63 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -1143,8 +1143,8 @@ msgstr "Nie je možné otvoriť vybraný konfiguračný súbor na čítanie: %1" msgid "Use regular expressions in search box" msgstr "Použiť v poli vyhľadávania regulárne výrazy" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 počítač(ov) je stále aktívnych. Naozaj chcete ukončiť správcu virtuálnych počítačov?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n počítač(ov) je stále aktívnych. Naozaj chcete ukončiť správcu virtuálnych počítačov?" msgid "Add new system wizard" msgstr "Sprievodca pridávaním nového systému" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index a7cf7dc29bb..43bb21a2047 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -1145,8 +1145,8 @@ msgstr "Ni bilo mogože odpreti izbrane datoteke z nastavitvami za branje: %1" msgid "Use regular expressions in search box" msgstr "V iskalnem polju uporabi regularne ekspresije" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "Št. trenutno dejavnih naprav je %1. Ali vseeno želite izstopiti iz upravitelja navideznih naprav?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "Št. trenutno dejavnih naprav je %n. Ali vseeno želite izstopiti iz upravitelja navideznih naprav?" msgid "Add new system wizard" msgstr "Čarovnik za dodajanje novega sistema" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 3cac62eaf79..7547ad5b0c1 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -1137,8 +1137,8 @@ msgstr "Kunde inte läsa den valda konfigurationsfilen: %1" msgid "Use regular expressions in search box" msgstr "Använd vanliga uttryck i sökfältet" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 maskin(er) är aktiva. Är du säker på att du vill avsluta VM-hanteraren ändå?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n maskin(er) är aktiva. Är du säker på att du vill avsluta VM-hanteraren ändå?" msgid "Add new system wizard" msgstr "Guiden Lägg till nytt system" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 22ccc4910ef..1b3d26aa75f 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -1143,8 +1143,8 @@ msgstr "Seçili yapılandırma dosyası okunmak için açılamıyor: %1" msgid "Use regular expressions in search box" msgstr "Arama kutusunda düzenli ifadeler kullan" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 makine şu anda aktif. Yine de VM yöneticisinden çıkmak istediğinize emin misiniz?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n makine şu anda aktif. Yine de VM yöneticisinden çıkmak istediğinize emin misiniz?" msgid "Add new system wizard" msgstr "Yeni sistem ekleme sihirbazı" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 0fb2c803377..178d7ead142 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -1145,8 +1145,8 @@ msgstr "Неможливо відкрити вибраний файл конфі msgid "Use regular expressions in search box" msgstr "Використовувати регулярні вирази в полі пошуку" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 машина(и) наразі активна(і). Ви впевнені, що все одно хочете вийти з менеджера віртуальної машини?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n машина(и) наразі активна(і). Ви впевнені, що все одно хочете вийти з менеджера віртуальної машини?" msgid "Add new system wizard" msgstr "Майстер додавання нової системи" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 35782e86d4c..533f40deccb 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -1137,8 +1137,8 @@ msgstr "Không thể mở cấu hình đã chọn để đọc: %1" msgid "Use regular expressions in search box" msgstr "Dùng regex trong hộp tìm kiếm" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 máy hiện vẫn đang chạy. Bạn có muốn thoát trình quản lý máy ảo không?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n máy hiện vẫn đang chạy. Bạn có muốn thoát trình quản lý máy ảo không?" msgid "Add new system wizard" msgstr "Thêm trình thuật sĩ hệ thống mới" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index a74ddbbbafc..b48820aa460 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -1137,8 +1137,8 @@ msgstr "无法打开选定的配置文件进行读取:%1" msgid "Use regular expressions in search box" msgstr "在搜索框中使用正则表达式" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 个计算机当前处于活动状态。您确定要退出虚拟机管理器吗?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n 个计算机当前处于活动状态。您确定要退出虚拟机管理器吗?" msgid "Add new system wizard" msgstr "添加新系统向导" diff --git a/src/qt/qt_vmmanager_mainwindow.cpp b/src/qt/qt_vmmanager_mainwindow.cpp index 3418519e545..846c3484bd6 100644 --- a/src/qt/qt_vmmanager_mainwindow.cpp +++ b/src/qt/qt_vmmanager_mainwindow.cpp @@ -271,7 +271,7 @@ VMManagerMainWindow::closeEvent(QCloseEvent *event) { int running = vmm->getActiveMachineCount(); if (running > 0) { - QMessageBox warningbox(QMessageBox::Icon::Warning, tr("%1 VM Manager").arg(EMU_NAME), tr("%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?").arg(running), QMessageBox::Yes | QMessageBox::No, this); + QMessageBox warningbox(QMessageBox::Icon::Warning, tr("%1 VM Manager").arg(EMU_NAME), tr("%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?", "", running), QMessageBox::Yes | QMessageBox::No, this); warningbox.exec(); if (warningbox.result() == QMessageBox::No) { event->ignore(); From 9814e4b3889debca237be92d1f63d4c2fb397648 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 18:04:31 +0500 Subject: [PATCH 289/320] Update the British English "translation" --- src/qt/languages/en-GB.po | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/qt/languages/en-GB.po b/src/qt/languages/en-GB.po index ba9f30421f5..fdc71fcb102 100644 --- a/src/qt/languages/en-GB.po +++ b/src/qt/languages/en-GB.po @@ -12,6 +12,9 @@ msgstr "RGB &Colour" msgid "&RGB Grayscale" msgstr "&RGB Greyscale" +msgid "Generic RGBI color monitor" +msgstr "Generic RGBI colour monitor" + msgid "Time synchronization" msgstr "Time synchronisation" @@ -21,15 +24,15 @@ msgstr "Unable to initialise Ghostscript" msgid "Unable to initialize GhostPCL" msgstr "Unable to initialise GhostPCL" +msgid "Failed to initialize network driver" +msgstr "Failed to initialise network driver" + msgid "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behavior will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." msgstr "Development of the WinBox manager stopped in 2022 due to a lack of maintainers. As we direct our efforts towards making 86Box even better, we have made the decision to no longer support WinBox as a manager.\n\nNo further updates will be provided through WinBox, and you may encounter incorrect behavior should you continue using it with newer versions of 86Box. Any bug reports related to WinBox behaviour will be closed as invalid.\n\nGo to 86box.net for a list of other managers you can use." msgid "Appl&y fullscreen stretch mode when maximized" msgstr "Appl&y fullscreen stretch mode when maximised" -msgid "Failed to initialize network driver" -msgstr "Failed to initialise network driver" - msgid "Render behavior" msgstr "Render behaviour" @@ -42,6 +45,12 @@ msgstr "Error initialising OpenGL" msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" msgstr "

When selecting media images (CD-ROM, floppy, etc.) the open dialogue will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" +msgid "Invert colors" +msgstr "Invert colours" + +msgid "True color" +msgstr "True colour" + msgid "Color (generic)" msgstr "Colour (generic)" @@ -75,5 +84,5 @@ msgstr "Colour" msgid "Failed to initialize Vulkan renderer." msgstr "Failed to initialise Vulkan renderer." -msgid "True color" -msgstr "True colour" +msgid "Color scheme" +msgstr "Colour scheme" From 0f719050e85f81e7b447ad3f8fdcf41b3a695706 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Tue, 13 Jan 2026 18:07:34 +0500 Subject: [PATCH 290/320] Remove an effectively unused string --- src/qt/languages/86box.pot | 3 --- src/qt/languages/ca-ES.po | 3 --- src/qt/languages/cs-CZ.po | 3 --- src/qt/languages/de-DE.po | 3 --- src/qt/languages/el-GR.po | 3 --- src/qt/languages/es-ES.po | 3 --- src/qt/languages/fi-FI.po | 3 --- src/qt/languages/fr-FR.po | 3 --- src/qt/languages/hr-HR.po | 3 --- src/qt/languages/it-IT.po | 3 --- src/qt/languages/ja-JP.po | 3 --- src/qt/languages/ko-KR.po | 3 --- src/qt/languages/nb-NO.po | 3 --- src/qt/languages/nl-NL.po | 3 --- src/qt/languages/pl-PL.po | 3 --- src/qt/languages/pt-BR.po | 3 --- src/qt/languages/pt-PT.po | 3 --- src/qt/languages/ru-RU.po | 3 --- src/qt/languages/sk-SK.po | 3 --- src/qt/languages/sl-SI.po | 3 --- src/qt/languages/sv-SE.po | 3 --- src/qt/languages/tr-TR.po | 3 --- src/qt/languages/uk-UA.po | 3 --- src/qt/languages/vi-VN.po | 3 --- src/qt/languages/zh-CN.po | 3 --- src/qt/languages/zh-TW.po | 3 --- src/qt/qt_vmmanager_main.cpp | 4 ++-- 27 files changed, 2 insertions(+), 80 deletions(-) diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index 29a6c91ec3a..b00cdddbe05 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -1221,9 +1221,6 @@ msgstr "" msgid "Change &display name…" msgstr "" -msgid "Context Menu" -msgstr "" - msgid "&Open folder…" msgstr "" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index 7d807b86656..35d8b750548 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -1227,9 +1227,6 @@ msgstr "Escriviu el nou nom mostrat (buit per restablir)" msgid "Change &display name…" msgstr "Canvia nom &mostrat…" -msgid "Context Menu" -msgstr "Menú de context" - msgid "&Open folder…" msgstr "&Obre carpeta…" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 6853a71a7c0..7064e6543a5 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -1227,9 +1227,6 @@ msgstr "Zadejte nové zobrazované jméno (prázdné pole pro vymazání)" msgid "Change &display name…" msgstr "Změnit &zobrazované jméno…" -msgid "Context Menu" -msgstr "Kontextová nabídka" - msgid "&Open folder…" msgstr "&Otevřít složku…" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 932059c4327..59f5acac65f 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -1227,9 +1227,6 @@ msgstr "Gebe den neuen Anzeigenamen ein (leer lassen zum Zurücksetzen)" msgid "Change &display name…" msgstr "&Anzeigename ändern…" -msgid "Context Menu" -msgstr "Kontextmenü" - msgid "&Open folder…" msgstr "&Ordner öffnen…" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 7c920b0d98d..69393c7517c 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -1238,9 +1238,6 @@ msgstr "Εισάγετε το νέο όνομα εμφάνισης (κενό γ msgid "Change &display name…" msgstr "Αλλαγή &ονόματος εμφάνισης…" -msgid "Context Menu" -msgstr "Μενού επιλογών" - msgid "&Open folder…" msgstr "&Άνοιγμα φακέλου…" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index 658d750f092..c7ff65f181e 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -1227,9 +1227,6 @@ msgstr "Escribir el nuevo nombre mostrado (vacío para restablecer)" msgid "Change &display name…" msgstr "Cambiar nombre &mostrado…" -msgid "Context Menu" -msgstr "Menú de contexto" - msgid "&Open folder…" msgstr "&Abrir carpeta…" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index b82884fcddf..71dee237e60 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -1227,9 +1227,6 @@ msgstr "Anna uusi näyttönimi tai poista se" msgid "Change &display name…" msgstr "Vaihda &näyttönimi…" -msgid "Context Menu" -msgstr "Kontekstivalikko" - msgid "&Open folder…" msgstr "&Avaa kansio…" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index 409d2604160..daef71ec87d 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -1227,9 +1227,6 @@ msgstr "Entrez le nouveau nom d'affichage (laissez vide pour réinitialiser)" msgid "Change &display name…" msgstr "Modifier le nom &d'affichage…" -msgid "Context Menu" -msgstr "Menu contextuel" - msgid "&Open folder…" msgstr "&Ouvrir le dossier…" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index aa3f45f1591..7c4f9d2be0d 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -1229,9 +1229,6 @@ msgstr "Unesite novo prikazno ime (prazno za ponovo postaviti)" msgid "Change &display name…" msgstr "Promijeni &prikazno ime…" -msgid "Context Menu" -msgstr "Kontekstni izbornik" - msgid "&Open folder…" msgstr "&Otvori mapu…" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index fe257ad572d..aa846ca15a2 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -1227,9 +1227,6 @@ msgstr "Inserisci il nuovo nome da visualizzare (vuoto per reimpostarlo)" msgid "Change &display name…" msgstr "Modifica &nome visualizzato…" -msgid "Context Menu" -msgstr "Menu contestuale" - msgid "&Open folder…" msgstr "&Apri cartella…" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index a5fb3c7a643..003c32d677e 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -1228,9 +1228,6 @@ msgstr "新しい表示名を入力してください(空白にするとリセ msgid "Change &display name…" msgstr "表示名を変更(&D)…" -msgid "Context Menu" -msgstr "コンテキストメニュー" - msgid "&Open folder…" msgstr "フォルダーを開く(&O)…" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 5d96a9bf070..54e618ccf89 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -1221,9 +1221,6 @@ msgstr "새 표시 이름을 입력하세요 (비워두면 초기화됩니다)" msgid "Change &display name…" msgstr "표시 이름 변경(&D)…" -msgid "Context Menu" -msgstr "컨텍스트 메뉴" - msgid "&Open folder…" msgstr "폴더 열기(&O)…" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index 1662926b7ac..1716eefd377 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -1221,9 +1221,6 @@ msgstr "Skriv inn nytt visningsnavn (tomt for å tilbakestille)" msgid "Change &display name…" msgstr "Endre &visningsnavn…" -msgid "Context Menu" -msgstr "Kontekstmeny" - msgid "&Open folder…" msgstr "&Åpne mappe…" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 9449f9a51ec..711477a1256 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -1221,9 +1221,6 @@ msgstr "Voer een nieuwe weergavenaam in (laat leeg om te herstellen)" msgid "Change &display name…" msgstr "Pas &weergavenaam aan…" -msgid "Context Menu" -msgstr "Contextmenu" - msgid "&Open folder…" msgstr "&Open map…" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 5cc13543164..307affc7964 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -1228,9 +1228,6 @@ msgstr "Podaj nową nazwę wyświetlaną (wyczyść, by zresetować)" msgid "Change &display name…" msgstr "Zmień wyświetlaną &nazwę…" -msgid "Context Menu" -msgstr "Menu kontekstowe" - msgid "&Open folder…" msgstr "&Otwórz folder…" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 91484567620..6f46fa90a2d 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -1221,9 +1221,6 @@ msgstr "Digite o novo nome de exibição (em branco para restaurar)" msgid "Change &display name…" msgstr "Mudar o &nome de exibição…" -msgid "Context Menu" -msgstr "Menu de contexto" - msgid "&Open folder…" msgstr "Abrir &pasta…" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 291280e2f50..7713bb5f0ca 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -1228,9 +1228,6 @@ msgstr "Escreve o nome apresentado (vazio para repor)" msgid "Change &display name…" msgstr "Alterar o nome &apresentado…" -msgid "Context Menu" -msgstr "Menu de contexto" - msgid "&Open folder…" msgstr "&Abrir pasta…" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 02537d7e40d..47f473d90f0 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -1240,9 +1240,6 @@ msgstr "Введите новое отображаемое имя (оставь msgid "Change &display name…" msgstr "Изменить &отображаемое имя…" -msgid "Context Menu" -msgstr "Контекстное меню" - msgid "&Open folder…" msgstr "&Открыть папку…" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 8e00dee9a63..01a178a68f3 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -1227,9 +1227,6 @@ msgstr "Zadajte nové zobrazené meno (prázdne pole pre vymazanie)" msgid "Change &display name…" msgstr "Zmeniť &zobrazené meno…" -msgid "Context Menu" -msgstr "Kontextové menu" - msgid "&Open folder…" msgstr "&Otvoriť priečinok…" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 43bb21a2047..9eb1875bb52 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -1229,9 +1229,6 @@ msgstr "Vstavi novo prikazano ime (prazno za ponastavitev)" msgid "Change &display name…" msgstr "Spremeni &prikazano ime…" -msgid "Context Menu" -msgstr "Kontekstni meni" - msgid "&Open folder…" msgstr "&Odpri mapo…" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 7547ad5b0c1..055b1420e65 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -1221,9 +1221,6 @@ msgstr "Ange nytt visningsnamn (tom för att återställa)" msgid "Change &display name…" msgstr "Ändra &visningsnamn…" -msgid "Context Menu" -msgstr "Innehållsmeny" - msgid "&Open folder…" msgstr "&Öppna mapp…" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index 1b3d26aa75f..fef1db11c51 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -1227,9 +1227,6 @@ msgstr "Yeni görünü adını girin (sıfırlamak için boş bırakın)" msgid "Change &display name…" msgstr "Görüntü adını &değiştirin…" -msgid "Context Menu" -msgstr "Bağlam Menüsü" - msgid "&Open folder…" msgstr "Klas&örü aç…" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 178d7ead142..9ce655b54a0 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -1229,9 +1229,6 @@ msgstr "Введіть нове відображуване ім'я (порожн msgid "Change &display name…" msgstr "Змінити &відображуване ім'я…" -msgid "Context Menu" -msgstr "Контекстне меню" - msgid "&Open folder…" msgstr "&Відкрити папку…" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 533f40deccb..79575f0a93c 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -1221,9 +1221,6 @@ msgstr "Điền tên hiển thị mới (để trống để đặt lại)" msgid "Change &display name…" msgstr "Thay đổi tên hiển thị…" -msgid "Context Menu" -msgstr "Menu ngữ cảnh" - msgid "&Open folder…" msgstr "Mở thư mục…" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index b48820aa460..76d1c53b29e 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -1221,9 +1221,6 @@ msgstr "输入新的显示名称 (留空以重置)" msgid "Change &display name…" msgstr "更改显示名称(&D)…" -msgid "Context Menu" -msgstr "上下文菜单" - msgid "&Open folder…" msgstr "打开文件夹(&O)…" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 4da19a8c3d0..200ed0095cb 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -1228,9 +1228,6 @@ msgstr "輸入新的顯示名稱 (留空以重設)" msgid "Change &display name…" msgstr "變更顯示名稱(&D)…" -msgid "Context Menu" -msgstr "內容選單" - msgid "&Open folder…" msgstr "開啟資料夾(&O)…" diff --git a/src/qt/qt_vmmanager_main.cpp b/src/qt/qt_vmmanager_main.cpp index 25e6e3775a4..786ef9ca4a2 100644 --- a/src/qt/qt_vmmanager_main.cpp +++ b/src/qt/qt_vmmanager_main.cpp @@ -98,7 +98,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) connect(ui->listView, &QListView::customContextMenuRequested, [this, parent](const QPoint &pos) { const auto indexAt = ui->listView->indexAt(pos); if (indexAt.isValid()) { - QMenu contextMenu(tr("Context Menu"), ui->listView); + QMenu contextMenu("", ui->listView); QAction startAction(tr("&Start")); contextMenu.addAction(&startAction); @@ -378,7 +378,7 @@ VMManagerMain::VMManagerMain(QWidget *parent) contextMenu.exec(ui->listView->viewport()->mapToGlobal(pos)); } else { - QMenu contextMenu(tr("Context Menu"), ui->listView); + QMenu contextMenu("", ui->listView); QAction newMachineAction(tr("&New machine…")); contextMenu.addAction(&newMachineAction); From 554b74a09d880ab1134479eee66e3aa0d1219caa Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 15 Jan 2026 01:23:16 +0500 Subject: [PATCH 291/320] Translate device bus name separately from device name --- src/device.c | 10 ++++++---- src/include/86box/device.h | 1 + src/qt/languages/86box.pot | 6 +++--- src/qt/languages/ca-ES.po | 12 ++++++------ src/qt/languages/cs-CZ.po | 12 ++++++------ src/qt/languages/de-DE.po | 12 ++++++------ src/qt/languages/el-GR.po | 12 ++++++------ src/qt/languages/es-ES.po | 12 ++++++------ src/qt/languages/fi-FI.po | 12 ++++++------ src/qt/languages/fr-FR.po | 12 ++++++------ src/qt/languages/hr-HR.po | 12 ++++++------ src/qt/languages/it-IT.po | 12 ++++++------ src/qt/languages/ja-JP.po | 12 ++++++------ src/qt/languages/ko-KR.po | 12 ++++++------ src/qt/languages/nb-NO.po | 12 ++++++------ src/qt/languages/nl-NL.po | 12 ++++++------ src/qt/languages/pl-PL.po | 12 ++++++------ src/qt/languages/pt-BR.po | 12 ++++++------ src/qt/languages/pt-PT.po | 12 ++++++------ src/qt/languages/ru-RU.po | 12 ++++++------ src/qt/languages/sk-SK.po | 12 ++++++------ src/qt/languages/sl-SI.po | 12 ++++++------ src/qt/languages/sv-SE.po | 12 ++++++------ src/qt/languages/tr-TR.po | 12 ++++++------ src/qt/languages/uk-UA.po | 12 ++++++------ src/qt/languages/vi-VN.po | 12 ++++++------ src/qt/languages/zh-CN.po | 12 ++++++------ src/qt/languages/zh-TW.po | 12 ++++++------ src/qt/qt_deviceconfig.cpp | 16 +++++++++++++--- 29 files changed, 173 insertions(+), 160 deletions(-) diff --git a/src/device.c b/src/device.c index 857103fa107..3ce49ee78fe 100644 --- a/src/device.c +++ b/src/device.c @@ -483,7 +483,7 @@ device_has_config(const device_t *dev) return (c > 0) ? 1 : 0; } -static const char * +const char * device_get_bus_name(const device_t *dev) { const char *sbus = NULL; @@ -556,9 +556,11 @@ device_get_name(const device_t *dev, int bus, char *name) if (sbus != NULL) { /* First concatenate [] before the device's name. */ - strcat(name, "["); - strcat(name, sbus); - strcat(name, "] "); + if (bus > 0) { + strcat(name, "["); + strcat(name, sbus); + strcat(name, "] "); + } /* Then change string from ISA16 to ISA if applicable. */ if (!strcmp(sbus, "ISA16")) diff --git a/src/include/86box/device.h b/src/include/86box/device.h index b6e78f41c8f..58edab35cab 100644 --- a/src/include/86box/device.h +++ b/src/include/86box/device.h @@ -206,6 +206,7 @@ extern void *device_get_priv(const device_t *dev); extern int device_available(const device_t *dev); extern void device_speed_changed(void); extern void device_force_redraw(void); +extern const char *device_get_bus_name(const device_t *dev); extern void device_get_name(const device_t *dev, int bus, char *name); extern int device_has_config(const device_t *dev); diff --git a/src/qt/languages/86box.pot b/src/qt/languages/86box.pot index b00cdddbe05..5af770c3765 100644 --- a/src/qt/languages/86box.pot +++ b/src/qt/languages/86box.pot @@ -531,10 +531,10 @@ msgstr "" msgid "CD-ROM controller:" msgstr "" -msgid "[ISA16] Tertiary IDE Controller" +msgid "Tertiary IDE Controller" msgstr "" -msgid "[ISA16] Quaternary IDE Controller" +msgid "Quaternary IDE Controller" msgstr "" msgid "Hard disk controllers" @@ -1842,7 +1842,7 @@ msgstr "" msgid "Default Baud rate" msgstr "" -msgid "[COM] Standard Hayes-compliant Modem" +msgid "Standard Hayes-compliant Modem" msgstr "" msgid "Roland MT-32 Emulation" diff --git a/src/qt/languages/ca-ES.po b/src/qt/languages/ca-ES.po index 35d8b750548..a47814d1f08 100644 --- a/src/qt/languages/ca-ES.po +++ b/src/qt/languages/ca-ES.po @@ -537,11 +537,11 @@ msgstr "Controladora de disquets:" msgid "CD-ROM controller:" msgstr "Controladora de CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Controlador IDE terciari" +msgid "Tertiary IDE Controller" +msgstr "Controlador IDE terciari" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Controlador IDE quaternari" +msgid "Quaternary IDE Controller" +msgstr "Controlador IDE quaternari" msgid "Hard disk controllers" msgstr "Controladores de disc dur" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (sèrie)" msgid "Default Baud rate" msgstr "Velocitat de transmissió per defecte" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Mòdem estàndard compatible amb Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Mòdem estàndard compatible amb Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulació Roland MT-32" diff --git a/src/qt/languages/cs-CZ.po b/src/qt/languages/cs-CZ.po index 7064e6543a5..9b40ababcea 100644 --- a/src/qt/languages/cs-CZ.po +++ b/src/qt/languages/cs-CZ.po @@ -537,11 +537,11 @@ msgstr "Disketový řadič:" msgid "CD-ROM controller:" msgstr "Řadič CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Třetí řadič IDE" +msgid "Tertiary IDE Controller" +msgstr "Třetí řadič IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Čtvrtý řadič IDE" +msgid "Quaternary IDE Controller" +msgstr "Čtvrtý řadič IDE" msgid "Hard disk controllers" msgstr "Řadiče pevných disků" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (sériová)" msgid "Default Baud rate" msgstr "Výchozí přenosová rychlost" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Modem kompatibilní se standardem Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Modem kompatibilní se standardem Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulace Roland MT-32" diff --git a/src/qt/languages/de-DE.po b/src/qt/languages/de-DE.po index 59f5acac65f..00770fc657c 100644 --- a/src/qt/languages/de-DE.po +++ b/src/qt/languages/de-DE.po @@ -537,11 +537,11 @@ msgstr "Disketten-Controller:" msgid "CD-ROM controller:" msgstr "CD-ROM-Controller:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tertiärer IDE-Controller" +msgid "Tertiary IDE Controller" +msgstr "Tertiärer IDE-Controller" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Quartärer IDE-Controller" +msgid "Quaternary IDE Controller" +msgstr "Quartärer IDE-Controller" msgid "Hard disk controllers" msgstr "Festplattencontroller" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (Seriell)" msgid "Default Baud rate" msgstr "Standard-Baudrate" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standard Hayes-kompatibles Modem" +msgid "Standard Hayes-compliant Modem" +msgstr "Standard Hayes-kompatibles Modem" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32-Emulation" diff --git a/src/qt/languages/el-GR.po b/src/qt/languages/el-GR.po index 69393c7517c..a3a788d2f45 100644 --- a/src/qt/languages/el-GR.po +++ b/src/qt/languages/el-GR.po @@ -537,11 +537,11 @@ msgstr "Ελεγκτής δισκέτας:" msgid "CD-ROM controller:" msgstr "Ελεγκτής CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Τριτογενής Ελεγκτής IDE" +msgid "Tertiary IDE Controller" +msgstr "Τριτογενής Ελεγκτής IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Τεταρτογενής Ελεγκτής IDE" +msgid "Quaternary IDE Controller" +msgstr "Τεταρτογενής Ελεγκτής IDE" msgid "Hard disk controllers" msgstr "Ελεγκτές σκληρού δίσκου" @@ -1884,8 +1884,8 @@ msgstr "3M MicroTouch (Σειριακό)" msgid "Default Baud rate" msgstr "Προεπιλεγμένος ρυθμός Baud" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Τυπικό μόντεμ συμβατό με Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Τυπικό μόντεμ συμβατό με Hayes" msgid "Roland MT-32 Emulation" msgstr "Εξομοίωση Roland MT-32" diff --git a/src/qt/languages/es-ES.po b/src/qt/languages/es-ES.po index c7ff65f181e..8b0c029e850 100644 --- a/src/qt/languages/es-ES.po +++ b/src/qt/languages/es-ES.po @@ -537,11 +537,11 @@ msgstr "Controladora de disquetes:" msgid "CD-ROM controller:" msgstr "Controladora CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tercera controladora IDE" +msgid "Tertiary IDE Controller" +msgstr "Tercera controladora IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Cuarta controladora IDE" +msgid "Quaternary IDE Controller" +msgstr "Cuarta controladora IDE" msgid "Hard disk controllers" msgstr "Controladores de disco duro" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (serie)" msgid "Default Baud rate" msgstr "Velocidad de transmisión pretederminada" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Módem estándar compatible con Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Módem estándar compatible con Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulación Roland MT-32" diff --git a/src/qt/languages/fi-FI.po b/src/qt/languages/fi-FI.po index 71dee237e60..5fa58548eab 100644 --- a/src/qt/languages/fi-FI.po +++ b/src/qt/languages/fi-FI.po @@ -537,11 +537,11 @@ msgstr "Levykeohjain:" msgid "CD-ROM controller:" msgstr "CD-ohjain:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Kolmas IDE-ohjain" +msgid "Tertiary IDE Controller" +msgstr "Kolmas IDE-ohjain" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Neljäs IDE-ohjain" +msgid "Quaternary IDE Controller" +msgstr "Neljäs IDE-ohjain" msgid "Hard disk controllers" msgstr "Kiintolevyohjaimet" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (sarja)" msgid "Default Baud rate" msgstr "Oletussiirtonopeus" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Tavallinen Hayes-yhteensopiva modeemi" +msgid "Standard Hayes-compliant Modem" +msgstr "Tavallinen Hayes-yhteensopiva modeemi" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32-emulointi" diff --git a/src/qt/languages/fr-FR.po b/src/qt/languages/fr-FR.po index daef71ec87d..482acdc2041 100644 --- a/src/qt/languages/fr-FR.po +++ b/src/qt/languages/fr-FR.po @@ -537,11 +537,11 @@ msgstr "Contrôleur de disquette :" msgid "CD-ROM controller:" msgstr "Contrôleur CD-ROM :" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Troisième contrôleur IDE" +msgid "Tertiary IDE Controller" +msgstr "Troisième contrôleur IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Quatrième contrôleur IDE" +msgid "Quaternary IDE Controller" +msgstr "Quatrième contrôleur IDE" msgid "Hard disk controllers" msgstr "Contrôleurs de disque dur" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (série)" msgid "Default Baud rate" msgstr "Vitesse de transmission par défaut" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Modem standard conforme à la norme Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Modem standard conforme à la norme Hayes" msgid "Roland MT-32 Emulation" msgstr "Émulation Roland MT-32" diff --git a/src/qt/languages/hr-HR.po b/src/qt/languages/hr-HR.po index 7c4f9d2be0d..aec1a38d49d 100644 --- a/src/qt/languages/hr-HR.po +++ b/src/qt/languages/hr-HR.po @@ -539,11 +539,11 @@ msgstr "Kontroler diskete:" msgid "CD-ROM controller:" msgstr "Kontroler CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tercijarni IDE kontroler" +msgid "Tertiary IDE Controller" +msgstr "Tercijarni IDE kontroler" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Kvaternarni IDE kontroler" +msgid "Quaternary IDE Controller" +msgstr "Kvaternarni IDE kontroler" msgid "Hard disk controllers" msgstr "Kontroleri tvrdih diskova" @@ -1850,8 +1850,8 @@ msgstr "3M MicroTouch (serijski)" msgid "Default Baud rate" msgstr "Zadana brzina prijenosa podataka" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standardni modem, usklađen s standardom Hayesom" +msgid "Standard Hayes-compliant Modem" +msgstr "Standardni modem, usklađen s standardom Hayesom" msgid "Roland MT-32 Emulation" msgstr "Emulacija Rolanda MT-32" diff --git a/src/qt/languages/it-IT.po b/src/qt/languages/it-IT.po index aa846ca15a2..a7f78002909 100644 --- a/src/qt/languages/it-IT.po +++ b/src/qt/languages/it-IT.po @@ -537,11 +537,11 @@ msgstr "Controller del floppy disk:" msgid "CD-ROM controller:" msgstr "Controller CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Controller IDE terziario" +msgid "Tertiary IDE Controller" +msgstr "Controller IDE terziario" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Controller IDE quaternario" +msgid "Quaternary IDE Controller" +msgstr "Controller IDE quaternario" msgid "Hard disk controllers" msgstr "Controller del disco rigido" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (seriale)" msgid "Default Baud rate" msgstr "Velocità di trasmissione predefinita" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Modem standard conforme a Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Modem standard conforme a Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulazione Roland MT-32" diff --git a/src/qt/languages/ja-JP.po b/src/qt/languages/ja-JP.po index 003c32d677e..e891d0dc4e1 100644 --- a/src/qt/languages/ja-JP.po +++ b/src/qt/languages/ja-JP.po @@ -538,11 +538,11 @@ msgstr "FDDコントローラー:" msgid "CD-ROM controller:" msgstr "CD-ROMコントローラー:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] 第三IDEコントローラー" +msgid "Tertiary IDE Controller" +msgstr "第三IDEコントローラー" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] 第四IDEコントローラー" +msgid "Quaternary IDE Controller" +msgstr "第四IDEコントローラー" msgid "Hard disk controllers" msgstr "ハードディスクコントローラー" @@ -1849,8 +1849,8 @@ msgstr "3Mマイクロタッチ(シリアル)" msgid "Default Baud rate" msgstr "デフォルトのボーレート" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] 標準ヘイズ準拠モデム" +msgid "Standard Hayes-compliant Modem" +msgstr "標準ヘイズ準拠モデム" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32エミュレーション" diff --git a/src/qt/languages/ko-KR.po b/src/qt/languages/ko-KR.po index 54e618ccf89..072cbef04a7 100644 --- a/src/qt/languages/ko-KR.po +++ b/src/qt/languages/ko-KR.po @@ -531,11 +531,11 @@ msgstr "플로피 디스크 컨트롤러:" msgid "CD-ROM controller:" msgstr "CD-ROM 컨트롤러:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] 제3의 IDE 컨트롤러" +msgid "Tertiary IDE Controller" +msgstr "제3의 IDE 컨트롤러" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] 제4의 IDE 컨트롤러" +msgid "Quaternary IDE Controller" +msgstr "제4의 IDE 컨트롤러" msgid "Hard disk controllers" msgstr "하드 디스크 컨트롤러" @@ -1842,8 +1842,8 @@ msgstr "3M 마이크로터치(직렬)" msgid "Default Baud rate" msgstr "기본 보드 속도" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] 표준 헤이즈 호환 모뎀" +msgid "Standard Hayes-compliant Modem" +msgstr "표준 헤이즈 호환 모뎀" msgid "Roland MT-32 Emulation" msgstr "롤랜드 MT-32 에뮬레이션" diff --git a/src/qt/languages/nb-NO.po b/src/qt/languages/nb-NO.po index 1716eefd377..c0f7db5e443 100644 --- a/src/qt/languages/nb-NO.po +++ b/src/qt/languages/nb-NO.po @@ -531,11 +531,11 @@ msgstr "Diskettkontroller:" msgid "CD-ROM controller:" msgstr "CD-ROM-kontroller:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tertiær IDE-kontroller" +msgid "Tertiary IDE Controller" +msgstr "Tertiær IDE-kontroller" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Kvartær IDE-kontroller" +msgid "Quaternary IDE Controller" +msgstr "Kvartær IDE-kontroller" msgid "Hard disk controllers" msgstr "Harddiskkontrollere" @@ -1842,8 +1842,8 @@ msgstr "3M MicroTouch (seriell)" msgid "Default Baud rate" msgstr "Standard baudrate" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standard Hayes-kompatibelt modem" +msgid "Standard Hayes-compliant Modem" +msgstr "Standard Hayes-kompatibelt modem" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32-emulering" diff --git a/src/qt/languages/nl-NL.po b/src/qt/languages/nl-NL.po index 711477a1256..5a6de011ee2 100644 --- a/src/qt/languages/nl-NL.po +++ b/src/qt/languages/nl-NL.po @@ -531,11 +531,11 @@ msgstr "Floppy disk controller:" msgid "CD-ROM controller:" msgstr "CD-ROM controller:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tertiaire IDE-controller" +msgid "Tertiary IDE Controller" +msgstr "Tertiaire IDE-controller" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Quaternaire IDE-controller" +msgid "Quaternary IDE Controller" +msgstr "Quaternaire IDE-controller" msgid "Hard disk controllers" msgstr "Harde schijfcontrollers" @@ -1842,8 +1842,8 @@ msgstr "3M MicroTouch (serieel)" msgid "Default Baud rate" msgstr "Standaard baudrate" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standaard Hayes-compatibele modem" +msgid "Standard Hayes-compliant Modem" +msgstr "Standaard Hayes-compatibele modem" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32-emulatie" diff --git a/src/qt/languages/pl-PL.po b/src/qt/languages/pl-PL.po index 307affc7964..6a2ddc3ea84 100644 --- a/src/qt/languages/pl-PL.po +++ b/src/qt/languages/pl-PL.po @@ -538,11 +538,11 @@ msgstr "Kontroler dyskietek:" msgid "CD-ROM controller:" msgstr "Kontroler CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Trzeciorzędny kontroler IDE" +msgid "Tertiary IDE Controller" +msgstr "Trzeciorzędny kontroler IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Czwartorzędny kontroler IDE" +msgid "Quaternary IDE Controller" +msgstr "Czwartorzędny kontroler IDE" msgid "Hard disk controllers" msgstr "Kontrolery dysków twardych" @@ -1849,8 +1849,8 @@ msgstr "3M MicroTouch (szeregowy)" msgid "Default Baud rate" msgstr "Domyślna szybkość transmisji" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standardowy modem zgodny z Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Standardowy modem zgodny z Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulacja Roland MT-32" diff --git a/src/qt/languages/pt-BR.po b/src/qt/languages/pt-BR.po index 6f46fa90a2d..64b7939f340 100644 --- a/src/qt/languages/pt-BR.po +++ b/src/qt/languages/pt-BR.po @@ -531,11 +531,11 @@ msgstr "Controlador de disquete:" msgid "CD-ROM controller:" msgstr "Controlador de CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Controlador IDE terciário" +msgid "Tertiary IDE Controller" +msgstr "Controlador IDE terciário" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Controlador IDE quaternário" +msgid "Quaternary IDE Controller" +msgstr "Controlador IDE quaternário" msgid "Hard disk controllers" msgstr "Controladores de disco rígido" @@ -1842,8 +1842,8 @@ msgstr "3M MicroTouch (serial)" msgid "Default Baud rate" msgstr "Taxa de transmissão padrão" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Modem padrão compatível com Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Modem padrão compatível com Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulação do Roland MT-32" diff --git a/src/qt/languages/pt-PT.po b/src/qt/languages/pt-PT.po index 7713bb5f0ca..086fbe1b5f4 100644 --- a/src/qt/languages/pt-PT.po +++ b/src/qt/languages/pt-PT.po @@ -538,11 +538,11 @@ msgstr "Controlador de disquetes:" msgid "CD-ROM controller:" msgstr "Controlador CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Controlador IDE terciário" +msgid "Tertiary IDE Controller" +msgstr "Controlador IDE terciário" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Controlador IDE quaternário" +msgid "Quaternary IDE Controller" +msgstr "Controlador IDE quaternário" msgid "Hard disk controllers" msgstr "Controladores de disco rígido" @@ -1849,8 +1849,8 @@ msgstr "3M MicroTouch (série)" msgid "Default Baud rate" msgstr "Velocidade de transmissão padrão" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Modem padrão compatível com Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Modem padrão compatível com Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulação do Roland MT-32" diff --git a/src/qt/languages/ru-RU.po b/src/qt/languages/ru-RU.po index 47f473d90f0..9308e6da3fa 100644 --- a/src/qt/languages/ru-RU.po +++ b/src/qt/languages/ru-RU.po @@ -538,11 +538,11 @@ msgstr "Контроллер гибких дисков:" msgid "CD-ROM controller:" msgstr "Контроллер CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Третичный контроллер IDE" +msgid "Tertiary IDE Controller" +msgstr "Третичный контроллер IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Четвертичный контроллер IDE" +msgid "Quaternary IDE Controller" +msgstr "Четвертичный контроллер IDE" msgid "Hard disk controllers" msgstr "Контроллеры жёстких дисков" @@ -1861,8 +1861,8 @@ msgstr "3M MicroTouch (последовательный)" msgid "Default Baud rate" msgstr "Скорость передачи данных по умолчанию" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Стандартный Hayes-совместимый модем" +msgid "Standard Hayes-compliant Modem" +msgstr "Стандартный Hayes-совместимый модем" msgid "Roland MT-32 Emulation" msgstr "Эмуляция Roland MT-32" diff --git a/src/qt/languages/sk-SK.po b/src/qt/languages/sk-SK.po index 01a178a68f3..76015e0b1ae 100644 --- a/src/qt/languages/sk-SK.po +++ b/src/qt/languages/sk-SK.po @@ -537,11 +537,11 @@ msgstr "Disketový radič:" msgid "CD-ROM controller:" msgstr "Radič CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tretí radič IDE" +msgid "Tertiary IDE Controller" +msgstr "Tretí radič IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Štvrtý radič IDE" +msgid "Quaternary IDE Controller" +msgstr "Štvrtý radič IDE" msgid "Hard disk controllers" msgstr "Radiče pevných diskov" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (sériová)" msgid "Default Baud rate" msgstr "Východná prenosová rýchlosť" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Štandardný modem kompatibilný s Hayesom" +msgid "Standard Hayes-compliant Modem" +msgstr "Štandardný modem kompatibilný s Hayesom" msgid "Roland MT-32 Emulation" msgstr "Emulácia Roland MT-32" diff --git a/src/qt/languages/sl-SI.po b/src/qt/languages/sl-SI.po index 9eb1875bb52..f36f32e50be 100644 --- a/src/qt/languages/sl-SI.po +++ b/src/qt/languages/sl-SI.po @@ -539,11 +539,11 @@ msgstr "Disketni krmilnik:" msgid "CD-ROM controller:" msgstr "Krmilnik CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Terciarni krmilnik IDE" +msgid "Tertiary IDE Controller" +msgstr "Terciarni krmilnik IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Kvartarni krmilnik IDE" +msgid "Quaternary IDE Controller" +msgstr "Kvartarni krmilnik IDE" msgid "Hard disk controllers" msgstr "Krmilniki trdih diskov" @@ -1850,8 +1850,8 @@ msgstr "3M MicroTouch (serijska)" msgid "Default Baud rate" msgstr "Privzeta baudna hitrost" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standardni modem v skladen s Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Standardni modem v skladen s Hayes" msgid "Roland MT-32 Emulation" msgstr "Emulacija Roland MT-32" diff --git a/src/qt/languages/sv-SE.po b/src/qt/languages/sv-SE.po index 055b1420e65..c897ed83d1d 100644 --- a/src/qt/languages/sv-SE.po +++ b/src/qt/languages/sv-SE.po @@ -531,11 +531,11 @@ msgstr "Styrenhet för diskett:" msgid "CD-ROM controller:" msgstr "Styrenhet för CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Tertiär IDE-kontroller" +msgid "Tertiary IDE Controller" +msgstr "Tertiär IDE-kontroller" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Kvartär IDE-kontroller" +msgid "Quaternary IDE Controller" +msgstr "Kvartär IDE-kontroller" msgid "Hard disk controllers" msgstr "Hårddiskkontroller" @@ -1842,8 +1842,8 @@ msgstr "3M MicroTouch (serie)" msgid "Default Baud rate" msgstr "Standard Baudhastighet" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standard Hayes-kompatibelt modem" +msgid "Standard Hayes-compliant Modem" +msgstr "Standard Hayes-kompatibelt modem" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32 emulering" diff --git a/src/qt/languages/tr-TR.po b/src/qt/languages/tr-TR.po index fef1db11c51..546b197a6b5 100644 --- a/src/qt/languages/tr-TR.po +++ b/src/qt/languages/tr-TR.po @@ -537,11 +537,11 @@ msgstr "Disket denetleyicisi:" msgid "CD-ROM controller:" msgstr "CD-ROM denetleyicisi:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Üçüncül IDE denetleyicisi" +msgid "Tertiary IDE Controller" +msgstr "Üçüncül IDE denetleyicisi" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Dördüncül IDE denetleyicisi" +msgid "Quaternary IDE Controller" +msgstr "Dördüncül IDE denetleyicisi" msgid "Hard disk controllers" msgstr "Sabit disk denetleyicileri" @@ -1848,8 +1848,8 @@ msgstr "3M MicroTouch (seri)" msgid "Default Baud rate" msgstr "Varsayılan Baud hızı" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Standart Hayes Uyumlu Modem" +msgid "Standard Hayes-compliant Modem" +msgstr "Standart Hayes Uyumlu Modem" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32 Emülasyonu" diff --git a/src/qt/languages/uk-UA.po b/src/qt/languages/uk-UA.po index 9ce655b54a0..9f7711d0423 100644 --- a/src/qt/languages/uk-UA.po +++ b/src/qt/languages/uk-UA.po @@ -539,11 +539,11 @@ msgstr "Контролер гнучких дисків:" msgid "CD-ROM controller:" msgstr "Контролер CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Третинний контролер IDE" +msgid "Tertiary IDE Controller" +msgstr "Третинний контролер IDE" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Четвертинний контролер IDE" +msgid "Quaternary IDE Controller" +msgstr "Четвертинний контролер IDE" msgid "Hard disk controllers" msgstr "Контролери жорстких дисків" @@ -1850,8 +1850,8 @@ msgstr "3M MicroTouch (послідовна)" msgid "Default Baud rate" msgstr "Швидкість передачі даних за замовчуванням" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Стандартний модем, сумісний зі стандартом Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Стандартний модем, сумісний зі стандартом Hayes" msgid "Roland MT-32 Emulation" msgstr "Емуляція Roland MT-32" diff --git a/src/qt/languages/vi-VN.po b/src/qt/languages/vi-VN.po index 79575f0a93c..00ca5f514b7 100644 --- a/src/qt/languages/vi-VN.po +++ b/src/qt/languages/vi-VN.po @@ -531,11 +531,11 @@ msgstr "Bộ điều khiển ổ mềm:" msgid "CD-ROM controller:" msgstr "Bộ điều khiển CD-ROM:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] Bộ điều khiển IDE thứ ba" +msgid "Tertiary IDE Controller" +msgstr "Bộ điều khiển IDE thứ ba" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] Bộ điều khiển IDE thứ tư" +msgid "Quaternary IDE Controller" +msgstr "Bộ điều khiển IDE thứ tư" msgid "Hard disk controllers" msgstr "Bộ điều khiển ổ cứng" @@ -1842,8 +1842,8 @@ msgstr "3M MicroTouch (Serial)" msgid "Default Baud rate" msgstr "Tốc độ baud mặc định" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] Modem tuân thủ tiêu chuẩn Hayes" +msgid "Standard Hayes-compliant Modem" +msgstr "Modem tuân thủ tiêu chuẩn Hayes" msgid "Roland MT-32 Emulation" msgstr "Mô phỏng Roland MT-32" diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 76d1c53b29e..e61f2ce7f5a 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -531,11 +531,11 @@ msgstr "软盘控制器:" msgid "CD-ROM controller:" msgstr "CD-ROM 控制器:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] 第三 IDE 控制器" +msgid "Tertiary IDE Controller" +msgstr "第三 IDE 控制器" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] 第四 IDE 控制器" +msgid "Quaternary IDE Controller" +msgstr "第四 IDE 控制器" msgid "Hard disk controllers" msgstr "硬盘控制器" @@ -1842,8 +1842,8 @@ msgstr "3M MicroTouch (串口)" msgid "Default Baud rate" msgstr "默认波特率" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] 标准 Hayes 兼容调制解调器" +msgid "Standard Hayes-compliant Modem" +msgstr "标准 Hayes 兼容调制解调器" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32 仿真" diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 200ed0095cb..736435c89a4 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -538,11 +538,11 @@ msgstr "軟碟控制器:" msgid "CD-ROM controller:" msgstr "CD-ROM 控制器:" -msgid "[ISA16] Tertiary IDE Controller" -msgstr "[ISA16] 第三 IDE 控制器" +msgid "Tertiary IDE Controller" +msgstr "第三 IDE 控制器" -msgid "[ISA16] Quaternary IDE Controller" -msgstr "[ISA16] 第四 IDE 控制器" +msgid "Quaternary IDE Controller" +msgstr "第四 IDE 控制器" msgid "Hard disk controllers" msgstr "硬碟控制器" @@ -1849,8 +1849,8 @@ msgstr "3M MicroTouch (序列埠)" msgid "Default Baud rate" msgstr "預設鮑率" -msgid "[COM] Standard Hayes-compliant Modem" -msgstr "[COM] 標準 Hayes 相容的數據機" +msgid "Standard Hayes-compliant Modem" +msgstr "標準 Hayes 相容的數據機" msgid "Roland MT-32 Emulation" msgstr "Roland MT-32 模擬" diff --git a/src/qt/qt_deviceconfig.cpp b/src/qt/qt_deviceconfig.cpp index 7cc39898873..42d63243d82 100644 --- a/src/qt/qt_deviceconfig.cpp +++ b/src/qt/qt_deviceconfig.cpp @@ -492,8 +492,18 @@ DeviceConfig::DeviceName(const _device_ *device, const char *internalName, const else if (device == nullptr) return ""; else { - char temp[512]; - device_get_name(device, bus, temp); - return tr((const char *) temp); + char temp[512]; + const char *tempbus; + if (bus == 1) { + device_get_name(device, -1, temp); + tempbus = device_get_bus_name(device); + if (tempbus != nullptr) + return QString("[%1] %2").arg(tr(tempbus), tr((const char *) temp)); + else + return tr((const char *) temp); + } else { + device_get_name(device, bus, temp); + return tr((const char *) temp); + } } } From 8613e9cbae69a701d5e66c43d742d29492dde8ab Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 15 Jan 2026 03:26:46 +0500 Subject: [PATCH 292/320] Manager: Add a button to reset to the default VM directory --- src/qt/qt_vmmanager_preferences.cpp | 10 ++++++++++ src/qt/qt_vmmanager_preferences.hpp | 1 + src/qt/qt_vmmanager_preferences.ui | 31 +++++++++++++++++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/src/qt/qt_vmmanager_preferences.cpp b/src/qt/qt_vmmanager_preferences.cpp index 77d5d1657bc..df30aec6caf 100644 --- a/src/qt/qt_vmmanager_preferences.cpp +++ b/src/qt/qt_vmmanager_preferences.cpp @@ -29,6 +29,7 @@ extern WindowsDarkModeFilter *vmm_dark_mode_filter; extern "C" { #include <86box/86box.h> #include <86box/config.h> +#include <86box/plat.h> #include <86box/version.h> } @@ -53,6 +54,7 @@ VMManagerPreferences:: if (machinesRunning) { ui->systemDirectory->setEnabled(false); ui->dirSelectButton->setEnabled(false); + ui->pushButtonDefaultSystemDir->setEnabled(false); ui->dirSelectButton->setToolTip(tr("To change the system directory, stop all running machines.")); } @@ -97,6 +99,14 @@ VMManagerPreferences::chooseDirectoryLocation() ui->systemDirectory->setText(QDir::toNativeSeparators(directory)); } +void +VMManagerPreferences::on_pushButtonDefaultSystemDir_released() +{ + char temp[1024]; + plat_get_vmm_dir(temp, sizeof(temp)); + ui->systemDirectory->setText(QDir::toNativeSeparators(QDir(temp).path())); +} + void VMManagerPreferences::on_pushButtonLanguage_released() { diff --git a/src/qt/qt_vmmanager_preferences.hpp b/src/qt/qt_vmmanager_preferences.hpp index 1ddeedb51fa..cbb7c5f6126 100644 --- a/src/qt/qt_vmmanager_preferences.hpp +++ b/src/qt/qt_vmmanager_preferences.hpp @@ -34,6 +34,7 @@ class VMManagerPreferences final : public QDialog { QString settingsFile; private slots: void chooseDirectoryLocation(); + void on_pushButtonDefaultSystemDir_released(); void on_pushButtonLanguage_released(); protected: diff --git a/src/qt/qt_vmmanager_preferences.ui b/src/qt/qt_vmmanager_preferences.ui index 7206b79bfd9..a4d526f8c17 100644 --- a/src/qt/qt_vmmanager_preferences.ui +++ b/src/qt/qt_vmmanager_preferences.ui @@ -56,6 +56,36 @@
+ + + + 0 + + + 0 + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + Default + + + + + @@ -170,6 +200,7 @@ dirSelectButton + pushButtonDefaultSystemDir comboBoxLanguage pushButtonLanguage rememberSizePositionCheckBox From da5a93af89f2b705b02443ca15930692772d7ace Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 15 Jan 2026 04:11:01 +0500 Subject: [PATCH 293/320] Manager: Remove unused alternative design for next/prev screenshot buttons --- src/qt/qt_vmmanager_details.cpp | 21 ++------------------- src/qt/qt_vmmanager_details.ui | 33 ++------------------------------- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/src/qt/qt_vmmanager_details.cpp b/src/qt/qt_vmmanager_details.cpp index c6d5631e113..40d0fb18569 100644 --- a/src/qt/qt_vmmanager_details.cpp +++ b/src/qt/qt_vmmanager_details.cpp @@ -93,21 +93,12 @@ VMManagerDetails::VMManagerDetails(QWidget *parent) // Set the icons for the screenshot navigation buttons ui->screenshotNext->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowRight)); ui->screenshotPrevious->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowLeft)); - ui->screenshotNextTB->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowRight)); - ui->screenshotPreviousTB->setIcon(QApplication::style()->standardIcon(QStyle::SP_ArrowLeft)); // Disabled by default ui->screenshotNext->setEnabled(false); ui->screenshotPrevious->setEnabled(false); - ui->screenshotNextTB->setEnabled(false); - ui->screenshotPreviousTB->setEnabled(false); // Connect their signals - connect(ui->screenshotNext, &QPushButton::clicked, this, &VMManagerDetails::nextScreenshot); - connect(ui->screenshotNextTB, &QToolButton::clicked, this, &VMManagerDetails::nextScreenshot); - connect(ui->screenshotPreviousTB, &QToolButton::clicked, this, &VMManagerDetails::previousScreenshot); - connect(ui->screenshotPrevious, &QPushButton::clicked, this, &VMManagerDetails::previousScreenshot); - // These push buttons can be taken out if the tool buttons stay - ui->screenshotNext->setVisible(false); - ui->screenshotPrevious->setVisible(false); + connect(ui->screenshotNext, &QToolButton::clicked, this, &VMManagerDetails::nextScreenshot); + connect(ui->screenshotPrevious, &QToolButton::clicked, this, &VMManagerDetails::previousScreenshot); QString toolButtonStyleSheet; // Simple method to try and determine if light mode is enabled #ifdef Q_OS_WINDOWS @@ -207,8 +198,6 @@ VMManagerDetails::reset() ui->screenshotNext->setEnabled(false); ui->screenshotPrevious->setEnabled(false); - ui->screenshotNextTB->setEnabled(false); - ui->screenshotPreviousTB->setEnabled(false); ui->screenshot->setPixmap(QString()); ui->screenshot->setFixedSize(240, 160); ui->screenshot->setFrameStyle(QFrame::Box | QFrame::Sunken); @@ -384,8 +373,6 @@ VMManagerDetails::updateScreenshots(VMManagerSystem *passed_sysconfig) // Disable screenshot navigation buttons by default ui->screenshotNext->setEnabled(false); ui->screenshotPrevious->setEnabled(false); - ui->screenshotNextTB->setEnabled(false); - ui->screenshotPreviousTB->setEnabled(false); // Different actions are taken depending on the existence and number of screenshots screenshots = passed_sysconfig->getScreenshots(); @@ -395,8 +382,6 @@ VMManagerDetails::updateScreenshots(VMManagerSystem *passed_sysconfig) if (screenshots.size() > 1) { ui->screenshotNext->setEnabled(true); ui->screenshotPrevious->setEnabled(true); - ui->screenshotNextTB->setEnabled(true); - ui->screenshotPreviousTB->setEnabled(true); } #ifdef Q_OS_WINDOWS ui->screenshot->setStyleSheet(""); @@ -409,8 +394,6 @@ VMManagerDetails::updateScreenshots(VMManagerSystem *passed_sysconfig) } else { ui->screenshotNext->setEnabled(false); ui->screenshotPrevious->setEnabled(false); - ui->screenshotNextTB->setEnabled(false); - ui->screenshotPreviousTB->setEnabled(false); ui->screenshot->setPixmap(QString()); ui->screenshot->setFixedSize(240, 160); ui->screenshot->setFrameStyle(QFrame::Box | QFrame::Sunken); diff --git a/src/qt/qt_vmmanager_details.ui b/src/qt/qt_vmmanager_details.ui index 162fb20eea5..0722dd3f5b9 100644 --- a/src/qt/qt_vmmanager_details.ui +++ b/src/qt/qt_vmmanager_details.ui @@ -146,22 +146,6 @@ - - - - - 0 - 0 - - - - - - - false - - - @@ -178,14 +162,14 @@ 0 - + - + @@ -197,19 +181,6 @@ - - - - - 0 - 0 - - - - - - - From ab76cc12ad28924b01ac1314ea2e3b51abcdac17 Mon Sep 17 00:00:00 2001 From: Alexander Babikov Date: Thu, 15 Jan 2026 05:56:50 +0500 Subject: [PATCH 294/320] Fix an unused (on non-Windows) variable --- src/sound/midi_fluidsynth.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sound/midi_fluidsynth.c b/src/sound/midi_fluidsynth.c index f1f977f0937..577c053678b 100644 --- a/src/sound/midi_fluidsynth.c +++ b/src/sound/midi_fluidsynth.c @@ -155,7 +155,9 @@ fluidsynth_init(UNUSED(const device_t *info)) { fluidsynth_t *data = &fsdev; midi_device_t *dev; +#ifdef _WIN32 char path[4096] = { 0 }; +#endif memset(data, 0, sizeof(fluidsynth_t)); From c3ef89775a202c4a4086c85272b4e2c47e3d5780 Mon Sep 17 00:00:00 2001 From: Bozo Scum Date: Thu, 15 Jan 2026 10:17:35 +0800 Subject: [PATCH 295/320] Update zh-TW.po * commit 5619dcd did not modify zh-TW.po, adding it * fine tune some translated terms --- src/qt/languages/zh-TW.po | 70 +++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 577e5bfdecd..598425668ec 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -275,7 +275,7 @@ msgid "&Play" msgstr "播放(&P)" msgid "&Rewind to the beginning" -msgstr "倒帶至起點(&R)" +msgstr "倒轉至起點(&R)" msgid "&Fast forward to the end" msgstr "快轉至終點(&F)" @@ -884,16 +884,16 @@ msgid "4-axis, 4-button joystick" msgstr "4 軸, 4 鍵搖桿" msgid "2-button gamepad(s)" -msgstr "2 鍵遊戲手柄" +msgstr "2 鍵遊戲手把" msgid "3-button gamepad" -msgstr "3 鍵遊戲手柄" +msgstr "3 鍵遊戲手把" msgid "4-button gamepad" -msgstr "4 鍵遊戲手柄" +msgstr "4 鍵遊戲手把" msgid "6-button gamepad" -msgstr "6 鍵遊戲手柄" +msgstr "6 鍵遊戲手把" msgid "2-button flight yoke" msgstr "2 按鈕飛行搖桿" @@ -914,13 +914,13 @@ msgid "4-button flight yoke with throttle" msgstr "4 按鈕帶油門飛行搖桿" msgid "Steering wheel (3-axis, 2-button)" -msgstr "方向盤 (3 軸, 2 鍵搖桿)" +msgstr "方向盤 (3 軸, 2 鍵)" msgid "Steering wheel (3-axis, 3-button)" -msgstr "方向盤 (3 軸, 3 鍵搖桿)" +msgstr "方向盤 (3 軸, 3 鍵)" msgid "Steering wheel (3-axis, 4-button)" -msgstr "方向盤 (3 軸, 4 鍵搖桿)" +msgstr "方向盤 (3 軸, 4 鍵)" msgid "Thrustmaster Formula T1/T2 with adapter" msgstr "Thrustmaster Formula T1/T2 附轉接器" @@ -1154,10 +1154,10 @@ msgid "Unable to open the selected configuration file for reading: %1" msgstr "無法開啟選取的組態檔進行讀取: %1" msgid "Use regular expressions in search box" -msgstr "在搜尋方塊中使用正規表示式" +msgstr "在搜尋欄中使用正規表示式" -msgid "%1 machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" -msgstr "%1 台機器目前處於活動狀態。您確定要退出虛擬機器管理員嗎?" +msgid "%n machine(s) are currently active. Are you sure you want to exit the VM manager anyway?" +msgstr "%n 台機器目前處於活動狀態。您確定要退出虛擬機器管理員嗎?" msgid "Add new system wizard" msgstr "新增系統精靈" @@ -1184,7 +1184,7 @@ msgid "Type some notes here" msgstr "在此輸入備註" msgid "Paste the contents of the existing configuration file into the box below." -msgstr "將現有組態檔的內容貼到下面的方塊中。" +msgstr "將現有組態檔的內容貼到下面的輸入欄中。" msgid "Load configuration from file" msgstr "從檔案載入組態" @@ -1322,7 +1322,7 @@ msgid "&Kill" msgstr "強制終止(&K)" msgid "Killing a virtual machine can cause data loss. Only do this if the 86Box process gets stuck.\n\nDo you really wish to kill the virtual machine \"%1\"?" -msgstr "強行終止虛擬機器可能會導致資料遺失。只有在 86Box 過程卡住時才執行此操作。\n\n您真的希望強制終止虛擬機器 \"%1\"?" +msgstr "強制終止虛擬機器可能會導致資料遺失。只有在 86Box 過程卡住時才執行此操作。\n\n您真的希望強制終止虛擬機器 \"%1\"?" msgid "&Delete" msgstr "刪除(&D)" @@ -1424,7 +1424,7 @@ msgid "Disk image too large" msgstr "磁碟影像太大" msgid "Remember to partition and format the newly-created drive." -msgstr "請記得為新創建的影像分區並格式化。" +msgstr "請記得為新創建的影像建立分割區並格式化。" msgid "The selected file will be overwritten. Are you sure you want to use it?" msgstr "選定的檔案將被覆蓋。確定繼續使用此檔案嗎?" @@ -1433,10 +1433,10 @@ msgid "Unsupported disk image" msgstr "不支援的磁碟影像" msgid "Overwrite" -msgstr "覆蓋" +msgstr "覆寫" msgid "Don't overwrite" -msgstr "不覆蓋" +msgstr "不覆寫" msgid "Raw image" msgstr "原始影像" @@ -1730,13 +1730,13 @@ msgid "OpenGL version 3.0 or greater is required. Current version is %1.%2" msgstr "需要 OpenGL 版本 3.0 或更高版本。目前版本為 %1.%2" msgid "Error initializing OpenGL" -msgstr "初始化 OpenGL 出錯" +msgstr "初始化 OpenGL 錯誤" msgid "\nFalling back to software rendering." -msgstr "\n回退到軟體渲染。" +msgstr "\n退回到軟體渲染。" msgid "

When selecting media images (CD-ROM, floppy, etc.) the open dialog will start in the same directory as the 86Box configuration file. This setting will likely only make a difference on macOS.

" -msgstr "

當選擇媒體影像 (CD-ROM、軟碟等) 時,開啟對話方塊會在與 86Box 組態檔相同的目錄中開始。此設定可能只會在 macOS 上有所影響。

" +msgstr "

當選擇媒體影像 (CD-ROM、軟碟等) 時,開啟對話框會在與 86Box 組態檔相同的目錄中開始。此設定可能只會在 macOS 上有所影響。

" msgid "This machine might have been moved or copied." msgstr "這台機器可能已被移動或複製。" @@ -1979,7 +1979,7 @@ msgid "BIOS size" msgstr "BIOS 大小" msgid "BIOS size (ROM #1)" -msgstr "BIOS 大小 (ROM )" +msgstr "BIOS 大小 (ROM 1)" msgid "BIOS size (ROM #2)" msgstr "BIOS 大小 (ROM 2)" @@ -2021,7 +2021,7 @@ msgid "MIDI Thru" msgstr "MIDI 輸入直通" msgid "MIDI Clockout" -msgstr "MIDI 時鐘輸出" +msgstr "MIDI 時脈輸出" msgid "Output Gain" msgstr "輸出增益" @@ -2045,19 +2045,19 @@ msgid "Chorus Waveform" msgstr "合唱波形" msgid "Reverb" -msgstr "混響" +msgstr "殘響" msgid "Reverb Room Size" -msgstr "混響室的大小" +msgstr "殘響室的大小" msgid "Reverb Damping" -msgstr "混響阻尼" +msgstr "殘響阻尼" msgid "Reverb Width" -msgstr "混響寬度" +msgstr "殘響寬度" msgid "Reverb Level" -msgstr "混響位準" +msgstr "殘響位準" msgid "Interpolation Method" msgstr "插值方法" @@ -2066,7 +2066,7 @@ msgid "Dynamic Sample Loading" msgstr "動態取樣載入" msgid "Reverb Output Gain" -msgstr "迴響輸出增益" +msgstr "殘響輸出增益" msgid "Reversed stereo" msgstr "左右互換立體聲" @@ -2201,7 +2201,7 @@ msgid "SB low DMA" msgstr "SB 低 DMA" msgid "6CH variant (6-channel)" -msgstr "6CH 變數 (6 通道)" +msgstr "6CH 變體 (6 通道)" msgid "Enable CMS" msgstr "啟用 CMS" @@ -2387,7 +2387,7 @@ msgid "7th Order" msgstr "七階" msgid "Non-timed (original)" -msgstr "非定時 (原始)" +msgstr "無計時 (原始)" msgid "45 Hz (JMP2 not populated)" msgstr "45 Hz (JMP2 未安插)" @@ -2510,7 +2510,7 @@ msgid "Has Quadcolor II daughter board" msgstr "具有 Quadcolor II 子板" msgid "Alternate monochrome contrast" -msgstr "交替單色對比" +msgstr "反轉單色對比" msgid "128 KB" msgstr "128 KB" @@ -2531,10 +2531,10 @@ msgid "Color 80x25 (5153/CGA)" msgstr "彩色 80x25 (5153/CGA)" msgid "Enhanced Color - Normal Mode (5154/ECD)" -msgstr "增強彩色 - 一般模式 (5154/ECD)" +msgstr "增強色彩 - 一般模式 (5154/ECD)" msgid "Enhanced Color - Enhanced Mode (5154/ECD)" -msgstr "增強彩色 - 增強模式 (5154/ECD)" +msgstr "增強色彩 - 增強模式 (5154/ECD)" msgid "Green" msgstr "綠色" @@ -2669,7 +2669,7 @@ msgid "Softfloat FPU" msgstr "Softfloat 浮點運算器模擬" msgid "High performance impact" -msgstr "對效能影響大" +msgstr "對效能影響高" msgid "[Generic] RAM Disk (max. speed)" msgstr "[通用] RAM 磁碟 (最大速度)" @@ -2888,7 +2888,7 @@ msgid "Unable to determine release information" msgstr "無法確定版本發佈資訊" msgid "There was an error checking for updates:\n\n%1\n\nPlease try again later." -msgstr "檢查更新時出錯:\n\n%1\n\n請稍後再試。" +msgstr "檢查更新時錯誤:\n\n%1\n\n請稍後再試。" msgid "Update check complete" msgstr "更新檢查完成" @@ -2936,7 +2936,7 @@ msgid "86Box Update" msgstr "86Box 更新" msgid "Release notes:" -msgstr "版本發佈說明:" +msgstr "版本發佈備註:" msgid "%1 Hz" msgstr "%1 Hz" From ccff53e61f7c3c6355d413c2b6286b48dc56d739 Mon Sep 17 00:00:00 2001 From: Bozo Scum Date: Thu, 15 Jan 2026 11:27:10 +0800 Subject: [PATCH 296/320] Update zh-TW.po * fill the translation of the new added string --- src/qt/languages/zh-TW.po | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/languages/zh-TW.po b/src/qt/languages/zh-TW.po index 3c8ab17d53b..0bdcd215a0f 100644 --- a/src/qt/languages/zh-TW.po +++ b/src/qt/languages/zh-TW.po @@ -3023,4 +3023,4 @@ msgid "Fast forward" msgstr "快轉" msgid "To change the system directory, stop all running machines." -msgstr "" +msgstr "欲變更系統目錄,請先停止全部運行中的機器。" From 88e3b6aad92327fcfc5cf3a3c3930e460bd76c78 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Fri, 16 Jan 2026 03:02:03 +0700 Subject: [PATCH 297/320] Correct MS-6117's memory Also correct the year for S168/S1 i486 machines. --- src/machine/machine_table.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 7ece45782c2..9b7211d8c0f 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -49,7 +49,7 @@ const machine_filter_t machine_types[] = { { "[1992] 486SLC", MACHINE_TYPE_486SLC }, { "[1985] i386DX", MACHINE_TYPE_386DX }, { "[1989] i386DX/i486", MACHINE_TYPE_386DX_486 }, - { "[1992] i486 (Socket 168 and 1)", MACHINE_TYPE_486 }, + { "[1989] i486 (Socket 168 and 1)", MACHINE_TYPE_486 }, { "[1992] i486 (Socket 2)", MACHINE_TYPE_486_S2 }, { "[1994] i486 (Socket 3)", MACHINE_TYPE_486_S3 }, { "[1994] i486 (Socket 3 PCI)", MACHINE_TYPE_486_S3_PCI }, @@ -18244,7 +18244,7 @@ const machine_t machines[] = { .flags = MACHINE_IDE_DUAL | MACHINE_APM | MACHINE_USB, .ram = { .min = 8192, - .max = 1048576, + .max = 786432, /* Manual thinks the maximum memory is 1024MB (256x4MB), but there is no 4th memory slot */ .step = 8192 }, .nvrmask = 255, From fb1f37c83bff06411c1f8355a4542a7ce4d1d39c Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 16 Jan 2026 11:35:17 +0100 Subject: [PATCH 298/320] Added PIIX4 AMI 1995 NVR device. --- src/include/86box/nvr.h | 1 + src/nvr_at.c | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/include/86box/nvr.h b/src/include/86box/nvr.h index 9485c7dcb3c..4d187b78534 100644 --- a/src/include/86box/nvr.h +++ b/src/include/86box/nvr.h @@ -95,6 +95,7 @@ extern const device_t ami_1992_nvr_device; extern const device_t ami_1994_nvr_device; extern const device_t ami_1995_nvr_device; extern const device_t via_nvr_device; +extern const device_t piix4_ami_1995_nvr_device; extern const device_t p6rp4_nvr_device; extern const device_t martin_nvr_device; extern const device_t elt_nvr_device; diff --git a/src/nvr_at.c b/src/nvr_at.c index 38a97560bb8..c25c482d8c6 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -1173,8 +1173,15 @@ nvr_at_init(const device_t *info) local->cent = RTC_CENTURY_VIA; break; case 8: /* Epson Equity LT */ - nvr->irq = -1; - local->cent = RTC_CENTURY_ELT; + if ((info->local & 0x1f) == 0x18) { + local->flags |= (FLAG_PIIX4 | FLAG_AMI_1995_HACK); + local->def = 0x00; + nvr->irq = 8; + local->cent = RTC_CENTURY_AT; + } else { + nvr->irq = -1; + local->cent = RTC_CENTURY_ELT; + } break; default: @@ -1445,6 +1452,20 @@ const device_t via_nvr_device = { .config = NULL }; +const device_t piix4_ami_1995_nvr_device = { + .name = "Intel PIIX4 AMI WinBIOS 1995 PC/AT NVRAM", + .internal_name = "piix4_ami_1995_nvr", + .flags = DEVICE_ISA16, + .local = 0x10 | 8, + .init = nvr_at_init, + .close = nvr_at_close, + .reset = nvr_at_reset, + .available = NULL, + .speed_changed = nvr_at_speed_changed, + .force_redraw = NULL, + .config = NULL +}; + const device_t p6rp4_nvr_device = { .name = "ASUS P/I-P6RP4 PC/AT NVRAM", .internal_name = "p6rp4_nvr", From 5f498ffd86dc26c6aaaa25f9cfeda68bc7ce5087 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 16 Jan 2026 11:43:31 +0100 Subject: [PATCH 299/320] PIIX4(E): Use the correct NVR variant when using the (not yet implemented) MSI MS-5156. --- src/chipset/intel_piix.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index 32df440981e..ef12b21878f 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -1580,7 +1580,10 @@ piix_init(const device_t *info) dev->usb = device_add(&usb_device); if (dev->type > 3) { - dev->nvr = device_add(&piix4_nvr_device); + if (!strcmp(machine_get_internal_name(), "ms5156")) + dev->nvr = device_add(&piix4_nvr_device); + else + dev->nvr = device_add(&piix4_ami_1995_nvr_device); dev->smbus = device_add(&piix4_smbus_device); dev->acpi = device_add(&acpi_intel_device); From 2e886e21c5d51e5b250403436f58c2f7a1a9d6b9 Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 16 Jan 2026 11:44:38 +0100 Subject: [PATCH 300/320] Reversed the cases so they're correct. --- src/chipset/intel_piix.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chipset/intel_piix.c b/src/chipset/intel_piix.c index ef12b21878f..c6f6486d1e3 100644 --- a/src/chipset/intel_piix.c +++ b/src/chipset/intel_piix.c @@ -1581,9 +1581,9 @@ piix_init(const device_t *info) if (dev->type > 3) { if (!strcmp(machine_get_internal_name(), "ms5156")) - dev->nvr = device_add(&piix4_nvr_device); - else dev->nvr = device_add(&piix4_ami_1995_nvr_device); + else + dev->nvr = device_add(&piix4_nvr_device); dev->smbus = device_add(&piix4_smbus_device); dev->acpi = device_add(&acpi_intel_device); From b3b6943055ed03d96d0b577fe6eaba07ab97540f Mon Sep 17 00:00:00 2001 From: OBattler Date: Fri, 16 Jan 2026 16:59:39 +0100 Subject: [PATCH 301/320] PIIX4 AMI 1995 NVR: Initialize second I/O port at 72h. --- src/nvr_at.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nvr_at.c b/src/nvr_at.c index c25c482d8c6..ce720add9ca 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -1226,7 +1226,8 @@ nvr_at_init(const device_t *info) io_sethandler(0x0070, 2, nvr_read, NULL, NULL, nvr_write, NULL, NULL, nvr); } - if (((info->local & 0x1f) == 0x11) || ((info->local & 0x1f) == 0x17)) { + if (((info->local & 0x1f) == 0x11) || ((info->local & 0x1f) == 0x17) || + ((info->local & 0x1f) == 0x18)) { io_sethandler(0x0072, 2, nvr_read, NULL, NULL, nvr_write, NULL, NULL, nvr); } From 17f18e064f479c1b13feb49f400ec7340fc480d8 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sat, 17 Jan 2026 16:54:13 +0100 Subject: [PATCH 302/320] Mouse: Move the delta division by 120 to mouse.c to properly accumulate smaller deltas with high-precision host mice on Windows hosts. --- src/device/mouse.c | 42 ++++++++++++++++++++++++++++----- src/qt/qt_winrawinputfilter.cpp | 4 ++-- 2 files changed, 38 insertions(+), 8 deletions(-) diff --git a/src/device/mouse.c b/src/device/mouse.c index d4ef4c8733e..5cc94d11642 100644 --- a/src/device/mouse.c +++ b/src/device/mouse.c @@ -34,6 +34,12 @@ #include <86box/plat.h> #include <86box/plat_unused.h> +#ifdef _WIN32 +#define WHEEL_DELTA 120 +#else +#define WHEEL_DELTA 1 +#endif + typedef struct mouse_t { const device_t *device; } mouse_t; @@ -510,16 +516,28 @@ mouse_subtract_z(int *delta_z, int min, int max, int invert) { int z = ATOMIC_LOAD(mouse_z); int real_z = invert ? -z : z; + min *= WHEEL_DELTA; + max *= WHEEL_DELTA; +#if WHEEL_DELTA > 1 + if ((real_z > -WHEEL_DELTA) && (real_z < WHEEL_DELTA)) { + *delta_z = 0; + return; + } else +#endif if (real_z > max) { - *delta_z = max; + *delta_z = max / WHEEL_DELTA; real_z -= max; } else if (real_z < min) { - *delta_z = min; + *delta_z = min / WHEEL_DELTA; real_z += ABS(min); } else { - *delta_z = real_z; + *delta_z = real_z / WHEEL_DELTA; +#if WHEEL_DELTA > 1 + real_z -= ((real_z / WHEEL_DELTA) * WHEEL_DELTA); +#else real_z = 0; +#endif } ATOMIC_STORE(mouse_z, invert ? -real_z : real_z); @@ -530,16 +548,28 @@ mouse_subtract_w(int *delta_w, int min, int max, int invert) { int w = ATOMIC_LOAD(mouse_w); int real_w = invert ? -w : w; + min *= WHEEL_DELTA; + max *= WHEEL_DELTA; +#if WHEEL_DELTA > 1 + if ((real_w > -WHEEL_DELTA) && (real_w < WHEEL_DELTA)) { + *delta_w = 0; + return; + } else +#endif if (real_w > max) { - *delta_w = max; + *delta_w = max / WHEEL_DELTA; real_w -= max; } else if (real_w < min) { - *delta_w = min; + *delta_w = min / WHEEL_DELTA; real_w += ABS(min); } else { - *delta_w = real_w; + *delta_w = real_w / WHEEL_DELTA; +#if WHEEL_DELTA > 1 + real_w -= ((real_w / WHEEL_DELTA) * WHEEL_DELTA); +#else real_w = 0; +#endif } ATOMIC_STORE(mouse_w, invert ? -real_w : real_w); diff --git a/src/qt/qt_winrawinputfilter.cpp b/src/qt/qt_winrawinputfilter.cpp index d40f4cdd688..5332cacbbcb 100644 --- a/src/qt/qt_winrawinputfilter.cpp +++ b/src/qt/qt_winrawinputfilter.cpp @@ -526,13 +526,13 @@ WindowsRawInputFilter::mouse_handle(RAWMOUSE *raw) mouse_set_buttons_ex(b); if (state.usButtonFlags & RI_MOUSE_WHEEL) { - delta_z = (SHORT) state.usButtonData / 120; + delta_z = (SHORT) state.usButtonData; mouse_set_z(delta_z); } else delta_z = 0; if (state.usButtonFlags & RI_MOUSE_HWHEEL) { - delta_w = (SHORT) state.usButtonData / 120; + delta_w = (SHORT) state.usButtonData; mouse_set_w(delta_w); } else delta_w = 0; From d813df9a446c785f74b8a94efa75e1ba48fa1a37 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 17 Jan 2026 22:35:51 +0600 Subject: [PATCH 303/320] Fix Break key for real --- src/device/keyboard_at.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index fd8d1150322..3a35a0b11cf 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -305,7 +305,7 @@ const scancode scancode_set1_at[512] = { { .mk = { 0 }, .brk = { 0 } }, /* 0de */ { .mk = { 0 }, .brk = { 0 } }, /* 0df */ { .mk = { 0 }, .brk = { 0 } }, /* 0e0 */ - { .mk = { 0 }, .brk = { 0 } }, /* 0e1 */ + { .mk = { 0xE1, 0 }, .brk = { 0 } }, /* 0e1 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e2 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e3 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e4 */ @@ -1339,7 +1339,7 @@ const scancode scancode_set1_ax[512] = { { .mk = { 0 }, .brk = { 0 } }, /* 0de */ { .mk = { 0 }, .brk = { 0 } }, /* 0df */ { .mk = { 0 }, .brk = { 0 } }, /* 0e0 */ - { .mk = { 0 }, .brk = { 0 } }, /* 0e1 */ + { .mk = { 0xE1, 0 }, .brk = { 0 } }, /* 0e1 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e2 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e3 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e4 */ From d8545025c5f61083b6bd9840a665cc0408ebc5eb Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Sat, 17 Jan 2026 22:46:15 +0600 Subject: [PATCH 304/320] Fix Break key on Set 2 scancodes --- src/device/keyboard_at.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/device/keyboard_at.c b/src/device/keyboard_at.c index 3a35a0b11cf..21f06df03aa 100644 --- a/src/device/keyboard_at.c +++ b/src/device/keyboard_at.c @@ -822,7 +822,7 @@ const scancode scancode_set2_at[512] = { { .mk = { 0 }, .brk = { 0 } }, /* 0de */ { .mk = { 0 }, .brk = { 0 } }, /* 0df */ { .mk = { 0 }, .brk = { 0 } }, /* 0e0 */ - { .mk = { 0 }, .brk = { 0 } }, /* 0e1 */ + { .mk = { 0xE1, 0 }, .brk = { 0 } }, /* 0e1 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e2 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e3 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e4 */ @@ -1856,7 +1856,7 @@ const scancode scancode_set2_ax[512] = { { .mk = { 0 }, .brk = { 0 } }, /* 0de */ { .mk = { 0 }, .brk = { 0 } }, /* 0df */ { .mk = { 0 }, .brk = { 0 } }, /* 0e0 */ - { .mk = { 0 }, .brk = { 0 } }, /* 0e1 */ + { .mk = { 0xE1, 0 }, .brk = { 0 } }, /* 0e1 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e2 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e3 */ { .mk = { 0 }, .brk = { 0 } }, /* 0e4 */ From e414d9ab55b5de57b31addec3ea7cffc96147ebf Mon Sep 17 00:00:00 2001 From: AITUS95 Date: Sun, 18 Jan 2026 03:13:34 +0100 Subject: [PATCH 305/320] Voodoo: smooth V1/V2 sync and Windows waits Make LFB relax/front-sync the default for V1/V2, keep wait stats opt-in, document sync behavior, and reduce Windows swap/event stalls. --- src/include/86box/vid_voodoo_common.h | 45 ++++ src/video/vid_voodoo.c | 321 ++++++++++++++++++++++++-- src/video/vid_voodoo_fifo.c | 191 +++++++++++++-- 3 files changed, 524 insertions(+), 33 deletions(-) diff --git a/src/include/86box/vid_voodoo_common.h b/src/include/86box/vid_voodoo_common.h index 2870f09eae8..a6174e1cd41 100644 --- a/src/include/86box/vid_voodoo_common.h +++ b/src/include/86box/vid_voodoo_common.h @@ -74,6 +74,13 @@ typedef union rgba_u { #define FIFO_FULL ((voodoo->fifo_write_idx - voodoo->fifo_read_idx) >= FIFO_SIZE - 4) #define FIFO_EMPTY (voodoo->fifo_read_idx == voodoo->fifo_write_idx) +#define VOODOO_BUF_FRONT 0 +#define VOODOO_BUF_BACK 1 +#define VOODOO_BUF_AUX 2 +#define VOODOO_BUF_UNKNOWN 3 +#define VOODOO_BUF_COUNT 4 +#define VOODOO_BUF_NONE 0xff + #define FIFO_TYPE 0xff000000 #define FIFO_ADDR 0x00ffffff @@ -98,6 +105,8 @@ typedef struct { uint32_t addr_type; uint32_t val; + uint8_t target_buf; + uint8_t pad[3]; } fifo_entry_t; typedef struct voodoo_params_t { @@ -356,6 +365,8 @@ typedef struct voodoo_t { event_t *wake_fifo_thread; event_t *wake_main_thread; event_t *fifo_not_full_event; + event_t *fifo_empty_event; + ATOMIC_INT fifo_empty_signaled; event_t *render_not_full_event[4]; event_t *wake_render_thread[4]; @@ -399,6 +410,8 @@ typedef struct voodoo_t { ATOMIC_INT cmd_written; ATOMIC_INT cmd_written_fifo; ATOMIC_INT cmd_written_fifo_2; + ATOMIC_INT pending_fb_writes_buf[VOODOO_BUF_COUNT]; + ATOMIC_INT pending_draw_cmds_buf[VOODOO_BUF_COUNT]; voodoo_params_t params_buffer[PARAM_SIZE]; ATOMIC_INT params_read_idx[4]; @@ -627,6 +640,12 @@ typedef struct voodoo_t { int fb_write_buffer; int fb_draw_buffer; int buffer_cutoff; + int queued_disp_buffer; + int queued_draw_buffer; + int queued_fb_write_buffer; + int queued_fb_draw_buffer; + uint32_t queued_lfbMode; + uint32_t queued_fbzMode; uint32_t tile_base; uint32_t tile_stride; @@ -657,6 +676,32 @@ typedef struct voodoo_t { uint64_t time; int render_time[4]; + uint64_t fifo_full_waits; + uint64_t fifo_full_wait_ticks; + uint64_t fifo_full_spin_checks; + uint64_t fifo_empty_waits; + uint64_t fifo_empty_wait_ticks; + uint64_t fifo_empty_spin_checks; + uint64_t render_waits; + uint64_t render_wait_ticks; + uint64_t render_wait_spin_checks; + uint64_t readl_fb_count; + uint64_t readl_fb_sync_count; + uint64_t readl_fb_nosync_count; + uint64_t readl_fb_relaxed_count; + uint64_t readl_fb_sync_buf[3]; + uint64_t readl_fb_nosync_buf[3]; + uint64_t readl_fb_relaxed_buf[3]; + uint64_t readl_reg_count; + uint64_t readl_tex_count; + int wait_stats_enabled; + int wait_stats_explicit; + int lfb_relax_enabled; + int lfb_relax_full; + int lfb_relax_ignore_cmdfifo; + int lfb_relax_ignore_draw; + int lfb_relax_ignore_fb_writes; + int lfb_relax_front_sync; int force_blit_count; int can_blit; diff --git a/src/video/vid_voodoo.c b/src/video/vid_voodoo.c index 745347cd43d..72a57e66c7b 100644 --- a/src/video/vid_voodoo.c +++ b/src/video/vid_voodoo.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include @@ -73,6 +74,66 @@ voodoo_log(const char *fmt, ...) # define voodoo_log(fmt, ...) #endif +static int +voodoo_env_is_disabled(const char *value) +{ + /* Accept common "off" values for env overrides. */ + return !strcmp(value, "0") || !strcmp(value, "off") || !strcmp(value, "false") || !strcmp(value, "disabled"); +} + +static void +voodoo_init_relax_settings(voodoo_t *voodoo) +{ + const char *relax_env = getenv("VOODOO_LFB_RELAX"); + const char *wait_env = getenv("VOODOO_WAIT_STATS"); + int relax_enabled = 1; + + /* Default to front-sync relax mode; wait stats are opt-in. */ + if (!relax_env || !*relax_env) { + relax_env = "4"; + } else if (voodoo_env_is_disabled(relax_env)) { + relax_enabled = 0; + } + + voodoo->wait_stats_explicit = (wait_env && *wait_env); + voodoo->wait_stats_enabled = voodoo->wait_stats_explicit && !voodoo_env_is_disabled(wait_env); + + voodoo->lfb_relax_enabled = relax_enabled; + voodoo->lfb_relax_full = relax_enabled && (strcmp(relax_env, "full") == 0); + voodoo->lfb_relax_ignore_cmdfifo = relax_enabled && (!strcmp(relax_env, "nocmdfifo") || !strcmp(relax_env, "2") || !strcmp(relax_env, "3") || !strcmp(relax_env, "4") || !strcmp(relax_env, "frontsync")); + voodoo->lfb_relax_ignore_draw = relax_enabled && (!strcmp(relax_env, "nodraw") || !strcmp(relax_env, "2") || !strcmp(relax_env, "3") || !strcmp(relax_env, "4") || !strcmp(relax_env, "frontsync")); + voodoo->lfb_relax_ignore_fb_writes = relax_enabled && (!strcmp(relax_env, "nowrites") || !strcmp(relax_env, "3") || !strcmp(relax_env, "4") || !strcmp(relax_env, "frontsync")); + voodoo->lfb_relax_front_sync = relax_enabled && (!strcmp(relax_env, "4") || !strcmp(relax_env, "frontsync")); +} + +static void +voodoo_update_queued_buffers(voodoo_t *voodoo) +{ + switch (voodoo->queued_lfbMode & LFB_WRITE_MASK) { + case LFB_WRITE_FRONT: + voodoo->queued_fb_write_buffer = voodoo->queued_disp_buffer; + break; + case LFB_WRITE_BACK: + voodoo->queued_fb_write_buffer = voodoo->queued_draw_buffer; + break; + default: + voodoo->queued_fb_write_buffer = voodoo->queued_disp_buffer; + break; + } + + switch (voodoo->queued_fbzMode & FBZ_DRAW_MASK) { + case FBZ_DRAW_FRONT: + voodoo->queued_fb_draw_buffer = voodoo->queued_disp_buffer; + break; + case FBZ_DRAW_BACK: + voodoo->queued_fb_draw_buffer = voodoo->queued_draw_buffer; + break; + default: + voodoo->queued_fb_draw_buffer = voodoo->queued_draw_buffer; + break; + } +} + void voodoo_recalc(voodoo_t *voodoo) { @@ -167,11 +228,69 @@ voodoo_readw(uint32_t addr, void *priv) voodoo = set->voodoos[0]; } - voodoo->flush = 1; - while (!FIFO_EMPTY) - voodoo_wake_fifo_thread_now(voodoo); - voodoo_wait_for_render_thread_idle(voodoo); - voodoo->flush = 0; + /* Reads from aux/draw/write regions must see completed rendering. */ + int need_sync = (voodoo->fb_read_offset == voodoo->params.aux_offset) || + (voodoo->fb_read_offset == voodoo->params.draw_offset) || + (voodoo->fb_read_offset == voodoo->fb_write_offset); + int do_sync = 0; + int read_buf = -1; + + if (voodoo->fb_read_offset == voodoo->params.front_offset) + read_buf = VOODOO_BUF_FRONT; + else if (voodoo->fb_read_offset == voodoo->back_offset) + read_buf = VOODOO_BUF_BACK; + else if (voodoo->fb_read_offset == voodoo->params.aux_offset) + read_buf = VOODOO_BUF_AUX; + + if (!need_sync && voodoo->lfb_relax_front_sync && read_buf >= 0 && read_buf != VOODOO_BUF_BACK) + need_sync = 1; + + if (need_sync) { + if (!voodoo->lfb_relax_enabled) + do_sync = 1; + else if (voodoo->lfb_relax_full) + do_sync = 0; + else { + /* In relax mode, only back-buffer reads can skip the full FIFO flush. */ + int pending_buf = 0; + int pending_unknown = 0; + + if (read_buf >= 0 && read_buf < VOODOO_BUF_COUNT) { + if (!voodoo->lfb_relax_ignore_fb_writes) + pending_buf += voodoo->pending_fb_writes_buf[read_buf]; + if (!voodoo->lfb_relax_ignore_draw) + pending_buf += voodoo->pending_draw_cmds_buf[read_buf]; + } + + if (!voodoo->lfb_relax_ignore_fb_writes) + pending_unknown += voodoo->pending_fb_writes_buf[VOODOO_BUF_UNKNOWN]; + if (!voodoo->lfb_relax_ignore_draw) + pending_unknown += voodoo->pending_draw_cmds_buf[VOODOO_BUF_UNKNOWN]; + if (!voodoo->lfb_relax_ignore_cmdfifo) { + if ((voodoo->cmdfifo_depth_rd != voodoo->cmdfifo_depth_wr) || voodoo->cmdfifo_in_sub) + pending_unknown++; + if ((voodoo->cmdfifo_depth_rd_2 != voodoo->cmdfifo_depth_wr_2) || voodoo->cmdfifo_in_sub_2) + pending_unknown++; + } + + if (read_buf != VOODOO_BUF_BACK) + do_sync = 1; + else + do_sync = (pending_buf || pending_unknown); + } + + if (do_sync) { + voodoo->flush = 1; + while (!FIFO_EMPTY) { + voodoo_wake_fifo_thread_now(voodoo); + thread_wait_event(voodoo->fifo_empty_event, -1); + } + voodoo_wait_for_render_thread_idle(voodoo); + voodoo->flush = 0; + } else if (voodoo->lfb_relax_enabled && !voodoo->lfb_relax_full) { + voodoo_wait_for_render_thread_idle(voodoo); + } + } return voodoo_fb_readw(addr, voodoo); } @@ -191,8 +310,17 @@ voodoo_readl(uint32_t addr, void *priv) cycles -= voodoo->read_time; if (addr & 0x800000) { /*Texture*/ + if (voodoo->wait_stats_enabled) + voodoo->readl_tex_count++; } else if (addr & 0x400000) /*Framebuffer*/ { + uint64_t fifo_wait_start = 0; + uint64_t fifo_wait_spins = 0; + int fifo_wait_active = 0; + int need_sync = 0; + int do_sync = 0; + int read_buf = -1; + if (SLI_ENABLED) { const voodoo_set_t *set = voodoo->set; int y = (addr >> 11) & 0x3ff; @@ -203,23 +331,116 @@ voodoo_readl(uint32_t addr, void *priv) voodoo = set->voodoos[0]; } - voodoo->flush = 1; - while (!FIFO_EMPTY) { - voodoo_wake_fifo_thread_now(voodoo); - thread_wait_event(voodoo->fifo_not_full_event, 1); + if (voodoo->wait_stats_enabled) + voodoo->readl_fb_count++; + + if (voodoo->fb_read_offset == voodoo->params.front_offset) + read_buf = VOODOO_BUF_FRONT; + else if (voodoo->fb_read_offset == voodoo->back_offset) + read_buf = VOODOO_BUF_BACK; + else if (voodoo->fb_read_offset == voodoo->params.aux_offset) + read_buf = VOODOO_BUF_AUX; + + /* Reads from aux/draw/write regions must see completed rendering. */ + need_sync = (voodoo->fb_read_offset == voodoo->params.aux_offset) || + (voodoo->fb_read_offset == voodoo->params.draw_offset) || + (voodoo->fb_read_offset == voodoo->fb_write_offset); + if (!need_sync && voodoo->lfb_relax_front_sync && read_buf >= 0 && read_buf != VOODOO_BUF_BACK) + need_sync = 1; + if (need_sync) { + if (!voodoo->lfb_relax_enabled) + do_sync = 1; + else if (voodoo->lfb_relax_full) + do_sync = 0; + else { + /* In relax mode, only back-buffer reads can skip the full FIFO flush. */ + int pending_buf = 0; + int pending_unknown = 0; + + if (read_buf >= 0 && read_buf < VOODOO_BUF_COUNT) { + if (!voodoo->lfb_relax_ignore_fb_writes) + pending_buf += voodoo->pending_fb_writes_buf[read_buf]; + if (!voodoo->lfb_relax_ignore_draw) + pending_buf += voodoo->pending_draw_cmds_buf[read_buf]; + } + + if (!voodoo->lfb_relax_ignore_fb_writes) + pending_unknown += voodoo->pending_fb_writes_buf[VOODOO_BUF_UNKNOWN]; + if (!voodoo->lfb_relax_ignore_draw) + pending_unknown += voodoo->pending_draw_cmds_buf[VOODOO_BUF_UNKNOWN]; + if (!voodoo->lfb_relax_ignore_cmdfifo) { + if ((voodoo->cmdfifo_depth_rd != voodoo->cmdfifo_depth_wr) || voodoo->cmdfifo_in_sub) + pending_unknown++; + if ((voodoo->cmdfifo_depth_rd_2 != voodoo->cmdfifo_depth_wr_2) || voodoo->cmdfifo_in_sub_2) + pending_unknown++; + } + + if (read_buf != VOODOO_BUF_BACK) + do_sync = 1; + else + do_sync = (pending_buf || pending_unknown); + } + } + + if (voodoo->wait_stats_enabled) { + if (do_sync) + voodoo->readl_fb_sync_count++; + else + voodoo->readl_fb_nosync_count++; + if (read_buf >= 0) { + if (do_sync) + voodoo->readl_fb_sync_buf[read_buf]++; + else + voodoo->readl_fb_nosync_buf[read_buf]++; + } + if (need_sync && voodoo->lfb_relax_enabled && !do_sync) { + voodoo->readl_fb_relaxed_count++; + if (read_buf >= 0) + voodoo->readl_fb_relaxed_buf[read_buf]++; + } + } + + if (do_sync) { + voodoo->flush = 1; + while (!FIFO_EMPTY) { + if (voodoo->wait_stats_enabled) { + if (!fifo_wait_active) { + fifo_wait_active = 1; + fifo_wait_start = plat_timer_read(); + voodoo->fifo_empty_waits++; + } + fifo_wait_spins++; + } + voodoo_wake_fifo_thread_now(voodoo); + thread_wait_event(voodoo->fifo_empty_event, -1); + } + if (fifo_wait_active) { + voodoo->fifo_empty_wait_ticks += plat_timer_read() - fifo_wait_start; + voodoo->fifo_empty_spin_checks += fifo_wait_spins; + } + voodoo_wait_for_render_thread_idle(voodoo); + voodoo->flush = 0; + } else if (need_sync && voodoo->lfb_relax_enabled && !voodoo->lfb_relax_full) { + voodoo_wait_for_render_thread_idle(voodoo); } - voodoo_wait_for_render_thread_idle(voodoo); - voodoo->flush = 0; temp = voodoo_fb_readl(addr, voodoo); - } else + } else { + if (voodoo->wait_stats_enabled) + voodoo->readl_reg_count++; + switch (addr & 0x3fc) { case SST_status: { int fifo_entries = FIFO_ENTRIES; int swap_count = voodoo->swap_count; int written = voodoo->cmd_written + voodoo->cmd_written_fifo + voodoo->cmd_written_fifo_2; - int busy = (written - voodoo->cmd_read) || (voodoo->cmdfifo_depth_rd != voodoo->cmdfifo_depth_wr); + int busy = (written - voodoo->cmd_read) || + (voodoo->cmdfifo_depth_rd != voodoo->cmdfifo_depth_wr) || + voodoo->voodoo_busy || + voodoo->render_voodoo_busy[0] || + (voodoo->render_threads >= 2 && voodoo->render_voodoo_busy[1]) || + (voodoo->render_threads == 4 && (voodoo->render_voodoo_busy[2] || voodoo->render_voodoo_busy[3])); if (SLI_ENABLED && voodoo->type != VOODOO_2) { voodoo_t *voodoo_other = (voodoo == voodoo->set->voodoos[0]) ? voodoo->set->voodoos[1] : voodoo->set->voodoos[0]; @@ -229,7 +450,12 @@ voodoo_readl(uint32_t addr, void *priv) swap_count = voodoo_other->swap_count; if ((voodoo_other->fifo_write_idx - voodoo_other->fifo_read_idx) > fifo_entries) fifo_entries = voodoo_other->fifo_write_idx - voodoo_other->fifo_read_idx; - if ((other_written - voodoo_other->cmd_read) || (voodoo_other->cmdfifo_depth_rd != voodoo_other->cmdfifo_depth_wr)) + if ((other_written - voodoo_other->cmd_read) || + (voodoo_other->cmdfifo_depth_rd != voodoo_other->cmdfifo_depth_wr) || + voodoo_other->voodoo_busy || + voodoo_other->render_voodoo_busy[0] || + (voodoo_other->render_threads >= 2 && voodoo_other->render_voodoo_busy[1]) || + (voodoo_other->render_threads == 4 && (voodoo_other->render_voodoo_busy[2] || voodoo_other->render_voodoo_busy[3]))) busy = 1; if (!voodoo_other->voodoo_busy) voodoo_wake_fifo_thread(voodoo_other); @@ -384,6 +610,7 @@ voodoo_readl(uint32_t addr, void *priv) voodoo_log("voodoo_readl : bad addr %08X\n", addr); temp = 0xffffffff; } + } return temp; } @@ -537,6 +764,11 @@ voodoo_writel(uint32_t addr, uint32_t val, void *priv) happen here on a real Voodoo*/ voodoo->disp_buffer = 0; voodoo->draw_buffer = 1; + voodoo->queued_disp_buffer = voodoo->disp_buffer; + voodoo->queued_draw_buffer = voodoo->draw_buffer; + voodoo->queued_lfbMode = voodoo->lfbMode; + voodoo->queued_fbzMode = voodoo->params.fbzMode; + voodoo_update_queued_buffers(voodoo); voodoo_recalc(voodoo); voodoo->front_offset = voodoo->params.front_offset; } @@ -925,6 +1157,7 @@ voodoo_card_init(void) voodoo_t *voodoo = malloc(sizeof(voodoo_t)); memset(voodoo, 0, sizeof(voodoo_t)); + voodoo_init_relax_settings(voodoo); voodoo->bilinear_enabled = device_get_config_int("bilinear"); voodoo->dithersub_enabled = device_get_config_int("dithersub"); voodoo->scrfilter = device_get_config_int("dacfilter"); @@ -992,6 +1225,9 @@ voodoo_card_init(void) voodoo->wake_render_thread[3] = thread_create_event(); voodoo->wake_main_thread = thread_create_event(); voodoo->fifo_not_full_event = thread_create_event(); + voodoo->fifo_empty_event = thread_create_event(); + thread_set_event(voodoo->fifo_empty_event); + ATOMIC_STORE(voodoo->fifo_empty_signaled, 1); voodoo->render_not_full_event[0] = thread_create_event(); voodoo->render_not_full_event[1] = thread_create_event(); voodoo->render_not_full_event[2] = thread_create_event(); @@ -1065,6 +1301,11 @@ voodoo_card_init(void) voodoo->disp_buffer = 0; voodoo->draw_buffer = 1; + voodoo->queued_disp_buffer = voodoo->disp_buffer; + voodoo->queued_draw_buffer = voodoo->draw_buffer; + voodoo->queued_lfbMode = voodoo->lfbMode; + voodoo->queued_fbzMode = voodoo->params.fbzMode; + voodoo_update_queued_buffers(voodoo); voodoo->force_blit_count = 0; voodoo->can_blit = 0; @@ -1080,6 +1321,7 @@ voodoo_2d3d_card_init(int type) voodoo_t *voodoo = malloc(sizeof(voodoo_t)); memset(voodoo, 0, sizeof(voodoo_t)); + voodoo_init_relax_settings(voodoo); voodoo->bilinear_enabled = device_get_config_int("bilinear"); voodoo->dithersub_enabled = device_get_config_int("dithersub"); voodoo->scrfilter = device_get_config_int("dacfilter"); @@ -1116,6 +1358,9 @@ voodoo_2d3d_card_init(int type) voodoo->wake_render_thread[3] = thread_create_event(); voodoo->wake_main_thread = thread_create_event(); voodoo->fifo_not_full_event = thread_create_event(); + voodoo->fifo_empty_event = thread_create_event(); + thread_set_event(voodoo->fifo_empty_event); + ATOMIC_STORE(voodoo->fifo_empty_signaled, 1); voodoo->render_not_full_event[0] = thread_create_event(); voodoo->render_not_full_event[1] = thread_create_event(); voodoo->render_not_full_event[2] = thread_create_event(); @@ -1189,6 +1434,11 @@ voodoo_2d3d_card_init(int type) voodoo->disp_buffer = 0; voodoo->draw_buffer = 1; + voodoo->queued_disp_buffer = voodoo->disp_buffer; + voodoo->queued_draw_buffer = voodoo->draw_buffer; + voodoo->queued_lfbMode = voodoo->lfbMode; + voodoo->queued_fbzMode = voodoo->params.fbzMode; + voodoo_update_queued_buffers(voodoo); voodoo->force_blit_count = 0; voodoo->can_blit = 0; @@ -1277,6 +1527,7 @@ voodoo_card_close(voodoo_t *voodoo) thread_wait(voodoo->render_thread[3]); } thread_destroy_event(voodoo->fifo_not_full_event); + thread_destroy_event(voodoo->fifo_empty_event); thread_destroy_event(voodoo->wake_main_thread); thread_destroy_event(voodoo->wake_fifo_thread); thread_destroy_event(voodoo->wake_render_thread[0]); @@ -1284,6 +1535,48 @@ voodoo_card_close(voodoo_t *voodoo) thread_destroy_event(voodoo->render_not_full_event[0]); thread_destroy_event(voodoo->render_not_full_event[1]); + if (voodoo->wait_stats_enabled && voodoo->wait_stats_explicit) { + pclog("Voodoo wait stats (type=%d): fifo_full waits=%" PRIu64 " ticks=%" PRIu64 " spins=%" PRIu64 + ", fifo_empty waits=%" PRIu64 " ticks=%" PRIu64 " spins=%" PRIu64 + ", render_wait waits=%" PRIu64 " ticks=%" PRIu64 " spins=%" PRIu64 + ", readl fb=%" PRIu64 " sync=%" PRIu64 " nosync=%" PRIu64 " relaxed=%" PRIu64 " relax=%d full=%d nocmdfifo=%d nodraw=%d nowrites=%d frontsync=%d" + " sync_buf f=%" PRIu64 " b=%" PRIu64 " a=%" PRIu64 + " nosync_buf f=%" PRIu64 " b=%" PRIu64 " a=%" PRIu64 + " relaxed_buf f=%" PRIu64 " b=%" PRIu64 " a=%" PRIu64 + " reg=%" PRIu64 " tex=%" PRIu64 "\n", + voodoo->type, + voodoo->fifo_full_waits, + voodoo->fifo_full_wait_ticks, + voodoo->fifo_full_spin_checks, + voodoo->fifo_empty_waits, + voodoo->fifo_empty_wait_ticks, + voodoo->fifo_empty_spin_checks, + voodoo->render_waits, + voodoo->render_wait_ticks, + voodoo->render_wait_spin_checks, + voodoo->readl_fb_count, + voodoo->readl_fb_sync_count, + voodoo->readl_fb_nosync_count, + voodoo->readl_fb_relaxed_count, + voodoo->lfb_relax_enabled, + voodoo->lfb_relax_full, + voodoo->lfb_relax_ignore_cmdfifo, + voodoo->lfb_relax_ignore_draw, + voodoo->lfb_relax_ignore_fb_writes, + voodoo->lfb_relax_front_sync, + voodoo->readl_fb_sync_buf[0], + voodoo->readl_fb_sync_buf[1], + voodoo->readl_fb_sync_buf[2], + voodoo->readl_fb_nosync_buf[0], + voodoo->readl_fb_nosync_buf[1], + voodoo->readl_fb_nosync_buf[2], + voodoo->readl_fb_relaxed_buf[0], + voodoo->readl_fb_relaxed_buf[1], + voodoo->readl_fb_relaxed_buf[2], + voodoo->readl_reg_count, + voodoo->readl_tex_count); + } + for (uint8_t c = 0; c < TEX_CACHE_MAX; c++) { if (voodoo->dual_tmus) free(voodoo->texture_cache[1][c].data); diff --git a/src/video/vid_voodoo_fifo.c b/src/video/vid_voodoo_fifo.c index a7ce0850ea5..c0fcfe3498b 100644 --- a/src/video/vid_voodoo_fifo.c +++ b/src/video/vid_voodoo_fifo.c @@ -62,8 +62,97 @@ voodoo_fifo_log(const char *fmt, ...) #define WAKE_DELAY_DEFAULT (TIMER_USEC * 100) -/* Per-card wake delay: Voodoo1 uses a larger delay to reduce FIFO wake frequency */ -#define WAKE_DELAY_OF(v) ((v)->type == VOODOO_1 ? (TIMER_USEC * 500) : WAKE_DELAY_DEFAULT) +/* Per-card wake delay: keep all Voodoo cards at the default */ +#define WAKE_DELAY_OF(v) (WAKE_DELAY_DEFAULT) + +static __inline uint8_t +voodoo_queue_color_buf_tag(const voodoo_t *voodoo, int buf) +{ + if (buf == voodoo->queued_disp_buffer) + return VOODOO_BUF_FRONT; + if (buf == voodoo->queued_draw_buffer) + return VOODOO_BUF_BACK; + return VOODOO_BUF_UNKNOWN; +} + +static __inline void +voodoo_queue_recalc_buffers(voodoo_t *voodoo) +{ + switch (voodoo->queued_lfbMode & LFB_WRITE_MASK) { + case LFB_WRITE_FRONT: + voodoo->queued_fb_write_buffer = voodoo->queued_disp_buffer; + break; + case LFB_WRITE_BACK: + voodoo->queued_fb_write_buffer = voodoo->queued_draw_buffer; + break; + default: + voodoo->queued_fb_write_buffer = voodoo->queued_disp_buffer; + break; + } + + switch (voodoo->queued_fbzMode & FBZ_DRAW_MASK) { + case FBZ_DRAW_FRONT: + voodoo->queued_fb_draw_buffer = voodoo->queued_disp_buffer; + break; + case FBZ_DRAW_BACK: + voodoo->queued_fb_draw_buffer = voodoo->queued_draw_buffer; + break; + default: + voodoo->queued_fb_draw_buffer = voodoo->queued_draw_buffer; + break; + } +} + +static __inline void +voodoo_queue_apply_reg(voodoo_t *voodoo, uint32_t addr, uint32_t val) +{ + switch (addr & 0x3fc) { + case SST_lfbMode: + voodoo->queued_lfbMode = val; + voodoo_queue_recalc_buffers(voodoo); + break; + case SST_fbzMode: + voodoo->queued_fbzMode = val; + voodoo_queue_recalc_buffers(voodoo); + break; + case SST_swapbufferCMD: + if (TRIPLE_BUFFER) { + voodoo->queued_disp_buffer = (voodoo->queued_disp_buffer + 1) % 3; + voodoo->queued_draw_buffer = (voodoo->queued_draw_buffer + 1) % 3; + } else { + voodoo->queued_disp_buffer = !voodoo->queued_disp_buffer; + voodoo->queued_draw_buffer = !voodoo->queued_draw_buffer; + } + voodoo_queue_recalc_buffers(voodoo); + break; + default: + break; + } +} + +static __inline uint8_t +voodoo_queue_reg_target_buf(voodoo_t *voodoo, uint32_t addr) +{ + switch (addr & 0x3fc) { + case SST_triangleCMD: + case SST_ftriangleCMD: + case SST_fastfillCMD: + return voodoo_queue_color_buf_tag(voodoo, voodoo->queued_fb_draw_buffer); + case SST_lfbMode: + case SST_fbzMode: + case SST_swapbufferCMD: + return VOODOO_BUF_UNKNOWN; + default: + return VOODOO_BUF_NONE; + } +} + +static __inline void +voodoo_cmdfifo_reg_writel(voodoo_t *voodoo, uint32_t addr, uint32_t val) +{ + voodoo_reg_writel(addr, val, voodoo); + voodoo_queue_apply_reg(voodoo, addr, val); +} void voodoo_wake_fifo_thread(voodoo_t *voodoo) { @@ -94,8 +183,19 @@ void voodoo_queue_command(voodoo_t *voodoo, uint32_t addr_type, uint32_t val) { fifo_entry_t *fifo = &voodoo->fifo[voodoo->fifo_write_idx & FIFO_MASK]; + uint64_t fifo_wait_start = 0; + uint64_t fifo_wait_spins = 0; + int fifo_wait_active = 0; while (FIFO_FULL) { + if (voodoo->wait_stats_enabled) { + if (!fifo_wait_active) { + fifo_wait_active = 1; + fifo_wait_start = plat_timer_read(); + voodoo->fifo_full_waits++; + } + fifo_wait_spins++; + } thread_reset_event(voodoo->fifo_not_full_event); if (FIFO_FULL) { thread_wait_event(voodoo->fifo_not_full_event, 1); /*Wait for room in ringbuffer*/ @@ -104,8 +204,38 @@ voodoo_queue_command(voodoo_t *voodoo, uint32_t addr_type, uint32_t val) } } - fifo->val = val; - fifo->addr_type = addr_type; + if (fifo_wait_active) { + voodoo->fifo_full_wait_ticks += plat_timer_read() - fifo_wait_start; + voodoo->fifo_full_spin_checks += fifo_wait_spins; + } + +#ifdef _WIN32 + /* Reset only after an empty signal to avoid heavy ResetEvent churn on Windows. */ + if (ATOMIC_LOAD(voodoo->fifo_empty_signaled)) { + ATOMIC_STORE(voodoo->fifo_empty_signaled, 0); + thread_reset_event(voodoo->fifo_empty_event); + } +#else + thread_reset_event(voodoo->fifo_empty_event); +#endif + + fifo->val = val; + fifo->addr_type = addr_type; + fifo->target_buf = VOODOO_BUF_NONE; + + if (((addr_type & FIFO_TYPE) == FIFO_WRITEW_FB) || + ((addr_type & FIFO_TYPE) == FIFO_WRITEL_FB)) { + fifo->target_buf = voodoo_queue_color_buf_tag(voodoo, voodoo->queued_fb_write_buffer); + ATOMIC_INC(voodoo->pending_fb_writes_buf[fifo->target_buf]); + } else if ((addr_type & FIFO_TYPE) == FIFO_WRITEL_REG) { + uint8_t reg_buf = voodoo_queue_reg_target_buf(voodoo, addr_type & FIFO_ADDR); + + if (reg_buf != VOODOO_BUF_NONE) { + fifo->target_buf = reg_buf; + ATOMIC_INC(voodoo->pending_draw_cmds_buf[fifo->target_buf]); + } + voodoo_queue_apply_reg(voodoo, addr_type & FIFO_ADDR, val); + } voodoo->fifo_write_idx++; voodoo->cmd_status &= ~(1 << 24); @@ -120,7 +250,7 @@ voodoo_flush(voodoo_t *voodoo) voodoo->flush = 1; while (!FIFO_EMPTY) { voodoo_wake_fifo_thread_now(voodoo); - thread_wait_event(voodoo->fifo_not_full_event, 1); + thread_wait_event(voodoo->fifo_empty_event, -1); } voodoo_wait_for_render_thread_idle(voodoo); voodoo->flush = 0; @@ -138,9 +268,7 @@ void voodoo_wait_for_swap_complete(voodoo_t *voodoo) { while (voodoo->swap_pending) { - thread_wait_event(voodoo->wake_fifo_thread, -1); - thread_reset_event(voodoo->wake_fifo_thread); - + /* Avoid waiting on wake_fifo_thread here; main thread may be draining the FIFO. */ thread_wait_mutex(voodoo->swap_mutex); if ((voodoo->swap_pending && voodoo->flush) || FIFO_FULL) { /*Main thread is waiting for FIFO to empty, so skip vsync wait and just swap*/ @@ -153,6 +281,13 @@ voodoo_wait_for_swap_complete(voodoo_t *voodoo) break; } else thread_release_mutex(voodoo->swap_mutex); + /* Yield briefly while waiting for the swap to complete. */ +#ifdef _WIN32 + /* Sleep(1) can add measurable stalls on Windows. */ + plat_delay_ms(0); +#else + plat_delay_ms(1); +#endif } } @@ -261,9 +396,15 @@ voodoo_fifo_thread(void *param) switch (fifo->addr_type & FIFO_TYPE) { case FIFO_WRITEL_REG: while ((fifo->addr_type & FIFO_TYPE) == FIFO_WRITEL_REG) { - voodoo_reg_writel(fifo->addr_type & FIFO_ADDR, fifo->val, voodoo); + uint32_t reg_addr = fifo->addr_type & FIFO_ADDR; + uint8_t target_buf = fifo->target_buf; + + voodoo_reg_writel(reg_addr, fifo->val, voodoo); fifo->addr_type = FIFO_INVALID; voodoo->fifo_read_idx++; + if (target_buf < VOODOO_BUF_COUNT) { + ATOMIC_DEC(voodoo->pending_draw_cmds_buf[target_buf]); + } if (FIFO_EMPTY) break; fifo = &voodoo->fifo[voodoo->fifo_read_idx & FIFO_MASK]; @@ -272,9 +413,14 @@ voodoo_fifo_thread(void *param) case FIFO_WRITEW_FB: voodoo_wait_for_render_thread_idle(voodoo); while ((fifo->addr_type & FIFO_TYPE) == FIFO_WRITEW_FB) { + uint8_t target_buf = fifo->target_buf; + voodoo_fb_writew(fifo->addr_type & FIFO_ADDR, fifo->val, voodoo); fifo->addr_type = FIFO_INVALID; voodoo->fifo_read_idx++; + if (target_buf < VOODOO_BUF_COUNT) { + ATOMIC_DEC(voodoo->pending_fb_writes_buf[target_buf]); + } if (FIFO_EMPTY) break; fifo = &voodoo->fifo[voodoo->fifo_read_idx & FIFO_MASK]; @@ -283,9 +429,14 @@ voodoo_fifo_thread(void *param) case FIFO_WRITEL_FB: voodoo_wait_for_render_thread_idle(voodoo); while ((fifo->addr_type & FIFO_TYPE) == FIFO_WRITEL_FB) { + uint8_t target_buf = fifo->target_buf; + voodoo_fb_writel(fifo->addr_type & FIFO_ADDR, fifo->val, voodoo); fifo->addr_type = FIFO_INVALID; voodoo->fifo_read_idx++; + if (target_buf < VOODOO_BUF_COUNT) { + ATOMIC_DEC(voodoo->pending_fb_writes_buf[target_buf]); + } if (FIFO_EMPTY) break; fifo = &voodoo->fifo[voodoo->fifo_read_idx & FIFO_MASK]; @@ -326,6 +477,8 @@ voodoo_fifo_thread(void *param) voodoo->cmd_status |= (1 << 24); voodoo->cmd_status_2 |= (1 << 24); + thread_set_event(voodoo->fifo_empty_event); + ATOMIC_STORE(voodoo->fifo_empty_signaled, 1); while (voodoo->cmdfifo_enabled && (voodoo->cmdfifo_depth_rd != voodoo->cmdfifo_depth_wr || voodoo->cmdfifo_in_sub)) { uint64_t start_time = plat_timer_read(); @@ -418,7 +571,7 @@ voodoo_fifo_thread(void *param) if (voodoo->type >= VOODOO_BANSHEE && (addr & 0x3ff) == SST_swapbufferCMD) voodoo->cmd_written_fifo++; - voodoo_reg_writel(addr, val, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, addr, val); } if (header & (1 << 15)) @@ -447,7 +600,7 @@ voodoo_fifo_thread(void *param) num = (header >> 29) & 7; mask = header; //(header >> 10) & 0xff; smode = (header >> 22) & 0xf; - voodoo_reg_writel(SST_sSetupMode, ((header >> 10) & 0xff) | (smode << 16), voodoo); + voodoo_cmdfifo_reg_writel(voodoo, SST_sSetupMode, ((header >> 10) & 0xff) | (smode << 16)); num_verticies = (header >> 6) & 0xf; v_num = 0; if (((header >> 3) & 7) == 2) @@ -492,9 +645,9 @@ voodoo_fifo_thread(void *param) voodoo->verts[3].sT1 = cmdfifo_get_f(voodoo); } if (v_num) - voodoo_reg_writel(SST_sDrawTriCMD, 0, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, SST_sDrawTriCMD, 0); else - voodoo_reg_writel(SST_sBeginTriCMD, 0, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, SST_sBeginTriCMD, 0); v_num++; if (v_num == 3 && ((header >> 3) & 7) == 0) v_num = 0; @@ -528,7 +681,7 @@ voodoo_fifo_thread(void *param) if (voodoo->type >= VOODOO_BANSHEE && (addr & 0x3ff) == SST_swapbufferCMD) voodoo->cmd_written_fifo++; - voodoo_reg_writel(addr, val, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, addr, val); } } @@ -709,7 +862,7 @@ voodoo_fifo_thread(void *param) if (voodoo->type >= VOODOO_BANSHEE && (addr & 0x3ff) == SST_swapbufferCMD) voodoo->cmd_written_fifo_2++; - voodoo_reg_writel(addr, val, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, addr, val); } if (header & (1 << 15)) @@ -738,7 +891,7 @@ voodoo_fifo_thread(void *param) num = (header >> 29) & 7; mask = header; //(header >> 10) & 0xff; smode = (header >> 22) & 0xf; - voodoo_reg_writel(SST_sSetupMode, ((header >> 10) & 0xff) | (smode << 16), voodoo); + voodoo_cmdfifo_reg_writel(voodoo, SST_sSetupMode, ((header >> 10) & 0xff) | (smode << 16)); num_verticies = (header >> 6) & 0xf; v_num = 0; if (((header >> 3) & 7) == 2) @@ -783,9 +936,9 @@ voodoo_fifo_thread(void *param) voodoo->verts[3].sT1 = cmdfifo_get_f_2(voodoo); } if (v_num) - voodoo_reg_writel(SST_sDrawTriCMD, 0, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, SST_sDrawTriCMD, 0); else - voodoo_reg_writel(SST_sBeginTriCMD, 0, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, SST_sBeginTriCMD, 0); v_num++; if (v_num == 3 && ((header >> 3) & 7) == 0) v_num = 0; @@ -819,7 +972,7 @@ voodoo_fifo_thread(void *param) if (voodoo->type >= VOODOO_BANSHEE && (addr & 0x3ff) == SST_swapbufferCMD) voodoo->cmd_written_fifo_2++; - voodoo_reg_writel(addr, val, voodoo); + voodoo_cmdfifo_reg_writel(voodoo, addr, val); } } From 51effd04531790e303aaa87678d37a8b4ec3d9d8 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 03:56:57 +0100 Subject: [PATCH 306/320] MDS v2 structures and decode/crypto utilities from Marisa-Chan's repository in preparation for MDS v2/MDX support implementation. --- src/cdrom/cdrom_image.c | 66 +- src/utils/CMakeLists.txt | 36 + src/utils/common/crc.c | 133 +++ src/utils/common/crc.h | 37 + src/utils/common/crypto.c | 1653 +++++++++++++++++++++++++++++ src/utils/common/crypto.h | 304 ++++++ src/utils/common/endian.c | 57 + src/utils/common/endian.h | 138 +++ src/utils/common/gfmul.c | 893 ++++++++++++++++ src/utils/common/gfmul.h | 78 ++ src/utils/common/password.h | 39 + src/utils/common/pkcs5.c | 631 +++++++++++ src/utils/common/pkcs5.h | 41 + src/utils/common/tcdefs.h | 167 +++ src/utils/common/xts.c | 627 +++++++++++ src/utils/common/xts.h | 79 ++ src/utils/crypto/aes.h | 215 ++++ src/utils/crypto/aes_x64.asm | 904 ++++++++++++++++ src/utils/crypto/aes_x86.asm | 644 +++++++++++ src/utils/crypto/aescrypt.c | 311 ++++++ src/utils/crypto/aeskey.c | 577 ++++++++++ src/utils/crypto/aesopt.h | 731 +++++++++++++ src/utils/crypto/aessmall.c | 921 ++++++++++++++++ src/utils/crypto/aessmall.h | 169 +++ src/utils/crypto/aessmall_x86.asm | 1444 +++++++++++++++++++++++++ src/utils/crypto/aestab.c | 427 ++++++++ src/utils/crypto/aestab.h | 174 +++ src/utils/crypto/bf_ecb.c | 113 ++ src/utils/crypto/bf_enc.c | 235 ++++ src/utils/crypto/bf_locl.h | 246 +++++ src/utils/crypto/bf_pi.h | 327 ++++++ src/utils/crypto/bf_skey.c | 118 ++ src/utils/crypto/blowfish.h | 120 +++ src/utils/crypto/c_ecb.c | 80 ++ src/utils/crypto/c_enc.c | 201 ++++ src/utils/crypto/c_skey.c | 164 +++ src/utils/crypto/cast.h | 113 ++ src/utils/crypto/cast_lcl.h | 225 ++++ src/utils/crypto/cast_s.h | 530 +++++++++ src/utils/crypto/des.c | 4 + src/utils/crypto/des.h | 292 +++++ src/utils/crypto/des_enc.c | 479 +++++++++ src/utils/crypto/des_locl.h | 518 +++++++++ src/utils/crypto/ecb3_enc.c | 84 ++ src/utils/crypto/podd.h | 77 ++ src/utils/crypto/rmd160.c | 510 +++++++++ src/utils/crypto/rmd160.h | 63 ++ src/utils/crypto/serpent.c | 940 ++++++++++++++++ src/utils/crypto/serpent.h | 19 + src/utils/crypto/set_key.c | 233 ++++ src/utils/crypto/set_key.h | 6 + src/utils/crypto/sha1.c | 280 +++++ src/utils/crypto/sha1.h | 80 ++ src/utils/crypto/sha2.c | 770 ++++++++++++++ src/utils/crypto/sha2.h | 155 +++ src/utils/crypto/sk.h | 206 ++++ src/utils/crypto/spr.h | 206 ++++ src/utils/crypto/twofish.c | 548 ++++++++++ src/utils/crypto/twofish.h | 56 + src/utils/crypto/whirlpool.c | 1058 ++++++++++++++++++ src/utils/crypto/whirlpool.h | 150 +++ src/utils/decode.c | 462 ++++++++ src/utils/defines.h | 13 + src/utils/edc.c | 78 ++ src/utils/edc.h | 8 + src/utils/mds.h | 188 ++++ src/utils/utils.c | 27 + 67 files changed, 21470 insertions(+), 8 deletions(-) create mode 100644 src/utils/common/crc.c create mode 100644 src/utils/common/crc.h create mode 100644 src/utils/common/crypto.c create mode 100644 src/utils/common/crypto.h create mode 100644 src/utils/common/endian.c create mode 100644 src/utils/common/endian.h create mode 100644 src/utils/common/gfmul.c create mode 100644 src/utils/common/gfmul.h create mode 100644 src/utils/common/password.h create mode 100644 src/utils/common/pkcs5.c create mode 100644 src/utils/common/pkcs5.h create mode 100644 src/utils/common/tcdefs.h create mode 100644 src/utils/common/xts.c create mode 100644 src/utils/common/xts.h create mode 100644 src/utils/crypto/aes.h create mode 100644 src/utils/crypto/aes_x64.asm create mode 100644 src/utils/crypto/aes_x86.asm create mode 100644 src/utils/crypto/aescrypt.c create mode 100644 src/utils/crypto/aeskey.c create mode 100644 src/utils/crypto/aesopt.h create mode 100644 src/utils/crypto/aessmall.c create mode 100644 src/utils/crypto/aessmall.h create mode 100644 src/utils/crypto/aessmall_x86.asm create mode 100644 src/utils/crypto/aestab.c create mode 100644 src/utils/crypto/aestab.h create mode 100644 src/utils/crypto/bf_ecb.c create mode 100644 src/utils/crypto/bf_enc.c create mode 100644 src/utils/crypto/bf_locl.h create mode 100644 src/utils/crypto/bf_pi.h create mode 100644 src/utils/crypto/bf_skey.c create mode 100644 src/utils/crypto/blowfish.h create mode 100644 src/utils/crypto/c_ecb.c create mode 100644 src/utils/crypto/c_enc.c create mode 100644 src/utils/crypto/c_skey.c create mode 100644 src/utils/crypto/cast.h create mode 100644 src/utils/crypto/cast_lcl.h create mode 100644 src/utils/crypto/cast_s.h create mode 100644 src/utils/crypto/des.c create mode 100644 src/utils/crypto/des.h create mode 100644 src/utils/crypto/des_enc.c create mode 100644 src/utils/crypto/des_locl.h create mode 100644 src/utils/crypto/ecb3_enc.c create mode 100644 src/utils/crypto/podd.h create mode 100644 src/utils/crypto/rmd160.c create mode 100644 src/utils/crypto/rmd160.h create mode 100644 src/utils/crypto/serpent.c create mode 100644 src/utils/crypto/serpent.h create mode 100644 src/utils/crypto/set_key.c create mode 100644 src/utils/crypto/set_key.h create mode 100644 src/utils/crypto/sha1.c create mode 100644 src/utils/crypto/sha1.h create mode 100644 src/utils/crypto/sha2.c create mode 100644 src/utils/crypto/sha2.h create mode 100644 src/utils/crypto/sk.h create mode 100644 src/utils/crypto/spr.h create mode 100644 src/utils/crypto/twofish.c create mode 100644 src/utils/crypto/twofish.h create mode 100644 src/utils/crypto/whirlpool.c create mode 100644 src/utils/crypto/whirlpool.h create mode 100644 src/utils/decode.c create mode 100644 src/utils/defines.h create mode 100644 src/utils/edc.c create mode 100644 src/utils/edc.h create mode 100644 src/utils/mds.h create mode 100644 src/utils/utils.c diff --git a/src/cdrom/cdrom_image.c b/src/cdrom/cdrom_image.c index 6452868abcf..6712912add5 100644 --- a/src/cdrom/cdrom_image.c +++ b/src/cdrom/cdrom_image.c @@ -175,6 +175,20 @@ typedef struct uint32_t trk_blocks_offs; } mds_sess_block_t; /* 24 bytes */ +/* MDF v2.01 session block. */ +typedef struct +{ + int64_t sess_start; + uint16_t sess_id; + uint8_t all_blocks_num; + uint8_t non_track_blocks_num; + uint16_t first_trk; + uint16_t last_trk; + uint32_t pad; + uint32_t trk_blocks_offs; + int64_t sess_end; +} mds_v2_sess_block_t; /* 24 bytes */ + typedef struct { uint8_t trk_mode; @@ -220,6 +234,17 @@ typedef struct uint32_t pad0; } mds_footer_t; /* 16 bytes */ +/* MDF v2.01 track footer block. */ +typedef struct +{ + uint32_t fn_offs; + uint32_t pad; /* Always wide */ + uint32_t pad0; + uint32_t pad1; + uint64_t trk_sectors; + uint64_t pad2; +} mds_v2_footer_t; /* 16 bytes */ + typedef struct { uint32_t type; @@ -1949,6 +1974,7 @@ image_load_mds(cd_image_t *img, const char *mdsfile) track_index_t *ci = NULL; track_file_t *tf = NULL; int is_viso = 0; + int version = 1; int last_t = -1; int error; char pathname[MAX_FILENAME_LENGTH]; @@ -1956,9 +1982,11 @@ image_load_mds(cd_image_t *img, const char *mdsfile) mds_hdr_t mds_hdr = { 0 }; mds_sess_block_t mds_sess_block = { 0 }; + mds_v2_sess_block_t mds_v2_sess_block = { 0 }; mds_trk_block_t mds_trk_block = { 0 }; mds_trk_ex_block_t mds_trk_ex_block = { 0 }; mds_footer_t mds_footer = { 0 }; + mds_v2_footer_t mds_v2_footer = { 0 }; mds_dpm_block_t mds_dpm_block = { 0 }; uint32_t mds_dpm_blocks_num = 0x00000000; uint32_t mds_dpm_block_offs = 0x00000000; @@ -2006,6 +2034,7 @@ image_load_mds(cd_image_t *img, const char *mdsfile) #else warning("\"%s\" is a Daemon Tools encrypted MDS which is not supported\n", mdsfile); #endif + version = 2; fclose(fp); return 0; } @@ -2083,9 +2112,18 @@ image_load_mds(cd_image_t *img, const char *mdsfile) } for (int s = 0; s < mds_hdr.sess_num; s++) { - fseek(fp, mds_hdr.sess_blocks_offs + (s * sizeof(mds_sess_block_t)), SEEK_SET); - if (fread(&mds_sess_block, 1, sizeof(mds_sess_block_t), fp) != sizeof(mds_sess_block_t)) - return 0; + if (version == 2) { + fseek(fp, mds_hdr.sess_blocks_offs + (s * sizeof(mds_v2_sess_block_t)), SEEK_SET); + if (fread(&mds_v2_sess_block, 1, sizeof(mds_v2_sess_block_t), fp) != sizeof(mds_v2_sess_block_t)) + return 0; + memcpy(&mds_sess_block, &mds_v2_sess_block, sizeof(mds_sess_block_t)); + mds_sess_block.sess_start = (int32_t) mds_v2_sess_block.sess_start; + mds_sess_block.sess_end = (int32_t) mds_v2_sess_block.sess_end; + } else { + fseek(fp, mds_hdr.sess_blocks_offs + (s * sizeof(mds_sess_block_t)), SEEK_SET); + if (fread(&mds_sess_block, 1, sizeof(mds_sess_block_t), fp) != sizeof(mds_sess_block_t)) + return 0; + } for (int t = 0; t < mds_sess_block.all_blocks_num; t++) { fseek(fp, mds_sess_block.trk_blocks_offs + (t * sizeof(mds_trk_block_t)), SEEK_SET); @@ -2127,9 +2165,17 @@ image_load_mds(cd_image_t *img, const char *mdsfile) uint32_t astart2 = mds_trk_block.start_sect + mds_trk_ex_block.trk_sectors; if (mds_trk_block.footer_offs != 0ULL) for (uint32_t ff = 0; ff < mds_trk_block.files_num; ff++) { - fseek(fp, mds_trk_block.footer_offs + (ff * sizeof(mds_footer_t)), SEEK_SET); - if (fread(&mds_footer, 1, sizeof(mds_footer_t), fp) != sizeof(mds_footer_t)) - return 0; + if (version == 2) { + fseek(fp, mds_trk_block.footer_offs + (ff * sizeof(mds_v2_footer_t)), SEEK_SET); + if (fread(&mds_v2_footer, 1, sizeof(mds_v2_footer_t), fp) != sizeof(mds_v2_footer_t)) + return 0; + memcpy(&mds_footer, &mds_v2_footer, sizeof(mds_footer)); + mds_footer.fn_is_wide = 1; + } else { + fseek(fp, mds_trk_block.footer_offs + (ff * sizeof(mds_footer_t)), SEEK_SET); + if (fread(&mds_footer, 1, sizeof(mds_footer_t), fp) != sizeof(mds_footer_t)) + return 0; + } uint16_t wfn[2048] = { 0 }; char fn[2048] = { 0 }; @@ -2149,7 +2195,10 @@ image_load_mds(cd_image_t *img, const char *mdsfile) break; } - if (!stricmp(fn, "*.mdf")) { + if (strlen(fn) == 0) + /* This is in MDX files - the file name string is empty. */ + strcpy(fn, mdsfile); + else if (!stricmp(fn, "*.mdf")) { strcpy(fn, mdsfile); fn[strlen(mdsfile) - 3] = 'm'; fn[strlen(mdsfile) - 2] = 'd'; @@ -2681,7 +2730,8 @@ image_open(cdrom_t *dev, const char *path) if (img != NULL) { int ret; const int is_cue = ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "CUE")); - const int is_mds = ((ext == 4) && !stricmp(path + strlen(path) - ext + 1, "MDS")); + const int is_mds = ((ext == 4) && (!stricmp(path + strlen(path) - ext + 1, "MDS") || + !stricmp(path + strlen(path) - ext + 1, "MDX"))); char n[1024] = { 0 }; sprintf(n, "CD-ROM %i Image", dev->id + 1); diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index bcbc7aafd5d..55525752bc1 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -16,12 +16,48 @@ # add_library(utils OBJECT + + # Core cJSON.c crc.c crc32.c + decode.c + edc.c fifo.c fifo8.c ini.c log.c random.c + utils.c + + # Common + common/crc.c + common/crypto.c + common/endian.c + common/gfmul.c + common/pkcs5.c + common/xts.c + + # Crypto + crypto/aescrypt.c + crypto/aeskey.c + crypto/aessmall.c + crypto/aestab.c + crypto/bf_ecb.c + crypto/bf_enc.c + crypto/bf_skey.c + crypto/c_ecb.c + crypto/c_enc.c + crypto/c_skey.c + crypto/des.c + crypto/des_enc.c + crypto/ecb3_enc.c + crypto/rmd160.c + crypto/serpent.c + crypto/set_key.c + crypto/sha1.c + crypto/sha2.c + crypto/twofish.c + crypto/whirlpool.c + ) diff --git a/src/utils/common/crc.c b/src/utils/common/crc.c new file mode 100644 index 00000000000..7e06b95b544 --- /dev/null +++ b/src/utils/common/crc.c @@ -0,0 +1,133 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#include "tcdefs.h" +#include "crc.h" +#include "../common/endian.h" + +#ifndef TC_MINIMIZE_CODE_SIZE + +/* CRC polynomial 0x04c11db7 */ +uint32_t crc_32_tab[]= +{ + 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, + 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, + 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, + 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, + 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, + 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, + 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, + 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, + 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, + 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, + 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, + 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, + 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, + 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, + 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, + 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, + 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, + 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, + 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, + 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, + 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, + 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, + 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, + 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, + 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, + 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, + 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, + 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, + 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, + 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, + 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, + 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d +}; + +uint32_t GetCrc32 (unsigned char *data, int length) +{ + uint32_t CRC = 0xffffffff; + + while (length--) + { + CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *data++) & 0xFF ]; + } + + return CRC ^ 0xffffffff; +} + +uint32_t crc32int (uint32_t *data) +{ + unsigned char *d = (unsigned char *) data; + uint32_t CRC = 0xffffffff; + + CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d++) & 0xFF ]; + CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d++) & 0xFF ]; + CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d++) & 0xFF ]; + return (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d) & 0xFF ] ^ 0xffffffff; +} + +#if BYTE_ORDER == LITTLE_ENDIAN +# define CRC_SELFTEST 0x6fcf9e13 +#else +# define CRC_SELFTEST 0xca87914d +#endif + +int crc32_selftests (void) +{ + int i; + uint32_t crc = 0xffffffff; + int bSuccess = 0; + + for (i = 0; i < (int)sizeof(crc_32_tab); i++) + crc = UPDC32 (((unsigned char *) crc_32_tab)[i], crc); + + bSuccess = CRC_SELFTEST == (crc ^ 0xffffffff); + + bSuccess &= GetCrc32 ((unsigned char *)crc_32_tab, sizeof crc_32_tab) == CRC_SELFTEST; + + return bSuccess; +} + +#else // TC_MINIMIZE_CODE_SIZE + +uint32_t GetCrc32 (unsigned char *data, int length) +{ + uint32_t r = 0xFFFFFFFFUL; + int i, b; + + for (i = 0; i < length; ++i) + { + r ^= data[i]; + for (b = 0; b < 8; ++b) + { + if ((unsigned __int8) r & 1) + r = (r >> 1) ^ 0xEDB88320UL; + else + r >>= 1; + } + } + + return r ^ 0xFFFFFFFFUL; +} + +int crc32_selftests () +{ + unsigned __int8 testData[32]; + unsigned __int8 i; + + for (i = 0; i < sizeof (testData); ++i) + testData[i] = i; + + return GetCrc32 (testData, sizeof (testData)) == 0x91267E8AUL; +} + +#endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/utils/common/crc.h b/src/utils/common/crc.h new file mode 100644 index 00000000000..0fef2a311ed --- /dev/null +++ b/src/utils/common/crc.h @@ -0,0 +1,37 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#ifndef TC_HEADER_CRC +#define TC_HEADER_CRC + +#include + +#include "tcdefs.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#define UPDC32(octet, crc)\ + (uint32_t)((crc_32_tab[(((uint32_t)(crc)) ^ ((unsigned char)(octet))) & 0xff] ^ (((uint32_t)(crc)) >> 8))) + +uint32_t GetCrc32 (unsigned char *data, int length); +uint32_t crc32int (uint32_t *data); +int crc32_selftests (void); + +extern uint32_t crc_32_tab[]; + +#if defined(__cplusplus) +} +#endif + +#endif // TC_HEADER_CRC diff --git a/src/utils/common/crypto.c b/src/utils/common/crypto.c new file mode 100644 index 00000000000..8edef29bbe9 --- /dev/null +++ b/src/utils/common/crypto.c @@ -0,0 +1,1653 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#include "tcdefs.h" +#include "crypto.h" +#include "xts.h" +#include "crc.h" +#include "../common/endian.h" +#include + +/* Update the following when adding a new cipher or EA: + + Crypto.h: + ID #define + MAX_EXPANDED_KEY #define + + Crypto.c: + Ciphers[] + EncryptionAlgorithms[] + CipherInit() + EncipherBlock() + DecipherBlock() + +*/ + +// Cipher configuration +static Cipher Ciphers[] = +{ +// Block Size Key Size Key Schedule Size +// ID Name (Bytes) (Bytes) (Bytes) + { AES256, "AES256", 16, 32, AES_KS }, + { AES192, "AES192", 16, 24, AES_KS }, + { AES128, "AES128", 16, 16, AES_KS }, + { BLOWFISH, "Blowfish", 8, 56, 4168 }, // Deprecated/legacy + { CAST, "CAST5", 8, 16, 128 }, // Deprecated/legacy + { DES56, "DES", 8, 7, 128 }, // Deprecated/legacy + { SERPENT, "Serpent", 16, 32, 140*4 }, + { TRIPLEDES,"Triple DES", 8, 8*3, 128*3 }, // Deprecated/legacy + { TWOFISH, "Twofish", 16, 32, TWOFISH_KS }, + { 0, 0, 0, 0, 0 } +}; + + +// Encryption algorithm configuration +// The following modes have been deprecated (legacy): LRW, CBC, INNER_CBC, OUTER_CBC +static EncryptionAlgorithm EncryptionAlgorithms[] = +{ + // Cipher(s) Modes FormatEnabled + + { { 0, 0 }, { 0, 0, 0, 0 }, 0 }, // Must be all-zero + { { AES256, 0 }, { XTS, LRW, CBC, 0 }, 1 }, + { { AES192, 0 }, { XTS, LRW, CBC, 0 }, 1 }, + { { AES128, 0 }, { XTS, LRW, CBC, 0 }, 1 }, + { { BLOWFISH, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy + { { CAST, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy + { { SERPENT, 0 }, { XTS, LRW, CBC, 0 }, 1 }, + { { TRIPLEDES, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy + { { TWOFISH, 0 }, { XTS, LRW, CBC, 0 }, 1 }, + { { TWOFISH, AES256, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, + { { SERPENT, TWOFISH, AES256, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, + { { AES256, SERPENT, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, + { { AES256, TWOFISH, SERPENT, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, + { { SERPENT, TWOFISH, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, + { { BLOWFISH, AES256, 0 }, { INNER_CBC, 0, 0, 0 }, 0 }, // Deprecated/legacy + { { SERPENT, BLOWFISH, AES256, 0 }, { INNER_CBC, 0, 0, 0 }, 0 }, // Deprecated/legacy + { { 0, 0 }, { 0, 0, 0, 0 }, 0 } // Must be all-zero + +}; + + + +// Hash algorithms +static Hash Hashes[] = +{ // ID Name Deprecated System Encryption + { RIPEMD160, "RIPEMD-160", 0, 1 }, + { SHA512, "SHA-512", 0, 0 }, + { WHIRLPOOL, "Whirlpool", 0, 0 }, + { SHA1, "SHA-1", 1, 0 }, // Deprecated/legacy + { 0, 0, 0 } +}; + +/* Return values: 0 = success, ERR_CIPHER_INIT_FAILURE (fatal), ERR_CIPHER_INIT_WEAK_KEY (non-fatal) */ +int CipherInit (int cipher, unsigned char *key, uint8_t *ks) +{ + int retVal = ERR_SUCCESS; + + switch (cipher) + { + case AES256: + if (aes_encrypt_key256 (key, (aes_encrypt_ctx *) ks) != EXIT_SUCCESS) + return ERR_CIPHER_INIT_FAILURE; + + if (aes_decrypt_key256 (key, (aes_decrypt_ctx *) (ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS) + return ERR_CIPHER_INIT_FAILURE; + break; + + case AES192: + if (aes_encrypt_key192 (key, (aes_encrypt_ctx *) ks) != EXIT_SUCCESS) + return ERR_CIPHER_INIT_FAILURE; + + if (aes_decrypt_key192 (key, (aes_decrypt_ctx *) (ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS) + return ERR_CIPHER_INIT_FAILURE; + break; + + case AES128: + if (aes_encrypt_key128 (key, (aes_encrypt_ctx *) ks) != EXIT_SUCCESS) + return ERR_CIPHER_INIT_FAILURE; + + if (aes_decrypt_key128 (key, (aes_decrypt_ctx *) (ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS) + return ERR_CIPHER_INIT_FAILURE; + break; + + case SERPENT: + serpent_set_key (key, CipherGetKeySize(SERPENT) * 8, ks); + break; + + case TWOFISH: + twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key, CipherGetKeySize(TWOFISH) * 8); + break; + + case BLOWFISH: + /* Deprecated/legacy */ + BF_set_key ((BF_KEY *)ks, CipherGetKeySize(BLOWFISH), key); + break; + + case DES56: + /* Deprecated/legacy */ + switch (des_key_sched ((des_cblock *) key, (struct des_ks_struct *) ks)) + { + case -1: + return ERR_CIPHER_INIT_FAILURE; + case -2: + retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error + break; + } + break; + + case CAST: + /* Deprecated/legacy */ + CAST_set_key((CAST_KEY *) ks, CipherGetKeySize(CAST), key); + break; + + case TRIPLEDES: + /* Deprecated/legacy */ + switch (des_key_sched ((des_cblock *) key, (struct des_ks_struct *) ks)) + { + case -1: + return ERR_CIPHER_INIT_FAILURE; + case -2: + retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error + break; + } + switch (des_key_sched ((des_cblock *) ((char*)(key)+8), (struct des_ks_struct *) (ks + CipherGetKeyScheduleSize (DES56)))) + { + case -1: + return ERR_CIPHER_INIT_FAILURE; + case -2: + retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error + break; + } + switch (des_key_sched ((des_cblock *) ((char*)(key)+16), (struct des_ks_struct *) (ks + CipherGetKeyScheduleSize (DES56) * 2))) + { + case -1: + return ERR_CIPHER_INIT_FAILURE; + case -2: + retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error + break; + } + + // Verify whether all three DES keys are mutually different + if (((*((int64_t *) key) ^ *((int64_t *) key+1)) & 0xFEFEFEFEFEFEFEFEULL) == 0 + || ((*((int64_t *) key+1) ^ *((int64_t *) key+2)) & 0xFEFEFEFEFEFEFEFEULL) == 0 + || ((*((int64_t *) key) ^ *((int64_t *) key+2)) & 0xFEFEFEFEFEFEFEFEULL) == 0) + retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error + + break; + + default: + // Unknown/wrong cipher ID + return ERR_CIPHER_INIT_FAILURE; + } + + return retVal; +} + +void EncipherBlock(int cipher, void *data, void *ks) +{ + switch (cipher) + { + case AES256: + case AES192: + case AES128: + aes_encrypt (data, data, ks); break; + case TWOFISH: twofish_encrypt (ks, data, data); break; + case SERPENT: serpent_encrypt (data, data, ks); break; + case BLOWFISH: BF_ecb_le_encrypt (data, data, ks, 1); break; // Deprecated/legacy + case DES56: des_encrypt (data, ks, 1); break; // Deprecated/legacy + case CAST: CAST_ecb_encrypt (data, data, ks, 1); break; // Deprecated/legacy + case TRIPLEDES: des_ecb3_encrypt (data, data, ks, // Deprecated/legacy + (void*)((char*) ks + CipherGetKeyScheduleSize (DES56)), (void*)((char*) ks + CipherGetKeyScheduleSize (DES56) * 2), 1); break; + default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID + } +} + +void DecipherBlock(int cipher, void *data, void *ks) +{ + switch (cipher) + { + case SERPENT: serpent_decrypt (data, data, ks); break; + case TWOFISH: twofish_decrypt (ks, data, data); break; + case AES256: + case AES192: + case AES128: + aes_decrypt (data, data, (void *) ((char *) ks + sizeof(aes_encrypt_ctx))); break; + case BLOWFISH: BF_ecb_le_encrypt (data, data, ks, 0); break; // Deprecated/legacy + case DES56: des_encrypt (data, ks, 0); break; // Deprecated/legacy + case CAST: CAST_ecb_encrypt (data, data, ks,0); break; // Deprecated/legacy + case TRIPLEDES: des_ecb3_encrypt (data, data, ks, // Deprecated/legacy + (void*)((char*) ks + CipherGetKeyScheduleSize (DES56)), + (void*)((char*) ks + CipherGetKeyScheduleSize (DES56) * 2), 0); break; + default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID + } +} + +// Ciphers support + +Cipher *CipherGet (int id) +{ + int i; + for (i = 0; Ciphers[i].Id != 0; i++) + if (Ciphers[i].Id == id) + return &Ciphers[i]; + + return NULL; +} + +char *CipherGetName (int cipherId) +{ + return CipherGet (cipherId) -> Name; +} + +int CipherGetBlockSize (int cipherId) +{ + return CipherGet (cipherId) -> BlockSize; +} + +int CipherGetKeySize (int cipherId) +{ + return CipherGet (cipherId) -> KeySize; +} + +int CipherGetKeyScheduleSize (int cipherId) +{ + return CipherGet (cipherId) -> KeyScheduleSize; +} + + +// Encryption algorithms support + +int EAGetFirst (void) +{ + return 1; +} + +// Returns number of EAs +int EAGetCount (void) +{ + int ea, count = 0; + + for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea)) + { + count++; + } + return count; +} + +int EAGetNext (int previousEA) +{ + int id = previousEA + 1; + if (EncryptionAlgorithms[id].Ciphers[0] != 0) return id; + return 0; +} + + +// Return values: 0 = success, ERR_CIPHER_INIT_FAILURE (fatal), ERR_CIPHER_INIT_WEAK_KEY (non-fatal) +int EAInit (int ea, unsigned char *key, uint8_t *ks) +{ + int c, retVal = ERR_SUCCESS; + + if (ea == 0) + return ERR_CIPHER_INIT_FAILURE; + + for (c = EAGetFirstCipher (ea); c != 0; c = EAGetNextCipher (ea, c)) + { + switch (CipherInit (c, key, ks)) + { + case ERR_CIPHER_INIT_FAILURE: + return ERR_CIPHER_INIT_FAILURE; + + case ERR_CIPHER_INIT_WEAK_KEY: + retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error + break; + } + + key += CipherGetKeySize (c); + ks += CipherGetKeyScheduleSize (c); + } + return retVal; +} + + +int EAInitMode (PCRYPTO_INFO ci) +{ + switch (ci->mode) + { + case XTS: + // Secondary key schedule + if (EAInit (ci->ea, ci->k2, ci->ks2) != ERR_SUCCESS) + return 0; + + /* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit + on the volume to be tweaked with zero tweaks (i.e. 512 bytes of the volume would be encrypted in ECB + mode). However, to create a TrueCrypt volume with such a weak key, each human being on Earth would have + to create approximately 11,378,125,361,078,862 (about eleven quadrillion) TrueCrypt volumes (provided + that the size of each of the volumes is 1024 terabytes). */ + break; + + case LRW: + switch (CipherGetBlockSize (EAGetFirstCipher (ci->ea))) + { + case 8: + /* Deprecated/legacy */ + return Gf64TabInit (ci->k2, &ci->gf_ctx); + + case 16: + return Gf128Tab64Init (ci->k2, &ci->gf_ctx); + + default: + TC_THROW_FATAL_EXCEPTION; + } + + break; + + case CBC: + case INNER_CBC: + case OUTER_CBC: + // The mode does not need to be initialized or is initialized elsewhere + return 1; + + default: + // Unknown/wrong ID + TC_THROW_FATAL_EXCEPTION; + } + return 1; +} + + +// Returns name of EA, cascaded cipher names are separated by hyphens +char *EAGetName (char *buf, int ea) +{ + int i = EAGetLastCipher(ea); + strcpy (buf, (i != 0) ? CipherGetName (i) : "?"); + + while ((i = EAGetPreviousCipher(ea, i))) + { + strcat (buf, "-"); + strcat (buf, CipherGetName (i)); + } + + return buf; +} + + +int EAGetByName (char *name) +{ + int ea = EAGetFirst (); + char n[128]; + + do + { + EAGetName (n, ea); + if (strcmp (n, name) == 0) + return ea; + } + while ((ea = EAGetNext (ea))); + + return 0; +} + +// Returns sum of key sizes of all ciphers of the EA (in bytes) +int EAGetKeySize (int ea) +{ + int i = EAGetFirstCipher (ea); + int size = CipherGetKeySize (i); + + while ((i = EAGetNextCipher (ea, i))) + { + size += CipherGetKeySize (i); + } + + return size; +} + + +// Returns the first mode of operation of EA +int EAGetFirstMode (int ea) +{ + return (EncryptionAlgorithms[ea].Modes[0]); +} + + +int EAGetNextMode (int ea, int previousModeId) +{ + int c, i = 0; + while ((c = EncryptionAlgorithms[ea].Modes[i++])) + { + if (c == previousModeId) + return EncryptionAlgorithms[ea].Modes[i]; + } + + return 0; +} + + +// Returns the name of the mode of operation of the whole EA +char *EAGetModeName (int ea, int mode, int capitalLetters) +{ + switch (mode) + { + case XTS: + + return "XTS"; + + case LRW: + + /* Deprecated/legacy */ + + return "LRW"; + + case CBC: + { + /* Deprecated/legacy */ + + char eaName[100]; + EAGetName (eaName, ea); + + if (strcmp (eaName, "Triple DES") == 0) + return capitalLetters ? "Outer-CBC" : "outer-CBC"; + + return "CBC"; + } + + case OUTER_CBC: + + /* Deprecated/legacy */ + + return capitalLetters ? "Outer-CBC" : "outer-CBC"; + + case INNER_CBC: + + /* Deprecated/legacy */ + + return capitalLetters ? "Inner-CBC" : "inner-CBC"; + + } + return "[unknown]"; +} + + + +// Returns sum of key schedule sizes of all ciphers of the EA +int EAGetKeyScheduleSize (int ea) +{ + int i = EAGetFirstCipher(ea); + int size = CipherGetKeyScheduleSize (i); + + while ((i = EAGetNextCipher(ea, i))) + { + size += CipherGetKeyScheduleSize (i); + } + + return size; +} + + +// Returns the largest key size needed by an EA for the specified mode of operation +int EAGetLargestKeyForMode (int mode) +{ + int ea, key = 0; + + for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea)) + { + if (!EAIsModeSupported (ea, mode)) + continue; + + if (EAGetKeySize (ea) >= key) + key = EAGetKeySize (ea); + } + return key; +} + + +// Returns the largest key needed by any EA for any mode +int EAGetLargestKey (void) +{ + int ea, key = 0; + + for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea)) + { + if (EAGetKeySize (ea) >= key) + key = EAGetKeySize (ea); + } + + return key; +} + + +// Returns number of ciphers in EA +int EAGetCipherCount (int ea) +{ + int i = 0; + while (EncryptionAlgorithms[ea].Ciphers[i++]); + + return i - 1; +} + + +int EAGetFirstCipher (int ea) +{ + return EncryptionAlgorithms[ea].Ciphers[0]; +} + + +int EAGetLastCipher (int ea) +{ + int c, i = 0; + while ((c = EncryptionAlgorithms[ea].Ciphers[i++])); + + return EncryptionAlgorithms[ea].Ciphers[i - 2]; +} + + +int EAGetNextCipher (int ea, int previousCipherId) +{ + int c, i = 0; + while ((c = EncryptionAlgorithms[ea].Ciphers[i++])) + { + if (c == previousCipherId) + return EncryptionAlgorithms[ea].Ciphers[i]; + } + + return 0; +} + + +int EAGetPreviousCipher (int ea, int previousCipherId) +{ + int c, i = 0; + + if (EncryptionAlgorithms[ea].Ciphers[i++] == previousCipherId) + return 0; + + while ((c = EncryptionAlgorithms[ea].Ciphers[i++])) + { + if (c == previousCipherId) + return EncryptionAlgorithms[ea].Ciphers[i - 2]; + } + + return 0; +} + + +int EAIsFormatEnabled (int ea) +{ + return EncryptionAlgorithms[ea].FormatEnabled; +} + + +// Returns TRUE if the mode of operation is supported for the encryption algorithm +int EAIsModeSupported (int ea, int testedMode) +{ + int mode; + + for (mode = EAGetFirstMode (ea); mode != 0; mode = EAGetNextMode (ea, mode)) + { + if (mode == testedMode) + return 1; + } + return 0; +} + + +Hash *HashGet (int id) +{ + int i; + for (i = 0; Hashes[i].Id != 0; i++) + if (Hashes[i].Id == id) + return &Hashes[i]; + + return 0; +} + + +int HashGetIdByName (char *name) +{ + int i; + for (i = 0; Hashes[i].Id != 0; i++) + if (strcmp (Hashes[i].Name, name) == 0) + return Hashes[i].Id; + + return 0; +} + + +char *HashGetName (int hashId) +{ + return HashGet (hashId) -> Name; +} + + +int HashIsDeprecated (int hashId) +{ + return HashGet (hashId) -> Deprecated; +} + + +PCRYPTO_INFO crypto_open (void) +{ + /* Do the crt allocation */ + PCRYPTO_INFO cryptoInfo = (PCRYPTO_INFO) TCalloc (sizeof (CRYPTO_INFO)); + memset (cryptoInfo, 0, sizeof (CRYPTO_INFO)); + + if (cryptoInfo == NULL) + return NULL; + + cryptoInfo->ea = -1; + return cryptoInfo; +} + +void crypto_loadkey (PKEY_INFO keyInfo, char *lpszUserKey, int nUserKeyLen) +{ + keyInfo->keyLength = nUserKeyLen; + burn (keyInfo->userKey, sizeof (keyInfo->userKey)); + memcpy (keyInfo->userKey, lpszUserKey, nUserKeyLen); +} + +void crypto_close (PCRYPTO_INFO cryptoInfo) +{ + if (cryptoInfo != NULL) + { + burn (cryptoInfo, sizeof (CRYPTO_INFO)); + TCfree (cryptoInfo); + } +} + + +#ifndef TC_NO_COMPILER_INT64 +void Xor128 (uint64_t *a, uint64_t *b) +{ + *a++ ^= *b++; + *a ^= *b; +} + + +void Xor64 (uint64_t *a, uint64_t *b) +{ + *a ^= *b; +} + + +void EncryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) +{ + /* Deprecated/legacy */ + + int cipher = EAGetFirstCipher (cryptoInfo->ea); + int cipherCount = EAGetCipherCount (cryptoInfo->ea); + uint8_t *p = buffer; + uint8_t *ks = cryptoInfo->ks; + uint8_t i[8]; + uint8_t t[16]; + uint64_t b; + + *(uint64_t *)i = BE64(blockIndex); + + if (length % 16) + TC_THROW_FATAL_EXCEPTION; + + // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). + + for (b = 0; b < length >> 4; b++) + { + Gf128MulBy64Tab (i, t, &cryptoInfo->gf_ctx); + Xor128 ((uint64_t *)p, (uint64_t *)t); + + if (cipherCount > 1) + { + // Cipher cascade + for (cipher = EAGetFirstCipher (cryptoInfo->ea); + cipher != 0; + cipher = EAGetNextCipher (cryptoInfo->ea, cipher)) + { + EncipherBlock (cipher, p, ks); + ks += CipherGetKeyScheduleSize (cipher); + } + ks = cryptoInfo->ks; + } + else + { + EncipherBlock (cipher, p, ks); + } + + Xor128 ((uint64_t *)p, (uint64_t *)t); + + p += 16; + + if (i[7] != 0xff) + i[7]++; + else + *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); + } + + FAST_ERASE64 (t, sizeof(t)); +} + + +void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) +{ + /* Deprecated/legacy */ + + int cipher = EAGetFirstCipher (cryptoInfo->ea); + uint8_t *p = buffer; + uint8_t *ks = cryptoInfo->ks; + uint8_t i[8]; + uint8_t t[8]; + uint64_t b; + + *(uint64_t *)i = BE64(blockIndex); + + if (length % 8) + TC_THROW_FATAL_EXCEPTION; + + for (b = 0; b < length >> 3; b++) + { + Gf64MulTab (i, t, &cryptoInfo->gf_ctx); + Xor64 ((uint64_t *)p, (uint64_t *)t); + + EncipherBlock (cipher, p, ks); + + Xor64 ((uint64_t *)p, (uint64_t *)t); + + p += 8; + + if (i[7] != 0xff) + i[7]++; + else + *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); + } + + FAST_ERASE64 (t, sizeof(t)); +} + + +void DecryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) +{ + /* Deprecated/legacy */ + + int cipher = EAGetFirstCipher (cryptoInfo->ea); + int cipherCount = EAGetCipherCount (cryptoInfo->ea); + uint8_t *p = buffer; + uint8_t *ks = cryptoInfo->ks; + uint8_t i[8]; + uint8_t t[16]; + uint64_t b; + + *(uint64_t *)i = BE64(blockIndex); + + if (length % 16) + TC_THROW_FATAL_EXCEPTION; + + // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). + + for (b = 0; b < length >> 4; b++) + { + Gf128MulBy64Tab (i, t, &cryptoInfo->gf_ctx); + Xor128 ((uint64_t *)p, (uint64_t *)t); + + if (cipherCount > 1) + { + // Cipher cascade + ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea); + + for (cipher = EAGetLastCipher (cryptoInfo->ea); + cipher != 0; + cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher)) + { + ks -= CipherGetKeyScheduleSize (cipher); + DecipherBlock (cipher, p, ks); + } + } + else + { + DecipherBlock (cipher, p, ks); + } + + Xor128 ((uint64_t *)p, (uint64_t *)t); + + p += 16; + + if (i[7] != 0xff) + i[7]++; + else + *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); + } + + FAST_ERASE64 (t, sizeof(t)); +} + + + +void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) +{ + /* Deprecated/legacy */ + + int cipher = EAGetFirstCipher (cryptoInfo->ea); + uint8_t *p = buffer; + uint8_t *ks = cryptoInfo->ks; + uint8_t i[8]; + uint8_t t[8]; + uint64_t b; + + *(uint64_t *)i = BE64(blockIndex); + + if (length % 8) + TC_THROW_FATAL_EXCEPTION; + + for (b = 0; b < length >> 3; b++) + { + Gf64MulTab (i, t, &cryptoInfo->gf_ctx); + Xor64 ((uint64_t *)p, (uint64_t *)t); + + DecipherBlock (cipher, p, ks); + + Xor64 ((uint64_t *)p, (uint64_t *)t); + + p += 8; + + if (i[7] != 0xff) + i[7]++; + else + *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); + } + + FAST_ERASE64 (t, sizeof(t)); +} + + +// Initializes IV and whitening values for sector encryption/decryption in CBC mode. +// IMPORTANT: This function has been deprecated (legacy). +void +InitSectorIVAndWhitening (uint64_t unitNo, + int blockSize, + uint32_t *iv, + uint64_t *ivSeed, + uint32_t *whitening) +{ + + /* IMPORTANT: This function has been deprecated (legacy) */ + + uint64_t iv64[4]; + uint32_t *iv32 = (uint32_t *) iv64; + + iv64[0] = ivSeed[0] ^ LE64(unitNo); + iv64[1] = ivSeed[1] ^ LE64(unitNo); + iv64[2] = ivSeed[2] ^ LE64(unitNo); + if (blockSize == 16) + { + iv64[3] = ivSeed[3] ^ LE64(unitNo); + } + + iv[0] = iv32[0]; + iv[1] = iv32[1]; + + switch (blockSize) + { + case 16: + + // 128-bit block + + iv[2] = iv32[2]; + iv[3] = iv32[3]; + + whitening[0] = LE32( crc32int ( &iv32[4] ) ^ crc32int ( &iv32[7] ) ); + whitening[1] = LE32( crc32int ( &iv32[5] ) ^ crc32int ( &iv32[6] ) ); + break; + + case 8: + + // 64-bit block + + whitening[0] = LE32( crc32int ( &iv32[2] ) ^ crc32int ( &iv32[5] ) ); + whitening[1] = LE32( crc32int ( &iv32[3] ) ^ crc32int ( &iv32[4] ) ); + break; + + default: + TC_THROW_FATAL_EXCEPTION; + } +} + + +// EncryptBufferCBC (deprecated/legacy) +// +// data: data to be encrypted +// len: number of bytes to encrypt (must be divisible by the largest cipher block size) +// ks: scheduled key +// iv: IV +// whitening: whitening constants +// ea: outer-CBC cascade ID (0 = CBC/inner-CBC) +// cipher: CBC/inner-CBC cipher ID (0 = outer-CBC) + +static void +EncryptBufferCBC (uint32_t *data, + unsigned int len, + uint8_t *ks, + uint32_t *iv, + uint32_t *whitening, + int ea, + int cipher) +{ + /* IMPORTANT: This function has been deprecated (legacy) */ + + uint32_t bufIV[4] = { 0 }; + uint64_t i; + int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher); + + if (len % blockSize) + TC_THROW_FATAL_EXCEPTION; + + // IV + bufIV[0] = iv[0]; + bufIV[1] = iv[1]; + if (blockSize == 16) + { + bufIV[2] = iv[2]; + bufIV[3] = iv[3]; + } + + // Encrypt each block + for (i = 0; i < len/blockSize; i++) + { + // CBC + data[0] ^= bufIV[0]; + data[1] ^= bufIV[1]; + if (blockSize == 16) + { + data[2] ^= bufIV[2]; + data[3] ^= bufIV[3]; + } + + if (ea != 0) + { + // Outer-CBC + for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher)) + { + EncipherBlock (cipher, data, ks); + ks += CipherGetKeyScheduleSize (cipher); + } + ks -= EAGetKeyScheduleSize (ea); + } + else + { + // CBC/inner-CBC + EncipherBlock (cipher, data, ks); + } + + // CBC + bufIV[0] = data[0]; + bufIV[1] = data[1]; + if (blockSize == 16) + { + bufIV[2] = data[2]; + bufIV[3] = data[3]; + } + + // Whitening + data[0] ^= whitening[0]; + data[1] ^= whitening[1]; + if (blockSize == 16) + { + data[2] ^= whitening[0]; + data[3] ^= whitening[1]; + } + + data += blockSize / sizeof(*data); + } +} + + +// DecryptBufferCBC (deprecated/legacy) +// +// data: data to be decrypted +// len: number of bytes to decrypt (must be divisible by the largest cipher block size) +// ks: scheduled key +// iv: IV +// whitening: whitening constants +// ea: outer-CBC cascade ID (0 = CBC/inner-CBC) +// cipher: CBC/inner-CBC cipher ID (0 = outer-CBC) + +static void +DecryptBufferCBC (uint32_t *data, + unsigned int len, + uint8_t *ks, + uint32_t *iv, + uint32_t *whitening, + int ea, + int cipher) +{ + + /* IMPORTANT: This function has been deprecated (legacy) */ + + uint32_t bufIV[4] = { 0 }; + uint64_t i; + uint32_t ct[4]; + int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher); + + if (len % blockSize) + TC_THROW_FATAL_EXCEPTION; + + // IV + bufIV[0] = iv[0]; + bufIV[1] = iv[1]; + if (blockSize == 16) + { + bufIV[2] = iv[2]; + bufIV[3] = iv[3]; + } + + // Decrypt each block + for (i = 0; i < len/blockSize; i++) + { + // Dewhitening + if (whitening) + { + data[0] ^= whitening[0]; + data[1] ^= whitening[1]; + if (blockSize == 16) + { + data[2] ^= whitening[0]; + data[3] ^= whitening[1]; + } + + // CBC + ct[0] = data[0]; + ct[1] = data[1]; + if (blockSize == 16) + { + ct[2] = data[2]; + ct[3] = data[3]; + } + } + + if (ea != 0) + { + // Outer-CBC + ks += EAGetKeyScheduleSize (ea); + for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher)) + { + ks -= CipherGetKeyScheduleSize (cipher); + DecipherBlock (cipher, data, ks); + } + } + else + { + // CBC/inner-CBC + DecipherBlock (cipher, data, ks); + } + + // CBC + data[0] ^= bufIV[0]; + data[1] ^= bufIV[1]; + if (whitening) + { + bufIV[0] = ct[0]; + bufIV[1] = ct[1]; + } + if (blockSize == 16) + { + data[2] ^= bufIV[2]; + data[3] ^= bufIV[3]; + if (whitening) + { + bufIV[2] = ct[2]; + bufIV[3] = ct[3]; + } + } + + data += blockSize / sizeof(*data); + } +} +#endif // #ifndef TC_NO_COMPILER_INT64 + + +// EncryptBuffer +// +// buf: data to be encrypted +// len: number of bytes to encrypt; must be divisible by the block size (for cascaded +// ciphers divisible by the largest block size used within the cascade) +void EncryptBuffer (uint8_t *buf, + TC_LARGEST_COMPILER_UINT len, + PCRYPTO_INFO cryptoInfo) +{ + switch (cryptoInfo->mode) + { + case XTS: + { + uint8_t *ks = cryptoInfo->ks; + uint8_t *ks2 = cryptoInfo->ks2; + UINT64_STRUCT dataUnitNo; + int cipher; + + // When encrypting/decrypting a buffer (typically a volume header) the sequential number + // of the first XTS data unit in the buffer is always 0 and the start of the buffer is + // always considered aligned with the start of a data unit. + dataUnitNo.LowPart = 0; + dataUnitNo.HighPart = 0; + + for (cipher = EAGetFirstCipher (cryptoInfo->ea); + cipher != 0; + cipher = EAGetNextCipher (cryptoInfo->ea, cipher)) + { + EncryptBufferXTS (buf, len, &dataUnitNo, 0, ks, ks2, cipher); + + ks += CipherGetKeyScheduleSize (cipher); + ks2 += CipherGetKeyScheduleSize (cipher); + } + } + break; + +#ifndef TC_NO_COMPILER_INT64 + case LRW: + + /* Deprecated/legacy */ + + switch (CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))) + { + case 8: + EncryptBufferLRW64 ((uint8_t *)buf, (uint64_t) len, 1, cryptoInfo); + break; + + case 16: + EncryptBufferLRW128 ((uint8_t *)buf, (uint64_t) len, 1, cryptoInfo); + break; + + default: + TC_THROW_FATAL_EXCEPTION; + } + break; + + case CBC: + case INNER_CBC: + { + /* Deprecated/legacy */ + + uint8_t *ks = cryptoInfo->ks; + int cipher; + + for (cipher = EAGetFirstCipher (cryptoInfo->ea); + cipher != 0; + cipher = EAGetNextCipher (cryptoInfo->ea, cipher)) + { + EncryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + ks, + (uint32_t *) cryptoInfo->k2, + (uint32_t *) &cryptoInfo->k2[8], + 0, + cipher); + + ks += CipherGetKeyScheduleSize (cipher); + } + } + break; + + case OUTER_CBC: + + /* Deprecated/legacy */ + + EncryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + cryptoInfo->ks, + (uint32_t *) cryptoInfo->k2, + (uint32_t *) &cryptoInfo->k2[8], + cryptoInfo->ea, + 0); + + break; +#endif // #ifndef TC_NO_COMPILER_INT64 + + default: + // Unknown/wrong ID + TC_THROW_FATAL_EXCEPTION; + } +} + +// #ifndef TC_NO_COMPILER_INT64 +// // Converts a data unit number to the index of the first LRW block in the data unit. +// // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). +// uint64_t DataUnit2LRWIndex (uint64_t dataUnit, int blockSize, PCRYPTO_INFO ci) +// { +// /* Deprecated/legacy */ + +// if (ci->hiddenVolume) +// dataUnit -= ci->hiddenVolumeOffset / ENCRYPTION_DATA_UNIT_SIZE; +// else +// dataUnit -= HEADER_SIZE / ENCRYPTION_DATA_UNIT_SIZE; // Compensate for the volume header size + +// switch (blockSize) +// { +// case 8: +// return (dataUnit << 6) | 1; + +// case 16: +// return (dataUnit << 5) | 1; + +// default: +// TC_THROW_FATAL_EXCEPTION; +// } + +// return 0; +// } +// #endif // #ifndef TC_NO_COMPILER_INT64 + + +// // buf: data to be encrypted +// // unitNo: sequential number of the data unit with which the buffer starts +// // nbrUnits: number of data units in the buffer +// void EncryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci) +// { +// int ea = ci->ea; +// uint8_t *ks = ci->ks; +// uint8_t *ks2 = ci->ks2; +// int cipher; + +// #ifndef TC_NO_COMPILER_INT64 +// void *iv = ci->k2; // Deprecated/legacy +// uint64_t unitNo = structUnitNo->Value; +// uint64_t *iv64 = (uint64_t *) iv; // Deprecated/legacy +// uint32_t sectorIV[4]; // Deprecated/legacy +// uint32_t secWhitening[2]; // Deprecated/legacy +// #endif + +// switch (ci->mode) +// { +// case XTS: +// for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher)) +// { +// EncryptBufferXTS (buf, +// nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, +// structUnitNo, +// 0, +// ks, +// ks2, +// cipher); + +// ks += CipherGetKeyScheduleSize (cipher); +// ks2 += CipherGetKeyScheduleSize (cipher); +// } +// break; + +// #ifndef TC_NO_COMPILER_INT64 +// case LRW: + +// /* Deprecated/legacy */ + +// switch (CipherGetBlockSize (EAGetFirstCipher (ea))) +// { +// case 8: +// EncryptBufferLRW64 (buf, +// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, +// DataUnit2LRWIndex (unitNo, 8, ci), +// ci); +// break; + +// case 16: +// EncryptBufferLRW128 (buf, +// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, +// DataUnit2LRWIndex (unitNo, 16, ci), +// ci); +// break; + +// default: +// TC_THROW_FATAL_EXCEPTION; +// } +// break; + +// case CBC: +// case INNER_CBC: + +// /* Deprecated/legacy */ + +// while (nbrUnits--) +// { +// for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher)) +// { +// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening); + +// EncryptBufferCBC ((uint32_t *) buf, +// ENCRYPTION_DATA_UNIT_SIZE, +// ks, +// sectorIV, +// secWhitening, +// 0, +// cipher); + +// ks += CipherGetKeyScheduleSize (cipher); +// } +// ks -= EAGetKeyScheduleSize (ea); +// buf += ENCRYPTION_DATA_UNIT_SIZE; +// unitNo++; +// } +// break; + +// case OUTER_CBC: + +// /* Deprecated/legacy */ + +// while (nbrUnits--) +// { +// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (EAGetFirstCipher (ea)), sectorIV, iv64, secWhitening); + +// EncryptBufferCBC ((uint32_t *) buf, +// ENCRYPTION_DATA_UNIT_SIZE, +// ks, +// sectorIV, +// secWhitening, +// ea, +// 0); + +// buf += ENCRYPTION_DATA_UNIT_SIZE; +// unitNo++; +// } +// break; +// #endif // #ifndef TC_NO_COMPILER_INT64 + +// default: +// // Unknown/wrong ID +// TC_THROW_FATAL_EXCEPTION; +// } +// } + +// DecryptBuffer +// +// buf: data to be decrypted +// len: number of bytes to decrypt; must be divisible by the block size (for cascaded +// ciphers divisible by the largest block size used within the cascade) +void DecryptBuffer (uint8_t *buf, + TC_LARGEST_COMPILER_UINT len, + uint32_t secSz, + uint64_t secN, + uint8_t flags, + PCRYPTO_INFO cryptoInfo) +{ + + void *iv = cryptoInfo->k2; + uint32_t sectorIV[4]; + uint32_t secWhitening[2]; + uint64_t *iv64 = (uint64_t *) iv; + + switch (cryptoInfo->mode) + { + case XTS: + { + uint8_t *ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea); + uint8_t *ks2 = cryptoInfo->ks2 + EAGetKeyScheduleSize (cryptoInfo->ea); + UINT64_STRUCT dataUnitNo; + int cipher; + + // When encrypting/decrypting a buffer (typically a volume header) the sequential number + // of the first XTS data unit in the buffer is always 0 and the start of the buffer is + // always considered aligned with the start of the data unit 0. + dataUnitNo.Value = secN; + + for (cipher = EAGetLastCipher (cryptoInfo->ea); + cipher != 0; + cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher)) + { + ks -= CipherGetKeyScheduleSize (cipher); + ks2 -= CipherGetKeyScheduleSize (cipher); + DecryptBufferXTS (buf, len, &dataUnitNo, 0, ks, ks2, cipher); + } + } + break; + +#ifndef TC_NO_COMPILER_INT64 + case LRW: + { + uint32_t n = 0; + if (flags & 2) + n = secN; + + switch (CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))) + { + case 8: + DecryptBufferLRW64 (buf, (uint64_t) len, 1 + (secSz / 8) * n, cryptoInfo); + break; + + case 16: + DecryptBufferLRW128 (buf, (uint64_t) len, 1 + (secSz / 16) * n, cryptoInfo); + break; + + default: + TC_THROW_FATAL_EXCEPTION; + } + break; + } + + case CBC: + case INNER_CBC: + { + /* Deprecated/legacy */ + + uint8_t *ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea); + int cipher; + for (cipher = EAGetLastCipher (cryptoInfo->ea); + cipher != 0; + cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher)) + { + ks -= CipherGetKeyScheduleSize (cipher); + + if (flags & 1) + { + DecryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + ks, + (uint32_t *) cryptoInfo->k2, + NULL, + 0, + cipher); + } + else if (flags & 2) + { + InitSectorIVAndWhitening (secN, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening); + DecryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + cryptoInfo->ks, + sectorIV, + secWhitening, + 0, + cipher); + } + else + { + DecryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + ks, + (uint32_t *) cryptoInfo->k2, + (uint32_t *) &cryptoInfo->k2[8], + 0, + cipher); + } + } + } + break; + + case OUTER_CBC: + if (flags & 1) + { + DecryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + cryptoInfo->ks, + (uint32_t *) cryptoInfo->k2, + NULL, + cryptoInfo->ea, + 0); + } + else if (flags & 2) + { + InitSectorIVAndWhitening (secN, CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea)), sectorIV, iv64, secWhitening); + DecryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + cryptoInfo->ks, + sectorIV, + secWhitening, + cryptoInfo->ea, + 0); + } + else + { + DecryptBufferCBC ((uint32_t *) buf, + (unsigned int) len, + cryptoInfo->ks, + (uint32_t *) cryptoInfo->k2, + (uint32_t *) &cryptoInfo->k2[8], + cryptoInfo->ea, + 0); + } + + break; +#endif // #ifndef TC_NO_COMPILER_INT64 + + default: + // Unknown/wrong ID + TC_THROW_FATAL_EXCEPTION; + } +} + +// // buf: data to be decrypted +// // unitNo: sequential number of the data unit with which the buffer starts +// // nbrUnits: number of data units in the buffer +// void DecryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci) +// { +// int ea = ci->ea; +// uint8_t *ks = ci->ks; +// uint8_t *ks2 = ci->ks2; +// int cipher; + +// #ifndef TC_NO_COMPILER_INT64 +// void *iv = ci->k2; // Deprecated/legacy +// uint64_t unitNo = structUnitNo->Value; +// uint64_t *iv64 = (uint64_t *) iv; // Deprecated/legacy +// uint32_t sectorIV[4]; // Deprecated/legacy +// uint32_t secWhitening[2]; // Deprecated/legacy +// #endif // #ifndef TC_NO_COMPILER_INT64 + + +// switch (ci->mode) +// { +// case XTS: +// ks += EAGetKeyScheduleSize (ea); +// ks2 += EAGetKeyScheduleSize (ea); + +// for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher)) +// { +// ks -= CipherGetKeyScheduleSize (cipher); +// ks2 -= CipherGetKeyScheduleSize (cipher); + +// DecryptBufferXTS (buf, +// nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, +// structUnitNo, +// 0, +// ks, +// ks2, +// cipher); +// } +// break; + +// #ifndef TC_NO_COMPILER_INT64 +// case LRW: + +// /* Deprecated/legacy */ + +// switch (CipherGetBlockSize (EAGetFirstCipher (ea))) +// { +// case 8: +// DecryptBufferLRW64 (buf, +// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, +// DataUnit2LRWIndex (unitNo, 8, ci), +// ci); +// break; + +// case 16: +// DecryptBufferLRW128 (buf, +// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, +// DataUnit2LRWIndex (unitNo, 16, ci), +// ci); +// break; + +// default: +// TC_THROW_FATAL_EXCEPTION; +// } +// break; + +// case CBC: +// case INNER_CBC: + +// /* Deprecated/legacy */ + +// while (nbrUnits--) +// { +// ks += EAGetKeyScheduleSize (ea); +// for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher)) +// { +// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening); + +// ks -= CipherGetKeyScheduleSize (cipher); + +// DecryptBufferCBC ((uint32_t *) buf, +// ENCRYPTION_DATA_UNIT_SIZE, +// ks, +// sectorIV, +// secWhitening, +// 0, +// cipher); +// } +// buf += ENCRYPTION_DATA_UNIT_SIZE; +// unitNo++; +// } +// break; + +// case OUTER_CBC: + +// /* Deprecated/legacy */ + +// while (nbrUnits--) +// { +// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (EAGetFirstCipher (ea)), sectorIV, iv64, secWhitening); + +// DecryptBufferCBC ((uint32_t *) buf, +// ENCRYPTION_DATA_UNIT_SIZE, +// ks, +// sectorIV, +// secWhitening, +// ea, +// 0); + +// buf += ENCRYPTION_DATA_UNIT_SIZE; +// unitNo++; +// } +// break; +// #endif // #ifndef TC_NO_COMPILER_INT64 + +// default: +// // Unknown/wrong ID +// TC_THROW_FATAL_EXCEPTION; +// } +// } + + +// Returns the maximum number of bytes necessary to be generated by the PBKDF2 (PKCS #5) +int GetMaxPkcs5OutSize (void) +{ + int size = 32; + +#ifndef max +#define max(a,b) (((a) > (b)) ? (a) : (b)) +#endif + + size = max (size, EAGetLargestKeyForMode (XTS) * 2); // Sizes of primary + secondary keys + + size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (LRW)); // Deprecated/legacy + size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (CBC)); // Deprecated/legacy + size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (OUTER_CBC)); // Deprecated/legacy + size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (INNER_CBC)); // Deprecated/legacy + + return size; +} diff --git a/src/utils/common/crypto.h b/src/utils/common/crypto.h new file mode 100644 index 00000000000..8c3960e0873 --- /dev/null +++ b/src/utils/common/crypto.h @@ -0,0 +1,304 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +/* Update the following when adding a new cipher or EA: + + Crypto.h: + ID #define + MAX_EXPANDED_KEY #define + + Crypto.c: + Ciphers[] + EncryptionAlgorithms[] + CipherInit() + EncipherBlock() + DecipherBlock() + +*/ + +#ifndef CRYPTO_H +#define CRYPTO_H + +#include +#include "tcdefs.h" + +#ifdef __cplusplus +extern "C" { +#endif + +// Encryption data unit size, which may differ from the sector size and must always be 512 +#define ENCRYPTION_DATA_UNIT_SIZE 512 + +// Size of the salt (in bytes) +#define PKCS5_SALT_SIZE 64 + +// Size of the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode) +#define MASTER_KEYDATA_SIZE 256 + +// Size of the deprecated volume header item containing either an IV seed (CBC mode) or tweak key (LRW mode) +#define LEGACY_VOL_IV_SIZE 32 + +// Volume header byte offsets +#define HEADER_SALT_OFFSET 0 +#define HEADER_ENCRYPTED_DATA_OFFSET PKCS5_SALT_SIZE +#define HEADER_MASTER_KEYDATA_OFFSET 256 + +// Volume header sizes +#define HEADER_SIZE 512 +#define HEADER_ENCRYPTED_DATA_SIZE (HEADER_SIZE - HEADER_ENCRYPTED_DATA_OFFSET) + +/* The offset, in bytes, of the hidden volume header position from the end of the file (a positive value). + The extra offset (SECTOR_SIZE * 2) was added because FAT file system fills the last sector with zeroes + (marked as free; observed when quick format was performed using the OS format tool). One extra sector was + added to the offset for future expandability (should the header size increase, or should header backup be + introduced). */ +#define HIDDEN_VOL_HEADER_OFFSET (HEADER_SIZE + SECTOR_SIZE * 2) + + +// The first PRF to try when mounting +#define FIRST_PRF_ID 1 + +// Hash algorithms (pseudorandom functions). +enum +{ + RIPEMD160 = FIRST_PRF_ID, + SHA1, + WHIRLPOOL, + SHA512, + HASH_ENUM_END_ID +}; + +// The last PRF to try when mounting and also the number of implemented PRFs +#define LAST_PRF_ID (HASH_ENUM_END_ID - 1) + +#define RIPEMD160_BLOCKSIZE 64 +#define RIPEMD160_DIGESTSIZE 20 + +#define SHA1_BLOCKSIZE 64 +#define SHA1_DIGESTSIZE 20 + +#define SHA512_BLOCKSIZE 128 +#define SHA512_DIGESTSIZE 64 + +#define WHIRLPOOL_BLOCKSIZE 64 +#define WHIRLPOOL_DIGESTSIZE 64 + +#define MAX_DIGESTSIZE WHIRLPOOL_DIGESTSIZE + +#define DEFAULT_HASH_ALGORITHM FIRST_PRF_ID +#define DEFAULT_HASH_ALGORITHM_BOOT RIPEMD160 + +// The mode of operation used for newly created volumes and first to try when mounting +#define FIRST_MODE_OF_OPERATION_ID 1 + +// Modes of operation +enum +{ + /* If you add/remove a mode, update the following: GetMaxPkcs5OutSize(), EAInitMode() */ + + XTS = FIRST_MODE_OF_OPERATION_ID, + LRW, // Deprecated/legacy + CBC, // Deprecated/legacy + OUTER_CBC, // Deprecated/legacy + INNER_CBC, // Deprecated/legacy + MODE_ENUM_END_ID +}; + + +// The last mode of operation to try when mounting and also the number of implemented modes +#define LAST_MODE_OF_OPERATION (MODE_ENUM_END_ID - 1) + +// Ciphertext/plaintext block size for XTS mode (in bytes) +#define BYTES_PER_XTS_BLOCK 16 + +// Number of ciphertext/plaintext blocks per XTS data unit +#define BLOCKS_PER_XTS_DATA_UNIT (ENCRYPTION_DATA_UNIT_SIZE / BYTES_PER_XTS_BLOCK) + + +// Cipher IDs +enum +{ + NONE = 0, + AES256, + AES192, + AES128, + BLOWFISH, // Deprecated/legacy + CAST, // Deprecated/legacy + SERPENT, + TRIPLEDES, // Deprecated/legacy + TWOFISH, + DES56 // Deprecated/legacy (used only by Triple DES) +}; + +typedef struct +{ + int Id; // Cipher ID + char *Name; // Name + int BlockSize; // Block size (bytes) + int KeySize; // Key size (bytes) + int KeyScheduleSize; // Scheduled key size (bytes) +} Cipher; + +typedef struct +{ + int Ciphers[4]; // Null terminated array of ciphers used by encryption algorithm + int Modes[LAST_MODE_OF_OPERATION + 1]; // Null terminated array of modes of operation + int FormatEnabled; +} EncryptionAlgorithm; + +typedef struct +{ + int Id; // Hash ID + char *Name; // Name + int Deprecated; + int SystemEncryption; // Available for system encryption +} Hash; + +// Maxium length of scheduled key +#define AES_KS (sizeof(aes_encrypt_ctx) + sizeof(aes_decrypt_ctx)) + +#define SERPENT_KS (140 * 4) + +#define MAX_EXPANDED_KEY (AES_KS + SERPENT_KS + TWOFISH_KS) + +#define PRAND_DISK_WIPE_PASSES 200 + +#if !defined (TC_WINDOWS_BOOT) || defined (TC_WINDOWS_BOOT_AES) +# include "../crypto/aes.h" +#else +# include "../crypto/aesSmall.h" +#endif + +#include "../crypto/blowfish.h" +#include "../crypto/cast.h" +#include "../crypto/des.h" +#include "../crypto/serpent.h" +#include "../crypto/twofish.h" + +#include "../crypto/rmd160.h" +# include "../crypto/sha1.h" +# include "../crypto/sha2.h" +# include "../crypto/whirlpool.h" + +#include "gfmul.h" +#include "password.h" + +typedef struct keyInfo_t +{ + int noIterations; /* Number of times to iterate (PKCS-5) */ + int keyLength; /* Length of the key */ + int8_t userKey[MAX_PASSWORD]; /* Password (to which keyfiles may have been applied). WITHOUT +1 for the null terminator. */ + int8_t salt[PKCS5_SALT_SIZE]; /* PKCS-5 salt */ + int8_t master_keydata[MASTER_KEYDATA_SIZE]; /* Concatenated master primary and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */ +} KEY_INFO, *PKEY_INFO; + +typedef struct CRYPTO_INFO_t +{ + int ea; /* Encryption algorithm ID */ + int mode; /* Mode of operation (e.g., XTS) */ + uint8_t ks[MAX_EXPANDED_KEY]; /* Primary key schedule (if it is a cascade, it conatins multiple concatenated keys) */ + uint8_t ks2[MAX_EXPANDED_KEY]; /* Secondary key schedule (if cascade, multiple concatenated) for XTS mode. */ + + GfCtx gf_ctx; + + uint8_t master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */ + uint8_t k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */ + uint8_t salt[PKCS5_SALT_SIZE]; + int noIterations; + int pkcs5; + + // uint64_t volume_creation_time; + // uint64_t header_creation_time; + + // // Hidden volume status & parameters + // int hiddenVolume; // Indicates whether the volume is mounted/mountable as hidden volume + // int bProtectHiddenVolume; // Indicates whether the volume contains a hidden volume to be protected against overwriting + // int bHiddenVolProtectionAction; // TRUE if a write operation has been denied by the driver in order to prevent the hidden volume from being overwritten (set to FALSE upon volume mount). + + // uint64_t hiddenVolumeSize; // Size of the hidden volume excluding the header (in bytes). Set to 0 for standard volumes. + // uint64_t hiddenVolumeOffset; // Absolute position, in bytes, of the first hidden volume data sector within the host volume (provided that there is a hidden volume within). This must be set for all hidden volumes; in case of a normal volume, this variable is only used when protecting a hidden volume within it. + // uint64_t volDataAreaOffset; // Absolute position, in bytes, of the first data sector of the volume. + + // int bPartitionInInactiveSysEncScope; // If TRUE, the volume is a partition located on an encrypted system drive and mounted without pre-boot authentication. + + // UINT64_STRUCT FirstDataUnitNo; // First data unit number of the volume. This is 0 for file-hosted and non-system partition-hosted volumes. For partitions within key scope of system encryption this reflects real physical offset within the device (this is used e.g. when such a partition is mounted as a regular volume without pre-boot authentication). + // UINT64_STRUCT VolumeSize; + + // UINT64_STRUCT EncryptedAreaStart; + // UINT64_STRUCT EncryptedAreaLength; + +} CRYPTO_INFO, *PCRYPTO_INFO; + +PCRYPTO_INFO crypto_open (void); +void crypto_loadkey (PKEY_INFO keyInfo, char *lpszUserKey, int nUserKeyLen); +void crypto_close (PCRYPTO_INFO cryptoInfo); + +int CipherGetBlockSize (int cipher); +int CipherGetKeySize (int cipher); +int CipherGetKeyScheduleSize (int cipher); +char * CipherGetName (int cipher); + +int CipherInit (int cipher, unsigned char *key, unsigned char *ks); +int EAInit (int ea, unsigned char *key, unsigned char *ks); +int EAInitMode (PCRYPTO_INFO ci); +void EncipherBlock(int cipher, void *data, void *ks); +void DecipherBlock(int cipher, void *data, void *ks); + +int EAGetFirst (void); +int EAGetCount (void); +int EAGetNext (int previousEA); +char * EAGetName (char *buf, int ea); +int EAGetByName (char *name); +int EAGetKeySize (int ea); +int EAGetFirstMode (int ea); +int EAGetNextMode (int ea, int previousModeId); +char * EAGetModeName (int ea, int mode, int capitalLetters); +int EAGetKeyScheduleSize (int ea); +int EAGetLargestKey (void); +int EAGetLargestKeyForMode (int mode); + +int EAGetCipherCount (int ea); +int EAGetFirstCipher (int ea); +int EAGetLastCipher (int ea); +int EAGetNextCipher (int ea, int previousCipherId); +int EAGetPreviousCipher (int ea, int previousCipherId); +int EAIsFormatEnabled (int ea); +int EAIsModeSupported (int ea, int testedMode); + +char *HashGetName (int hash_algo_id); +int HashIsDeprecated (int hashId); + +int GetMaxPkcs5OutSize (void); + +//void EncryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci); +//void DecryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci); +void EncryptBuffer (uint8_t *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo); +void DecryptBuffer (uint8_t *buf, TC_LARGEST_COMPILER_UINT len, uint32_t secSz, uint64_t secN, uint8_t flags, PCRYPTO_INFO cryptoInfo); + +#ifndef TC_NO_COMPILER_INT64 + +void Xor128 (uint64_t *a, uint64_t *b); +void Xor64 (uint64_t *a, uint64_t *b); + +void EncryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); +void DecryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); +void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); +void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); + +void InitSectorIVAndWhitening (uint64_t unitNo, int blockSize, uint32_t *iv, uint64_t *ivSeed, uint32_t *whitening); +//uint64_t DataUnit2LRWIndex (uint64_t dataUnit, int blockSize, PCRYPTO_INFO ci); +#endif // #ifndef TC_NO_COMPILER_INT64 + +#ifdef __cplusplus +} +#endif + +#endif /* CRYPTO_H */ diff --git a/src/utils/common/endian.c b/src/utils/common/endian.c new file mode 100644 index 00000000000..90d2115daf7 --- /dev/null +++ b/src/utils/common/endian.c @@ -0,0 +1,57 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#include "tcdefs.h" +#include "../common/endian.h" + + +uint16_t MirrorBytes16 (uint16_t x) +{ + return (x << 8) | (x >> 8); +} + + +uint32_t MirrorBytes32 (uint32_t x) +{ + uint32_t n = (uint8_t) x; + n <<= 8; n |= (uint8_t) (x >> 8); + n <<= 8; n |= (uint8_t) (x >> 16); + return (n << 8) | (uint8_t) (x >> 24); +} + +#ifndef TC_NO_COMPILER_INT64 +uint64_t MirrorBytes64 (uint64_t x) +{ + uint64_t n = (uint8_t) x; + n <<= 8; n |= (uint8_t) (x >> 8); + n <<= 8; n |= (uint8_t) (x >> 16); + n <<= 8; n |= (uint8_t) (x >> 24); + n <<= 8; n |= (uint8_t) (x >> 32); + n <<= 8; n |= (uint8_t) (x >> 40); + n <<= 8; n |= (uint8_t) (x >> 48); + return (n << 8) | (uint8_t) (x >> 56); +} +#endif + +void +LongReverse (uint32_t *buffer, unsigned byteCount) +{ + uint32_t value; + + byteCount /= sizeof (uint32_t); + while (byteCount--) + { + value = *buffer; + value = ((value & 0xFF00FF00L) >> 8) | \ + ((value & 0x00FF00FFL) << 8); + *buffer++ = (value << 16) | (value >> 16); + } +} diff --git a/src/utils/common/endian.h b/src/utils/common/endian.h new file mode 100644 index 00000000000..787c6fa2172 --- /dev/null +++ b/src/utils/common/endian.h @@ -0,0 +1,138 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#ifndef TC_ENDIAN_H +#define TC_ENDIAN_H + +#include + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#ifdef _WIN32 + +# ifndef LITTLE_ENDIAN +# define LITTLE_ENDIAN 1234 +# endif +# ifndef BYTE_ORDER +# define BYTE_ORDER LITTLE_ENDIAN +# endif + +#elif !defined(BYTE_ORDER) + +# ifdef TC_MACOSX +# include +# elif defined (TC_BSD) +# include +# else +# include +# endif + +# ifndef BYTE_ORDER +# ifndef __BYTE_ORDER +# error Byte order cannot be determined (BYTE_ORDER undefined) +# endif + +# define BYTE_ORDER __BYTE_ORDER +# endif + +# ifndef LITTLE_ENDIAN +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# endif + +# ifndef BIG_ENDIAN +# define BIG_ENDIAN __BIG_ENDIAN +# endif + +#endif // !BYTE_ORDER + +/* Macros to read and write 16, 32, and 64-bit quantities in a portable manner. + These functions are implemented as macros rather than true functions as + the need to adjust the memory pointers makes them somewhat painful to call + in user code */ + +#define mputInt64(memPtr,data) \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 56 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 48 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 40 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 32 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 24 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 16 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 8 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( data ) & 0xFF ) + +#define mputLong(memPtr,data) \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 24 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 16 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 8 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( data ) & 0xFF ) + +#define mputWord(memPtr,data) \ + *memPtr++ = ( unsigned char ) ( ( ( data ) >> 8 ) & 0xFF ), \ + *memPtr++ = ( unsigned char ) ( ( data ) & 0xFF ) + +#define mputByte(memPtr,data) \ + *memPtr++ = ( unsigned char ) data + +#define mputBytes(memPtr,data,len) \ + memcpy (memPtr,data,len); \ + memPtr += len; + +#define mgetInt64(memPtr) \ + ( memPtr += 8, ( ( unsigned __int64 ) memPtr[ -8 ] << 56 ) | ( ( unsigned __int64 ) memPtr[ -7 ] << 48 ) | \ + ( ( unsigned __int64 ) memPtr[ -6 ] << 40 ) | ( ( unsigned __int64 ) memPtr[ -5 ] << 32 ) | \ + ( ( unsigned __int64 ) memPtr[ -4 ] << 24 ) | ( ( unsigned __int64 ) memPtr[ -3 ] << 16 ) | \ + ( ( unsigned __int64 ) memPtr[ -2 ] << 8 ) | ( unsigned __int64 ) memPtr[ -1 ] ) + +#define mgetLong(memPtr) \ + ( memPtr += 4, ( ( unsigned __int32 ) memPtr[ -4 ] << 24 ) | ( ( unsigned __int32 ) memPtr[ -3 ] << 16 ) | \ + ( ( unsigned __int32 ) memPtr[ -2 ] << 8 ) | ( unsigned __int32 ) memPtr[ -1 ] ) + +#define mgetWord(memPtr) \ + ( memPtr += 2, ( unsigned short ) memPtr[ -2 ] << 8 ) | ( ( unsigned short ) memPtr[ -1 ] ) + +#define mgetByte(memPtr) \ + ( ( unsigned char ) *memPtr++ ) + +#if BYTE_ORDER == BIG_ENDIAN +# define LE16(x) MirrorBytes16(x) +# define LE32(x) MirrorBytes32(x) +# define LE64(x) MirrorBytes64(x) +#else +# define LE16(x) (x) +# define LE32(x) (x) +# define LE64(x) (x) +#endif + +#if BYTE_ORDER == LITTLE_ENDIAN +# define BE16(x) MirrorBytes16(x) +# define BE32(x) MirrorBytes32(x) +# define BE64(x) MirrorBytes64(x) +#else +# define BE16(x) (x) +# define BE32(x) (x) +# define BE64(x) (x) +#endif + +uint16_t MirrorBytes16 (uint16_t x); +uint32_t MirrorBytes32 (uint32_t x); +#ifndef TC_NO_COMPILER_INT64 +uint64_t MirrorBytes64 (uint64_t x); +#endif +void LongReverse ( uint32_t *buffer , unsigned byteCount ); + +#if defined(__cplusplus) +} +#endif + +#endif /* TC_ENDIAN_H */ diff --git a/src/utils/common/gfmul.c b/src/utils/common/gfmul.c new file mode 100644 index 00000000000..9536d2ea9a7 --- /dev/null +++ b/src/utils/common/gfmul.c @@ -0,0 +1,893 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 31/01/2004 + + My thanks to John Viega and David McGrew for their support in developing + this code and to David for testing it on a big-endain system. +*/ + +/* + Portions Copyright (c) 2005 TrueCrypt Foundation + + TrueCrypt Foundation made the following changes: + + - Added multiplication in the finite field GF(2^128) optimized for + cases involving a 64-bit operand. + + - Added multiplication in the finite field GF(2^64). + + - Added MSB-first mode. + + - Added basic test algorithms. + + - Removed GCM. +*/ + +#include +#include +#include +#include "gfmul.h" +#include "tcdefs.h" +#include "../common/endian.h" + +/* BUFFER_ALIGN32 or BUFFER_ALIGN64 must be defined at this point to */ +/* enable faster operation by taking advantage of memory aligned values */ +/* NOTE: the BUFFER_ALIGN64 option has not been tested extensively */ + +#define BUFFER_ALIGN32 +#define UNROLL_LOOPS /* define to unroll some loops */ +#define IN_LINES /* define to use inline functions */ + /* in place of macros */ + +#define mode(x) GM_##x + +#if defined(__cplusplus) +extern "C" +{ +#endif + +typedef uint32_t mode(32t); +typedef uint64_t mode(64t); + +#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ +#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ + +#if BYTE_ORDER == LITTLE_ENDIAN +# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN +#endif + +#if BYTE_ORDER == BIG_ENDIAN +# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN +#endif + +#ifdef _MSC_VER +#pragma intrinsic(memcpy) +#define in_line __inline +#else +#define in_line +#endif + +#if 0 && defined(_MSC_VER) +#define rotl32 _lrotl +#define rotr32 _lrotr +#else +#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) +#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) +#endif + +#if !defined(bswap_32) +#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) +#endif + +#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) +#define SWAP_BYTES +#else +#undef SWAP_BYTES +#endif + +#if defined(SWAP_BYTES) + +#if defined ( IN_LINES ) + +in_line void bsw_32(void * p, unsigned int n) +{ unsigned int i = n; + while(i--) + ((mode(32t)*)p)[i] = bswap_32(((mode(32t)*)p)[i]); +} + +#else + +#define bsw_32(p,n) \ + { int _i = (n); while(_i--) ((mode(32t)*)p)[_i] = bswap_32(((mode(32t)*)p)[_i]); } + +#endif + +#else +#define bsw_32(p,n) +#endif + +/* These values are used to detect long word alignment in order */ +/* to speed up some GCM buffer operations. This facility may */ +/* not work on some machines */ + +#define lp08(x) ((unsigned char*)(x)) +#define lp32(x) ((mode(32t)*)(x)) +#define lp64(x) ((mode(64t)*)(x)) + +#define A32_MASK 3 +#define A64_MASK 7 +#define aligned32(x) (!(((mode(32t))(x)) & A32_MASK)) +#define aligned64(x) (!(((mode(32t))(x)) & A64_MASK)) + +#if defined( BUFFER_ALIGN32 ) + +#define ADR_MASK A32_MASK +#define aligned aligned32 +#define lp lp32 +#define lp_inc 4 + +#if defined( IN_LINES ) + +in_line void move_block_aligned( void *p, const void *q) +{ + lp32(p)[0] = lp32(q)[0], lp32(p)[1] = lp32(q)[1], + lp32(p)[2] = lp32(q)[2], lp32(p)[3] = lp32(q)[3]; +} + +in_line void move_block_aligned64( void *p, const void *q) +{ + lp32(p)[0] = lp32(q)[0], lp32(p)[1] = lp32(q)[1]; +} + +in_line void xor_block_aligned( void *p, const void *q) +{ + lp32(p)[0] ^= lp32(q)[0], lp32(p)[1] ^= lp32(q)[1], + lp32(p)[2] ^= lp32(q)[2], lp32(p)[3] ^= lp32(q)[3]; +} + +in_line void xor_block_aligned64( void *p, const void *q) +{ + lp32(p)[0] ^= lp32(q)[0], lp32(p)[1] ^= lp32(q)[1]; +} + +#else + +#define move_block_aligned(p,q) \ + lp32(p)[0] = lp32(q)[0], lp32(p)[1] = lp32(q)[1], \ + lp32(p)[2] = lp32(q)[2], lp32(p)[3] = lp32(q)[3] + +#define xor_block_aligned(p,q) \ + lp32(p)[0] ^= lp32(q)[0], lp32(p)[1] ^= lp32(q)[1], \ + lp32(p)[2] ^= lp32(q)[2], lp32(p)[3] ^= lp32(q)[3] + +#endif + +#elif defined( BUFFER_ALIGN64 ) + +#define ADR_MASK A64_MASK +#define aligned aligned64 +#define lp lp64 +#define lp_inc 8 + +#define move_block_aligned(p,q) \ + lp64(p)[0] = lp64(q)[0], lp64(p)[1] = lp64(q)[1] + +#define xor_block_aligned(p,q) \ + lp64(p)[0] ^= lp64(q)[0], lp64(p)[1] ^= lp64(q)[1] + +#else +#define aligned(x) 0 +#endif + +#define move_block(p,q) memcpy((p), (q), BLOCK_LEN) + +#define xor_block(p,q) \ + lp08(p)[ 0] ^= lp08(q)[ 0], lp08(p)[ 1] ^= lp08(q)[ 1], \ + lp08(p)[ 2] ^= lp08(q)[ 2], lp08(p)[ 3] ^= lp08(q)[ 3], \ + lp08(p)[ 4] ^= lp08(q)[ 4], lp08(p)[ 5] ^= lp08(q)[ 5], \ + lp08(p)[ 6] ^= lp08(q)[ 6], lp08(p)[ 7] ^= lp08(q)[ 7], \ + lp08(p)[ 8] ^= lp08(q)[ 8], lp08(p)[ 9] ^= lp08(q)[ 9], \ + lp08(p)[10] ^= lp08(q)[10], lp08(p)[11] ^= lp08(q)[11], \ + lp08(p)[12] ^= lp08(q)[12], lp08(p)[13] ^= lp08(q)[13], \ + lp08(p)[14] ^= lp08(q)[14], lp08(p)[15] ^= lp08(q)[15] + + +#define gf_dat(q) {\ + q(0x00), q(0x01), q(0x02), q(0x03), q(0x04), q(0x05), q(0x06), q(0x07),\ + q(0x08), q(0x09), q(0x0a), q(0x0b), q(0x0c), q(0x0d), q(0x0e), q(0x0f),\ + q(0x10), q(0x11), q(0x12), q(0x13), q(0x14), q(0x15), q(0x16), q(0x17),\ + q(0x18), q(0x19), q(0x1a), q(0x1b), q(0x1c), q(0x1d), q(0x1e), q(0x1f),\ + q(0x20), q(0x21), q(0x22), q(0x23), q(0x24), q(0x25), q(0x26), q(0x27),\ + q(0x28), q(0x29), q(0x2a), q(0x2b), q(0x2c), q(0x2d), q(0x2e), q(0x2f),\ + q(0x30), q(0x31), q(0x32), q(0x33), q(0x34), q(0x35), q(0x36), q(0x37),\ + q(0x38), q(0x39), q(0x3a), q(0x3b), q(0x3c), q(0x3d), q(0x3e), q(0x3f),\ + q(0x40), q(0x41), q(0x42), q(0x43), q(0x44), q(0x45), q(0x46), q(0x47),\ + q(0x48), q(0x49), q(0x4a), q(0x4b), q(0x4c), q(0x4d), q(0x4e), q(0x4f),\ + q(0x50), q(0x51), q(0x52), q(0x53), q(0x54), q(0x55), q(0x56), q(0x57),\ + q(0x58), q(0x59), q(0x5a), q(0x5b), q(0x5c), q(0x5d), q(0x5e), q(0x5f),\ + q(0x60), q(0x61), q(0x62), q(0x63), q(0x64), q(0x65), q(0x66), q(0x67),\ + q(0x68), q(0x69), q(0x6a), q(0x6b), q(0x6c), q(0x6d), q(0x6e), q(0x6f),\ + q(0x70), q(0x71), q(0x72), q(0x73), q(0x74), q(0x75), q(0x76), q(0x77),\ + q(0x78), q(0x79), q(0x7a), q(0x7b), q(0x7c), q(0x7d), q(0x7e), q(0x7f),\ + q(0x80), q(0x81), q(0x82), q(0x83), q(0x84), q(0x85), q(0x86), q(0x87),\ + q(0x88), q(0x89), q(0x8a), q(0x8b), q(0x8c), q(0x8d), q(0x8e), q(0x8f),\ + q(0x90), q(0x91), q(0x92), q(0x93), q(0x94), q(0x95), q(0x96), q(0x97),\ + q(0x98), q(0x99), q(0x9a), q(0x9b), q(0x9c), q(0x9d), q(0x9e), q(0x9f),\ + q(0xa0), q(0xa1), q(0xa2), q(0xa3), q(0xa4), q(0xa5), q(0xa6), q(0xa7),\ + q(0xa8), q(0xa9), q(0xaa), q(0xab), q(0xac), q(0xad), q(0xae), q(0xaf),\ + q(0xb0), q(0xb1), q(0xb2), q(0xb3), q(0xb4), q(0xb5), q(0xb6), q(0xb7),\ + q(0xb8), q(0xb9), q(0xba), q(0xbb), q(0xbc), q(0xbd), q(0xbe), q(0xbf),\ + q(0xc0), q(0xc1), q(0xc2), q(0xc3), q(0xc4), q(0xc5), q(0xc6), q(0xc7),\ + q(0xc8), q(0xc9), q(0xca), q(0xcb), q(0xcc), q(0xcd), q(0xce), q(0xcf),\ + q(0xd0), q(0xd1), q(0xd2), q(0xd3), q(0xd4), q(0xd5), q(0xd6), q(0xd7),\ + q(0xd8), q(0xd9), q(0xda), q(0xdb), q(0xdc), q(0xdd), q(0xde), q(0xdf),\ + q(0xe0), q(0xe1), q(0xe2), q(0xe3), q(0xe4), q(0xe5), q(0xe6), q(0xe7),\ + q(0xe8), q(0xe9), q(0xea), q(0xeb), q(0xec), q(0xed), q(0xee), q(0xef),\ + q(0xf0), q(0xf1), q(0xf2), q(0xf3), q(0xf4), q(0xf5), q(0xf6), q(0xf7),\ + q(0xf8), q(0xf9), q(0xfa), q(0xfb), q(0xfc), q(0xfd), q(0xfe), q(0xff) } + +/* given the value i in 0..255 as the byte overflow when a a field */ +/* element in GHASH is multipled by x^8, this function will return */ +/* the values that are generated in the lo 16-bit word of the field */ +/* value by applying the modular polynomial. The values lo_byte and */ +/* hi_byte are returned via the macro xp_fun(lo_byte, hi_byte) so */ +/* that the values can be assembled into memory as required by a */ +/* suitable definition of this macro operating on the table above */ + +#define xp(i) xp_fun( \ + (i & 0x80 ? 0xe1 : 0) ^ (i & 0x40 ? 0x70 : 0) ^ \ + (i & 0x20 ? 0x38 : 0) ^ (i & 0x10 ? 0x1c : 0) ^ \ + (i & 0x08 ? 0x0e : 0) ^ (i & 0x04 ? 0x07 : 0) ^ \ + (i & 0x02 ? 0x03 : 0) ^ (i & 0x01 ? 0x01 : 0), \ + (i & 0x80 ? 0x00 : 0) ^ (i & 0x40 ? 0x80 : 0) ^ \ + (i & 0x20 ? 0x40 : 0) ^ (i & 0x10 ? 0x20 : 0) ^ \ + (i & 0x08 ? 0x10 : 0) ^ (i & 0x04 ? 0x08 : 0) ^ \ + (i & 0x02 ? 0x84 : 0) ^ (i & 0x01 ? 0xc2 : 0) ) + +#define xp64(i) xp_fun( \ + (i & 0x80 ? 0xd8 : 0) ^ (i & 0x40 ? 0x6c : 0) ^ \ + (i & 0x20 ? 0x36 : 0) ^ (i & 0x10 ? 0x1b : 0) ^ \ + (i & 0x08 ? 0x0d : 0) ^ (i & 0x04 ? 0x06 : 0) ^ \ + (i & 0x02 ? 0x03 : 0) ^ (i & 0x01 ? 0x01 : 0), \ + (i & 0x80 ? 0x00 : 0) ^ (i & 0x40 ? 0x00 : 0) ^ \ + (i & 0x20 ? 0x00 : 0) ^ (i & 0x10 ? 0x00 : 0) ^ \ + (i & 0x08 ? 0x80 : 0) ^ (i & 0x04 ? 0xc0 : 0) ^ \ + (i & 0x02 ? 0x60 : 0) ^ (i & 0x01 ? 0xb0 : 0) ) + +static mode(32t) gf_poly[2] = { 0, 0xe1000000 }; +static mode(32t) gf_poly64[2] = { 0, 0xd8000000 }; + +/* Multiply of a GF128 field element by x. The field element */ +/* is held in an array of bytes in which field bits 8n..8n + 7 */ +/* are held in byte[n], with lower indexed bits placed in the */ +/* more numerically significant bit positions in bytes. */ + +/* This function multiples a field element x, in the polynomial */ +/* field representation. It uses 32-bit word operations to gain */ +/* speed but compensates for machine endianess and hence works */ +/* correctly on both styles of machine */ + +in_line void mul_x(mode(32t) x[4]) +{ mode(32t) t; + + bsw_32(x, 4); + + /* at this point the filed element bits 0..127 are set out */ + /* as follows in 32-bit words (where the most significant */ + /* (ms) numeric bits are to the left) */ + /* */ + /* x[0] x[1] x[2] x[3] */ + /* ms ls ms ls ms ls ms ls */ + /* field: 0 ... 31 32 .. 63 64 .. 95 96 .. 127 */ + + t = gf_poly[x[3] & 1]; /* bit 127 of the element */ + x[3] = (x[3] >> 1) | (x[2] << 31); /* shift bits up by one */ + x[2] = (x[2] >> 1) | (x[1] << 31); /* position */ + x[1] = (x[1] >> 1) | (x[0] << 31); /* if bit 7 is 1 xor in */ + x[0] = (x[0] >> 1) ^ t; /* the field polynomial */ + bsw_32(x, 4); +} + +in_line void mul_x64(mode(32t) x[2]) +{ mode(32t) t; + + bsw_32(x, 2); + + /* at this point the filed element bits 0..127 are set out */ + /* as follows in 32-bit words (where the most significant */ + /* (ms) numeric bits are to the left) */ + /* */ + /* x[0] x[1] x[2] x[3] */ + /* ms ls ms ls ms ls ms ls */ + /* field: 0 ... 31 32 .. 63 64 .. 95 96 .. 127 */ + + t = gf_poly64[x[1] & 1]; /* bit 127 of the element */ + /* shift bits up by one */ + /* position */ + x[1] = (x[1] >> 1) | (x[0] << 31); /* if bit 7 is 1 xor in */ + x[0] = (x[0] >> 1) ^ t; /* the field polynomial */ + bsw_32(x, 2); +} + +/* Multiply of a GF128 field element by x^8 using 32-bit words */ +/* for speed - machine endianess matters here */ + +#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) + +#define xp_fun(x,y) ((mode(32t))(x)) | (((mode(32t))(y)) << 8) +static const uint16_t gft_le[256] = gf_dat(xp); +static const uint16_t gft_le64[256] = gf_dat(xp64); + +in_line void mul_lex8(mode(32t) x[4]) /* mutiply with long words */ +{ mode(32t) t = (x[3] >> 24); /* in little endian format */ + x[3] = (x[3] << 8) | (x[2] >> 24); + x[2] = (x[2] << 8) | (x[1] >> 24); + x[1] = (x[1] << 8) | (x[0] >> 24); + x[0] = (x[0] << 8) ^ gft_le[t]; +} + +in_line void mul_lex8_64(mode(32t) x[2]) /* mutiply with long words */ +{ mode(32t) t = (x[1] >> 24); /* in little endian format */ + x[1] = (x[1] << 8) | (x[0] >> 24); + x[0] = (x[0] << 8) ^ gft_le64[t]; +} + +#endif + +#if 1 || (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) + +#undef xp_fun +#define xp_fun(x,y) ((mode(32t))(y)) | (((mode(32t))(x)) << 8) +static const uint16_t gft_be[256] = gf_dat(xp); +static const uint16_t gft_be64[256] = gf_dat(xp64); + +in_line void mul_bex8(mode(32t) x[4]) /* mutiply with long words */ +{ mode(32t) t = (x[3] & 0xff); /* in big endian format */ + x[3] = (x[3] >> 8) | (x[2] << 24); + x[2] = (x[2] >> 8) | (x[1] << 24); + x[1] = (x[1] >> 8) | (x[0] << 24); + x[0] = (x[0] >> 8) ^ (((mode(32t))gft_be[t]) << 16); +} + +in_line void mul_bex8_64(mode(32t) x[2]) /* mutiply with long words */ +{ mode(32t) t = (x[1] & 0xff); /* in big endian format */ + x[1] = (x[1] >> 8) | (x[0] << 24); + x[0] = (x[0] >> 8) ^ (((mode(32t))gft_be64[t]) << 16); +} + +#endif + +/* hence choose the correct version for the machine endianess */ + +#if PLATFORM_BYTE_ORDER == BRG_BIG_ENDIAN +#define mul_x8 mul_bex8 +#define mul_x8_64 mul_bex8_64 +#else +#define mul_x8 mul_lex8 +#define mul_x8_64 mul_lex8_64 +#endif + +/* different versions of the general gf_mul function are provided */ +/* here. Sadly none are very fast :-( */ + +void GfMul128 (void *a, const void* b) +{ mode(32t) r[CBLK_LEN >> 2], p[8][CBLK_LEN >> 2]; + int i; + + move_block_aligned(p[0], b); + bsw_32(p[0], 4); + for(i = 0; i < 7; ++i) + { + p[i + 1][3] = (p[i][3] >> 1) | (p[i][2] << 31); + p[i + 1][2] = (p[i][2] >> 1) | (p[i][1] << 31); + p[i + 1][1] = (p[i][1] >> 1) | (p[i][0] << 31); + p[i + 1][0] = (p[i][0] >> 1) ^ gf_poly[p[i][3] & 1]; + } + + memset(r, 0, CBLK_LEN); + for(i = 0; i < 16; ++i) + { + if(i) mul_bex8(r); /* order is always big endian here */ + + if(((unsigned char*)a)[15 - i] & 0x80) + xor_block_aligned(r, p[0]); + if(((unsigned char*)a)[15 - i] & 0x40) + xor_block_aligned(r, p[1]); + if(((unsigned char*)a)[15 - i] & 0x20) + xor_block_aligned(r, p[2]); + if(((unsigned char*)a)[15 - i] & 0x10) + xor_block_aligned(r, p[3]); + if(((unsigned char*)a)[15 - i] & 0x08) + xor_block_aligned(r, p[4]); + if(((unsigned char*)a)[15 - i] & 0x04) + xor_block_aligned(r, p[5]); + if(((unsigned char*)a)[15 - i] & 0x02) + xor_block_aligned(r, p[6]); + if(((unsigned char*)a)[15 - i] & 0x01) + xor_block_aligned(r, p[7]); + } + bsw_32(r, 4); + move_block_aligned(a, r); +} + +#if defined( UNROLL_LOOPS ) + +#define xor_8k(i) \ + xor_block_aligned(r, ctx->gf_t8k[i + i][a[i] & 15]); \ + xor_block_aligned(r, ctx->gf_t8k[i + i + 1][a[i] >> 4]) + + +void GfMul128Tab (unsigned char a[CBLK_LEN], GfCtx8k *ctx) +{ uint32_t r[CBLK_LEN >> 2]; + + move_block_aligned(r, ctx->gf_t8k[0][a[0] & 15]); + xor_block_aligned(r, ctx->gf_t8k[1][a[0] >> 4]); + xor_8k( 1); xor_8k( 2); xor_8k( 3); + xor_8k( 4); xor_8k( 5); xor_8k( 6); xor_8k( 7); + xor_8k( 8); xor_8k( 9); xor_8k(10); xor_8k(11); + xor_8k(12); xor_8k(13); xor_8k(14); xor_8k(15); + move_block_aligned(a, r); +} + +#else + +void GfMul128Tab (unsigned char a[CBLK_LEN], GfCtx8k *ctx) +{ uint32_t r[CBLK_LEN >> 2], *p; + int i; + + p = ctx->gf_t8k[0][a[0] & 15]; + memcpy(r, p, CBLK_LEN); + p = ctx->gf_t8k[1][a[0] >> 4]; + xor_block_aligned(r, p); + for(i = 1; i < CBLK_LEN; ++i) + { + xor_block_aligned(r, ctx->gf_t8k[i + i][a[i] & 15]); + xor_block_aligned(r, ctx->gf_t8k[i + i + 1][a[i] >> 4]); + } + memcpy(a, r, CBLK_LEN); +} + +#endif + +void compile_8k_table(uint8_t *a, GfCtx8k *ctx) +{ int i, j, k; + + memset(ctx->gf_t8k, 0, 32 * 16 * 16); + for(i = 0; i < 2 * CBLK_LEN; ++i) + { + if(i == 0) + { + memcpy(ctx->gf_t8k[1][8], a, CBLK_LEN); + for(j = 4; j > 0; j >>= 1) + { + memcpy(ctx->gf_t8k[1][j], ctx->gf_t8k[1][j + j], CBLK_LEN); + mul_x(ctx->gf_t8k[1][j]); + } + memcpy(ctx->gf_t8k[0][8], ctx->gf_t8k[1][1], CBLK_LEN); + mul_x(ctx->gf_t8k[0][8]); + for(j = 4; j > 0; j >>= 1) + { + memcpy(ctx->gf_t8k[0][j], ctx->gf_t8k[0][j + j], CBLK_LEN); + mul_x(ctx->gf_t8k[0][j]); + } + } + else if(i > 1) + for(j = 8; j > 0; j >>= 1) + { + memcpy(ctx->gf_t8k[i][j], ctx->gf_t8k[i - 2][j], CBLK_LEN); + mul_x8(ctx->gf_t8k[i][j]); + } + + for(j = 2; j < 16; j += j) + { + mode(32t) *pj = ctx->gf_t8k[i][j]; + mode(32t) *pk = ctx->gf_t8k[i][1]; + mode(32t) *pl = ctx->gf_t8k[i][j + 1]; + + for(k = 1; k < j; ++k) + { + *pl++ = pj[0] ^ *pk++; + *pl++ = pj[1] ^ *pk++; + *pl++ = pj[2] ^ *pk++; + *pl++ = pj[3] ^ *pk++; + } + } + } +} + + +void compile_4k_table64(uint8_t *a, GfCtx4k64 *ctx) +{ int i, j, k; + + memset(ctx->gf_t4k, 0, sizeof(ctx->gf_t4k)); + for(i = 0; i < 2 * CBLK_LEN8; ++i) + { + if(i == 0) + { + memcpy(ctx->gf_t4k[1][8], a, CBLK_LEN8); + for(j = 4; j > 0; j >>= 1) + { + memcpy(ctx->gf_t4k[1][j], ctx->gf_t4k[1][j + j], CBLK_LEN8); + mul_x64(ctx->gf_t4k[1][j]); + } + memcpy(ctx->gf_t4k[0][8], ctx->gf_t4k[1][1], CBLK_LEN8); + mul_x64(ctx->gf_t4k[0][8]); + for(j = 4; j > 0; j >>= 1) + { + memcpy(ctx->gf_t4k[0][j], ctx->gf_t4k[0][j + j], CBLK_LEN8); + mul_x64(ctx->gf_t4k[0][j]); + } + } + else if(i > 1) + for(j = 8; j > 0; j >>= 1) + { + memcpy(ctx->gf_t4k[i][j], ctx->gf_t4k[i - 2][j], CBLK_LEN8); + mul_x8_64(ctx->gf_t4k[i][j]); + } + + for(j = 2; j < 16; j += j) + { + mode(32t) *pj = ctx->gf_t4k[i][j]; + mode(32t) *pk = ctx->gf_t4k[i][1]; + mode(32t) *pl = ctx->gf_t4k[i][j + 1]; + + for(k = 1; k < j; ++k) + { + *pl++ = pj[0] ^ *pk++; + *pl++ = pj[1] ^ *pk++; + *pl++ = pj[2] ^ *pk++; + *pl++ = pj[3] ^ *pk++; + } + } + } +} + +static int IsBitSet128 (unsigned int bit, uint8_t *a) +{ + return a[(127 - bit) / 8] & (0x80 >> ((127 - bit) % 8)); +} + +static int IsBitSet64 (unsigned int bit, uint8_t *a) +{ + return a[(63 - bit) / 8] & (0x80 >> ((63 - bit) % 8)); +} + +static void SetBit128 (unsigned int bit, uint8_t *a) +{ + a[(127 - bit) / 8] |= 0x80 >> ((127 - bit) % 8); +} + +static void SetBit64 (unsigned int bit, uint8_t *a) +{ + a[(63 - bit) / 8] |= 0x80 >> ((63 - bit) % 8); +} + +void MirrorBits128 (uint8_t *a) +{ + uint8_t t[128 / 8]; + int i; + memset (t,0,16); + for (i = 0; i < 128; i++) + { + if (IsBitSet128(i, a)) + SetBit128 (127 - i, t); + } + memcpy (a, t, sizeof (t)); + burn (t,sizeof (t)); +} + +void MirrorBits64 (uint8_t *a) +{ + uint8_t t[64 / 8]; + int i; + memset (t,0,8); + for (i = 0; i < 64; i++) + { + if (IsBitSet64(i, a)) + SetBit64 (63 - i, t); + } + memcpy (a, t, sizeof (t)); + burn (t,sizeof (t)); +} + +/* Allocate and initialize speed optimization table + for multiplication by 64-bit operand in MSB-first mode */ +int Gf128Tab64Init (uint8_t *a, GfCtx *ctx) +{ + GfCtx8k *ctx8k; + uint8_t am[16]; + int i, j; + + ctx8k = (GfCtx8k *) TCalloc (sizeof (GfCtx8k)); + if (!ctx8k) + return 0; + + memcpy (am, a, 16); + MirrorBits128 (am); + compile_8k_table (am, ctx8k); + + /* Convert 8k LSB-first table to 4k MSB-first */ + for (i = 16; i < 32; i++) + { + for (j = 0; j < 16; j++) + { + int jm = 0; + jm |= (j & 0x1) << 3; + jm |= (j & 0x2) << 1; + jm |= (j & 0x4) >> 1; + jm |= (j & 0x8) >> 3; + + memcpy (&ctx->gf_t128[i-16][jm], (unsigned char *)&ctx8k->gf_t8k[31-i][j], 16); + MirrorBits128 ((unsigned char *)&ctx->gf_t128[i-16][jm]); + } + } + + burn (ctx8k ,sizeof (*ctx8k)); + burn (am, sizeof (am)); + TCfree (ctx8k); + return 1; +} + +int Gf64TabInit (uint8_t *a, GfCtx *ctx) +{ + /* Deprecated/legacy */ + + GfCtx4k64 *ctx4k; + uint8_t am[8]; + int i, j; + + ctx4k = (GfCtx4k64 *) TCalloc (sizeof (GfCtx4k64)); + if (!ctx4k) + return 0; + + memcpy (am, a, 8); + MirrorBits64 (am); + compile_4k_table64 (am, ctx4k); + + /* Convert LSB-first table to MSB-first */ + for (i = 0; i < 16; i++) + { + for (j = 0; j < 16; j++) + { + int jm = 0; + jm |= (j & 0x1) << 3; + jm |= (j & 0x2) << 1; + jm |= (j & 0x4) >> 1; + jm |= (j & 0x8) >> 3; + + memcpy (&ctx->gf_t64[i][jm], (unsigned char *)&ctx4k->gf_t4k[15-i][j], 8); + MirrorBits64 ((unsigned char *)&ctx->gf_t64[i][jm]); + } + } + + burn (ctx4k,sizeof (*ctx4k)); + burn (am, sizeof (am)); + TCfree (ctx4k); + return 1; +} + +#define xor_8kt64(i) \ + xor_block_aligned(r, ctx->gf_t128[i + i][a[i] & 15]); \ + xor_block_aligned(r, ctx->gf_t128[i + i + 1][a[i] >> 4]) + +/* Multiply a 128-bit number by a 64-bit number in the finite field GF(2^128) */ +void Gf128MulBy64Tab (uint8_t a[8], uint8_t p[16], GfCtx *ctx) +{ + uint32_t r[CBLK_LEN >> 2]; + + move_block_aligned(r, ctx->gf_t128[7*2][a[7] & 15]); + xor_block_aligned(r, ctx->gf_t128[7*2+1][a[7] >> 4]); + + if (*(uint16_t *)a) + { + xor_8kt64(0); + xor_8kt64(1); + } + if (a[2]) + { + xor_8kt64(2); + } + xor_8kt64(3); + xor_8kt64(4); + xor_8kt64(5); + xor_8kt64(6); + + move_block_aligned(p, r); +} + +#define xor_8k64(i) \ + xor_block_aligned64(r, ctx->gf_t64[i + i][a[i] & 15]); \ + xor_block_aligned64(r, ctx->gf_t64[i + i + 1][a[i] >> 4]) + +/* Multiply two 64-bit numbers in the finite field GF(2^64) */ +void Gf64MulTab (unsigned char a[8], unsigned char p[8], GfCtx *ctx) +{ + /* Deprecated/legacy */ + + uint32_t r[CBLK_LEN8 >> 2]; + + move_block_aligned64(r, ctx->gf_t64[7*2][a[7] & 15]); + xor_block_aligned64(r, ctx->gf_t64[7*2+1][a[7] >> 4]); + + if (*(uint16_t *)a) + { + xor_8k64(0); + xor_8k64(1); + } + if (a[2]) + { + xor_8k64(2); + } + xor_8k64(3); + xor_8k64(4); + xor_8k64(5); + xor_8k64(6); + + move_block_aligned64(p, r); +} + + +/* Basic algorithms for testing of optimized algorithms */ + +static void xor128 (uint64_t *a, uint64_t *b) +{ + *a++ ^= *b++; + *a ^= *b; +} + +static void shl128 (uint8_t *a) +{ + int i, x = 0, xx; + for (i = 15; i >= 0; i--) + { + xx = (a[i] & 0x80) >> 7; + a[i] = (a[i] << 1) | x; + x = xx; + } +} + +static void GfMul128Basic (uint8_t *a, uint8_t *b, uint8_t *p) +{ + int i; + uint8_t la[16]; + memcpy (la, a, 16); + memset (p, 0, 16); + + for (i = 0; i < 128; i++) + { + if (IsBitSet128 (i, b)) + xor128 ((uint64_t *)p, (uint64_t *)la); + + if (la[0] & 0x80) + { + shl128 (la); + la[15] ^= 0x87; + } + else + { + shl128 (la); + } + } +} + +static void xor64 (uint64_t *a, uint64_t *b) +{ + *a ^= *b; +} + +static void shl64 (uint8_t *a) +{ + int i, x = 0, xx; + for (i = 7; i >= 0; i--) + { + xx = (a[i] & 0x80) >> 7; + a[i] = (a[i] << 1) | x; + x = xx; + } +} + +static void GfMul64Basic (uint8_t *a, uint8_t *b, uint8_t* p) +{ + /* Deprecated/legacy */ + + int i; + uint8_t la[8]; + memcpy (la, a, 8); + memset (p, 0, 8); + + for (i = 0; i < 64; i++) + { + if (IsBitSet64 (i, b)) + xor64 ((uint64_t *)p, (uint64_t *)la); + + if (la[0] & 0x80) + { + shl64 (la); + la[7] ^= 0x1b; + } + else + { + shl64 (la); + } + } +} + + +int GfMulSelfTest (void) +{ + int result = 1; + uint8_t a[16]; + uint8_t b[16]; + uint8_t p1[16]; + uint8_t p2[16]; + GfCtx *gfCtx = (GfCtx *) TCalloc (sizeof (GfCtx)); + int i, j; + + if (!gfCtx) + return 0; + + /* GF(2^64) - deprecated/legacy */ + for (i = 0; i < 0x100; i++) + { + for (j = 0; j < 8; j++) + { + a[j] = (uint8_t) i; + b[j] = a[j] ^ 0xff; + } + + GfMul64Basic (a, b, p1); + + Gf64TabInit (a, gfCtx); + Gf64MulTab (b, p2, gfCtx); + + if (memcmp (p1, p2, 8) != 0) + result = 0; + } + + /* GF(2^128) */ + for (i = 0; i < 0x100; i++) + { + for (j = 0; j < 16; j++) + { + a[j] = (uint8_t) i; + b[j] = j < 8 ? 0 : a[j] ^ 0xff; + } + + GfMul128Basic (a, b, p1); + + Gf128Tab64Init (a, gfCtx); + Gf128MulBy64Tab (b + 8, p2, gfCtx); + + if (memcmp (p1, p2, 16) != 0) + result = 0; + } + + TCfree (gfCtx); + return result; +} + +#if defined(__cplusplus) +} +#endif diff --git a/src/utils/common/gfmul.h b/src/utils/common/gfmul.h new file mode 100644 index 00000000000..da411ed6748 --- /dev/null +++ b/src/utils/common/gfmul.h @@ -0,0 +1,78 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 31/01/2004 +*/ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + +#ifndef _GCM_H +#define _GCM_H + +#include + +#include "tcdefs.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#define CBLK_LEN 16 /* encryption block length */ +#define CBLK_LEN8 8 + +typedef struct +{ + uint32_t gf_t8k[CBLK_LEN * 2][16][CBLK_LEN / 4]; +} GfCtx8k; + +typedef struct +{ + uint32_t gf_t4k[CBLK_LEN8 * 2][16][CBLK_LEN / 4]; +} GfCtx4k64; + +typedef struct +{ + /* union not used to support faster mounting */ + uint32_t gf_t128[CBLK_LEN * 2 / 2][16][CBLK_LEN / 4]; + uint32_t gf_t64[CBLK_LEN8 * 2][16][CBLK_LEN8 / 4]; +} GfCtx; + +typedef int ret_type; + +void GfMul128 (void *a, const void* b); +void GfMul128Tab(unsigned char a[16], GfCtx8k *ctx); +int Gf128Tab64Init (uint8_t *a, GfCtx *ctx); +void Gf128MulBy64Tab (uint8_t a[8], uint8_t p[16], GfCtx *ctx); +int Gf64TabInit (uint8_t *a, GfCtx *ctx); +void Gf64MulTab (unsigned char a[8], unsigned char p[8], GfCtx *ctx); +void MirrorBits128 (uint8_t *a); +void MirrorBits64 (uint8_t *a); +int GfMulSelfTest (void); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/utils/common/password.h b/src/utils/common/password.h new file mode 100644 index 00000000000..cbf4cc53bd5 --- /dev/null +++ b/src/utils/common/password.h @@ -0,0 +1,39 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#ifndef PASSWORD_H +#define PASSWORD_H + +#include + +// User text input limits +#define MIN_PASSWORD 1 // Minimum password length +#define MAX_PASSWORD 64 // Maximum password length + +#define PASSWORD_LEN_WARNING 20 // Display a warning when a password is shorter than this + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct +{ + // Modifying this structure can introduce incompatibility with previous versions + int32_t Length; + unsigned char Text[MAX_PASSWORD + 1]; + char Pad[3]; // keep 64-bit alignment +} Password; + +#ifdef __cplusplus +} +#endif + +#endif // PASSWORD_H diff --git a/src/utils/common/pkcs5.c b/src/utils/common/pkcs5.c new file mode 100644 index 00000000000..2e55472b2f1 --- /dev/null +++ b/src/utils/common/pkcs5.c @@ -0,0 +1,631 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#include "tcdefs.h" + +#include +#include "../crypto/rmd160.h" +#include "../crypto/sha1.h" +#include "../crypto/sha2.h" +#include "../crypto/whirlpool.h" +#include "pkcs5.h" +#include "crypto.h" + +void hmac_truncate + ( + char *d1, /* data to be truncated */ + char *d2, /* truncated data */ + int len /* length in bytes to keep */ +) +{ + int i; + for (i = 0; i < len; i++) + d2[i] = d1[i]; +} + + +void hmac_sha512 +( + char *k, /* secret key */ + int lk, /* length of the key in bytes */ + char *d, /* data */ + int ld, /* length of data in bytes */ + char *out, /* output buffer, at least "t" bytes */ + int t +) +{ + sha512_ctx ictx, octx; + char isha[SHA512_DIGESTSIZE], osha[SHA512_DIGESTSIZE]; + char key[SHA512_DIGESTSIZE]; + char buf[SHA512_BLOCKSIZE]; + int i; + + /* If the key is longer than the hash algorithm block size, + let key = sha512(key), as per HMAC specifications. */ + if (lk > SHA512_BLOCKSIZE) + { + sha512_ctx tctx; + + sha512_begin (&tctx); + sha512_hash ((unsigned char *) k, lk, &tctx); + sha512_end ((unsigned char *) key, &tctx); + + k = key; + lk = SHA512_DIGESTSIZE; + + burn (&tctx, sizeof(tctx)); // Prevent leaks + } + + /**** Inner Digest ****/ + + sha512_begin (&ictx); + + /* Pad the key for inner digest */ + for (i = 0; i < lk; ++i) + buf[i] = (char) (k[i] ^ 0x36); + for (i = lk; i < SHA512_BLOCKSIZE; ++i) + buf[i] = 0x36; + + sha512_hash ((unsigned char *) buf, SHA512_BLOCKSIZE, &ictx); + sha512_hash ((unsigned char *) d, ld, &ictx); + + sha512_end ((unsigned char *) isha, &ictx); + + /**** Outer Digest ****/ + + sha512_begin (&octx); + + for (i = 0; i < lk; ++i) + buf[i] = (char) (k[i] ^ 0x5C); + for (i = lk; i < SHA512_BLOCKSIZE; ++i) + buf[i] = 0x5C; + + sha512_hash ((unsigned char *) buf, SHA512_BLOCKSIZE, &octx); + sha512_hash ((unsigned char *) isha, SHA512_DIGESTSIZE, &octx); + + sha512_end ((unsigned char *) osha, &octx); + + /* truncate and print the results */ + t = t > SHA512_DIGESTSIZE ? SHA512_DIGESTSIZE : t; + hmac_truncate (osha, out, t); + + /* Prevent leaks */ + burn (&ictx, sizeof(ictx)); + burn (&octx, sizeof(octx)); + burn (isha, sizeof(isha)); + burn (osha, sizeof(osha)); + burn (buf, sizeof(buf)); + burn (key, sizeof(key)); +} + + +void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) +{ + char j[SHA512_DIGESTSIZE], k[SHA512_DIGESTSIZE]; + char init[128]; + char counter[4]; + int c, i; + + /* iteration 1 */ + memset (counter, 0, 4); + counter[3] = (char) b; + memcpy (init, salt, salt_len); /* salt */ + memcpy (&init[salt_len], counter, 4); /* big-endian block number */ + hmac_sha512 (pwd, pwd_len, init, salt_len + 4, j, SHA512_DIGESTSIZE); + memcpy (u, j, SHA512_DIGESTSIZE); + + /* remaining iterations */ + for (c = 1; c < iterations; c++) + { + hmac_sha512 (pwd, pwd_len, j, SHA512_DIGESTSIZE, k, SHA512_DIGESTSIZE); + for (i = 0; i < SHA512_DIGESTSIZE; i++) + { + u[i] ^= k[i]; + j[i] = k[i]; + } + } + + /* Prevent possible leaks. */ + burn (j, sizeof(j)); + burn (k, sizeof(k)); +} + + +void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) +{ + char u[SHA512_DIGESTSIZE]; + int b, l, r; + + if (dklen % SHA512_DIGESTSIZE) + { + l = 1 + dklen / SHA512_DIGESTSIZE; + } + else + { + l = dklen / SHA512_DIGESTSIZE; + } + + r = dklen - (l - 1) * SHA512_DIGESTSIZE; + + /* first l - 1 blocks */ + for (b = 1; b < l; b++) + { + derive_u_sha512 (pwd, pwd_len, salt, salt_len, iterations, u, b); + memcpy (dk, u, SHA512_DIGESTSIZE); + dk += SHA512_DIGESTSIZE; + } + + /* last block */ + derive_u_sha512 (pwd, pwd_len, salt, salt_len, iterations, u, b); + memcpy (dk, u, r); + + + /* Prevent possible leaks. */ + burn (u, sizeof(u)); +} + + +/* Deprecated/legacy */ +void hmac_sha1 +( + char *k, /* secret key */ + int lk, /* length of the key in bytes */ + char *d, /* data */ + int ld, /* length of data in bytes */ + char *out, /* output buffer, at least "t" bytes */ + int t +) +{ + sha1_ctx ictx, octx; + char isha[SHA1_DIGESTSIZE], osha[SHA1_DIGESTSIZE]; + char key[SHA1_DIGESTSIZE]; + char buf[SHA1_BLOCKSIZE]; + int i; + + /* If the key is longer than the hash algorithm block size, + let key = sha1(key), as per HMAC specifications. */ + if (lk > SHA1_BLOCKSIZE) + { + sha1_ctx tctx; + + sha1_begin (&tctx); + sha1_hash ((unsigned char *) k, lk, &tctx); + sha1_end ((unsigned char *) key, &tctx); + + k = key; + lk = SHA1_DIGESTSIZE; + + burn (&tctx, sizeof(tctx)); // Prevent leaks + } + + /**** Inner Digest ****/ + + sha1_begin (&ictx); + + /* Pad the key for inner digest */ + for (i = 0; i < lk; ++i) + buf[i] = (char) (k[i] ^ 0x36); + for (i = lk; i < SHA1_BLOCKSIZE; ++i) + buf[i] = 0x36; + + sha1_hash ((unsigned char *) buf, SHA1_BLOCKSIZE, &ictx); + sha1_hash ((unsigned char *) d, ld, &ictx); + + sha1_end ((unsigned char *) isha, &ictx); + + /**** Outer Digest ****/ + + sha1_begin (&octx); + + for (i = 0; i < lk; ++i) + buf[i] = (char) (k[i] ^ 0x5C); + for (i = lk; i < SHA1_BLOCKSIZE; ++i) + buf[i] = 0x5C; + + sha1_hash ((unsigned char *) buf, SHA1_BLOCKSIZE, &octx); + sha1_hash ((unsigned char *) isha, SHA1_DIGESTSIZE, &octx); + + sha1_end ((unsigned char *) osha, &octx); + + /* truncate and print the results */ + t = t > SHA1_DIGESTSIZE ? SHA1_DIGESTSIZE : t; + hmac_truncate (osha, out, t); + + /* Prevent leaks */ + burn (&ictx, sizeof(ictx)); + burn (&octx, sizeof(octx)); + burn (isha, sizeof(isha)); + burn (osha, sizeof(osha)); + burn (buf, sizeof(buf)); + burn (key, sizeof(key)); +} + + +/* Deprecated/legacy */ +void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) +{ + char j[SHA1_DIGESTSIZE], k[SHA1_DIGESTSIZE]; + char init[128]; + char counter[4]; + int c, i; + + /* iteration 1 */ + memset (counter, 0, 4); + counter[3] = (char) b; + memcpy (init, salt, salt_len); /* salt */ + memcpy (&init[salt_len], counter, 4); /* big-endian block number */ + hmac_sha1 (pwd, pwd_len, init, salt_len + 4, j, SHA1_DIGESTSIZE); + memcpy (u, j, SHA1_DIGESTSIZE); + + /* remaining iterations */ + for (c = 1; c < iterations; c++) + { + hmac_sha1 (pwd, pwd_len, j, SHA1_DIGESTSIZE, k, SHA1_DIGESTSIZE); + for (i = 0; i < SHA1_DIGESTSIZE; i++) + { + u[i] ^= k[i]; + j[i] = k[i]; + } + } + + /* Prevent possible leaks. */ + burn (j, sizeof(j)); + burn (k, sizeof(k)); +} + + +/* Deprecated/legacy */ +void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) +{ + char u[SHA1_DIGESTSIZE]; + int b, l, r; + + if (dklen % SHA1_DIGESTSIZE) + { + l = 1 + dklen / SHA1_DIGESTSIZE; + } + else + { + l = dklen / SHA1_DIGESTSIZE; + } + + r = dklen - (l - 1) * SHA1_DIGESTSIZE; + + /* first l - 1 blocks */ + for (b = 1; b < l; b++) + { + derive_u_sha1 (pwd, pwd_len, salt, salt_len, iterations, u, b); + memcpy (dk, u, SHA1_DIGESTSIZE); + dk += SHA1_DIGESTSIZE; + } + + /* last block */ + derive_u_sha1 (pwd, pwd_len, salt, salt_len, iterations, u, b); + memcpy (dk, u, r); + + + /* Prevent possible leaks. */ + burn (u, sizeof(u)); +} + + +void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest) +{ + RMD160_CTX context; + unsigned char k_ipad[65]; /* inner padding - key XORd with ipad */ + unsigned char k_opad[65]; /* outer padding - key XORd with opad */ + unsigned char tk[RIPEMD160_DIGESTSIZE]; + int i; + + /* If the key is longer than the hash algorithm block size, + let key = ripemd160(key), as per HMAC specifications. */ + if (keylen > RIPEMD160_BLOCKSIZE) + { + RMD160_CTX tctx; + + RMD160Init(&tctx); + RMD160Update(&tctx, (const uint8_t *) key, keylen); + RMD160Final(tk, &tctx); + + key = (char *) tk; + keylen = RIPEMD160_DIGESTSIZE; + + burn (&tctx, sizeof(tctx)); // Prevent leaks + } + + /* + + RMD160(K XOR opad, RMD160(K XOR ipad, text)) + + where K is an n byte key + ipad is the byte 0x36 repeated RIPEMD160_BLOCKSIZE times + opad is the byte 0x5c repeated RIPEMD160_BLOCKSIZE times + and text is the data being protected */ + + + /* start out by storing key in pads */ + memset(k_ipad, 0x36, sizeof(k_ipad)); + memset(k_opad, 0x5c, sizeof(k_opad)); + + /* XOR key with ipad and opad values */ + for (i=0; i WHIRLPOOL_BLOCKSIZE) + { + WHIRLPOOL_CTX tctx; + + WHIRLPOOL_init (&tctx); + WHIRLPOOL_add ((unsigned char *) k, lk * 8, &tctx); + WHIRLPOOL_finalize (&tctx, (unsigned char *) key); + + k = key; + lk = WHIRLPOOL_DIGESTSIZE; + + burn (&tctx, sizeof(tctx)); // Prevent leaks + } + + /**** Inner Digest ****/ + + WHIRLPOOL_init (&ictx); + + /* Pad the key for inner digest */ + for (i = 0; i < lk; ++i) + buf[i] = (char) (k[i] ^ 0x36); + for (i = lk; i < WHIRLPOOL_BLOCKSIZE; ++i) + buf[i] = 0x36; + + WHIRLPOOL_add ((unsigned char *) buf, WHIRLPOOL_BLOCKSIZE * 8, &ictx); + WHIRLPOOL_add ((unsigned char *) d, ld * 8, &ictx); + + WHIRLPOOL_finalize (&ictx, (unsigned char *) iwhi); + + /**** Outer Digest ****/ + + WHIRLPOOL_init (&octx); + + for (i = 0; i < lk; ++i) + buf[i] = (char) (k[i] ^ 0x5C); + for (i = lk; i < WHIRLPOOL_BLOCKSIZE; ++i) + buf[i] = 0x5C; + + WHIRLPOOL_add ((unsigned char *) buf, WHIRLPOOL_BLOCKSIZE * 8, &octx); + WHIRLPOOL_add ((unsigned char *) iwhi, WHIRLPOOL_DIGESTSIZE * 8, &octx); + + WHIRLPOOL_finalize (&octx, (unsigned char *) owhi); + + /* truncate and print the results */ + t = t > WHIRLPOOL_DIGESTSIZE ? WHIRLPOOL_DIGESTSIZE : t; + hmac_truncate (owhi, out, t); + + /* Prevent possible leaks. */ + burn (&ictx, sizeof(ictx)); + burn (&octx, sizeof(octx)); + burn (owhi, sizeof(owhi)); + burn (iwhi, sizeof(iwhi)); + burn (buf, sizeof(buf)); + burn (key, sizeof(key)); +} + +void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) +{ + char j[WHIRLPOOL_DIGESTSIZE], k[WHIRLPOOL_DIGESTSIZE]; + char init[128]; + char counter[4]; + int c, i; + + /* iteration 1 */ + memset (counter, 0, 4); + counter[3] = (char) b; + memcpy (init, salt, salt_len); /* salt */ + memcpy (&init[salt_len], counter, 4); /* big-endian block number */ + hmac_whirlpool (pwd, pwd_len, init, salt_len + 4, j, WHIRLPOOL_DIGESTSIZE); + memcpy (u, j, WHIRLPOOL_DIGESTSIZE); + + /* remaining iterations */ + for (c = 1; c < iterations; c++) + { + hmac_whirlpool (pwd, pwd_len, j, WHIRLPOOL_DIGESTSIZE, k, WHIRLPOOL_DIGESTSIZE); + for (i = 0; i < WHIRLPOOL_DIGESTSIZE; i++) + { + u[i] ^= k[i]; + j[i] = k[i]; + } + } + + /* Prevent possible leaks. */ + burn (j, sizeof(j)); + burn (k, sizeof(k)); +} + +void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) +{ + char u[WHIRLPOOL_DIGESTSIZE]; + int b, l, r; + + if (dklen % WHIRLPOOL_DIGESTSIZE) + { + l = 1 + dklen / WHIRLPOOL_DIGESTSIZE; + } + else + { + l = dklen / WHIRLPOOL_DIGESTSIZE; + } + + r = dklen - (l - 1) * WHIRLPOOL_DIGESTSIZE; + + /* first l - 1 blocks */ + for (b = 1; b < l; b++) + { + derive_u_whirlpool (pwd, pwd_len, salt, salt_len, iterations, u, b); + memcpy (dk, u, WHIRLPOOL_DIGESTSIZE); + dk += WHIRLPOOL_DIGESTSIZE; + } + + /* last block */ + derive_u_whirlpool (pwd, pwd_len, salt, salt_len, iterations, u, b); + memcpy (dk, u, r); + + + /* Prevent possible leaks. */ + burn (u, sizeof(u)); +} + + +char *get_pkcs5_prf_name (int pkcs5_prf_id) +{ + switch (pkcs5_prf_id) + { + case SHA512: + return "HMAC-SHA-512"; + + case SHA1: // Deprecated/legacy + return "HMAC-SHA-1"; + + case RIPEMD160: + return "HMAC-RIPEMD-160"; + + case WHIRLPOOL: + return "HMAC-Whirlpool"; + + default: + return "(Unknown)"; + } +} + + +int get_pkcs5_iteration_count (int pkcs5_prf_id, int bBoot) +{ + switch (pkcs5_prf_id) + { + case RIPEMD160: + return (bBoot ? 1000 : 2000); + + case SHA512: + return 1000; + + case SHA1: // Deprecated/legacy + return 2000; + + case WHIRLPOOL: + return 1000; + + default: + TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID + } + return 0; +} diff --git a/src/utils/common/pkcs5.h b/src/utils/common/pkcs5.h new file mode 100644 index 00000000000..efd2cc9ed56 --- /dev/null +++ b/src/utils/common/pkcs5.h @@ -0,0 +1,41 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#ifndef TC_HEADER_PKCS5 +#define TC_HEADER_PKCS5 + +#include "tcdefs.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +void hmac_sha512 (char *k, int lk, char *d, int ld, char *out, int t); +void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); +void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); +void hmac_sha1 (char *k, int lk, char *d, int ld, char *out, int t); +void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); +void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); +void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest); +void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); +void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); +void hmac_whirlpool (char *k, int lk, char *d, int ld, char *out, int t); +void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); +void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); +int get_pkcs5_iteration_count (int pkcs5_prf_id, int bBoot); +char *get_pkcs5_prf_name (int pkcs5_prf_id); + +#if defined(__cplusplus) +} +#endif + +#endif // TC_HEADER_PKCS5 diff --git a/src/utils/common/tcdefs.h b/src/utils/common/tcdefs.h new file mode 100644 index 00000000000..49dc6bde254 --- /dev/null +++ b/src/utils/common/tcdefs.h @@ -0,0 +1,167 @@ +/* + Legal Notice: Some portions of the source code contained in this file were + derived from the source code of Encryption for the Masses 2.02a, which is + Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License + Agreement for Encryption for the Masses'. Modifications and additions to + the original source code (contained in this file) and all other portions of + this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed + by the TrueCrypt License 2.4 the full text of which is contained in the + file License.txt included in TrueCrypt binary and source code distribution + packages. */ + +#ifndef TCDEFS_H +#define TCDEFS_H + +#include +#include + +#define TC_APP_NAME "TrueCrypt" + +// Version displayed to user +#define VERSION_STRING "5.1a" + +// Version number to compare against driver +#define VERSION_NUM 0x051a + +// Version number written to volume header during format, +// specifies the minimum program version required to mount the volume +#define VOL_REQ_PROG_VERSION 0x0500 + +// Volume header version +#define VOLUME_HEADER_VERSION 0x0003 + +// Sector size of encrypted filesystem, which may differ from sector size +// of host filesystem/device (this is fully supported since v4.3). +#define SECTOR_SIZE 512 + +#define BYTES_PER_KB 1024LL +#define BYTES_PER_MB 1048576LL +#define BYTES_PER_GB 1073741824LL +#define BYTES_PER_TB 1099511627776LL +#define BYTES_PER_PB 1125899906842624LL + +/* GUI/driver errors */ + +#define MAX_128BIT_BLOCK_VOLUME_SIZE BYTES_PER_PB // Security bound (128-bit block XTS mode) +#define MAX_VOLUME_SIZE_GENERAL 0x7fffFFFFffffFFFFLL // Signed 64-bit integer file offset values +#define MAX_VOLUME_SIZE MAX_128BIT_BLOCK_VOLUME_SIZE +#define MIN_FAT_VOLUME_SIZE 19456 +#define MAX_FAT_VOLUME_SIZE 0x20000000000LL +#define MIN_NTFS_VOLUME_SIZE 2634752 +#define OPTIMAL_MIN_NTFS_VOLUME_SIZE (4 * BYTES_PER_GB) +#define MAX_NTFS_VOLUME_SIZE (128LL * BYTES_PER_TB) // NTFS volume can theoretically be up to 16 exabytes, but Windows XP and 2003 limit the size to that addressable with 32-bit clusters, i.e. max size is 128 TB (if 64-KB clusters are used). +#define MAX_HIDDEN_VOLUME_HOST_SIZE MAX_NTFS_VOLUME_SIZE +#define MAX_HIDDEN_VOLUME_SIZE ( MAX_HIDDEN_VOLUME_HOST_SIZE - HIDDEN_VOL_HEADER_OFFSET - HEADER_SIZE ) +#define MIN_VOLUME_SIZE MIN_FAT_VOLUME_SIZE +#define MIN_HIDDEN_VOLUME_HOST_SIZE ( MIN_VOLUME_SIZE * 2 + HIDDEN_VOL_HEADER_OFFSET + HEADER_SIZE ) + +#ifndef TC_NO_COMPILER_INT64 +#if MAX_VOLUME_SIZE > MAX_VOLUME_SIZE_GENERAL +#error MAX_VOLUME_SIZE must be less than or equal to MAX_VOLUME_SIZE_GENERAL +#endif +#endif + +#define TCalloc(X) calloc(1, X) +#define TCfree free + +#define WIDE(x) (LPWSTR)L##x + +typedef int8_t int8; +typedef int16_t int16; +typedef int32_t int32; +typedef uint8_t byte; +typedef uint16_t uint16; +typedef uint32_t uint32; + +#ifdef TC_NO_COMPILER_INT64 +typedef uint32_t TC_LARGEST_COMPILER_UINT; +#else +typedef uint64_t TC_LARGEST_COMPILER_UINT; +typedef int64_t int64; +typedef uint64_t uint64; +#endif + +// Needed by Cryptolib +typedef uint8_t uint_8t; +typedef uint16_t uint_16t; +typedef uint32_t uint_32t; +#ifndef TC_NO_COMPILER_INT64 +typedef uint64_t uint_64t; +#endif + +typedef union +{ + struct + { + uint32_t LowPart; + uint32_t HighPart; + }; +#ifndef TC_NO_COMPILER_INT64 + uint64_t Value; +#endif + +} UINT64_STRUCT; + + +#define TC_THROW_FATAL_EXCEPTION *(char *) 0 = 0 + +#define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; while (burnc--) *burnm++ = 0; } while (0) + +// The size of the memory area to wipe is in bytes amd it must be a multiple of 8. +#ifndef TC_NO_COMPILER_INT64 +# define FAST_ERASE64(mem,size) do { volatile uint64_t *burnm = (volatile uint64_t *)(mem); int burnc = size >> 3; while (burnc--) *burnm++ = 0; } while (0) +#else +# define FAST_ERASE64(mem,size) do { volatile uint32_t *burnm = (volatile uint32_t *)(mem); int burnc = size >> 2; while (burnc--) *burnm++ = 0; } while (0) +#endif + + +#ifdef MAX_PATH +#define TC_MAX_PATH MAX_PATH +#else +#define TC_MAX_PATH 260 /* Includes the null terminator */ +#endif + +#define MAX_URL_LENGTH 2084 /* Internet Explorer limit. Includes the terminating null character. */ + + +enum +{ + /* WARNING: Add any new codes at the end (do NOT insert them between existing). Do NOT delete any + existing codes. Changing these values or their meanings may cause incompatibility with other + versions (for example, if a new version of the TrueCrypt installer receives an error code from + an installed driver whose version is lower, it will interpret the error incorrectly). */ + + ERR_SUCCESS = 0, + ERR_OS_ERROR = 1, + ERR_OUTOFMEMORY, + ERR_PASSWORD_WRONG, + ERR_VOL_FORMAT_BAD, + ERR_DRIVE_NOT_FOUND, + ERR_FILES_OPEN, + ERR_VOL_SIZE_WRONG, + ERR_COMPRESSION_NOT_SUPPORTED, + ERR_PASSWORD_CHANGE_VOL_TYPE, + ERR_PASSWORD_CHANGE_VOL_VERSION, + ERR_VOL_SEEKING, + ERR_VOL_WRITING, + ERR_FILES_OPEN_LOCK, + ERR_VOL_READING, + ERR_DRIVER_VERSION, + ERR_NEW_VERSION_REQUIRED, + ERR_CIPHER_INIT_FAILURE, + ERR_CIPHER_INIT_WEAK_KEY, + ERR_SELF_TESTS_FAILED, + ERR_SECTOR_SIZE_INCOMPATIBLE, + ERR_VOL_ALREADY_MOUNTED, + ERR_NO_FREE_DRIVES, + ERR_FILE_OPEN_FAILED, + ERR_VOL_MOUNT_FAILED, + ERR_INVALID_DEVICE, + ERR_ACCESS_DENIED, + ERR_MODE_INIT_FAILED, + ERR_DONT_REPORT, + ERR_ENCRYPTION_NOT_COMPLETED, + ERR_PARAMETER_INCORRECT +}; + +#endif // #ifndef TCDEFS_H diff --git a/src/utils/common/xts.c b/src/utils/common/xts.c new file mode 100644 index 00000000000..47fcc2f90ad --- /dev/null +++ b/src/utils/common/xts.c @@ -0,0 +1,627 @@ +/* + Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. + + Governed by the TrueCrypt License 2.4 the full text of which is contained + in the file License.txt included in TrueCrypt binary and source code + distribution packages. +*/ + +/* For low-memory environments, define XTS_LOW_RESOURCE_VERSION, which will save +0.5 KB of RAM, but the speed will be 15-20% lower. However, on multi-core CPUs, +the XTS_LOW_RESOURCE_VERSION code might eventually be faster when parallelized, +because it processes the buffer continuously as a whole -- it does not divide the +buffer into data units (nevertheless, note that GenerateWhiteningValues supports +more than one data unit). + +Note that when TC_NO_COMPILER_INT64 is defined, XTS_LOW_RESOURCE_VERSION is implicitly +defined as well (because the non-low-resource version needs 64-bit types). + +For big-endian platforms (PowerPC, SPARC, etc.) define BYTE_ORDER as BIG_ENDIAN. */ + + +#ifdef TC_MINIMIZE_CODE_SIZE +# define XTS_LOW_RESOURCE_VERSION +# pragma optimize ("tl", on) +#endif + +#ifdef TC_NO_COMPILER_INT64 +# ifndef XTS_LOW_RESOURCE_VERSION +# define XTS_LOW_RESOURCE_VERSION +# endif +#endif + + +#include "xts.h" + + +#ifndef XTS_LOW_RESOURCE_VERSION + +// length: number of bytes to encrypt; may be larger than one data unit and must be divisible by the cipher block size +// ks: the primary key schedule +// ks2: the secondary key schedule +// startDataUnitNo: The sequential number of the data unit with which the buffer starts. +// startCipherBlockNo: The sequential number of the first plaintext block to encrypt inside the data unit startDataUnitNo. +// When encrypting the data unit from its first block, startCipherBlockNo is 0. +// The startCipherBlockNo value applies only to the first data unit in the buffer; each successive +// data unit is encrypted from its first block. The start of the buffer does not have to be +// aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it +// is not aligned, startCipherBlockNo must reflect the misalignment accordingly. +void EncryptBufferXTS (uint8_t *buffer, + TC_LARGEST_COMPILER_UINT length, + const UINT64_STRUCT *startDataUnitNo, + unsigned int startCipherBlockNo, + uint8_t *ks, + uint8_t *ks2, + int cipher) +{ + uint8_t finalCarry; + uint8_t whiteningValues [ENCRYPTION_DATA_UNIT_SIZE]; + uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; + uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; + uint64_t *whiteningValuesPtr64 = (uint64_t *) whiteningValues; + uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; + uint64_t *bufPtr = (uint64_t *) buffer; + unsigned int startBlock = startCipherBlockNo, endBlock, block; + uint64_t *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; + TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; + + /* The encrypted data unit number (i.e. the resultant ciphertext block) is to be multiplied in the + finite field GF(2^128) by j-th power of n, where j is the sequential plaintext/ciphertext block + number and n is 2, a primitive element of GF(2^128). This can be (and is) simplified and implemented + as a left shift of the preceding whitening value by one bit (with carry propagating). In addition, if + the shift of the highest byte results in a carry, 135 is XORed into the lowest byte. The value 135 is + derived from the modulus of the Galois Field (x^128+x^7+x^2+x+1). */ + + // Convert the 64-bit data unit number into a little-endian 16-byte array. + // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. + dataUnitNo = startDataUnitNo->Value; + *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); + *((uint64_t *) byteBufUnitNo + 1) = 0; + + if (length % BYTES_PER_XTS_BLOCK) + TC_THROW_FATAL_EXCEPTION; + + blockCount = length / BYTES_PER_XTS_BLOCK; + + // Process all blocks in the buffer + // When length > ENCRYPTION_DATA_UNIT_SIZE, this can be parallelized (one data unit per core) + while (blockCount > 0) + { + if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) + endBlock = startBlock + (unsigned int) blockCount; + else + endBlock = BLOCKS_PER_XTS_DATA_UNIT; + + whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; + whiteningValuePtr64 = (uint64_t *) whiteningValue; + + // Encrypt the data unit number using the secondary key (in order to generate the first + // whitening value for this data unit) + *whiteningValuePtr64 = *((uint64_t *) byteBufUnitNo); + *(whiteningValuePtr64 + 1) = 0; + EncipherBlock (cipher, whiteningValue, ks2); + + // Generate subsequent whitening values for blocks in this data unit. Note that all generated 128-bit + // whitening values are stored in memory as a sequence of 64-bit integers in reverse order. + for (block = 0; block < endBlock; block++) + { + if (block >= startBlock) + { + *whiteningValuesPtr64-- = *whiteningValuePtr64++; + *whiteningValuesPtr64-- = *whiteningValuePtr64; + } + else + whiteningValuePtr64++; + + // Derive the next whitening value + +#if BYTE_ORDER == LITTLE_ENDIAN + + // Little-endian platforms (Intel, AMD, etc.) + + finalCarry = + (*whiteningValuePtr64 & 0x8000000000000000) ? + 135 : 0; + + *whiteningValuePtr64-- <<= 1; + + if (*whiteningValuePtr64 & 0x8000000000000000) + *(whiteningValuePtr64 + 1) |= 1; + + *whiteningValuePtr64 <<= 1; + +#else + // Big-endian platforms (PowerPC, Motorola, etc.) + + finalCarry = + (*whiteningValuePtr64 & 0x80) ? + 135 : 0; + + *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); + + whiteningValuePtr64--; + + if (*whiteningValuePtr64 & 0x80) + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + + *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); +#endif + + whiteningValue[0] ^= finalCarry; + } + + whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; + + // Encrypt all blocks in this data unit + // TO DO: This should be parallelized (one block per core) + for (block = startBlock; block < endBlock; block++) + { + // Pre-whitening + *bufPtr++ ^= *whiteningValuesPtr64--; + *bufPtr-- ^= *whiteningValuesPtr64++; + + // Actual encryption + EncipherBlock (cipher, bufPtr, ks); + + // Post-whitening + *bufPtr++ ^= *whiteningValuesPtr64--; + *bufPtr++ ^= *whiteningValuesPtr64--; + + blockCount--; + } + + startBlock = 0; + + dataUnitNo++; + + *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); + } + + FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); + FAST_ERASE64 (whiteningValues, sizeof(whiteningValues)); +} + + +// For descriptions of the input parameters, see EncryptBufferXTS(). +void DecryptBufferXTS (uint8_t *buffer, + TC_LARGEST_COMPILER_UINT length, + const UINT64_STRUCT *startDataUnitNo, + unsigned int startCipherBlockNo, + uint8_t *ks, + uint8_t *ks2, + int cipher) +{ + uint8_t finalCarry; + uint8_t whiteningValues [ENCRYPTION_DATA_UNIT_SIZE]; + uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; + uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; + uint64_t *whiteningValuesPtr64 = (uint64_t *) whiteningValues; + uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; + uint64_t *bufPtr = (uint64_t *) buffer; + unsigned int startBlock = startCipherBlockNo, endBlock, block; + uint64_t *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; + TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; + + // Convert the 64-bit data unit number into a little-endian 16-byte array. + // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. + dataUnitNo = startDataUnitNo->Value; + *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); + *((uint64_t *) byteBufUnitNo + 1) = 0; + + if (length % BYTES_PER_XTS_BLOCK) + TC_THROW_FATAL_EXCEPTION; + + blockCount = length / BYTES_PER_XTS_BLOCK; + + // Process all blocks in the buffer + // When length > ENCRYPTION_DATA_UNIT_SIZE, this can be parallelized (one data unit per core) + while (blockCount > 0) + { + if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) + endBlock = startBlock + (unsigned int) blockCount; + else + endBlock = BLOCKS_PER_XTS_DATA_UNIT; + + whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; + whiteningValuePtr64 = (uint64_t *) whiteningValue; + + // Encrypt the data unit number using the secondary key (in order to generate the first + // whitening value for this data unit) + *whiteningValuePtr64 = *((uint64_t *) byteBufUnitNo); + *(whiteningValuePtr64 + 1) = 0; + EncipherBlock (cipher, whiteningValue, ks2); + + // Generate subsequent whitening values for blocks in this data unit. Note that all generated 128-bit + // whitening values are stored in memory as a sequence of 64-bit integers in reverse order. + for (block = 0; block < endBlock; block++) + { + if (block >= startBlock) + { + *whiteningValuesPtr64-- = *whiteningValuePtr64++; + *whiteningValuesPtr64-- = *whiteningValuePtr64; + } + else + whiteningValuePtr64++; + + // Derive the next whitening value + +#if BYTE_ORDER == LITTLE_ENDIAN + + // Little-endian platforms (Intel, AMD, etc.) + + finalCarry = + (*whiteningValuePtr64 & 0x8000000000000000) ? + 135 : 0; + + *whiteningValuePtr64-- <<= 1; + + if (*whiteningValuePtr64 & 0x8000000000000000) + *(whiteningValuePtr64 + 1) |= 1; + + *whiteningValuePtr64 <<= 1; + +#else + // Big-endian platforms (PowerPC, Motorola, etc.) + + finalCarry = + (*whiteningValuePtr64 & 0x80) ? + 135 : 0; + + *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); + + whiteningValuePtr64--; + + if (*whiteningValuePtr64 & 0x80) + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + + *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); +#endif + + whiteningValue[0] ^= finalCarry; + } + + whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; + + // Decrypt blocks in this data unit + // TO DO: This should be parallelized (one block per core) + for (block = startBlock; block < endBlock; block++) + { + *bufPtr++ ^= *whiteningValuesPtr64--; + *bufPtr-- ^= *whiteningValuesPtr64++; + + DecipherBlock (cipher, bufPtr, ks); + + *bufPtr++ ^= *whiteningValuesPtr64--; + *bufPtr++ ^= *whiteningValuesPtr64--; + + blockCount--; + } + + startBlock = 0; + + dataUnitNo++; + + *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); + } + + FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); + FAST_ERASE64 (whiteningValues, sizeof(whiteningValues)); +} + + +#if 0 // The following function is currently unused but may be useful in future + +// Generates XTS whitening values. Use this function if you need to generate whitening values for more than +// one data unit in one pass (the value 'length' may be greater than the data unit size). 'buffer' must point +// to the LAST 8 bytes of the buffer for the whitening values. Note that the generated 128-bit whitening values +// are stored in memory as a sequence of 64-bit integers in reverse order. For descriptions of the input +// parameters, see EncryptBufferXTS(). +static void GenerateWhiteningValues (uint64_t *bufPtr64, + TC_LARGEST_COMPILER_UINT length, + const UINT64_STRUCT *startDataUnitNo, + unsigned int startBlock, + uint8_t *ks2, + int cipher) +{ + unsigned int block; + unsigned int endBlock; + uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; + uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; + uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; + uint8_t finalCarry; + uint64_t *const finalInt64WhiteningValuePtr = whiteningValuePtr64 + sizeof (whiteningValue) / sizeof (*whiteningValuePtr64) - 1; + TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; + + dataUnitNo = startDataUnitNo->Value; + + blockCount = length / BYTES_PER_XTS_BLOCK; + + // Convert the 64-bit data unit number into a little-endian 16-byte array. + // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. + *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); + *((uint64_t *) byteBufUnitNo + 1) = 0; + + // Generate the whitening values. + // When length > ENCRYPTION_DATA_UNIT_SIZE, this can be parallelized (one data unit per core) + while (blockCount > 0) + { + if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) + endBlock = startBlock + (unsigned int) blockCount; + else + endBlock = BLOCKS_PER_XTS_DATA_UNIT; + + // Encrypt the data unit number using the secondary key (in order to generate the first + // whitening value for this data unit) + memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK); + EncipherBlock (cipher, whiteningValue, ks2); + + // Process all blocks in this data unit + for (block = 0; block < endBlock; block++) + { + if (block >= startBlock) + { + whiteningValuePtr64 = (uint64_t *) whiteningValue; + + *bufPtr64-- = *whiteningValuePtr64++; + *bufPtr64-- = *whiteningValuePtr64; + + blockCount--; + } + + // Derive the next whitening value + + whiteningValuePtr64 = finalInt64WhiteningValuePtr; + +#if BYTE_ORDER == LITTLE_ENDIAN + + // Little-endian platforms (Intel, AMD, etc.) + + finalCarry = + (*whiteningValuePtr64 & 0x8000000000000000) ? + 135 : 0; + + *whiteningValuePtr64-- <<= 1; + + if (*whiteningValuePtr64 & 0x8000000000000000) + *(whiteningValuePtr64 + 1) |= 1; + + *whiteningValuePtr64 <<= 1; + +#else + // Big-endian platforms (PowerPC, Motorola, etc.) + + finalCarry = + (*whiteningValuePtr64 & 0x80) ? + 135 : 0; + + *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); + + whiteningValuePtr64--; + + if (*whiteningValuePtr64 & 0x80) + *(whiteningValuePtr64 + 1) |= 0x0100000000000000; + + *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); +#endif + + whiteningValue[0] ^= finalCarry; + } + + startBlock = 0; + + dataUnitNo++; + + // Convert the 64-bit data unit number into a little-endian 16-byte array. + *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); + } + + FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); +} +#endif // #if 0 + + +#else // XTS_LOW_RESOURCE_VERSION + + +#if BYTE_ORDER == BIG_ENDIAN +#error XTS_LOW_RESOURCE_VERSION is not compatible with big-endian platforms +#endif + + +// Increases a 64-bit value by one in a way compatible with non-64-bit environments/platforms +static void IncUint64Struct (UINT64_STRUCT *uint64Struct) +{ +#ifdef TC_NO_COMPILER_INT64 + if (!++uint64Struct->LowPart) + { + uint64Struct->HighPart++; + } +#else + uint64Struct->Value++; +#endif +} + + +// Converts a 64-bit unsigned integer (passed as two 32-bit integers for compatibility with non-64-bit +// environments/platforms) into a little-endian 16-byte array. +static void Uint64ToLE16ByteArray (uint8_t *byteBuf, unsigned __int32 highInt32, unsigned __int32 lowInt32) +{ + unsigned __int32 *bufPtr32 = (unsigned __int32 *) byteBuf; + + *bufPtr32++ = lowInt32; + *bufPtr32++ = highInt32; + + // We're converting a 64-bit number into a little-endian 16-byte array so we can zero the last 8 bytes + *bufPtr32++ = 0; + *bufPtr32 = 0; +} + + +// Generates and XORs XTS whitening values into blocks in the buffer. +// For descriptions of the input parameters, see EncryptBufferXTS(). +static void WhiteningPass (uint8_t *buffer, + TC_LARGEST_COMPILER_UINT length, + const UINT64_STRUCT *startDataUnitNo, + unsigned int startBlock, + uint8_t *ks2, + int cipher) +{ + TC_LARGEST_COMPILER_UINT blockCount; + UINT64_STRUCT dataUnitNo; + unsigned int block; + unsigned int endBlock; + uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; + uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; + unsigned __int32 *bufPtr32 = (unsigned __int32 *) buffer; + unsigned __int32 *whiteningValuePtr32 = (unsigned __int32 *) whiteningValue; + uint8_t finalCarry; + unsigned __int32 *const finalDwordWhiteningValuePtr = whiteningValuePtr32 + sizeof (whiteningValue) / sizeof (*whiteningValuePtr32) - 1; + + // Store the 64-bit data unit number in a way compatible with non-64-bit environments/platforms + dataUnitNo.HighPart = startDataUnitNo->HighPart; + dataUnitNo.LowPart = startDataUnitNo->LowPart; + + blockCount = length / BYTES_PER_XTS_BLOCK; + + // Convert the 64-bit data unit number into a little-endian 16-byte array. + // (Passed as two 32-bit integers for compatibility with non-64-bit environments/platforms.) + Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); + + // Generate whitening values for all blocks in the buffer + while (blockCount > 0) + { + if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) + endBlock = startBlock + (unsigned int) blockCount; + else + endBlock = BLOCKS_PER_XTS_DATA_UNIT; + + // Encrypt the data unit number using the secondary key (in order to generate the first + // whitening value for this data unit) + memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK); + EncipherBlock (cipher, whiteningValue, ks2); + + // Generate subsequent whitening values and XOR each whitening value into corresponding + // ciphertext/plaintext block + + for (block = 0; block < endBlock; block++) + { + if (block >= startBlock) + { + whiteningValuePtr32 = (unsigned __int32 *) whiteningValue; + + // XOR the whitening value into this ciphertext/plaintext block + *bufPtr32++ ^= *whiteningValuePtr32++; + *bufPtr32++ ^= *whiteningValuePtr32++; + *bufPtr32++ ^= *whiteningValuePtr32++; + *bufPtr32++ ^= *whiteningValuePtr32; + + blockCount--; + } + + // Derive the next whitening value + + finalCarry = 0; + + for (whiteningValuePtr32 = finalDwordWhiteningValuePtr; + whiteningValuePtr32 >= (unsigned __int32 *) whiteningValue; + whiteningValuePtr32--) + { + if (*whiteningValuePtr32 & 0x80000000) // If the following shift results in a carry + { + if (whiteningValuePtr32 != finalDwordWhiteningValuePtr) // If not processing the highest double word + { + // A regular carry + *(whiteningValuePtr32 + 1) |= 1; + } + else + { + // The highest byte shift will result in a carry + finalCarry = 135; + } + } + + *whiteningValuePtr32 <<= 1; + } + + whiteningValue[0] ^= finalCarry; + } + + startBlock = 0; + + // Increase the data unit number by one + IncUint64Struct (&dataUnitNo); + + // Convert the 64-bit data unit number into a little-endian 16-byte array. + Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); + } + + FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); +} + + +// length: number of bytes to encrypt; may be larger than one data unit and must be divisible by the cipher block size +// ks: the primary key schedule +// ks2: the secondary key schedule +// dataUnitNo: The sequential number of the data unit with which the buffer starts. +// startCipherBlockNo: The sequential number of the first plaintext block to encrypt inside the data unit dataUnitNo. +// When encrypting the data unit from its first block, startCipherBlockNo is 0. +// The startCipherBlockNo value applies only to the first data unit in the buffer; each successive +// data unit is encrypted from its first block. The start of the buffer does not have to be +// aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it +// is not aligned, startCipherBlockNo must reflect the misalignment accordingly. +void EncryptBufferXTS (uint8_t *buffer, + TC_LARGEST_COMPILER_UINT length, + const UINT64_STRUCT *dataUnitNo, + unsigned int startCipherBlockNo, + uint8_t *ks, + uint8_t *ks2, + int cipher) +{ + TC_LARGEST_COMPILER_UINT blockCount; + uint8_t *bufPtr = buffer; + + if (length % BYTES_PER_XTS_BLOCK) + TC_THROW_FATAL_EXCEPTION; + + // Pre-whitening (all plaintext blocks in the buffer) + WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); + + // Encrypt all plaintext blocks in the buffer + for (blockCount = 0; blockCount < length / BYTES_PER_XTS_BLOCK; blockCount++) + { + EncipherBlock (cipher, bufPtr, ks); + bufPtr += BYTES_PER_XTS_BLOCK; + } + + // Post-whitening (all ciphertext blocks in the buffer) + WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); +} + + +// For descriptions of the input parameters, see EncryptBufferXTS(). +void DecryptBufferXTS (uint8_t *buffer, + TC_LARGEST_COMPILER_UINT length, + const UINT64_STRUCT *dataUnitNo, + unsigned int startCipherBlockNo, + uint8_t *ks, + uint8_t *ks2, + int cipher) +{ + TC_LARGEST_COMPILER_UINT blockCount; + uint8_t *bufPtr = buffer; + + if (length % BYTES_PER_XTS_BLOCK) + TC_THROW_FATAL_EXCEPTION; + + WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); + + for (blockCount = 0; blockCount < length / BYTES_PER_XTS_BLOCK; blockCount++) + { + DecipherBlock (cipher, bufPtr, ks); + bufPtr += BYTES_PER_XTS_BLOCK; + } + + WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); +} + +#endif // XTS_LOW_RESOURCE_VERSION diff --git a/src/utils/common/xts.h b/src/utils/common/xts.h new file mode 100644 index 00000000000..cce7877b8df --- /dev/null +++ b/src/utils/common/xts.h @@ -0,0 +1,79 @@ +/* + Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. + + Governed by the TrueCrypt License 2.4 the full text of which is contained + in the file License.txt included in TrueCrypt binary and source code + distribution packages. +*/ + +#ifndef XTS_H +#define XTS_H + +// Header files (optional) + +#include + +#include "tcdefs.h" +#include "../common/endian.h" +#include "crypto.h" + + +#ifdef __cplusplus +extern "C" { +#endif + +// Macros + +#ifndef LITTLE_ENDIAN +# define LITTLE_ENDIAN 1 +#endif + +#ifndef BIG_ENDIAN +# define BIG_ENDIAN 2 +#endif + +#ifndef BYTE_ORDER +# define BYTE_ORDER LITTLE_ENDIAN +#endif + +#ifndef LE64 +# if BYTE_ORDER == LITTLE_ENDIAN +# define LE64(x) (x) +# endif +#endif + +// Custom data types + +#ifndef TC_LARGEST_COMPILER_UINT +# ifdef TC_NO_COMPILER_INT64 + typedef uint32_t TC_LARGEST_COMPILER_UINT; +# else + typedef uint64_t TC_LARGEST_COMPILER_UINT; +# endif +#endif + +#ifndef TCDEFS_H +typedef union +{ + struct + { + uint32_t LowPart; + uint32_t HighPart; + }; +# ifndef TC_NO_COMPILER_INT64 + uint64_t Value; +# endif + +} UINT64_STRUCT; +#endif + +// Public function prototypes + +void EncryptBufferXTS (uint8_t *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); +void DecryptBufferXTS (uint8_t *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); + +#ifdef __cplusplus +} +#endif + +#endif // #ifndef XTS_H diff --git a/src/utils/crypto/aes.h b/src/utils/crypto/aes.h new file mode 100644 index 00000000000..e8ae33e9da2 --- /dev/null +++ b/src/utils/crypto/aes.h @@ -0,0 +1,215 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 + + This file contains the definitions required to use AES in C. See aesopt.h + for optimisation details. +*/ + +/* Adapted by the TrueCrypt Foundation */ + +#ifndef _AES_H +#define _AES_H + +#include "../common/tcdefs.h" + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 +#endif +#define INT_RETURN int + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#define AES_128 /* define if AES with 128 bit keys is needed */ +#define AES_192 /* define if AES with 192 bit keys is needed */ +#define AES_256 /* define if AES with 256 bit keys is needed */ +#define AES_VAR /* define if a variable key size is needed */ +// #define AES_MODES /* define if support is needed for modes */ + +/* The following must also be set in assembler files if being used */ + +#define AES_ENCRYPT /* if support for encryption is needed */ +#define AES_DECRYPT /* if support for decryption is needed */ +#define AES_ERR_CHK /* for parameter checks & error return codes */ +#define AES_REV_DKS /* define to reverse decryption key schedule */ + +#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */ +#define N_COLS 4 /* the number of columns in the state */ + +/* The key schedule length is 11, 13 or 15 16-byte blocks for 128, */ +/* 192 or 256-bit keys respectively. That is 176, 208 or 240 bytes */ +/* or 44, 52 or 60 32-bit words. */ + +#if defined( AES_VAR ) || defined( AES_256 ) +#define KS_LENGTH 60 +#elif defined( AES_192 ) +#define KS_LENGTH 52 +#else +#define KS_LENGTH 44 +#endif + +#if defined( AES_ERR_CHK ) +#define AES_RETURN INT_RETURN +#else +#define AES_RETURN VOID_RETURN +#endif + +/* the character array 'inf' in the following structures is used */ +/* to hold AES context information. This AES code uses cx->inf.b[0] */ +/* to hold the number of rounds multiplied by 16. The other three */ +/* elements can be used by code that implements additional modes */ + +typedef union +{ uint_32t l; + uint_8t b[4]; +} aes_inf; + +typedef struct +{ uint_32t ks[KS_LENGTH]; + aes_inf inf; +} aes_encrypt_ctx; + +typedef struct +{ uint_32t ks[KS_LENGTH]; + aes_inf inf; +} aes_decrypt_ctx; + +/* This routine must be called before first use if non-static */ +/* tables are being used */ + +AES_RETURN aes_init(void); + +/* Key lengths in the range 16 <= key_len <= 32 are given in bytes, */ +/* those in the range 128 <= key_len <= 256 are given in bits */ + +#if defined( AES_ENCRYPT ) + +#if defined(AES_128) || defined(AES_VAR) +AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); +#endif + +#if defined(AES_192) || defined(AES_VAR) +AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); +#endif + +#if defined(AES_256) || defined(AES_VAR) +AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); +#endif + +#if defined(AES_VAR) +AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]); +#endif + +AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]); + +#endif + +#if defined( AES_DECRYPT ) + +#if defined(AES_128) || defined(AES_VAR) +AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); +#endif + +#if defined(AES_192) || defined(AES_VAR) +AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); +#endif + +#if defined(AES_256) || defined(AES_VAR) +AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); +#endif + +#if defined(AES_VAR) +AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]); +#endif + +AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]); + +#endif + +#if defined(AES_MODES) + +/* Multiple calls to the following subroutines for multiple block */ +/* ECB, CBC, CFB, OFB and CTR mode encryption can be used to handle */ +/* long messages incremantally provided that the context AND the iv */ +/* are preserved between all such calls. For the ECB and CBC modes */ +/* each individual call within a series of incremental calls must */ +/* process only full blocks (i.e. len must be a multiple of 16) but */ +/* the CFB, OFB and CTR mode calls can handle multiple incremental */ +/* calls of any length. Each mode is reset when a new AES key is */ +/* set but ECB and CBC operations can be reset without setting a */ +/* new key by setting a new IV value. To reset CFB, OFB and CTR */ +/* without setting the key, aes_mode_reset() must be called and the */ +/* IV must be set. NOTE: All these calls update the IV on exit so */ +/* this has to be reset if a new operation with the same IV as the */ +/* previous one is required (or decryption follows encryption with */ +/* the same IV array). */ + +AES_RETURN aes_test_alignment_detection(unsigned int n); + +AES_RETURN aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, const aes_encrypt_ctx cx[1]); + +AES_RETURN aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, const aes_decrypt_ctx cx[1]); + +AES_RETURN aes_cbc_encrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, const aes_encrypt_ctx cx[1]); + +AES_RETURN aes_cbc_decrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, const aes_decrypt_ctx cx[1]); + +AES_RETURN aes_mode_reset(aes_encrypt_ctx cx[1]); + +AES_RETURN aes_cfb_encrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, aes_encrypt_ctx cx[1]); + +AES_RETURN aes_cfb_decrypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, aes_encrypt_ctx cx[1]); + +#define aes_ofb_encrypt aes_ofb_crypt +#define aes_ofb_decrypt aes_ofb_crypt + +AES_RETURN aes_ofb_crypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *iv, aes_encrypt_ctx cx[1]); + +typedef void cbuf_inc(unsigned char *cbuf); + +#define aes_ctr_encrypt aes_ctr_crypt +#define aes_ctr_decrypt aes_ctr_crypt + +AES_RETURN aes_ctr_crypt(const unsigned char *ibuf, unsigned char *obuf, + int len, unsigned char *cbuf, cbuf_inc ctr_inc, aes_encrypt_ctx cx[1]); + +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/utils/crypto/aes_x64.asm b/src/utils/crypto/aes_x64.asm new file mode 100644 index 00000000000..f86afcf4dd6 --- /dev/null +++ b/src/utils/crypto/aes_x64.asm @@ -0,0 +1,904 @@ + +; --------------------------------------------------------------------------- +; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. +; +; LICENSE TERMS +; +; The free distribution and use of this software is allowed (with or without +; changes) provided that: +; +; 1. source code distributions include the above copyright notice, this +; list of conditions and the following disclaimer; +; +; 2. binary distributions include the above copyright notice, this list +; of conditions and the following disclaimer in their documentation; +; +; 3. the name of the copyright holder is not used to endorse products +; built using this software without specific written permission. +; +; DISCLAIMER +; +; This software is provided 'as is' with no explicit or implied warranties +; in respect of its properties, including, but not limited to, correctness +; and/or fitness for purpose. +; --------------------------------------------------------------------------- +; Issue 20/12/2007 +; +; I am grateful to Dag Arne Osvik for many discussions of the techniques that +; can be used to optimise AES assembler code on AMD64/EM64T architectures. +; Some of the techniques used in this implementation are the result of +; suggestions made by him for which I am most grateful. + +; An AES implementation for AMD64 processors using the YASM assembler. This +; implemetation provides only encryption, decryption and hence requires key +; scheduling support in C. It uses 8k bytes of tables but its encryption and +; decryption performance is very close to that obtained using large tables. +; It can use either Windows or Gnu/Linux calling conventions, which are as +; follows: +; windows gnu/linux +; +; in_blk rcx rdi +; out_blk rdx rsi +; context (cx) r8 rdx +; +; preserved rsi - + rbx, rbp, rsp, r12, r13, r14 & r15 +; registers rdi - on both +; +; destroyed - rsi + rax, rcx, rdx, r8, r9, r10 & r11 +; registers - rdi on both +; +; The default convention is that for windows, the gnu/linux convention being +; used if __GNUC__ is defined. +; +; Define _SEH_ to include support for Win64 structured exception handling +; (this requires YASM version 0.6 or later). +; +; This code provides the standard AES block size (128 bits, 16 bytes) and the +; three standard AES key sizes (128, 192 and 256 bits). It has the same call +; interface as my C implementation. It uses the Microsoft C AMD64 calling +; conventions in which the three parameters are placed in rcx, rdx and r8 +; respectively. The rbx, rsi, rdi, rbp and r12..r15 registers are preserved. +; +; AES_RETURN aes_encrypt(const unsigned char in_blk[], +; unsigned char out_blk[], const aes_encrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt(const unsigned char in_blk[], +; unsigned char out_blk[], const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_encrypt_key(const unsigned char key[], +; const aes_encrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt_key(const unsigned char key[], +; const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_encrypt_key(const unsigned char key[], +; unsigned int len, const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt_key(const unsigned char key[], +; unsigned int len, const aes_decrypt_ctx cx[1]); +; +; where is 128, 102 or 256. In the last two calls the length can be in +; either bits or bytes. +; +; Comment in/out the following lines to obtain the desired subroutines. These +; selections MUST match those in the C header file aes.h + +; %define AES_128 ; define if AES with 128 bit keys is needed +; %define AES_192 ; define if AES with 192 bit keys is needed +%define AES_256 ; define if AES with 256 bit keys is needed +; %define AES_VAR ; define if a variable key size is needed +%define ENCRYPTION ; define if encryption is needed +%define DECRYPTION ; define if decryption is needed +%define AES_REV_DKS ; define if key decryption schedule is reversed +%define LAST_ROUND_TABLES ; define for the faster version using extra tables + +; The encryption key schedule has the following in memory layout where N is the +; number of rounds (10, 12 or 14): +; +; lo: | input key (round 0) | ; each round is four 32-bit words +; | encryption round 1 | +; | encryption round 2 | +; .... +; | encryption round N-1 | +; hi: | encryption round N | +; +; The decryption key schedule is normally set up so that it has the same +; layout as above by actually reversing the order of the encryption key +; schedule in memory (this happens when AES_REV_DKS is set): +; +; lo: | decryption round 0 | = | encryption round N | +; | decryption round 1 | = INV_MIX_COL[ | encryption round N-1 | ] +; | decryption round 2 | = INV_MIX_COL[ | encryption round N-2 | ] +; .... .... +; | decryption round N-1 | = INV_MIX_COL[ | encryption round 1 | ] +; hi: | decryption round N | = | input key (round 0) | +; +; with rounds except the first and last modified using inv_mix_column() +; But if AES_REV_DKS is NOT set the order of keys is left as it is for +; encryption so that it has to be accessed in reverse when used for +; decryption (although the inverse mix column modifications are done) +; +; lo: | decryption round 0 | = | input key (round 0) | +; | decryption round 1 | = INV_MIX_COL[ | encryption round 1 | ] +; | decryption round 2 | = INV_MIX_COL[ | encryption round 2 | ] +; .... .... +; | decryption round N-1 | = INV_MIX_COL[ | encryption round N-1 | ] +; hi: | decryption round N | = | encryption round N | +; +; This layout is faster when the assembler key scheduling provided here +; is used. +; +; The DLL interface must use the _stdcall convention in which the number +; of bytes of parameter space is added after an @ to the sutine's name. +; We must also remove our parameters from the stack before return (see +; the do_exit macro). Define DLL_EXPORT for the Dynamic Link Library version. + +;%define DLL_EXPORT + +; End of user defines + +%ifdef AES_VAR +%ifndef AES_128 +%define AES_128 +%endif +%ifndef AES_192 +%define AES_192 +%endif +%ifndef AES_256 +%define AES_256 +%endif +%endif + +%ifdef AES_VAR +%define KS_LENGTH 60 +%elifdef AES_256 +%define KS_LENGTH 60 +%elifdef AES_192 +%define KS_LENGTH 52 +%else +%define KS_LENGTH 44 +%endif + +%define r0 rax +%define r1 rdx +%define r2 rcx +%define r3 rbx +%define r4 rsi +%define r5 rdi +%define r6 rbp +%define r7 rsp + +%define raxd eax +%define rdxd edx +%define rcxd ecx +%define rbxd ebx +%define rsid esi +%define rdid edi +%define rbpd ebp +%define rspd esp + +%define raxb al +%define rdxb dl +%define rcxb cl +%define rbxb bl +%define rsib sil +%define rdib dil +%define rbpb bpl +%define rspb spl + +%define r0h ah +%define r1h dh +%define r2h ch +%define r3h bh + +%define r0d eax +%define r1d edx +%define r2d ecx +%define r3d ebx + +; finite field multiplies by {02}, {04} and {08} + +%define f2(x) ((x<<1)^(((x>>7)&1)*0x11b)) +%define f4(x) ((x<<2)^(((x>>6)&1)*0x11b)^(((x>>6)&2)*0x11b)) +%define f8(x) ((x<<3)^(((x>>5)&1)*0x11b)^(((x>>5)&2)*0x11b)^(((x>>5)&4)*0x11b)) + +; finite field multiplies required in table generation + +%define f3(x) (f2(x) ^ x) +%define f9(x) (f8(x) ^ x) +%define fb(x) (f8(x) ^ f2(x) ^ x) +%define fd(x) (f8(x) ^ f4(x) ^ x) +%define fe(x) (f8(x) ^ f4(x) ^ f2(x)) + +; macro for expanding S-box data + +%macro enc_vals 1 + db %1(0x63),%1(0x7c),%1(0x77),%1(0x7b),%1(0xf2),%1(0x6b),%1(0x6f),%1(0xc5) + db %1(0x30),%1(0x01),%1(0x67),%1(0x2b),%1(0xfe),%1(0xd7),%1(0xab),%1(0x76) + db %1(0xca),%1(0x82),%1(0xc9),%1(0x7d),%1(0xfa),%1(0x59),%1(0x47),%1(0xf0) + db %1(0xad),%1(0xd4),%1(0xa2),%1(0xaf),%1(0x9c),%1(0xa4),%1(0x72),%1(0xc0) + db %1(0xb7),%1(0xfd),%1(0x93),%1(0x26),%1(0x36),%1(0x3f),%1(0xf7),%1(0xcc) + db %1(0x34),%1(0xa5),%1(0xe5),%1(0xf1),%1(0x71),%1(0xd8),%1(0x31),%1(0x15) + db %1(0x04),%1(0xc7),%1(0x23),%1(0xc3),%1(0x18),%1(0x96),%1(0x05),%1(0x9a) + db %1(0x07),%1(0x12),%1(0x80),%1(0xe2),%1(0xeb),%1(0x27),%1(0xb2),%1(0x75) + db %1(0x09),%1(0x83),%1(0x2c),%1(0x1a),%1(0x1b),%1(0x6e),%1(0x5a),%1(0xa0) + db %1(0x52),%1(0x3b),%1(0xd6),%1(0xb3),%1(0x29),%1(0xe3),%1(0x2f),%1(0x84) + db %1(0x53),%1(0xd1),%1(0x00),%1(0xed),%1(0x20),%1(0xfc),%1(0xb1),%1(0x5b) + db %1(0x6a),%1(0xcb),%1(0xbe),%1(0x39),%1(0x4a),%1(0x4c),%1(0x58),%1(0xcf) + db %1(0xd0),%1(0xef),%1(0xaa),%1(0xfb),%1(0x43),%1(0x4d),%1(0x33),%1(0x85) + db %1(0x45),%1(0xf9),%1(0x02),%1(0x7f),%1(0x50),%1(0x3c),%1(0x9f),%1(0xa8) + db %1(0x51),%1(0xa3),%1(0x40),%1(0x8f),%1(0x92),%1(0x9d),%1(0x38),%1(0xf5) + db %1(0xbc),%1(0xb6),%1(0xda),%1(0x21),%1(0x10),%1(0xff),%1(0xf3),%1(0xd2) + db %1(0xcd),%1(0x0c),%1(0x13),%1(0xec),%1(0x5f),%1(0x97),%1(0x44),%1(0x17) + db %1(0xc4),%1(0xa7),%1(0x7e),%1(0x3d),%1(0x64),%1(0x5d),%1(0x19),%1(0x73) + db %1(0x60),%1(0x81),%1(0x4f),%1(0xdc),%1(0x22),%1(0x2a),%1(0x90),%1(0x88) + db %1(0x46),%1(0xee),%1(0xb8),%1(0x14),%1(0xde),%1(0x5e),%1(0x0b),%1(0xdb) + db %1(0xe0),%1(0x32),%1(0x3a),%1(0x0a),%1(0x49),%1(0x06),%1(0x24),%1(0x5c) + db %1(0xc2),%1(0xd3),%1(0xac),%1(0x62),%1(0x91),%1(0x95),%1(0xe4),%1(0x79) + db %1(0xe7),%1(0xc8),%1(0x37),%1(0x6d),%1(0x8d),%1(0xd5),%1(0x4e),%1(0xa9) + db %1(0x6c),%1(0x56),%1(0xf4),%1(0xea),%1(0x65),%1(0x7a),%1(0xae),%1(0x08) + db %1(0xba),%1(0x78),%1(0x25),%1(0x2e),%1(0x1c),%1(0xa6),%1(0xb4),%1(0xc6) + db %1(0xe8),%1(0xdd),%1(0x74),%1(0x1f),%1(0x4b),%1(0xbd),%1(0x8b),%1(0x8a) + db %1(0x70),%1(0x3e),%1(0xb5),%1(0x66),%1(0x48),%1(0x03),%1(0xf6),%1(0x0e) + db %1(0x61),%1(0x35),%1(0x57),%1(0xb9),%1(0x86),%1(0xc1),%1(0x1d),%1(0x9e) + db %1(0xe1),%1(0xf8),%1(0x98),%1(0x11),%1(0x69),%1(0xd9),%1(0x8e),%1(0x94) + db %1(0x9b),%1(0x1e),%1(0x87),%1(0xe9),%1(0xce),%1(0x55),%1(0x28),%1(0xdf) + db %1(0x8c),%1(0xa1),%1(0x89),%1(0x0d),%1(0xbf),%1(0xe6),%1(0x42),%1(0x68) + db %1(0x41),%1(0x99),%1(0x2d),%1(0x0f),%1(0xb0),%1(0x54),%1(0xbb),%1(0x16) +%endmacro + +%macro dec_vals 1 + db %1(0x52),%1(0x09),%1(0x6a),%1(0xd5),%1(0x30),%1(0x36),%1(0xa5),%1(0x38) + db %1(0xbf),%1(0x40),%1(0xa3),%1(0x9e),%1(0x81),%1(0xf3),%1(0xd7),%1(0xfb) + db %1(0x7c),%1(0xe3),%1(0x39),%1(0x82),%1(0x9b),%1(0x2f),%1(0xff),%1(0x87) + db %1(0x34),%1(0x8e),%1(0x43),%1(0x44),%1(0xc4),%1(0xde),%1(0xe9),%1(0xcb) + db %1(0x54),%1(0x7b),%1(0x94),%1(0x32),%1(0xa6),%1(0xc2),%1(0x23),%1(0x3d) + db %1(0xee),%1(0x4c),%1(0x95),%1(0x0b),%1(0x42),%1(0xfa),%1(0xc3),%1(0x4e) + db %1(0x08),%1(0x2e),%1(0xa1),%1(0x66),%1(0x28),%1(0xd9),%1(0x24),%1(0xb2) + db %1(0x76),%1(0x5b),%1(0xa2),%1(0x49),%1(0x6d),%1(0x8b),%1(0xd1),%1(0x25) + db %1(0x72),%1(0xf8),%1(0xf6),%1(0x64),%1(0x86),%1(0x68),%1(0x98),%1(0x16) + db %1(0xd4),%1(0xa4),%1(0x5c),%1(0xcc),%1(0x5d),%1(0x65),%1(0xb6),%1(0x92) + db %1(0x6c),%1(0x70),%1(0x48),%1(0x50),%1(0xfd),%1(0xed),%1(0xb9),%1(0xda) + db %1(0x5e),%1(0x15),%1(0x46),%1(0x57),%1(0xa7),%1(0x8d),%1(0x9d),%1(0x84) + db %1(0x90),%1(0xd8),%1(0xab),%1(0x00),%1(0x8c),%1(0xbc),%1(0xd3),%1(0x0a) + db %1(0xf7),%1(0xe4),%1(0x58),%1(0x05),%1(0xb8),%1(0xb3),%1(0x45),%1(0x06) + db %1(0xd0),%1(0x2c),%1(0x1e),%1(0x8f),%1(0xca),%1(0x3f),%1(0x0f),%1(0x02) + db %1(0xc1),%1(0xaf),%1(0xbd),%1(0x03),%1(0x01),%1(0x13),%1(0x8a),%1(0x6b) + db %1(0x3a),%1(0x91),%1(0x11),%1(0x41),%1(0x4f),%1(0x67),%1(0xdc),%1(0xea) + db %1(0x97),%1(0xf2),%1(0xcf),%1(0xce),%1(0xf0),%1(0xb4),%1(0xe6),%1(0x73) + db %1(0x96),%1(0xac),%1(0x74),%1(0x22),%1(0xe7),%1(0xad),%1(0x35),%1(0x85) + db %1(0xe2),%1(0xf9),%1(0x37),%1(0xe8),%1(0x1c),%1(0x75),%1(0xdf),%1(0x6e) + db %1(0x47),%1(0xf1),%1(0x1a),%1(0x71),%1(0x1d),%1(0x29),%1(0xc5),%1(0x89) + db %1(0x6f),%1(0xb7),%1(0x62),%1(0x0e),%1(0xaa),%1(0x18),%1(0xbe),%1(0x1b) + db %1(0xfc),%1(0x56),%1(0x3e),%1(0x4b),%1(0xc6),%1(0xd2),%1(0x79),%1(0x20) + db %1(0x9a),%1(0xdb),%1(0xc0),%1(0xfe),%1(0x78),%1(0xcd),%1(0x5a),%1(0xf4) + db %1(0x1f),%1(0xdd),%1(0xa8),%1(0x33),%1(0x88),%1(0x07),%1(0xc7),%1(0x31) + db %1(0xb1),%1(0x12),%1(0x10),%1(0x59),%1(0x27),%1(0x80),%1(0xec),%1(0x5f) + db %1(0x60),%1(0x51),%1(0x7f),%1(0xa9),%1(0x19),%1(0xb5),%1(0x4a),%1(0x0d) + db %1(0x2d),%1(0xe5),%1(0x7a),%1(0x9f),%1(0x93),%1(0xc9),%1(0x9c),%1(0xef) + db %1(0xa0),%1(0xe0),%1(0x3b),%1(0x4d),%1(0xae),%1(0x2a),%1(0xf5),%1(0xb0) + db %1(0xc8),%1(0xeb),%1(0xbb),%1(0x3c),%1(0x83),%1(0x53),%1(0x99),%1(0x61) + db %1(0x17),%1(0x2b),%1(0x04),%1(0x7e),%1(0xba),%1(0x77),%1(0xd6),%1(0x26) + db %1(0xe1),%1(0x69),%1(0x14),%1(0x63),%1(0x55),%1(0x21),%1(0x0c),%1(0x7d) +%endmacro + +%define u8(x) f2(x), x, x, f3(x), f2(x), x, x, f3(x) +%define v8(x) fe(x), f9(x), fd(x), fb(x), fe(x), f9(x), fd(x), x +%define w8(x) x, 0, 0, 0, x, 0, 0, 0 + +%define tptr rbp ; table pointer +%define kptr r8 ; key schedule pointer +%define fofs 128 ; adjust offset in key schedule to keep |disp| < 128 +%define fk_ref(x,y) [kptr-16*x+fofs+4*y] +%ifdef AES_REV_DKS +%define rofs 128 +%define ik_ref(x,y) [kptr-16*x+rofs+4*y] +%else +%define rofs -128 +%define ik_ref(x,y) [kptr+16*x+rofs+4*y] +%endif + +%define tab_0(x) [tptr+8*x] +%define tab_1(x) [tptr+8*x+3] +%define tab_2(x) [tptr+8*x+2] +%define tab_3(x) [tptr+8*x+1] +%define tab_f(x) byte [tptr+8*x+1] +%define tab_i(x) byte [tptr+8*x+7] +%define t_ref(x,r) tab_ %+ x(r) + +%macro ff_rnd 5 ; normal forward round + mov %1d, fk_ref(%5,0) + mov %2d, fk_ref(%5,1) + mov %3d, fk_ref(%5,2) + mov %4d, fk_ref(%5,3) + + movzx esi, al + movzx edi, ah + shr eax, 16 + xor %1d, t_ref(0,rsi) + xor %4d, t_ref(1,rdi) + movzx esi, al + movzx edi, ah + xor %3d, t_ref(2,rsi) + xor %2d, t_ref(3,rdi) + + movzx esi, bl + movzx edi, bh + shr ebx, 16 + xor %2d, t_ref(0,rsi) + xor %1d, t_ref(1,rdi) + movzx esi, bl + movzx edi, bh + xor %4d, t_ref(2,rsi) + xor %3d, t_ref(3,rdi) + + movzx esi, cl + movzx edi, ch + shr ecx, 16 + xor %3d, t_ref(0,rsi) + xor %2d, t_ref(1,rdi) + movzx esi, cl + movzx edi, ch + xor %1d, t_ref(2,rsi) + xor %4d, t_ref(3,rdi) + + movzx esi, dl + movzx edi, dh + shr edx, 16 + xor %4d, t_ref(0,rsi) + xor %3d, t_ref(1,rdi) + movzx esi, dl + movzx edi, dh + xor %2d, t_ref(2,rsi) + xor %1d, t_ref(3,rdi) + + mov eax,%1d + mov ebx,%2d + mov ecx,%3d + mov edx,%4d +%endmacro + +%ifdef LAST_ROUND_TABLES + +%macro fl_rnd 5 ; last forward round + add tptr, 2048 + mov %1d, fk_ref(%5,0) + mov %2d, fk_ref(%5,1) + mov %3d, fk_ref(%5,2) + mov %4d, fk_ref(%5,3) + + movzx esi, al + movzx edi, ah + shr eax, 16 + xor %1d, t_ref(0,rsi) + xor %4d, t_ref(1,rdi) + movzx esi, al + movzx edi, ah + xor %3d, t_ref(2,rsi) + xor %2d, t_ref(3,rdi) + + movzx esi, bl + movzx edi, bh + shr ebx, 16 + xor %2d, t_ref(0,rsi) + xor %1d, t_ref(1,rdi) + movzx esi, bl + movzx edi, bh + xor %4d, t_ref(2,rsi) + xor %3d, t_ref(3,rdi) + + movzx esi, cl + movzx edi, ch + shr ecx, 16 + xor %3d, t_ref(0,rsi) + xor %2d, t_ref(1,rdi) + movzx esi, cl + movzx edi, ch + xor %1d, t_ref(2,rsi) + xor %4d, t_ref(3,rdi) + + movzx esi, dl + movzx edi, dh + shr edx, 16 + xor %4d, t_ref(0,rsi) + xor %3d, t_ref(1,rdi) + movzx esi, dl + movzx edi, dh + xor %2d, t_ref(2,rsi) + xor %1d, t_ref(3,rdi) +%endmacro + +%else + +%macro fl_rnd 5 ; last forward round + mov %1d, fk_ref(%5,0) + mov %2d, fk_ref(%5,1) + mov %3d, fk_ref(%5,2) + mov %4d, fk_ref(%5,3) + + movzx esi, al + movzx edi, ah + shr eax, 16 + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + xor %1d, esi + rol edi, 8 + xor %4d, edi + movzx esi, al + movzx edi, ah + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + rol esi, 16 + rol edi, 24 + xor %3d, esi + xor %2d, edi + + movzx esi, bl + movzx edi, bh + shr ebx, 16 + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + xor %2d, esi + rol edi, 8 + xor %1d, edi + movzx esi, bl + movzx edi, bh + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + rol esi, 16 + rol edi, 24 + xor %4d, esi + xor %3d, edi + + movzx esi, cl + movzx edi, ch + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + shr ecx, 16 + xor %3d, esi + rol edi, 8 + xor %2d, edi + movzx esi, cl + movzx edi, ch + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + rol esi, 16 + rol edi, 24 + xor %1d, esi + xor %4d, edi + + movzx esi, dl + movzx edi, dh + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + shr edx, 16 + xor %4d, esi + rol edi, 8 + xor %3d, edi + movzx esi, dl + movzx edi, dh + movzx esi, t_ref(f,rsi) + movzx edi, t_ref(f,rdi) + rol esi, 16 + rol edi, 24 + xor %2d, esi + xor %1d, edi +%endmacro + +%endif + +%macro ii_rnd 5 ; normal inverse round + mov %1d, ik_ref(%5,0) + mov %2d, ik_ref(%5,1) + mov %3d, ik_ref(%5,2) + mov %4d, ik_ref(%5,3) + + movzx esi, al + movzx edi, ah + shr eax, 16 + xor %1d, t_ref(0,rsi) + xor %2d, t_ref(1,rdi) + movzx esi, al + movzx edi, ah + xor %3d, t_ref(2,rsi) + xor %4d, t_ref(3,rdi) + + movzx esi, bl + movzx edi, bh + shr ebx, 16 + xor %2d, t_ref(0,rsi) + xor %3d, t_ref(1,rdi) + movzx esi, bl + movzx edi, bh + xor %4d, t_ref(2,rsi) + xor %1d, t_ref(3,rdi) + + movzx esi, cl + movzx edi, ch + shr ecx, 16 + xor %3d, t_ref(0,rsi) + xor %4d, t_ref(1,rdi) + movzx esi, cl + movzx edi, ch + xor %1d, t_ref(2,rsi) + xor %2d, t_ref(3,rdi) + + movzx esi, dl + movzx edi, dh + shr edx, 16 + xor %4d, t_ref(0,rsi) + xor %1d, t_ref(1,rdi) + movzx esi, dl + movzx edi, dh + xor %2d, t_ref(2,rsi) + xor %3d, t_ref(3,rdi) + + mov eax,%1d + mov ebx,%2d + mov ecx,%3d + mov edx,%4d +%endmacro + +%ifdef LAST_ROUND_TABLES + +%macro il_rnd 5 ; last inverse round + add tptr, 2048 + mov %1d, ik_ref(%5,0) + mov %2d, ik_ref(%5,1) + mov %3d, ik_ref(%5,2) + mov %4d, ik_ref(%5,3) + + movzx esi, al + movzx edi, ah + shr eax, 16 + xor %1d, t_ref(0,rsi) + xor %2d, t_ref(1,rdi) + movzx esi, al + movzx edi, ah + xor %3d, t_ref(2,rsi) + xor %4d, t_ref(3,rdi) + + movzx esi, bl + movzx edi, bh + shr ebx, 16 + xor %2d, t_ref(0,rsi) + xor %3d, t_ref(1,rdi) + movzx esi, bl + movzx edi, bh + xor %4d, t_ref(2,rsi) + xor %1d, t_ref(3,rdi) + + movzx esi, cl + movzx edi, ch + shr ecx, 16 + xor %3d, t_ref(0,rsi) + xor %4d, t_ref(1,rdi) + movzx esi, cl + movzx edi, ch + xor %1d, t_ref(2,rsi) + xor %2d, t_ref(3,rdi) + + movzx esi, dl + movzx edi, dh + shr edx, 16 + xor %4d, t_ref(0,rsi) + xor %1d, t_ref(1,rdi) + movzx esi, dl + movzx edi, dh + xor %2d, t_ref(2,rsi) + xor %3d, t_ref(3,rdi) +%endmacro + +%else + +%macro il_rnd 5 ; last inverse round + mov %1d, ik_ref(%5,0) + mov %2d, ik_ref(%5,1) + mov %3d, ik_ref(%5,2) + mov %4d, ik_ref(%5,3) + + movzx esi, al + movzx edi, ah + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + shr eax, 16 + xor %1d, esi + rol edi, 8 + xor %2d, edi + movzx esi, al + movzx edi, ah + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + rol esi, 16 + rol edi, 24 + xor %3d, esi + xor %4d, edi + + movzx esi, bl + movzx edi, bh + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + shr ebx, 16 + xor %2d, esi + rol edi, 8 + xor %3d, edi + movzx esi, bl + movzx edi, bh + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + rol esi, 16 + rol edi, 24 + xor %4d, esi + xor %1d, edi + + movzx esi, cl + movzx edi, ch + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + shr ecx, 16 + xor %3d, esi + rol edi, 8 + xor %4d, edi + movzx esi, cl + movzx edi, ch + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + rol esi, 16 + rol edi, 24 + xor %1d, esi + xor %2d, edi + + movzx esi, dl + movzx edi, dh + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + shr edx, 16 + xor %4d, esi + rol edi, 8 + xor %1d, edi + movzx esi, dl + movzx edi, dh + movzx esi, t_ref(i,rsi) + movzx edi, t_ref(i,rdi) + rol esi, 16 + rol edi, 24 + xor %2d, esi + xor %3d, edi +%endmacro + +%endif + +%ifdef ENCRYPTION + + global aes_encrypt +%ifdef DLL_EXPORT + export aes_encrypt +%endif + + section .data align=64 + align 64 +enc_tab: + enc_vals u8 +%ifdef LAST_ROUND_TABLES + enc_vals w8 +%endif + + section .text align=16 + align 16 + +%ifdef _SEH_ +proc_frame aes_encrypt + alloc_stack 7*8 ; 7 to align stack to 16 bytes + save_reg rsi,4*8 + save_reg rdi,5*8 + save_reg rbx,1*8 + save_reg rbp,2*8 + save_reg r12,3*8 +end_prologue + mov rdi, rcx ; input pointer + mov [rsp+0*8], rdx ; output pointer +%else + aes_encrypt: + %ifdef __GNUC__ + sub rsp, 4*8 ; gnu/linux binary interface + mov [rsp+0*8], rsi ; output pointer + mov r8, rdx ; context + %else + sub rsp, 6*8 ; windows binary interface + mov [rsp+4*8], rsi + mov [rsp+5*8], rdi + mov rdi, rcx ; input pointer + mov [rsp+0*8], rdx ; output pointer + %endif + mov [rsp+1*8], rbx ; input pointer in rdi + mov [rsp+2*8], rbp ; output pointer in [rsp] + mov [rsp+3*8], r12 ; context in r8 +%endif + + movzx esi, byte [kptr+4*KS_LENGTH] + lea tptr,[enc_tab wrt rip] + sub kptr, fofs + + mov eax, [rdi+0*4] + mov ebx, [rdi+1*4] + mov ecx, [rdi+2*4] + mov edx, [rdi+3*4] + + xor eax, [kptr+fofs] + xor ebx, [kptr+fofs+4] + xor ecx, [kptr+fofs+8] + xor edx, [kptr+fofs+12] + + lea kptr,[kptr+rsi] + cmp esi, 10*16 + je .3 + cmp esi, 12*16 + je .2 + cmp esi, 14*16 + je .1 + mov rax, -1 + jmp .4 + +.1: ff_rnd r9, r10, r11, r12, 13 + ff_rnd r9, r10, r11, r12, 12 +.2: ff_rnd r9, r10, r11, r12, 11 + ff_rnd r9, r10, r11, r12, 10 +.3: ff_rnd r9, r10, r11, r12, 9 + ff_rnd r9, r10, r11, r12, 8 + ff_rnd r9, r10, r11, r12, 7 + ff_rnd r9, r10, r11, r12, 6 + ff_rnd r9, r10, r11, r12, 5 + ff_rnd r9, r10, r11, r12, 4 + ff_rnd r9, r10, r11, r12, 3 + ff_rnd r9, r10, r11, r12, 2 + ff_rnd r9, r10, r11, r12, 1 + fl_rnd r9, r10, r11, r12, 0 + + mov rbx, [rsp] + mov [rbx], r9d + mov [rbx+4], r10d + mov [rbx+8], r11d + mov [rbx+12], r12d + xor rax, rax +.4: + mov rbx, [rsp+1*8] + mov rbp, [rsp+2*8] + mov r12, [rsp+3*8] +%ifdef __GNUC__ + add rsp, 4*8 + ret +%else + mov rsi, [rsp+4*8] + mov rdi, [rsp+5*8] + %ifdef _SEH_ + add rsp, 7*8 + ret + endproc_frame + %else + add rsp, 6*8 + ret + %endif +%endif + +%endif + +%ifdef DECRYPTION + + global aes_decrypt +%ifdef DLL_EXPORT + export aes_decrypt +%endif + + section .data + align 64 +dec_tab: + dec_vals v8 +%ifdef LAST_ROUND_TABLES + dec_vals w8 +%endif + + section .text + align 16 + +%ifdef _SEH_ +proc_frame aes_decrypt + alloc_stack 7*8 ; 7 to align stack to 16 bytes + save_reg rsi,4*8 + save_reg rdi,5*8 + save_reg rbx,1*8 + save_reg rbp,2*8 + save_reg r12,3*8 +end_prologue + mov rdi, rcx ; input pointer + mov [rsp+0*8], rdx ; output pointer +%else + aes_decrypt: + %ifdef __GNUC__ + sub rsp, 4*8 ; gnu/linux binary interface + mov [rsp+0*8], rsi ; output pointer + mov r8, rdx ; context + %else + sub rsp, 6*8 ; windows binary interface + mov [rsp+4*8], rsi + mov [rsp+5*8], rdi + mov rdi, rcx ; input pointer + mov [rsp+0*8], rdx ; output pointer + %endif + mov [rsp+1*8], rbx ; input pointer in rdi + mov [rsp+2*8], rbp ; output pointer in [rsp] + mov [rsp+3*8], r12 ; context in r8 +%endif + + movzx esi,byte[kptr+4*KS_LENGTH] + lea tptr,[dec_tab wrt rip] + sub kptr, rofs + + mov eax, [rdi+0*4] + mov ebx, [rdi+1*4] + mov ecx, [rdi+2*4] + mov edx, [rdi+3*4] + +%ifdef AES_REV_DKS + mov rdi, kptr + lea kptr,[kptr+rsi] +%else + lea rdi,[kptr+rsi] +%endif + + xor eax, [rdi+rofs] + xor ebx, [rdi+rofs+4] + xor ecx, [rdi+rofs+8] + xor edx, [rdi+rofs+12] + + cmp esi, 10*16 + je .3 + cmp esi, 12*16 + je .2 + cmp esi, 14*16 + je .1 + mov rax, -1 + jmp .4 + +.1: ii_rnd r9, r10, r11, r12, 13 + ii_rnd r9, r10, r11, r12, 12 +.2: ii_rnd r9, r10, r11, r12, 11 + ii_rnd r9, r10, r11, r12, 10 +.3: ii_rnd r9, r10, r11, r12, 9 + ii_rnd r9, r10, r11, r12, 8 + ii_rnd r9, r10, r11, r12, 7 + ii_rnd r9, r10, r11, r12, 6 + ii_rnd r9, r10, r11, r12, 5 + ii_rnd r9, r10, r11, r12, 4 + ii_rnd r9, r10, r11, r12, 3 + ii_rnd r9, r10, r11, r12, 2 + ii_rnd r9, r10, r11, r12, 1 + il_rnd r9, r10, r11, r12, 0 + + mov rbx, [rsp] + mov [rbx], r9d + mov [rbx+4], r10d + mov [rbx+8], r11d + mov [rbx+12], r12d + xor rax, rax +.4: mov rbx, [rsp+1*8] + mov rbp, [rsp+2*8] + mov r12, [rsp+3*8] +%ifdef __GNUC__ + add rsp, 4*8 + ret +%else + mov rsi, [rsp+4*8] + mov rdi, [rsp+5*8] + %ifdef _SEH_ + add rsp, 7*8 + ret + endproc_frame + %else + add rsp, 6*8 + ret + %endif +%endif + +%endif + + end diff --git a/src/utils/crypto/aes_x86.asm b/src/utils/crypto/aes_x86.asm new file mode 100644 index 00000000000..7fc9093ec0e --- /dev/null +++ b/src/utils/crypto/aes_x86.asm @@ -0,0 +1,644 @@ + +; --------------------------------------------------------------------------- +; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. +; +; LICENSE TERMS +; +; The free distribution and use of this software is allowed (with or without +; changes) provided that: +; +; 1. source code distributions include the above copyright notice, this +; list of conditions and the following disclaimer; +; +; 2. binary distributions include the above copyright notice, this list +; of conditions and the following disclaimer in their documentation; +; +; 3. the name of the copyright holder is not used to endorse products +; built using this software without specific written permission. +; +; DISCLAIMER +; +; This software is provided 'as is' with no explicit or implied warranties +; in respect of its properties, including, but not limited to, correctness +; and/or fitness for purpose. +; --------------------------------------------------------------------------- +; Issue 20/12/2007 +; +; This code requires ASM_X86_V1C to be set in aesopt.h. It requires the C files +; aeskey.c and aestab.c for support. + +; An AES implementation for x86 processors using the YASM (or NASM) assembler. +; This is an assembler implementation that covers encryption and decryption +; only and is intended as a replacement of the C file aescrypt.c. It hence +; requires the file aeskey.c for keying and aestab.c for the AES tables. It +; employs full tables rather than compressed tables. + +; This code provides the standard AES block size (128 bits, 16 bytes) and the +; three standard AES key sizes (128, 192 and 256 bits). It has the same call +; interface as my C implementation. The ebx, esi, edi and ebp registers are +; preserved across calls but eax, ecx and edx and the artihmetic status flags +; are not. It is also important that the defines below match those used in the +; C code. This code uses the VC++ register saving conentions; if it is used +; with another compiler, conventions for using and saving registers may need to +; be checked (and calling conventions). The YASM command line for the VC++ +; custom build step is: +; +; yasm -Xvc -f win32 -o "$(TargetDir)\$(InputName).obj" "$(InputPath)" +; +; The calling intefaces are: +; +; AES_RETURN aes_encrypt(const unsigned char in_blk[], +; unsigned char out_blk[], const aes_encrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt(const unsigned char in_blk[], +; unsigned char out_blk[], const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_encrypt_key(const unsigned char key[], +; const aes_encrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt_key(const unsigned char key[], +; const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_encrypt_key(const unsigned char key[], +; unsigned int len, const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt_key(const unsigned char key[], +; unsigned int len, const aes_decrypt_ctx cx[1]); +; +; where is 128, 102 or 256. In the last two calls the length can be in +; either bits or bytes. +; +; Comment in/out the following lines to obtain the desired subroutines. These +; selections MUST match those in the C header file aes.h + +; %define AES_128 ; define if AES with 128 bit keys is needed +; %define AES_192 ; define if AES with 192 bit keys is needed +%define AES_256 ; define if AES with 256 bit keys is needed +; %define AES_VAR ; define if a variable key size is needed +%define ENCRYPTION ; define if encryption is needed +%define DECRYPTION ; define if decryption is needed +%define AES_REV_DKS ; define if key decryption schedule is reversed +%define LAST_ROUND_TABLES ; define if tables are to be used for last round + +; offsets to parameters + +in_blk equ 4 ; input byte array address parameter +out_blk equ 8 ; output byte array address parameter +ctx equ 12 ; AES context structure +stk_spc equ 20 ; stack space +%define parms 12 ; parameter space on stack + +; The encryption key schedule has the following in memory layout where N is the +; number of rounds (10, 12 or 14): +; +; lo: | input key (round 0) | ; each round is four 32-bit words +; | encryption round 1 | +; | encryption round 2 | +; .... +; | encryption round N-1 | +; hi: | encryption round N | +; +; The decryption key schedule is normally set up so that it has the same +; layout as above by actually reversing the order of the encryption key +; schedule in memory (this happens when AES_REV_DKS is set): +; +; lo: | decryption round 0 | = | encryption round N | +; | decryption round 1 | = INV_MIX_COL[ | encryption round N-1 | ] +; | decryption round 2 | = INV_MIX_COL[ | encryption round N-2 | ] +; .... .... +; | decryption round N-1 | = INV_MIX_COL[ | encryption round 1 | ] +; hi: | decryption round N | = | input key (round 0) | +; +; with rounds except the first and last modified using inv_mix_column() +; But if AES_REV_DKS is NOT set the order of keys is left as it is for +; encryption so that it has to be accessed in reverse when used for +; decryption (although the inverse mix column modifications are done) +; +; lo: | decryption round 0 | = | input key (round 0) | +; | decryption round 1 | = INV_MIX_COL[ | encryption round 1 | ] +; | decryption round 2 | = INV_MIX_COL[ | encryption round 2 | ] +; .... .... +; | decryption round N-1 | = INV_MIX_COL[ | encryption round N-1 | ] +; hi: | decryption round N | = | encryption round N | +; +; This layout is faster when the assembler key scheduling provided here +; is used. +; +; The DLL interface must use the _stdcall convention in which the number +; of bytes of parameter space is added after an @ to the sutine's name. +; We must also remove our parameters from the stack before return (see +; the do_exit macro). Define DLL_EXPORT for the Dynamic Link Library version. + +;%define DLL_EXPORT + +; End of user defines + +%ifdef AES_VAR +%ifndef AES_128 +%define AES_128 +%endif +%ifndef AES_192 +%define AES_192 +%endif +%ifndef AES_256 +%define AES_256 +%endif +%endif + +%ifdef AES_VAR +%define KS_LENGTH 60 +%elifdef AES_256 +%define KS_LENGTH 60 +%elifdef AES_192 +%define KS_LENGTH 52 +%else +%define KS_LENGTH 44 +%endif + +; These macros implement stack based local variables + +%macro save 2 + mov [esp+4*%1],%2 +%endmacro + +%macro restore 2 + mov %1,[esp+4*%2] +%endmacro + +; the DLL has to implement the _stdcall calling interface on return +; In this case we have to take our parameters (3 4-byte pointers) +; off the stack + +%macro do_name 1-2 parms +%ifndef DLL_EXPORT + align 32 + global %1 +%1: +%else + align 32 + global %1@%2 + export %1@%2 +%1@%2: +%endif +%endmacro + +%macro do_call 1-2 parms +%ifndef DLL_EXPORT + call %1 + add esp,%2 +%else + call %1@%2 +%endif +%endmacro + +%macro do_exit 0-1 parms +%ifdef DLL_EXPORT + ret %1 +%else + ret +%endif +%endmacro + +%ifdef ENCRYPTION + + extern _t_fn + +%define etab_0(x) [_t_fn+4*x] +%define etab_1(x) [_t_fn+1024+4*x] +%define etab_2(x) [_t_fn+2048+4*x] +%define etab_3(x) [_t_fn+3072+4*x] + +%ifdef LAST_ROUND_TABLES + + extern _t_fl + +%define eltab_0(x) [_t_fl+4*x] +%define eltab_1(x) [_t_fl+1024+4*x] +%define eltab_2(x) [_t_fl+2048+4*x] +%define eltab_3(x) [_t_fl+3072+4*x] + +%else + +%define etab_b(x) byte [_t_fn+3072+4*x] + +%endif + +; ROUND FUNCTION. Build column[2] on ESI and column[3] on EDI that have the +; round keys pre-loaded. Build column[0] in EBP and column[1] in EBX. +; +; Input: +; +; EAX column[0] +; EBX column[1] +; ECX column[2] +; EDX column[3] +; ESI column key[round][2] +; EDI column key[round][3] +; EBP scratch +; +; Output: +; +; EBP column[0] unkeyed +; EBX column[1] unkeyed +; ESI column[2] keyed +; EDI column[3] keyed +; EAX scratch +; ECX scratch +; EDX scratch + +%macro rnd_fun 2 + + rol ebx,16 + %1 esi, cl, 0, ebp + %1 esi, dh, 1, ebp + %1 esi, bh, 3, ebp + %1 edi, dl, 0, ebp + %1 edi, ah, 1, ebp + %1 edi, bl, 2, ebp + %2 ebp, al, 0, ebp + shr ebx,16 + and eax,0xffff0000 + or eax,ebx + shr edx,16 + %1 ebp, ah, 1, ebx + %1 ebp, dh, 3, ebx + %2 ebx, dl, 2, ebx + %1 ebx, ch, 1, edx + %1 ebx, al, 0, edx + shr eax,16 + shr ecx,16 + %1 ebp, cl, 2, edx + %1 edi, ch, 3, edx + %1 esi, al, 2, edx + %1 ebx, ah, 3, edx + +%endmacro + +; Basic MOV and XOR Operations for normal rounds + +%macro nr_xor 4 + movzx %4,%2 + xor %1,etab_%3(%4) +%endmacro + +%macro nr_mov 4 + movzx %4,%2 + mov %1,etab_%3(%4) +%endmacro + +; Basic MOV and XOR Operations for last round + +%ifdef LAST_ROUND_TABLES + + %macro lr_xor 4 + movzx %4,%2 + xor %1,eltab_%3(%4) + %endmacro + + %macro lr_mov 4 + movzx %4,%2 + mov %1,eltab_%3(%4) + %endmacro + +%else + + %macro lr_xor 4 + movzx %4,%2 + movzx %4,etab_b(%4) + %if %3 != 0 + shl %4,8*%3 + %endif + xor %1,%4 + %endmacro + + %macro lr_mov 4 + movzx %4,%2 + movzx %1,etab_b(%4) + %if %3 != 0 + shl %1,8*%3 + %endif + %endmacro + +%endif + +%macro enc_round 0 + + add ebp,16 + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + rnd_fun nr_xor, nr_mov + + mov eax,ebp + mov ecx,esi + mov edx,edi + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + +%macro enc_last_round 0 + + add ebp,16 + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + rnd_fun lr_xor, lr_mov + + mov eax,ebp + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + + section .text align=32 + +; AES Encryption Subroutine + + do_name _aes_encrypt + + sub esp,stk_spc + mov [esp+16],ebp + mov [esp+12],ebx + mov [esp+ 8],esi + mov [esp+ 4],edi + + mov esi,[esp+in_blk+stk_spc] ; input pointer + mov eax,[esi ] + mov ebx,[esi+ 4] + mov ecx,[esi+ 8] + mov edx,[esi+12] + + mov ebp,[esp+ctx+stk_spc] ; key pointer + movzx edi,byte [ebp+4*KS_LENGTH] + xor eax,[ebp ] + xor ebx,[ebp+ 4] + xor ecx,[ebp+ 8] + xor edx,[ebp+12] + +; determine the number of rounds + + cmp edi,10*16 + je .3 + cmp edi,12*16 + je .2 + cmp edi,14*16 + je .1 + mov eax,-1 + jmp .5 + +.1: enc_round + enc_round +.2: enc_round + enc_round +.3: enc_round + enc_round + enc_round + enc_round + enc_round + enc_round + enc_round + enc_round + enc_round + enc_last_round + + mov edx,[esp+out_blk+stk_spc] + mov [edx],eax + mov [edx+4],ebx + mov [edx+8],esi + mov [edx+12],edi + xor eax,eax + +.5: mov ebp,[esp+16] + mov ebx,[esp+12] + mov esi,[esp+ 8] + mov edi,[esp+ 4] + add esp,stk_spc + do_exit + +%endif + +%ifdef DECRYPTION + + extern _t_in + +%define dtab_0(x) [_t_in+4*x] +%define dtab_1(x) [_t_in+1024+4*x] +%define dtab_2(x) [_t_in+2048+4*x] +%define dtab_3(x) [_t_in+3072+4*x] + +%ifdef LAST_ROUND_TABLES + + extern _t_il + +%define dltab_0(x) [_t_il+4*x] +%define dltab_1(x) [_t_il+1024+4*x] +%define dltab_2(x) [_t_il+2048+4*x] +%define dltab_3(x) [_t_il+3072+4*x] + +%else + + extern _t_ibox + +%define dtab_x(x) byte [_t_ibox+x] + +%endif + +%macro irn_fun 2 + + rol eax,16 + %1 esi, cl, 0, ebp + %1 esi, bh, 1, ebp + %1 esi, al, 2, ebp + %1 edi, dl, 0, ebp + %1 edi, ch, 1, ebp + %1 edi, ah, 3, ebp + %2 ebp, bl, 0, ebp + shr eax,16 + and ebx,0xffff0000 + or ebx,eax + shr ecx,16 + %1 ebp, bh, 1, eax + %1 ebp, ch, 3, eax + %2 eax, cl, 2, ecx + %1 eax, bl, 0, ecx + %1 eax, dh, 1, ecx + shr ebx,16 + shr edx,16 + %1 esi, dh, 3, ecx + %1 ebp, dl, 2, ecx + %1 eax, bh, 3, ecx + %1 edi, bl, 2, ecx + +%endmacro + +; Basic MOV and XOR Operations for normal rounds + +%macro ni_xor 4 + movzx %4,%2 + xor %1,dtab_%3(%4) +%endmacro + +%macro ni_mov 4 + movzx %4,%2 + mov %1,dtab_%3(%4) +%endmacro + +; Basic MOV and XOR Operations for last round + +%ifdef LAST_ROUND_TABLES + +%macro li_xor 4 + movzx %4,%2 + xor %1,dltab_%3(%4) +%endmacro + +%macro li_mov 4 + movzx %4,%2 + mov %1,dltab_%3(%4) +%endmacro + +%else + + %macro li_xor 4 + movzx %4,%2 + movzx %4,dtab_x(%4) + %if %3 != 0 + shl %4,8*%3 + %endif + xor %1,%4 + %endmacro + + %macro li_mov 4 + movzx %4,%2 + movzx %1,dtab_x(%4) + %if %3 != 0 + shl %1,8*%3 + %endif + %endmacro + +%endif + +%macro dec_round 0 + +%ifdef AES_REV_DKS + add ebp,16 +%else + sub ebp,16 +%endif + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + irn_fun ni_xor, ni_mov + + mov ebx,ebp + mov ecx,esi + mov edx,edi + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + +%macro dec_last_round 0 + +%ifdef AES_REV_DKS + add ebp,16 +%else + sub ebp,16 +%endif + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + irn_fun li_xor, li_mov + + mov ebx,ebp + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + + section .text + +; AES Decryption Subroutine + + do_name _aes_decrypt + + sub esp,stk_spc + mov [esp+16],ebp + mov [esp+12],ebx + mov [esp+ 8],esi + mov [esp+ 4],edi + +; input four columns and xor in first round key + + mov esi,[esp+in_blk+stk_spc] ; input pointer + mov eax,[esi ] + mov ebx,[esi+ 4] + mov ecx,[esi+ 8] + mov edx,[esi+12] + lea esi,[esi+16] + + mov ebp,[esp+ctx+stk_spc] ; key pointer + movzx edi,byte[ebp+4*KS_LENGTH] +%ifndef AES_REV_DKS ; if decryption key schedule is not reversed + lea ebp,[ebp+edi] ; we have to access it from the top down +%endif + xor eax,[ebp ] ; key schedule + xor ebx,[ebp+ 4] + xor ecx,[ebp+ 8] + xor edx,[ebp+12] + +; determine the number of rounds + + cmp edi,10*16 + je .3 + cmp edi,12*16 + je .2 + cmp edi,14*16 + je .1 + mov eax,-1 + jmp .5 + +.1: dec_round + dec_round +.2: dec_round + dec_round +.3: dec_round + dec_round + dec_round + dec_round + dec_round + dec_round + dec_round + dec_round + dec_round + dec_last_round + +; move final values to the output array. + + mov ebp,[esp+out_blk+stk_spc] + mov [ebp],eax + mov [ebp+4],ebx + mov [ebp+8],esi + mov [ebp+12],edi + xor eax,eax + +.5: mov ebp,[esp+16] + mov ebx,[esp+12] + mov esi,[esp+ 8] + mov edi,[esp+ 4] + add esp,stk_spc + do_exit + +%endif + + end + diff --git a/src/utils/crypto/aescrypt.c b/src/utils/crypto/aescrypt.c new file mode 100644 index 00000000000..7724431dde4 --- /dev/null +++ b/src/utils/crypto/aescrypt.c @@ -0,0 +1,311 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 +*/ + +#include "aesopt.h" +#include "aestab.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c]) +#define so(y,x,c) word_out(y, c, s(x,c)) + +#if defined(ARRAYS) +#define locals(y,x) x[4],y[4] +#else +#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3 +#endif + +#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \ + s(y,2) = s(x,2); s(y,3) = s(x,3); +#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3) +#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3) +#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3) + +#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) + +/* Visual C++ .Net v7.1 provides the fastest encryption code when using + Pentium optimiation with small code but this is poor for decryption + so we need to control this with the following VC++ pragmas +*/ + +#if defined( _MSC_VER ) && !defined( _WIN64 ) +#pragma optimize( "s", on ) +#endif + +/* Given the column (c) of the output state variable, the following + macros give the input state variables which are needed in its + computation for each row (r) of the state. All the alternative + macros give the same end values but expand into different ways + of calculating these values. In particular the complex macro + used for dynamically variable block sizes is designed to expand + to a compile time constant whenever possible but will expand to + conditional clauses on some branches (I am grateful to Frank + Yellin for this construction) +*/ + +#define fwd_var(x,r,c)\ + ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ + : r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\ + : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ + : ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))) + +#if defined(FT4_SET) +#undef dec_fmvars +#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c)) +#elif defined(FT1_SET) +#undef dec_fmvars +#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c)) +#else +#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c))) +#endif + +#if defined(FL4_SET) +#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c)) +#elif defined(FL1_SET) +#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c)) +#else +#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c)) +#endif + +AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]) +{ uint_32t locals(b0, b1); + const uint_32t *kp; +#if defined( dec_fmvars ) + dec_fmvars; /* declare variables for fwd_mcol() if needed */ +#endif + +#if defined( AES_ERR_CHK ) + if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) + return EXIT_FAILURE; +#endif + + kp = cx->ks; + state_in(b0, in, kp); + +#if (ENC_UNROLL == FULL) + + switch(cx->inf.b[0]) + { + case 14 * 16: + round(fwd_rnd, b1, b0, kp + 1 * N_COLS); + round(fwd_rnd, b0, b1, kp + 2 * N_COLS); + kp += 2 * N_COLS; + case 12 * 16: + round(fwd_rnd, b1, b0, kp + 1 * N_COLS); + round(fwd_rnd, b0, b1, kp + 2 * N_COLS); + kp += 2 * N_COLS; + case 10 * 16: + round(fwd_rnd, b1, b0, kp + 1 * N_COLS); + round(fwd_rnd, b0, b1, kp + 2 * N_COLS); + round(fwd_rnd, b1, b0, kp + 3 * N_COLS); + round(fwd_rnd, b0, b1, kp + 4 * N_COLS); + round(fwd_rnd, b1, b0, kp + 5 * N_COLS); + round(fwd_rnd, b0, b1, kp + 6 * N_COLS); + round(fwd_rnd, b1, b0, kp + 7 * N_COLS); + round(fwd_rnd, b0, b1, kp + 8 * N_COLS); + round(fwd_rnd, b1, b0, kp + 9 * N_COLS); + round(fwd_lrnd, b0, b1, kp +10 * N_COLS); + } + +#else + +#if (ENC_UNROLL == PARTIAL) + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) + { + kp += N_COLS; + round(fwd_rnd, b1, b0, kp); + kp += N_COLS; + round(fwd_rnd, b0, b1, kp); + } + kp += N_COLS; + round(fwd_rnd, b1, b0, kp); +#else + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) + { + kp += N_COLS; + round(fwd_rnd, b1, b0, kp); + l_copy(b0, b1); + } +#endif + kp += N_COLS; + round(fwd_lrnd, b0, b1, kp); + } +#endif + + state_out(out, b0); + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if ( FUNCS_IN_C & DECRYPTION_IN_C) + +/* Visual C++ .Net v7.1 provides the fastest encryption code when using + Pentium optimiation with small code but this is poor for decryption + so we need to control this with the following VC++ pragmas +*/ + +#if defined( _MSC_VER ) && !defined( _WIN64 ) +#pragma optimize( "t", on ) +#endif + +/* Given the column (c) of the output state variable, the following + macros give the input state variables which are needed in its + computation for each row (r) of the state. All the alternative + macros give the same end values but expand into different ways + of calculating these values. In particular the complex macro + used for dynamically variable block sizes is designed to expand + to a compile time constant whenever possible but will expand to + conditional clauses on some branches (I am grateful to Frank + Yellin for this construction) +*/ + +#define inv_var(x,r,c)\ + ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ + : r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\ + : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ + : ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))) + +#if defined(IT4_SET) +#undef dec_imvars +#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c)) +#elif defined(IT1_SET) +#undef dec_imvars +#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c)) +#else +#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))) +#endif + +#if defined(IL4_SET) +#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c)) +#elif defined(IL1_SET) +#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c)) +#else +#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)) +#endif + +/* This code can work with the decryption key schedule in the */ +/* order that is used for encrytpion (where the 1st decryption */ +/* round key is at the high end ot the schedule) or with a key */ +/* schedule that has been reversed to put the 1st decryption */ +/* round key at the low end of the schedule in memory (when */ +/* AES_REV_DKS is defined) */ + +#ifdef AES_REV_DKS +#define key_ofs 0 +#define rnd_key(n) (kp + n * N_COLS) +#else +#define key_ofs 1 +#define rnd_key(n) (kp - n * N_COLS) +#endif + +AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]) +{ uint_32t locals(b0, b1); +#if defined( dec_imvars ) + dec_imvars; /* declare variables for inv_mcol() if needed */ +#endif + const uint_32t *kp; + +#if defined( AES_ERR_CHK ) + if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) + return EXIT_FAILURE; +#endif + + kp = cx->ks + (key_ofs ? (cx->inf.b[0] >> 2) : 0); + state_in(b0, in, kp); + +#if (DEC_UNROLL == FULL) + + kp = cx->ks + (key_ofs ? 0 : (cx->inf.b[0] >> 2)); + switch(cx->inf.b[0]) + { + case 14 * 16: + round(inv_rnd, b1, b0, rnd_key(-13)); + round(inv_rnd, b0, b1, rnd_key(-12)); + case 12 * 16: + round(inv_rnd, b1, b0, rnd_key(-11)); + round(inv_rnd, b0, b1, rnd_key(-10)); + case 10 * 16: + round(inv_rnd, b1, b0, rnd_key(-9)); + round(inv_rnd, b0, b1, rnd_key(-8)); + round(inv_rnd, b1, b0, rnd_key(-7)); + round(inv_rnd, b0, b1, rnd_key(-6)); + round(inv_rnd, b1, b0, rnd_key(-5)); + round(inv_rnd, b0, b1, rnd_key(-4)); + round(inv_rnd, b1, b0, rnd_key(-3)); + round(inv_rnd, b0, b1, rnd_key(-2)); + round(inv_rnd, b1, b0, rnd_key(-1)); + round(inv_lrnd, b0, b1, rnd_key( 0)); + } + +#else + +#if (DEC_UNROLL == PARTIAL) + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) + { + kp = rnd_key(1); + round(inv_rnd, b1, b0, kp); + kp = rnd_key(1); + round(inv_rnd, b0, b1, kp); + } + kp = rnd_key(1); + round(inv_rnd, b1, b0, kp); +#else + { uint_32t rnd; + for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) + { + kp = rnd_key(1); + round(inv_rnd, b1, b0, kp); + l_copy(b0, b1); + } +#endif + kp = rnd_key(1); + round(inv_lrnd, b0, b1, kp); + } +#endif + + state_out(out, b0); + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(__cplusplus) +} +#endif diff --git a/src/utils/crypto/aeskey.c b/src/utils/crypto/aeskey.c new file mode 100644 index 00000000000..8e6264f933b --- /dev/null +++ b/src/utils/crypto/aeskey.c @@ -0,0 +1,577 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 +*/ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsequence-point" + +#include "aesopt.h" +#include "aestab.h" + +#ifdef USE_VIA_ACE_IF_PRESENT +# include "aes_via_ace.h" +#endif + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* Initialise the key schedule from the user supplied key. The key + length can be specified in bytes, with legal values of 16, 24 + and 32, or in bits, with legal values of 128, 192 and 256. These + values correspond with Nk values of 4, 6 and 8 respectively. + + The following macros implement a single cycle in the key + schedule generation process. The number of cycles needed + for each cx->n_col and nk value is: + + nk = 4 5 6 7 8 + ------------------------------ + cx->n_col = 4 10 9 8 7 7 + cx->n_col = 5 14 11 10 9 9 + cx->n_col = 6 19 15 12 11 11 + cx->n_col = 7 21 19 16 13 14 + cx->n_col = 8 29 23 19 17 14 +*/ + +#if (FUNCS_IN_C & ENC_KEYING_IN_C) + +#if defined(AES_128) || defined(AES_VAR) + +#define ke4(k,i) \ +{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ + k[4*(i)+5] = ss[1] ^= ss[0]; \ + k[4*(i)+6] = ss[2] ^= ss[1]; \ + k[4*(i)+7] = ss[3] ^= ss[2]; \ +} + +AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]) +{ uint_32t ss[4]; + + cx->ks[0] = ss[0] = word_in(key, 0); + cx->ks[1] = ss[1] = word_in(key, 1); + cx->ks[2] = ss[2] = word_in(key, 2); + cx->ks[3] = ss[3] = word_in(key, 3); + +#if ENC_UNROLL == NONE + { uint_32t i; + for(i = 0; i < 9; ++i) + ke4(cx->ks, i); + } +#else + ke4(cx->ks, 0); ke4(cx->ks, 1); + ke4(cx->ks, 2); ke4(cx->ks, 3); + ke4(cx->ks, 4); ke4(cx->ks, 5); + ke4(cx->ks, 6); ke4(cx->ks, 7); + ke4(cx->ks, 8); +#endif + ke4(cx->ks, 9); + cx->inf.l = 0; + cx->inf.b[0] = 10 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(AES_192) || defined(AES_VAR) + +#define kef6(k,i) \ +{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ + k[6*(i)+ 7] = ss[1] ^= ss[0]; \ + k[6*(i)+ 8] = ss[2] ^= ss[1]; \ + k[6*(i)+ 9] = ss[3] ^= ss[2]; \ +} + +#define ke6(k,i) \ +{ kef6(k,i); \ + k[6*(i)+10] = ss[4] ^= ss[3]; \ + k[6*(i)+11] = ss[5] ^= ss[4]; \ +} + +AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]) +{ uint_32t ss[6]; + + cx->ks[0] = ss[0] = word_in(key, 0); + cx->ks[1] = ss[1] = word_in(key, 1); + cx->ks[2] = ss[2] = word_in(key, 2); + cx->ks[3] = ss[3] = word_in(key, 3); + cx->ks[4] = ss[4] = word_in(key, 4); + cx->ks[5] = ss[5] = word_in(key, 5); + +#if ENC_UNROLL == NONE + { uint_32t i; + for(i = 0; i < 7; ++i) + ke6(cx->ks, i); + } +#else + ke6(cx->ks, 0); ke6(cx->ks, 1); + ke6(cx->ks, 2); ke6(cx->ks, 3); + ke6(cx->ks, 4); ke6(cx->ks, 5); + ke6(cx->ks, 6); +#endif + kef6(cx->ks, 7); + cx->inf.l = 0; + cx->inf.b[0] = 12 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(AES_256) || defined(AES_VAR) + +#define kef8(k,i) \ +{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ + k[8*(i)+ 9] = ss[1] ^= ss[0]; \ + k[8*(i)+10] = ss[2] ^= ss[1]; \ + k[8*(i)+11] = ss[3] ^= ss[2]; \ +} + +#define ke8(k,i) \ +{ kef8(k,i); \ + k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); \ + k[8*(i)+13] = ss[5] ^= ss[4]; \ + k[8*(i)+14] = ss[6] ^= ss[5]; \ + k[8*(i)+15] = ss[7] ^= ss[6]; \ +} + +AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]) +{ uint_32t ss[8]; + + cx->ks[0] = ss[0] = word_in(key, 0); + cx->ks[1] = ss[1] = word_in(key, 1); + cx->ks[2] = ss[2] = word_in(key, 2); + cx->ks[3] = ss[3] = word_in(key, 3); + cx->ks[4] = ss[4] = word_in(key, 4); + cx->ks[5] = ss[5] = word_in(key, 5); + cx->ks[6] = ss[6] = word_in(key, 6); + cx->ks[7] = ss[7] = word_in(key, 7); + +#if ENC_UNROLL == NONE + { uint_32t i; + for(i = 0; i < 6; ++i) + ke8(cx->ks, i); + } +#else + ke8(cx->ks, 0); ke8(cx->ks, 1); + ke8(cx->ks, 2); ke8(cx->ks, 3); + ke8(cx->ks, 4); ke8(cx->ks, 5); +#endif + kef8(cx->ks, 6); + cx->inf.l = 0; + cx->inf.b[0] = 14 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(AES_VAR) + +AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]) +{ + switch(key_len) + { +#if defined( AES_ERR_CHK ) + case 16: case 128: return aes_encrypt_key128(key, cx); + case 24: case 192: return aes_encrypt_key192(key, cx); + case 32: case 256: return aes_encrypt_key256(key, cx); + default: return EXIT_FAILURE; +#else + case 16: case 128: aes_encrypt_key128(key, cx); return; + case 24: case 192: aes_encrypt_key192(key, cx); return; + case 32: case 256: aes_encrypt_key256(key, cx); return; +#endif + } +} + +#endif + +#endif + +#if (FUNCS_IN_C & DEC_KEYING_IN_C) + +/* this is used to store the decryption round keys */ +/* in forward or reverse order */ + +#ifdef AES_REV_DKS +#define v(n,i) ((n) - (i) + 2 * ((i) & 3)) +#else +#define v(n,i) (i) +#endif + +#if DEC_ROUND == NO_TABLES +#define ff(x) (x) +#else +#define ff(x) inv_mcol(x) +#if defined( dec_imvars ) +#define d_vars dec_imvars +#endif +#endif + +#if defined(AES_128) || defined(AES_VAR) + +#define k4e(k,i) \ +{ k[v(40,(4*(i))+4)] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ + k[v(40,(4*(i))+5)] = ss[1] ^= ss[0]; \ + k[v(40,(4*(i))+6)] = ss[2] ^= ss[1]; \ + k[v(40,(4*(i))+7)] = ss[3] ^= ss[2]; \ +} + +#if 1 + +#define kdf4(k,i) \ +{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; \ + ss[1] = ss[1] ^ ss[3]; \ + ss[2] = ss[2] ^ ss[3]; \ + ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ + ss[i % 4] ^= ss[4]; \ + ss[4] ^= k[v(40,(4*(i)))]; k[v(40,(4*(i))+4)] = ff(ss[4]); \ + ss[4] ^= k[v(40,(4*(i))+1)]; k[v(40,(4*(i))+5)] = ff(ss[4]); \ + ss[4] ^= k[v(40,(4*(i))+2)]; k[v(40,(4*(i))+6)] = ff(ss[4]); \ + ss[4] ^= k[v(40,(4*(i))+3)]; k[v(40,(4*(i))+7)] = ff(ss[4]); \ +} + +#define kd4(k,i) \ +{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ + ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \ + k[v(40,(4*(i))+4)] = ss[4] ^= k[v(40,(4*(i)))]; \ + k[v(40,(4*(i))+5)] = ss[4] ^= k[v(40,(4*(i))+1)]; \ + k[v(40,(4*(i))+6)] = ss[4] ^= k[v(40,(4*(i))+2)]; \ + k[v(40,(4*(i))+7)] = ss[4] ^= k[v(40,(4*(i))+3)]; \ +} + +#define kdl4(k,i) \ +{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \ + k[v(40,(4*(i))+4)] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; \ + k[v(40,(4*(i))+5)] = ss[1] ^ ss[3]; \ + k[v(40,(4*(i))+6)] = ss[0]; \ + k[v(40,(4*(i))+7)] = ss[1]; \ +} + +#else + +#define kdf4(k,i) \ +{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ff(ss[0]); \ + ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ff(ss[1]); \ + ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ff(ss[2]); \ + ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ff(ss[3]); \ +} + +#define kd4(k,i) \ +{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \ + ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[v(40,(4*(i))+ 4)] = ss[4] ^= k[v(40,(4*(i)))]; \ + ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[4] ^= k[v(40,(4*(i))+ 1)]; \ + ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[4] ^= k[v(40,(4*(i))+ 2)]; \ + ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[4] ^= k[v(40,(4*(i))+ 3)]; \ +} + +#define kdl4(k,i) \ +{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ss[0]; \ + ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[1]; \ + ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[2]; \ + ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[3]; \ +} + +#endif + +AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]) +{ uint_32t ss[5]; +#if defined( d_vars ) + d_vars; +#endif + cx->ks[v(40,(0))] = ss[0] = word_in(key, 0); + cx->ks[v(40,(1))] = ss[1] = word_in(key, 1); + cx->ks[v(40,(2))] = ss[2] = word_in(key, 2); + cx->ks[v(40,(3))] = ss[3] = word_in(key, 3); + +#if DEC_UNROLL == NONE + { uint_32t i; + for(i = 0; i < 10; ++i) + k4e(cx->ks, i); +#if !(DEC_ROUND == NO_TABLES) + for(i = N_COLS; i < 10 * N_COLS; ++i) + cx->ks[i] = inv_mcol(cx->ks[i]); +#endif + } +#else + kdf4(cx->ks, 0); kd4(cx->ks, 1); + kd4(cx->ks, 2); kd4(cx->ks, 3); + kd4(cx->ks, 4); kd4(cx->ks, 5); + kd4(cx->ks, 6); kd4(cx->ks, 7); + kd4(cx->ks, 8); kdl4(cx->ks, 9); +#endif + cx->inf.l = 0; + cx->inf.b[0] = 10 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(AES_192) || defined(AES_VAR) + +#define k6ef(k,i) \ +{ k[v(48,(6*(i))+ 6)] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ + k[v(48,(6*(i))+ 7)] = ss[1] ^= ss[0]; \ + k[v(48,(6*(i))+ 8)] = ss[2] ^= ss[1]; \ + k[v(48,(6*(i))+ 9)] = ss[3] ^= ss[2]; \ +} + +#define k6e(k,i) \ +{ k6ef(k,i); \ + k[v(48,(6*(i))+10)] = ss[4] ^= ss[3]; \ + k[v(48,(6*(i))+11)] = ss[5] ^= ss[4]; \ +} + +#define kdf6(k,i) \ +{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ff(ss[0]); \ + ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ff(ss[1]); \ + ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ff(ss[2]); \ + ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ff(ss[3]); \ + ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ff(ss[4]); \ + ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ff(ss[5]); \ +} + +#define kd6(k,i) \ +{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \ + ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[v(48,(6*(i))+ 6)] = ss[6] ^= k[v(48,(6*(i)))]; \ + ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[6] ^= k[v(48,(6*(i))+ 1)]; \ + ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[6] ^= k[v(48,(6*(i))+ 2)]; \ + ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[6] ^= k[v(48,(6*(i))+ 3)]; \ + ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ss[6] ^= k[v(48,(6*(i))+ 4)]; \ + ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ss[6] ^= k[v(48,(6*(i))+ 5)]; \ +} + +#define kdl6(k,i) \ +{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ss[0]; \ + ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[1]; \ + ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[2]; \ + ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[3]; \ +} + +AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]) +{ uint_32t ss[7]; +#if defined( d_vars ) + d_vars; +#endif + cx->ks[v(48,(0))] = ss[0] = word_in(key, 0); + cx->ks[v(48,(1))] = ss[1] = word_in(key, 1); + cx->ks[v(48,(2))] = ss[2] = word_in(key, 2); + cx->ks[v(48,(3))] = ss[3] = word_in(key, 3); + +#if DEC_UNROLL == NONE + cx->ks[v(48,(4))] = ss[4] = word_in(key, 4); + cx->ks[v(48,(5))] = ss[5] = word_in(key, 5); + { uint_32t i; + + for(i = 0; i < 7; ++i) + k6e(cx->ks, i); + k6ef(cx->ks, 7); +#if !(DEC_ROUND == NO_TABLES) + for(i = N_COLS; i < 12 * N_COLS; ++i) + cx->ks[i] = inv_mcol(cx->ks[i]); +#endif + } +#else + cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4)); + cx->ks[v(48,(5))] = ff(ss[5] = word_in(key, 5)); + kdf6(cx->ks, 0); kd6(cx->ks, 1); + kd6(cx->ks, 2); kd6(cx->ks, 3); + kd6(cx->ks, 4); kd6(cx->ks, 5); + kd6(cx->ks, 6); kdl6(cx->ks, 7); +#endif + cx->inf.l = 0; + cx->inf.b[0] = 12 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(AES_256) || defined(AES_VAR) + +#define k8ef(k,i) \ +{ k[v(56,(8*(i))+ 8)] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ + k[v(56,(8*(i))+ 9)] = ss[1] ^= ss[0]; \ + k[v(56,(8*(i))+10)] = ss[2] ^= ss[1]; \ + k[v(56,(8*(i))+11)] = ss[3] ^= ss[2]; \ +} + +#define k8e(k,i) \ +{ k8ef(k,i); \ + k[v(56,(8*(i))+12)] = ss[4] ^= ls_box(ss[3],0); \ + k[v(56,(8*(i))+13)] = ss[5] ^= ss[4]; \ + k[v(56,(8*(i))+14)] = ss[6] ^= ss[5]; \ + k[v(56,(8*(i))+15)] = ss[7] ^= ss[6]; \ +} + +#define kdf8(k,i) \ +{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ff(ss[0]); \ + ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ff(ss[1]); \ + ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ff(ss[2]); \ + ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ff(ss[3]); \ + ss[4] ^= ls_box(ss[3],0); k[v(56,(8*(i))+12)] = ff(ss[4]); \ + ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ff(ss[5]); \ + ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ff(ss[6]); \ + ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ff(ss[7]); \ +} + +#define kd8(k,i) \ +{ ss[8] = ls_box(ss[7],3) ^ t_use(r,c)[i]; \ + ss[0] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+ 8)] = ss[8] ^= k[v(56,(8*(i)))]; \ + ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[8] ^= k[v(56,(8*(i))+ 1)]; \ + ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[8] ^= k[v(56,(8*(i))+ 2)]; \ + ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[8] ^= k[v(56,(8*(i))+ 3)]; \ + ss[8] = ls_box(ss[3],0); \ + ss[4] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+12)] = ss[8] ^= k[v(56,(8*(i))+ 4)]; \ + ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ss[8] ^= k[v(56,(8*(i))+ 5)]; \ + ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ss[8] ^= k[v(56,(8*(i))+ 6)]; \ + ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ss[8] ^= k[v(56,(8*(i))+ 7)]; \ +} + +#define kdl8(k,i) \ +{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ss[0]; \ + ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[1]; \ + ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[2]; \ + ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[3]; \ +} + +AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]) +{ uint_32t ss[9]; +#if defined( d_vars ) + d_vars; +#endif + cx->ks[v(56,(0))] = ss[0] = word_in(key, 0); + cx->ks[v(56,(1))] = ss[1] = word_in(key, 1); + cx->ks[v(56,(2))] = ss[2] = word_in(key, 2); + cx->ks[v(56,(3))] = ss[3] = word_in(key, 3); + +#if DEC_UNROLL == NONE + cx->ks[v(56,(4))] = ss[4] = word_in(key, 4); + cx->ks[v(56,(5))] = ss[5] = word_in(key, 5); + cx->ks[v(56,(6))] = ss[6] = word_in(key, 6); + cx->ks[v(56,(7))] = ss[7] = word_in(key, 7); + { uint_32t i; + + for(i = 0; i < 6; ++i) + k8e(cx->ks, i); + k8ef(cx->ks, 6); +#if !(DEC_ROUND == NO_TABLES) + for(i = N_COLS; i < 14 * N_COLS; ++i) + cx->ks[i] = inv_mcol(cx->ks[i]); + +#endif + } +#else + cx->ks[v(56,(4))] = ff(ss[4] = word_in(key, 4)); + cx->ks[v(56,(5))] = ff(ss[5] = word_in(key, 5)); + cx->ks[v(56,(6))] = ff(ss[6] = word_in(key, 6)); + cx->ks[v(56,(7))] = ff(ss[7] = word_in(key, 7)); + kdf8(cx->ks, 0); kd8(cx->ks, 1); + kd8(cx->ks, 2); kd8(cx->ks, 3); + kd8(cx->ks, 4); kd8(cx->ks, 5); + kdl8(cx->ks, 6); +#endif + cx->inf.l = 0; + cx->inf.b[0] = 14 * 16; + +#ifdef USE_VIA_ACE_IF_PRESENT + if(VIA_ACE_AVAILABLE) + cx->inf.b[1] = 0xff; +#endif + +#if defined( AES_ERR_CHK ) + return EXIT_SUCCESS; +#endif +} + +#endif + +#if defined(AES_VAR) + +AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]) +{ + switch(key_len) + { +#if defined( AES_ERR_CHK ) + case 16: case 128: return aes_decrypt_key128(key, cx); + case 24: case 192: return aes_decrypt_key192(key, cx); + case 32: case 256: return aes_decrypt_key256(key, cx); + default: return EXIT_FAILURE; +#else + case 16: case 128: aes_decrypt_key128(key, cx); return; + case 24: case 192: aes_decrypt_key192(key, cx); return; + case 32: case 256: aes_decrypt_key256(key, cx); return; +#endif + } +} + +#endif + +#endif + +#if defined(__cplusplus) +} +#endif + +#pragma GCC diagnostic pop diff --git a/src/utils/crypto/aesopt.h b/src/utils/crypto/aesopt.h new file mode 100644 index 00000000000..1a977822229 --- /dev/null +++ b/src/utils/crypto/aesopt.h @@ -0,0 +1,731 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 + + This file contains the compilation options for AES (Rijndael) and code + that is common across encryption, key scheduling and table generation. + + OPERATION + + These source code files implement the AES algorithm Rijndael designed by + Joan Daemen and Vincent Rijmen. This version is designed for the standard + block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24 + and 32 bytes). + + This version is designed for flexibility and speed using operations on + 32-bit words rather than operations on bytes. It can be compiled with + either big or little endian internal byte order but is faster when the + native byte order for the processor is used. + + THE CIPHER INTERFACE + + The cipher interface is implemented as an array of bytes in which lower + AES bit sequence indexes map to higher numeric significance within bytes. + + uint_8t (an unsigned 8-bit type) + uint_32t (an unsigned 32-bit type) + struct aes_encrypt_ctx (structure for the cipher encryption context) + struct aes_decrypt_ctx (structure for the cipher decryption context) + AES_RETURN the function return type + + C subroutine calls: + + AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); + AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); + AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); + AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, + const aes_encrypt_ctx cx[1]); + + AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); + AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); + AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); + AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, + const aes_decrypt_ctx cx[1]); + + IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that + you call aes_init() before AES is used so that the tables are initialised. + + C++ aes class subroutines: + + Class AESencrypt for encryption + + Construtors: + AESencrypt(void) + AESencrypt(const unsigned char *key) - 128 bit key + Members: + AES_RETURN key128(const unsigned char *key) + AES_RETURN key192(const unsigned char *key) + AES_RETURN key256(const unsigned char *key) + AES_RETURN encrypt(const unsigned char *in, unsigned char *out) const + + Class AESdecrypt for encryption + Construtors: + AESdecrypt(void) + AESdecrypt(const unsigned char *key) - 128 bit key + Members: + AES_RETURN key128(const unsigned char *key) + AES_RETURN key192(const unsigned char *key) + AES_RETURN key256(const unsigned char *key) + AES_RETURN decrypt(const unsigned char *in, unsigned char *out) const +*/ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + +#if !defined( _AESOPT_H ) +#define _AESOPT_H + + +#if defined( __cplusplus ) +#include "aescpp.h" +#else +#include "aes.h" +#endif + + +#include "../common/endian.h" +#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ +#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ + +#if BYTE_ORDER == LITTLE_ENDIAN +# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN +#endif + +#if BYTE_ORDER == BIG_ENDIAN +# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN +#endif + + +/* CONFIGURATION - THE USE OF DEFINES + + Later in this section there are a number of defines that control the + operation of the code. In each section, the purpose of each define is + explained so that the relevant form can be included or excluded by + setting either 1's or 0's respectively on the branches of the related + #if clauses. The following local defines should not be changed. +*/ + +#define ENCRYPTION_IN_C 1 +#define DECRYPTION_IN_C 2 +#define ENC_KEYING_IN_C 4 +#define DEC_KEYING_IN_C 8 + +#define NO_TABLES 0 +#define ONE_TABLE 1 +#define FOUR_TABLES 4 +#define NONE 0 +#define PARTIAL 1 +#define FULL 2 + +/* --- START OF USER CONFIGURED OPTIONS --- */ + +/* 1. BYTE ORDER WITHIN 32 BIT WORDS + + The fundamental data processing units in Rijndael are 8-bit bytes. The + input, output and key input are all enumerated arrays of bytes in which + bytes are numbered starting at zero and increasing to one less than the + number of bytes in the array in question. This enumeration is only used + for naming bytes and does not imply any adjacency or order relationship + from one byte to another. When these inputs and outputs are considered + as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to + byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte. + In this implementation bits are numbered from 0 to 7 starting at the + numerically least significant end of each byte (bit n represents 2^n). + + However, Rijndael can be implemented more efficiently using 32-bit + words by packing bytes into words so that bytes 4*n to 4*n+3 are placed + into word[n]. While in principle these bytes can be assembled into words + in any positions, this implementation only supports the two formats in + which bytes in adjacent positions within words also have adjacent byte + numbers. This order is called big-endian if the lowest numbered bytes + in words have the highest numeric significance and little-endian if the + opposite applies. + + This code can work in either order irrespective of the order used by the + machine on which it runs. Normally the internal byte order will be set + to the order of the processor on which the code is to be run but this + define can be used to reverse this in special situations + + WARNING: Assembler code versions rely on PLATFORM_BYTE_ORDER being set. + This define will hence be redefined later (in section 4) if necessary +*/ + +#if 1 +#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER +#elif 0 +#define ALGORITHM_BYTE_ORDER IS_LITTLE_ENDIAN +#elif 0 +#define ALGORITHM_BYTE_ORDER IS_BIG_ENDIAN +#else +#error The algorithm byte order is not defined +#endif + +/* 2. VIA ACE SUPPORT + + Define this option if support for the VIA ACE is required. This uses + inline assembler instructions and is only implemented for the Microsoft, + Intel and GCC compilers. If VIA ACE is known to be present, then defining + ASSUME_VIA_ACE_PRESENT will remove the ordinary encryption/decryption + code. If USE_VIA_ACE_IF_PRESENT is defined then VIA ACE will be used if + it is detected (both present and enabled) but the normal AES code will + also be present. + + When VIA ACE is to be used, all AES encryption contexts MUST be 16 byte + aligned; other input/output buffers do not need to be 16 byte aligned + but there are very large performance gains if this can be arranged. + VIA ACE also requires the decryption key schedule to be in reverse + order (which later checks below ensure). +*/ + +#if 0 && !defined( USE_VIA_ACE_IF_PRESENT ) +# define USE_VIA_ACE_IF_PRESENT +#endif + +#if 0 && !defined( ASSUME_VIA_ACE_PRESENT ) +# define ASSUME_VIA_ACE_PRESENT +# endif + +#if defined ( _WIN64 ) || defined( _WIN32_WCE ) || \ + defined( _MSC_VER ) && ( _MSC_VER <= 800 ) +# if defined( USE_VIA_ACE_IF_PRESENT ) +# undef USE_VIA_ACE_IF_PRESENT +# endif +# if defined( ASSUME_VIA_ACE_PRESENT ) +# undef ASSUME_VIA_ACE_PRESENT +# endif +#endif + +/* 3. ASSEMBLER SUPPORT + + This define (which can be on the command line) enables the use of the + assembler code routines for encryption, decryption and key scheduling + as follows: + + ASM_X86_V1C uses the assembler (aes_x86_v1.asm) with large tables for + encryption and decryption and but with key scheduling in C + ASM_X86_V2 uses assembler (aes_x86_v2.asm) with compressed tables for + encryption, decryption and key scheduling + ASM_X86_V2C uses assembler (aes_x86_v2.asm) with compressed tables for + encryption and decryption and but with key scheduling in C + ASM_AMD64_C uses assembler (aes_amd64.asm) with compressed tables for + encryption and decryption and but with key scheduling in C + + Change one 'if 0' below to 'if 1' to select the version or define + as a compilation option. +*/ + +#if 0 && !defined( ASM_X86_V1C ) +# define ASM_X86_V1C +#elif 0 && !defined( ASM_X86_V2 ) +# define ASM_X86_V2 +#elif 0 && !defined( ASM_X86_V2C ) +# define ASM_X86_V2C +#elif 0 && !defined( ASM_AMD64_C ) +# define ASM_AMD64_C +#endif + +#if (defined ( ASM_X86_V1C ) || defined( ASM_X86_V2 ) || defined( ASM_X86_V2C )) \ + && !defined( _M_IX86 ) || defined( ASM_AMD64_C ) && !defined( _M_X64 ) +//# error Assembler code is only available for x86 and AMD64 systems +#endif + +/* 4. FAST INPUT/OUTPUT OPERATIONS. + + On some machines it is possible to improve speed by transferring the + bytes in the input and output arrays to and from the internal 32-bit + variables by addressing these arrays as if they are arrays of 32-bit + words. On some machines this will always be possible but there may + be a large performance penalty if the byte arrays are not aligned on + the normal word boundaries. On other machines this technique will + lead to memory access errors when such 32-bit word accesses are not + properly aligned. The option SAFE_IO avoids such problems but will + often be slower on those machines that support misaligned access + (especially so if care is taken to align the input and output byte + arrays on 32-bit word boundaries). If SAFE_IO is not defined it is + assumed that access to byte arrays as if they are arrays of 32-bit + words will not cause problems when such accesses are misaligned. +*/ +#if 1 && !defined( _MSC_VER ) +#define SAFE_IO +#endif + +/* 5. LOOP UNROLLING + + The code for encryption and decrytpion cycles through a number of rounds + that can be implemented either in a loop or by expanding the code into a + long sequence of instructions, the latter producing a larger program but + one that will often be much faster. The latter is called loop unrolling. + There are also potential speed advantages in expanding two iterations in + a loop with half the number of iterations, which is called partial loop + unrolling. The following options allow partial or full loop unrolling + to be set independently for encryption and decryption +*/ +#if 1 +#define ENC_UNROLL FULL +#elif 0 +#define ENC_UNROLL PARTIAL +#else +#define ENC_UNROLL NONE +#endif + +#if 1 +#define DEC_UNROLL FULL +#elif 0 +#define DEC_UNROLL PARTIAL +#else +#define DEC_UNROLL NONE +#endif + +/* 6. FAST FINITE FIELD OPERATIONS + + If this section is included, tables are used to provide faster finite + field arithmetic (this has no effect if FIXED_TABLES is defined). +*/ +#if !defined (TC_WINDOWS_BOOT) +#define FF_TABLES +#endif + +/* 7. INTERNAL STATE VARIABLE FORMAT + + The internal state of Rijndael is stored in a number of local 32-bit + word varaibles which can be defined either as an array or as individual + names variables. Include this section if you want to store these local + varaibles in arrays. Otherwise individual local variables will be used. +*/ +#if 1 +#define ARRAYS +#endif + +/* 8. FIXED OR DYNAMIC TABLES + + When this section is included the tables used by the code are compiled + statically into the binary file. Otherwise the subroutine aes_init() + must be called to compute them before the code is first used. +*/ +#if !defined (TC_WINDOWS_BOOT) && !(defined( _MSC_VER ) && ( _MSC_VER <= 800 )) +#define FIXED_TABLES +#endif + +/* 9. TABLE ALIGNMENT + + On some sytsems speed will be improved by aligning the AES large lookup + tables on particular boundaries. This define should be set to a power of + two giving the desired alignment. It can be left undefined if alignment + is not needed. This option is specific to the Microsft VC++ compiler - + it seems to sometimes cause trouble for the VC++ version 6 compiler. +*/ + +#if 1 && defined( _MSC_VER ) && ( _MSC_VER >= 1300 ) +#define TABLE_ALIGN 32 +#endif + +/* 10. TABLE OPTIONS + + This cipher proceeds by repeating in a number of cycles known as 'rounds' + which are implemented by a round function which can optionally be speeded + up using tables. The basic tables are each 256 32-bit words, with either + one or four tables being required for each round function depending on + how much speed is required. The encryption and decryption round functions + are different and the last encryption and decrytpion round functions are + different again making four different round functions in all. + + This means that: + 1. Normal encryption and decryption rounds can each use either 0, 1 + or 4 tables and table spaces of 0, 1024 or 4096 bytes each. + 2. The last encryption and decryption rounds can also use either 0, 1 + or 4 tables and table spaces of 0, 1024 or 4096 bytes each. + + Include or exclude the appropriate definitions below to set the number + of tables used by this implementation. +*/ + +#if 1 /* set tables for the normal encryption round */ +#define ENC_ROUND FOUR_TABLES +#elif 0 +#define ENC_ROUND ONE_TABLE +#else +#define ENC_ROUND NO_TABLES +#endif + +#if 1 /* set tables for the last encryption round */ +#define LAST_ENC_ROUND FOUR_TABLES +#elif 0 +#define LAST_ENC_ROUND ONE_TABLE +#else +#define LAST_ENC_ROUND NO_TABLES +#endif + +#if 1 /* set tables for the normal decryption round */ +#define DEC_ROUND FOUR_TABLES +#elif 0 +#define DEC_ROUND ONE_TABLE +#else +#define DEC_ROUND NO_TABLES +#endif + +#if 1 /* set tables for the last decryption round */ +#define LAST_DEC_ROUND FOUR_TABLES +#elif 0 +#define LAST_DEC_ROUND ONE_TABLE +#else +#define LAST_DEC_ROUND NO_TABLES +#endif + +/* The decryption key schedule can be speeded up with tables in the same + way that the round functions can. Include or exclude the following + defines to set this requirement. +*/ +#if 1 +#define KEY_SCHED FOUR_TABLES +#elif 0 +#define KEY_SCHED ONE_TABLE +#else +#define KEY_SCHED NO_TABLES +#endif + +/* ---- END OF USER CONFIGURED OPTIONS ---- */ + +/* VIA ACE support is only available for VC++ and GCC */ + +#if !defined( _MSC_VER ) && !defined( __GNUC__ ) +# if defined( ASSUME_VIA_ACE_PRESENT ) +# undef ASSUME_VIA_ACE_PRESENT +# endif +# if defined( USE_VIA_ACE_IF_PRESENT ) +# undef USE_VIA_ACE_IF_PRESENT +# endif +#endif + +#if defined( ASSUME_VIA_ACE_PRESENT ) && !defined( USE_VIA_ACE_IF_PRESENT ) +#define USE_VIA_ACE_IF_PRESENT +#endif + +#if defined( USE_VIA_ACE_IF_PRESENT ) && !defined ( AES_REV_DKS ) +#define AES_REV_DKS +#endif + +/* Assembler support requires the use of platform byte order */ + +#if ( defined( ASM_X86_V1C ) || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) ) \ + && (ALGORITHM_BYTE_ORDER != PLATFORM_BYTE_ORDER) +#undef ALGORITHM_BYTE_ORDER +#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER +#endif + +/* In this implementation the columns of the state array are each held in + 32-bit words. The state array can be held in various ways: in an array + of words, in a number of individual word variables or in a number of + processor registers. The following define maps a variable name x and + a column number c to the way the state array variable is to be held. + The first define below maps the state into an array x[c] whereas the + second form maps the state into a number of individual variables x0, + x1, etc. Another form could map individual state colums to machine + register names. +*/ + +#if defined( ARRAYS ) +#define s(x,c) x[c] +#else +#define s(x,c) x##c +#endif + +/* This implementation provides subroutines for encryption, decryption + and for setting the three key lengths (separately) for encryption + and decryption. Since not all functions are needed, masks are set + up here to determine which will be implemented in C +*/ + +#if !defined( AES_ENCRYPT ) +# define EFUNCS_IN_C 0 +#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ + || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) +# define EFUNCS_IN_C ENC_KEYING_IN_C +#elif !defined( ASM_X86_V2 ) +# define EFUNCS_IN_C ( ENCRYPTION_IN_C | ENC_KEYING_IN_C ) +#else +# define EFUNCS_IN_C 0 +#endif + +#if !defined( AES_DECRYPT ) +# define DFUNCS_IN_C 0 +#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ + || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) +# define DFUNCS_IN_C DEC_KEYING_IN_C +#elif !defined( ASM_X86_V2 ) +# define DFUNCS_IN_C ( DECRYPTION_IN_C | DEC_KEYING_IN_C ) +#else +# define DFUNCS_IN_C 0 +#endif + +#define FUNCS_IN_C ( EFUNCS_IN_C | DFUNCS_IN_C ) + +/* END OF CONFIGURATION OPTIONS */ + +#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2)) + +/* Disable or report errors on some combinations of options */ + +#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES +#undef LAST_ENC_ROUND +#define LAST_ENC_ROUND NO_TABLES +#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES +#undef LAST_ENC_ROUND +#define LAST_ENC_ROUND ONE_TABLE +#endif + +#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE +#undef ENC_UNROLL +#define ENC_UNROLL NONE +#endif + +#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES +#undef LAST_DEC_ROUND +#define LAST_DEC_ROUND NO_TABLES +#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES +#undef LAST_DEC_ROUND +#define LAST_DEC_ROUND ONE_TABLE +#endif + +#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE +#undef DEC_UNROLL +#define DEC_UNROLL NONE +#endif + +#if defined( bswap32 ) +#define aes_sw32 bswap32 +#elif defined( bswap_32 ) +#define aes_sw32 bswap_32 +#else +#define brot(x,n) (((uint_32t)(x) << n) | ((uint_32t)(x) >> (32 - n))) +#define aes_sw32(x) ((brot((x),8) & 0x00ff00ff) | (brot((x),24) & 0xff00ff00)) +#endif + +/* upr(x,n): rotates bytes within words by n positions, moving bytes to + higher index positions with wrap around into low positions + ups(x,n): moves bytes by n positions to higher index positions in + words but without wrap around + bval(x,n): extracts a byte from a word + + WARNING: The definitions given here are intended only for use with + unsigned variables and with shift counts that are compile + time constants +*/ + +#if ( ALGORITHM_BYTE_ORDER == IS_LITTLE_ENDIAN ) +#define upr(x,n) (((uint_32t)(x) << (8 * (n))) | ((uint_32t)(x) >> (32 - 8 * (n)))) +#define ups(x,n) ((uint_32t) (x) << (8 * (n))) +#define bval(x,n) ((uint_8t)((x) >> (8 * (n)))) +#define bytes2word(b0, b1, b2, b3) \ + (((uint_32t)(b3) << 24) | ((uint_32t)(b2) << 16) | ((uint_32t)(b1) << 8) | (b0)) +#endif + +#if ( ALGORITHM_BYTE_ORDER == IS_BIG_ENDIAN ) +#define upr(x,n) (((uint_32t)(x) >> (8 * (n))) | ((uint_32t)(x) << (32 - 8 * (n)))) +#define ups(x,n) ((uint_32t) (x) >> (8 * (n))) +#define bval(x,n) ((uint_8t)((x) >> (24 - 8 * (n)))) +#define bytes2word(b0, b1, b2, b3) \ + (((uint_32t)(b0) << 24) | ((uint_32t)(b1) << 16) | ((uint_32t)(b2) << 8) | (b3)) +#endif + +#if defined( SAFE_IO ) + +#define word_in(x,c) bytes2word(((const uint_8t*)(x)+4*c)[0], ((const uint_8t*)(x)+4*c)[1], \ + ((const uint_8t*)(x)+4*c)[2], ((const uint_8t*)(x)+4*c)[3]) +#define word_out(x,c,v) { ((uint_8t*)(x)+4*c)[0] = bval(v,0); ((uint_8t*)(x)+4*c)[1] = bval(v,1); \ + ((uint_8t*)(x)+4*c)[2] = bval(v,2); ((uint_8t*)(x)+4*c)[3] = bval(v,3); } + +#elif ( ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER ) + +#define word_in(x,c) (*((uint_32t*)(x)+(c))) +#define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = (v)) + +#else + +#define word_in(x,c) aes_sw32(*((uint_32t*)(x)+(c))) +#define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = aes_sw32(v)) + +#endif + +/* the finite field modular polynomial and elements */ + +#define WPOLY 0x011b +#define BPOLY 0x1b + +/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */ + +#define m1 0x80808080 +#define m2 0x7f7f7f7f +#define gf_mulx(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY)) + +/* The following defines provide alternative definitions of gf_mulx that might + give improved performance if a fast 32-bit multiply is not available. Note + that a temporary variable u needs to be defined where gf_mulx is used. + +#define gf_mulx(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6)) +#define m4 (0x01010101 * BPOLY) +#define gf_mulx(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4) +*/ + +/* Work out which tables are needed for the different options */ + +#if defined( ASM_X86_V1C ) +#if defined( ENC_ROUND ) +#undef ENC_ROUND +#endif +#define ENC_ROUND FOUR_TABLES +#if defined( LAST_ENC_ROUND ) +#undef LAST_ENC_ROUND +#endif +#define LAST_ENC_ROUND FOUR_TABLES +#if defined( DEC_ROUND ) +#undef DEC_ROUND +#endif +#define DEC_ROUND FOUR_TABLES +#if defined( LAST_DEC_ROUND ) +#undef LAST_DEC_ROUND +#endif +#define LAST_DEC_ROUND FOUR_TABLES +#if defined( KEY_SCHED ) +#undef KEY_SCHED +#define KEY_SCHED FOUR_TABLES +#endif +#endif + +#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) || defined( ASM_X86_V1C ) +#if ENC_ROUND == ONE_TABLE +#define FT1_SET +#elif ENC_ROUND == FOUR_TABLES +#define FT4_SET +#else +#define SBX_SET +#endif +#if LAST_ENC_ROUND == ONE_TABLE +#define FL1_SET +#elif LAST_ENC_ROUND == FOUR_TABLES +#define FL4_SET +#elif !defined( SBX_SET ) +#define SBX_SET +#endif +#endif + +#if ( FUNCS_IN_C & DECRYPTION_IN_C ) || defined( ASM_X86_V1C ) +#if DEC_ROUND == ONE_TABLE +#define IT1_SET +#elif DEC_ROUND == FOUR_TABLES +#define IT4_SET +#else +#define ISB_SET +#endif +#if LAST_DEC_ROUND == ONE_TABLE +#define IL1_SET +#elif LAST_DEC_ROUND == FOUR_TABLES +#define IL4_SET +#elif !defined(ISB_SET) +#define ISB_SET +#endif +#endif + +#if (FUNCS_IN_C & ENC_KEYING_IN_C) || (FUNCS_IN_C & DEC_KEYING_IN_C) +#if KEY_SCHED == ONE_TABLE +#define LS1_SET +#elif KEY_SCHED == FOUR_TABLES +#define LS4_SET +#elif !defined( SBX_SET ) +#define SBX_SET +#endif +#endif + +#if (FUNCS_IN_C & DEC_KEYING_IN_C) +#if KEY_SCHED == ONE_TABLE +#define IM1_SET +#elif KEY_SCHED == FOUR_TABLES +#define IM4_SET +#elif !defined( SBX_SET ) +#define SBX_SET +#endif +#endif + +/* generic definitions of Rijndael macros that use tables */ + +#define no_table(x,box,vf,rf,c) bytes2word( \ + box[bval(vf(x,0,c),rf(0,c))], \ + box[bval(vf(x,1,c),rf(1,c))], \ + box[bval(vf(x,2,c),rf(2,c))], \ + box[bval(vf(x,3,c),rf(3,c))]) + +#define one_table(x,op,tab,vf,rf,c) \ + ( tab[bval(vf(x,0,c),rf(0,c))] \ + ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \ + ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \ + ^ op(tab[bval(vf(x,3,c),rf(3,c))],3)) + +#define four_tables(x,tab,vf,rf,c) \ + ( tab[0][bval(vf(x,0,c),rf(0,c))] \ + ^ tab[1][bval(vf(x,1,c),rf(1,c))] \ + ^ tab[2][bval(vf(x,2,c),rf(2,c))] \ + ^ tab[3][bval(vf(x,3,c),rf(3,c))]) + +#define vf1(x,r,c) (x) +#define rf1(r,c) (r) +#define rf2(r,c) ((8+r-c)&3) + +/* perform forward and inverse column mix operation on four bytes in long word x in */ +/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */ + +#if defined( FM4_SET ) /* not currently used */ +#define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0) +#elif defined( FM1_SET ) /* not currently used */ +#define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0) +#else +#define dec_fmvars uint_32t g2 +#define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1)) +#endif + +#if defined( IM4_SET ) +#define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0) +#elif defined( IM1_SET ) +#define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0) +#else +#define dec_imvars uint_32t g2, g4, g9 +#define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \ + (x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1)) +#endif + +#if defined( FL4_SET ) +#define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c) +#elif defined( LS4_SET ) +#define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c) +#elif defined( FL1_SET ) +#define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c) +#elif defined( LS1_SET ) +#define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c) +#else +#define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c) +#endif + +#if defined( ASM_X86_V1C ) && defined( AES_DECRYPT ) && !defined( ISB_SET ) +#define ISB_SET +#endif + +#endif diff --git a/src/utils/crypto/aessmall.c b/src/utils/crypto/aessmall.c new file mode 100644 index 00000000000..3296f13917b --- /dev/null +++ b/src/utils/crypto/aessmall.c @@ -0,0 +1,921 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue 09/09/2006 + + This is an AES implementation that uses only 8-bit byte operations on the + cipher state (there are options to use 32-bit types if available). + + The combination of mix columns and byte substitution used here is based on + that developed by Karl Malbrain. His contribution is acknowledged. + */ + +/* Adapted by TrueCrypt Foundation: + - Macro-generated tables were replaced with static data to enable compiling + with MSVC++ 1.5 which runs out of resources when expanding large macros. +*/ + +// #pragma optimize ("t", on) + +/* define if you have a fast memcpy function on your system */ +#if 1 +# define HAVE_MEMCPY +# include +# if defined( _MSC_VER ) +# ifndef DEBUG +# pragma intrinsic( memcpy ) +# endif +# endif +#endif + +/* define if you have fast 32-bit types on your system */ +#if 1 +# define HAVE_UINT_32T +#endif + +/* alternative versions (test for performance on your system) */ +#if 0 +# define VERSION_1 +#endif + +#include +#include "aessmall.h" + +#define WPOLY 0x011b +#define DPOLY 0x008d +#define f1(x) (x) +#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) +#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) +#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ + ^ (((x>>5) & 4) * WPOLY)) +#define d2(x) (((x) >> 1) ^ ((x) & 1 ? DPOLY : 0)) + +#define f3(x) (f2(x) ^ x) +#define f9(x) (f8(x) ^ x) +#define fb(x) (f8(x) ^ f2(x) ^ x) +#define fd(x) (f8(x) ^ f4(x) ^ x) +#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) + +static const uint_8t s_box[256] = { + 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5, + 0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, + 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0, + 0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, + 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc, + 0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, + 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a, + 0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, + 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0, + 0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, + 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b, + 0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, + 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85, + 0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, + 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5, + 0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, + 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17, + 0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, + 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88, + 0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, + 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c, + 0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, + 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9, + 0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, + 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6, + 0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, + 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e, + 0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, + 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94, + 0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, + 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68, + 0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16 +}; + +static const uint_8t inv_s_box[256] = { + 0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38, + 0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb, + 0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87, + 0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb, + 0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d, + 0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e, + 0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2, + 0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25, + 0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16, + 0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92, + 0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda, + 0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84, + 0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a, + 0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06, + 0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02, + 0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b, + 0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea, + 0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73, + 0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85, + 0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e, + 0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89, + 0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b, + 0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20, + 0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4, + 0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31, + 0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f, + 0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d, + 0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef, + 0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0, + 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61, + 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26, + 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d +}; + +static const uint_8t gfm2_s_box[256] = { + 0xc6,0xf8,0xee,0xf6,0xff,0xd6,0xde,0x91, + 0x60,0x02,0xce,0x56,0xe7,0xb5,0x4d,0xec, + 0x8f,0x1f,0x89,0xfa,0xef,0xb2,0x8e,0xfb, + 0x41,0xb3,0x5f,0x45,0x23,0x53,0xe4,0x9b, + 0x75,0xe1,0x3d,0x4c,0x6c,0x7e,0xf5,0x83, + 0x68,0x51,0xd1,0xf9,0xe2,0xab,0x62,0x2a, + 0x08,0x95,0x46,0x9d,0x30,0x37,0x0a,0x2f, + 0x0e,0x24,0x1b,0xdf,0xcd,0x4e,0x7f,0xea, + 0x12,0x1d,0x58,0x34,0x36,0xdc,0xb4,0x5b, + 0xa4,0x76,0xb7,0x7d,0x52,0xdd,0x5e,0x13, + 0xa6,0xb9,0x00,0xc1,0x40,0xe3,0x79,0xb6, + 0xd4,0x8d,0x67,0x72,0x94,0x98,0xb0,0x85, + 0xbb,0xc5,0x4f,0xed,0x86,0x9a,0x66,0x11, + 0x8a,0xe9,0x04,0xfe,0xa0,0x78,0x25,0x4b, + 0xa2,0x5d,0x80,0x05,0x3f,0x21,0x70,0xf1, + 0x63,0x77,0xaf,0x42,0x20,0xe5,0xfd,0xbf, + 0x81,0x18,0x26,0xc3,0xbe,0x35,0x88,0x2e, + 0x93,0x55,0xfc,0x7a,0xc8,0xba,0x32,0xe6, + 0xc0,0x19,0x9e,0xa3,0x44,0x54,0x3b,0x0b, + 0x8c,0xc7,0x6b,0x28,0xa7,0xbc,0x16,0xad, + 0xdb,0x64,0x74,0x14,0x92,0x0c,0x48,0xb8, + 0x9f,0xbd,0x43,0xc4,0x39,0x31,0xd3,0xf2, + 0xd5,0x8b,0x6e,0xda,0x01,0xb1,0x9c,0x49, + 0xd8,0xac,0xf3,0xcf,0xca,0xf4,0x47,0x10, + 0x6f,0xf0,0x4a,0x5c,0x38,0x57,0x73,0x97, + 0xcb,0xa1,0xe8,0x3e,0x96,0x61,0x0d,0x0f, + 0xe0,0x7c,0x71,0xcc,0x90,0x06,0xf7,0x1c, + 0xc2,0x6a,0xae,0x69,0x17,0x99,0x3a,0x27, + 0xd9,0xeb,0x2b,0x22,0xd2,0xa9,0x07,0x33, + 0x2d,0x3c,0x15,0xc9,0x87,0xaa,0x50,0xa5, + 0x03,0x59,0x09,0x1a,0x65,0xd7,0x84,0xd0, + 0x82,0x29,0x5a,0x1e,0x7b,0xa8,0x6d,0x2c +}; + +static const uint_8t gfm3_s_box[256] = { + 0xa5,0x84,0x99,0x8d,0x0d,0xbd,0xb1,0x54, + 0x50,0x03,0xa9,0x7d,0x19,0x62,0xe6,0x9a, + 0x45,0x9d,0x40,0x87,0x15,0xeb,0xc9,0x0b, + 0xec,0x67,0xfd,0xea,0xbf,0xf7,0x96,0x5b, + 0xc2,0x1c,0xae,0x6a,0x5a,0x41,0x02,0x4f, + 0x5c,0xf4,0x34,0x08,0x93,0x73,0x53,0x3f, + 0x0c,0x52,0x65,0x5e,0x28,0xa1,0x0f,0xb5, + 0x09,0x36,0x9b,0x3d,0x26,0x69,0xcd,0x9f, + 0x1b,0x9e,0x74,0x2e,0x2d,0xb2,0xee,0xfb, + 0xf6,0x4d,0x61,0xce,0x7b,0x3e,0x71,0x97, + 0xf5,0x68,0x00,0x2c,0x60,0x1f,0xc8,0xed, + 0xbe,0x46,0xd9,0x4b,0xde,0xd4,0xe8,0x4a, + 0x6b,0x2a,0xe5,0x16,0xc5,0xd7,0x55,0x94, + 0xcf,0x10,0x06,0x81,0xf0,0x44,0xba,0xe3, + 0xf3,0xfe,0xc0,0x8a,0xad,0xbc,0x48,0x04, + 0xdf,0xc1,0x75,0x63,0x30,0x1a,0x0e,0x6d, + 0x4c,0x14,0x35,0x2f,0xe1,0xa2,0xcc,0x39, + 0x57,0xf2,0x82,0x47,0xac,0xe7,0x2b,0x95, + 0xa0,0x98,0xd1,0x7f,0x66,0x7e,0xab,0x83, + 0xca,0x29,0xd3,0x3c,0x79,0xe2,0x1d,0x76, + 0x3b,0x56,0x4e,0x1e,0xdb,0x0a,0x6c,0xe4, + 0x5d,0x6e,0xef,0xa6,0xa8,0xa4,0x37,0x8b, + 0x32,0x43,0x59,0xb7,0x8c,0x64,0xd2,0xe0, + 0xb4,0xfa,0x07,0x25,0xaf,0x8e,0xe9,0x18, + 0xd5,0x88,0x6f,0x72,0x24,0xf1,0xc7,0x51, + 0x23,0x7c,0x9c,0x21,0xdd,0xdc,0x86,0x85, + 0x90,0x42,0xc4,0xaa,0xd8,0x05,0x01,0x12, + 0xa3,0x5f,0xf9,0xd0,0x91,0x58,0x27,0xb9, + 0x38,0x13,0xb3,0x33,0xbb,0x70,0x89,0xa7, + 0xb6,0x22,0x92,0x20,0x49,0xff,0x78,0x7a, + 0x8f,0xf8,0x80,0x17,0xda,0x31,0xc6,0xb8, + 0xc3,0xb0,0x77,0x11,0xcb,0xfc,0xd6,0x3a +}; + +static const uint_8t gfmul_9[256] = { + 0x00,0x09,0x12,0x1b,0x24,0x2d,0x36,0x3f, + 0x48,0x41,0x5a,0x53,0x6c,0x65,0x7e,0x77, + 0x90,0x99,0x82,0x8b,0xb4,0xbd,0xa6,0xaf, + 0xd8,0xd1,0xca,0xc3,0xfc,0xf5,0xee,0xe7, + 0x3b,0x32,0x29,0x20,0x1f,0x16,0x0d,0x04, + 0x73,0x7a,0x61,0x68,0x57,0x5e,0x45,0x4c, + 0xab,0xa2,0xb9,0xb0,0x8f,0x86,0x9d,0x94, + 0xe3,0xea,0xf1,0xf8,0xc7,0xce,0xd5,0xdc, + 0x76,0x7f,0x64,0x6d,0x52,0x5b,0x40,0x49, + 0x3e,0x37,0x2c,0x25,0x1a,0x13,0x08,0x01, + 0xe6,0xef,0xf4,0xfd,0xc2,0xcb,0xd0,0xd9, + 0xae,0xa7,0xbc,0xb5,0x8a,0x83,0x98,0x91, + 0x4d,0x44,0x5f,0x56,0x69,0x60,0x7b,0x72, + 0x05,0x0c,0x17,0x1e,0x21,0x28,0x33,0x3a, + 0xdd,0xd4,0xcf,0xc6,0xf9,0xf0,0xeb,0xe2, + 0x95,0x9c,0x87,0x8e,0xb1,0xb8,0xa3,0xaa, + 0xec,0xe5,0xfe,0xf7,0xc8,0xc1,0xda,0xd3, + 0xa4,0xad,0xb6,0xbf,0x80,0x89,0x92,0x9b, + 0x7c,0x75,0x6e,0x67,0x58,0x51,0x4a,0x43, + 0x34,0x3d,0x26,0x2f,0x10,0x19,0x02,0x0b, + 0xd7,0xde,0xc5,0xcc,0xf3,0xfa,0xe1,0xe8, + 0x9f,0x96,0x8d,0x84,0xbb,0xb2,0xa9,0xa0, + 0x47,0x4e,0x55,0x5c,0x63,0x6a,0x71,0x78, + 0x0f,0x06,0x1d,0x14,0x2b,0x22,0x39,0x30, + 0x9a,0x93,0x88,0x81,0xbe,0xb7,0xac,0xa5, + 0xd2,0xdb,0xc0,0xc9,0xf6,0xff,0xe4,0xed, + 0x0a,0x03,0x18,0x11,0x2e,0x27,0x3c,0x35, + 0x42,0x4b,0x50,0x59,0x66,0x6f,0x74,0x7d, + 0xa1,0xa8,0xb3,0xba,0x85,0x8c,0x97,0x9e, + 0xe9,0xe0,0xfb,0xf2,0xcd,0xc4,0xdf,0xd6, + 0x31,0x38,0x23,0x2a,0x15,0x1c,0x07,0x0e, + 0x79,0x70,0x6b,0x62,0x5d,0x54,0x4f,0x46 +}; + +static const uint_8t gfmul_b[256] = { + 0x00,0x0b,0x16,0x1d,0x2c,0x27,0x3a,0x31, + 0x58,0x53,0x4e,0x45,0x74,0x7f,0x62,0x69, + 0xb0,0xbb,0xa6,0xad,0x9c,0x97,0x8a,0x81, + 0xe8,0xe3,0xfe,0xf5,0xc4,0xcf,0xd2,0xd9, + 0x7b,0x70,0x6d,0x66,0x57,0x5c,0x41,0x4a, + 0x23,0x28,0x35,0x3e,0x0f,0x04,0x19,0x12, + 0xcb,0xc0,0xdd,0xd6,0xe7,0xec,0xf1,0xfa, + 0x93,0x98,0x85,0x8e,0xbf,0xb4,0xa9,0xa2, + 0xf6,0xfd,0xe0,0xeb,0xda,0xd1,0xcc,0xc7, + 0xae,0xa5,0xb8,0xb3,0x82,0x89,0x94,0x9f, + 0x46,0x4d,0x50,0x5b,0x6a,0x61,0x7c,0x77, + 0x1e,0x15,0x08,0x03,0x32,0x39,0x24,0x2f, + 0x8d,0x86,0x9b,0x90,0xa1,0xaa,0xb7,0xbc, + 0xd5,0xde,0xc3,0xc8,0xf9,0xf2,0xef,0xe4, + 0x3d,0x36,0x2b,0x20,0x11,0x1a,0x07,0x0c, + 0x65,0x6e,0x73,0x78,0x49,0x42,0x5f,0x54, + 0xf7,0xfc,0xe1,0xea,0xdb,0xd0,0xcd,0xc6, + 0xaf,0xa4,0xb9,0xb2,0x83,0x88,0x95,0x9e, + 0x47,0x4c,0x51,0x5a,0x6b,0x60,0x7d,0x76, + 0x1f,0x14,0x09,0x02,0x33,0x38,0x25,0x2e, + 0x8c,0x87,0x9a,0x91,0xa0,0xab,0xb6,0xbd, + 0xd4,0xdf,0xc2,0xc9,0xf8,0xf3,0xee,0xe5, + 0x3c,0x37,0x2a,0x21,0x10,0x1b,0x06,0x0d, + 0x64,0x6f,0x72,0x79,0x48,0x43,0x5e,0x55, + 0x01,0x0a,0x17,0x1c,0x2d,0x26,0x3b,0x30, + 0x59,0x52,0x4f,0x44,0x75,0x7e,0x63,0x68, + 0xb1,0xba,0xa7,0xac,0x9d,0x96,0x8b,0x80, + 0xe9,0xe2,0xff,0xf4,0xc5,0xce,0xd3,0xd8, + 0x7a,0x71,0x6c,0x67,0x56,0x5d,0x40,0x4b, + 0x22,0x29,0x34,0x3f,0x0e,0x05,0x18,0x13, + 0xca,0xc1,0xdc,0xd7,0xe6,0xed,0xf0,0xfb, + 0x92,0x99,0x84,0x8f,0xbe,0xb5,0xa8,0xa3 +}; + +static const uint_8t gfmul_d[256] = { + 0x00,0x0d,0x1a,0x17,0x34,0x39,0x2e,0x23, + 0x68,0x65,0x72,0x7f,0x5c,0x51,0x46,0x4b, + 0xd0,0xdd,0xca,0xc7,0xe4,0xe9,0xfe,0xf3, + 0xb8,0xb5,0xa2,0xaf,0x8c,0x81,0x96,0x9b, + 0xbb,0xb6,0xa1,0xac,0x8f,0x82,0x95,0x98, + 0xd3,0xde,0xc9,0xc4,0xe7,0xea,0xfd,0xf0, + 0x6b,0x66,0x71,0x7c,0x5f,0x52,0x45,0x48, + 0x03,0x0e,0x19,0x14,0x37,0x3a,0x2d,0x20, + 0x6d,0x60,0x77,0x7a,0x59,0x54,0x43,0x4e, + 0x05,0x08,0x1f,0x12,0x31,0x3c,0x2b,0x26, + 0xbd,0xb0,0xa7,0xaa,0x89,0x84,0x93,0x9e, + 0xd5,0xd8,0xcf,0xc2,0xe1,0xec,0xfb,0xf6, + 0xd6,0xdb,0xcc,0xc1,0xe2,0xef,0xf8,0xf5, + 0xbe,0xb3,0xa4,0xa9,0x8a,0x87,0x90,0x9d, + 0x06,0x0b,0x1c,0x11,0x32,0x3f,0x28,0x25, + 0x6e,0x63,0x74,0x79,0x5a,0x57,0x40,0x4d, + 0xda,0xd7,0xc0,0xcd,0xee,0xe3,0xf4,0xf9, + 0xb2,0xbf,0xa8,0xa5,0x86,0x8b,0x9c,0x91, + 0x0a,0x07,0x10,0x1d,0x3e,0x33,0x24,0x29, + 0x62,0x6f,0x78,0x75,0x56,0x5b,0x4c,0x41, + 0x61,0x6c,0x7b,0x76,0x55,0x58,0x4f,0x42, + 0x09,0x04,0x13,0x1e,0x3d,0x30,0x27,0x2a, + 0xb1,0xbc,0xab,0xa6,0x85,0x88,0x9f,0x92, + 0xd9,0xd4,0xc3,0xce,0xed,0xe0,0xf7,0xfa, + 0xb7,0xba,0xad,0xa0,0x83,0x8e,0x99,0x94, + 0xdf,0xd2,0xc5,0xc8,0xeb,0xe6,0xf1,0xfc, + 0x67,0x6a,0x7d,0x70,0x53,0x5e,0x49,0x44, + 0x0f,0x02,0x15,0x18,0x3b,0x36,0x21,0x2c, + 0x0c,0x01,0x16,0x1b,0x38,0x35,0x22,0x2f, + 0x64,0x69,0x7e,0x73,0x50,0x5d,0x4a,0x47, + 0xdc,0xd1,0xc6,0xcb,0xe8,0xe5,0xf2,0xff, + 0xb4,0xb9,0xae,0xa3,0x80,0x8d,0x9a,0x97 +}; + +static const uint_8t gfmul_e[256] = { + 0x00,0x0e,0x1c,0x12,0x38,0x36,0x24,0x2a, + 0x70,0x7e,0x6c,0x62,0x48,0x46,0x54,0x5a, + 0xe0,0xee,0xfc,0xf2,0xd8,0xd6,0xc4,0xca, + 0x90,0x9e,0x8c,0x82,0xa8,0xa6,0xb4,0xba, + 0xdb,0xd5,0xc7,0xc9,0xe3,0xed,0xff,0xf1, + 0xab,0xa5,0xb7,0xb9,0x93,0x9d,0x8f,0x81, + 0x3b,0x35,0x27,0x29,0x03,0x0d,0x1f,0x11, + 0x4b,0x45,0x57,0x59,0x73,0x7d,0x6f,0x61, + 0xad,0xa3,0xb1,0xbf,0x95,0x9b,0x89,0x87, + 0xdd,0xd3,0xc1,0xcf,0xe5,0xeb,0xf9,0xf7, + 0x4d,0x43,0x51,0x5f,0x75,0x7b,0x69,0x67, + 0x3d,0x33,0x21,0x2f,0x05,0x0b,0x19,0x17, + 0x76,0x78,0x6a,0x64,0x4e,0x40,0x52,0x5c, + 0x06,0x08,0x1a,0x14,0x3e,0x30,0x22,0x2c, + 0x96,0x98,0x8a,0x84,0xae,0xa0,0xb2,0xbc, + 0xe6,0xe8,0xfa,0xf4,0xde,0xd0,0xc2,0xcc, + 0x41,0x4f,0x5d,0x53,0x79,0x77,0x65,0x6b, + 0x31,0x3f,0x2d,0x23,0x09,0x07,0x15,0x1b, + 0xa1,0xaf,0xbd,0xb3,0x99,0x97,0x85,0x8b, + 0xd1,0xdf,0xcd,0xc3,0xe9,0xe7,0xf5,0xfb, + 0x9a,0x94,0x86,0x88,0xa2,0xac,0xbe,0xb0, + 0xea,0xe4,0xf6,0xf8,0xd2,0xdc,0xce,0xc0, + 0x7a,0x74,0x66,0x68,0x42,0x4c,0x5e,0x50, + 0x0a,0x04,0x16,0x18,0x32,0x3c,0x2e,0x20, + 0xec,0xe2,0xf0,0xfe,0xd4,0xda,0xc8,0xc6, + 0x9c,0x92,0x80,0x8e,0xa4,0xaa,0xb8,0xb6, + 0x0c,0x02,0x10,0x1e,0x34,0x3a,0x28,0x26, + 0x7c,0x72,0x60,0x6e,0x44,0x4a,0x58,0x56, + 0x37,0x39,0x2b,0x25,0x0f,0x01,0x13,0x1d, + 0x47,0x49,0x5b,0x55,0x7f,0x71,0x63,0x6d, + 0xd7,0xd9,0xcb,0xc5,0xef,0xe1,0xf3,0xfd, + 0xa7,0xa9,0xbb,0xb5,0x9f,0x91,0x83,0x8d +}; + +#if defined( HAVE_UINT_32T ) + typedef unsigned long uint_32t; +#endif + +#if defined( HAVE_MEMCPY ) +# define block_copy(d, s, l) memcpy(d, s, l) +# define block16_copy(d, s) memcpy(d, s, N_BLOCK) +#else +# define block_copy(d, s, l) copy_block(d, s, l) +# define block16_copy(d, s) copy_block16(d, s) + +/* block size 'nn' must be a multiple of four */ + +static void copy_block16( void *d, const void *s ) +{ +#if defined( HAVE_UINT_32T ) + ((uint_32t*)d)[ 0] = ((uint_32t*)s)[ 0]; + ((uint_32t*)d)[ 1] = ((uint_32t*)s)[ 1]; + ((uint_32t*)d)[ 2] = ((uint_32t*)s)[ 2]; + ((uint_32t*)d)[ 3] = ((uint_32t*)s)[ 3]; +#else + ((uint_8t*)d)[ 0] = ((uint_8t*)s)[ 0]; + ((uint_8t*)d)[ 1] = ((uint_8t*)s)[ 1]; + ((uint_8t*)d)[ 2] = ((uint_8t*)s)[ 2]; + ((uint_8t*)d)[ 3] = ((uint_8t*)s)[ 3]; + ((uint_8t*)d)[ 4] = ((uint_8t*)s)[ 4]; + ((uint_8t*)d)[ 5] = ((uint_8t*)s)[ 5]; + ((uint_8t*)d)[ 6] = ((uint_8t*)s)[ 6]; + ((uint_8t*)d)[ 7] = ((uint_8t*)s)[ 7]; + ((uint_8t*)d)[ 8] = ((uint_8t*)s)[ 8]; + ((uint_8t*)d)[ 9] = ((uint_8t*)s)[ 9]; + ((uint_8t*)d)[10] = ((uint_8t*)s)[10]; + ((uint_8t*)d)[11] = ((uint_8t*)s)[11]; + ((uint_8t*)d)[12] = ((uint_8t*)s)[12]; + ((uint_8t*)d)[13] = ((uint_8t*)s)[13]; + ((uint_8t*)d)[14] = ((uint_8t*)s)[14]; + ((uint_8t*)d)[15] = ((uint_8t*)s)[15]; +#endif +} + +static void copy_block( void * d, void *s, uint_8t nn ) +{ + while( nn-- ) + *((uint8_t*)d)++ = *((uint8_t*)s)++; +} +#endif + +static void copy_and_key( void *d, const void *s, const void *k ) +{ +#if defined( HAVE_UINT_32T ) + ((uint_32t*)d)[ 0] = ((uint_32t*)s)[ 0] ^ ((uint_32t*)k)[ 0]; + ((uint_32t*)d)[ 1] = ((uint_32t*)s)[ 1] ^ ((uint_32t*)k)[ 1]; + ((uint_32t*)d)[ 2] = ((uint_32t*)s)[ 2] ^ ((uint_32t*)k)[ 2]; + ((uint_32t*)d)[ 3] = ((uint_32t*)s)[ 3] ^ ((uint_32t*)k)[ 3]; +#elif 1 + ((uint_8t*)d)[ 0] = ((uint_8t*)s)[ 0] ^ ((uint_8t*)k)[ 0]; + ((uint_8t*)d)[ 1] = ((uint_8t*)s)[ 1] ^ ((uint_8t*)k)[ 1]; + ((uint_8t*)d)[ 2] = ((uint_8t*)s)[ 2] ^ ((uint_8t*)k)[ 2]; + ((uint_8t*)d)[ 3] = ((uint_8t*)s)[ 3] ^ ((uint_8t*)k)[ 3]; + ((uint_8t*)d)[ 4] = ((uint_8t*)s)[ 4] ^ ((uint_8t*)k)[ 4]; + ((uint_8t*)d)[ 5] = ((uint_8t*)s)[ 5] ^ ((uint_8t*)k)[ 5]; + ((uint_8t*)d)[ 6] = ((uint_8t*)s)[ 6] ^ ((uint_8t*)k)[ 6]; + ((uint_8t*)d)[ 7] = ((uint_8t*)s)[ 7] ^ ((uint_8t*)k)[ 7]; + ((uint_8t*)d)[ 8] = ((uint_8t*)s)[ 8] ^ ((uint_8t*)k)[ 8]; + ((uint_8t*)d)[ 9] = ((uint_8t*)s)[ 9] ^ ((uint_8t*)k)[ 9]; + ((uint_8t*)d)[10] = ((uint_8t*)s)[10] ^ ((uint_8t*)k)[10]; + ((uint_8t*)d)[11] = ((uint_8t*)s)[11] ^ ((uint_8t*)k)[11]; + ((uint_8t*)d)[12] = ((uint_8t*)s)[12] ^ ((uint_8t*)k)[12]; + ((uint_8t*)d)[13] = ((uint_8t*)s)[13] ^ ((uint_8t*)k)[13]; + ((uint_8t*)d)[14] = ((uint_8t*)s)[14] ^ ((uint_8t*)k)[14]; + ((uint_8t*)d)[15] = ((uint_8t*)s)[15] ^ ((uint_8t*)k)[15]; +#else + block16_copy(d, s); + xor_block(d, k); +#endif +} + +static void shift_sub_rows( uint_8t st[N_BLOCK] ) +{ uint_8t tt; + + st[ 0] = s_box[st[ 0]]; st[ 4] = s_box[st[ 4]]; + st[ 8] = s_box[st[ 8]]; st[12] = s_box[st[12]]; + + tt = st[1]; st[ 1] = s_box[st[ 5]]; st[ 5] = s_box[st[ 9]]; + st[ 9] = s_box[st[13]]; st[13] = s_box[ tt ]; + + tt = st[2]; st[ 2] = s_box[st[10]]; st[10] = s_box[ tt ]; + tt = st[6]; st[ 6] = s_box[st[14]]; st[14] = s_box[ tt ]; + + tt = st[15]; st[15] = s_box[st[11]]; st[11] = s_box[st[ 7]]; + st[ 7] = s_box[st[ 3]]; st[ 3] = s_box[ tt ]; +} + +static void inv_shift_sub_rows( uint_8t st[N_BLOCK] ) +{ uint_8t tt; + + st[ 0] = inv_s_box[st[ 0]]; st[ 4] = inv_s_box[st[ 4]]; + st[ 8] = inv_s_box[st[ 8]]; st[12] = inv_s_box[st[12]]; + + tt = st[13]; st[13] = inv_s_box[st[9]]; st[ 9] = inv_s_box[st[5]]; + st[ 5] = inv_s_box[st[1]]; st[ 1] = inv_s_box[ tt ]; + + tt = st[2]; st[ 2] = inv_s_box[st[10]]; st[10] = inv_s_box[ tt ]; + tt = st[6]; st[ 6] = inv_s_box[st[14]]; st[14] = inv_s_box[ tt ]; + + tt = st[3]; st[ 3] = inv_s_box[st[ 7]]; st[ 7] = inv_s_box[st[11]]; + st[11] = inv_s_box[st[15]]; st[15] = inv_s_box[ tt ]; +} + +#if defined( VERSION_1 ) + static void mix_sub_columns( uint_8t dt[N_BLOCK] ) + { uint_8t st[N_BLOCK]; + block16_copy(st, dt); +#else + static void mix_sub_columns( uint_8t dt[N_BLOCK], uint_8t st[N_BLOCK] ) + { +#endif + dt[ 0] = gfm2_s_box[st[0]] ^ gfm3_s_box[st[5]] ^ s_box[st[10]] ^ s_box[st[15]]; + dt[ 1] = s_box[st[0]] ^ gfm2_s_box[st[5]] ^ gfm3_s_box[st[10]] ^ s_box[st[15]]; + dt[ 2] = s_box[st[0]] ^ s_box[st[5]] ^ gfm2_s_box[st[10]] ^ gfm3_s_box[st[15]]; + dt[ 3] = gfm3_s_box[st[0]] ^ s_box[st[5]] ^ s_box[st[10]] ^ gfm2_s_box[st[15]]; + + dt[ 4] = gfm2_s_box[st[4]] ^ gfm3_s_box[st[9]] ^ s_box[st[14]] ^ s_box[st[3]]; + dt[ 5] = s_box[st[4]] ^ gfm2_s_box[st[9]] ^ gfm3_s_box[st[14]] ^ s_box[st[3]]; + dt[ 6] = s_box[st[4]] ^ s_box[st[9]] ^ gfm2_s_box[st[14]] ^ gfm3_s_box[st[3]]; + dt[ 7] = gfm3_s_box[st[4]] ^ s_box[st[9]] ^ s_box[st[14]] ^ gfm2_s_box[st[3]]; + + dt[ 8] = gfm2_s_box[st[8]] ^ gfm3_s_box[st[13]] ^ s_box[st[2]] ^ s_box[st[7]]; + dt[ 9] = s_box[st[8]] ^ gfm2_s_box[st[13]] ^ gfm3_s_box[st[2]] ^ s_box[st[7]]; + dt[10] = s_box[st[8]] ^ s_box[st[13]] ^ gfm2_s_box[st[2]] ^ gfm3_s_box[st[7]]; + dt[11] = gfm3_s_box[st[8]] ^ s_box[st[13]] ^ s_box[st[2]] ^ gfm2_s_box[st[7]]; + + dt[12] = gfm2_s_box[st[12]] ^ gfm3_s_box[st[1]] ^ s_box[st[6]] ^ s_box[st[11]]; + dt[13] = s_box[st[12]] ^ gfm2_s_box[st[1]] ^ gfm3_s_box[st[6]] ^ s_box[st[11]]; + dt[14] = s_box[st[12]] ^ s_box[st[1]] ^ gfm2_s_box[st[6]] ^ gfm3_s_box[st[11]]; + dt[15] = gfm3_s_box[st[12]] ^ s_box[st[1]] ^ s_box[st[6]] ^ gfm2_s_box[st[11]]; + } + +#if defined( VERSION_1 ) + static void inv_mix_sub_columns( uint_8t dt[N_BLOCK] ) + { uint_8t st[N_BLOCK]; + block16_copy(st, dt); +#else + static void inv_mix_sub_columns( uint_8t dt[N_BLOCK], uint_8t st[N_BLOCK] ) + { +#endif + dt[ 0] = inv_s_box[gfmul_e[st[ 0]] ^ gfmul_b[st[ 1]] ^ gfmul_d[st[ 2]] ^ gfmul_9[st[ 3]]]; + dt[ 5] = inv_s_box[gfmul_9[st[ 0]] ^ gfmul_e[st[ 1]] ^ gfmul_b[st[ 2]] ^ gfmul_d[st[ 3]]]; + dt[10] = inv_s_box[gfmul_d[st[ 0]] ^ gfmul_9[st[ 1]] ^ gfmul_e[st[ 2]] ^ gfmul_b[st[ 3]]]; + dt[15] = inv_s_box[gfmul_b[st[ 0]] ^ gfmul_d[st[ 1]] ^ gfmul_9[st[ 2]] ^ gfmul_e[st[ 3]]]; + + dt[ 4] = inv_s_box[gfmul_e[st[ 4]] ^ gfmul_b[st[ 5]] ^ gfmul_d[st[ 6]] ^ gfmul_9[st[ 7]]]; + dt[ 9] = inv_s_box[gfmul_9[st[ 4]] ^ gfmul_e[st[ 5]] ^ gfmul_b[st[ 6]] ^ gfmul_d[st[ 7]]]; + dt[14] = inv_s_box[gfmul_d[st[ 4]] ^ gfmul_9[st[ 5]] ^ gfmul_e[st[ 6]] ^ gfmul_b[st[ 7]]]; + dt[ 3] = inv_s_box[gfmul_b[st[ 4]] ^ gfmul_d[st[ 5]] ^ gfmul_9[st[ 6]] ^ gfmul_e[st[ 7]]]; + + dt[ 8] = inv_s_box[gfmul_e[st[ 8]] ^ gfmul_b[st[ 9]] ^ gfmul_d[st[10]] ^ gfmul_9[st[11]]]; + dt[13] = inv_s_box[gfmul_9[st[ 8]] ^ gfmul_e[st[ 9]] ^ gfmul_b[st[10]] ^ gfmul_d[st[11]]]; + dt[ 2] = inv_s_box[gfmul_d[st[ 8]] ^ gfmul_9[st[ 9]] ^ gfmul_e[st[10]] ^ gfmul_b[st[11]]]; + dt[ 7] = inv_s_box[gfmul_b[st[ 8]] ^ gfmul_d[st[ 9]] ^ gfmul_9[st[10]] ^ gfmul_e[st[11]]]; + + dt[12] = inv_s_box[gfmul_e[st[12]] ^ gfmul_b[st[13]] ^ gfmul_d[st[14]] ^ gfmul_9[st[15]]]; + dt[ 1] = inv_s_box[gfmul_9[st[12]] ^ gfmul_e[st[13]] ^ gfmul_b[st[14]] ^ gfmul_d[st[15]]]; + dt[ 6] = inv_s_box[gfmul_d[st[12]] ^ gfmul_9[st[13]] ^ gfmul_e[st[14]] ^ gfmul_b[st[15]]]; + dt[11] = inv_s_box[gfmul_b[st[12]] ^ gfmul_d[st[13]] ^ gfmul_9[st[14]] ^ gfmul_e[st[15]]]; + } + +#if defined( AES_ENC_PREKEYED ) || defined( AES_DEC_PREKEYED ) + +/* Set the cipher key for the pre-keyed version */ + +return_type aes_set_key( const unsigned char key[], length_type keylen, aes_context ctx[1] ) +{ + uint_8t cc, rc, hi; + + switch( keylen ) + { + case 16: + case 128: + keylen = 16; + break; + case 24: + case 192: + keylen = 24; + break; + case 32: + keylen = 32; + break; + default: + ctx->rnd = 0; + return -1; + } + block_copy(ctx->ksch, key, keylen); + hi = (keylen + 28) << 2; + ctx->rnd = (hi >> 4) - 1; + for( cc = keylen, rc = 1; cc < hi; cc += 4 ) + { uint_8t tt, t0, t1, t2, t3; + + t0 = ctx->ksch[cc - 4]; + t1 = ctx->ksch[cc - 3]; + t2 = ctx->ksch[cc - 2]; + t3 = ctx->ksch[cc - 1]; + if( cc % keylen == 0 ) + { + tt = t0; + t0 = s_box[t1] ^ rc; + t1 = s_box[t2]; + t2 = s_box[t3]; + t3 = s_box[tt]; + rc = f2(rc); + } + else if( keylen > 24 && cc % keylen == 16 ) + { + t0 = s_box[t0]; + t1 = s_box[t1]; + t2 = s_box[t2]; + t3 = s_box[t3]; + } + tt = cc - keylen; + ctx->ksch[cc + 0] = ctx->ksch[tt + 0] ^ t0; + ctx->ksch[cc + 1] = ctx->ksch[tt + 1] ^ t1; + ctx->ksch[cc + 2] = ctx->ksch[tt + 2] ^ t2; + ctx->ksch[cc + 3] = ctx->ksch[tt + 3] ^ t3; + } + return 0; +} + +#endif + +#if defined( AES_ENC_PREKEYED ) + +/* Encrypt a single block of 16 bytes */ + +return_type aes_encrypt( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], const aes_context ctx[1] ) +{ + if( ctx->rnd ) + { + uint_8t s1[N_BLOCK], r; + copy_and_key( s1, in, ctx->ksch ); + + for( r = 1 ; r < ctx->rnd ; ++r ) +#if defined( VERSION_1 ) + { + mix_sub_columns( s1 ); + add_round_key( s1, ctx->ksch + r * N_BLOCK); + } +#else + { uint_8t s2[N_BLOCK]; + mix_sub_columns( s2, s1 ); + copy_and_key( s1, s2, ctx->ksch + r * N_BLOCK); + } +#endif + shift_sub_rows( s1 ); + copy_and_key( out, s1, ctx->ksch + r * N_BLOCK ); + } + else + return -1; + return 0; +} + +#endif + +#if defined( AES_DEC_PREKEYED ) + +/* Decrypt a single block of 16 bytes */ + +return_type aes_decrypt( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], const aes_context ctx[1] ) +{ + if( ctx->rnd ) + { + uint_8t s1[N_BLOCK], r; + copy_and_key( s1, in, ctx->ksch + ctx->rnd * N_BLOCK ); + inv_shift_sub_rows( s1 ); + + for( r = ctx->rnd ; --r ; ) +#if defined( VERSION_1 ) + { + add_round_key( s1, ctx->ksch + r * N_BLOCK ); + inv_mix_sub_columns( s1 ); + } +#else + { uint_8t s2[N_BLOCK]; + copy_and_key( s2, s1, ctx->ksch + r * N_BLOCK ); + inv_mix_sub_columns( s1, s2 ); + } +#endif + copy_and_key( out, s1, ctx->ksch ); + } + else + return -1; + return 0; +} + +#endif + +#if defined( AES_ENC_128_OTFK ) + +/* The 'on the fly' encryption key update for for 128 bit keys */ + +static void update_encrypt_key_128( uint_8t k[N_BLOCK], uint_8t *rc ) +{ uint_8t cc; + + k[0] ^= s_box[k[13]] ^ *rc; + k[1] ^= s_box[k[14]]; + k[2] ^= s_box[k[15]]; + k[3] ^= s_box[k[12]]; + *rc = f2( *rc ); + + for(cc = 4; cc < 16; cc += 4 ) + { + k[cc + 0] ^= k[cc - 4]; + k[cc + 1] ^= k[cc - 3]; + k[cc + 2] ^= k[cc - 2]; + k[cc + 3] ^= k[cc - 1]; + } +} + +/* Encrypt a single block of 16 bytes with 'on the fly' 128 bit keying */ + +void aes_encrypt_128( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], + const unsigned char key[N_BLOCK], unsigned char o_key[N_BLOCK] ) +{ uint_8t s1[N_BLOCK], r, rc = 1; + + if(o_key != key) + block16_copy( o_key, key ); + copy_and_key( s1, in, o_key ); + + for( r = 1 ; r < 10 ; ++r ) +#if defined( VERSION_1 ) + { + mix_sub_columns( s1 ); + update_encrypt_key_128( o_key, &rc ); + add_round_key( s1, o_key ); + } +#else + { uint_8t s2[N_BLOCK]; + mix_sub_columns( s2, s1 ); + update_encrypt_key_128( o_key, &rc ); + copy_and_key( s1, s2, o_key ); + } +#endif + + shift_sub_rows( s1 ); + update_encrypt_key_128( o_key, &rc ); + copy_and_key( out, s1, o_key ); +} + +#endif + +#if defined( AES_DEC_128_OTFK ) + +/* The 'on the fly' decryption key update for for 128 bit keys */ + +static void update_decrypt_key_128( uint_8t k[N_BLOCK], uint_8t *rc ) +{ uint_8t cc; + + for( cc = 12; cc > 0; cc -= 4 ) + { + k[cc + 0] ^= k[cc - 4]; + k[cc + 1] ^= k[cc - 3]; + k[cc + 2] ^= k[cc - 2]; + k[cc + 3] ^= k[cc - 1]; + } + *rc = d2(*rc); + k[0] ^= s_box[k[13]] ^ *rc; + k[1] ^= s_box[k[14]]; + k[2] ^= s_box[k[15]]; + k[3] ^= s_box[k[12]]; +} + +/* Decrypt a single block of 16 bytes with 'on the fly' 128 bit keying */ + +void aes_decrypt_128( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], + const unsigned char key[N_BLOCK], unsigned char o_key[N_BLOCK] ) +{ + uint_8t s1[N_BLOCK], r, rc = 0x6c; + if(o_key != key) + block16_copy( o_key, key ); + + copy_and_key( s1, in, o_key ); + inv_shift_sub_rows( s1 ); + + for( r = 10 ; --r ; ) +#if defined( VERSION_1 ) + { + update_decrypt_key_128( o_key, &rc ); + add_round_key( s1, o_key ); + inv_mix_sub_columns( s1 ); + } +#else + { uint_8t s2[N_BLOCK]; + update_decrypt_key_128( o_key, &rc ); + copy_and_key( s2, s1, o_key ); + inv_mix_sub_columns( s1, s2 ); + } +#endif + update_decrypt_key_128( o_key, &rc ); + copy_and_key( out, s1, o_key ); +} + +#endif + +#if defined( AES_ENC_256_OTFK ) + +/* The 'on the fly' encryption key update for for 256 bit keys */ + +static void update_encrypt_key_256( uint_8t k[2 * N_BLOCK], uint_8t *rc ) +{ uint_8t cc; + + k[0] ^= s_box[k[29]] ^ *rc; + k[1] ^= s_box[k[30]]; + k[2] ^= s_box[k[31]]; + k[3] ^= s_box[k[28]]; + *rc = f2( *rc ); + + for(cc = 4; cc < 16; cc += 4) + { + k[cc + 0] ^= k[cc - 4]; + k[cc + 1] ^= k[cc - 3]; + k[cc + 2] ^= k[cc - 2]; + k[cc + 3] ^= k[cc - 1]; + } + + k[16] ^= s_box[k[12]]; + k[17] ^= s_box[k[13]]; + k[18] ^= s_box[k[14]]; + k[19] ^= s_box[k[15]]; + + for( cc = 20; cc < 32; cc += 4 ) + { + k[cc + 0] ^= k[cc - 4]; + k[cc + 1] ^= k[cc - 3]; + k[cc + 2] ^= k[cc - 2]; + k[cc + 3] ^= k[cc - 1]; + } +} + +/* Encrypt a single block of 16 bytes with 'on the fly' 256 bit keying */ + +void aes_encrypt_256( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], + const unsigned char key[2 * N_BLOCK], unsigned char o_key[2 * N_BLOCK] ) +{ + uint_8t s1[N_BLOCK], r, rc = 1; + if(o_key != key) + { + block16_copy( o_key, key ); + block16_copy( o_key + 16, key + 16 ); + } + copy_and_key( s1, in, o_key ); + + for( r = 1 ; r < 14 ; ++r ) +#if defined( VERSION_1 ) + { + mix_sub_columns(s1); + if( r & 1 ) + add_round_key( s1, o_key + 16 ); + else + { + update_encrypt_key_256( o_key, &rc ); + add_round_key( s1, o_key ); + } + } +#else + { uint_8t s2[N_BLOCK]; + mix_sub_columns( s2, s1 ); + if( r & 1 ) + copy_and_key( s1, s2, o_key + 16 ); + else + { + update_encrypt_key_256( o_key, &rc ); + copy_and_key( s1, s2, o_key ); + } + } +#endif + + shift_sub_rows( s1 ); + update_encrypt_key_256( o_key, &rc ); + copy_and_key( out, s1, o_key ); +} + +#endif + +#if defined( AES_DEC_256_OTFK ) + +/* The 'on the fly' encryption key update for for 256 bit keys */ + +static void update_decrypt_key_256( uint_8t k[2 * N_BLOCK], uint_8t *rc ) +{ uint_8t cc; + + for(cc = 28; cc > 16; cc -= 4) + { + k[cc + 0] ^= k[cc - 4]; + k[cc + 1] ^= k[cc - 3]; + k[cc + 2] ^= k[cc - 2]; + k[cc + 3] ^= k[cc - 1]; + } + + k[16] ^= s_box[k[12]]; + k[17] ^= s_box[k[13]]; + k[18] ^= s_box[k[14]]; + k[19] ^= s_box[k[15]]; + + for(cc = 12; cc > 0; cc -= 4) + { + k[cc + 0] ^= k[cc - 4]; + k[cc + 1] ^= k[cc - 3]; + k[cc + 2] ^= k[cc - 2]; + k[cc + 3] ^= k[cc - 1]; + } + + *rc = d2(*rc); + k[0] ^= s_box[k[29]] ^ *rc; + k[1] ^= s_box[k[30]]; + k[2] ^= s_box[k[31]]; + k[3] ^= s_box[k[28]]; +} + +/* Decrypt a single block of 16 bytes with 'on the fly' + 256 bit keying +*/ +void aes_decrypt_256( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], + const unsigned char key[2 * N_BLOCK], unsigned char o_key[2 * N_BLOCK] ) +{ + uint_8t s1[N_BLOCK], r, rc = 0x80; + + if(o_key != key) + { + block16_copy( o_key, key ); + block16_copy( o_key + 16, key + 16 ); + } + + copy_and_key( s1, in, o_key ); + inv_shift_sub_rows( s1 ); + + for( r = 14 ; --r ; ) +#if defined( VERSION_1 ) + { + if( ( r & 1 ) ) + { + update_decrypt_key_256( o_key, &rc ); + add_round_key( s1, o_key + 16 ); + } + else + add_round_key( s1, o_key ); + inv_mix_sub_columns( s1 ); + } +#else + { uint_8t s2[N_BLOCK]; + if( ( r & 1 ) ) + { + update_decrypt_key_256( o_key, &rc ); + copy_and_key( s2, s1, o_key + 16 ); + } + else + copy_and_key( s2, s1, o_key ); + inv_mix_sub_columns( s1, s2 ); + } +#endif + copy_and_key( out, s1, o_key ); +} + +#endif diff --git a/src/utils/crypto/aessmall.h b/src/utils/crypto/aessmall.h new file mode 100644 index 00000000000..ebeb24efd0f --- /dev/null +++ b/src/utils/crypto/aessmall.h @@ -0,0 +1,169 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software in both source and binary + form is allowed (with or without changes) provided that: + + 1. distributions of this source code include the above copyright + notice, this list of conditions and the following disclaimer; + + 2. distributions in binary form include the above copyright + notice, this list of conditions and the following disclaimer + in the documentation and/or other associated materials; + + 3. the copyright holder's name is not used to endorse products + built using this software without specific written permission. + + ALTERNATIVELY, provided that this notice is retained in full, this product + may be distributed under the terms of the GNU General Public License (GPL), + in which case the provisions of the GPL apply INSTEAD OF those given above. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue 09/09/2006 + + This is an AES implementation that uses only 8-bit byte operations on the + cipher state. + */ + +#ifndef AES_H +#define AES_H + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* This provides speed optimisation opportunities if 32-bit word + operations are available +*/ +#if 1 +# define HAVE_UINT_32T +#endif + +#if 1 +# define AES_ENC_PREKEYED /* AES encryption with a precomputed key schedule */ +#endif +#if 1 +# define AES_DEC_PREKEYED /* AES decryption with a precomputed key schedule */ +#endif +#if 0 +# define AES_ENC_128_OTFK /* AES encryption with 'on the fly' 128 bit keying */ +#endif +#if 0 +# define AES_DEC_128_OTFK /* AES decryption with 'on the fly' 128 bit keying */ +#endif +#if 0 +# define AES_ENC_256_OTFK /* AES encryption with 'on the fly' 256 bit keying */ +#endif +#if 0 +# define AES_DEC_256_OTFK /* AES decryption with 'on the fly' 256 bit keying */ +#endif + +#define N_ROW 4 +#define N_COL 4 +#define N_BLOCK (N_ROW * N_COL) +#define N_MAX_ROUNDS 14 + +typedef unsigned char uint_8t; + +typedef uint_8t return_type; +typedef uint_8t length_type; +typedef uint_8t uint_type; + +typedef unsigned char uint_8t; + +typedef struct +{ uint_8t ksch[(N_MAX_ROUNDS + 1) * N_BLOCK]; + uint_8t rnd; +} aes_context; + +/* The following calls are for a precomputed key schedule + + NOTE: If the length_type used for the key length is an + unsigned 8-bit character, a key length of 256 bits must + be entered as a length in bytes (valid inputs are hence + 128, 192, 16, 24 and 32). +*/ + +#if defined( AES_ENC_PREKEYED ) || defined( AES_DEC_PREKEYED ) + +return_type aes_set_key( const unsigned char key[], + length_type keylen, + aes_context ctx[1] ); +#endif + +#if defined( AES_ENC_PREKEYED ) + +return_type aes_encrypt( const unsigned char in[N_BLOCK], + unsigned char out[N_BLOCK], + const aes_context ctx[1] ); +#endif + +#if defined( AES_DEC_PREKEYED ) + +return_type aes_decrypt( const unsigned char in[N_BLOCK], + unsigned char out[N_BLOCK], + const aes_context ctx[1] ); +#endif + +/* The following calls are for 'on the fly' keying. In this case the + encryption and decryption keys are different. + + The encryption subroutines take a key in an array of bytes in + key[L] where L is 16, 24 or 32 bytes for key lengths of 128, + 192, and 256 bits respectively. They then encrypts the input + data, in[] with this key and put the reult in the output array + out[]. In addition, the second key array, o_key[L], is used + to output the key that is needed by the decryption subroutine + to reverse the encryption operation. The two key arrays can + be the same array but in this case the original key will be + overwritten. + + In the same way, the decryption subroutines output keys that + can be used to reverse their effect when used for encryption. + + Only 128 and 256 bit keys are supported in these 'on the fly' + modes. +*/ + +#if defined( AES_ENC_128_OTFK ) +void aes_encrypt_128( const unsigned char in[N_BLOCK], + unsigned char out[N_BLOCK], + const unsigned char key[N_BLOCK], + uint_8t o_key[N_BLOCK] ); +#endif + +#if defined( AES_DEC_128_OTFK ) +void aes_decrypt_128( const unsigned char in[N_BLOCK], + unsigned char out[N_BLOCK], + const unsigned char key[N_BLOCK], + unsigned char o_key[N_BLOCK] ); +#endif + +#if defined( AES_ENC_256_OTFK ) +void aes_encrypt_256( const unsigned char in[N_BLOCK], + unsigned char out[N_BLOCK], + const unsigned char key[2 * N_BLOCK], + unsigned char o_key[2 * N_BLOCK] ); +#endif + +#if defined( AES_DEC_256_OTFK ) +void aes_decrypt_256( const unsigned char in[N_BLOCK], + unsigned char out[N_BLOCK], + const unsigned char key[2 * N_BLOCK], + unsigned char o_key[2 * N_BLOCK] ); +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/utils/crypto/aessmall_x86.asm b/src/utils/crypto/aessmall_x86.asm new file mode 100644 index 00000000000..9356a65c05a --- /dev/null +++ b/src/utils/crypto/aessmall_x86.asm @@ -0,0 +1,1444 @@ + +; --------------------------------------------------------------------------- +; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. +; +; LICENSE TERMS +; +; The free distribution and use of this software is allowed (with or without +; changes) provided that: +; +; 1. source code distributions include the above copyright notice, this +; list of conditions and the following disclaimer; +; +; 2. binary distributions include the above copyright notice, this list +; of conditions and the following disclaimer in their documentation; +; +; 3. the name of the copyright holder is not used to endorse products +; built using this software without specific written permission. +; +; DISCLAIMER +; +; This software is provided 'as is' with no explicit or implied warranties +; in respect of its properties, including, but not limited to, correctness +; and/or fitness for purpose. +; --------------------------------------------------------------------------- +; Issue 20/12/2007 +; +; This code requires either ASM_X86_V2 or ASM_X86_V2C to be set in aesopt.h +; and the same define to be set here as well. If AES_V2C is set this file +; requires the C files aeskey.c and aestab.c for support. + +; An AES implementation for x86 processors using the YASM (or NASM) assembler. +; This is a full assembler implementation covering encryption, decryption and +; key scheduling. It uses 2k bytes of tables but its encryption and decryption +; performance is very close to that obtained using large tables. Key schedule +; expansion is slower for both encryption and decryption but this is likely to +; be offset by the much smaller load that this version places on the processor +; cache. I acknowledge the contribution made by Daniel Bernstein to aspects of +; the design of the AES round function used here. +; +; This code provides the standard AES block size (128 bits, 16 bytes) and the +; three standard AES key sizes (128, 192 and 256 bits). It has the same call +; interface as my C implementation. The ebx, esi, edi and ebp registers are +; preserved across calls but eax, ecx and edx and the artihmetic status flags +; are not. Although this is a full assembler implementation, it can be used +; in conjunction with my C code which provides faster key scheduling using +; large tables. In this case aeskey.c should be compiled with ASM_X86_V2C +; defined. It is also important that the defines below match those used in the +; C code. This code uses the VC++ register saving conentions; if it is used +; with another compiler, conventions for using and saving registers may need +; to be checked (and calling conventions). The YASM command line for the VC++ +; custom build step is: +; +; yasm -Xvc -f win32 -D -o "$(TargetDir)\$(InputName).obj" "$(InputPath)" +; +; For the cryptlib build this is (pcg): +; +; yasm -Xvc -f win32 -D ASM_X86_V2C -o aescrypt2.obj aes_x86_v2.asm +; +; where is ASM_X86_V2 or ASM_X86_V2C. The calling intefaces are: +; +; AES_RETURN aes_encrypt(const unsigned char in_blk[], +; unsigned char out_blk[], const aes_encrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt(const unsigned char in_blk[], +; unsigned char out_blk[], const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_encrypt_key(const unsigned char key[], +; const aes_encrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt_key(const unsigned char key[], +; const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_encrypt_key(const unsigned char key[], +; unsigned int len, const aes_decrypt_ctx cx[1]); +; +; AES_RETURN aes_decrypt_key(const unsigned char key[], +; unsigned int len, const aes_decrypt_ctx cx[1]); +; +; where is 128, 102 or 256. In the last two calls the length can be in +; either bits or bytes. + +; The DLL interface must use the _stdcall convention in which the number +; of bytes of parameter space is added after an @ to the sutine's name. +; We must also remove our parameters from the stack before return (see +; the do_exit macro). Define DLL_EXPORT for the Dynamic Link Library version. + +; +; Adapted for TrueCrypt by the TrueCrypt Foundation: +; - All tables generated at run-time +; - Adapted for 16-bit environment +; + +CPU 386 +USE16 +SEGMENT _TEXT PUBLIC CLASS=CODE USE16 +SEGMENT _DATA PUBLIC CLASS=DATA USE16 + +GROUP DGROUP _TEXT _DATA + +extern _aes_dec_tab ; Aestab.c +extern _aes_enc_tab + +; %define DLL_EXPORT + +; The size of the code can be reduced by using functions for the encryption +; and decryption rounds in place of macro expansion + +%define REDUCE_CODE_SIZE + +; Comment in/out the following lines to obtain the desired subroutines. These +; selections MUST match those in the C header file aes.h + +; %define AES_128 ; define if AES with 128 bit keys is needed +; %define AES_192 ; define if AES with 192 bit keys is needed +%define AES_256 ; define if AES with 256 bit keys is needed +; %define AES_VAR ; define if a variable key size is needed +%define ENCRYPTION ; define if encryption is needed +%define DECRYPTION ; define if decryption is needed +; %define AES_REV_DKS ; define if key decryption schedule is reversed + +%ifndef ASM_X86_V2C +%define ENCRYPTION_KEY_SCHEDULE ; define if encryption key expansion is needed +%define DECRYPTION_KEY_SCHEDULE ; define if decryption key expansion is needed +%endif + +; The encryption key schedule has the following in memory layout where N is the +; number of rounds (10, 12 or 14): +; +; lo: | input key (round 0) | ; each round is four 32-bit words +; | encryption round 1 | +; | encryption round 2 | +; .... +; | encryption round N-1 | +; hi: | encryption round N | +; +; The decryption key schedule is normally set up so that it has the same +; layout as above by actually reversing the order of the encryption key +; schedule in memory (this happens when AES_REV_DKS is set): +; +; lo: | decryption round 0 | = | encryption round N | +; | decryption round 1 | = INV_MIX_COL[ | encryption round N-1 | ] +; | decryption round 2 | = INV_MIX_COL[ | encryption round N-2 | ] +; .... .... +; | decryption round N-1 | = INV_MIX_COL[ | encryption round 1 | ] +; hi: | decryption round N | = | input key (round 0) | +; +; with rounds except the first and last modified using inv_mix_column() +; But if AES_REV_DKS is NOT set the order of keys is left as it is for +; encryption so that it has to be accessed in reverse when used for +; decryption (although the inverse mix column modifications are done) +; +; lo: | decryption round 0 | = | input key (round 0) | +; | decryption round 1 | = INV_MIX_COL[ | encryption round 1 | ] +; | decryption round 2 | = INV_MIX_COL[ | encryption round 2 | ] +; .... .... +; | decryption round N-1 | = INV_MIX_COL[ | encryption round N-1 | ] +; hi: | decryption round N | = | encryption round N | +; +; This layout is faster when the assembler key scheduling provided here +; is used. +; +; End of user defines + +%ifdef AES_VAR +%ifndef AES_128 +%define AES_128 +%endif +%ifndef AES_192 +%define AES_192 +%endif +%ifndef AES_256 +%define AES_256 +%endif +%endif + +%ifdef AES_VAR +%define KS_LENGTH 60 +%elifdef AES_256 +%define KS_LENGTH 60 +%elifdef AES_192 +%define KS_LENGTH 52 +%else +%define KS_LENGTH 44 +%endif + +; These macros implement stack based local variables + +%macro save 2 + mov [esp+4*%1],%2 +%endmacro + +%macro restore 2 + mov %1,[esp+4*%2] +%endmacro + +%ifdef REDUCE_CODE_SIZE + %macro mf_call 1 + call %1 + %endmacro +%else + %macro mf_call 1 + %1 + %endmacro +%endif + +; the DLL has to implement the _stdcall calling interface on return +; In this case we have to take our parameters (3 4-byte pointers) +; off the stack + +%define parms 12 + +%macro do_name 1-2 parms +%ifndef DLL_EXPORT + global %1 +%1: +%else + global %1@%2 + export %1@%2 +%1@%2: +%endif +%endmacro + +%macro do_call 1-2 parms +%ifndef DLL_EXPORT + call %1 + add esp,%2 +%else + call %1@%2 +%endif +%endmacro + +%macro do_exit 0-1 parms +%ifdef DLL_EXPORT + ret %1 +%else + ret +%endif +%endmacro + +; finite field multiplies by {02}, {04} and {08} + +%define f2(x) ((x<<1)^(((x>>7)&1)*0x11b)) +%define f4(x) ((x<<2)^(((x>>6)&1)*0x11b)^(((x>>6)&2)*0x11b)) +%define f8(x) ((x<<3)^(((x>>5)&1)*0x11b)^(((x>>5)&2)*0x11b)^(((x>>5)&4)*0x11b)) + +; finite field multiplies required in table generation + +%define f3(x) (f2(x) ^ x) +%define f9(x) (f8(x) ^ x) +%define fb(x) (f8(x) ^ f2(x) ^ x) +%define fd(x) (f8(x) ^ f4(x) ^ x) +%define fe(x) (f8(x) ^ f4(x) ^ f2(x)) + +%define etab_0(x) [_aes_enc_tab+4+8*x] +%define etab_1(x) [_aes_enc_tab+3+8*x] +%define etab_2(x) [_aes_enc_tab+2+8*x] +%define etab_3(x) [_aes_enc_tab+1+8*x] +%define etab_b(x) byte [_aes_enc_tab+1+8*x] ; used with movzx for 0x000000xx +%define etab_w(x) word [_aes_enc_tab+8*x] ; used with movzx for 0x0000xx00 + +%define btab_0(x) [_aes_enc_tab+6+8*x] +%define btab_1(x) [_aes_enc_tab+5+8*x] +%define btab_2(x) [_aes_enc_tab+4+8*x] +%define btab_3(x) [_aes_enc_tab+3+8*x] + +; ROUND FUNCTION. Build column[2] on ESI and column[3] on EDI that have the +; round keys pre-loaded. Build column[0] in EBP and column[1] in EBX. +; +; Input: +; +; EAX column[0] +; EBX column[1] +; ECX column[2] +; EDX column[3] +; ESI column key[round][2] +; EDI column key[round][3] +; EBP scratch +; +; Output: +; +; EBP column[0] unkeyed +; EBX column[1] unkeyed +; ESI column[2] keyed +; EDI column[3] keyed +; EAX scratch +; ECX scratch +; EDX scratch + +%macro rnd_fun 2 + + rol ebx,16 + %1 esi, cl, 0, ebp + %1 esi, dh, 1, ebp + %1 esi, bh, 3, ebp + %1 edi, dl, 0, ebp + %1 edi, ah, 1, ebp + %1 edi, bl, 2, ebp + %2 ebp, al, 0, ebp + shr ebx,16 + and eax,0xffff0000 + or eax,ebx + shr edx,16 + %1 ebp, ah, 1, ebx + %1 ebp, dh, 3, ebx + %2 ebx, dl, 2, ebx + %1 ebx, ch, 1, edx + %1 ebx, al, 0, edx + shr eax,16 + shr ecx,16 + %1 ebp, cl, 2, edx + %1 edi, ch, 3, edx + %1 esi, al, 2, edx + %1 ebx, ah, 3, edx + +%endmacro + +; Basic MOV and XOR Operations for normal rounds + +%macro nr_xor 4 + movzx %4,%2 + xor %1,etab_%3(%4) +%endmacro + +%macro nr_mov 4 + movzx %4,%2 + mov %1,etab_%3(%4) +%endmacro + +; Basic MOV and XOR Operations for last round + +%if 1 + + %macro lr_xor 4 + movzx %4,%2 + movzx %4,etab_b(%4) + %if %3 != 0 + shl %4,8*%3 + %endif + xor %1,%4 + %endmacro + + %macro lr_mov 4 + movzx %4,%2 + movzx %1,etab_b(%4) + %if %3 != 0 + shl %1,8*%3 + %endif + %endmacro + +%else ; less effective but worth leaving as an option + + %macro lr_xor 4 + movzx %4,%2 + mov %4,btab_%3(%4) + and %4,0x000000ff << 8 * %3 + xor %1,%4 + %endmacro + + %macro lr_mov 4 + movzx %4,%2 + mov %1,btab_%3(%4) + and %1,0x000000ff << 8 * %3 + %endmacro + +%endif + +; Apply S-Box to the 4 bytes in a 32-bit word and rotate byte positions + +%ifdef REDUCE_CODE_SIZE + +l3s_col: + movzx ecx,al ; in eax + movzx ecx, etab_b(ecx) ; out eax + xor edx,ecx ; scratch ecx,edx + movzx ecx,ah + movzx ecx, etab_b(ecx) + shl ecx,8 + xor edx,ecx + shr eax,16 + movzx ecx,al + movzx ecx, etab_b(ecx) + shl ecx,16 + xor edx,ecx + movzx ecx,ah + movzx ecx, etab_b(ecx) + shl ecx,24 + xor edx,ecx + mov eax,edx + ret + +%else + +%macro l3s_col 0 + + movzx ecx,al ; in eax + movzx ecx, etab_b(ecx) ; out eax + xor edx,ecx ; scratch ecx,edx + movzx ecx,ah + movzx ecx, etab_b(ecx) + shl ecx,8 + xor edx,ecx + shr eax,16 + movzx ecx,al + movzx ecx, etab_b(ecx) + shl ecx,16 + xor edx,ecx + movzx ecx,ah + movzx ecx, etab_b(ecx) + shl ecx,24 + xor edx,ecx + mov eax,edx + +%endmacro + +%endif + +; offsets to parameters + +in_blk equ 2 ; input byte array address parameter +out_blk equ 4 ; output byte array address parameter +ctx equ 6 ; AES context structure +stk_spc equ 20 ; stack space + +%ifdef ENCRYPTION + +; %define ENCRYPTION_TABLE + +%ifdef REDUCE_CODE_SIZE + +enc_round: + sub sp, 2 + add ebp,16 + save 1,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + rnd_fun nr_xor, nr_mov + + mov eax,ebp + mov ecx,esi + mov edx,edi + restore ebp,1 + xor eax,[ebp] + xor ebx,[ebp+4] + add sp, 2 + ret + +%else + +%macro enc_round 0 + + add ebp,16 + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + rnd_fun nr_xor, nr_mov + + mov eax,ebp + mov ecx,esi + mov edx,edi + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + +%endif + +%macro enc_last_round 0 + + add ebp,16 + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + rnd_fun lr_xor, lr_mov + + mov eax,ebp + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + + section _TEXT + +; AES Encryption Subroutine + + do_name _aes_encrypt,12 + + mov ax, sp + movzx esp, ax + + sub esp,stk_spc + mov [esp+16],ebp + mov [esp+12],ebx + mov [esp+ 8],esi + mov [esp+ 4],edi + + movzx esi,word [esp+in_blk+stk_spc] ; input pointer + mov eax,[esi ] + mov ebx,[esi+ 4] + mov ecx,[esi+ 8] + mov edx,[esi+12] + + movzx ebp,word [esp+ctx+stk_spc] ; key pointer + movzx edi,byte [ebp+4*KS_LENGTH] + xor eax,[ebp ] + xor ebx,[ebp+ 4] + xor ecx,[ebp+ 8] + xor edx,[ebp+12] + +; determine the number of rounds + +%ifndef AES_256 + cmp edi,10*16 + je .3 + cmp edi,12*16 + je .2 + cmp edi,14*16 + je .1 + mov eax,-1 + jmp .5 +%endif + +.1: mf_call enc_round + mf_call enc_round +.2: mf_call enc_round + mf_call enc_round +.3: mf_call enc_round + mf_call enc_round + mf_call enc_round + mf_call enc_round + mf_call enc_round + mf_call enc_round + mf_call enc_round + mf_call enc_round + mf_call enc_round + enc_last_round + + movzx edx,word [esp+out_blk+stk_spc] + mov [edx],eax + mov [edx+4],ebx + mov [edx+8],esi + mov [edx+12],edi + xor eax,eax + +.5: mov ebp,[esp+16] + mov ebx,[esp+12] + mov esi,[esp+ 8] + mov edi,[esp+ 4] + add esp,stk_spc + do_exit 12 + +%endif + +%macro f_key 2 + + push ecx + push edx + mov edx,esi + ror eax,8 + mf_call l3s_col + mov esi,eax + pop edx + pop ecx + xor esi,rc_val + + mov [ebp+%1*%2],esi + xor edi,esi + mov [ebp+%1*%2+4],edi + xor ecx,edi + mov [ebp+%1*%2+8],ecx + xor edx,ecx + mov [ebp+%1*%2+12],edx + mov eax,edx + +%if %2 == 24 + +%if %1 < 7 + xor eax,[ebp+%1*%2+16-%2] + mov [ebp+%1*%2+16],eax + xor eax,[ebp+%1*%2+20-%2] + mov [ebp+%1*%2+20],eax +%endif + +%elif %2 == 32 + +%if %1 < 6 + push ecx + push edx + mov edx,[ebp+%1*%2+16-%2] + mf_call l3s_col + pop edx + pop ecx + mov [ebp+%1*%2+16],eax + xor eax,[ebp+%1*%2+20-%2] + mov [ebp+%1*%2+20],eax + xor eax,[ebp+%1*%2+24-%2] + mov [ebp+%1*%2+24],eax + xor eax,[ebp+%1*%2+28-%2] + mov [ebp+%1*%2+28],eax +%endif + +%endif + +%assign rc_val f2(rc_val) + +%endmacro + +%ifdef ENCRYPTION_KEY_SCHEDULE + +%ifdef AES_128 + +%ifndef ENCRYPTION_TABLE +; %define ENCRYPTION_TABLE +%endif + +%assign rc_val 1 + + do_name _aes_encrypt_key128,8 + + push ebp + push ebx + push esi + push edi + + mov ebp,[esp+24] + mov [ebp+4*KS_LENGTH],dword 10*16 + mov ebx,[esp+20] + + mov esi,[ebx] + mov [ebp],esi + mov edi,[ebx+4] + mov [ebp+4],edi + mov ecx,[ebx+8] + mov [ebp+8],ecx + mov edx,[ebx+12] + mov [ebp+12],edx + add ebp,16 + mov eax,edx + + f_key 0,16 ; 11 * 4 = 44 unsigned longs + f_key 1,16 ; 4 + 4 * 10 generated = 44 + f_key 2,16 + f_key 3,16 + f_key 4,16 + f_key 5,16 + f_key 6,16 + f_key 7,16 + f_key 8,16 + f_key 9,16 + + pop edi + pop esi + pop ebx + pop ebp + xor eax,eax + do_exit 8 + +%endif + +%ifdef AES_192 + +%ifndef ENCRYPTION_TABLE +; %define ENCRYPTION_TABLE +%endif + +%assign rc_val 1 + + do_name _aes_encrypt_key192,8 + + push ebp + push ebx + push esi + push edi + + mov ebp,[esp+24] + mov [ebp+4*KS_LENGTH],dword 12 * 16 + mov ebx,[esp+20] + + mov esi,[ebx] + mov [ebp],esi + mov edi,[ebx+4] + mov [ebp+4],edi + mov ecx,[ebx+8] + mov [ebp+8],ecx + mov edx,[ebx+12] + mov [ebp+12],edx + mov eax,[ebx+16] + mov [ebp+16],eax + mov eax,[ebx+20] + mov [ebp+20],eax + add ebp,24 + + f_key 0,24 ; 13 * 4 = 52 unsigned longs + f_key 1,24 ; 6 + 6 * 8 generated = 54 + f_key 2,24 + f_key 3,24 + f_key 4,24 + f_key 5,24 + f_key 6,24 + f_key 7,24 + + pop edi + pop esi + pop ebx + pop ebp + xor eax,eax + do_exit 8 + +%endif + +%ifdef AES_256 + +%ifndef ENCRYPTION_TABLE +; %define ENCRYPTION_TABLE +%endif + +%assign rc_val 1 + + do_name _aes_encrypt_key256,8 + + mov ax, sp + movzx esp, ax + + push ebp + push ebx + push esi + push edi + + movzx ebp, word [esp+20] ; ks + mov [ebp+4*KS_LENGTH],dword 14 * 16 + movzx ebx, word [esp+18] ; key + + mov esi,[ebx] + mov [ebp],esi + mov edi,[ebx+4] + mov [ebp+4],edi + mov ecx,[ebx+8] + mov [ebp+8],ecx + mov edx,[ebx+12] + mov [ebp+12],edx + mov eax,[ebx+16] + mov [ebp+16],eax + mov eax,[ebx+20] + mov [ebp+20],eax + mov eax,[ebx+24] + mov [ebp+24],eax + mov eax,[ebx+28] + mov [ebp+28],eax + add ebp,32 + + f_key 0,32 ; 15 * 4 = 60 unsigned longs + f_key 1,32 ; 8 + 8 * 7 generated = 64 + f_key 2,32 + f_key 3,32 + f_key 4,32 + f_key 5,32 + f_key 6,32 + + pop edi + pop esi + pop ebx + pop ebp + xor eax,eax + do_exit 8 + +%endif + +%ifdef AES_VAR + +%ifndef ENCRYPTION_TABLE +; %define ENCRYPTION_TABLE +%endif + + do_name _aes_encrypt_key,12 + + mov ecx,[esp+4] + mov eax,[esp+8] + mov edx,[esp+12] + push edx + push ecx + + cmp eax,16 + je .1 + cmp eax,128 + je .1 + + cmp eax,24 + je .2 + cmp eax,192 + je .2 + + cmp eax,32 + je .3 + cmp eax,256 + je .3 + mov eax,-1 + add esp,8 + do_exit 12 + +.1: do_call _aes_encrypt_key128,8 + do_exit 12 +.2: do_call _aes_encrypt_key192,8 + do_exit 12 +.3: do_call _aes_encrypt_key256,8 + do_exit 12 + +%endif + +%endif + +%ifdef ENCRYPTION_TABLE + +; S-box data - 256 entries + + section _DATA + +%define u8(x) 0, x, x, f3(x), f2(x), x, x, f3(x) + +_aes_enc_tab: + db u8(0x63),u8(0x7c),u8(0x77),u8(0x7b),u8(0xf2),u8(0x6b),u8(0x6f),u8(0xc5) + db u8(0x30),u8(0x01),u8(0x67),u8(0x2b),u8(0xfe),u8(0xd7),u8(0xab),u8(0x76) + db u8(0xca),u8(0x82),u8(0xc9),u8(0x7d),u8(0xfa),u8(0x59),u8(0x47),u8(0xf0) + db u8(0xad),u8(0xd4),u8(0xa2),u8(0xaf),u8(0x9c),u8(0xa4),u8(0x72),u8(0xc0) + db u8(0xb7),u8(0xfd),u8(0x93),u8(0x26),u8(0x36),u8(0x3f),u8(0xf7),u8(0xcc) + db u8(0x34),u8(0xa5),u8(0xe5),u8(0xf1),u8(0x71),u8(0xd8),u8(0x31),u8(0x15) + db u8(0x04),u8(0xc7),u8(0x23),u8(0xc3),u8(0x18),u8(0x96),u8(0x05),u8(0x9a) + db u8(0x07),u8(0x12),u8(0x80),u8(0xe2),u8(0xeb),u8(0x27),u8(0xb2),u8(0x75) + db u8(0x09),u8(0x83),u8(0x2c),u8(0x1a),u8(0x1b),u8(0x6e),u8(0x5a),u8(0xa0) + db u8(0x52),u8(0x3b),u8(0xd6),u8(0xb3),u8(0x29),u8(0xe3),u8(0x2f),u8(0x84) + db u8(0x53),u8(0xd1),u8(0x00),u8(0xed),u8(0x20),u8(0xfc),u8(0xb1),u8(0x5b) + db u8(0x6a),u8(0xcb),u8(0xbe),u8(0x39),u8(0x4a),u8(0x4c),u8(0x58),u8(0xcf) + db u8(0xd0),u8(0xef),u8(0xaa),u8(0xfb),u8(0x43),u8(0x4d),u8(0x33),u8(0x85) + db u8(0x45),u8(0xf9),u8(0x02),u8(0x7f),u8(0x50),u8(0x3c),u8(0x9f),u8(0xa8) + db u8(0x51),u8(0xa3),u8(0x40),u8(0x8f),u8(0x92),u8(0x9d),u8(0x38),u8(0xf5) + db u8(0xbc),u8(0xb6),u8(0xda),u8(0x21),u8(0x10),u8(0xff),u8(0xf3),u8(0xd2) + db u8(0xcd),u8(0x0c),u8(0x13),u8(0xec),u8(0x5f),u8(0x97),u8(0x44),u8(0x17) + db u8(0xc4),u8(0xa7),u8(0x7e),u8(0x3d),u8(0x64),u8(0x5d),u8(0x19),u8(0x73) + db u8(0x60),u8(0x81),u8(0x4f),u8(0xdc),u8(0x22),u8(0x2a),u8(0x90),u8(0x88) + db u8(0x46),u8(0xee),u8(0xb8),u8(0x14),u8(0xde),u8(0x5e),u8(0x0b),u8(0xdb) + db u8(0xe0),u8(0x32),u8(0x3a),u8(0x0a),u8(0x49),u8(0x06),u8(0x24),u8(0x5c) + db u8(0xc2),u8(0xd3),u8(0xac),u8(0x62),u8(0x91),u8(0x95),u8(0xe4),u8(0x79) + db u8(0xe7),u8(0xc8),u8(0x37),u8(0x6d),u8(0x8d),u8(0xd5),u8(0x4e),u8(0xa9) + db u8(0x6c),u8(0x56),u8(0xf4),u8(0xea),u8(0x65),u8(0x7a),u8(0xae),u8(0x08) + db u8(0xba),u8(0x78),u8(0x25),u8(0x2e),u8(0x1c),u8(0xa6),u8(0xb4),u8(0xc6) + db u8(0xe8),u8(0xdd),u8(0x74),u8(0x1f),u8(0x4b),u8(0xbd),u8(0x8b),u8(0x8a) + db u8(0x70),u8(0x3e),u8(0xb5),u8(0x66),u8(0x48),u8(0x03),u8(0xf6),u8(0x0e) + db u8(0x61),u8(0x35),u8(0x57),u8(0xb9),u8(0x86),u8(0xc1),u8(0x1d),u8(0x9e) + db u8(0xe1),u8(0xf8),u8(0x98),u8(0x11),u8(0x69),u8(0xd9),u8(0x8e),u8(0x94) + db u8(0x9b),u8(0x1e),u8(0x87),u8(0xe9),u8(0xce),u8(0x55),u8(0x28),u8(0xdf) + db u8(0x8c),u8(0xa1),u8(0x89),u8(0x0d),u8(0xbf),u8(0xe6),u8(0x42),u8(0x68) + db u8(0x41),u8(0x99),u8(0x2d),u8(0x0f),u8(0xb0),u8(0x54),u8(0xbb),u8(0x16) + +%endif + +%ifdef DECRYPTION + +; %define DECRYPTION_TABLE + +%define dtab_0(x) [_aes_dec_tab+ 8*x] +%define dtab_1(x) [_aes_dec_tab+3+8*x] +%define dtab_2(x) [_aes_dec_tab+2+8*x] +%define dtab_3(x) [_aes_dec_tab+1+8*x] +%define dtab_x(x) byte [_aes_dec_tab+7+8*x] + +%macro irn_fun 2 + + rol eax,16 + %1 esi, cl, 0, ebp + %1 esi, bh, 1, ebp + %1 esi, al, 2, ebp + %1 edi, dl, 0, ebp + %1 edi, ch, 1, ebp + %1 edi, ah, 3, ebp + %2 ebp, bl, 0, ebp + shr eax,16 + and ebx,0xffff0000 + or ebx,eax + shr ecx,16 + %1 ebp, bh, 1, eax + %1 ebp, ch, 3, eax + %2 eax, cl, 2, ecx + %1 eax, bl, 0, ecx + %1 eax, dh, 1, ecx + shr ebx,16 + shr edx,16 + %1 esi, dh, 3, ecx + %1 ebp, dl, 2, ecx + %1 eax, bh, 3, ecx + %1 edi, bl, 2, ecx + +%endmacro + +; Basic MOV and XOR Operations for normal rounds + +%macro ni_xor 4 + movzx %4,%2 + xor %1,dtab_%3(%4) +%endmacro + +%macro ni_mov 4 + movzx %4,%2 + mov %1,dtab_%3(%4) +%endmacro + +; Basic MOV and XOR Operations for last round + +%macro li_xor 4 + movzx %4,%2 + movzx %4,dtab_x(%4) +%if %3 != 0 + shl %4,8*%3 +%endif + xor %1,%4 +%endmacro + +%macro li_mov 4 + movzx %4,%2 + movzx %1,dtab_x(%4) +%if %3 != 0 + shl %1,8*%3 +%endif +%endmacro + +%ifdef REDUCE_CODE_SIZE + +dec_round: + sub sp, 2 +%ifdef AES_REV_DKS + add ebp,16 +%else + sub ebp,16 +%endif + save 1,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + irn_fun ni_xor, ni_mov + + mov ebx,ebp + mov ecx,esi + mov edx,edi + restore ebp,1 + xor eax,[ebp] + xor ebx,[ebp+4] + add sp, 2 + ret + +%else + +%macro dec_round 0 + +%ifdef AES_REV_DKS + add ebp,16 +%else + sub ebp,16 +%endif + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + irn_fun ni_xor, ni_mov + + mov ebx,ebp + mov ecx,esi + mov edx,edi + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + +%endif + +%macro dec_last_round 0 + +%ifdef AES_REV_DKS + add ebp,16 +%else + sub ebp,16 +%endif + save 0,ebp + mov esi,[ebp+8] + mov edi,[ebp+12] + + irn_fun li_xor, li_mov + + mov ebx,ebp + restore ebp,0 + xor eax,[ebp] + xor ebx,[ebp+4] + +%endmacro + + section _TEXT + +; AES Decryption Subroutine + + do_name _aes_decrypt,12 + + mov ax, sp + movzx esp, ax + + sub esp,stk_spc + mov [esp+16],ebp + mov [esp+12],ebx + mov [esp+ 8],esi + mov [esp+ 4],edi + +; input four columns and xor in first round key + + movzx esi,word [esp+in_blk+stk_spc] ; input pointer + mov eax,[esi ] + mov ebx,[esi+ 4] + mov ecx,[esi+ 8] + mov edx,[esi+12] + lea esi,[esi+16] + + movzx ebp, word [esp+ctx+stk_spc] ; key pointer + movzx edi,byte[ebp+4*KS_LENGTH] +%ifndef AES_REV_DKS ; if decryption key schedule is not reversed + lea ebp,[ebp+edi] ; we have to access it from the top down +%endif + xor eax,[ebp ] ; key schedule + xor ebx,[ebp+ 4] + xor ecx,[ebp+ 8] + xor edx,[ebp+12] + +; determine the number of rounds + +%ifndef AES_256 + cmp edi,10*16 + je .3 + cmp edi,12*16 + je .2 + cmp edi,14*16 + je .1 + mov eax,-1 + jmp .5 +%endif + +.1: mf_call dec_round + mf_call dec_round +.2: mf_call dec_round + mf_call dec_round +.3: mf_call dec_round + mf_call dec_round + mf_call dec_round + mf_call dec_round + mf_call dec_round + mf_call dec_round + mf_call dec_round + mf_call dec_round + mf_call dec_round + dec_last_round + +; move final values to the output array. + + movzx ebp,word [esp+out_blk+stk_spc] + mov [ebp],eax + mov [ebp+4],ebx + mov [ebp+8],esi + mov [ebp+12],edi + xor eax,eax + +.5: mov ebp,[esp+16] + mov ebx,[esp+12] + mov esi,[esp+ 8] + mov edi,[esp+ 4] + add esp,stk_spc + do_exit 12 + +%endif + +%ifdef REDUCE_CODE_SIZE + +inv_mix_col: + movzx ecx,dl ; input eax, edx + movzx ecx,etab_b(ecx) ; output eax + mov eax,dtab_0(ecx) ; used ecx + movzx ecx,dh + shr edx,16 + movzx ecx,etab_b(ecx) + xor eax,dtab_1(ecx) + movzx ecx,dl + movzx ecx,etab_b(ecx) + xor eax,dtab_2(ecx) + movzx ecx,dh + movzx ecx,etab_b(ecx) + xor eax,dtab_3(ecx) + ret + +%else + +%macro inv_mix_col 0 + + movzx ecx,dl ; input eax, edx + movzx ecx,etab_b(ecx) ; output eax + mov eax,dtab_0(ecx) ; used ecx + movzx ecx,dh + shr edx,16 + movzx ecx,etab_b(ecx) + xor eax,dtab_1(ecx) + movzx ecx,dl + movzx ecx,etab_b(ecx) + xor eax,dtab_2(ecx) + movzx ecx,dh + movzx ecx,etab_b(ecx) + xor eax,dtab_3(ecx) + +%endmacro + +%endif + +%ifdef DECRYPTION_KEY_SCHEDULE + +%ifdef AES_128 + +%ifndef DECRYPTION_TABLE +; %define DECRYPTION_TABLE +%endif + + do_name _aes_decrypt_key128,8 + + push ebp + push ebx + push esi + push edi + mov eax,[esp+24] ; context + mov edx,[esp+20] ; key + push eax + push edx + do_call _aes_encrypt_key128,8 ; generate expanded encryption key + mov eax,10*16 + mov esi,[esp+24] ; pointer to first round key + lea edi,[esi+eax] ; pointer to last round key + add esi,32 + ; the inverse mix column transformation + mov edx,[esi-16] ; needs to be applied to all round keys + mf_call inv_mix_col ; except first and last. Hence start by + mov [esi-16],eax ; transforming the four sub-keys in the + mov edx,[esi-12] ; second round key + mf_call inv_mix_col + mov [esi-12],eax ; transformations for subsequent rounds + mov edx,[esi-8] ; can then be made more efficient by + mf_call inv_mix_col ; noting that for three of the four sub-keys + mov [esi-8],eax ; in the encryption round key ek[r]: + mov edx,[esi-4] ; + mf_call inv_mix_col ; ek[r][n] = ek[r][n-1] ^ ek[r-1][n] + mov [esi-4],eax ; + ; where n is 1..3. Hence the corresponding +.0: mov edx,[esi] ; subkeys in the decryption round key dk[r] + mf_call inv_mix_col ; also obey since inv_mix_col is linear in + mov [esi],eax ; GF(256): + xor eax,[esi-12] ; + mov [esi+4],eax ; dk[r][n] = dk[r][n-1] ^ dk[r-1][n] + xor eax,[esi-8] ; + mov [esi+8],eax ; So we only need one inverse mix column + xor eax,[esi-4] ; operation (n = 0) for each four word cycle + mov [esi+12],eax ; in the expanded key. + add esi,16 + cmp edi,esi + jg .0 + jmp dec_end + +%endif + +%ifdef AES_192 + +%ifndef DECRYPTION_TABLE +; %define DECRYPTION_TABLE +%endif + + do_name _aes_decrypt_key192,8 + + push ebp + push ebx + push esi + push edi + mov eax,[esp+24] ; context + mov edx,[esp+20] ; key + push eax + push edx + do_call _aes_encrypt_key192,8 ; generate expanded encryption key + mov eax,12*16 + mov esi,[esp+24] ; first round key + lea edi,[esi+eax] ; last round key + add esi,48 ; the first 6 words are the key, of + ; which the top 2 words are part of + mov edx,[esi-32] ; the second round key and hence + mf_call inv_mix_col ; need to be modified. After this we + mov [esi-32],eax ; need to do a further six values prior + mov edx,[esi-28] ; to using a more efficient technique + mf_call inv_mix_col ; based on: + mov [esi-28],eax ; + ; dk[r][n] = dk[r][n-1] ^ dk[r-1][n] + mov edx,[esi-24] ; + mf_call inv_mix_col ; for n = 1 .. 5 where the key expansion + mov [esi-24],eax ; cycle is now 6 words long + mov edx,[esi-20] + mf_call inv_mix_col + mov [esi-20],eax + mov edx,[esi-16] + mf_call inv_mix_col + mov [esi-16],eax + mov edx,[esi-12] + mf_call inv_mix_col + mov [esi-12],eax + mov edx,[esi-8] + mf_call inv_mix_col + mov [esi-8],eax + mov edx,[esi-4] + mf_call inv_mix_col + mov [esi-4],eax + +.0: mov edx,[esi] ; the expanded key is 13 * 4 = 44 32-bit words + mf_call inv_mix_col ; of which 11 * 4 = 44 have to be modified + mov [esi],eax ; using inv_mix_col. We have already done 8 + xor eax,[esi-20] ; of these so 36 are left - hence we need + mov [esi+4],eax ; exactly 6 loops of six here + xor eax,[esi-16] + mov [esi+8],eax + xor eax,[esi-12] + mov [esi+12],eax + xor eax,[esi-8] + mov [esi+16],eax + xor eax,[esi-4] + mov [esi+20],eax + add esi,24 + cmp edi,esi + jg .0 + jmp dec_end + +%endif + +%ifdef AES_256 + +%ifndef DECRYPTION_TABLE +; %define DECRYPTION_TABLE +%endif + + do_name _aes_decrypt_key256,8 + + mov ax, sp + movzx esp, ax + push ebp + push ebx + push esi + push edi + + movzx eax, word [esp+20] ; ks + movzx edx, word [esp+18] ; key + push ax + push dx + do_call _aes_encrypt_key256,4 ; generate expanded encryption key + mov eax,14*16 + movzx esi, word [esp+20] ; ks + lea edi,[esi+eax] + add esi,64 + + mov edx,[esi-48] ; the primary key is 8 words, of which + mf_call inv_mix_col ; the top four require modification + mov [esi-48],eax + mov edx,[esi-44] + mf_call inv_mix_col + mov [esi-44],eax + mov edx,[esi-40] + mf_call inv_mix_col + mov [esi-40],eax + mov edx,[esi-36] + mf_call inv_mix_col + mov [esi-36],eax + + mov edx,[esi-32] ; the encryption key expansion cycle is + mf_call inv_mix_col ; now eight words long so we need to + mov [esi-32],eax ; start by doing one complete block + mov edx,[esi-28] + mf_call inv_mix_col + mov [esi-28],eax + mov edx,[esi-24] + mf_call inv_mix_col + mov [esi-24],eax + mov edx,[esi-20] + mf_call inv_mix_col + mov [esi-20],eax + mov edx,[esi-16] + mf_call inv_mix_col + mov [esi-16],eax + mov edx,[esi-12] + mf_call inv_mix_col + mov [esi-12],eax + mov edx,[esi-8] + mf_call inv_mix_col + mov [esi-8],eax + mov edx,[esi-4] + mf_call inv_mix_col + mov [esi-4],eax + +.0: mov edx,[esi] ; we can now speed up the remaining + mf_call inv_mix_col ; rounds by using the technique + mov [esi],eax ; outlined earlier. But note that + xor eax,[esi-28] ; there is one extra inverse mix + mov [esi+4],eax ; column operation as the 256 bit + xor eax,[esi-24] ; key has an extra non-linear step + mov [esi+8],eax ; for the midway element. + xor eax,[esi-20] + mov [esi+12],eax ; the expanded key is 15 * 4 = 60 + mov edx,[esi+16] ; 32-bit words of which 52 need to + mf_call inv_mix_col ; be modified. We have already done + mov [esi+16],eax ; 12 so 40 are left - which means + xor eax,[esi-12] ; that we need exactly 5 loops of 8 + mov [esi+20],eax + xor eax,[esi-8] + mov [esi+24],eax + xor eax,[esi-4] + mov [esi+28],eax + add esi,32 + cmp edi,esi + jg .0 + +%endif + +dec_end: + +%ifdef AES_REV_DKS + + movzx esi,word [esp+20] ; this reverses the order of the +.1: mov eax,[esi] ; round keys if required + mov ebx,[esi+4] + mov ebp,[edi] + mov edx,[edi+4] + mov [esi],ebp + mov [esi+4],edx + mov [edi],eax + mov [edi+4],ebx + + mov eax,[esi+8] + mov ebx,[esi+12] + mov ebp,[edi+8] + mov edx,[edi+12] + mov [esi+8],ebp + mov [esi+12],edx + mov [edi+8],eax + mov [edi+12],ebx + + add esi,16 + sub edi,16 + cmp edi,esi + jg .1 + +%endif + + pop edi + pop esi + pop ebx + pop ebp + xor eax,eax + do_exit 8 + +%ifdef AES_VAR + + do_name _aes_decrypt_key,12 + + mov ecx,[esp+4] + mov eax,[esp+8] + mov edx,[esp+12] + push edx + push ecx + + cmp eax,16 + je .1 + cmp eax,128 + je .1 + + cmp eax,24 + je .2 + cmp eax,192 + je .2 + + cmp eax,32 + je .3 + cmp eax,256 + je .3 + mov eax,-1 + add esp,8 + do_exit 12 + +.1: do_call _aes_decrypt_key128,8 + do_exit 12 +.2: do_call _aes_decrypt_key192,8 + do_exit 12 +.3: do_call _aes_decrypt_key256,8 + do_exit 12 + +%endif + +%endif + +%ifdef DECRYPTION_TABLE + +; Inverse S-box data - 256 entries + + section _DATA + +%define v8(x) fe(x), f9(x), fd(x), fb(x), fe(x), f9(x), fd(x), x + +_aes_dec_tab: + db v8(0x52),v8(0x09),v8(0x6a),v8(0xd5),v8(0x30),v8(0x36),v8(0xa5),v8(0x38) + db v8(0xbf),v8(0x40),v8(0xa3),v8(0x9e),v8(0x81),v8(0xf3),v8(0xd7),v8(0xfb) + db v8(0x7c),v8(0xe3),v8(0x39),v8(0x82),v8(0x9b),v8(0x2f),v8(0xff),v8(0x87) + db v8(0x34),v8(0x8e),v8(0x43),v8(0x44),v8(0xc4),v8(0xde),v8(0xe9),v8(0xcb) + db v8(0x54),v8(0x7b),v8(0x94),v8(0x32),v8(0xa6),v8(0xc2),v8(0x23),v8(0x3d) + db v8(0xee),v8(0x4c),v8(0x95),v8(0x0b),v8(0x42),v8(0xfa),v8(0xc3),v8(0x4e) + db v8(0x08),v8(0x2e),v8(0xa1),v8(0x66),v8(0x28),v8(0xd9),v8(0x24),v8(0xb2) + db v8(0x76),v8(0x5b),v8(0xa2),v8(0x49),v8(0x6d),v8(0x8b),v8(0xd1),v8(0x25) + db v8(0x72),v8(0xf8),v8(0xf6),v8(0x64),v8(0x86),v8(0x68),v8(0x98),v8(0x16) + db v8(0xd4),v8(0xa4),v8(0x5c),v8(0xcc),v8(0x5d),v8(0x65),v8(0xb6),v8(0x92) + db v8(0x6c),v8(0x70),v8(0x48),v8(0x50),v8(0xfd),v8(0xed),v8(0xb9),v8(0xda) + db v8(0x5e),v8(0x15),v8(0x46),v8(0x57),v8(0xa7),v8(0x8d),v8(0x9d),v8(0x84) + db v8(0x90),v8(0xd8),v8(0xab),v8(0x00),v8(0x8c),v8(0xbc),v8(0xd3),v8(0x0a) + db v8(0xf7),v8(0xe4),v8(0x58),v8(0x05),v8(0xb8),v8(0xb3),v8(0x45),v8(0x06) + db v8(0xd0),v8(0x2c),v8(0x1e),v8(0x8f),v8(0xca),v8(0x3f),v8(0x0f),v8(0x02) + db v8(0xc1),v8(0xaf),v8(0xbd),v8(0x03),v8(0x01),v8(0x13),v8(0x8a),v8(0x6b) + db v8(0x3a),v8(0x91),v8(0x11),v8(0x41),v8(0x4f),v8(0x67),v8(0xdc),v8(0xea) + db v8(0x97),v8(0xf2),v8(0xcf),v8(0xce),v8(0xf0),v8(0xb4),v8(0xe6),v8(0x73) + db v8(0x96),v8(0xac),v8(0x74),v8(0x22),v8(0xe7),v8(0xad),v8(0x35),v8(0x85) + db v8(0xe2),v8(0xf9),v8(0x37),v8(0xe8),v8(0x1c),v8(0x75),v8(0xdf),v8(0x6e) + db v8(0x47),v8(0xf1),v8(0x1a),v8(0x71),v8(0x1d),v8(0x29),v8(0xc5),v8(0x89) + db v8(0x6f),v8(0xb7),v8(0x62),v8(0x0e),v8(0xaa),v8(0x18),v8(0xbe),v8(0x1b) + db v8(0xfc),v8(0x56),v8(0x3e),v8(0x4b),v8(0xc6),v8(0xd2),v8(0x79),v8(0x20) + db v8(0x9a),v8(0xdb),v8(0xc0),v8(0xfe),v8(0x78),v8(0xcd),v8(0x5a),v8(0xf4) + db v8(0x1f),v8(0xdd),v8(0xa8),v8(0x33),v8(0x88),v8(0x07),v8(0xc7),v8(0x31) + db v8(0xb1),v8(0x12),v8(0x10),v8(0x59),v8(0x27),v8(0x80),v8(0xec),v8(0x5f) + db v8(0x60),v8(0x51),v8(0x7f),v8(0xa9),v8(0x19),v8(0xb5),v8(0x4a),v8(0x0d) + db v8(0x2d),v8(0xe5),v8(0x7a),v8(0x9f),v8(0x93),v8(0xc9),v8(0x9c),v8(0xef) + db v8(0xa0),v8(0xe0),v8(0x3b),v8(0x4d),v8(0xae),v8(0x2a),v8(0xf5),v8(0xb0) + db v8(0xc8),v8(0xeb),v8(0xbb),v8(0x3c),v8(0x83),v8(0x53),v8(0x99),v8(0x61) + db v8(0x17),v8(0x2b),v8(0x04),v8(0x7e),v8(0xba),v8(0x77),v8(0xd6),v8(0x26) + db v8(0xe1),v8(0x69),v8(0x14),v8(0x63),v8(0x55),v8(0x21),v8(0x0c),v8(0x7d) + +%endif diff --git a/src/utils/crypto/aestab.c b/src/utils/crypto/aestab.c new file mode 100644 index 00000000000..07102a978c5 --- /dev/null +++ b/src/utils/crypto/aestab.c @@ -0,0 +1,427 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 +*/ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation: + - Added run-time table generator for Aes_x86_v2.asm +*/ + +#define DO_TABLES + +#include "aes.h" +#include "aesopt.h" + +#if defined(FIXED_TABLES) + +#define sb_data(w) {\ + w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\ + w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\ + w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\ + w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\ + w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\ + w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\ + w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\ + w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\ + w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\ + w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\ + w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\ + w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\ + w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\ + w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\ + w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\ + w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\ + w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\ + w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\ + w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\ + w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\ + w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\ + w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\ + w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\ + w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\ + w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\ + w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\ + w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\ + w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\ + w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\ + w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\ + w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\ + w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16) } + +#define isb_data(w) {\ + w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\ + w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\ + w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\ + w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\ + w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\ + w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\ + w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\ + w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\ + w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\ + w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\ + w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\ + w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\ + w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\ + w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\ + w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\ + w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\ + w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\ + w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\ + w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\ + w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\ + w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\ + w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\ + w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\ + w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\ + w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\ + w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\ + w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\ + w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\ + w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\ + w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\ + w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\ + w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d) } + +#define mm_data(w) {\ + w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\ + w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\ + w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\ + w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\ + w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\ + w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\ + w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\ + w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\ + w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\ + w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\ + w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\ + w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\ + w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\ + w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\ + w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\ + w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\ + w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\ + w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\ + w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\ + w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\ + w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\ + w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\ + w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\ + w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\ + w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\ + w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\ + w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\ + w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\ + w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\ + w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\ + w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\ + w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff) } + +#define rc_data(w) {\ + w(0x01), w(0x02), w(0x04), w(0x08), w(0x10),w(0x20), w(0x40), w(0x80),\ + w(0x1b), w(0x36) } + +#define h0(x) (x) + +#define w0(p) bytes2word(p, 0, 0, 0) +#define w1(p) bytes2word(0, p, 0, 0) +#define w2(p) bytes2word(0, 0, p, 0) +#define w3(p) bytes2word(0, 0, 0, p) + +#define u0(p) bytes2word(f2(p), p, p, f3(p)) +#define u1(p) bytes2word(f3(p), f2(p), p, p) +#define u2(p) bytes2word(p, f3(p), f2(p), p) +#define u3(p) bytes2word(p, p, f3(p), f2(p)) + +#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p)) +#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p)) +#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p)) +#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p)) + +#endif + +#if defined(FIXED_TABLES) || !defined(FF_TABLES) + +#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) +#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) +#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ + ^ (((x>>5) & 4) * WPOLY)) +#define f3(x) (f2(x) ^ x) +#define f9(x) (f8(x) ^ x) +#define fb(x) (f8(x) ^ f2(x) ^ x) +#define fd(x) (f8(x) ^ f4(x) ^ x) +#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) + +#else + +#define f2(x) ((x) ? pow[log[x] + 0x19] : 0) +#define f3(x) ((x) ? pow[log[x] + 0x01] : 0) +#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0) +#define fb(x) ((x) ? pow[log[x] + 0x68] : 0) +#define fd(x) ((x) ? pow[log[x] + 0xee] : 0) +#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0) +#define fi(x) ((x) ? pow[ 255 - log[x]] : 0) + +#endif + +#include "aestab.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#if defined(FIXED_TABLES) + +/* implemented in case of wrong call for fixed tables */ + +AES_RETURN aes_init(void) +{ + return EXIT_SUCCESS; +} + +#else /* dynamic table generation */ + +#if !defined(FF_TABLES) + +/* Generate the tables for the dynamic table option + + It will generally be sensible to use tables to compute finite + field multiplies and inverses but where memory is scarse this + code might sometimes be better. But it only has effect during + initialisation so its pretty unimportant in overall terms. +*/ + +/* return 2 ^ (n - 1) where n is the bit number of the highest bit + set in x with x in the range 1 < x < 0x00000200. This form is + used so that locals within fi can be bytes rather than words +*/ + +static uint_8t hibit(const uint_32t x) +{ uint_8t r = (uint_8t)((x >> 1) | (x >> 2)); + + r |= (r >> 2); + r |= (r >> 4); + return (r + 1) >> 1; +} + +/* return the inverse of the finite field element x */ + +static uint_8t fi(const uint_8t x) +{ uint_8t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0; + + if(x < 2) return x; + + for(;;) + { + if(!n1) return v1; + + while(n2 >= n1) + { + n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2); + } + + if(!n2) return v2; + + while(n1 >= n2) + { + n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1); + } + } +} + +#endif + +/* The forward and inverse affine transformations used in the S-box */ + +#define fwd_affine(x) \ + (w = (uint_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(uint_8t)(w^(w>>8))) + +#define inv_affine(x) \ + (w = (uint_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(uint_8t)(w^(w>>8))) + +static int init = 0; + +#ifdef TC_WINDOWS_BOOT + +#pragma optimize ("l", on) +uint_8t aes_enc_tab[256][8]; +uint_8t aes_dec_tab[256][8]; + +#endif + +AES_RETURN aes_init(void) +{ uint_32t i, w; + +#ifdef TC_WINDOWS_BOOT + + if (init) + return EXIT_SUCCESS; + + for (i = 0; i < 256; ++i) + { + uint_8t x = fwd_affine(fi((uint_8t)i)); + aes_enc_tab[i][0] = 0; + aes_enc_tab[i][1] = x; + aes_enc_tab[i][2] = x; + aes_enc_tab[i][3] = f3(x); + aes_enc_tab[i][4] = f2(x); + aes_enc_tab[i][5] = x; + aes_enc_tab[i][6] = x; + aes_enc_tab[i][7] = f3(x); + + x = fi((uint_8t)inv_affine((uint_8t)i)); + aes_dec_tab[i][0] = fe(x); + aes_dec_tab[i][1] = f9(x); + aes_dec_tab[i][2] = fd(x); + aes_dec_tab[i][3] = fb(x); + aes_dec_tab[i][4] = fe(x); + aes_dec_tab[i][5] = f9(x); + aes_dec_tab[i][6] = fd(x); + aes_dec_tab[i][7] = x; + } + +#else // TC_WINDOWS_BOOT + +#if defined(FF_TABLES) + + uint_8t pow[512], log[256]; + + if(init) + return EXIT_SUCCESS; + /* log and power tables for GF(2^8) finite field with + WPOLY as modular polynomial - the simplest primitive + root is 0x03, used here to generate the tables + */ + + i = 0; w = 1; + do + { + pow[i] = (uint_8t)w; + pow[i + 255] = (uint_8t)w; + log[w] = (uint_8t)i++; + w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0); + } + while (w != 1); + +#else + if(init) + return EXIT_SUCCESS; +#endif + + for(i = 0, w = 1; i < RC_LENGTH; ++i) + { + t_set(r,c)[i] = bytes2word(w, 0, 0, 0); + w = f2(w); + } + + for(i = 0; i < 256; ++i) + { uint_8t b; + + b = fwd_affine(fi((uint_8t)i)); + w = bytes2word(f2(b), b, b, f3(b)); + +#if defined( SBX_SET ) + t_set(s,box)[i] = b; +#endif + +#if defined( FT1_SET ) /* tables for a normal encryption round */ + t_set(f,n)[i] = w; +#endif +#if defined( FT4_SET ) + t_set(f,n)[0][i] = w; + t_set(f,n)[1][i] = upr(w,1); + t_set(f,n)[2][i] = upr(w,2); + t_set(f,n)[3][i] = upr(w,3); +#endif + w = bytes2word(b, 0, 0, 0); + +#if defined( FL1_SET ) /* tables for last encryption round (may also */ + t_set(f,l)[i] = w; /* be used in the key schedule) */ +#endif +#if defined( FL4_SET ) + t_set(f,l)[0][i] = w; + t_set(f,l)[1][i] = upr(w,1); + t_set(f,l)[2][i] = upr(w,2); + t_set(f,l)[3][i] = upr(w,3); +#endif + +#if defined( LS1_SET ) /* table for key schedule if t_set(f,l) above is*/ + t_set(l,s)[i] = w; /* not of the required form */ +#endif +#if defined( LS4_SET ) + t_set(l,s)[0][i] = w; + t_set(l,s)[1][i] = upr(w,1); + t_set(l,s)[2][i] = upr(w,2); + t_set(l,s)[3][i] = upr(w,3); +#endif + + b = fi(inv_affine((uint_8t)i)); + w = bytes2word(fe(b), f9(b), fd(b), fb(b)); + +#if defined( IM1_SET ) /* tables for the inverse mix column operation */ + t_set(i,m)[b] = w; +#endif +#if defined( IM4_SET ) + t_set(i,m)[0][b] = w; + t_set(i,m)[1][b] = upr(w,1); + t_set(i,m)[2][b] = upr(w,2); + t_set(i,m)[3][b] = upr(w,3); +#endif + +#if defined( ISB_SET ) + t_set(i,box)[i] = b; +#endif +#if defined( IT1_SET ) /* tables for a normal decryption round */ + t_set(i,n)[i] = w; +#endif +#if defined( IT4_SET ) + t_set(i,n)[0][i] = w; + t_set(i,n)[1][i] = upr(w,1); + t_set(i,n)[2][i] = upr(w,2); + t_set(i,n)[3][i] = upr(w,3); +#endif + w = bytes2word(b, 0, 0, 0); +#if defined( IL1_SET ) /* tables for last decryption round */ + t_set(i,l)[i] = w; +#endif +#if defined( IL4_SET ) + t_set(i,l)[0][i] = w; + t_set(i,l)[1][i] = upr(w,1); + t_set(i,l)[2][i] = upr(w,2); + t_set(i,l)[3][i] = upr(w,3); +#endif + } + +#endif // TC_WINDOWS_BOOT + + init = 1; + return EXIT_SUCCESS; +} + +#endif + +#if defined(__cplusplus) +} +#endif diff --git a/src/utils/crypto/aestab.h b/src/utils/crypto/aestab.h new file mode 100644 index 00000000000..e52e0057d8a --- /dev/null +++ b/src/utils/crypto/aestab.h @@ -0,0 +1,174 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 20/12/2007 + + This file contains the code for declaring the tables needed to implement + AES. The file aesopt.h is assumed to be included before this header file. + If there are no global variables, the definitions here can be used to put + the AES tables in a structure so that a pointer can then be added to the + AES context to pass them to the AES routines that need them. If this + facility is used, the calling program has to ensure that this pointer is + managed appropriately. In particular, the value of the t_dec(in,it) item + in the table structure must be set to zero in order to ensure that the + tables are initialised. In practice the three code sequences in aeskey.c + that control the calls to aes_init() and the aes_init() routine itself will + have to be changed for a specific implementation. If global variables are + available it will generally be preferable to use them with the precomputed + FIXED_TABLES option that uses static global tables. + + The following defines can be used to control the way the tables + are defined, initialised and used in embedded environments that + require special features for these purposes + + the 't_dec' construction is used to declare fixed table arrays + the 't_set' construction is used to set fixed table values + the 't_use' construction is used to access fixed table values + + 256 byte tables: + + t_xxx(s,box) => forward S box + t_xxx(i,box) => inverse S box + + 256 32-bit word OR 4 x 256 32-bit word tables: + + t_xxx(f,n) => forward normal round + t_xxx(f,l) => forward last round + t_xxx(i,n) => inverse normal round + t_xxx(i,l) => inverse last round + t_xxx(l,s) => key schedule table + t_xxx(i,m) => key schedule table + + Other variables and tables: + + t_xxx(r,c) => the rcon table +*/ + +#if !defined( _AESTAB_H ) +#define _AESTAB_H + +#define t_dec(m,n) t_##m##n +#define t_set(m,n) t_##m##n +#define t_use(m,n) t_##m##n + +#if defined(FIXED_TABLES) +# if !defined( __GNUC__ ) && (defined( __MSDOS__ ) || defined( __WIN16__ )) +/* make tables far data to avoid using too much DGROUP space (PG) */ +# define CONST const far +# else +# define CONST const +# endif +#else +# define CONST +#endif + +#if defined(__cplusplus) +# define EXTERN extern "C" +#elif defined(DO_TABLES) +# define EXTERN +#else +# define EXTERN extern +#endif + +#if defined(_MSC_VER) && defined(TABLE_ALIGN) +#define ALIGN __declspec(align(TABLE_ALIGN)) +#else +#define ALIGN +#endif + +#if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 ) +# define XP_DIR __cdecl +#else +# define XP_DIR +#endif + +#if defined(DO_TABLES) && defined(FIXED_TABLES) +#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] = b(e) +#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) } +EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH] = rc_data(w0); +#else +#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] +#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] +EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH]; +#endif + +#if defined( SBX_SET ) + d_1(uint_8t, t_dec(s,box), sb_data, h0); +#endif +#if defined( ISB_SET ) + d_1(uint_8t, t_dec(i,box), isb_data, h0); +#endif + +#if defined( FT1_SET ) + d_1(uint_32t, t_dec(f,n), sb_data, u0); +#endif +#if defined( FT4_SET ) + d_4(uint_32t, t_dec(f,n), sb_data, u0, u1, u2, u3); +#endif + +#if defined( FL1_SET ) + d_1(uint_32t, t_dec(f,l), sb_data, w0); +#endif +#if defined( FL4_SET ) + d_4(uint_32t, t_dec(f,l), sb_data, w0, w1, w2, w3); +#endif + +#if defined( IT1_SET ) + d_1(uint_32t, t_dec(i,n), isb_data, v0); +#endif +#if defined( IT4_SET ) + d_4(uint_32t, t_dec(i,n), isb_data, v0, v1, v2, v3); +#endif + +#if defined( IL1_SET ) + d_1(uint_32t, t_dec(i,l), isb_data, w0); +#endif +#if defined( IL4_SET ) + d_4(uint_32t, t_dec(i,l), isb_data, w0, w1, w2, w3); +#endif + +#if defined( LS1_SET ) +#if defined( FL1_SET ) +#undef LS1_SET +#else + d_1(uint_32t, t_dec(l,s), sb_data, w0); +#endif +#endif + +#if defined( LS4_SET ) +#if defined( FL4_SET ) +#undef LS4_SET +#else + d_4(uint_32t, t_dec(l,s), sb_data, w0, w1, w2, w3); +#endif +#endif + +#if defined( IM1_SET ) + d_1(uint_32t, t_dec(i,m), mm_data, v0); +#endif +#if defined( IM4_SET ) + d_4(uint_32t, t_dec(i,m), mm_data, v0, v1, v2, v3); +#endif + +#endif diff --git a/src/utils/crypto/bf_ecb.c b/src/utils/crypto/bf_ecb.c new file mode 100644 index 00000000000..8fd65d213be --- /dev/null +++ b/src/utils/crypto/bf_ecb.c @@ -0,0 +1,113 @@ +/* Deprecated/legacy */ + +/* crypto/bf/bf_ecb.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + +#include "blowfish.h" +#include "bf_locl.h" +#include "../common/endian.h" + +/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' + * (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, + * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) + */ + +char *BF_version="BlowFish part of SSLeay 0.8.2b 08-Jan-1998"; + +char *BF_options(void) + { +#ifdef BF_PTR + return("blowfish(ptr)"); +#elif defined(BF_PTR2) + return("blowfish(ptr2)"); +#else + return("blowfish(idx)"); +#endif + } + +void BF_ecb_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt) + { + BF_LONG l,d[2]; + + n2l(in,l); d[0]=l; + n2l(in,l); d[1]=l; + if (encrypt) + BF_encrypt(d,ks); + else + BF_decrypt(d,ks); + l=d[0]; l2n(l,out); + l=d[1]; l2n(l,out); + l=d[0]=d[1]=0; + } + +void BF_ecb_le_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt) +{ + BF_LONG d[2]; + + d[0] = LE32(((BF_LONG *)in)[0]); + d[1] = LE32(((BF_LONG *)in)[1]); + if (encrypt) + BF_encrypt(d,ks); + else + BF_decrypt(d,ks); + ((BF_LONG *)out)[0] = LE32(d[0]); + ((BF_LONG *)out)[1] = LE32(d[1]); + d[0]=d[1]=0; +} diff --git a/src/utils/crypto/bf_enc.c b/src/utils/crypto/bf_enc.c new file mode 100644 index 00000000000..2323c648fcf --- /dev/null +++ b/src/utils/crypto/bf_enc.c @@ -0,0 +1,235 @@ +/* Deprecated/legacy */ + +/* crypto/bf/bf_enc.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + + + +#include "blowfish.h" +#include "bf_locl.h" + +/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' + * (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, + * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) + */ + +#if (BF_ROUNDS != 16) && (BF_ROUNDS != 20) +If you set BF_ROUNDS to some value other than 16 or 20, you will have +to modify the code. +#endif + +void BF_encrypt(BF_LONG *data, BF_KEY *key) + { + register BF_LONG l,r,*p,*s; + + p=key->P; + s= &(key->S[0]); + l=data[0]; + r=data[1]; + + l^=p[0]; + BF_ENC(r,l,s,p[ 1]); + BF_ENC(l,r,s,p[ 2]); + BF_ENC(r,l,s,p[ 3]); + BF_ENC(l,r,s,p[ 4]); + BF_ENC(r,l,s,p[ 5]); + BF_ENC(l,r,s,p[ 6]); + BF_ENC(r,l,s,p[ 7]); + BF_ENC(l,r,s,p[ 8]); + BF_ENC(r,l,s,p[ 9]); + BF_ENC(l,r,s,p[10]); + BF_ENC(r,l,s,p[11]); + BF_ENC(l,r,s,p[12]); + BF_ENC(r,l,s,p[13]); + BF_ENC(l,r,s,p[14]); + BF_ENC(r,l,s,p[15]); + BF_ENC(l,r,s,p[16]); +#if BF_ROUNDS == 20 + BF_ENC(r,l,s,p[17]); + BF_ENC(l,r,s,p[18]); + BF_ENC(r,l,s,p[19]); + BF_ENC(l,r,s,p[20]); +#endif + r^=p[BF_ROUNDS+1]; + + data[1]=l&0xffffffffL; + data[0]=r&0xffffffffL; + } + +#ifndef BF_DEFAULT_OPTIONS + +void BF_decrypt(BF_LONG *data, BF_KEY *key) + { + register BF_LONG l,r,*p,*s; + + p=key->P; + s= &(key->S[0]); + l=data[0]; + r=data[1]; + + l^=p[BF_ROUNDS+1]; +#if BF_ROUNDS == 20 + BF_ENC(r,l,s,p[20]); + BF_ENC(l,r,s,p[19]); + BF_ENC(r,l,s,p[18]); + BF_ENC(l,r,s,p[17]); +#endif + BF_ENC(r,l,s,p[16]); + BF_ENC(l,r,s,p[15]); + BF_ENC(r,l,s,p[14]); + BF_ENC(l,r,s,p[13]); + BF_ENC(r,l,s,p[12]); + BF_ENC(l,r,s,p[11]); + BF_ENC(r,l,s,p[10]); + BF_ENC(l,r,s,p[ 9]); + BF_ENC(r,l,s,p[ 8]); + BF_ENC(l,r,s,p[ 7]); + BF_ENC(r,l,s,p[ 6]); + BF_ENC(l,r,s,p[ 5]); + BF_ENC(r,l,s,p[ 4]); + BF_ENC(l,r,s,p[ 3]); + BF_ENC(r,l,s,p[ 2]); + BF_ENC(l,r,s,p[ 1]); + r^=p[0]; + + data[1]=l&0xffffffffL; + data[0]=r&0xffffffffL; + } + +void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, BF_KEY *ks, unsigned char *iv, int encrypt) + { + register BF_LONG tin0,tin1; + register BF_LONG tout0,tout1,xor0,xor1; + register long l=length; + BF_LONG tin[2]; + + if (encrypt) + { + n2l(iv,tout0); + n2l(iv,tout1); + iv-=8; + for (l-=8; l>=0; l-=8) + { + n2l(in,tin0); + n2l(in,tin1); + tin0^=tout0; + tin1^=tout1; + tin[0]=tin0; + tin[1]=tin1; + BF_encrypt(tin,ks); + tout0=tin[0]; + tout1=tin[1]; + l2n(tout0,out); + l2n(tout1,out); + } + if (l != -8) + { + n2ln(in,tin0,tin1,l+8); + tin0^=tout0; + tin1^=tout1; + tin[0]=tin0; + tin[1]=tin1; + BF_encrypt(tin,ks); + tout0=tin[0]; + tout1=tin[1]; + l2n(tout0,out); + l2n(tout1,out); + } + l2n(tout0,iv); + l2n(tout1,iv); + } + else + { + n2l(iv,xor0); + n2l(iv,xor1); + iv-=8; + for (l-=8; l>=0; l-=8) + { + n2l(in,tin0); + n2l(in,tin1); + tin[0]=tin0; + tin[1]=tin1; + BF_decrypt(tin,ks); + tout0=tin[0]^xor0; + tout1=tin[1]^xor1; + l2n(tout0,out); + l2n(tout1,out); + xor0=tin0; + xor1=tin1; + } + if (l != -8) + { + n2l(in,tin0); + n2l(in,tin1); + tin[0]=tin0; + tin[1]=tin1; + BF_decrypt(tin,ks); + tout0=tin[0]^xor0; + tout1=tin[1]^xor1; + l2nn(tout0,tout1,out,l+8); + xor0=tin0; + xor1=tin1; + } + l2n(xor0,iv); + l2n(xor1,iv); + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=0; + } + +#endif diff --git a/src/utils/crypto/bf_locl.h b/src/utils/crypto/bf_locl.h new file mode 100644 index 00000000000..36dc05048f3 --- /dev/null +++ b/src/utils/crypto/bf_locl.h @@ -0,0 +1,246 @@ +/* Deprecated/legacy */ + +/* crypto/bf/bf_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify bf_locl.org since bf_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ +# define BF_PTR +#elif defined( __ultrix ) /* Older MIPS */ +# define BF_PTR +#elif defined( __osf1__ ) /* Alpha */ + /* None */ +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* None */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ + /* Unknown */ +#elif defined( __sgi ) /* Newer MIPS */ +# define BF_PTR +#elif defined( i386 ) /* x86 boxes, should be gcc */ +# define BF_PTR2 +#elif defined( _MSC_VER ) /* x86 boxes, Visual C */ +# define BF_PTR2 +#endif /* Systems-specific speed defines */ + +#undef c2l +#define c2l(c,l) (l =((uint32_t)(*((c)++))) , \ + l|=((uint32_t)(*((c)++)))<< 8L, \ + l|=((uint32_t)(*((c)++)))<<16L, \ + l|=((uint32_t)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#undef c2ln +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((uint32_t)(*(--(c))))<<24L; \ + case 7: l2|=((uint32_t)(*(--(c))))<<16L; \ + case 6: l2|=((uint32_t)(*(--(c))))<< 8L; \ + case 5: l2|=((uint32_t)(*(--(c)))); \ + case 4: l1 =((uint32_t)(*(--(c))))<<24L; \ + case 3: l1|=((uint32_t)(*(--(c))))<<16L; \ + case 2: l1|=((uint32_t)(*(--(c))))<< 8L; \ + case 1: l1|=((uint32_t)(*(--(c)))); \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#undef l2cn +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +/* NOTE - c is not incremented as per n2l */ +#define n2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((uint32_t)(*(--(c)))) ; \ + case 7: l2|=((uint32_t)(*(--(c))))<< 8; \ + case 6: l2|=((uint32_t)(*(--(c))))<<16; \ + case 5: l2|=((uint32_t)(*(--(c))))<<24; \ + case 4: l1 =((uint32_t)(*(--(c)))) ; \ + case 3: l1|=((uint32_t)(*(--(c))))<< 8; \ + case 2: l1|=((uint32_t)(*(--(c))))<<16; \ + case 1: l1|=((uint32_t)(*(--(c))))<<24; \ + } \ + } + +/* NOTE - c is not incremented as per l2n */ +#define l2nn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ + } \ + } + +#undef n2l +#define n2l(c,l) (l =((uint32_t)(*((c)++)))<<24L, \ + l|=((uint32_t)(*((c)++)))<<16L, \ + l|=((uint32_t)(*((c)++)))<< 8L, \ + l|=((uint32_t)(*((c)++)))) + +#undef l2n +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* This is actually a big endian algorithm, the most significate byte + * is used to lookup array 0 */ + +/* use BF_PTR2 for intel boxes, + * BF_PTR for sparc and MIPS/SGI + * use nothing for Alpha and HP. + */ +#if !defined(BF_PTR) && !defined(BF_PTR2) +#define BF_PTR2 +#endif + +#define BF_M 0x3fc +#define BF_0 22L +#define BF_1 14L +#define BF_2 6L +#define BF_3 2L /* left shift */ + +#if defined(BF_PTR2) + +/* This is basically a special pentium verson */ +#define BF_ENC(LL,R,S,P) \ + { \ + BF_LONG t,u,v; \ + u=R>>BF_0; \ + v=R>>BF_1; \ + u&=BF_M; \ + v&=BF_M; \ + t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ + u=R>>BF_2; \ + t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ + v=R<>BF_0)&BF_M))+ \ + *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ + *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ + *(BF_LONG *)((unsigned char *)&(S[768])+((R<>24L) ] + \ + S[0x0100+((int)(R>>16L)&0xff)])^ \ + S[0x0200+((int)(R>> 8L)&0xff)])+ \ + S[0x0300+((int)(R )&0xff)])&0xffffffffL; +#endif diff --git a/src/utils/crypto/bf_pi.h b/src/utils/crypto/bf_pi.h new file mode 100644 index 00000000000..9a3933ed1bf --- /dev/null +++ b/src/utils/crypto/bf_pi.h @@ -0,0 +1,327 @@ +/* Deprecated/legacy */ + +/* crypto/bf/bf_pi.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static BF_KEY bf_init= { + { + 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L, + 0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L, + 0x452821e6L, 0x38d01377L, 0xbe5466cfL, 0x34e90c6cL, + 0xc0ac29b7L, 0xc97c50ddL, 0x3f84d5b5L, 0xb5470917L, + 0x9216d5d9L, 0x8979fb1b + },{ + 0xd1310ba6L, 0x98dfb5acL, 0x2ffd72dbL, 0xd01adfb7L, + 0xb8e1afedL, 0x6a267e96L, 0xba7c9045L, 0xf12c7f99L, + 0x24a19947L, 0xb3916cf7L, 0x0801f2e2L, 0x858efc16L, + 0x636920d8L, 0x71574e69L, 0xa458fea3L, 0xf4933d7eL, + 0x0d95748fL, 0x728eb658L, 0x718bcd58L, 0x82154aeeL, + 0x7b54a41dL, 0xc25a59b5L, 0x9c30d539L, 0x2af26013L, + 0xc5d1b023L, 0x286085f0L, 0xca417918L, 0xb8db38efL, + 0x8e79dcb0L, 0x603a180eL, 0x6c9e0e8bL, 0xb01e8a3eL, + 0xd71577c1L, 0xbd314b27L, 0x78af2fdaL, 0x55605c60L, + 0xe65525f3L, 0xaa55ab94L, 0x57489862L, 0x63e81440L, + 0x55ca396aL, 0x2aab10b6L, 0xb4cc5c34L, 0x1141e8ceL, + 0xa15486afL, 0x7c72e993L, 0xb3ee1411L, 0x636fbc2aL, + 0x2ba9c55dL, 0x741831f6L, 0xce5c3e16L, 0x9b87931eL, + 0xafd6ba33L, 0x6c24cf5cL, 0x7a325381L, 0x28958677L, + 0x3b8f4898L, 0x6b4bb9afL, 0xc4bfe81bL, 0x66282193L, + 0x61d809ccL, 0xfb21a991L, 0x487cac60L, 0x5dec8032L, + 0xef845d5dL, 0xe98575b1L, 0xdc262302L, 0xeb651b88L, + 0x23893e81L, 0xd396acc5L, 0x0f6d6ff3L, 0x83f44239L, + 0x2e0b4482L, 0xa4842004L, 0x69c8f04aL, 0x9e1f9b5eL, + 0x21c66842L, 0xf6e96c9aL, 0x670c9c61L, 0xabd388f0L, + 0x6a51a0d2L, 0xd8542f68L, 0x960fa728L, 0xab5133a3L, + 0x6eef0b6cL, 0x137a3be4L, 0xba3bf050L, 0x7efb2a98L, + 0xa1f1651dL, 0x39af0176L, 0x66ca593eL, 0x82430e88L, + 0x8cee8619L, 0x456f9fb4L, 0x7d84a5c3L, 0x3b8b5ebeL, + 0xe06f75d8L, 0x85c12073L, 0x401a449fL, 0x56c16aa6L, + 0x4ed3aa62L, 0x363f7706L, 0x1bfedf72L, 0x429b023dL, + 0x37d0d724L, 0xd00a1248L, 0xdb0fead3L, 0x49f1c09bL, + 0x075372c9L, 0x80991b7bL, 0x25d479d8L, 0xf6e8def7L, + 0xe3fe501aL, 0xb6794c3bL, 0x976ce0bdL, 0x04c006baL, + 0xc1a94fb6L, 0x409f60c4L, 0x5e5c9ec2L, 0x196a2463L, + 0x68fb6fafL, 0x3e6c53b5L, 0x1339b2ebL, 0x3b52ec6fL, + 0x6dfc511fL, 0x9b30952cL, 0xcc814544L, 0xaf5ebd09L, + 0xbee3d004L, 0xde334afdL, 0x660f2807L, 0x192e4bb3L, + 0xc0cba857L, 0x45c8740fL, 0xd20b5f39L, 0xb9d3fbdbL, + 0x5579c0bdL, 0x1a60320aL, 0xd6a100c6L, 0x402c7279L, + 0x679f25feL, 0xfb1fa3ccL, 0x8ea5e9f8L, 0xdb3222f8L, + 0x3c7516dfL, 0xfd616b15L, 0x2f501ec8L, 0xad0552abL, + 0x323db5faL, 0xfd238760L, 0x53317b48L, 0x3e00df82L, + 0x9e5c57bbL, 0xca6f8ca0L, 0x1a87562eL, 0xdf1769dbL, + 0xd542a8f6L, 0x287effc3L, 0xac6732c6L, 0x8c4f5573L, + 0x695b27b0L, 0xbbca58c8L, 0xe1ffa35dL, 0xb8f011a0L, + 0x10fa3d98L, 0xfd2183b8L, 0x4afcb56cL, 0x2dd1d35bL, + 0x9a53e479L, 0xb6f84565L, 0xd28e49bcL, 0x4bfb9790L, + 0xe1ddf2daL, 0xa4cb7e33L, 0x62fb1341L, 0xcee4c6e8L, + 0xef20cadaL, 0x36774c01L, 0xd07e9efeL, 0x2bf11fb4L, + 0x95dbda4dL, 0xae909198L, 0xeaad8e71L, 0x6b93d5a0L, + 0xd08ed1d0L, 0xafc725e0L, 0x8e3c5b2fL, 0x8e7594b7L, + 0x8ff6e2fbL, 0xf2122b64L, 0x8888b812L, 0x900df01cL, + 0x4fad5ea0L, 0x688fc31cL, 0xd1cff191L, 0xb3a8c1adL, + 0x2f2f2218L, 0xbe0e1777L, 0xea752dfeL, 0x8b021fa1L, + 0xe5a0cc0fL, 0xb56f74e8L, 0x18acf3d6L, 0xce89e299L, + 0xb4a84fe0L, 0xfd13e0b7L, 0x7cc43b81L, 0xd2ada8d9L, + 0x165fa266L, 0x80957705L, 0x93cc7314L, 0x211a1477L, + 0xe6ad2065L, 0x77b5fa86L, 0xc75442f5L, 0xfb9d35cfL, + 0xebcdaf0cL, 0x7b3e89a0L, 0xd6411bd3L, 0xae1e7e49L, + 0x00250e2dL, 0x2071b35eL, 0x226800bbL, 0x57b8e0afL, + 0x2464369bL, 0xf009b91eL, 0x5563911dL, 0x59dfa6aaL, + 0x78c14389L, 0xd95a537fL, 0x207d5ba2L, 0x02e5b9c5L, + 0x83260376L, 0x6295cfa9L, 0x11c81968L, 0x4e734a41L, + 0xb3472dcaL, 0x7b14a94aL, 0x1b510052L, 0x9a532915L, + 0xd60f573fL, 0xbc9bc6e4L, 0x2b60a476L, 0x81e67400L, + 0x08ba6fb5L, 0x571be91fL, 0xf296ec6bL, 0x2a0dd915L, + 0xb6636521L, 0xe7b9f9b6L, 0xff34052eL, 0xc5855664L, + 0x53b02d5dL, 0xa99f8fa1L, 0x08ba4799L, 0x6e85076aL, + 0x4b7a70e9L, 0xb5b32944L, 0xdb75092eL, 0xc4192623L, + 0xad6ea6b0L, 0x49a7df7dL, 0x9cee60b8L, 0x8fedb266L, + 0xecaa8c71L, 0x699a17ffL, 0x5664526cL, 0xc2b19ee1L, + 0x193602a5L, 0x75094c29L, 0xa0591340L, 0xe4183a3eL, + 0x3f54989aL, 0x5b429d65L, 0x6b8fe4d6L, 0x99f73fd6L, + 0xa1d29c07L, 0xefe830f5L, 0x4d2d38e6L, 0xf0255dc1L, + 0x4cdd2086L, 0x8470eb26L, 0x6382e9c6L, 0x021ecc5eL, + 0x09686b3fL, 0x3ebaefc9L, 0x3c971814L, 0x6b6a70a1L, + 0x687f3584L, 0x52a0e286L, 0xb79c5305L, 0xaa500737L, + 0x3e07841cL, 0x7fdeae5cL, 0x8e7d44ecL, 0x5716f2b8L, + 0xb03ada37L, 0xf0500c0dL, 0xf01c1f04L, 0x0200b3ffL, + 0xae0cf51aL, 0x3cb574b2L, 0x25837a58L, 0xdc0921bdL, + 0xd19113f9L, 0x7ca92ff6L, 0x94324773L, 0x22f54701L, + 0x3ae5e581L, 0x37c2dadcL, 0xc8b57634L, 0x9af3dda7L, + 0xa9446146L, 0x0fd0030eL, 0xecc8c73eL, 0xa4751e41L, + 0xe238cd99L, 0x3bea0e2fL, 0x3280bba1L, 0x183eb331L, + 0x4e548b38L, 0x4f6db908L, 0x6f420d03L, 0xf60a04bfL, + 0x2cb81290L, 0x24977c79L, 0x5679b072L, 0xbcaf89afL, + 0xde9a771fL, 0xd9930810L, 0xb38bae12L, 0xdccf3f2eL, + 0x5512721fL, 0x2e6b7124L, 0x501adde6L, 0x9f84cd87L, + 0x7a584718L, 0x7408da17L, 0xbc9f9abcL, 0xe94b7d8cL, + 0xec7aec3aL, 0xdb851dfaL, 0x63094366L, 0xc464c3d2L, + 0xef1c1847L, 0x3215d908L, 0xdd433b37L, 0x24c2ba16L, + 0x12a14d43L, 0x2a65c451L, 0x50940002L, 0x133ae4ddL, + 0x71dff89eL, 0x10314e55L, 0x81ac77d6L, 0x5f11199bL, + 0x043556f1L, 0xd7a3c76bL, 0x3c11183bL, 0x5924a509L, + 0xf28fe6edL, 0x97f1fbfaL, 0x9ebabf2cL, 0x1e153c6eL, + 0x86e34570L, 0xeae96fb1L, 0x860e5e0aL, 0x5a3e2ab3L, + 0x771fe71cL, 0x4e3d06faL, 0x2965dcb9L, 0x99e71d0fL, + 0x803e89d6L, 0x5266c825L, 0x2e4cc978L, 0x9c10b36aL, + 0xc6150ebaL, 0x94e2ea78L, 0xa5fc3c53L, 0x1e0a2df4L, + 0xf2f74ea7L, 0x361d2b3dL, 0x1939260fL, 0x19c27960L, + 0x5223a708L, 0xf71312b6L, 0xebadfe6eL, 0xeac31f66L, + 0xe3bc4595L, 0xa67bc883L, 0xb17f37d1L, 0x018cff28L, + 0xc332ddefL, 0xbe6c5aa5L, 0x65582185L, 0x68ab9802L, + 0xeecea50fL, 0xdb2f953bL, 0x2aef7dadL, 0x5b6e2f84L, + 0x1521b628L, 0x29076170L, 0xecdd4775L, 0x619f1510L, + 0x13cca830L, 0xeb61bd96L, 0x0334fe1eL, 0xaa0363cfL, + 0xb5735c90L, 0x4c70a239L, 0xd59e9e0bL, 0xcbaade14L, + 0xeecc86bcL, 0x60622ca7L, 0x9cab5cabL, 0xb2f3846eL, + 0x648b1eafL, 0x19bdf0caL, 0xa02369b9L, 0x655abb50L, + 0x40685a32L, 0x3c2ab4b3L, 0x319ee9d5L, 0xc021b8f7L, + 0x9b540b19L, 0x875fa099L, 0x95f7997eL, 0x623d7da8L, + 0xf837889aL, 0x97e32d77L, 0x11ed935fL, 0x16681281L, + 0x0e358829L, 0xc7e61fd6L, 0x96dedfa1L, 0x7858ba99L, + 0x57f584a5L, 0x1b227263L, 0x9b83c3ffL, 0x1ac24696L, + 0xcdb30aebL, 0x532e3054L, 0x8fd948e4L, 0x6dbc3128L, + 0x58ebf2efL, 0x34c6ffeaL, 0xfe28ed61L, 0xee7c3c73L, + 0x5d4a14d9L, 0xe864b7e3L, 0x42105d14L, 0x203e13e0L, + 0x45eee2b6L, 0xa3aaabeaL, 0xdb6c4f15L, 0xfacb4fd0L, + 0xc742f442L, 0xef6abbb5L, 0x654f3b1dL, 0x41cd2105L, + 0xd81e799eL, 0x86854dc7L, 0xe44b476aL, 0x3d816250L, + 0xcf62a1f2L, 0x5b8d2646L, 0xfc8883a0L, 0xc1c7b6a3L, + 0x7f1524c3L, 0x69cb7492L, 0x47848a0bL, 0x5692b285L, + 0x095bbf00L, 0xad19489dL, 0x1462b174L, 0x23820e00L, + 0x58428d2aL, 0x0c55f5eaL, 0x1dadf43eL, 0x233f7061L, + 0x3372f092L, 0x8d937e41L, 0xd65fecf1L, 0x6c223bdbL, + 0x7cde3759L, 0xcbee7460L, 0x4085f2a7L, 0xce77326eL, + 0xa6078084L, 0x19f8509eL, 0xe8efd855L, 0x61d99735L, + 0xa969a7aaL, 0xc50c06c2L, 0x5a04abfcL, 0x800bcadcL, + 0x9e447a2eL, 0xc3453484L, 0xfdd56705L, 0x0e1e9ec9L, + 0xdb73dbd3L, 0x105588cdL, 0x675fda79L, 0xe3674340L, + 0xc5c43465L, 0x713e38d8L, 0x3d28f89eL, 0xf16dff20L, + 0x153e21e7L, 0x8fb03d4aL, 0xe6e39f2bL, 0xdb83adf7L, + 0xe93d5a68L, 0x948140f7L, 0xf64c261cL, 0x94692934L, + 0x411520f7L, 0x7602d4f7L, 0xbcf46b2eL, 0xd4a20068L, + 0xd4082471L, 0x3320f46aL, 0x43b7d4b7L, 0x500061afL, + 0x1e39f62eL, 0x97244546L, 0x14214f74L, 0xbf8b8840L, + 0x4d95fc1dL, 0x96b591afL, 0x70f4ddd3L, 0x66a02f45L, + 0xbfbc09ecL, 0x03bd9785L, 0x7fac6dd0L, 0x31cb8504L, + 0x96eb27b3L, 0x55fd3941L, 0xda2547e6L, 0xabca0a9aL, + 0x28507825L, 0x530429f4L, 0x0a2c86daL, 0xe9b66dfbL, + 0x68dc1462L, 0xd7486900L, 0x680ec0a4L, 0x27a18deeL, + 0x4f3ffea2L, 0xe887ad8cL, 0xb58ce006L, 0x7af4d6b6L, + 0xaace1e7cL, 0xd3375fecL, 0xce78a399L, 0x406b2a42L, + 0x20fe9e35L, 0xd9f385b9L, 0xee39d7abL, 0x3b124e8bL, + 0x1dc9faf7L, 0x4b6d1856L, 0x26a36631L, 0xeae397b2L, + 0x3a6efa74L, 0xdd5b4332L, 0x6841e7f7L, 0xca7820fbL, + 0xfb0af54eL, 0xd8feb397L, 0x454056acL, 0xba489527L, + 0x55533a3aL, 0x20838d87L, 0xfe6ba9b7L, 0xd096954bL, + 0x55a867bcL, 0xa1159a58L, 0xcca92963L, 0x99e1db33L, + 0xa62a4a56L, 0x3f3125f9L, 0x5ef47e1cL, 0x9029317cL, + 0xfdf8e802L, 0x04272f70L, 0x80bb155cL, 0x05282ce3L, + 0x95c11548L, 0xe4c66d22L, 0x48c1133fL, 0xc70f86dcL, + 0x07f9c9eeL, 0x41041f0fL, 0x404779a4L, 0x5d886e17L, + 0x325f51ebL, 0xd59bc0d1L, 0xf2bcc18fL, 0x41113564L, + 0x257b7834L, 0x602a9c60L, 0xdff8e8a3L, 0x1f636c1bL, + 0x0e12b4c2L, 0x02e1329eL, 0xaf664fd1L, 0xcad18115L, + 0x6b2395e0L, 0x333e92e1L, 0x3b240b62L, 0xeebeb922L, + 0x85b2a20eL, 0xe6ba0d99L, 0xde720c8cL, 0x2da2f728L, + 0xd0127845L, 0x95b794fdL, 0x647d0862L, 0xe7ccf5f0L, + 0x5449a36fL, 0x877d48faL, 0xc39dfd27L, 0xf33e8d1eL, + 0x0a476341L, 0x992eff74L, 0x3a6f6eabL, 0xf4f8fd37L, + 0xa812dc60L, 0xa1ebddf8L, 0x991be14cL, 0xdb6e6b0dL, + 0xc67b5510L, 0x6d672c37L, 0x2765d43bL, 0xdcd0e804L, + 0xf1290dc7L, 0xcc00ffa3L, 0xb5390f92L, 0x690fed0bL, + 0x667b9ffbL, 0xcedb7d9cL, 0xa091cf0bL, 0xd9155ea3L, + 0xbb132f88L, 0x515bad24L, 0x7b9479bfL, 0x763bd6ebL, + 0x37392eb3L, 0xcc115979L, 0x8026e297L, 0xf42e312dL, + 0x6842ada7L, 0xc66a2b3bL, 0x12754cccL, 0x782ef11cL, + 0x6a124237L, 0xb79251e7L, 0x06a1bbe6L, 0x4bfb6350L, + 0x1a6b1018L, 0x11caedfaL, 0x3d25bdd8L, 0xe2e1c3c9L, + 0x44421659L, 0x0a121386L, 0xd90cec6eL, 0xd5abea2aL, + 0x64af674eL, 0xda86a85fL, 0xbebfe988L, 0x64e4c3feL, + 0x9dbc8057L, 0xf0f7c086L, 0x60787bf8L, 0x6003604dL, + 0xd1fd8346L, 0xf6381fb0L, 0x7745ae04L, 0xd736fcccL, + 0x83426b33L, 0xf01eab71L, 0xb0804187L, 0x3c005e5fL, + 0x77a057beL, 0xbde8ae24L, 0x55464299L, 0xbf582e61L, + 0x4e58f48fL, 0xf2ddfda2L, 0xf474ef38L, 0x8789bdc2L, + 0x5366f9c3L, 0xc8b38e74L, 0xb475f255L, 0x46fcd9b9L, + 0x7aeb2661L, 0x8b1ddf84L, 0x846a0e79L, 0x915f95e2L, + 0x466e598eL, 0x20b45770L, 0x8cd55591L, 0xc902de4cL, + 0xb90bace1L, 0xbb8205d0L, 0x11a86248L, 0x7574a99eL, + 0xb77f19b6L, 0xe0a9dc09L, 0x662d09a1L, 0xc4324633L, + 0xe85a1f02L, 0x09f0be8cL, 0x4a99a025L, 0x1d6efe10L, + 0x1ab93d1dL, 0x0ba5a4dfL, 0xa186f20fL, 0x2868f169L, + 0xdcb7da83L, 0x573906feL, 0xa1e2ce9bL, 0x4fcd7f52L, + 0x50115e01L, 0xa70683faL, 0xa002b5c4L, 0x0de6d027L, + 0x9af88c27L, 0x773f8641L, 0xc3604c06L, 0x61a806b5L, + 0xf0177a28L, 0xc0f586e0L, 0x006058aaL, 0x30dc7d62L, + 0x11e69ed7L, 0x2338ea63L, 0x53c2dd94L, 0xc2c21634L, + 0xbbcbee56L, 0x90bcb6deL, 0xebfc7da1L, 0xce591d76L, + 0x6f05e409L, 0x4b7c0188L, 0x39720a3dL, 0x7c927c24L, + 0x86e3725fL, 0x724d9db9L, 0x1ac15bb4L, 0xd39eb8fcL, + 0xed545578L, 0x08fca5b5L, 0xd83d7cd3L, 0x4dad0fc4L, + 0x1e50ef5eL, 0xb161e6f8L, 0xa28514d9L, 0x6c51133cL, + 0x6fd5c7e7L, 0x56e14ec4L, 0x362abfceL, 0xddc6c837L, + 0xd79a3234L, 0x92638212L, 0x670efa8eL, 0x406000e0L, + 0x3a39ce37L, 0xd3faf5cfL, 0xabc27737L, 0x5ac52d1bL, + 0x5cb0679eL, 0x4fa33742L, 0xd3822740L, 0x99bc9bbeL, + 0xd5118e9dL, 0xbf0f7315L, 0xd62d1c7eL, 0xc700c47bL, + 0xb78c1b6bL, 0x21a19045L, 0xb26eb1beL, 0x6a366eb4L, + 0x5748ab2fL, 0xbc946e79L, 0xc6a376d2L, 0x6549c2c8L, + 0x530ff8eeL, 0x468dde7dL, 0xd5730a1dL, 0x4cd04dc6L, + 0x2939bbdbL, 0xa9ba4650L, 0xac9526e8L, 0xbe5ee304L, + 0xa1fad5f0L, 0x6a2d519aL, 0x63ef8ce2L, 0x9a86ee22L, + 0xc089c2b8L, 0x43242ef6L, 0xa51e03aaL, 0x9cf2d0a4L, + 0x83c061baL, 0x9be96a4dL, 0x8fe51550L, 0xba645bd6L, + 0x2826a2f9L, 0xa73a3ae1L, 0x4ba99586L, 0xef5562e9L, + 0xc72fefd3L, 0xf752f7daL, 0x3f046f69L, 0x77fa0a59L, + 0x80e4a915L, 0x87b08601L, 0x9b09e6adL, 0x3b3ee593L, + 0xe990fd5aL, 0x9e34d797L, 0x2cf0b7d9L, 0x022b8b51L, + 0x96d5ac3aL, 0x017da67dL, 0xd1cf3ed6L, 0x7c7d2d28L, + 0x1f9f25cfL, 0xadf2b89bL, 0x5ad6b472L, 0x5a88f54cL, + 0xe029ac71L, 0xe019a5e6L, 0x47b0acfdL, 0xed93fa9bL, + 0xe8d3c48dL, 0x283b57ccL, 0xf8d56629L, 0x79132e28L, + 0x785f0191L, 0xed756055L, 0xf7960e44L, 0xe3d35e8cL, + 0x15056dd4L, 0x88f46dbaL, 0x03a16125L, 0x0564f0bdL, + 0xc3eb9e15L, 0x3c9057a2L, 0x97271aecL, 0xa93a072aL, + 0x1b3f6d9bL, 0x1e6321f5L, 0xf59c66fbL, 0x26dcf319L, + 0x7533d928L, 0xb155fdf5L, 0x03563482L, 0x8aba3cbbL, + 0x28517711L, 0xc20ad9f8L, 0xabcc5167L, 0xccad925fL, + 0x4de81751L, 0x3830dc8eL, 0x379d5862L, 0x9320f991L, + 0xea7a90c2L, 0xfb3e7bceL, 0x5121ce64L, 0x774fbe32L, + 0xa8b6e37eL, 0xc3293d46L, 0x48de5369L, 0x6413e680L, + 0xa2ae0810L, 0xdd6db224L, 0x69852dfdL, 0x09072166L, + 0xb39a460aL, 0x6445c0ddL, 0x586cdecfL, 0x1c20c8aeL, + 0x5bbef7ddL, 0x1b588d40L, 0xccd2017fL, 0x6bb4e3bbL, + 0xdda26a7eL, 0x3a59ff45L, 0x3e350a44L, 0xbcb4cdd5L, + 0x72eacea8L, 0xfa6484bbL, 0x8d6612aeL, 0xbf3c6f47L, + 0xd29be463L, 0x542f5d9eL, 0xaec2771bL, 0xf64e6370L, + 0x740e0d8dL, 0xe75b1357L, 0xf8721671L, 0xaf537d5dL, + 0x4040cb08L, 0x4eb4e2ccL, 0x34d2466aL, 0x0115af84L, + 0xe1b00428L, 0x95983a1dL, 0x06b89fb4L, 0xce6ea048L, + 0x6f3f3b82L, 0x3520ab82L, 0x011a1d4bL, 0x277227f8L, + 0x611560b1L, 0xe7933fdcL, 0xbb3a792bL, 0x344525bdL, + 0xa08839e1L, 0x51ce794bL, 0x2f32c9b7L, 0xa01fbac9L, + 0xe01cc87eL, 0xbcc7d1f6L, 0xcf0111c3L, 0xa1e8aac7L, + 0x1a908749L, 0xd44fbd9aL, 0xd0dadecbL, 0xd50ada38L, + 0x0339c32aL, 0xc6913667L, 0x8df9317cL, 0xe0b12b4fL, + 0xf79e59b7L, 0x43f5bb3aL, 0xf2d519ffL, 0x27d9459cL, + 0xbf97222cL, 0x15e6fc2aL, 0x0f91fc71L, 0x9b941525L, + 0xfae59361L, 0xceb69cebL, 0xc2a86459L, 0x12baa8d1L, + 0xb6c1075eL, 0xe3056a0cL, 0x10d25065L, 0xcb03a442L, + 0xe0ec6e0eL, 0x1698db3bL, 0x4c98a0beL, 0x3278e964L, + 0x9f1f9532L, 0xe0d392dfL, 0xd3a0342bL, 0x8971f21eL, + 0x1b0a7441L, 0x4ba3348cL, 0xc5be7120L, 0xc37632d8L, + 0xdf359f8dL, 0x9b992f2eL, 0xe60b6f47L, 0x0fe3f11dL, + 0xe54cda54L, 0x1edad891L, 0xce6279cfL, 0xcd3e7e6fL, + 0x1618b166L, 0xfd2c1d05L, 0x848fd2c5L, 0xf6fb2299L, + 0xf523f357L, 0xa6327623L, 0x93a83531L, 0x56cccd02L, + 0xacf08162L, 0x5a75ebb5L, 0x6e163697L, 0x88d273ccL, + 0xde966292L, 0x81b949d0L, 0x4c50901bL, 0x71c65614L, + 0xe6c6c7bdL, 0x327a140aL, 0x45e1d006L, 0xc3f27b9aL, + 0xc9aa53fdL, 0x62a80f00L, 0xbb25bfe2L, 0x35bdd2f6L, + 0x71126905L, 0xb2040222L, 0xb6cbcf7cL, 0xcd769c2bL, + 0x53113ec0L, 0x1640e3d3L, 0x38abbd60L, 0x2547adf0L, + 0xba38209cL, 0xf746ce76L, 0x77afa1c5L, 0x20756060L, + 0x85cbfe4eL, 0x8ae88dd8L, 0x7aaaf9b0L, 0x4cf9aa7eL, + 0x1948c25cL, 0x02fb8a8cL, 0x01c36ae4L, 0xd6ebe1f9L, + 0x90d4f869L, 0xa65cdea0L, 0x3f09252dL, 0xc208e69fL, + 0xb74e6132L, 0xce77e25bL, 0x578fdfe3L, 0x3ac372e6L, + } + }; + diff --git a/src/utils/crypto/bf_skey.c b/src/utils/crypto/bf_skey.c new file mode 100644 index 00000000000..5926293aab3 --- /dev/null +++ b/src/utils/crypto/bf_skey.c @@ -0,0 +1,118 @@ +/* Deprecated/legacy */ + +/* crypto/bf/bf_skey.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include +#include + +#include "blowfish.h" +#include "bf_locl.h" +#include "bf_pi.h" + +void BF_set_key(BF_KEY *key, int len, unsigned char *data) + { + int i; + BF_LONG *p,ri,in[2]; + unsigned char *d,*end; + + + memcpy((char *)key,(char *)&bf_init,sizeof(BF_KEY)); + p=key->P; + + if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; + + d=data; + end= &(data[len]); + for (i=0; i<(BF_ROUNDS+2); i++) + { + ri= *(d++); + if (d >= end) d=data; + + ri<<=8; + ri|= *(d++); + if (d >= end) d=data; + + ri<<=8; + ri|= *(d++); + if (d >= end) d=data; + + ri<<=8; + ri|= *(d++); + if (d >= end) d=data; + + p[i]^=ri; + } + + in[0]=0L; + in[1]=0L; + for (i=0; i<(BF_ROUNDS+2); i+=2) + { + BF_encrypt(in,key); + p[i ]=in[0]; + p[i+1]=in[1]; + } + + p=key->S; + for (i=0; i<4*256; i+=2) + { + BF_encrypt(in,key); + p[i ]=in[0]; + p[i+1]=in[1]; + } + } diff --git a/src/utils/crypto/blowfish.h b/src/utils/crypto/blowfish.h new file mode 100644 index 00000000000..e54bfefccdb --- /dev/null +++ b/src/utils/crypto/blowfish.h @@ -0,0 +1,120 @@ +/* Deprecated/legacy */ + +/* crypto/bf/blowfish.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_BLOWFISH_H +#define HEADER_BLOWFISH_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define BF_ENCRYPT 1 +#define BF_DECRYPT 0 + +/* If you make this 'unsigned int' the pointer variants will work on + * the Alpha, otherwise they will not. Strangly using the '8 byte' + * BF_LONG and the default 'non-pointer' inner loop is the best configuration + * for the Alpha */ +#define BF_LONG uint32_t + +#define BF_ROUNDS 16 +#define BF_BLOCK 8 + +typedef struct bf_key_st + { + BF_LONG P[BF_ROUNDS+2]; + BF_LONG S[4*256]; + } BF_KEY; + +#ifndef NOPROTO + +void BF_set_key(BF_KEY *key, int len, unsigned char *data); +void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key, int enc); +void BF_ecb_le_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt); +void BF_encrypt(BF_LONG *data,BF_KEY *key); +void BF_decrypt(BF_LONG *data,BF_KEY *key); +void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, + BF_KEY *ks, unsigned char *iv, int enc); +void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + BF_KEY *schedule, unsigned char *ivec, int *num, int enc); +void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + BF_KEY *schedule, unsigned char *ivec, int *num); +char *BF_options(void); + +#else + +void BF_set_key(); +void BF_ecb_encrypt(); +void BF_encrypt(); +void BF_decrypt(); +void BF_cbc_encrypt(); +void BF_cfb64_encrypt(); +void BF_ofb64_encrypt(); +char *BF_options(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/utils/crypto/c_ecb.c b/src/utils/crypto/c_ecb.c new file mode 100644 index 00000000000..1beb7910777 --- /dev/null +++ b/src/utils/crypto/c_ecb.c @@ -0,0 +1,80 @@ +/* Deprecated/legacy */ + +/* crypto/cast/cast_ecb.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include "cast.h" +#include "cast_lcl.h" + + +char *CAST_version="CAST part of SSLeay 0.8.2b 08-Jan-1998"; + +void CAST_ecb_encrypt(unsigned char *in, unsigned char *out, CAST_KEY *ks, int encrypt) + { + CAST_LONG l,d[2]; + + n2l(in,l); d[0]=l; + n2l(in,l); d[1]=l; + if (encrypt) + CAST_encrypt(d,ks); + else + CAST_decrypt(d,ks); + l=d[0]; l2n(l,out); + l=d[1]; l2n(l,out); + l=d[0]=d[1]=0; + } diff --git a/src/utils/crypto/c_enc.c b/src/utils/crypto/c_enc.c new file mode 100644 index 00000000000..258bfa92cea --- /dev/null +++ b/src/utils/crypto/c_enc.c @@ -0,0 +1,201 @@ +/* Deprecated/legacy */ + +/* crypto/cast/c_enc.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include "cast.h" +#include "cast_lcl.h" + +void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) + { + register CAST_LONG l,r,*k,t; + + k= &(key->data[0]); + l=data[0]; + r=data[1]; + + E_CAST( 0,k,l,r,+,^,-); + E_CAST( 1,k,r,l,^,-,+); + E_CAST( 2,k,l,r,-,+,^); + E_CAST( 3,k,r,l,+,^,-); + E_CAST( 4,k,l,r,^,-,+); + E_CAST( 5,k,r,l,-,+,^); + E_CAST( 6,k,l,r,+,^,-); + E_CAST( 7,k,r,l,^,-,+); + E_CAST( 8,k,l,r,-,+,^); + E_CAST( 9,k,r,l,+,^,-); + E_CAST(10,k,l,r,^,-,+); + E_CAST(11,k,r,l,-,+,^); + E_CAST(12,k,l,r,+,^,-); + E_CAST(13,k,r,l,^,-,+); + E_CAST(14,k,l,r,-,+,^); + E_CAST(15,k,r,l,+,^,-); + + data[1]=l&0xffffffffL; + data[0]=r&0xffffffffL; + } + +void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) + { + register CAST_LONG l,r,*k,t; + + k= &(key->data[0]); + l=data[0]; + r=data[1]; + + E_CAST(15,k,l,r,+,^,-); + E_CAST(14,k,r,l,-,+,^); + E_CAST(13,k,l,r,^,-,+); + E_CAST(12,k,r,l,+,^,-); + E_CAST(11,k,l,r,-,+,^); + E_CAST(10,k,r,l,^,-,+); + E_CAST( 9,k,l,r,+,^,-); + E_CAST( 8,k,r,l,-,+,^); + E_CAST( 7,k,l,r,^,-,+); + E_CAST( 6,k,r,l,+,^,-); + E_CAST( 5,k,l,r,-,+,^); + E_CAST( 4,k,r,l,^,-,+); + E_CAST( 3,k,l,r,+,^,-); + E_CAST( 2,k,r,l,-,+,^); + E_CAST( 1,k,l,r,^,-,+); + E_CAST( 0,k,r,l,+,^,-); + + data[1]=l&0xffffffffL; + data[0]=r&0xffffffffL; + } + +void CAST_cbc_encrypt(unsigned char *in, unsigned char *out, long length, CAST_KEY *ks, unsigned char *iv, int encrypt) + { + register CAST_LONG tin0,tin1; + register CAST_LONG tout0,tout1,xor0,xor1; + register long l=length; + CAST_LONG tin[2]; + + if (encrypt) + { + n2l(iv,tout0); + n2l(iv,tout1); + iv-=8; + for (l-=8; l>=0; l-=8) + { + n2l(in,tin0); + n2l(in,tin1); + tin0^=tout0; + tin1^=tout1; + tin[0]=tin0; + tin[1]=tin1; + CAST_encrypt(tin,ks); + tout0=tin[0]; + tout1=tin[1]; + l2n(tout0,out); + l2n(tout1,out); + } + if (l != -8) + { + n2ln(in,tin0,tin1,l+8); + tin0^=tout0; + tin1^=tout1; + tin[0]=tin0; + tin[1]=tin1; + CAST_encrypt(tin,ks); + tout0=tin[0]; + tout1=tin[1]; + l2n(tout0,out); + l2n(tout1,out); + } + l2n(tout0,iv); + l2n(tout1,iv); + } + else + { + n2l(iv,xor0); + n2l(iv,xor1); + iv-=8; + for (l-=8; l>=0; l-=8) + { + n2l(in,tin0); + n2l(in,tin1); + tin[0]=tin0; + tin[1]=tin1; + CAST_decrypt(tin,ks); + tout0=tin[0]^xor0; + tout1=tin[1]^xor1; + l2n(tout0,out); + l2n(tout1,out); + xor0=tin0; + xor1=tin1; + } + if (l != -8) + { + n2l(in,tin0); + n2l(in,tin1); + tin[0]=tin0; + tin[1]=tin1; + CAST_decrypt(tin,ks); + tout0=tin[0]^xor0; + tout1=tin[1]^xor1; + l2nn(tout0,tout1,out,l+8); + xor0=tin0; + xor1=tin1; + } + l2n(xor0,iv); + l2n(xor1,iv); + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=0; + } diff --git a/src/utils/crypto/c_skey.c b/src/utils/crypto/c_skey.c new file mode 100644 index 00000000000..498a68b3539 --- /dev/null +++ b/src/utils/crypto/c_skey.c @@ -0,0 +1,164 @@ +/* Deprecated/legacy */ + +/* crypto/cast/c_skey.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + + +#include "cast.h" +#include "cast_lcl.h" +#include "cast_s.h" + +#define CAST_exp(l,A,a,n) \ + A[n/4]=l; \ + a[n+3]=(l )&0xff; \ + a[n+2]=(l>> 8)&0xff; \ + a[n+1]=(l>>16)&0xff; \ + a[n+0]=(l>>24); + +#define S4 CAST_S_table4 +#define S5 CAST_S_table5 +#define S6 CAST_S_table6 +#define S7 CAST_S_table7 + +void CAST_set_key(CAST_KEY *key, int len, unsigned char *data) + { + CAST_LONG x[16]; + CAST_LONG z[16]; + CAST_LONG k[32]; + CAST_LONG X[4],Z[4]; + CAST_LONG l,*K; + int i; + + for (i=0; i<16; i++) x[i]=0; + if (len > 16) len=16; + for (i=0; idata[i*2]=k[i]; + key->data[i*2+1]=((k[i+16])+16)&0x1f; + } + } diff --git a/src/utils/crypto/cast.h b/src/utils/crypto/cast.h new file mode 100644 index 00000000000..b1008fb9d4b --- /dev/null +++ b/src/utils/crypto/cast.h @@ -0,0 +1,113 @@ +/* Deprecated/legacy */ + +/* crypto/cast/cast.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifndef HEADER_CAST_H +#define HEADER_CAST_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CAST_ENCRYPT 1 +#define CAST_DECRYPT 0 + +#define CAST_LONG uint32_t + +#define CAST_BLOCK 8 +#define CAST_KEY_LENGTH 16 + +typedef struct cast_key_st + { + CAST_LONG data[32]; + } CAST_KEY; + +#ifndef NOPROTO + +void CAST_set_key(CAST_KEY *key, int len, unsigned char *data); +void CAST_ecb_encrypt(unsigned char *in,unsigned char *out,CAST_KEY *key, + int enc); +void CAST_encrypt(CAST_LONG *data,CAST_KEY *key); +void CAST_decrypt(CAST_LONG *data,CAST_KEY *key); +void CAST_cbc_encrypt(unsigned char *in, unsigned char *out, long length, + CAST_KEY *ks, unsigned char *iv, int enc); +void CAST_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + CAST_KEY *schedule, unsigned char *ivec, int *num, int enc); +void CAST_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + CAST_KEY *schedule, unsigned char *ivec, int *num); + +#else + +void CAST_set_key(); +void CAST_ecb_encrypt(); +void CAST_encrypt(); +void CAST_decrypt(); +void CAST_cbc_encrypt(); +void CAST_cfb64_encrypt(); +void CAST_ofb64_encrypt(); + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/utils/crypto/cast_lcl.h b/src/utils/crypto/cast_lcl.h new file mode 100644 index 00000000000..e757c21efe1 --- /dev/null +++ b/src/utils/crypto/cast_lcl.h @@ -0,0 +1,225 @@ +/* Deprecated/legacy */ + +/* crypto/rc2/rc2_locl.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#ifdef WIN32 +#include +#endif + +#undef c2l +#define c2l(c,l) (l =((uint32_t)(*((c)++))) , \ + l|=((uint32_t)(*((c)++)))<< 8L, \ + l|=((uint32_t)(*((c)++)))<<16L, \ + l|=((uint32_t)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#undef c2ln +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((uint32_t)(*(--(c))))<<24L; \ + case 7: l2|=((uint32_t)(*(--(c))))<<16L; \ + case 6: l2|=((uint32_t)(*(--(c))))<< 8L; \ + case 5: l2|=((uint32_t)(*(--(c)))); \ + case 4: l1 =((uint32_t)(*(--(c))))<<24L; \ + case 3: l1|=((uint32_t)(*(--(c))))<<16L; \ + case 2: l1|=((uint32_t)(*(--(c))))<< 8L; \ + case 1: l1|=((uint32_t)(*(--(c)))); \ + } \ + } + +#undef l2c +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#undef l2cn +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +/* NOTE - c is not incremented as per n2l */ +#define n2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((uint32_t)(*(--(c)))) ; \ + case 7: l2|=((uint32_t)(*(--(c))))<< 8; \ + case 6: l2|=((uint32_t)(*(--(c))))<<16; \ + case 5: l2|=((uint32_t)(*(--(c))))<<24; \ + case 4: l1 =((uint32_t)(*(--(c)))) ; \ + case 3: l1|=((uint32_t)(*(--(c))))<< 8; \ + case 2: l1|=((uint32_t)(*(--(c))))<<16; \ + case 1: l1|=((uint32_t)(*(--(c))))<<24; \ + } \ + } + +/* NOTE - c is not incremented as per l2n */ +#define l2nn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ + } \ + } + +#undef n2l +#define n2l(c,l) (l =((uint32_t)(*((c)++)))<<24L, \ + l|=((uint32_t)(*((c)++)))<<16L, \ + l|=((uint32_t)(*((c)++)))<< 8L, \ + l|=((uint32_t)(*((c)++)))) + +#undef l2n +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +//#if defined(WIN32) +//#define ROTL(a,n) (_lrotl(a,n)) +//#else +#define ROTL(a,n) (((a)<<(n))|((a)>>(32-(n)))) +//#endif + +#define C_M 0x3fc +#define C_0 22L +#define C_1 14L +#define C_2 6L +#define C_3 2L /* left shift */ + +/* The rotate has an extra 16 added to it to help the x86 asm */ +#if defined(CAST_PTR) +#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ + { \ + int i; \ + t=key[n*2] OP1 R; \ + i=key[n*2+1]; \ + t=ROTL(t,i); \ + L^= ((( *(CAST_LONG *)((unsigned char *) \ + CAST_S_table0+((t>>C_2)&C_M)) OP2 \ + *(CAST_LONG *)((unsigned char *) \ + CAST_S_table1+((t<>C_0)&C_M))) OP1 \ + *(CAST_LONG *)((unsigned char *) \ + CAST_S_table3+((t>>C_1)&C_M))); \ + } +#elif defined(CAST_PTR2) +#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ + { \ + int i; \ + CAST_LONG u,v,w; \ + w=key[n*2] OP1 R; \ + i=key[n*2+1]; \ + w=ROTL(w,i); \ + u=w>>C_2; \ + v=w<>C_0; \ + t=t OP2 *(CAST_LONG *)((unsigned char *)CAST_S_table1+v); \ + v=w>>C_1; \ + u&=C_M; \ + v&=C_M; \ + t=t OP3 *(CAST_LONG *)((unsigned char *)CAST_S_table2+u); \ + t=t OP1 *(CAST_LONG *)((unsigned char *)CAST_S_table3+v); \ + L^=t; \ + } +#else +#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ + { \ + CAST_LONG a,b,c,d; \ + t=key[n*2] OP1 R; \ + t=ROTL(t,(key[n*2+1])); \ + a=CAST_S_table0[(t>> 8)&0xff]; \ + b=CAST_S_table1[(t )&0xff]; \ + c=CAST_S_table2[(t>>24)&0xff]; \ + d=CAST_S_table3[(t>>16)&0xff]; \ + L^=(((a OP2 b) OP3 c) OP1 d); \ + } +#endif + +extern CAST_LONG CAST_S_table0[256]; +extern CAST_LONG CAST_S_table1[256]; +extern CAST_LONG CAST_S_table2[256]; +extern CAST_LONG CAST_S_table3[256]; +extern CAST_LONG CAST_S_table4[256]; +extern CAST_LONG CAST_S_table5[256]; +extern CAST_LONG CAST_S_table6[256]; +extern CAST_LONG CAST_S_table7[256]; diff --git a/src/utils/crypto/cast_s.h b/src/utils/crypto/cast_s.h new file mode 100644 index 00000000000..5841ee13459 --- /dev/null +++ b/src/utils/crypto/cast_s.h @@ -0,0 +1,530 @@ +/* Deprecated/legacy */ + +CAST_LONG CAST_S_table0[256]={ + 0x30fb40d4,0x9fa0ff0b,0x6beccd2f,0x3f258c7a, + 0x1e213f2f,0x9c004dd3,0x6003e540,0xcf9fc949, + 0xbfd4af27,0x88bbbdb5,0xe2034090,0x98d09675, + 0x6e63a0e0,0x15c361d2,0xc2e7661d,0x22d4ff8e, + 0x28683b6f,0xc07fd059,0xff2379c8,0x775f50e2, + 0x43c340d3,0xdf2f8656,0x887ca41a,0xa2d2bd2d, + 0xa1c9e0d6,0x346c4819,0x61b76d87,0x22540f2f, + 0x2abe32e1,0xaa54166b,0x22568e3a,0xa2d341d0, + 0x66db40c8,0xa784392f,0x004dff2f,0x2db9d2de, + 0x97943fac,0x4a97c1d8,0x527644b7,0xb5f437a7, + 0xb82cbaef,0xd751d159,0x6ff7f0ed,0x5a097a1f, + 0x827b68d0,0x90ecf52e,0x22b0c054,0xbc8e5935, + 0x4b6d2f7f,0x50bb64a2,0xd2664910,0xbee5812d, + 0xb7332290,0xe93b159f,0xb48ee411,0x4bff345d, + 0xfd45c240,0xad31973f,0xc4f6d02e,0x55fc8165, + 0xd5b1caad,0xa1ac2dae,0xa2d4b76d,0xc19b0c50, + 0x882240f2,0x0c6e4f38,0xa4e4bfd7,0x4f5ba272, + 0x564c1d2f,0xc59c5319,0xb949e354,0xb04669fe, + 0xb1b6ab8a,0xc71358dd,0x6385c545,0x110f935d, + 0x57538ad5,0x6a390493,0xe63d37e0,0x2a54f6b3, + 0x3a787d5f,0x6276a0b5,0x19a6fcdf,0x7a42206a, + 0x29f9d4d5,0xf61b1891,0xbb72275e,0xaa508167, + 0x38901091,0xc6b505eb,0x84c7cb8c,0x2ad75a0f, + 0x874a1427,0xa2d1936b,0x2ad286af,0xaa56d291, + 0xd7894360,0x425c750d,0x93b39e26,0x187184c9, + 0x6c00b32d,0x73e2bb14,0xa0bebc3c,0x54623779, + 0x64459eab,0x3f328b82,0x7718cf82,0x59a2cea6, + 0x04ee002e,0x89fe78e6,0x3fab0950,0x325ff6c2, + 0x81383f05,0x6963c5c8,0x76cb5ad6,0xd49974c9, + 0xca180dcf,0x380782d5,0xc7fa5cf6,0x8ac31511, + 0x35e79e13,0x47da91d0,0xf40f9086,0xa7e2419e, + 0x31366241,0x051ef495,0xaa573b04,0x4a805d8d, + 0x548300d0,0x00322a3c,0xbf64cddf,0xba57a68e, + 0x75c6372b,0x50afd341,0xa7c13275,0x915a0bf5, + 0x6b54bfab,0x2b0b1426,0xab4cc9d7,0x449ccd82, + 0xf7fbf265,0xab85c5f3,0x1b55db94,0xaad4e324, + 0xcfa4bd3f,0x2deaa3e2,0x9e204d02,0xc8bd25ac, + 0xeadf55b3,0xd5bd9e98,0xe31231b2,0x2ad5ad6c, + 0x954329de,0xadbe4528,0xd8710f69,0xaa51c90f, + 0xaa786bf6,0x22513f1e,0xaa51a79b,0x2ad344cc, + 0x7b5a41f0,0xd37cfbad,0x1b069505,0x41ece491, + 0xb4c332e6,0x032268d4,0xc9600acc,0xce387e6d, + 0xbf6bb16c,0x6a70fb78,0x0d03d9c9,0xd4df39de, + 0xe01063da,0x4736f464,0x5ad328d8,0xb347cc96, + 0x75bb0fc3,0x98511bfb,0x4ffbcc35,0xb58bcf6a, + 0xe11f0abc,0xbfc5fe4a,0xa70aec10,0xac39570a, + 0x3f04442f,0x6188b153,0xe0397a2e,0x5727cb79, + 0x9ceb418f,0x1cacd68d,0x2ad37c96,0x0175cb9d, + 0xc69dff09,0xc75b65f0,0xd9db40d8,0xec0e7779, + 0x4744ead4,0xb11c3274,0xdd24cb9e,0x7e1c54bd, + 0xf01144f9,0xd2240eb1,0x9675b3fd,0xa3ac3755, + 0xd47c27af,0x51c85f4d,0x56907596,0xa5bb15e6, + 0x580304f0,0xca042cf1,0x011a37ea,0x8dbfaadb, + 0x35ba3e4a,0x3526ffa0,0xc37b4d09,0xbc306ed9, + 0x98a52666,0x5648f725,0xff5e569d,0x0ced63d0, + 0x7c63b2cf,0x700b45e1,0xd5ea50f1,0x85a92872, + 0xaf1fbda7,0xd4234870,0xa7870bf3,0x2d3b4d79, + 0x42e04198,0x0cd0ede7,0x26470db8,0xf881814c, + 0x474d6ad7,0x7c0c5e5c,0xd1231959,0x381b7298, + 0xf5d2f4db,0xab838653,0x6e2f1e23,0x83719c9e, + 0xbd91e046,0x9a56456e,0xdc39200c,0x20c8c571, + 0x962bda1c,0xe1e696ff,0xb141ab08,0x7cca89b9, + 0x1a69e783,0x02cc4843,0xa2f7c579,0x429ef47d, + 0x427b169c,0x5ac9f049,0xdd8f0f00,0x5c8165bf, + }; +CAST_LONG CAST_S_table1[256]={ + 0x1f201094,0xef0ba75b,0x69e3cf7e,0x393f4380, + 0xfe61cf7a,0xeec5207a,0x55889c94,0x72fc0651, + 0xada7ef79,0x4e1d7235,0xd55a63ce,0xde0436ba, + 0x99c430ef,0x5f0c0794,0x18dcdb7d,0xa1d6eff3, + 0xa0b52f7b,0x59e83605,0xee15b094,0xe9ffd909, + 0xdc440086,0xef944459,0xba83ccb3,0xe0c3cdfb, + 0xd1da4181,0x3b092ab1,0xf997f1c1,0xa5e6cf7b, + 0x01420ddb,0xe4e7ef5b,0x25a1ff41,0xe180f806, + 0x1fc41080,0x179bee7a,0xd37ac6a9,0xfe5830a4, + 0x98de8b7f,0x77e83f4e,0x79929269,0x24fa9f7b, + 0xe113c85b,0xacc40083,0xd7503525,0xf7ea615f, + 0x62143154,0x0d554b63,0x5d681121,0xc866c359, + 0x3d63cf73,0xcee234c0,0xd4d87e87,0x5c672b21, + 0x071f6181,0x39f7627f,0x361e3084,0xe4eb573b, + 0x602f64a4,0xd63acd9c,0x1bbc4635,0x9e81032d, + 0x2701f50c,0x99847ab4,0xa0e3df79,0xba6cf38c, + 0x10843094,0x2537a95e,0xf46f6ffe,0xa1ff3b1f, + 0x208cfb6a,0x8f458c74,0xd9e0a227,0x4ec73a34, + 0xfc884f69,0x3e4de8df,0xef0e0088,0x3559648d, + 0x8a45388c,0x1d804366,0x721d9bfd,0xa58684bb, + 0xe8256333,0x844e8212,0x128d8098,0xfed33fb4, + 0xce280ae1,0x27e19ba5,0xd5a6c252,0xe49754bd, + 0xc5d655dd,0xeb667064,0x77840b4d,0xa1b6a801, + 0x84db26a9,0xe0b56714,0x21f043b7,0xe5d05860, + 0x54f03084,0x066ff472,0xa31aa153,0xdadc4755, + 0xb5625dbf,0x68561be6,0x83ca6b94,0x2d6ed23b, + 0xeccf01db,0xa6d3d0ba,0xb6803d5c,0xaf77a709, + 0x33b4a34c,0x397bc8d6,0x5ee22b95,0x5f0e5304, + 0x81ed6f61,0x20e74364,0xb45e1378,0xde18639b, + 0x881ca122,0xb96726d1,0x8049a7e8,0x22b7da7b, + 0x5e552d25,0x5272d237,0x79d2951c,0xc60d894c, + 0x488cb402,0x1ba4fe5b,0xa4b09f6b,0x1ca815cf, + 0xa20c3005,0x8871df63,0xb9de2fcb,0x0cc6c9e9, + 0x0beeff53,0xe3214517,0xb4542835,0x9f63293c, + 0xee41e729,0x6e1d2d7c,0x50045286,0x1e6685f3, + 0xf33401c6,0x30a22c95,0x31a70850,0x60930f13, + 0x73f98417,0xa1269859,0xec645c44,0x52c877a9, + 0xcdff33a6,0xa02b1741,0x7cbad9a2,0x2180036f, + 0x50d99c08,0xcb3f4861,0xc26bd765,0x64a3f6ab, + 0x80342676,0x25a75e7b,0xe4e6d1fc,0x20c710e6, + 0xcdf0b680,0x17844d3b,0x31eef84d,0x7e0824e4, + 0x2ccb49eb,0x846a3bae,0x8ff77888,0xee5d60f6, + 0x7af75673,0x2fdd5cdb,0xa11631c1,0x30f66f43, + 0xb3faec54,0x157fd7fa,0xef8579cc,0xd152de58, + 0xdb2ffd5e,0x8f32ce19,0x306af97a,0x02f03ef8, + 0x99319ad5,0xc242fa0f,0xa7e3ebb0,0xc68e4906, + 0xb8da230c,0x80823028,0xdcdef3c8,0xd35fb171, + 0x088a1bc8,0xbec0c560,0x61a3c9e8,0xbca8f54d, + 0xc72feffa,0x22822e99,0x82c570b4,0xd8d94e89, + 0x8b1c34bc,0x301e16e6,0x273be979,0xb0ffeaa6, + 0x61d9b8c6,0x00b24869,0xb7ffce3f,0x08dc283b, + 0x43daf65a,0xf7e19798,0x7619b72f,0x8f1c9ba4, + 0xdc8637a0,0x16a7d3b1,0x9fc393b7,0xa7136eeb, + 0xc6bcc63e,0x1a513742,0xef6828bc,0x520365d6, + 0x2d6a77ab,0x3527ed4b,0x821fd216,0x095c6e2e, + 0xdb92f2fb,0x5eea29cb,0x145892f5,0x91584f7f, + 0x5483697b,0x2667a8cc,0x85196048,0x8c4bacea, + 0x833860d4,0x0d23e0f9,0x6c387e8a,0x0ae6d249, + 0xb284600c,0xd835731d,0xdcb1c647,0xac4c56ea, + 0x3ebd81b3,0x230eabb0,0x6438bc87,0xf0b5b1fa, + 0x8f5ea2b3,0xfc184642,0x0a036b7a,0x4fb089bd, + 0x649da589,0xa345415e,0x5c038323,0x3e5d3bb9, + 0x43d79572,0x7e6dd07c,0x06dfdf1e,0x6c6cc4ef, + 0x7160a539,0x73bfbe70,0x83877605,0x4523ecf1, + }; +CAST_LONG CAST_S_table2[256]={ + 0x8defc240,0x25fa5d9f,0xeb903dbf,0xe810c907, + 0x47607fff,0x369fe44b,0x8c1fc644,0xaececa90, + 0xbeb1f9bf,0xeefbcaea,0xe8cf1950,0x51df07ae, + 0x920e8806,0xf0ad0548,0xe13c8d83,0x927010d5, + 0x11107d9f,0x07647db9,0xb2e3e4d4,0x3d4f285e, + 0xb9afa820,0xfade82e0,0xa067268b,0x8272792e, + 0x553fb2c0,0x489ae22b,0xd4ef9794,0x125e3fbc, + 0x21fffcee,0x825b1bfd,0x9255c5ed,0x1257a240, + 0x4e1a8302,0xbae07fff,0x528246e7,0x8e57140e, + 0x3373f7bf,0x8c9f8188,0xa6fc4ee8,0xc982b5a5, + 0xa8c01db7,0x579fc264,0x67094f31,0xf2bd3f5f, + 0x40fff7c1,0x1fb78dfc,0x8e6bd2c1,0x437be59b, + 0x99b03dbf,0xb5dbc64b,0x638dc0e6,0x55819d99, + 0xa197c81c,0x4a012d6e,0xc5884a28,0xccc36f71, + 0xb843c213,0x6c0743f1,0x8309893c,0x0feddd5f, + 0x2f7fe850,0xd7c07f7e,0x02507fbf,0x5afb9a04, + 0xa747d2d0,0x1651192e,0xaf70bf3e,0x58c31380, + 0x5f98302e,0x727cc3c4,0x0a0fb402,0x0f7fef82, + 0x8c96fdad,0x5d2c2aae,0x8ee99a49,0x50da88b8, + 0x8427f4a0,0x1eac5790,0x796fb449,0x8252dc15, + 0xefbd7d9b,0xa672597d,0xada840d8,0x45f54504, + 0xfa5d7403,0xe83ec305,0x4f91751a,0x925669c2, + 0x23efe941,0xa903f12e,0x60270df2,0x0276e4b6, + 0x94fd6574,0x927985b2,0x8276dbcb,0x02778176, + 0xf8af918d,0x4e48f79e,0x8f616ddf,0xe29d840e, + 0x842f7d83,0x340ce5c8,0x96bbb682,0x93b4b148, + 0xef303cab,0x984faf28,0x779faf9b,0x92dc560d, + 0x224d1e20,0x8437aa88,0x7d29dc96,0x2756d3dc, + 0x8b907cee,0xb51fd240,0xe7c07ce3,0xe566b4a1, + 0xc3e9615e,0x3cf8209d,0x6094d1e3,0xcd9ca341, + 0x5c76460e,0x00ea983b,0xd4d67881,0xfd47572c, + 0xf76cedd9,0xbda8229c,0x127dadaa,0x438a074e, + 0x1f97c090,0x081bdb8a,0x93a07ebe,0xb938ca15, + 0x97b03cff,0x3dc2c0f8,0x8d1ab2ec,0x64380e51, + 0x68cc7bfb,0xd90f2788,0x12490181,0x5de5ffd4, + 0xdd7ef86a,0x76a2e214,0xb9a40368,0x925d958f, + 0x4b39fffa,0xba39aee9,0xa4ffd30b,0xfaf7933b, + 0x6d498623,0x193cbcfa,0x27627545,0x825cf47a, + 0x61bd8ba0,0xd11e42d1,0xcead04f4,0x127ea392, + 0x10428db7,0x8272a972,0x9270c4a8,0x127de50b, + 0x285ba1c8,0x3c62f44f,0x35c0eaa5,0xe805d231, + 0x428929fb,0xb4fcdf82,0x4fb66a53,0x0e7dc15b, + 0x1f081fab,0x108618ae,0xfcfd086d,0xf9ff2889, + 0x694bcc11,0x236a5cae,0x12deca4d,0x2c3f8cc5, + 0xd2d02dfe,0xf8ef5896,0xe4cf52da,0x95155b67, + 0x494a488c,0xb9b6a80c,0x5c8f82bc,0x89d36b45, + 0x3a609437,0xec00c9a9,0x44715253,0x0a874b49, + 0xd773bc40,0x7c34671c,0x02717ef6,0x4feb5536, + 0xa2d02fff,0xd2bf60c4,0xd43f03c0,0x50b4ef6d, + 0x07478cd1,0x006e1888,0xa2e53f55,0xb9e6d4bc, + 0xa2048016,0x97573833,0xd7207d67,0xde0f8f3d, + 0x72f87b33,0xabcc4f33,0x7688c55d,0x7b00a6b0, + 0x947b0001,0x570075d2,0xf9bb88f8,0x8942019e, + 0x4264a5ff,0x856302e0,0x72dbd92b,0xee971b69, + 0x6ea22fde,0x5f08ae2b,0xaf7a616d,0xe5c98767, + 0xcf1febd2,0x61efc8c2,0xf1ac2571,0xcc8239c2, + 0x67214cb8,0xb1e583d1,0xb7dc3e62,0x7f10bdce, + 0xf90a5c38,0x0ff0443d,0x606e6dc6,0x60543a49, + 0x5727c148,0x2be98a1d,0x8ab41738,0x20e1be24, + 0xaf96da0f,0x68458425,0x99833be5,0x600d457d, + 0x282f9350,0x8334b362,0xd91d1120,0x2b6d8da0, + 0x642b1e31,0x9c305a00,0x52bce688,0x1b03588a, + 0xf7baefd5,0x4142ed9c,0xa4315c11,0x83323ec5, + 0xdfef4636,0xa133c501,0xe9d3531c,0xee353783, + }; +CAST_LONG CAST_S_table3[256]={ + 0x9db30420,0x1fb6e9de,0xa7be7bef,0xd273a298, + 0x4a4f7bdb,0x64ad8c57,0x85510443,0xfa020ed1, + 0x7e287aff,0xe60fb663,0x095f35a1,0x79ebf120, + 0xfd059d43,0x6497b7b1,0xf3641f63,0x241e4adf, + 0x28147f5f,0x4fa2b8cd,0xc9430040,0x0cc32220, + 0xfdd30b30,0xc0a5374f,0x1d2d00d9,0x24147b15, + 0xee4d111a,0x0fca5167,0x71ff904c,0x2d195ffe, + 0x1a05645f,0x0c13fefe,0x081b08ca,0x05170121, + 0x80530100,0xe83e5efe,0xac9af4f8,0x7fe72701, + 0xd2b8ee5f,0x06df4261,0xbb9e9b8a,0x7293ea25, + 0xce84ffdf,0xf5718801,0x3dd64b04,0xa26f263b, + 0x7ed48400,0x547eebe6,0x446d4ca0,0x6cf3d6f5, + 0x2649abdf,0xaea0c7f5,0x36338cc1,0x503f7e93, + 0xd3772061,0x11b638e1,0x72500e03,0xf80eb2bb, + 0xabe0502e,0xec8d77de,0x57971e81,0xe14f6746, + 0xc9335400,0x6920318f,0x081dbb99,0xffc304a5, + 0x4d351805,0x7f3d5ce3,0xa6c866c6,0x5d5bcca9, + 0xdaec6fea,0x9f926f91,0x9f46222f,0x3991467d, + 0xa5bf6d8e,0x1143c44f,0x43958302,0xd0214eeb, + 0x022083b8,0x3fb6180c,0x18f8931e,0x281658e6, + 0x26486e3e,0x8bd78a70,0x7477e4c1,0xb506e07c, + 0xf32d0a25,0x79098b02,0xe4eabb81,0x28123b23, + 0x69dead38,0x1574ca16,0xdf871b62,0x211c40b7, + 0xa51a9ef9,0x0014377b,0x041e8ac8,0x09114003, + 0xbd59e4d2,0xe3d156d5,0x4fe876d5,0x2f91a340, + 0x557be8de,0x00eae4a7,0x0ce5c2ec,0x4db4bba6, + 0xe756bdff,0xdd3369ac,0xec17b035,0x06572327, + 0x99afc8b0,0x56c8c391,0x6b65811c,0x5e146119, + 0x6e85cb75,0xbe07c002,0xc2325577,0x893ff4ec, + 0x5bbfc92d,0xd0ec3b25,0xb7801ab7,0x8d6d3b24, + 0x20c763ef,0xc366a5fc,0x9c382880,0x0ace3205, + 0xaac9548a,0xeca1d7c7,0x041afa32,0x1d16625a, + 0x6701902c,0x9b757a54,0x31d477f7,0x9126b031, + 0x36cc6fdb,0xc70b8b46,0xd9e66a48,0x56e55a79, + 0x026a4ceb,0x52437eff,0x2f8f76b4,0x0df980a5, + 0x8674cde3,0xedda04eb,0x17a9be04,0x2c18f4df, + 0xb7747f9d,0xab2af7b4,0xefc34d20,0x2e096b7c, + 0x1741a254,0xe5b6a035,0x213d42f6,0x2c1c7c26, + 0x61c2f50f,0x6552daf9,0xd2c231f8,0x25130f69, + 0xd8167fa2,0x0418f2c8,0x001a96a6,0x0d1526ab, + 0x63315c21,0x5e0a72ec,0x49bafefd,0x187908d9, + 0x8d0dbd86,0x311170a7,0x3e9b640c,0xcc3e10d7, + 0xd5cad3b6,0x0caec388,0xf73001e1,0x6c728aff, + 0x71eae2a1,0x1f9af36e,0xcfcbd12f,0xc1de8417, + 0xac07be6b,0xcb44a1d8,0x8b9b0f56,0x013988c3, + 0xb1c52fca,0xb4be31cd,0xd8782806,0x12a3a4e2, + 0x6f7de532,0x58fd7eb6,0xd01ee900,0x24adffc2, + 0xf4990fc5,0x9711aac5,0x001d7b95,0x82e5e7d2, + 0x109873f6,0x00613096,0xc32d9521,0xada121ff, + 0x29908415,0x7fbb977f,0xaf9eb3db,0x29c9ed2a, + 0x5ce2a465,0xa730f32c,0xd0aa3fe8,0x8a5cc091, + 0xd49e2ce7,0x0ce454a9,0xd60acd86,0x015f1919, + 0x77079103,0xdea03af6,0x78a8565e,0xdee356df, + 0x21f05cbe,0x8b75e387,0xb3c50651,0xb8a5c3ef, + 0xd8eeb6d2,0xe523be77,0xc2154529,0x2f69efdf, + 0xafe67afb,0xf470c4b2,0xf3e0eb5b,0xd6cc9876, + 0x39e4460c,0x1fda8538,0x1987832f,0xca007367, + 0xa99144f8,0x296b299e,0x492fc295,0x9266beab, + 0xb5676e69,0x9bd3ddda,0xdf7e052f,0xdb25701c, + 0x1b5e51ee,0xf65324e6,0x6afce36c,0x0316cc04, + 0x8644213e,0xb7dc59d0,0x7965291f,0xccd6fd43, + 0x41823979,0x932bcdf6,0xb657c34d,0x4edfd282, + 0x7ae5290c,0x3cb9536b,0x851e20fe,0x9833557e, + 0x13ecf0b0,0xd3ffb372,0x3f85c5c1,0x0aef7ed2, + }; +CAST_LONG CAST_S_table4[256]={ + 0x7ec90c04,0x2c6e74b9,0x9b0e66df,0xa6337911, + 0xb86a7fff,0x1dd358f5,0x44dd9d44,0x1731167f, + 0x08fbf1fa,0xe7f511cc,0xd2051b00,0x735aba00, + 0x2ab722d8,0x386381cb,0xacf6243a,0x69befd7a, + 0xe6a2e77f,0xf0c720cd,0xc4494816,0xccf5c180, + 0x38851640,0x15b0a848,0xe68b18cb,0x4caadeff, + 0x5f480a01,0x0412b2aa,0x259814fc,0x41d0efe2, + 0x4e40b48d,0x248eb6fb,0x8dba1cfe,0x41a99b02, + 0x1a550a04,0xba8f65cb,0x7251f4e7,0x95a51725, + 0xc106ecd7,0x97a5980a,0xc539b9aa,0x4d79fe6a, + 0xf2f3f763,0x68af8040,0xed0c9e56,0x11b4958b, + 0xe1eb5a88,0x8709e6b0,0xd7e07156,0x4e29fea7, + 0x6366e52d,0x02d1c000,0xc4ac8e05,0x9377f571, + 0x0c05372a,0x578535f2,0x2261be02,0xd642a0c9, + 0xdf13a280,0x74b55bd2,0x682199c0,0xd421e5ec, + 0x53fb3ce8,0xc8adedb3,0x28a87fc9,0x3d959981, + 0x5c1ff900,0xfe38d399,0x0c4eff0b,0x062407ea, + 0xaa2f4fb1,0x4fb96976,0x90c79505,0xb0a8a774, + 0xef55a1ff,0xe59ca2c2,0xa6b62d27,0xe66a4263, + 0xdf65001f,0x0ec50966,0xdfdd55bc,0x29de0655, + 0x911e739a,0x17af8975,0x32c7911c,0x89f89468, + 0x0d01e980,0x524755f4,0x03b63cc9,0x0cc844b2, + 0xbcf3f0aa,0x87ac36e9,0xe53a7426,0x01b3d82b, + 0x1a9e7449,0x64ee2d7e,0xcddbb1da,0x01c94910, + 0xb868bf80,0x0d26f3fd,0x9342ede7,0x04a5c284, + 0x636737b6,0x50f5b616,0xf24766e3,0x8eca36c1, + 0x136e05db,0xfef18391,0xfb887a37,0xd6e7f7d4, + 0xc7fb7dc9,0x3063fcdf,0xb6f589de,0xec2941da, + 0x26e46695,0xb7566419,0xf654efc5,0xd08d58b7, + 0x48925401,0xc1bacb7f,0xe5ff550f,0xb6083049, + 0x5bb5d0e8,0x87d72e5a,0xab6a6ee1,0x223a66ce, + 0xc62bf3cd,0x9e0885f9,0x68cb3e47,0x086c010f, + 0xa21de820,0xd18b69de,0xf3f65777,0xfa02c3f6, + 0x407edac3,0xcbb3d550,0x1793084d,0xb0d70eba, + 0x0ab378d5,0xd951fb0c,0xded7da56,0x4124bbe4, + 0x94ca0b56,0x0f5755d1,0xe0e1e56e,0x6184b5be, + 0x580a249f,0x94f74bc0,0xe327888e,0x9f7b5561, + 0xc3dc0280,0x05687715,0x646c6bd7,0x44904db3, + 0x66b4f0a3,0xc0f1648a,0x697ed5af,0x49e92ff6, + 0x309e374f,0x2cb6356a,0x85808573,0x4991f840, + 0x76f0ae02,0x083be84d,0x28421c9a,0x44489406, + 0x736e4cb8,0xc1092910,0x8bc95fc6,0x7d869cf4, + 0x134f616f,0x2e77118d,0xb31b2be1,0xaa90b472, + 0x3ca5d717,0x7d161bba,0x9cad9010,0xaf462ba2, + 0x9fe459d2,0x45d34559,0xd9f2da13,0xdbc65487, + 0xf3e4f94e,0x176d486f,0x097c13ea,0x631da5c7, + 0x445f7382,0x175683f4,0xcdc66a97,0x70be0288, + 0xb3cdcf72,0x6e5dd2f3,0x20936079,0x459b80a5, + 0xbe60e2db,0xa9c23101,0xeba5315c,0x224e42f2, + 0x1c5c1572,0xf6721b2c,0x1ad2fff3,0x8c25404e, + 0x324ed72f,0x4067b7fd,0x0523138e,0x5ca3bc78, + 0xdc0fd66e,0x75922283,0x784d6b17,0x58ebb16e, + 0x44094f85,0x3f481d87,0xfcfeae7b,0x77b5ff76, + 0x8c2302bf,0xaaf47556,0x5f46b02a,0x2b092801, + 0x3d38f5f7,0x0ca81f36,0x52af4a8a,0x66d5e7c0, + 0xdf3b0874,0x95055110,0x1b5ad7a8,0xf61ed5ad, + 0x6cf6e479,0x20758184,0xd0cefa65,0x88f7be58, + 0x4a046826,0x0ff6f8f3,0xa09c7f70,0x5346aba0, + 0x5ce96c28,0xe176eda3,0x6bac307f,0x376829d2, + 0x85360fa9,0x17e3fe2a,0x24b79767,0xf5a96b20, + 0xd6cd2595,0x68ff1ebf,0x7555442c,0xf19f06be, + 0xf9e0659a,0xeeb9491d,0x34010718,0xbb30cab8, + 0xe822fe15,0x88570983,0x750e6249,0xda627e55, + 0x5e76ffa8,0xb1534546,0x6d47de08,0xefe9e7d4, + }; +CAST_LONG CAST_S_table5[256]={ + 0xf6fa8f9d,0x2cac6ce1,0x4ca34867,0xe2337f7c, + 0x95db08e7,0x016843b4,0xeced5cbc,0x325553ac, + 0xbf9f0960,0xdfa1e2ed,0x83f0579d,0x63ed86b9, + 0x1ab6a6b8,0xde5ebe39,0xf38ff732,0x8989b138, + 0x33f14961,0xc01937bd,0xf506c6da,0xe4625e7e, + 0xa308ea99,0x4e23e33c,0x79cbd7cc,0x48a14367, + 0xa3149619,0xfec94bd5,0xa114174a,0xeaa01866, + 0xa084db2d,0x09a8486f,0xa888614a,0x2900af98, + 0x01665991,0xe1992863,0xc8f30c60,0x2e78ef3c, + 0xd0d51932,0xcf0fec14,0xf7ca07d2,0xd0a82072, + 0xfd41197e,0x9305a6b0,0xe86be3da,0x74bed3cd, + 0x372da53c,0x4c7f4448,0xdab5d440,0x6dba0ec3, + 0x083919a7,0x9fbaeed9,0x49dbcfb0,0x4e670c53, + 0x5c3d9c01,0x64bdb941,0x2c0e636a,0xba7dd9cd, + 0xea6f7388,0xe70bc762,0x35f29adb,0x5c4cdd8d, + 0xf0d48d8c,0xb88153e2,0x08a19866,0x1ae2eac8, + 0x284caf89,0xaa928223,0x9334be53,0x3b3a21bf, + 0x16434be3,0x9aea3906,0xefe8c36e,0xf890cdd9, + 0x80226dae,0xc340a4a3,0xdf7e9c09,0xa694a807, + 0x5b7c5ecc,0x221db3a6,0x9a69a02f,0x68818a54, + 0xceb2296f,0x53c0843a,0xfe893655,0x25bfe68a, + 0xb4628abc,0xcf222ebf,0x25ac6f48,0xa9a99387, + 0x53bddb65,0xe76ffbe7,0xe967fd78,0x0ba93563, + 0x8e342bc1,0xe8a11be9,0x4980740d,0xc8087dfc, + 0x8de4bf99,0xa11101a0,0x7fd37975,0xda5a26c0, + 0xe81f994f,0x9528cd89,0xfd339fed,0xb87834bf, + 0x5f04456d,0x22258698,0xc9c4c83b,0x2dc156be, + 0x4f628daa,0x57f55ec5,0xe2220abe,0xd2916ebf, + 0x4ec75b95,0x24f2c3c0,0x42d15d99,0xcd0d7fa0, + 0x7b6e27ff,0xa8dc8af0,0x7345c106,0xf41e232f, + 0x35162386,0xe6ea8926,0x3333b094,0x157ec6f2, + 0x372b74af,0x692573e4,0xe9a9d848,0xf3160289, + 0x3a62ef1d,0xa787e238,0xf3a5f676,0x74364853, + 0x20951063,0x4576698d,0xb6fad407,0x592af950, + 0x36f73523,0x4cfb6e87,0x7da4cec0,0x6c152daa, + 0xcb0396a8,0xc50dfe5d,0xfcd707ab,0x0921c42f, + 0x89dff0bb,0x5fe2be78,0x448f4f33,0x754613c9, + 0x2b05d08d,0x48b9d585,0xdc049441,0xc8098f9b, + 0x7dede786,0xc39a3373,0x42410005,0x6a091751, + 0x0ef3c8a6,0x890072d6,0x28207682,0xa9a9f7be, + 0xbf32679d,0xd45b5b75,0xb353fd00,0xcbb0e358, + 0x830f220a,0x1f8fb214,0xd372cf08,0xcc3c4a13, + 0x8cf63166,0x061c87be,0x88c98f88,0x6062e397, + 0x47cf8e7a,0xb6c85283,0x3cc2acfb,0x3fc06976, + 0x4e8f0252,0x64d8314d,0xda3870e3,0x1e665459, + 0xc10908f0,0x513021a5,0x6c5b68b7,0x822f8aa0, + 0x3007cd3e,0x74719eef,0xdc872681,0x073340d4, + 0x7e432fd9,0x0c5ec241,0x8809286c,0xf592d891, + 0x08a930f6,0x957ef305,0xb7fbffbd,0xc266e96f, + 0x6fe4ac98,0xb173ecc0,0xbc60b42a,0x953498da, + 0xfba1ae12,0x2d4bd736,0x0f25faab,0xa4f3fceb, + 0xe2969123,0x257f0c3d,0x9348af49,0x361400bc, + 0xe8816f4a,0x3814f200,0xa3f94043,0x9c7a54c2, + 0xbc704f57,0xda41e7f9,0xc25ad33a,0x54f4a084, + 0xb17f5505,0x59357cbe,0xedbd15c8,0x7f97c5ab, + 0xba5ac7b5,0xb6f6deaf,0x3a479c3a,0x5302da25, + 0x653d7e6a,0x54268d49,0x51a477ea,0x5017d55b, + 0xd7d25d88,0x44136c76,0x0404a8c8,0xb8e5a121, + 0xb81a928a,0x60ed5869,0x97c55b96,0xeaec991b, + 0x29935913,0x01fdb7f1,0x088e8dfa,0x9ab6f6f5, + 0x3b4cbf9f,0x4a5de3ab,0xe6051d35,0xa0e1d855, + 0xd36b4cf1,0xf544edeb,0xb0e93524,0xbebb8fbd, + 0xa2d762cf,0x49c92f54,0x38b5f331,0x7128a454, + 0x48392905,0xa65b1db8,0x851c97bd,0xd675cf2f, + }; +CAST_LONG CAST_S_table6[256]={ + 0x85e04019,0x332bf567,0x662dbfff,0xcfc65693, + 0x2a8d7f6f,0xab9bc912,0xde6008a1,0x2028da1f, + 0x0227bce7,0x4d642916,0x18fac300,0x50f18b82, + 0x2cb2cb11,0xb232e75c,0x4b3695f2,0xb28707de, + 0xa05fbcf6,0xcd4181e9,0xe150210c,0xe24ef1bd, + 0xb168c381,0xfde4e789,0x5c79b0d8,0x1e8bfd43, + 0x4d495001,0x38be4341,0x913cee1d,0x92a79c3f, + 0x089766be,0xbaeeadf4,0x1286becf,0xb6eacb19, + 0x2660c200,0x7565bde4,0x64241f7a,0x8248dca9, + 0xc3b3ad66,0x28136086,0x0bd8dfa8,0x356d1cf2, + 0x107789be,0xb3b2e9ce,0x0502aa8f,0x0bc0351e, + 0x166bf52a,0xeb12ff82,0xe3486911,0xd34d7516, + 0x4e7b3aff,0x5f43671b,0x9cf6e037,0x4981ac83, + 0x334266ce,0x8c9341b7,0xd0d854c0,0xcb3a6c88, + 0x47bc2829,0x4725ba37,0xa66ad22b,0x7ad61f1e, + 0x0c5cbafa,0x4437f107,0xb6e79962,0x42d2d816, + 0x0a961288,0xe1a5c06e,0x13749e67,0x72fc081a, + 0xb1d139f7,0xf9583745,0xcf19df58,0xbec3f756, + 0xc06eba30,0x07211b24,0x45c28829,0xc95e317f, + 0xbc8ec511,0x38bc46e9,0xc6e6fa14,0xbae8584a, + 0xad4ebc46,0x468f508b,0x7829435f,0xf124183b, + 0x821dba9f,0xaff60ff4,0xea2c4e6d,0x16e39264, + 0x92544a8b,0x009b4fc3,0xaba68ced,0x9ac96f78, + 0x06a5b79a,0xb2856e6e,0x1aec3ca9,0xbe838688, + 0x0e0804e9,0x55f1be56,0xe7e5363b,0xb3a1f25d, + 0xf7debb85,0x61fe033c,0x16746233,0x3c034c28, + 0xda6d0c74,0x79aac56c,0x3ce4e1ad,0x51f0c802, + 0x98f8f35a,0x1626a49f,0xeed82b29,0x1d382fe3, + 0x0c4fb99a,0xbb325778,0x3ec6d97b,0x6e77a6a9, + 0xcb658b5c,0xd45230c7,0x2bd1408b,0x60c03eb7, + 0xb9068d78,0xa33754f4,0xf430c87d,0xc8a71302, + 0xb96d8c32,0xebd4e7be,0xbe8b9d2d,0x7979fb06, + 0xe7225308,0x8b75cf77,0x11ef8da4,0xe083c858, + 0x8d6b786f,0x5a6317a6,0xfa5cf7a0,0x5dda0033, + 0xf28ebfb0,0xf5b9c310,0xa0eac280,0x08b9767a, + 0xa3d9d2b0,0x79d34217,0x021a718d,0x9ac6336a, + 0x2711fd60,0x438050e3,0x069908a8,0x3d7fedc4, + 0x826d2bef,0x4eeb8476,0x488dcf25,0x36c9d566, + 0x28e74e41,0xc2610aca,0x3d49a9cf,0xbae3b9df, + 0xb65f8de6,0x92aeaf64,0x3ac7d5e6,0x9ea80509, + 0xf22b017d,0xa4173f70,0xdd1e16c3,0x15e0d7f9, + 0x50b1b887,0x2b9f4fd5,0x625aba82,0x6a017962, + 0x2ec01b9c,0x15488aa9,0xd716e740,0x40055a2c, + 0x93d29a22,0xe32dbf9a,0x058745b9,0x3453dc1e, + 0xd699296e,0x496cff6f,0x1c9f4986,0xdfe2ed07, + 0xb87242d1,0x19de7eae,0x053e561a,0x15ad6f8c, + 0x66626c1c,0x7154c24c,0xea082b2a,0x93eb2939, + 0x17dcb0f0,0x58d4f2ae,0x9ea294fb,0x52cf564c, + 0x9883fe66,0x2ec40581,0x763953c3,0x01d6692e, + 0xd3a0c108,0xa1e7160e,0xe4f2dfa6,0x693ed285, + 0x74904698,0x4c2b0edd,0x4f757656,0x5d393378, + 0xa132234f,0x3d321c5d,0xc3f5e194,0x4b269301, + 0xc79f022f,0x3c997e7e,0x5e4f9504,0x3ffafbbd, + 0x76f7ad0e,0x296693f4,0x3d1fce6f,0xc61e45be, + 0xd3b5ab34,0xf72bf9b7,0x1b0434c0,0x4e72b567, + 0x5592a33d,0xb5229301,0xcfd2a87f,0x60aeb767, + 0x1814386b,0x30bcc33d,0x38a0c07d,0xfd1606f2, + 0xc363519b,0x589dd390,0x5479f8e6,0x1cb8d647, + 0x97fd61a9,0xea7759f4,0x2d57539d,0x569a58cf, + 0xe84e63ad,0x462e1b78,0x6580f87e,0xf3817914, + 0x91da55f4,0x40a230f3,0xd1988f35,0xb6e318d2, + 0x3ffa50bc,0x3d40f021,0xc3c0bdae,0x4958c24c, + 0x518f36b2,0x84b1d370,0x0fedce83,0x878ddada, + 0xf2a279c7,0x94e01be8,0x90716f4b,0x954b8aa3, + }; +CAST_LONG CAST_S_table7[256]={ + 0xe216300d,0xbbddfffc,0xa7ebdabd,0x35648095, + 0x7789f8b7,0xe6c1121b,0x0e241600,0x052ce8b5, + 0x11a9cfb0,0xe5952f11,0xece7990a,0x9386d174, + 0x2a42931c,0x76e38111,0xb12def3a,0x37ddddfc, + 0xde9adeb1,0x0a0cc32c,0xbe197029,0x84a00940, + 0xbb243a0f,0xb4d137cf,0xb44e79f0,0x049eedfd, + 0x0b15a15d,0x480d3168,0x8bbbde5a,0x669ded42, + 0xc7ece831,0x3f8f95e7,0x72df191b,0x7580330d, + 0x94074251,0x5c7dcdfa,0xabbe6d63,0xaa402164, + 0xb301d40a,0x02e7d1ca,0x53571dae,0x7a3182a2, + 0x12a8ddec,0xfdaa335d,0x176f43e8,0x71fb46d4, + 0x38129022,0xce949ad4,0xb84769ad,0x965bd862, + 0x82f3d055,0x66fb9767,0x15b80b4e,0x1d5b47a0, + 0x4cfde06f,0xc28ec4b8,0x57e8726e,0x647a78fc, + 0x99865d44,0x608bd593,0x6c200e03,0x39dc5ff6, + 0x5d0b00a3,0xae63aff2,0x7e8bd632,0x70108c0c, + 0xbbd35049,0x2998df04,0x980cf42a,0x9b6df491, + 0x9e7edd53,0x06918548,0x58cb7e07,0x3b74ef2e, + 0x522fffb1,0xd24708cc,0x1c7e27cd,0xa4eb215b, + 0x3cf1d2e2,0x19b47a38,0x424f7618,0x35856039, + 0x9d17dee7,0x27eb35e6,0xc9aff67b,0x36baf5b8, + 0x09c467cd,0xc18910b1,0xe11dbf7b,0x06cd1af8, + 0x7170c608,0x2d5e3354,0xd4de495a,0x64c6d006, + 0xbcc0c62c,0x3dd00db3,0x708f8f34,0x77d51b42, + 0x264f620f,0x24b8d2bf,0x15c1b79e,0x46a52564, + 0xf8d7e54e,0x3e378160,0x7895cda5,0x859c15a5, + 0xe6459788,0xc37bc75f,0xdb07ba0c,0x0676a3ab, + 0x7f229b1e,0x31842e7b,0x24259fd7,0xf8bef472, + 0x835ffcb8,0x6df4c1f2,0x96f5b195,0xfd0af0fc, + 0xb0fe134c,0xe2506d3d,0x4f9b12ea,0xf215f225, + 0xa223736f,0x9fb4c428,0x25d04979,0x34c713f8, + 0xc4618187,0xea7a6e98,0x7cd16efc,0x1436876c, + 0xf1544107,0xbedeee14,0x56e9af27,0xa04aa441, + 0x3cf7c899,0x92ecbae6,0xdd67016d,0x151682eb, + 0xa842eedf,0xfdba60b4,0xf1907b75,0x20e3030f, + 0x24d8c29e,0xe139673b,0xefa63fb8,0x71873054, + 0xb6f2cf3b,0x9f326442,0xcb15a4cc,0xb01a4504, + 0xf1e47d8d,0x844a1be5,0xbae7dfdc,0x42cbda70, + 0xcd7dae0a,0x57e85b7a,0xd53f5af6,0x20cf4d8c, + 0xcea4d428,0x79d130a4,0x3486ebfb,0x33d3cddc, + 0x77853b53,0x37effcb5,0xc5068778,0xe580b3e6, + 0x4e68b8f4,0xc5c8b37e,0x0d809ea2,0x398feb7c, + 0x132a4f94,0x43b7950e,0x2fee7d1c,0x223613bd, + 0xdd06caa2,0x37df932b,0xc4248289,0xacf3ebc3, + 0x5715f6b7,0xef3478dd,0xf267616f,0xc148cbe4, + 0x9052815e,0x5e410fab,0xb48a2465,0x2eda7fa4, + 0xe87b40e4,0xe98ea084,0x5889e9e1,0xefd390fc, + 0xdd07d35b,0xdb485694,0x38d7e5b2,0x57720101, + 0x730edebc,0x5b643113,0x94917e4f,0x503c2fba, + 0x646f1282,0x7523d24a,0xe0779695,0xf9c17a8f, + 0x7a5b2121,0xd187b896,0x29263a4d,0xba510cdf, + 0x81f47c9f,0xad1163ed,0xea7b5965,0x1a00726e, + 0x11403092,0x00da6d77,0x4a0cdd61,0xad1f4603, + 0x605bdfb0,0x9eedc364,0x22ebe6a8,0xcee7d28a, + 0xa0e736a0,0x5564a6b9,0x10853209,0xc7eb8f37, + 0x2de705ca,0x8951570f,0xdf09822b,0xbd691a6c, + 0xaa12e4f2,0x87451c0f,0xe0f6a27a,0x3ada4819, + 0x4cf1764f,0x0d771c2b,0x67cdb156,0x350d8384, + 0x5938fa0f,0x42399ef3,0x36997b07,0x0e84093d, + 0x4aa93e61,0x8360d87b,0x1fa98b0c,0x1149382c, + 0xe97625a5,0x0614d1b7,0x0e25244b,0x0c768347, + 0x589e8d82,0x0d2059d1,0xa466bb1e,0xf8da0a82, + 0x04f19130,0xba6e4ec0,0x99265164,0x1ee7230d, + 0x50b2ad80,0xeaee6801,0x8db2a283,0xea8bf59e, + }; diff --git a/src/utils/crypto/des.c b/src/utils/crypto/des.c new file mode 100644 index 00000000000..897cbdd52d4 --- /dev/null +++ b/src/utils/crypto/des.c @@ -0,0 +1,4 @@ +/* Deprecated/legacy */ + +#include "des.h" +#include "spr.h" diff --git a/src/utils/crypto/des.h b/src/utils/crypto/des.h new file mode 100644 index 00000000000..625c3f9dcd8 --- /dev/null +++ b/src/utils/crypto/des.h @@ -0,0 +1,292 @@ +/* Deprecated/legacy */ + +/* crypto/des/des.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify des.org since des.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_DES_H +#define HEADER_DES_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a + * %20 speed up (longs are 8 bytes, int's are 4). */ +#ifndef DES_LONG +#define DES_LONG uint32_t +#endif + +typedef unsigned char des_cblock[8]; +typedef struct des_ks_struct + { + union { + des_cblock _; + /* make sure things are correct size on machines with + * 8 byte longs */ + DES_LONG pad[2]; + } ks; + } des_key_schedule[16]; + +#define DES_KEY_SZ (sizeof(des_cblock)) +#define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) + +#define DES_ENCRYPT 1 +#define DES_DECRYPT 0 + +#define DES_CBC_MODE 0 +#define DES_PCBC_MODE 1 + +#define des_ecb2_encrypt(i,o,k1,k2,e) \ + des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) + +#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ + des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) + +#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ + des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) + +#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ + des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) + +#define C_Block des_cblock +#define Key_schedule des_key_schedule +#ifdef KERBEROS +#define ENCRYPT DES_ENCRYPT +#define DECRYPT DES_DECRYPT +#endif +#define KEY_SZ DES_KEY_SZ +#define string_to_key des_string_to_key +#define read_pw_string des_read_pw_string +#define random_key des_random_key +#define pcbc_encrypt des_pcbc_encrypt +#define set_key des_set_key +#define key_sched des_key_sched +#define ecb_encrypt des_ecb_encrypt +#define cbc_encrypt des_cbc_encrypt +#define ncbc_encrypt des_ncbc_encrypt +#define xcbc_encrypt des_xcbc_encrypt +#define cbc_cksum des_cbc_cksum +#define quad_cksum des_quad_cksum + +/* For compatibility with the MIT lib - eay 20/05/92 */ +typedef des_key_schedule bit_64; +#define des_fixup_key_parity des_set_odd_parity +#define des_check_key_parity check_parity + +extern int des_check_key; /* defaults to false */ +extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ + +/* The next line is used to disable full ANSI prototypes, if your + * compiler has problems with the prototypes, make sure this line always + * evaluates to true :-) */ +#if defined(MSDOS) || defined(__STDC__) +#undef NOPROTO +#endif +#ifndef NOPROTO +char *des_options(void); +void des_ecb3_encrypt(des_cblock *input,des_cblock *output, + des_key_schedule ks1,des_key_schedule ks2, + des_key_schedule ks3, int enc); +DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, + long length,des_key_schedule schedule,des_cblock *ivec); +void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec, + des_cblock *inw,des_cblock *outw,int enc); +void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, + long length,des_key_schedule schedule,des_cblock *ivec,int enc); +void des_ecb_encrypt(des_cblock *input,des_cblock *output, + des_key_schedule ks,int enc); +void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); +void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); +void des_encrypt3(DES_LONG *data, des_key_schedule ks1, + des_key_schedule ks2, des_key_schedule ks3); +void des_decrypt3(DES_LONG *data, des_key_schedule ks1, + des_key_schedule ks2, des_key_schedule ks3); +void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int enc); +void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int *num, int enc); +void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, + long length, des_key_schedule ks1, des_key_schedule ks2, + des_key_schedule ks3, des_cblock *ivec, int *num); + +void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), + des_cblock (*out_white)); + +int des_enc_read(int fd,char *buf,int len,des_key_schedule sched, + des_cblock *iv); +int des_enc_write(int fd,char *buf,int len,des_key_schedule sched, + des_cblock *iv); +char *des_fcrypt(const char *buf,const char *salt, char *ret); +char *des_crypt(const char *buf,const char *salt); +void des_ofb_encrypt(unsigned char *in,unsigned char *out, + int numbits,long length,des_key_schedule schedule,des_cblock *ivec); +void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, + des_key_schedule schedule,des_cblock *ivec,int enc); +DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, + long length,int out_count,des_cblock *seed); +void des_random_seed(des_cblock key); +void des_random_key(des_cblock ret); +int des_read_password(des_cblock *key,char *prompt,int verify); +int des_read_2passwords(des_cblock *key1,des_cblock *key2, + char *prompt,int verify); +int des_read_pw_string(char *buf,int length,char *prompt,int verify); +void des_set_odd_parity(des_cblock *key); +int des_is_weak_key(des_cblock *key); +int des_set_key(des_cblock *key,des_key_schedule schedule); +int des_key_sched(des_cblock *key,des_key_schedule schedule); +void des_string_to_key(char *str,des_cblock *key); +void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); +void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, + des_key_schedule schedule, des_cblock *ivec, int *num, int enc); +void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, + des_key_schedule schedule, des_cblock *ivec, int *num); +int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); + +/* Extra functions from Mark Murray */ +void des_cblock_print_file(des_cblock *cb, FILE *fp); +/* The following functions are not in the normal unix build or the + * SSLeay build. When using the SSLeay build, use RAND_seed() + * and RAND_bytes() instead. */ +int des_new_random_key(des_cblock *key); +void des_init_random_number_generator(des_cblock *key); +void des_set_random_generator_seed(des_cblock *key); +void des_set_sequence_number(des_cblock new_sequence_number); +void des_generate_random_block(des_cblock *block); + +#else + +char *des_options(); +void des_ecb3_encrypt(); +DES_LONG des_cbc_cksum(); +void des_cbc_encrypt(); +void des_ncbc_encrypt(); +void des_xcbc_encrypt(); +void des_cfb_encrypt(); +void des_ede3_cfb64_encrypt(); +void des_ede3_ofb64_encrypt(); +void des_ecb_encrypt(); +void des_encrypt(); +void des_encrypt2(); +void des_encrypt3(); +void des_decrypt3(); +void des_ede3_cbc_encrypt(); +int des_enc_read(); +int des_enc_write(); +char *des_fcrypt(); +#ifdef PERL5 +char *des_crypt(); +#else +char *crypt(); +#endif +void des_ofb_encrypt(); +void des_pcbc_encrypt(); +DES_LONG des_quad_cksum(); +void des_random_seed(); +void des_random_key(); +int des_read_password(); +int des_read_2passwords(); +int des_read_pw_string(); +void des_set_odd_parity(); +int des_is_weak_key(); +int des_set_key(); +int des_key_sched(); +void des_string_to_key(); +void des_string_to_2keys(); +void des_cfb64_encrypt(); +void des_ofb64_encrypt(); +int des_read_pw(); +void des_xwhite_in2out(); + +/* Extra functions from Mark Murray */ +void des_cblock_print_file(); +/* The following functions are not in the normal unix build or the + * SSLeay build. When using the SSLeay build, use RAND_seed() + * and RAND_bytes() instead. */ +#ifdef FreeBSD +int des_new_random_key(); +void des_init_random_number_generator(); +void des_set_random_generator_seed(); +void des_set_sequence_number(); +void des_generate_random_block(); +#endif + +#endif + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/src/utils/crypto/des_enc.c b/src/utils/crypto/des_enc.c new file mode 100644 index 00000000000..bb822afcd55 --- /dev/null +++ b/src/utils/crypto/des_enc.c @@ -0,0 +1,479 @@ +/* Deprecated/legacy */ + +/* crypto/des/des_enc.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + +#include "des_locl.h" +#include "../common/endian.h" + +void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc) + { + register DES_LONG l,r,t,u; +#ifdef DES_PTR + register unsigned char *des_SP=(unsigned char *)des_SPtrans; +#endif +#ifndef DES_UNROLL + register int i; +#endif + register DES_LONG *s; + + r=LE32(data[0]); + l=LE32(data[1]); + + IP(r,l); + /* Things have been modified so that the initial rotate is + * done outside the loop. This required the + * des_SPtrans values in sp.h to be rotated 1 bit to the right. + * One perl script later and things have a 5% speed up on a sparc2. + * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> + * for pointing this out. */ + /* clear the top bits on machines with 8byte longs */ + /* shift left by 2 */ + r=ROTATE(r,29)&0xffffffffL; + l=ROTATE(l,29)&0xffffffffL; + + s=(DES_LONG *)ks; + /* I don't know if it is worth the effort of loop unrolling the + * inner loop */ + if (enc) + { +#ifdef DES_UNROLL + D_ENCRYPT(l,r, 0); /* 1 */ + D_ENCRYPT(r,l, 2); /* 2 */ + D_ENCRYPT(l,r, 4); /* 3 */ + D_ENCRYPT(r,l, 6); /* 4 */ + D_ENCRYPT(l,r, 8); /* 5 */ + D_ENCRYPT(r,l,10); /* 6 */ + D_ENCRYPT(l,r,12); /* 7 */ + D_ENCRYPT(r,l,14); /* 8 */ + D_ENCRYPT(l,r,16); /* 9 */ + D_ENCRYPT(r,l,18); /* 10 */ + D_ENCRYPT(l,r,20); /* 11 */ + D_ENCRYPT(r,l,22); /* 12 */ + D_ENCRYPT(l,r,24); /* 13 */ + D_ENCRYPT(r,l,26); /* 14 */ + D_ENCRYPT(l,r,28); /* 15 */ + D_ENCRYPT(r,l,30); /* 16 */ +#else + for (i=0; i<32; i+=8) + { + D_ENCRYPT(l,r,i+0); /* 1 */ + D_ENCRYPT(r,l,i+2); /* 2 */ + D_ENCRYPT(l,r,i+4); /* 3 */ + D_ENCRYPT(r,l,i+6); /* 4 */ + } +#endif + } + else + { +#ifdef DES_UNROLL + D_ENCRYPT(l,r,30); /* 16 */ + D_ENCRYPT(r,l,28); /* 15 */ + D_ENCRYPT(l,r,26); /* 14 */ + D_ENCRYPT(r,l,24); /* 13 */ + D_ENCRYPT(l,r,22); /* 12 */ + D_ENCRYPT(r,l,20); /* 11 */ + D_ENCRYPT(l,r,18); /* 10 */ + D_ENCRYPT(r,l,16); /* 9 */ + D_ENCRYPT(l,r,14); /* 8 */ + D_ENCRYPT(r,l,12); /* 7 */ + D_ENCRYPT(l,r,10); /* 6 */ + D_ENCRYPT(r,l, 8); /* 5 */ + D_ENCRYPT(l,r, 6); /* 4 */ + D_ENCRYPT(r,l, 4); /* 3 */ + D_ENCRYPT(l,r, 2); /* 2 */ + D_ENCRYPT(r,l, 0); /* 1 */ +#else + for (i=30; i>0; i-=8) + { + D_ENCRYPT(l,r,i-0); /* 16 */ + D_ENCRYPT(r,l,i-2); /* 15 */ + D_ENCRYPT(l,r,i-4); /* 14 */ + D_ENCRYPT(r,l,i-6); /* 13 */ + } +#endif + } + + /* rotate and clear the top bits on machines with 8byte longs */ + l=ROTATE(l,3)&0xffffffffL; + r=ROTATE(r,3)&0xffffffffL; + + FP(r,l); + data[0]=LE32(l); + data[1]=LE32(r); + l=r=t=u=0; + } + +void des_encrypt2(DES_LONG *data, des_key_schedule ks, int enc) + { + register DES_LONG l,r,t,u; +#ifdef DES_PTR + register unsigned char *des_SP=(unsigned char *)des_SPtrans; +#endif +#ifndef DES_UNROLL + register int i; +#endif + register DES_LONG *s; + + r=data[0]; + l=data[1]; + + /* Things have been modified so that the initial rotate is + * done outside the loop. This required the + * des_SPtrans values in sp.h to be rotated 1 bit to the right. + * One perl script later and things have a 5% speed up on a sparc2. + * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> + * for pointing this out. */ + /* clear the top bits on machines with 8byte longs */ + r=ROTATE(r,29)&0xffffffffL; + l=ROTATE(l,29)&0xffffffffL; + + s=(DES_LONG *)ks; + /* I don't know if it is worth the effort of loop unrolling the + * inner loop */ + if (enc) + { +#ifdef DES_UNROLL + D_ENCRYPT(l,r, 0); /* 1 */ + D_ENCRYPT(r,l, 2); /* 2 */ + D_ENCRYPT(l,r, 4); /* 3 */ + D_ENCRYPT(r,l, 6); /* 4 */ + D_ENCRYPT(l,r, 8); /* 5 */ + D_ENCRYPT(r,l,10); /* 6 */ + D_ENCRYPT(l,r,12); /* 7 */ + D_ENCRYPT(r,l,14); /* 8 */ + D_ENCRYPT(l,r,16); /* 9 */ + D_ENCRYPT(r,l,18); /* 10 */ + D_ENCRYPT(l,r,20); /* 11 */ + D_ENCRYPT(r,l,22); /* 12 */ + D_ENCRYPT(l,r,24); /* 13 */ + D_ENCRYPT(r,l,26); /* 14 */ + D_ENCRYPT(l,r,28); /* 15 */ + D_ENCRYPT(r,l,30); /* 16 */ +#else + for (i=0; i<32; i+=8) + { + D_ENCRYPT(l,r,i+0); /* 1 */ + D_ENCRYPT(r,l,i+2); /* 2 */ + D_ENCRYPT(l,r,i+4); /* 3 */ + D_ENCRYPT(r,l,i+6); /* 4 */ + } +#endif + } + else + { +#ifdef DES_UNROLL + D_ENCRYPT(l,r,30); /* 16 */ + D_ENCRYPT(r,l,28); /* 15 */ + D_ENCRYPT(l,r,26); /* 14 */ + D_ENCRYPT(r,l,24); /* 13 */ + D_ENCRYPT(l,r,22); /* 12 */ + D_ENCRYPT(r,l,20); /* 11 */ + D_ENCRYPT(l,r,18); /* 10 */ + D_ENCRYPT(r,l,16); /* 9 */ + D_ENCRYPT(l,r,14); /* 8 */ + D_ENCRYPT(r,l,12); /* 7 */ + D_ENCRYPT(l,r,10); /* 6 */ + D_ENCRYPT(r,l, 8); /* 5 */ + D_ENCRYPT(l,r, 6); /* 4 */ + D_ENCRYPT(r,l, 4); /* 3 */ + D_ENCRYPT(l,r, 2); /* 2 */ + D_ENCRYPT(r,l, 0); /* 1 */ +#else + for (i=30; i>0; i-=8) + { + D_ENCRYPT(l,r,i-0); /* 16 */ + D_ENCRYPT(r,l,i-2); /* 15 */ + D_ENCRYPT(l,r,i-4); /* 14 */ + D_ENCRYPT(r,l,i-6); /* 13 */ + } +#endif + } + /* rotate and clear the top bits on machines with 8byte longs */ + data[0]=ROTATE(l,3)&0xffffffffL; + data[1]=ROTATE(r,3)&0xffffffffL; + l=r=t=u=0; + } + +void des_encrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3) + { + register DES_LONG l,r; + + l=data[0]; + r=data[1]; + IP(l,r); + data[0]=l; + data[1]=r; + des_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); + des_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); + des_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); + l=data[0]; + r=data[1]; + FP(r,l); + data[0]=l; + data[1]=r; + } + +void des_decrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3) + { + register DES_LONG l,r; + + l=data[0]; + r=data[1]; + IP(l,r); + data[0]=l; + data[1]=r; + des_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); + des_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); + des_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); + l=data[0]; + r=data[1]; + FP(r,l); + data[0]=l; + data[1]=r; + } + +#ifndef DES_DEFAULT_OPTIONS + +void des_ncbc_encrypt(des_cblock (*input), des_cblock (*output), long length, des_key_schedule schedule, des_cblock (*ivec), int enc) + { + register DES_LONG tin0,tin1; + register DES_LONG tout0,tout1,xor0,xor1; + register unsigned char *in,*out; + register long l=length; + DES_LONG tin[2]; + unsigned char *iv; + + in=(unsigned char *)input; + out=(unsigned char *)output; + iv=(unsigned char *)ivec; + + if (enc) + { + c2l(iv,tout0); + c2l(iv,tout1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + tin0^=tout0; tin[0]=tin0; + tin1^=tout1; tin[1]=tin1; + des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); + tout0=tin[0]; l2c(tout0,out); + tout1=tin[1]; l2c(tout1,out); + } + if (l != -8) + { + c2ln(in,tin0,tin1,l+8); + tin0^=tout0; tin[0]=tin0; + tin1^=tout1; tin[1]=tin1; + des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); + tout0=tin[0]; l2c(tout0,out); + tout1=tin[1]; l2c(tout1,out); + } + iv=(unsigned char *)ivec; + l2c(tout0,iv); + l2c(tout1,iv); + } + else + { + c2l(iv,xor0); + c2l(iv,xor1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); tin[0]=tin0; + c2l(in,tin1); tin[1]=tin1; + des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); + tout0=tin[0]^xor0; + tout1=tin[1]^xor1; + l2c(tout0,out); + l2c(tout1,out); + xor0=tin0; + xor1=tin1; + } + if (l != -8) + { + c2l(in,tin0); tin[0]=tin0; + c2l(in,tin1); tin[1]=tin1; + des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); + tout0=tin[0]^xor0; + tout1=tin[1]^xor1; + l2cn(tout0,tout1,out,l+8); + xor0=tin0; + xor1=tin1; + } + + iv=(unsigned char *)ivec; + l2c(xor0,iv); + l2c(xor1,iv); + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=0; + } + +void des_ede3_cbc_encrypt(des_cblock (*input), des_cblock (*output), long length, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3, des_cblock (*ivec), int enc) + { + register DES_LONG tin0,tin1; + register DES_LONG tout0,tout1,xor0,xor1; + register unsigned char *in,*out; + register long l=length; + DES_LONG tin[2]; + unsigned char *iv; + + in=(unsigned char *)input; + out=(unsigned char *)output; + iv=(unsigned char *)ivec; + + if (enc) + { + c2l(iv,tout0); + c2l(iv,tout1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + tin0^=tout0; + tin1^=tout1; + + tin[0]=tin0; + tin[1]=tin1; + des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + l2c(tout0,out); + l2c(tout1,out); + } + if (l != -8) + { + c2ln(in,tin0,tin1,l+8); + tin0^=tout0; + tin1^=tout1; + + tin[0]=tin0; + tin[1]=tin1; + des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + l2c(tout0,out); + l2c(tout1,out); + } + iv=(unsigned char *)ivec; + l2c(tout0,iv); + l2c(tout1,iv); + } + else + { + register DES_LONG t0,t1; + + c2l(iv,xor0); + c2l(iv,xor1); + for (l-=8; l>=0; l-=8) + { + c2l(in,tin0); + c2l(in,tin1); + + t0=tin0; + t1=tin1; + + tin[0]=tin0; + tin[1]=tin1; + des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + tout0^=xor0; + tout1^=xor1; + l2c(tout0,out); + l2c(tout1,out); + xor0=t0; + xor1=t1; + } + if (l != -8) + { + c2l(in,tin0); + c2l(in,tin1); + + t0=tin0; + t1=tin1; + + tin[0]=tin0; + tin[1]=tin1; + des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); + tout0=tin[0]; + tout1=tin[1]; + + tout0^=xor0; + tout1^=xor1; + l2cn(tout0,tout1,out,l+8); + xor0=t0; + xor1=t1; + } + + iv=(unsigned char *)ivec; + l2c(xor0,iv); + l2c(xor1,iv); + } + tin0=tin1=tout0=tout1=xor0=xor1=0; + tin[0]=tin[1]=0; + } + +#endif /* DES_DEFAULT_OPTIONS */ diff --git a/src/utils/crypto/des_locl.h b/src/utils/crypto/des_locl.h new file mode 100644 index 00000000000..116b41d958f --- /dev/null +++ b/src/utils/crypto/des_locl.h @@ -0,0 +1,518 @@ +/* Deprecated/legacy */ + +/* crypto/des/des_locl.org */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + * + * Always modify des_locl.org since des_locl.h is automatically generated from + * it during SSLeay configuration. + * + * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING + */ + +#ifndef HEADER_DES_LOCL_H +#define HEADER_DES_LOCL_H + +#if defined(WIN32) || defined(WIN16) +#ifndef MSDOS +#define MSDOS +#endif +#endif + +#include +#include +#ifndef MSDOS +#include +#endif +#include "des.h" + +#ifndef DES_DEFAULT_OPTIONS +/* the following is tweaked from a config script, that is why it is a + * protected undef/define */ +#ifndef DES_PTR +#define DES_PTR +#endif + +/* This helps C compiler generate the correct code for multiple functional + * units. It reduces register dependancies at the expense of 2 more + * registers */ +#ifndef DES_RISC1 +#define DES_RISC1 +#endif + +#ifndef DES_RISC2 +#undef DES_RISC2 +#endif + +#if defined(DES_RISC1) && defined(DES_RISC2) +YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! +#endif + +/* Unroll the inner loop, this sometimes helps, sometimes hinders. + * Very mucy CPU dependant */ +#ifndef DES_UNROLL +#define DES_UNROLL +#endif + +/* These default values were supplied by + * Peter Gutman + * They are only used if nothing else has been defined */ +#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) +/* Special defines which change the way the code is built depending on the + CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find + even newer MIPS CPU's, but at the moment one size fits all for + optimization options. Older Sparc's work better with only UNROLL, but + there's no way to tell at compile time what it is you're running on */ + +#if defined( sun ) /* Newer Sparc's */ + #define DES_PTR + #define DES_RISC1 + #define DES_UNROLL +#elif defined( __ultrix ) /* Older MIPS */ + #define DES_PTR + #define DES_RISC2 + #define DES_UNROLL +#elif defined( __osf1__ ) /* Alpha */ + #define DES_PTR + #define DES_RISC2 +#elif defined ( _AIX ) /* RS6000 */ + /* Unknown */ +#elif defined( __hpux ) /* HP-PA */ + /* Unknown */ +#elif defined( __aux ) /* 68K */ + /* Unknown */ +#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ + #define DES_UNROLL +#elif defined( __sgi ) /* Newer MIPS */ + #define DES_PTR + #define DES_RISC2 + #define DES_UNROLL +#elif defined( i386 ) /* x86 boxes, should be gcc */ + #define DES_PTR + #define DES_RISC1 + #define DES_UNROLL +#endif /* Systems-specific speed defines */ +#endif + +#endif /* DES_DEFAULT_OPTIONS */ + +#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ +#include +#include +#include +#include +#ifndef RAND +#define RAND +#endif +#undef NOPROTO +#endif + +#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) +#include +#endif + +#ifndef RAND +#define RAND +#endif + +#ifdef linux +#undef RAND +#endif + +#ifdef MSDOS +#define getpid() 2 +#define RAND +#undef NOPROTO +#endif + +#if defined(NOCONST) +#define const +#endif + +#ifdef __STDC__ +#undef NOPROTO +#endif + +#ifdef RAND +#define srandom(s) srand(s) +#define random rand +#endif + +#define ITERATIONS 16 +#define HALF_ITERATIONS 8 + +/* used in des_read and des_write */ +#define MAXWRITE (1024*16) +#define BSIZE (MAXWRITE+4) + +#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<<24L) + +/* NOTE - c is not incremented as per c2l */ +#define c2ln(c,l1,l2,n) { \ + c+=n; \ + l1=l2=0; \ + switch (n) { \ + case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ + case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ + case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ + case 5: l2|=((DES_LONG)(*(--(c)))); \ + case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ + case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ + case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ + case 1: l1|=((DES_LONG)(*(--(c)))); \ + } \ + } + +#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>24L)&0xff)) + +/* replacements for htonl and ntohl since I have no idea what to do + * when faced with machines with 8 byte longs. */ +#define HDRSIZE 4 + +#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ + l|=((DES_LONG)(*((c)++)))<<16L, \ + l|=((DES_LONG)(*((c)++)))<< 8L, \ + l|=((DES_LONG)(*((c)++)))) + +#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ + *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ + *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ + *((c)++)=(unsigned char)(((l) )&0xff)) + +/* NOTE - c is not incremented as per l2c */ +#define l2cn(l1,l2,c,n) { \ + c+=n; \ + switch (n) { \ + case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ + case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ + case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ + case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ + case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ + case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ + case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ + case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ + } \ + } + +//#if defined(WIN32) +//#define ROTATE(a,n) (_lrotr(a,n)) +//#else +#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) +//#endif + +/* Don't worry about the LOAD_DATA() stuff, that is used by + * fcrypt() to add it's little bit to the front */ + +#ifdef DES_FCRYPT + +#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ + { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } + +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + t=R^(R>>16L); \ + u=t&E0; t&=E1; \ + tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ + tmp=(t<<16); t^=R^s[S+1]; t^=tmp +#else +#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) +#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ + u=R^s[S ]; \ + t=R^s[S+1] +#endif + +/* The changes to this macro may help or hinder, depending on the + * compiler and the achitecture. gcc2 always seems to do well :-). + * Inspired by Dana How + * DO NOT use the alternative version on machines with 8 byte longs. + * It does not seem to work on the Alpha, even when DES_LONG is 4 + * bytes, probably an issue of accessing non-word aligned objects :-( */ +#ifdef DES_PTR + +/* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there + * is no reason to not xor all the sub items together. This potentially + * saves a register since things can be xored directly into L */ + +#if defined(DES_RISC1) || defined(DES_RISC2) +#ifdef DES_RISC1 +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + u>>=16L; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ + u3=(int)(u>>8L); \ + u1=(int)u&0xfc; \ + u3&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + t>>=16L; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ + u3=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u3&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); } +#endif +#ifdef DES_RISC2 +#define D_ENCRYPT(LL,R,S) { \ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u2=(int)u>>8L; \ + u1=(int)u&0xfc; \ + u2&=0xfc; \ + t=ROTATE(t,4); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ + s1=(int)(u>>16L); \ + s2=(int)(u>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \ + u2=(int)t>>8L; \ + u1=(int)t&0xfc; \ + u2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ + s1=(int)(t>>16L); \ + s2=(int)(t>>24L); \ + s1&=0xfc; \ + s2&=0xfc; \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \ + LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); } +#endif +#else +#define D_ENCRYPT(LL,R,S) { \ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^= \ + *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \ + *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); } +#endif + +#else /* original version */ + +#if defined(DES_RISC1) || defined(DES_RISC2) +#ifdef DES_RISC1 +#define D_ENCRYPT(LL,R,S) {\ + unsigned int u1,u2,u3; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + u>>=16L; \ + LL^=des_SPtrans[0][u1]; \ + LL^=des_SPtrans[2][u2]; \ + u3=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u3&=0x3f; \ + LL^=des_SPtrans[4][u1]; \ + LL^=des_SPtrans[6][u3]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + t>>=16L; \ + LL^=des_SPtrans[1][u1]; \ + LL^=des_SPtrans[3][u2]; \ + u3=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u3&=0x3f; \ + LL^=des_SPtrans[5][u1]; \ + LL^=des_SPtrans[7][u3]; } +#endif +#ifdef DES_RISC2 +#define D_ENCRYPT(LL,R,S) {\ + unsigned int u1,u2,s1,s2; \ + LOAD_DATA(R,S,u,t,E0,E1,u1); \ + u>>=2L; \ + t=ROTATE(t,6); \ + u2=(int)u>>8L; \ + u1=(int)u&0x3f; \ + u2&=0x3f; \ + LL^=des_SPtrans[0][u1]; \ + LL^=des_SPtrans[2][u2]; \ + s1=(int)u>>16L; \ + s2=(int)u>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=des_SPtrans[4][s1]; \ + LL^=des_SPtrans[6][s2]; \ + u2=(int)t>>8L; \ + u1=(int)t&0x3f; \ + u2&=0x3f; \ + LL^=des_SPtrans[1][u1]; \ + LL^=des_SPtrans[3][u2]; \ + s1=(int)t>>16; \ + s2=(int)t>>24L; \ + s1&=0x3f; \ + s2&=0x3f; \ + LL^=des_SPtrans[5][s1]; \ + LL^=des_SPtrans[7][s2]; } +#endif + +#else + +#define D_ENCRYPT(LL,R,S) {\ + LOAD_DATA_tmp(R,S,u,t,E0,E1); \ + t=ROTATE(t,4); \ + LL^=\ + des_SPtrans[0][(u>> 2L)&0x3f]^ \ + des_SPtrans[2][(u>>10L)&0x3f]^ \ + des_SPtrans[4][(u>>18L)&0x3f]^ \ + des_SPtrans[6][(u>>26L)&0x3f]^ \ + des_SPtrans[1][(t>> 2L)&0x3f]^ \ + des_SPtrans[3][(t>>10L)&0x3f]^ \ + des_SPtrans[5][(t>>18L)&0x3f]^ \ + des_SPtrans[7][(t>>26L)&0x3f]; } +#endif +#endif + + /* IP and FP + * The problem is more of a geometric problem that random bit fiddling. + 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 + 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 + 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 + 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 + + 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 + 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 + 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 + 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 + + The output has been subject to swaps of the form + 0 1 -> 3 1 but the odd and even bits have been put into + 2 3 2 0 + different words. The main trick is to remember that + t=((l>>size)^r)&(mask); + r^=t; + l^=(t<>(n))^(b))&(m)),\ + (b)^=(t),\ + (a)^=((t)<<(n))) + +#define IP(l,r) \ + { \ + register DES_LONG tt; \ + PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ + PERM_OP(l,r,tt,16,0x0000ffffL); \ + PERM_OP(r,l,tt, 2,0x33333333L); \ + PERM_OP(l,r,tt, 8,0x00ff00ffL); \ + PERM_OP(r,l,tt, 1,0x55555555L); \ + } + +#define FP(l,r) \ + { \ + register DES_LONG tt; \ + PERM_OP(l,r,tt, 1,0x55555555L); \ + PERM_OP(r,l,tt, 8,0x00ff00ffL); \ + PERM_OP(l,r,tt, 2,0x33333333L); \ + PERM_OP(r,l,tt,16,0x0000ffffL); \ + PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ + } + +extern const DES_LONG des_SPtrans[8][64]; + +#ifndef NOPROTO +void fcrypt_body(DES_LONG *out,des_key_schedule ks, + DES_LONG Eswap0, DES_LONG Eswap1); +#else +void fcrypt_body(); +#endif + +#endif diff --git a/src/utils/crypto/ecb3_enc.c b/src/utils/crypto/ecb3_enc.c new file mode 100644 index 00000000000..ff4661f6485 --- /dev/null +++ b/src/utils/crypto/ecb3_enc.c @@ -0,0 +1,84 @@ +/* Deprecated/legacy */ + +/* crypto/des/ecb3_enc.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +#include "des_locl.h" + + +void des_ecb3_encrypt(des_cblock (*input), des_cblock (*output), des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3, int enc) + { + register DES_LONG l0,l1; + register unsigned char *in,*out; + DES_LONG ll[2]; + + in=(unsigned char *)input; + out=(unsigned char *)output; + c2l(in,l0); + c2l(in,l1); + ll[0]=l0; + ll[1]=l1; + if (enc) + des_encrypt3(ll,ks1,ks2,ks3); + else + des_decrypt3(ll,ks1,ks2,ks3); + l0=ll[0]; + l1=ll[1]; + l2c(l0,out); + l2c(l1,out); + } diff --git a/src/utils/crypto/podd.h b/src/utils/crypto/podd.h new file mode 100644 index 00000000000..d4083b42877 --- /dev/null +++ b/src/utils/crypto/podd.h @@ -0,0 +1,77 @@ +/* Deprecated/legacy */ + +/* crypto/des/podd.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static const unsigned char odd_parity[256]={ + 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, + 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, + 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, + 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, + 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, + 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, + 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, +112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, +128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, +145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, +161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, +176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, +193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, +208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, +224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, +241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; diff --git a/src/utils/crypto/rmd160.c b/src/utils/crypto/rmd160.c new file mode 100644 index 00000000000..7a273022f89 --- /dev/null +++ b/src/utils/crypto/rmd160.c @@ -0,0 +1,510 @@ +/* + * Copyright (c) 2001 Markus Friedl. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +/* + * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", + * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, + * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf + */ + +/* Adapted by TrueCrypt Foundation */ + +#include "rmd160.h" +#include "../common/endian.h" +#include + +#define PUT_64BIT_LE(cp, value) do { \ + (cp)[7] = (unsigned char)((value) >> 56); \ + (cp)[6] = (unsigned char)((value) >> 48); \ + (cp)[5] = (unsigned char)((value) >> 40); \ + (cp)[4] = (unsigned char)((value) >> 32); \ + (cp)[3] = (unsigned char)((value) >> 24); \ + (cp)[2] = (unsigned char)((value) >> 16); \ + (cp)[1] = (unsigned char)((value) >> 8); \ + (cp)[0] = (unsigned char)(value); } while (0) + +#define PUT_32BIT_LE(cp, value) do { \ + (cp)[3] = (unsigned char)((value) >> 24); \ + (cp)[2] = (unsigned char)((value) >> 16); \ + (cp)[1] = (unsigned char)((value) >> 8); \ + (cp)[0] = (unsigned char)(value); } while (0) + +#define H0 0x67452301U +#define H1 0xEFCDAB89U +#define H2 0x98BADCFEU +#define H3 0x10325476U +#define H4 0xC3D2E1F0U + +#define K0 0x00000000U +#define K1 0x5A827999U +#define K2 0x6ED9EBA1U +#define K3 0x8F1BBCDCU +#define K4 0xA953FD4EU + +#define KK0 0x50A28BE6U +#define KK1 0x5C4DD124U +#define KK2 0x6D703EF3U +#define KK3 0x7A6D76E9U +#define KK4 0x00000000U + +/* rotate x left n bits. */ + +#if defined (_MSC_VER) && !defined (_DEBUG) +#include +# pragma intrinsic (_lrotl) +# define ROL(n, x) (_lrotl (x, n)) +#else +# define ROL(n, x) (((x) << (n)) | ((x) >> (32-(n)))) +#endif + +#define F0(x, y, z) ((x) ^ (y) ^ (z)) +#define F1(x, y, z) (((x) & (y)) | ((~x) & (z))) +#define F2(x, y, z) (((x) | (~y)) ^ (z)) +#define F3(x, y, z) (((x) & (z)) | ((y) & (~z))) +#define F4(x, y, z) ((x) ^ ((y) | (~z))) + +#define R(a, b, c, d, e, Fj, Kj, sj, rj) \ + do { \ + a = ROL(sj, a + Fj(b,c,d) + X(rj) + Kj) + e; \ + c = ROL(10, c); \ + } while(0) + +#define X(i) x[i] + +#ifndef TC_MINIMIZE_CODE_SIZE + +static u_char PADDING[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 +}; + +#else + +static u_char PADDING[64]; + +#endif + +void +RMD160Init(RMD160_CTX *ctx) +{ + ctx->count = 0; + ctx->state[0] = H0; + ctx->state[1] = H1; + ctx->state[2] = H2; + ctx->state[3] = H3; + ctx->state[4] = H4; + + PADDING[0] = 0x80; +} + +void +RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len) +{ + u_int32_t have, off, need; + u_char buf[64] = { 0 }; + + have = (uint32_t)((ctx->count/8) % 64); + need = 64 - have; + ctx->count += 8 * len; + off = 0; + + if (len >= need) { + if (have) { + memcpy(ctx->buffer + have, input, (size_t) need); + RMD160Transform(ctx->state, ctx->buffer); + off = need; + have = 0; + } + /* now the buffer is empty */ + while (off + 64 <= len) { + if ((len - off) < 64) { + memset(buf, 0x00, 64); + memcpy(buf, input + off, len - off); + RMD160Transform(ctx->state, buf); + } else + RMD160Transform(ctx->state, input + off); + off += 64; + } + } + if (off < len) + memcpy(ctx->buffer + have, input+off, (size_t) (len-off)); +} + +void RMD160Final(u_char digest[20], RMD160_CTX *ctx) +{ + int i; + u_char size[8]; + u_int32_t padlen; + +#ifndef TC_NO_COMPILER_INT64 + PUT_64BIT_LE(size, ctx->count); +#else + *(uint32_t *) (size + 4) = 0; + PUT_32BIT_LE(size, ctx->count); +#endif + /* + * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes + * for the size + */ + padlen = (uint32_t)(64 - ((ctx->count/8) % 64)); + if (padlen < 1 + 8) + padlen += 64; + RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ + RMD160Update(ctx, size, 8); + + if (digest != 0) + for (i = 0; i < 5; i++) + PUT_32BIT_LE(digest + i*4, ctx->state[i]); + + memset(ctx, 0, sizeof (*ctx)); +} + +#ifndef TC_MINIMIZE_CODE_SIZE + +void +RMD160Transform(u_int32_t state[5], const u_char block[64]) +{ + u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; + +#if BYTE_ORDER == LITTLE_ENDIAN + memcpy(x, block, 64); +#else + int i; + + for (i = 0; i < 16; i++) + x[i] = (u_int32_t)( + (u_int32_t)(block[i*4 + 0]) | + (u_int32_t)(block[i*4 + 1]) << 8 | + (u_int32_t)(block[i*4 + 2]) << 16 | + (u_int32_t)(block[i*4 + 3]) << 24); +#endif + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + /* Round 1 */ + R(a, b, c, d, e, F0, K0, 11, 0); + R(e, a, b, c, d, F0, K0, 14, 1); + R(d, e, a, b, c, F0, K0, 15, 2); + R(c, d, e, a, b, F0, K0, 12, 3); + R(b, c, d, e, a, F0, K0, 5, 4); + R(a, b, c, d, e, F0, K0, 8, 5); + R(e, a, b, c, d, F0, K0, 7, 6); + R(d, e, a, b, c, F0, K0, 9, 7); + R(c, d, e, a, b, F0, K0, 11, 8); + R(b, c, d, e, a, F0, K0, 13, 9); + R(a, b, c, d, e, F0, K0, 14, 10); + R(e, a, b, c, d, F0, K0, 15, 11); + R(d, e, a, b, c, F0, K0, 6, 12); + R(c, d, e, a, b, F0, K0, 7, 13); + R(b, c, d, e, a, F0, K0, 9, 14); + R(a, b, c, d, e, F0, K0, 8, 15); /* #15 */ + /* Round 2 */ + R(e, a, b, c, d, F1, K1, 7, 7); + R(d, e, a, b, c, F1, K1, 6, 4); + R(c, d, e, a, b, F1, K1, 8, 13); + R(b, c, d, e, a, F1, K1, 13, 1); + R(a, b, c, d, e, F1, K1, 11, 10); + R(e, a, b, c, d, F1, K1, 9, 6); + R(d, e, a, b, c, F1, K1, 7, 15); + R(c, d, e, a, b, F1, K1, 15, 3); + R(b, c, d, e, a, F1, K1, 7, 12); + R(a, b, c, d, e, F1, K1, 12, 0); + R(e, a, b, c, d, F1, K1, 15, 9); + R(d, e, a, b, c, F1, K1, 9, 5); + R(c, d, e, a, b, F1, K1, 11, 2); + R(b, c, d, e, a, F1, K1, 7, 14); + R(a, b, c, d, e, F1, K1, 13, 11); + R(e, a, b, c, d, F1, K1, 12, 8); /* #31 */ + /* Round 3 */ + R(d, e, a, b, c, F2, K2, 11, 3); + R(c, d, e, a, b, F2, K2, 13, 10); + R(b, c, d, e, a, F2, K2, 6, 14); + R(a, b, c, d, e, F2, K2, 7, 4); + R(e, a, b, c, d, F2, K2, 14, 9); + R(d, e, a, b, c, F2, K2, 9, 15); + R(c, d, e, a, b, F2, K2, 13, 8); + R(b, c, d, e, a, F2, K2, 15, 1); + R(a, b, c, d, e, F2, K2, 14, 2); + R(e, a, b, c, d, F2, K2, 8, 7); + R(d, e, a, b, c, F2, K2, 13, 0); + R(c, d, e, a, b, F2, K2, 6, 6); + R(b, c, d, e, a, F2, K2, 5, 13); + R(a, b, c, d, e, F2, K2, 12, 11); + R(e, a, b, c, d, F2, K2, 7, 5); + R(d, e, a, b, c, F2, K2, 5, 12); /* #47 */ + /* Round 4 */ + R(c, d, e, a, b, F3, K3, 11, 1); + R(b, c, d, e, a, F3, K3, 12, 9); + R(a, b, c, d, e, F3, K3, 14, 11); + R(e, a, b, c, d, F3, K3, 15, 10); + R(d, e, a, b, c, F3, K3, 14, 0); + R(c, d, e, a, b, F3, K3, 15, 8); + R(b, c, d, e, a, F3, K3, 9, 12); + R(a, b, c, d, e, F3, K3, 8, 4); + R(e, a, b, c, d, F3, K3, 9, 13); + R(d, e, a, b, c, F3, K3, 14, 3); + R(c, d, e, a, b, F3, K3, 5, 7); + R(b, c, d, e, a, F3, K3, 6, 15); + R(a, b, c, d, e, F3, K3, 8, 14); + R(e, a, b, c, d, F3, K3, 6, 5); + R(d, e, a, b, c, F3, K3, 5, 6); + R(c, d, e, a, b, F3, K3, 12, 2); /* #63 */ + /* Round 5 */ + R(b, c, d, e, a, F4, K4, 9, 4); + R(a, b, c, d, e, F4, K4, 15, 0); + R(e, a, b, c, d, F4, K4, 5, 5); + R(d, e, a, b, c, F4, K4, 11, 9); + R(c, d, e, a, b, F4, K4, 6, 7); + R(b, c, d, e, a, F4, K4, 8, 12); + R(a, b, c, d, e, F4, K4, 13, 2); + R(e, a, b, c, d, F4, K4, 12, 10); + R(d, e, a, b, c, F4, K4, 5, 14); + R(c, d, e, a, b, F4, K4, 12, 1); + R(b, c, d, e, a, F4, K4, 13, 3); + R(a, b, c, d, e, F4, K4, 14, 8); + R(e, a, b, c, d, F4, K4, 11, 11); + R(d, e, a, b, c, F4, K4, 8, 6); + R(c, d, e, a, b, F4, K4, 5, 15); + R(b, c, d, e, a, F4, K4, 6, 13); /* #79 */ + + aa = a ; bb = b; cc = c; dd = d; ee = e; + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + /* Parallel round 1 */ + R(a, b, c, d, e, F4, KK0, 8, 5); + R(e, a, b, c, d, F4, KK0, 9, 14); + R(d, e, a, b, c, F4, KK0, 9, 7); + R(c, d, e, a, b, F4, KK0, 11, 0); + R(b, c, d, e, a, F4, KK0, 13, 9); + R(a, b, c, d, e, F4, KK0, 15, 2); + R(e, a, b, c, d, F4, KK0, 15, 11); + R(d, e, a, b, c, F4, KK0, 5, 4); + R(c, d, e, a, b, F4, KK0, 7, 13); + R(b, c, d, e, a, F4, KK0, 7, 6); + R(a, b, c, d, e, F4, KK0, 8, 15); + R(e, a, b, c, d, F4, KK0, 11, 8); + R(d, e, a, b, c, F4, KK0, 14, 1); + R(c, d, e, a, b, F4, KK0, 14, 10); + R(b, c, d, e, a, F4, KK0, 12, 3); + R(a, b, c, d, e, F4, KK0, 6, 12); /* #15 */ + /* Parallel round 2 */ + R(e, a, b, c, d, F3, KK1, 9, 6); + R(d, e, a, b, c, F3, KK1, 13, 11); + R(c, d, e, a, b, F3, KK1, 15, 3); + R(b, c, d, e, a, F3, KK1, 7, 7); + R(a, b, c, d, e, F3, KK1, 12, 0); + R(e, a, b, c, d, F3, KK1, 8, 13); + R(d, e, a, b, c, F3, KK1, 9, 5); + R(c, d, e, a, b, F3, KK1, 11, 10); + R(b, c, d, e, a, F3, KK1, 7, 14); + R(a, b, c, d, e, F3, KK1, 7, 15); + R(e, a, b, c, d, F3, KK1, 12, 8); + R(d, e, a, b, c, F3, KK1, 7, 12); + R(c, d, e, a, b, F3, KK1, 6, 4); + R(b, c, d, e, a, F3, KK1, 15, 9); + R(a, b, c, d, e, F3, KK1, 13, 1); + R(e, a, b, c, d, F3, KK1, 11, 2); /* #31 */ + /* Parallel round 3 */ + R(d, e, a, b, c, F2, KK2, 9, 15); + R(c, d, e, a, b, F2, KK2, 7, 5); + R(b, c, d, e, a, F2, KK2, 15, 1); + R(a, b, c, d, e, F2, KK2, 11, 3); + R(e, a, b, c, d, F2, KK2, 8, 7); + R(d, e, a, b, c, F2, KK2, 6, 14); + R(c, d, e, a, b, F2, KK2, 6, 6); + R(b, c, d, e, a, F2, KK2, 14, 9); + R(a, b, c, d, e, F2, KK2, 12, 11); + R(e, a, b, c, d, F2, KK2, 13, 8); + R(d, e, a, b, c, F2, KK2, 5, 12); + R(c, d, e, a, b, F2, KK2, 14, 2); + R(b, c, d, e, a, F2, KK2, 13, 10); + R(a, b, c, d, e, F2, KK2, 13, 0); + R(e, a, b, c, d, F2, KK2, 7, 4); + R(d, e, a, b, c, F2, KK2, 5, 13); /* #47 */ + /* Parallel round 4 */ + R(c, d, e, a, b, F1, KK3, 15, 8); + R(b, c, d, e, a, F1, KK3, 5, 6); + R(a, b, c, d, e, F1, KK3, 8, 4); + R(e, a, b, c, d, F1, KK3, 11, 1); + R(d, e, a, b, c, F1, KK3, 14, 3); + R(c, d, e, a, b, F1, KK3, 14, 11); + R(b, c, d, e, a, F1, KK3, 6, 15); + R(a, b, c, d, e, F1, KK3, 14, 0); + R(e, a, b, c, d, F1, KK3, 6, 5); + R(d, e, a, b, c, F1, KK3, 9, 12); + R(c, d, e, a, b, F1, KK3, 12, 2); + R(b, c, d, e, a, F1, KK3, 9, 13); + R(a, b, c, d, e, F1, KK3, 12, 9); + R(e, a, b, c, d, F1, KK3, 5, 7); + R(d, e, a, b, c, F1, KK3, 15, 10); + R(c, d, e, a, b, F1, KK3, 8, 14); /* #63 */ + /* Parallel round 5 */ + R(b, c, d, e, a, F0, KK4, 8, 12); + R(a, b, c, d, e, F0, KK4, 5, 15); + R(e, a, b, c, d, F0, KK4, 12, 10); + R(d, e, a, b, c, F0, KK4, 9, 4); + R(c, d, e, a, b, F0, KK4, 12, 1); + R(b, c, d, e, a, F0, KK4, 5, 5); + R(a, b, c, d, e, F0, KK4, 14, 8); + R(e, a, b, c, d, F0, KK4, 6, 7); + R(d, e, a, b, c, F0, KK4, 8, 6); + R(c, d, e, a, b, F0, KK4, 13, 2); + R(b, c, d, e, a, F0, KK4, 6, 13); + R(a, b, c, d, e, F0, KK4, 5, 14); + R(e, a, b, c, d, F0, KK4, 15, 0); + R(d, e, a, b, c, F0, KK4, 13, 3); + R(c, d, e, a, b, F0, KK4, 11, 9); + R(b, c, d, e, a, F0, KK4, 11, 11); /* #79 */ + + t = state[1] + cc + d; + state[1] = state[2] + dd + e; + state[2] = state[3] + ee + a; + state[3] = state[4] + aa + b; + state[4] = state[0] + bb + c; + state[0] = t; +} + +#else // TC_MINIMIZE_CODE_SIZE + +/* + Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. + + Governed by the TrueCrypt License 2.4 the full text of which is contained + in the file License.txt included in TrueCrypt binary and source code + distribution packages. +*/ + +#pragma optimize ("tl", on) + +typedef uint32_t uint32; +typedef unsigned __int8 byte; + +static const byte OrderTab[] = { + 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, + 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, + 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, + 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, + 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, + 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, + 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, + 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, + 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, + 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 +}; + +static const byte RolTab[] = { + 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, + 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, + 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, + 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, + 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, + 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, + 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, + 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, + 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, + 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 +}; + +static const uint32 KTab[] = { + 0x00000000UL, + 0x5A827999UL, + 0x6ED9EBA1UL, + 0x8F1BBCDCUL, + 0xA953FD4EUL, + 0x50A28BE6UL, + 0x5C4DD124UL, + 0x6D703EF3UL, + 0x7A6D76E9UL, + 0x00000000UL +}; + + +void RMD160Transform (u_int32_t state[5], const u_char block[64]) +{ + uint32 a, b, c, d, e; + uint32 a2, b2, c2, d2, e2; + uint32 *data = (uint32 *) block; + byte pos; + uint32 tmp; + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + + for (pos = 0; pos < 160; ++pos) + { + tmp = a + data[OrderTab[pos]] + KTab[pos >> 4]; + + switch (pos >> 4) + { + case 0: case 9: tmp += F0 (b, c, d); break; + case 1: case 8: tmp += F1 (b, c, d); break; + case 2: case 7: tmp += F2 (b, c, d); break; + case 3: case 6: tmp += F3 (b, c, d); break; + case 4: case 5: tmp += F4 (b, c, d); break; + } + + tmp = ROL (RolTab[pos], tmp) + e; + a = e; + e = d; + d = ROL (10, c); + c = b; + b = tmp; + + if (pos == 79) + { + a2 = a; + b2 = b; + c2 = c; + d2 = d; + e2 = e; + + a = state[0]; + b = state[1]; + c = state[2]; + d = state[3]; + e = state[4]; + } + } + + tmp = state[1] + c2 + d; + state[1] = state[2] + d2 + e; + state[2] = state[3] + e2 + a; + state[3] = state[4] + a2 + b; + state[4] = state[0] + b2 + c; + state[0] = tmp; +} + +#endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/utils/crypto/rmd160.h b/src/utils/crypto/rmd160.h new file mode 100644 index 00000000000..c97f65439c2 --- /dev/null +++ b/src/utils/crypto/rmd160.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2001 Markus Friedl. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +/* Adapted by TrueCrypt Foundation */ + +#ifndef _RMD160_H +#define _RMD160_H + +#include + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#ifndef u_int32_t +#define u_int32_t uint32_t +#define u_int64_t uint64_t +#define u_char uint8_t +#endif + +/* RMD160 context. */ +typedef struct RMD160Context { + u_int32_t state[5]; /* state */ +#ifndef TC_NO_COMPILER_INT64 + u_int64_t count; /* number of bits, modulo 2^64 */ +#else + u_int32_t count; +#endif + u_char buffer[64]; /* input buffer */ +} RMD160_CTX; + +void RMD160Init(RMD160_CTX *); +void RMD160Transform(u_int32_t [5], const u_char [64]); +void RMD160Update(RMD160_CTX *, const u_char *, u_int32_t); +void RMD160Final(u_char [20], RMD160_CTX *); + +#if defined(__cplusplus) +} +#endif + +#endif /* _RMD160_H */ diff --git a/src/utils/crypto/serpent.c b/src/utils/crypto/serpent.c new file mode 100644 index 00000000000..5edf17c3d23 --- /dev/null +++ b/src/utils/crypto/serpent.c @@ -0,0 +1,940 @@ +// serpent.cpp - written and placed in the public domain by Wei Dai + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + + +#include "serpent.h" +#include "../common/endian.h" + +#include + +#if defined(_WIN32) && !defined(_DEBUG) +#include +#define rotlFixed _rotl +#define rotrFixed _rotr +#else +#define rotlFixed(x,n) (((x) << (n)) | ((x) >> (32 - (n)))) +#define rotrFixed(x,n) (((x) >> (n)) | ((x) << (32 - (n)))) +#endif + +// linear transformation +#define LT(i,a,b,c,d,e) {\ + a = rotlFixed(a, 13); \ + c = rotlFixed(c, 3); \ + d = rotlFixed(d ^ c ^ (a << 3), 7); \ + b = rotlFixed(b ^ a ^ c, 1); \ + a = rotlFixed(a ^ b ^ d, 5); \ + c = rotlFixed(c ^ d ^ (b << 7), 22);} + +// inverse linear transformation +#define ILT(i,a,b,c,d,e) {\ + c = rotrFixed(c, 22); \ + a = rotrFixed(a, 5); \ + c ^= d ^ (b << 7); \ + a ^= b ^ d; \ + b = rotrFixed(b, 1); \ + d = rotrFixed(d, 7) ^ c ^ (a << 3); \ + b ^= a ^ c; \ + c = rotrFixed(c, 3); \ + a = rotrFixed(a, 13);} + +// order of output from S-box functions +#define beforeS0(f) f(0,a,b,c,d,e) +#define afterS0(f) f(1,b,e,c,a,d) +#define afterS1(f) f(2,c,b,a,e,d) +#define afterS2(f) f(3,a,e,b,d,c) +#define afterS3(f) f(4,e,b,d,c,a) +#define afterS4(f) f(5,b,a,e,c,d) +#define afterS5(f) f(6,a,c,b,e,d) +#define afterS6(f) f(7,a,c,d,b,e) +#define afterS7(f) f(8,d,e,b,a,c) + +// order of output from inverse S-box functions +#define beforeI7(f) f(8,a,b,c,d,e) +#define afterI7(f) f(7,d,a,b,e,c) +#define afterI6(f) f(6,a,b,c,e,d) +#define afterI5(f) f(5,b,d,e,c,a) +#define afterI4(f) f(4,b,c,e,a,d) +#define afterI3(f) f(3,a,b,e,c,d) +#define afterI2(f) f(2,b,d,e,c,a) +#define afterI1(f) f(1,a,b,c,e,d) +#define afterI0(f) f(0,a,d,b,e,c) + +// The instruction sequences for the S-box functions +// come from Dag Arne Osvik's paper "Speeding up Serpent". + +#define S0(i, r0, r1, r2, r3, r4) \ + { \ + r3 ^= r0; \ + r4 = r1; \ + r1 &= r3; \ + r4 ^= r2; \ + r1 ^= r0; \ + r0 |= r3; \ + r0 ^= r4; \ + r4 ^= r3; \ + r3 ^= r2; \ + r2 |= r1; \ + r2 ^= r4; \ + r4 = ~r4; \ + r4 |= r1; \ + r1 ^= r3; \ + r1 ^= r4; \ + r3 |= r0; \ + r1 ^= r3; \ + r4 ^= r3; \ + } + +#define I0(i, r0, r1, r2, r3, r4) \ + { \ + r2 = ~r2; \ + r4 = r1; \ + r1 |= r0; \ + r4 = ~r4; \ + r1 ^= r2; \ + r2 |= r4; \ + r1 ^= r3; \ + r0 ^= r4; \ + r2 ^= r0; \ + r0 &= r3; \ + r4 ^= r0; \ + r0 |= r1; \ + r0 ^= r2; \ + r3 ^= r4; \ + r2 ^= r1; \ + r3 ^= r0; \ + r3 ^= r1; \ + r2 &= r3; \ + r4 ^= r2; \ + } + +#define S1(i, r0, r1, r2, r3, r4) \ + { \ + r0 = ~r0; \ + r2 = ~r2; \ + r4 = r0; \ + r0 &= r1; \ + r2 ^= r0; \ + r0 |= r3; \ + r3 ^= r2; \ + r1 ^= r0; \ + r0 ^= r4; \ + r4 |= r1; \ + r1 ^= r3; \ + r2 |= r0; \ + r2 &= r4; \ + r0 ^= r1; \ + r1 &= r2; \ + r1 ^= r0; \ + r0 &= r2; \ + r0 ^= r4; \ + } + +#define I1(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r1; \ + r1 ^= r3; \ + r3 &= r1; \ + r4 ^= r2; \ + r3 ^= r0; \ + r0 |= r1; \ + r2 ^= r3; \ + r0 ^= r4; \ + r0 |= r2; \ + r1 ^= r3; \ + r0 ^= r1; \ + r1 |= r3; \ + r1 ^= r0; \ + r4 = ~r4; \ + r4 ^= r1; \ + r1 |= r0; \ + r1 ^= r0; \ + r1 |= r4; \ + r3 ^= r1; \ + } + +#define S2(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r0; \ + r0 &= r2; \ + r0 ^= r3; \ + r2 ^= r1; \ + r2 ^= r0; \ + r3 |= r4; \ + r3 ^= r1; \ + r4 ^= r2; \ + r1 = r3; \ + r3 |= r4; \ + r3 ^= r0; \ + r0 &= r1; \ + r4 ^= r0; \ + r1 ^= r3; \ + r1 ^= r4; \ + r4 = ~r4; \ + } + +#define I2(i, r0, r1, r2, r3, r4) \ + { \ + r2 ^= r3; \ + r3 ^= r0; \ + r4 = r3; \ + r3 &= r2; \ + r3 ^= r1; \ + r1 |= r2; \ + r1 ^= r4; \ + r4 &= r3; \ + r2 ^= r3; \ + r4 &= r0; \ + r4 ^= r2; \ + r2 &= r1; \ + r2 |= r0; \ + r3 = ~r3; \ + r2 ^= r3; \ + r0 ^= r3; \ + r0 &= r1; \ + r3 ^= r4; \ + r3 ^= r0; \ + } + +#define S3(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r0; \ + r0 |= r3; \ + r3 ^= r1; \ + r1 &= r4; \ + r4 ^= r2; \ + r2 ^= r3; \ + r3 &= r0; \ + r4 |= r1; \ + r3 ^= r4; \ + r0 ^= r1; \ + r4 &= r0; \ + r1 ^= r3; \ + r4 ^= r2; \ + r1 |= r0; \ + r1 ^= r2; \ + r0 ^= r3; \ + r2 = r1; \ + r1 |= r3; \ + r1 ^= r0; \ + } + +#define I3(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 ^= r1; \ + r1 &= r2; \ + r1 ^= r0; \ + r0 &= r4; \ + r4 ^= r3; \ + r3 |= r1; \ + r3 ^= r2; \ + r0 ^= r4; \ + r2 ^= r0; \ + r0 |= r3; \ + r0 ^= r1; \ + r4 ^= r2; \ + r2 &= r3; \ + r1 |= r3; \ + r1 ^= r2; \ + r4 ^= r0; \ + r2 ^= r4; \ + } + +#define S4(i, r0, r1, r2, r3, r4) \ + { \ + r1 ^= r3; \ + r3 = ~r3; \ + r2 ^= r3; \ + r3 ^= r0; \ + r4 = r1; \ + r1 &= r3; \ + r1 ^= r2; \ + r4 ^= r3; \ + r0 ^= r4; \ + r2 &= r4; \ + r2 ^= r0; \ + r0 &= r1; \ + r3 ^= r0; \ + r4 |= r1; \ + r4 ^= r0; \ + r0 |= r3; \ + r0 ^= r2; \ + r2 &= r3; \ + r0 = ~r0; \ + r4 ^= r2; \ + } + +#define I4(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 &= r3; \ + r2 ^= r1; \ + r1 |= r3; \ + r1 &= r0; \ + r4 ^= r2; \ + r4 ^= r1; \ + r1 &= r2; \ + r0 = ~r0; \ + r3 ^= r4; \ + r1 ^= r3; \ + r3 &= r0; \ + r3 ^= r2; \ + r0 ^= r1; \ + r2 &= r0; \ + r3 ^= r0; \ + r2 ^= r4; \ + r2 |= r3; \ + r3 ^= r0; \ + r2 ^= r1; \ + } + +#define S5(i, r0, r1, r2, r3, r4) \ + { \ + r0 ^= r1; \ + r1 ^= r3; \ + r3 = ~r3; \ + r4 = r1; \ + r1 &= r0; \ + r2 ^= r3; \ + r1 ^= r2; \ + r2 |= r4; \ + r4 ^= r3; \ + r3 &= r1; \ + r3 ^= r0; \ + r4 ^= r1; \ + r4 ^= r2; \ + r2 ^= r0; \ + r0 &= r3; \ + r2 = ~r2; \ + r0 ^= r4; \ + r4 |= r3; \ + r2 ^= r4; \ + } + +#define I5(i, r0, r1, r2, r3, r4) \ + { \ + r1 = ~r1; \ + r4 = r3; \ + r2 ^= r1; \ + r3 |= r0; \ + r3 ^= r2; \ + r2 |= r1; \ + r2 &= r0; \ + r4 ^= r3; \ + r2 ^= r4; \ + r4 |= r0; \ + r4 ^= r1; \ + r1 &= r2; \ + r1 ^= r3; \ + r4 ^= r2; \ + r3 &= r4; \ + r4 ^= r1; \ + r3 ^= r0; \ + r3 ^= r4; \ + r4 = ~r4; \ + } + +#define S6(i, r0, r1, r2, r3, r4) \ + { \ + r2 = ~r2; \ + r4 = r3; \ + r3 &= r0; \ + r0 ^= r4; \ + r3 ^= r2; \ + r2 |= r4; \ + r1 ^= r3; \ + r2 ^= r0; \ + r0 |= r1; \ + r2 ^= r1; \ + r4 ^= r0; \ + r0 |= r3; \ + r0 ^= r2; \ + r4 ^= r3; \ + r4 ^= r0; \ + r3 = ~r3; \ + r2 &= r4; \ + r2 ^= r3; \ + } + +#define I6(i, r0, r1, r2, r3, r4) \ + { \ + r0 ^= r2; \ + r4 = r2; \ + r2 &= r0; \ + r4 ^= r3; \ + r2 = ~r2; \ + r3 ^= r1; \ + r2 ^= r3; \ + r4 |= r0; \ + r0 ^= r2; \ + r3 ^= r4; \ + r4 ^= r1; \ + r1 &= r3; \ + r1 ^= r0; \ + r0 ^= r3; \ + r0 |= r2; \ + r3 ^= r1; \ + r4 ^= r0; \ + } + +#define S7(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 &= r1; \ + r2 ^= r3; \ + r3 &= r1; \ + r4 ^= r2; \ + r2 ^= r1; \ + r1 ^= r0; \ + r0 |= r4; \ + r0 ^= r2; \ + r3 ^= r1; \ + r2 ^= r3; \ + r3 &= r0; \ + r3 ^= r4; \ + r4 ^= r2; \ + r2 &= r0; \ + r4 = ~r4; \ + r2 ^= r4; \ + r4 &= r0; \ + r1 ^= r3; \ + r4 ^= r1; \ + } + +#define I7(i, r0, r1, r2, r3, r4) \ + { \ + r4 = r2; \ + r2 ^= r0; \ + r0 &= r3; \ + r2 = ~r2; \ + r4 |= r3; \ + r3 ^= r1; \ + r1 |= r0; \ + r0 ^= r2; \ + r2 &= r4; \ + r1 ^= r2; \ + r2 ^= r0; \ + r0 |= r2; \ + r3 &= r4; \ + r0 ^= r3; \ + r4 ^= r1; \ + r3 ^= r4; \ + r4 |= r0; \ + r3 ^= r2; \ + r4 ^= r2; \ + } + +// key xor +#define KX(r, a, b, c, d, e) {\ + a ^= k[4 * r + 0]; \ + b ^= k[4 * r + 1]; \ + c ^= k[4 * r + 2]; \ + d ^= k[4 * r + 3];} + + +#ifdef TC_MINIMIZE_CODE_SIZE + +static void S0f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r3 ^= *r0; + *r4 = *r1; + *r1 &= *r3; + *r4 ^= *r2; + *r1 ^= *r0; + *r0 |= *r3; + *r0 ^= *r4; + *r4 ^= *r3; + *r3 ^= *r2; + *r2 |= *r1; + *r2 ^= *r4; + *r4 = ~*r4; + *r4 |= *r1; + *r1 ^= *r3; + *r1 ^= *r4; + *r3 |= *r0; + *r1 ^= *r3; + *r4 ^= *r3; +} + +static void S1f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r0 = ~*r0; + *r2 = ~*r2; + *r4 = *r0; + *r0 &= *r1; + *r2 ^= *r0; + *r0 |= *r3; + *r3 ^= *r2; + *r1 ^= *r0; + *r0 ^= *r4; + *r4 |= *r1; + *r1 ^= *r3; + *r2 |= *r0; + *r2 &= *r4; + *r0 ^= *r1; + *r1 &= *r2; + *r1 ^= *r0; + *r0 &= *r2; + *r0 ^= *r4; +} + +static void S2f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r4 = *r0; + *r0 &= *r2; + *r0 ^= *r3; + *r2 ^= *r1; + *r2 ^= *r0; + *r3 |= *r4; + *r3 ^= *r1; + *r4 ^= *r2; + *r1 = *r3; + *r3 |= *r4; + *r3 ^= *r0; + *r0 &= *r1; + *r4 ^= *r0; + *r1 ^= *r3; + *r1 ^= *r4; + *r4 = ~*r4; +} + +static void S3f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r4 = *r0; + *r0 |= *r3; + *r3 ^= *r1; + *r1 &= *r4; + *r4 ^= *r2; + *r2 ^= *r3; + *r3 &= *r0; + *r4 |= *r1; + *r3 ^= *r4; + *r0 ^= *r1; + *r4 &= *r0; + *r1 ^= *r3; + *r4 ^= *r2; + *r1 |= *r0; + *r1 ^= *r2; + *r0 ^= *r3; + *r2 = *r1; + *r1 |= *r3; + *r1 ^= *r0; +} + +static void S4f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r1 ^= *r3; + *r3 = ~*r3; + *r2 ^= *r3; + *r3 ^= *r0; + *r4 = *r1; + *r1 &= *r3; + *r1 ^= *r2; + *r4 ^= *r3; + *r0 ^= *r4; + *r2 &= *r4; + *r2 ^= *r0; + *r0 &= *r1; + *r3 ^= *r0; + *r4 |= *r1; + *r4 ^= *r0; + *r0 |= *r3; + *r0 ^= *r2; + *r2 &= *r3; + *r0 = ~*r0; + *r4 ^= *r2; +} + +static void S5f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r0 ^= *r1; + *r1 ^= *r3; + *r3 = ~*r3; + *r4 = *r1; + *r1 &= *r0; + *r2 ^= *r3; + *r1 ^= *r2; + *r2 |= *r4; + *r4 ^= *r3; + *r3 &= *r1; + *r3 ^= *r0; + *r4 ^= *r1; + *r4 ^= *r2; + *r2 ^= *r0; + *r0 &= *r3; + *r2 = ~*r2; + *r0 ^= *r4; + *r4 |= *r3; + *r2 ^= *r4; +} + +static void S6f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r2 = ~*r2; + *r4 = *r3; + *r3 &= *r0; + *r0 ^= *r4; + *r3 ^= *r2; + *r2 |= *r4; + *r1 ^= *r3; + *r2 ^= *r0; + *r0 |= *r1; + *r2 ^= *r1; + *r4 ^= *r0; + *r0 |= *r3; + *r0 ^= *r2; + *r4 ^= *r3; + *r4 ^= *r0; + *r3 = ~*r3; + *r2 &= *r4; + *r2 ^= *r3; +} + +static void S7f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) +{ + *r4 = *r2; + *r2 &= *r1; + *r2 ^= *r3; + *r3 &= *r1; + *r4 ^= *r2; + *r2 ^= *r1; + *r1 ^= *r0; + *r0 |= *r4; + *r0 ^= *r2; + *r3 ^= *r1; + *r2 ^= *r3; + *r3 &= *r0; + *r3 ^= *r4; + *r4 ^= *r2; + *r2 &= *r0; + *r4 = ~*r4; + *r2 ^= *r4; + *r4 &= *r0; + *r1 ^= *r3; + *r4 ^= *r1; +} + +static void KXf (const uint32_t *k, unsigned int r, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) +{ + *a ^= k[r]; + *b ^= k[r + 1]; + *c ^= k[r + 2]; + *d ^= k[r + 3]; +} + +#endif // TC_MINIMIZE_CODE_SIZE + +#ifndef TC_MINIMIZE_CODE_SIZE + +void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks) +{ + uint32_t a,b,c,d,e; + uint32_t *k = (uint32_t *)ks; + uint32_t t; + int i; + + for (i = 0; i < keylen / (int)sizeof(int32_t); i++) + k[i] = LE32(((uint32_t*)userKey)[i]); + + if (keylen < 32) + k[keylen/4] |= (uint32_t)1 << ((keylen%4)*8); + + k += 8; + t = k[-1]; + for (i = 0; i < 132; ++i) + k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11); + k -= 20; + +#define LK(r, a, b, c, d, e) {\ + a = k[(8-r)*4 + 0]; \ + b = k[(8-r)*4 + 1]; \ + c = k[(8-r)*4 + 2]; \ + d = k[(8-r)*4 + 3];} + +#define SK(r, a, b, c, d, e) {\ + k[(8-r)*4 + 4] = a; \ + k[(8-r)*4 + 5] = b; \ + k[(8-r)*4 + 6] = c; \ + k[(8-r)*4 + 7] = d;} \ + + for (i=0; i<4; i++) + { + afterS2(LK); afterS2(S3); afterS3(SK); + afterS1(LK); afterS1(S2); afterS2(SK); + afterS0(LK); afterS0(S1); afterS1(SK); + beforeS0(LK); beforeS0(S0); afterS0(SK); + k += 8*4; + afterS6(LK); afterS6(S7); afterS7(SK); + afterS5(LK); afterS5(S6); afterS6(SK); + afterS4(LK); afterS4(S5); afterS5(SK); + afterS3(LK); afterS3(S4); afterS4(SK); + } + afterS2(LK); afterS2(S3); afterS3(SK); +} + +#else // TC_MINIMIZE_CODE_SIZE + +static void LKf (uint32_t *k, unsigned int r, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) +{ + *a = k[r]; + *b = k[r + 1]; + *c = k[r + 2]; + *d = k[r + 3]; +} + +static void SKf (uint32_t *k, unsigned int r, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) +{ + k[r + 4] = *a; + k[r + 5] = *b; + k[r + 6] = *c; + k[r + 7] = *d; +} + +void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks) +{ + uint32_t a,b,c,d,e; + uint32_t *k = (uint32_t *)ks; + uint32_t t; + int i; + + for (i = 0; i < keylen / (int)sizeof(__int32); i++) + k[i] = LE32(((uint32_t*)userKey)[i]); + + if (keylen < 32) + k[keylen/4] |= (uint32_t)1 << ((keylen%4)*8); + + k += 8; + t = k[-1]; + for (i = 0; i < 132; ++i) + k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11); + k -= 20; + + for (i=0; i<4; i++) + { + LKf (k, 20, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); SKf (k, 16, &e, &b, &d, &c); + LKf (k, 24, &c, &b, &a, &e); S2f (&c, &b, &a, &e, &d); SKf (k, 20, &a, &e, &b, &d); + LKf (k, 28, &b, &e, &c, &a); S1f (&b, &e, &c, &a, &d); SKf (k, 24, &c, &b, &a, &e); + LKf (k, 32, &a, &b, &c, &d); S0f (&a, &b, &c, &d, &e); SKf (k, 28, &b, &e, &c, &a); + k += 8*4; + LKf (k, 4, &a, &c, &d, &b); S7f (&a, &c, &d, &b, &e); SKf (k, 0, &d, &e, &b, &a); + LKf (k, 8, &a, &c, &b, &e); S6f (&a, &c, &b, &e, &d); SKf (k, 4, &a, &c, &d, &b); + LKf (k, 12, &b, &a, &e, &c); S5f (&b, &a, &e, &c, &d); SKf (k, 8, &a, &c, &b, &e); + LKf (k, 16, &e, &b, &d, &c); S4f (&e, &b, &d, &c, &a); SKf (k, 12, &b, &a, &e, &c); + } + LKf (k, 20, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); SKf (k, 16, &e, &b, &d, &c); +} + +#endif // TC_MINIMIZE_CODE_SIZE + + +#ifndef TC_MINIMIZE_CODE_SIZE + +void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) +{ + uint32_t a, b, c, d, e; + unsigned int i=1; + const uint32_t *k = (uint32_t *)ks + 8; + uint32_t *in = (uint32_t *) inBlock; + uint32_t *out = (uint32_t *) outBlock; + + a = LE32(in[0]); + b = LE32(in[1]); + c = LE32(in[2]); + d = LE32(in[3]); + + do + { + beforeS0(KX); beforeS0(S0); afterS0(LT); + afterS0(KX); afterS0(S1); afterS1(LT); + afterS1(KX); afterS1(S2); afterS2(LT); + afterS2(KX); afterS2(S3); afterS3(LT); + afterS3(KX); afterS3(S4); afterS4(LT); + afterS4(KX); afterS4(S5); afterS5(LT); + afterS5(KX); afterS5(S6); afterS6(LT); + afterS6(KX); afterS6(S7); + + if (i == 4) + break; + + ++i; + c = b; + b = e; + e = d; + d = a; + a = e; + k += 32; + beforeS0(LT); + } + while (1); + + afterS7(KX); + + out[0] = LE32(d); + out[1] = LE32(e); + out[2] = LE32(b); + out[3] = LE32(a); +} + +#else // TC_MINIMIZE_CODE_SIZE + +typedef uint32_t uint32; + +static void LTf (uint32 *a, uint32 *b, uint32 *c, uint32 *d) +{ + *a = rotlFixed(*a, 13); + *c = rotlFixed(*c, 3); + *d = rotlFixed(*d ^ *c ^ (*a << 3), 7); + *b = rotlFixed(*b ^ *a ^ *c, 1); + *a = rotlFixed(*a ^ *b ^ *d, 5); + *c = rotlFixed(*c ^ *d ^ (*b << 7), 22); +} + +void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) +{ + uint32_t a, b, c, d, e; + unsigned int i=1; + const uint32_t *k = (uint32_t *)ks + 8; + uint32_t *in = (uint32_t *) inBlock; + uint32_t *out = (uint32_t *) outBlock; + + a = LE32(in[0]); + b = LE32(in[1]); + c = LE32(in[2]); + d = LE32(in[3]); + + do + { + KXf (k, 0, &a, &b, &c, &d); S0f (&a, &b, &c, &d, &e); LTf (&b, &e, &c, &a); + KXf (k, 4, &b, &e, &c, &a); S1f (&b, &e, &c, &a, &d); LTf (&c, &b, &a, &e); + KXf (k, 8, &c, &b, &a, &e); S2f (&c, &b, &a, &e, &d); LTf (&a, &e, &b, &d); + KXf (k, 12, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); LTf (&e, &b, &d, &c); + KXf (k, 16, &e, &b, &d, &c); S4f (&e, &b, &d, &c, &a); LTf (&b, &a, &e, &c); + KXf (k, 20, &b, &a, &e, &c); S5f (&b, &a, &e, &c, &d); LTf (&a, &c, &b, &e); + KXf (k, 24, &a, &c, &b, &e); S6f (&a, &c, &b, &e, &d); LTf (&a, &c, &d, &b); + KXf (k, 28, &a, &c, &d, &b); S7f (&a, &c, &d, &b, &e); + + if (i == 4) + break; + + ++i; + c = b; + b = e; + e = d; + d = a; + a = e; + k += 32; + LTf (&a,&b,&c,&d); + } + while (1); + + KXf (k, 32, &d, &e, &b, &a); + + out[0] = LE32(d); + out[1] = LE32(e); + out[2] = LE32(b); + out[3] = LE32(a); +} + +#endif // TC_MINIMIZE_CODE_SIZE + +#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_SERPENT) + +void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) +{ + uint32_t a, b, c, d, e; + const uint32_t *k = (uint32_t *)ks + 104; + unsigned int i=4; + uint32_t *in = (uint32_t *) inBlock; + uint32_t *out = (uint32_t *) outBlock; + + a = LE32(in[0]); + b = LE32(in[1]); + c = LE32(in[2]); + d = LE32(in[3]); + + beforeI7(KX); + goto start; + + do + { + c = b; + b = d; + d = e; + k -= 32; + beforeI7(ILT); +start: + beforeI7(I7); afterI7(KX); + afterI7(ILT); afterI7(I6); afterI6(KX); + afterI6(ILT); afterI6(I5); afterI5(KX); + afterI5(ILT); afterI5(I4); afterI4(KX); + afterI4(ILT); afterI4(I3); afterI3(KX); + afterI3(ILT); afterI3(I2); afterI2(KX); + afterI2(ILT); afterI2(I1); afterI1(KX); + afterI1(ILT); afterI1(I0); afterI0(KX); + } + while (--i != 0); + + out[0] = LE32(a); + out[1] = LE32(d); + out[2] = LE32(b); + out[3] = LE32(e); +} + +#else // TC_MINIMIZE_CODE_SIZE && !TC_WINDOWS_BOOT_SERPENT + +static void ILTf (uint32 *a, uint32 *b, uint32 *c, uint32 *d) +{ + *c = rotrFixed(*c, 22); + *a = rotrFixed(*a, 5); + *c ^= *d ^ (*b << 7); + *a ^= *b ^ *d; + *b = rotrFixed(*b, 1); + *d = rotrFixed(*d, 7) ^ *c ^ (*a << 3); + *b ^= *a ^ *c; + *c = rotrFixed(*c, 3); + *a = rotrFixed(*a, 13); +} + +void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) +{ + uint32_t a, b, c, d, e; + const uint32_t *k = (uint32_t *)ks + 104; + unsigned int i=4; + uint32_t *in = (uint32_t *) inBlock; + uint32_t *out = (uint32_t *) outBlock; + + a = LE32(in[0]); + b = LE32(in[1]); + c = LE32(in[2]); + d = LE32(in[3]); + + KXf (k, 32, &a, &b, &c, &d); + goto start; + + do + { + c = b; + b = d; + d = e; + k -= 32; + beforeI7(ILT); +start: + beforeI7(I7); KXf (k, 28, &d, &a, &b, &e); + ILTf (&d, &a, &b, &e); afterI7(I6); KXf (k, 24, &a, &b, &c, &e); + ILTf (&a, &b, &c, &e); afterI6(I5); KXf (k, 20, &b, &d, &e, &c); + ILTf (&b, &d, &e, &c); afterI5(I4); KXf (k, 16, &b, &c, &e, &a); + ILTf (&b, &c, &e, &a); afterI4(I3); KXf (k, 12, &a, &b, &e, &c); + ILTf (&a, &b, &e, &c); afterI3(I2); KXf (k, 8, &b, &d, &e, &c); + ILTf (&b, &d, &e, &c); afterI2(I1); KXf (k, 4, &a, &b, &c, &e); + ILTf (&a, &b, &c, &e); afterI1(I0); KXf (k, 0, &a, &d, &b, &e); + } + while (--i != 0); + + out[0] = LE32(a); + out[1] = LE32(d); + out[2] = LE32(b); + out[3] = LE32(e); +} + +#endif // TC_MINIMIZE_CODE_SIZE && !TC_WINDOWS_BOOT_SERPENT diff --git a/src/utils/crypto/serpent.h b/src/utils/crypto/serpent.h new file mode 100644 index 00000000000..484e949f400 --- /dev/null +++ b/src/utils/crypto/serpent.h @@ -0,0 +1,19 @@ +#ifndef HEADER_Crypto_Serpent +#define HEADER_Crypto_Serpent + +#include + +#ifdef __cplusplus +extern "C" +{ +#endif + +void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks); +void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks); +void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks); + +#ifdef __cplusplus +} +#endif + +#endif // HEADER_Crypto_Serpent diff --git a/src/utils/crypto/set_key.c b/src/utils/crypto/set_key.c new file mode 100644 index 00000000000..fe0026dc1d9 --- /dev/null +++ b/src/utils/crypto/set_key.c @@ -0,0 +1,233 @@ +/* Deprecated/legacy */ + +/* crypto/des/set_key.c */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +/* set_key.c v 1.4 eay 24/9/91 + * 1.4 Speed up by 400% :-) + * 1.3 added register declarations. + * 1.2 unrolled make_key_sched a bit more + * 1.1 added norm_expand_bits + * 1.0 First working version + */ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + +#include "des_locl.h" +#include "podd.h" +#include "sk.h" + +int des_check_key=1; + +void des_set_odd_parity(des_cblock (*key)) + { + int i; + + for (i=0; i<(int)DES_KEY_SZ; i++) + (*key)[i]=odd_parity[(*key)[i]]; + } + +/* Weak and semi week keys as take from + * %A D.W. Davies + * %A W.L. Price + * %T Security for Computer Networks + * %I John Wiley & Sons + * %D 1984 + * Many thanks to smb@ulysses.att.com (Steven Bellovin) for the reference + * (and actual cblock values). + */ +#define NUM_WEAK_KEY 18 +static des_cblock weak_keys[NUM_WEAK_KEY]={ + /* weak keys */ + {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, + {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE}, + {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E}, + {0xE0,0xE0,0xE0,0xE0,0xF1,0xF1,0xF1,0xF1}, + {0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F}, + {0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0}, + /* semi-weak keys */ + {0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE}, + {0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01}, + {0x1F,0xE0,0x1F,0xE0,0x0E,0xF1,0x0E,0xF1}, + {0xE0,0x1F,0xE0,0x1F,0xF1,0x0E,0xF1,0x0E}, + {0x01,0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1}, + {0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1,0x01}, + {0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E,0xFE}, + {0xFE,0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E}, + {0x01,0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E}, + {0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E,0x01}, + {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, + {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; + +int des_is_weak_key(des_cblock (*key)) +{ + int i; + + for (i=0; i>(n))^(b))&(m)),\ + * (b)^=(t),\ + * (a)=((a)^((t)<<(n)))) + */ + +#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ + (a)=(a)^(t)^(t>>(16-(n)))) + +/* return 0 if key parity is odd (correct), + * return -1 if key parity error, + * return -2 if illegal weak key. + */ +int des_set_key(des_cblock (*key), des_key_schedule schedule) + { + static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; + register DES_LONG c,d,t,s,t2; + register unsigned char *in; + register DES_LONG *k; + register int i; + + k=(DES_LONG *)schedule; + in=(unsigned char *)key; + + c2l(in,c); + c2l(in,d); + + /* do PC1 in 60 simple operations */ +/* PERM_OP(d,c,t,4,0x0f0f0f0fL); + HPERM_OP(c,t,-2, 0xcccc0000L); + HPERM_OP(c,t,-1, 0xaaaa0000L); + HPERM_OP(c,t, 8, 0x00ff0000L); + HPERM_OP(c,t,-1, 0xaaaa0000L); + HPERM_OP(d,t,-8, 0xff000000L); + HPERM_OP(d,t, 8, 0x00ff0000L); + HPERM_OP(d,t, 2, 0x33330000L); + d=((d&0x00aa00aaL)<<7L)|((d&0x55005500L)>>7L)|(d&0xaa55aa55L); + d=(d>>8)|((c&0xf0000000L)>>4); + c&=0x0fffffffL; */ + + /* I now do it in 47 simple operations :-) + * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) + * for the inspiration. :-) */ + PERM_OP (d,c,t,4,0x0f0f0f0fL); + HPERM_OP(c,t,-2,0xcccc0000L); + HPERM_OP(d,t,-2,0xcccc0000L); + PERM_OP (d,c,t,1,0x55555555L); + PERM_OP (c,d,t,8,0x00ff00ffL); + PERM_OP (d,c,t,1,0x55555555L); + d= (((d&0x000000ffL)<<16L)| (d&0x0000ff00L) | + ((d&0x00ff0000L)>>16L)|((c&0xf0000000L)>>4L)); + c&=0x0fffffffL; + + for (i=0; i>2L)|(c<<26L)); d=((d>>2L)|(d<<26L)); } + else + { c=((c>>1L)|(c<<27L)); d=((d>>1L)|(d<<27L)); } + c&=0x0fffffffL; + d&=0x0fffffffL; + /* could be a few less shifts but I am to lazy at this + * point in time to investigate */ + s= des_skb[0][ (c )&0x3f ]| + des_skb[1][((c>> 6)&0x03)|((c>> 7L)&0x3c)]| + des_skb[2][((c>>13)&0x0f)|((c>>14L)&0x30)]| + des_skb[3][((c>>20)&0x01)|((c>>21L)&0x06) | + ((c>>22L)&0x38)]; + t= des_skb[4][ (d )&0x3f ]| + des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| + des_skb[6][ (d>>15L)&0x3f ]| + des_skb[7][((d>>21L)&0x0f)|((d>>22L)&0x30)]; + + /* table contained 0213 4657 */ + t2=((t<<16L)|(s&0x0000ffffL))&0xffffffffL; + *(k++)=ROTATE(t2,30)&0xffffffffL; + + t2=((s>>16L)|(t&0xffff0000L)); + *(k++)=ROTATE(t2,26)&0xffffffffL; + } + + if (des_check_key) + { + //if (!check_parity(key)) + // return(-1); + + if (des_is_weak_key(key)) + return(-2); + } + + return(0); + } + +int des_key_sched(des_cblock (*key), des_key_schedule schedule) + { + return(des_set_key(key,schedule)); + } diff --git a/src/utils/crypto/set_key.h b/src/utils/crypto/set_key.h new file mode 100644 index 00000000000..a3f1c689c42 --- /dev/null +++ b/src/utils/crypto/set_key.h @@ -0,0 +1,6 @@ +/* Deprecated/legacy */ + +void des_set_odd_parity ( des_cblock (*key )); +int des_is_weak_key ( des_cblock (*key )); +int des_set_key ( des_cblock (*key ), des_key_schedule schedule ); +int des_key_sched ( des_cblock (*key ), des_key_schedule schedule ); diff --git a/src/utils/crypto/sha1.c b/src/utils/crypto/sha1.c new file mode 100644 index 00000000000..370479ec82b --- /dev/null +++ b/src/utils/crypto/sha1.c @@ -0,0 +1,280 @@ +/* Deprecated/legacy */ + +/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 18/06/2004 + + This is a byte oriented version of SHA1 that operates on arrays of bytes + stored in memory. +*/ + +#include /* for memcpy() etc. */ +#include /* for _lrotl with VC++ */ + +#include "sha1.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* + To obtain the highest speed on processors with 32-bit words, this code + needs to determine the order in which bytes are packed into such words. + The following block of code is an attempt to capture the most obvious + ways in which various environemnts specify their endian definitions. + It may well fail, in which case the definitions will need to be set by + editing at the points marked **** EDIT HERE IF NECESSARY **** below. +*/ + +/* PLATFORM SPECIFIC INCLUDES */ + +/* Original byte order detection removed */ +#include "../common/endian.h" + +#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ +#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ + +#if BYTE_ORDER == LITTLE_ENDIAN +# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN +#endif + +#if BYTE_ORDER == BIG_ENDIAN +# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN +#endif + +#ifdef _MSC_VER +#pragma intrinsic(memcpy) +#endif + +#if 1 && defined(_MSC_VER) && !defined(_DEBUG) +#define rotl32 _rotl +#define rotr32 _rotr +#else +#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) +#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) +#endif + +#if !defined(bswap_32) +#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) +#endif + +#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) +#define SWAP_BYTES +#else +#undef SWAP_BYTES +#endif + +#if defined(SWAP_BYTES) +#define bsw_32(p,n) \ + { int _i = (n); while(_i--) ((sha1_32t*)p)[_i] = bswap_32(((sha1_32t*)p)[_i]); } +#else +#define bsw_32(p,n) +#endif + +#define SHA1_MASK (SHA1_BLOCK_SIZE - 1) + +#if 0 + +#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define parity(x,y,z) ((x) ^ (y) ^ (z)) +#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#else /* Discovered by Rich Schroeppel and Colin Plumb */ + +#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) +#define parity(x,y,z) ((x) ^ (y) ^ (z)) +#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) + +#endif + +/* Compile 64 bytes of hash data into SHA1 context. Note */ +/* that this routine assumes that the byte order in the */ +/* ctx->wbuf[] at this point is in such an order that low */ +/* address bytes in the ORIGINAL byte stream will go in */ +/* this buffer to the high end of 32-bit words on BOTH big */ +/* and little endian systems */ + +#ifdef ARRAY +#define q(v,n) v[n] +#else +#define q(v,n) v##n +#endif + +#define one_cycle(v,a,b,c,d,e,f,k,h) \ + q(v,e) += rotr32(q(v,a),27) + \ + f(q(v,b),q(v,c),q(v,d)) + k + h; \ + q(v,b) = rotr32(q(v,b), 2) + +#define five_cycle(v,f,k,i) \ + one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \ + one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \ + one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \ + one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \ + one_cycle(v, 1,2,3,4,0, f,k,hf(i+4)) + +void sha1_compile(sha1_ctx ctx[1]) +{ sha1_32t *w = ctx->wbuf; + +#ifdef ARRAY + sha1_32t v[5]; + memcpy(v, ctx->hash, 5 * sizeof(sha1_32t)); +#else + sha1_32t v0, v1, v2, v3, v4; + v0 = ctx->hash[0]; v1 = ctx->hash[1]; + v2 = ctx->hash[2]; v3 = ctx->hash[3]; + v4 = ctx->hash[4]; +#endif + +#define hf(i) w[i] + + five_cycle(v, ch, 0x5a827999, 0); + five_cycle(v, ch, 0x5a827999, 5); + five_cycle(v, ch, 0x5a827999, 10); + one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \ + +#undef hf +#define hf(i) (w[(i) & 15] = rotl32( \ + w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \ + ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1)) + + one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16)); + one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17)); + one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18)); + one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19)); + + five_cycle(v, parity, 0x6ed9eba1, 20); + five_cycle(v, parity, 0x6ed9eba1, 25); + five_cycle(v, parity, 0x6ed9eba1, 30); + five_cycle(v, parity, 0x6ed9eba1, 35); + + five_cycle(v, maj, 0x8f1bbcdc, 40); + five_cycle(v, maj, 0x8f1bbcdc, 45); + five_cycle(v, maj, 0x8f1bbcdc, 50); + five_cycle(v, maj, 0x8f1bbcdc, 55); + + five_cycle(v, parity, 0xca62c1d6, 60); + five_cycle(v, parity, 0xca62c1d6, 65); + five_cycle(v, parity, 0xca62c1d6, 70); + five_cycle(v, parity, 0xca62c1d6, 75); + +#ifdef ARRAY + ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; + ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; + ctx->hash[4] += v[4]; +#else + ctx->hash[0] += v0; ctx->hash[1] += v1; + ctx->hash[2] += v2; ctx->hash[3] += v3; + ctx->hash[4] += v4; +#endif +} + +void sha1_begin(sha1_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + ctx->hash[0] = 0x67452301; + ctx->hash[1] = 0xefcdab89; + ctx->hash[2] = 0x98badcfe; + ctx->hash[3] = 0x10325476; + ctx->hash[4] = 0xc3d2e1f0; +} + +/* SHA1 hash data in an array of bytes into hash buffer and */ +/* call the hash_compile function as required. */ + +void sha1_hash(const unsigned char data[], uint32_t len, sha1_ctx ctx[1]) +{ sha1_32t pos = (sha1_32t)(ctx->count[0] & SHA1_MASK), + space = SHA1_BLOCK_SIZE - pos; + const unsigned char *sp = data; + + if((ctx->count[0] += len) < len) + ++(ctx->count[1]); + + while(len >= space) /* tranfer whole blocks if possible */ + { + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); + sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0; + bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2); + sha1_compile(ctx); + } + + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); +} + +/* SHA1 final padding and digest calculation */ + +void sha1_end(unsigned char hval[], sha1_ctx ctx[1]) +{ sha1_32t i = (sha1_32t)(ctx->count[0] & SHA1_MASK); + + /* put bytes in the buffer in an order in which references to */ + /* 32-bit words will put bytes with lower addresses into the */ + /* top of 32 bit words on BOTH big and little endian machines */ + bsw_32(ctx->wbuf, (i + 3) >> 2); + + /* we now need to mask valid bytes and add the padding which is */ + /* a single 1 bit and as many zero bits as necessary. Note that */ + /* we can always add the first padding byte here because the */ + /* buffer always has at least one empty slot */ + ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); + ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); + + /* we need 9 or more empty positions, one for the padding byte */ + /* (above) and eight for the length count. If there is not */ + /* enough space, pad and empty the buffer */ + if(i > SHA1_BLOCK_SIZE - 9) + { + if(i < 60) ctx->wbuf[15] = 0; + sha1_compile(ctx); + i = 0; + } + else /* compute a word index for the empty buffer positions */ + i = (i >> 2) + 1; + + while(i < 14) /* and zero pad all but last two positions */ + ctx->wbuf[i++] = 0; + + /* the following 32-bit length fields are assembled in the */ + /* wrong byte order on little endian machines but this is */ + /* corrected later since they are only ever used as 32-bit */ + /* word values. */ + ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); + ctx->wbuf[15] = ctx->count[0] << 3; + sha1_compile(ctx); + + /* extract the hash value as bytes in case the hash buffer is */ + /* misaligned for 32-bit words */ + for(i = 0; i < SHA1_DIGEST_SIZE; ++i) + hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); +} + +void sha1(unsigned char hval[], const unsigned char data[], uint32_t len) +{ sha1_ctx cx[1]; + + sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx); +} + +#if defined(__cplusplus) +} +#endif diff --git a/src/utils/crypto/sha1.h b/src/utils/crypto/sha1.h new file mode 100644 index 00000000000..d622f9839ca --- /dev/null +++ b/src/utils/crypto/sha1.h @@ -0,0 +1,80 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 26/08/2003 +*/ + +#ifndef _SHA1_H +#define _SHA1_H + +#include +#include + +#define SHA1_BLOCK_SIZE 64 +#define SHA1_DIGEST_SIZE 20 + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* define an unsigned 32-bit type */ + +#if defined(_MSC_VER) + typedef uint32_t sha1_32t; +#elif defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful + typedef uint32_t sha1_32t; +#elif defined(UINT_MAX) && UINT_MAX == 0xffffffff + typedef uint32_t sha1_32t; +#else +# error Please define sha1_32t as an unsigned 32 bit type in sha1.h +#endif + +/* type to hold the SHA256 context */ + +typedef struct +{ sha1_32t count[2]; + sha1_32t hash[5]; + sha1_32t wbuf[16]; +} sha1_ctx; + +/* Note that these prototypes are the same for both bit and */ +/* byte oriented implementations. However the length fields */ +/* are in bytes or bits as appropriate for the version used */ +/* and bit sequences are input as arrays of bytes in which */ +/* bit sequences run from the most to the least significant */ +/* end of each byte */ + +void sha1_compile(sha1_ctx ctx[1]); + +void sha1_begin(sha1_ctx ctx[1]); +void sha1_hash(const uint8_t data[], uint32_t len, sha1_ctx ctx[1]); +void sha1_end(uint8_t hval[], sha1_ctx ctx[1]); +void sha1(uint8_t hval[], const uint8_t data[], uint32_t len); + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/utils/crypto/sha2.c b/src/utils/crypto/sha2.c new file mode 100644 index 00000000000..cc528d941d1 --- /dev/null +++ b/src/utils/crypto/sha2.c @@ -0,0 +1,770 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 01/08/2005 + + This is a byte oriented version of SHA2 that operates on arrays of bytes + stored in memory. This code implements sha256, sha384 and sha512 but the + latter two functions rely on efficient 64-bit integer operations that + may not be very efficient on 32-bit machines + + The sha256 functions use a type 'sha256_ctx' to hold details of the + current hash state and uses the following three calls: + + void sha256_begin(sha256_ctx ctx[1]) + void sha256_hash(const unsigned char data[], + unsigned long len, sha256_ctx ctx[1]) + void sha_end1(unsigned char hval[], sha256_ctx ctx[1]) + + The first subroutine initialises a hash computation by setting up the + context in the sha256_ctx context. The second subroutine hashes 8-bit + bytes from array data[] into the hash state withinh sha256_ctx context, + the number of bytes to be hashed being given by the the unsigned long + integer len. The third subroutine completes the hash calculation and + places the resulting digest value in the array of 8-bit bytes hval[]. + + The sha384 and sha512 functions are similar and use the interfaces: + + void sha384_begin(sha384_ctx ctx[1]); + void sha384_hash(const unsigned char data[], + unsigned long len, sha384_ctx ctx[1]); + void sha384_end(unsigned char hval[], sha384_ctx ctx[1]); + + void sha512_begin(sha512_ctx ctx[1]); + void sha512_hash(const unsigned char data[], + unsigned long len, sha512_ctx ctx[1]); + void sha512_end(unsigned char hval[], sha512_ctx ctx[1]); + + In addition there is a function sha2 that can be used to call all these + functions using a call with a hash length parameter as follows: + + int sha2_begin(unsigned long len, sha2_ctx ctx[1]); + void sha2_hash(const unsigned char data[], + unsigned long len, sha2_ctx ctx[1]); + void sha2_end(unsigned char hval[], sha2_ctx ctx[1]); + + My thanks to Erik Andersen for testing this code + on big-endian systems and for his assistance with corrections +*/ + +#include "../common/endian.h" +#define PLATFORM_BYTE_ORDER BYTE_ORDER +#define IS_LITTLE_ENDIAN LITTLE_ENDIAN + +#if 0 +#define UNROLL_SHA2 /* for SHA2 loop unroll */ +#endif + +#include /* for memcpy() etc. */ + +#include "sha2.h" + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) +#pragma intrinsic(memcpy) +#endif + +#if 0 && defined(_MSC_VER) +#define rotl32 _lrotl +#define rotr32 _lrotr +#else +#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) +#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) +#endif + +#if !defined(bswap_32) +#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) +#endif + +#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) +#define SWAP_BYTES +#else +#undef SWAP_BYTES +#endif + +#if 0 + +#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) +#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) + +#else /* Thanks to Rich Schroeppel and Colin Plumb for the following */ + +#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) +#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) + +#endif + +/* round transforms for SHA256 and SHA512 compression functions */ + +#define vf(n,i) v[(n - i) & 7] + +#define hf(i) (p[i & 15] += \ + g_1(p[(i + 14) & 15]) + p[(i + 9) & 15] + g_0(p[(i + 1) & 15])) + +#define v_cycle(i,j) \ + vf(7,i) += (j ? hf(i) : p[i]) + k_0[i+j] \ + + s_1(vf(4,i)) + ch(vf(4,i),vf(5,i),vf(6,i)); \ + vf(3,i) += vf(7,i); \ + vf(7,i) += s_0(vf(0,i))+ maj(vf(0,i),vf(1,i),vf(2,i)) + +#if defined(SHA_224) || defined(SHA_256) + +#define SHA256_MASK (SHA256_BLOCK_SIZE - 1) + +#if defined(SWAP_BYTES) +#define bsw_32(p,n) \ + { int _i = (n); while(_i--) ((uint_32t*)p)[_i] = bswap_32(((uint_32t*)p)[_i]); } +#else +#define bsw_32(p,n) +#endif + +#define s_0(x) (rotr32((x), 2) ^ rotr32((x), 13) ^ rotr32((x), 22)) +#define s_1(x) (rotr32((x), 6) ^ rotr32((x), 11) ^ rotr32((x), 25)) +#define g_0(x) (rotr32((x), 7) ^ rotr32((x), 18) ^ ((x) >> 3)) +#define g_1(x) (rotr32((x), 17) ^ rotr32((x), 19) ^ ((x) >> 10)) +#define k_0 k256 + +/* rotated SHA256 round definition. Rather than swapping variables as in */ +/* FIPS-180, different variables are 'rotated' on each round, returning */ +/* to their starting positions every eight rounds */ + +#define q(n) v##n + +#define one_cycle(a,b,c,d,e,f,g,h,k,w) \ + q(h) += s_1(q(e)) + ch(q(e), q(f), q(g)) + k + w; \ + q(d) += q(h); q(h) += s_0(q(a)) + maj(q(a), q(b), q(c)) + +/* SHA256 mixing data */ + +const uint_32t k256[64] = +{ 0x428a2f98ul, 0x71374491ul, 0xb5c0fbcful, 0xe9b5dba5ul, + 0x3956c25bul, 0x59f111f1ul, 0x923f82a4ul, 0xab1c5ed5ul, + 0xd807aa98ul, 0x12835b01ul, 0x243185beul, 0x550c7dc3ul, + 0x72be5d74ul, 0x80deb1feul, 0x9bdc06a7ul, 0xc19bf174ul, + 0xe49b69c1ul, 0xefbe4786ul, 0x0fc19dc6ul, 0x240ca1ccul, + 0x2de92c6ful, 0x4a7484aaul, 0x5cb0a9dcul, 0x76f988daul, + 0x983e5152ul, 0xa831c66dul, 0xb00327c8ul, 0xbf597fc7ul, + 0xc6e00bf3ul, 0xd5a79147ul, 0x06ca6351ul, 0x14292967ul, + 0x27b70a85ul, 0x2e1b2138ul, 0x4d2c6dfcul, 0x53380d13ul, + 0x650a7354ul, 0x766a0abbul, 0x81c2c92eul, 0x92722c85ul, + 0xa2bfe8a1ul, 0xa81a664bul, 0xc24b8b70ul, 0xc76c51a3ul, + 0xd192e819ul, 0xd6990624ul, 0xf40e3585ul, 0x106aa070ul, + 0x19a4c116ul, 0x1e376c08ul, 0x2748774cul, 0x34b0bcb5ul, + 0x391c0cb3ul, 0x4ed8aa4aul, 0x5b9cca4ful, 0x682e6ff3ul, + 0x748f82eeul, 0x78a5636ful, 0x84c87814ul, 0x8cc70208ul, + 0x90befffaul, 0xa4506cebul, 0xbef9a3f7ul, 0xc67178f2ul, +}; + +/* Compile 64 bytes of hash data into SHA256 digest value */ +/* NOTE: this routine assumes that the byte order in the */ +/* ctx->wbuf[] at this point is such that low address bytes */ +/* in the ORIGINAL byte stream will go into the high end of */ +/* words on BOTH big and little endian systems */ + +VOID_RETURN sha256_compile(sha256_ctx ctx[1]) +{ +#if !defined(UNROLL_SHA2) + + uint_32t j, *p = ctx->wbuf, v[8]; + + memcpy(v, ctx->hash, 8 * sizeof(uint_32t)); + + for(j = 0; j < 64; j += 16) + { + v_cycle( 0, j); v_cycle( 1, j); + v_cycle( 2, j); v_cycle( 3, j); + v_cycle( 4, j); v_cycle( 5, j); + v_cycle( 6, j); v_cycle( 7, j); + v_cycle( 8, j); v_cycle( 9, j); + v_cycle(10, j); v_cycle(11, j); + v_cycle(12, j); v_cycle(13, j); + v_cycle(14, j); v_cycle(15, j); + } + + ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; + ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; + ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; + ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; + +#else + + uint_32t *p = ctx->wbuf,v0,v1,v2,v3,v4,v5,v6,v7; + + v0 = ctx->hash[0]; v1 = ctx->hash[1]; + v2 = ctx->hash[2]; v3 = ctx->hash[3]; + v4 = ctx->hash[4]; v5 = ctx->hash[5]; + v6 = ctx->hash[6]; v7 = ctx->hash[7]; + + one_cycle(0,1,2,3,4,5,6,7,k256[ 0],p[ 0]); + one_cycle(7,0,1,2,3,4,5,6,k256[ 1],p[ 1]); + one_cycle(6,7,0,1,2,3,4,5,k256[ 2],p[ 2]); + one_cycle(5,6,7,0,1,2,3,4,k256[ 3],p[ 3]); + one_cycle(4,5,6,7,0,1,2,3,k256[ 4],p[ 4]); + one_cycle(3,4,5,6,7,0,1,2,k256[ 5],p[ 5]); + one_cycle(2,3,4,5,6,7,0,1,k256[ 6],p[ 6]); + one_cycle(1,2,3,4,5,6,7,0,k256[ 7],p[ 7]); + one_cycle(0,1,2,3,4,5,6,7,k256[ 8],p[ 8]); + one_cycle(7,0,1,2,3,4,5,6,k256[ 9],p[ 9]); + one_cycle(6,7,0,1,2,3,4,5,k256[10],p[10]); + one_cycle(5,6,7,0,1,2,3,4,k256[11],p[11]); + one_cycle(4,5,6,7,0,1,2,3,k256[12],p[12]); + one_cycle(3,4,5,6,7,0,1,2,k256[13],p[13]); + one_cycle(2,3,4,5,6,7,0,1,k256[14],p[14]); + one_cycle(1,2,3,4,5,6,7,0,k256[15],p[15]); + + one_cycle(0,1,2,3,4,5,6,7,k256[16],hf( 0)); + one_cycle(7,0,1,2,3,4,5,6,k256[17],hf( 1)); + one_cycle(6,7,0,1,2,3,4,5,k256[18],hf( 2)); + one_cycle(5,6,7,0,1,2,3,4,k256[19],hf( 3)); + one_cycle(4,5,6,7,0,1,2,3,k256[20],hf( 4)); + one_cycle(3,4,5,6,7,0,1,2,k256[21],hf( 5)); + one_cycle(2,3,4,5,6,7,0,1,k256[22],hf( 6)); + one_cycle(1,2,3,4,5,6,7,0,k256[23],hf( 7)); + one_cycle(0,1,2,3,4,5,6,7,k256[24],hf( 8)); + one_cycle(7,0,1,2,3,4,5,6,k256[25],hf( 9)); + one_cycle(6,7,0,1,2,3,4,5,k256[26],hf(10)); + one_cycle(5,6,7,0,1,2,3,4,k256[27],hf(11)); + one_cycle(4,5,6,7,0,1,2,3,k256[28],hf(12)); + one_cycle(3,4,5,6,7,0,1,2,k256[29],hf(13)); + one_cycle(2,3,4,5,6,7,0,1,k256[30],hf(14)); + one_cycle(1,2,3,4,5,6,7,0,k256[31],hf(15)); + + one_cycle(0,1,2,3,4,5,6,7,k256[32],hf( 0)); + one_cycle(7,0,1,2,3,4,5,6,k256[33],hf( 1)); + one_cycle(6,7,0,1,2,3,4,5,k256[34],hf( 2)); + one_cycle(5,6,7,0,1,2,3,4,k256[35],hf( 3)); + one_cycle(4,5,6,7,0,1,2,3,k256[36],hf( 4)); + one_cycle(3,4,5,6,7,0,1,2,k256[37],hf( 5)); + one_cycle(2,3,4,5,6,7,0,1,k256[38],hf( 6)); + one_cycle(1,2,3,4,5,6,7,0,k256[39],hf( 7)); + one_cycle(0,1,2,3,4,5,6,7,k256[40],hf( 8)); + one_cycle(7,0,1,2,3,4,5,6,k256[41],hf( 9)); + one_cycle(6,7,0,1,2,3,4,5,k256[42],hf(10)); + one_cycle(5,6,7,0,1,2,3,4,k256[43],hf(11)); + one_cycle(4,5,6,7,0,1,2,3,k256[44],hf(12)); + one_cycle(3,4,5,6,7,0,1,2,k256[45],hf(13)); + one_cycle(2,3,4,5,6,7,0,1,k256[46],hf(14)); + one_cycle(1,2,3,4,5,6,7,0,k256[47],hf(15)); + + one_cycle(0,1,2,3,4,5,6,7,k256[48],hf( 0)); + one_cycle(7,0,1,2,3,4,5,6,k256[49],hf( 1)); + one_cycle(6,7,0,1,2,3,4,5,k256[50],hf( 2)); + one_cycle(5,6,7,0,1,2,3,4,k256[51],hf( 3)); + one_cycle(4,5,6,7,0,1,2,3,k256[52],hf( 4)); + one_cycle(3,4,5,6,7,0,1,2,k256[53],hf( 5)); + one_cycle(2,3,4,5,6,7,0,1,k256[54],hf( 6)); + one_cycle(1,2,3,4,5,6,7,0,k256[55],hf( 7)); + one_cycle(0,1,2,3,4,5,6,7,k256[56],hf( 8)); + one_cycle(7,0,1,2,3,4,5,6,k256[57],hf( 9)); + one_cycle(6,7,0,1,2,3,4,5,k256[58],hf(10)); + one_cycle(5,6,7,0,1,2,3,4,k256[59],hf(11)); + one_cycle(4,5,6,7,0,1,2,3,k256[60],hf(12)); + one_cycle(3,4,5,6,7,0,1,2,k256[61],hf(13)); + one_cycle(2,3,4,5,6,7,0,1,k256[62],hf(14)); + one_cycle(1,2,3,4,5,6,7,0,k256[63],hf(15)); + + ctx->hash[0] += v0; ctx->hash[1] += v1; + ctx->hash[2] += v2; ctx->hash[3] += v3; + ctx->hash[4] += v4; ctx->hash[5] += v5; + ctx->hash[6] += v6; ctx->hash[7] += v7; +#endif +} + +/* SHA256 hash data in an array of bytes into hash buffer */ +/* and call the hash_compile function as required. */ + +VOID_RETURN sha256_hash(const unsigned char data[], unsigned long len, sha256_ctx ctx[1]) +{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA256_MASK), + space = SHA256_BLOCK_SIZE - pos; + const unsigned char *sp = data; + + if((ctx->count[0] += len) < len) + ++(ctx->count[1]); + + while(len >= space) /* tranfer whole blocks while possible */ + { + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); + sp += space; len -= space; space = SHA256_BLOCK_SIZE; pos = 0; + bsw_32(ctx->wbuf, SHA256_BLOCK_SIZE >> 2) + sha256_compile(ctx); + } + + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); +} + +/* SHA256 Final padding and digest calculation */ + +static void sha_end1(unsigned char hval[], sha256_ctx ctx[1], const unsigned int hlen) +{ uint_32t i = (uint_32t)(ctx->count[0] & SHA256_MASK); + + /* put bytes in the buffer in an order in which references to */ + /* 32-bit words will put bytes with lower addresses into the */ + /* top of 32 bit words on BOTH big and little endian machines */ + bsw_32(ctx->wbuf, (i + 3) >> 2) + + /* we now need to mask valid bytes and add the padding which is */ + /* a single 1 bit and as many zero bits as necessary. Note that */ + /* we can always add the first padding byte here because the */ + /* buffer always has at least one empty slot */ + ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); + ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); + + /* we need 9 or more empty positions, one for the padding byte */ + /* (above) and eight for the length count. If there is not */ + /* enough space pad and empty the buffer */ + if(i > SHA256_BLOCK_SIZE - 9) + { + if(i < 60) ctx->wbuf[15] = 0; + sha256_compile(ctx); + i = 0; + } + else /* compute a word index for the empty buffer positions */ + i = (i >> 2) + 1; + + while(i < 14) /* and zero pad all but last two positions */ + ctx->wbuf[i++] = 0; + + /* the following 32-bit length fields are assembled in the */ + /* wrong byte order on little endian machines but this is */ + /* corrected later since they are only ever used as 32-bit */ + /* word values. */ + ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); + ctx->wbuf[15] = ctx->count[0] << 3; + sha256_compile(ctx); + + /* extract the hash value as bytes in case the hash buffer is */ + /* mislaigned for 32-bit words */ + for(i = 0; i < hlen; ++i) + hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); +} + +#endif + +#if defined(SHA_224) + +const uint_32t i224[8] = +{ + 0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul, + 0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul +}; + +VOID_RETURN sha224_begin(sha224_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + memcpy(ctx->hash, i224, 8 * sizeof(uint_32t)); +} + +VOID_RETURN sha224_end(unsigned char hval[], sha224_ctx ctx[1]) +{ + sha_end1(hval, ctx, SHA224_DIGEST_SIZE); +} + +VOID_RETURN sha224(unsigned char hval[], const unsigned char data[], unsigned long len) +{ sha224_ctx cx[1]; + + sha224_begin(cx); + sha224_hash(data, len, cx); + sha_end1(hval, cx, SHA224_DIGEST_SIZE); +} + +#endif + +#if defined(SHA_256) + +const uint_32t i256[8] = +{ + 0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul, + 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul +}; + +VOID_RETURN sha256_begin(sha256_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + memcpy(ctx->hash, i256, 8 * sizeof(uint_32t)); +} + +VOID_RETURN sha256_end(unsigned char hval[], sha256_ctx ctx[1]) +{ + sha_end1(hval, ctx, SHA256_DIGEST_SIZE); +} + +VOID_RETURN sha256(unsigned char hval[], const unsigned char data[], unsigned long len) +{ sha256_ctx cx[1]; + + sha256_begin(cx); + sha256_hash(data, len, cx); + sha_end1(hval, cx, SHA256_DIGEST_SIZE); +} + +#endif + +#if defined(SHA_384) || defined(SHA_512) + +#define SHA512_MASK (SHA512_BLOCK_SIZE - 1) + +#define rotr64(x,n) (((x) >> n) | ((x) << (64 - n))) + +#if !defined(bswap_64) +#define bswap_64(x) (((uint_64t)(bswap_32((uint_32t)(x)))) << 32 | bswap_32((uint_32t)((x) >> 32))) +#endif + +#if defined(SWAP_BYTES) +#define bsw_64(p,n) \ + { int _i = (n); while(_i--) ((uint_64t*)p)[_i] = bswap_64(((uint_64t*)p)[_i]); } +#else +#define bsw_64(p,n) +#endif + +/* SHA512 mixing function definitions */ + +#ifdef s_0 +# undef s_0 +# undef s_1 +# undef g_0 +# undef g_1 +# undef k_0 +#endif + +#define s_0(x) (rotr64((x), 28) ^ rotr64((x), 34) ^ rotr64((x), 39)) +#define s_1(x) (rotr64((x), 14) ^ rotr64((x), 18) ^ rotr64((x), 41)) +#define g_0(x) (rotr64((x), 1) ^ rotr64((x), 8) ^ ((x) >> 7)) +#define g_1(x) (rotr64((x), 19) ^ rotr64((x), 61) ^ ((x) >> 6)) +#define k_0 k512 + +/* SHA384/SHA512 mixing data */ + +const uint_64t k512[80] = +{ + li_64(428a2f98d728ae22), li_64(7137449123ef65cd), + li_64(b5c0fbcfec4d3b2f), li_64(e9b5dba58189dbbc), + li_64(3956c25bf348b538), li_64(59f111f1b605d019), + li_64(923f82a4af194f9b), li_64(ab1c5ed5da6d8118), + li_64(d807aa98a3030242), li_64(12835b0145706fbe), + li_64(243185be4ee4b28c), li_64(550c7dc3d5ffb4e2), + li_64(72be5d74f27b896f), li_64(80deb1fe3b1696b1), + li_64(9bdc06a725c71235), li_64(c19bf174cf692694), + li_64(e49b69c19ef14ad2), li_64(efbe4786384f25e3), + li_64(0fc19dc68b8cd5b5), li_64(240ca1cc77ac9c65), + li_64(2de92c6f592b0275), li_64(4a7484aa6ea6e483), + li_64(5cb0a9dcbd41fbd4), li_64(76f988da831153b5), + li_64(983e5152ee66dfab), li_64(a831c66d2db43210), + li_64(b00327c898fb213f), li_64(bf597fc7beef0ee4), + li_64(c6e00bf33da88fc2), li_64(d5a79147930aa725), + li_64(06ca6351e003826f), li_64(142929670a0e6e70), + li_64(27b70a8546d22ffc), li_64(2e1b21385c26c926), + li_64(4d2c6dfc5ac42aed), li_64(53380d139d95b3df), + li_64(650a73548baf63de), li_64(766a0abb3c77b2a8), + li_64(81c2c92e47edaee6), li_64(92722c851482353b), + li_64(a2bfe8a14cf10364), li_64(a81a664bbc423001), + li_64(c24b8b70d0f89791), li_64(c76c51a30654be30), + li_64(d192e819d6ef5218), li_64(d69906245565a910), + li_64(f40e35855771202a), li_64(106aa07032bbd1b8), + li_64(19a4c116b8d2d0c8), li_64(1e376c085141ab53), + li_64(2748774cdf8eeb99), li_64(34b0bcb5e19b48a8), + li_64(391c0cb3c5c95a63), li_64(4ed8aa4ae3418acb), + li_64(5b9cca4f7763e373), li_64(682e6ff3d6b2b8a3), + li_64(748f82ee5defb2fc), li_64(78a5636f43172f60), + li_64(84c87814a1f0ab72), li_64(8cc702081a6439ec), + li_64(90befffa23631e28), li_64(a4506cebde82bde9), + li_64(bef9a3f7b2c67915), li_64(c67178f2e372532b), + li_64(ca273eceea26619c), li_64(d186b8c721c0c207), + li_64(eada7dd6cde0eb1e), li_64(f57d4f7fee6ed178), + li_64(06f067aa72176fba), li_64(0a637dc5a2c898a6), + li_64(113f9804bef90dae), li_64(1b710b35131c471b), + li_64(28db77f523047d84), li_64(32caab7b40c72493), + li_64(3c9ebe0a15c9bebc), li_64(431d67c49c100d4c), + li_64(4cc5d4becb3e42b6), li_64(597f299cfc657e2a), + li_64(5fcb6fab3ad6faec), li_64(6c44198c4a475817) +}; + +/* Compile 128 bytes of hash data into SHA384/512 digest */ +/* NOTE: this routine assumes that the byte order in the */ +/* ctx->wbuf[] at this point is such that low address bytes */ +/* in the ORIGINAL byte stream will go into the high end of */ +/* words on BOTH big and little endian systems */ + +VOID_RETURN sha512_compile(sha512_ctx ctx[1]) +{ uint_64t v[8], *p = ctx->wbuf; + uint_32t j; + + memcpy(v, ctx->hash, 8 * sizeof(uint_64t)); + + for(j = 0; j < 80; j += 16) + { + v_cycle( 0, j); v_cycle( 1, j); + v_cycle( 2, j); v_cycle( 3, j); + v_cycle( 4, j); v_cycle( 5, j); + v_cycle( 6, j); v_cycle( 7, j); + v_cycle( 8, j); v_cycle( 9, j); + v_cycle(10, j); v_cycle(11, j); + v_cycle(12, j); v_cycle(13, j); + v_cycle(14, j); v_cycle(15, j); + } + + ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; + ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; + ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; + ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; +} + +/* Compile 128 bytes of hash data into SHA256 digest value */ +/* NOTE: this routine assumes that the byte order in the */ +/* ctx->wbuf[] at this point is in such an order that low */ +/* address bytes in the ORIGINAL byte stream placed in this */ +/* buffer will now go to the high end of words on BOTH big */ +/* and little endian systems */ + +VOID_RETURN sha512_hash(const unsigned char data[], unsigned long len, sha512_ctx ctx[1]) +{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA512_MASK), + space = SHA512_BLOCK_SIZE - pos; + const unsigned char *sp = data; + + if((ctx->count[0] += len) < len) + ++(ctx->count[1]); + + while(len >= space) /* tranfer whole blocks while possible */ + { + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); + sp += space; len -= space; space = SHA512_BLOCK_SIZE; pos = 0; + bsw_64(ctx->wbuf, SHA512_BLOCK_SIZE >> 3); + sha512_compile(ctx); + } + + memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); +} + +/* SHA384/512 Final padding and digest calculation */ + +static void sha_end2(unsigned char hval[], sha512_ctx ctx[1], const unsigned int hlen) +{ uint_32t i = (uint_32t)(ctx->count[0] & SHA512_MASK); + + /* put bytes in the buffer in an order in which references to */ + /* 32-bit words will put bytes with lower addresses into the */ + /* top of 32 bit words on BOTH big and little endian machines */ + bsw_64(ctx->wbuf, (i + 7) >> 3); + + /* we now need to mask valid bytes and add the padding which is */ + /* a single 1 bit and as many zero bits as necessary. Note that */ + /* we can always add the first padding byte here because the */ + /* buffer always has at least one empty slot */ + ctx->wbuf[i >> 3] &= li_64(ffffffffffffff00) << 8 * (~i & 7); + ctx->wbuf[i >> 3] |= li_64(0000000000000080) << 8 * (~i & 7); + + /* we need 17 or more empty byte positions, one for the padding */ + /* byte (above) and sixteen for the length count. If there is */ + /* not enough space pad and empty the buffer */ + if(i > SHA512_BLOCK_SIZE - 17) + { + if(i < 120) ctx->wbuf[15] = 0; + sha512_compile(ctx); + i = 0; + } + else + i = (i >> 3) + 1; + + while(i < 14) + ctx->wbuf[i++] = 0; + + /* the following 64-bit length fields are assembled in the */ + /* wrong byte order on little endian machines but this is */ + /* corrected later since they are only ever used as 64-bit */ + /* word values. */ + ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 61); + ctx->wbuf[15] = ctx->count[0] << 3; + sha512_compile(ctx); + + /* extract the hash value as bytes in case the hash buffer is */ + /* misaligned for 32-bit words */ + for(i = 0; i < hlen; ++i) + hval[i] = (unsigned char)(ctx->hash[i >> 3] >> (8 * (~i & 7))); +} + +#endif + +#if defined(SHA_384) + +/* SHA384 initialisation data */ + +const uint_64t i384[80] = +{ + li_64(cbbb9d5dc1059ed8), li_64(629a292a367cd507), + li_64(9159015a3070dd17), li_64(152fecd8f70e5939), + li_64(67332667ffc00b31), li_64(8eb44a8768581511), + li_64(db0c2e0d64f98fa7), li_64(47b5481dbefa4fa4) +}; + +VOID_RETURN sha384_begin(sha384_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + memcpy(ctx->hash, i384, 8 * sizeof(uint_64t)); +} + +VOID_RETURN sha384_end(unsigned char hval[], sha384_ctx ctx[1]) +{ + sha_end2(hval, ctx, SHA384_DIGEST_SIZE); +} + +VOID_RETURN sha384(unsigned char hval[], const unsigned char data[], unsigned long len) +{ sha384_ctx cx[1]; + + sha384_begin(cx); + sha384_hash(data, len, cx); + sha_end2(hval, cx, SHA384_DIGEST_SIZE); +} + +#endif + +#if defined(SHA_512) + +/* SHA512 initialisation data */ + +const uint_64t i512[80] = +{ + li_64(6a09e667f3bcc908), li_64(bb67ae8584caa73b), + li_64(3c6ef372fe94f82b), li_64(a54ff53a5f1d36f1), + li_64(510e527fade682d1), li_64(9b05688c2b3e6c1f), + li_64(1f83d9abfb41bd6b), li_64(5be0cd19137e2179) +}; + +VOID_RETURN sha512_begin(sha512_ctx ctx[1]) +{ + ctx->count[0] = ctx->count[1] = 0; + memcpy(ctx->hash, i512, 8 * sizeof(uint_64t)); +} + +VOID_RETURN sha512_end(unsigned char hval[], sha512_ctx ctx[1]) +{ + sha_end2(hval, ctx, SHA512_DIGEST_SIZE); +} + +VOID_RETURN sha512(unsigned char hval[], const unsigned char data[], unsigned long len) +{ sha512_ctx cx[1]; + + sha512_begin(cx); + sha512_hash(data, len, cx); + sha_end2(hval, cx, SHA512_DIGEST_SIZE); +} + +#endif + +#if defined(SHA_2) + +#define CTX_224(x) ((x)->uu->ctx256) +#define CTX_256(x) ((x)->uu->ctx256) +#define CTX_384(x) ((x)->uu->ctx512) +#define CTX_512(x) ((x)->uu->ctx512) + +/* SHA2 initialisation */ + +INT_RETURN sha2_begin(unsigned long len, sha2_ctx ctx[1]) +{ + switch(len) + { +#if defined(SHA_224) + case 224: + case 28: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; + memcpy(CTX_256(ctx)->hash, i224, 32); + ctx->sha2_len = 28; return EXIT_SUCCESS; +#endif +#if defined(SHA_256) + case 256: + case 32: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; + memcpy(CTX_256(ctx)->hash, i256, 32); + ctx->sha2_len = 32; return EXIT_SUCCESS; +#endif +#if defined(SHA_384) + case 384: + case 48: CTX_384(ctx)->count[0] = CTX_384(ctx)->count[1] = 0; + memcpy(CTX_384(ctx)->hash, i384, 64); + ctx->sha2_len = 48; return EXIT_SUCCESS; +#endif +#if defined(SHA_512) + case 512: + case 64: CTX_512(ctx)->count[0] = CTX_512(ctx)->count[1] = 0; + memcpy(CTX_512(ctx)->hash, i512, 64); + ctx->sha2_len = 64; return EXIT_SUCCESS; +#endif + default: return EXIT_FAILURE; + } +} + +VOID_RETURN sha2_hash(const unsigned char data[], unsigned long len, sha2_ctx ctx[1]) +{ + switch(ctx->sha2_len) + { +#if defined(SHA_224) + case 28: sha224_hash(data, len, CTX_224(ctx)); return; +#endif +#if defined(SHA_256) + case 32: sha256_hash(data, len, CTX_256(ctx)); return; +#endif +#if defined(SHA_384) + case 48: sha384_hash(data, len, CTX_384(ctx)); return; +#endif +#if defined(SHA_512) + case 64: sha512_hash(data, len, CTX_512(ctx)); return; +#endif + } +} + +VOID_RETURN sha2_end(unsigned char hval[], sha2_ctx ctx[1]) +{ + switch(ctx->sha2_len) + { +#if defined(SHA_224) + case 28: sha_end1(hval, CTX_224(ctx), SHA224_DIGEST_SIZE); return; +#endif +#if defined(SHA_256) + case 32: sha_end1(hval, CTX_256(ctx), SHA256_DIGEST_SIZE); return; +#endif +#if defined(SHA_384) + case 48: sha_end2(hval, CTX_384(ctx), SHA384_DIGEST_SIZE); return; +#endif +#if defined(SHA_512) + case 64: sha_end2(hval, CTX_512(ctx), SHA512_DIGEST_SIZE); return; +#endif + } +} + +INT_RETURN sha2(unsigned char hval[], unsigned long size, + const unsigned char data[], unsigned long len) +{ sha2_ctx cx[1]; + + if(sha2_begin(size, cx) == EXIT_SUCCESS) + { + sha2_hash(data, len, cx); sha2_end(hval, cx); return EXIT_SUCCESS; + } + else + return EXIT_FAILURE; +} + +#endif + +#if defined(__cplusplus) +} +#endif diff --git a/src/utils/crypto/sha2.h b/src/utils/crypto/sha2.h new file mode 100644 index 00000000000..3ebf6671005 --- /dev/null +++ b/src/utils/crypto/sha2.h @@ -0,0 +1,155 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + Issue Date: 01/08/2005 +*/ + +#ifndef _SHA2_H +#define _SHA2_H + +#include "../common/tcdefs.h" +#include "../common/endian.h" + +#define SHA_64BIT + +/* define the hash functions that you need */ +#define SHA_2 /* for dynamic hash length */ +#define SHA_224 +#define SHA_256 +#ifdef SHA_64BIT +# define SHA_384 +# define SHA_512 +# define NEED_UINT_64T +#endif + +#ifndef EXIT_SUCCESS +#define EXIT_SUCCESS 0 +#define EXIT_FAILURE 1 +#endif + +#define li_64(h) 0x##h##ull + +#define VOID_RETURN void +#define INT_RETURN int + +#if defined(__cplusplus) +extern "C" +{ +#endif + +/* Note that the following function prototypes are the same */ +/* for both the bit and byte oriented implementations. But */ +/* the length fields are in bytes or bits as is appropriate */ +/* for the version used. Bit sequences are arrays of bytes */ +/* in which bit sequence indexes increase from the most to */ +/* the least significant end of each byte */ + +#define SHA224_DIGEST_SIZE 28 +#define SHA224_BLOCK_SIZE 64 +#define SHA256_DIGEST_SIZE 32 +#define SHA256_BLOCK_SIZE 64 + +/* type to hold the SHA256 (and SHA224) context */ + +typedef struct +{ uint_32t count[2]; + uint_32t hash[8]; + uint_32t wbuf[16]; +} sha256_ctx; + +typedef sha256_ctx sha224_ctx; + +VOID_RETURN sha256_compile(sha256_ctx ctx[1]); + +VOID_RETURN sha224_begin(sha224_ctx ctx[1]); +#define sha224_hash sha256_hash +VOID_RETURN sha224_end(uint8_t hval[], sha224_ctx ctx[1]); +VOID_RETURN sha224(uint8_t hval[], const uint8_t data[], unsigned long len); + +VOID_RETURN sha256_begin(sha256_ctx ctx[1]); +VOID_RETURN sha256_hash(const uint8_t data[], unsigned long len, sha256_ctx ctx[1]); +VOID_RETURN sha256_end(uint8_t hval[], sha256_ctx ctx[1]); +VOID_RETURN sha256(uint8_t hval[], const uint8_t data[], unsigned long len); + +#ifndef SHA_64BIT + +typedef struct +{ union + { sha256_ctx ctx256[1]; + } uu[1]; + uint_32t sha2_len; +} sha2_ctx; + +#define SHA2_MAX_DIGEST_SIZE SHA256_DIGEST_SIZE + +#else + +#define SHA384_DIGEST_SIZE 48 +#define SHA384_BLOCK_SIZE 128 +#define SHA512_DIGEST_SIZE 64 +#define SHA512_BLOCK_SIZE 128 +#define SHA2_MAX_DIGEST_SIZE SHA512_DIGEST_SIZE + +/* type to hold the SHA384 (and SHA512) context */ + +typedef struct +{ uint_64t count[2]; + uint_64t hash[8]; + uint_64t wbuf[16]; +} sha512_ctx; + +typedef sha512_ctx sha384_ctx; + +typedef struct +{ union + { sha256_ctx ctx256[1]; + sha512_ctx ctx512[1]; + } uu[1]; + uint_32t sha2_len; +} sha2_ctx; + +VOID_RETURN sha512_compile(sha512_ctx ctx[1]); + +VOID_RETURN sha384_begin(sha384_ctx ctx[1]); +#define sha384_hash sha512_hash +VOID_RETURN sha384_end(uint8_t hval[], sha384_ctx ctx[1]); +VOID_RETURN sha384(uint8_t hval[], const uint8_t data[], unsigned long len); + +VOID_RETURN sha512_begin(sha512_ctx ctx[1]); +VOID_RETURN sha512_hash(const uint8_t data[], unsigned long len, sha512_ctx ctx[1]); +VOID_RETURN sha512_end(uint8_t hval[], sha512_ctx ctx[1]); +VOID_RETURN sha512(uint8_t hval[], const uint8_t data[], unsigned long len); + +INT_RETURN sha2_begin(unsigned long size, sha2_ctx ctx[1]); +VOID_RETURN sha2_hash(const uint8_t data[], unsigned long len, sha2_ctx ctx[1]); +VOID_RETURN sha2_end(uint8_t hval[], sha2_ctx ctx[1]); +INT_RETURN sha2(uint8_t hval[], unsigned long size, const uint8_t data[], unsigned long len); + +#endif + +#if defined(__cplusplus) +} +#endif + +#endif diff --git a/src/utils/crypto/sk.h b/src/utils/crypto/sk.h new file mode 100644 index 00000000000..ea55bc6ff76 --- /dev/null +++ b/src/utils/crypto/sk.h @@ -0,0 +1,206 @@ +/* Deprecated/legacy */ + +/* crypto/des/sk.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +static const DES_LONG des_skb[8][64]={ +{ +/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000L,0x00000010L,0x20000000L,0x20000010L, +0x00010000L,0x00010010L,0x20010000L,0x20010010L, +0x00000800L,0x00000810L,0x20000800L,0x20000810L, +0x00010800L,0x00010810L,0x20010800L,0x20010810L, +0x00000020L,0x00000030L,0x20000020L,0x20000030L, +0x00010020L,0x00010030L,0x20010020L,0x20010030L, +0x00000820L,0x00000830L,0x20000820L,0x20000830L, +0x00010820L,0x00010830L,0x20010820L,0x20010830L, +0x00080000L,0x00080010L,0x20080000L,0x20080010L, +0x00090000L,0x00090010L,0x20090000L,0x20090010L, +0x00080800L,0x00080810L,0x20080800L,0x20080810L, +0x00090800L,0x00090810L,0x20090800L,0x20090810L, +0x00080020L,0x00080030L,0x20080020L,0x20080030L, +0x00090020L,0x00090030L,0x20090020L,0x20090030L, +0x00080820L,0x00080830L,0x20080820L,0x20080830L, +0x00090820L,0x00090830L,0x20090820L,0x20090830L, +},{ +/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ +0x00000000L,0x02000000L,0x00002000L,0x02002000L, +0x00200000L,0x02200000L,0x00202000L,0x02202000L, +0x00000004L,0x02000004L,0x00002004L,0x02002004L, +0x00200004L,0x02200004L,0x00202004L,0x02202004L, +0x00000400L,0x02000400L,0x00002400L,0x02002400L, +0x00200400L,0x02200400L,0x00202400L,0x02202400L, +0x00000404L,0x02000404L,0x00002404L,0x02002404L, +0x00200404L,0x02200404L,0x00202404L,0x02202404L, +0x10000000L,0x12000000L,0x10002000L,0x12002000L, +0x10200000L,0x12200000L,0x10202000L,0x12202000L, +0x10000004L,0x12000004L,0x10002004L,0x12002004L, +0x10200004L,0x12200004L,0x10202004L,0x12202004L, +0x10000400L,0x12000400L,0x10002400L,0x12002400L, +0x10200400L,0x12200400L,0x10202400L,0x12202400L, +0x10000404L,0x12000404L,0x10002404L,0x12002404L, +0x10200404L,0x12200404L,0x10202404L,0x12202404L, +},{ +/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ +0x00000000L,0x00000001L,0x00040000L,0x00040001L, +0x01000000L,0x01000001L,0x01040000L,0x01040001L, +0x00000002L,0x00000003L,0x00040002L,0x00040003L, +0x01000002L,0x01000003L,0x01040002L,0x01040003L, +0x00000200L,0x00000201L,0x00040200L,0x00040201L, +0x01000200L,0x01000201L,0x01040200L,0x01040201L, +0x00000202L,0x00000203L,0x00040202L,0x00040203L, +0x01000202L,0x01000203L,0x01040202L,0x01040203L, +0x08000000L,0x08000001L,0x08040000L,0x08040001L, +0x09000000L,0x09000001L,0x09040000L,0x09040001L, +0x08000002L,0x08000003L,0x08040002L,0x08040003L, +0x09000002L,0x09000003L,0x09040002L,0x09040003L, +0x08000200L,0x08000201L,0x08040200L,0x08040201L, +0x09000200L,0x09000201L,0x09040200L,0x09040201L, +0x08000202L,0x08000203L,0x08040202L,0x08040203L, +0x09000202L,0x09000203L,0x09040202L,0x09040203L, +},{ +/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ +0x00000000L,0x00100000L,0x00000100L,0x00100100L, +0x00000008L,0x00100008L,0x00000108L,0x00100108L, +0x00001000L,0x00101000L,0x00001100L,0x00101100L, +0x00001008L,0x00101008L,0x00001108L,0x00101108L, +0x04000000L,0x04100000L,0x04000100L,0x04100100L, +0x04000008L,0x04100008L,0x04000108L,0x04100108L, +0x04001000L,0x04101000L,0x04001100L,0x04101100L, +0x04001008L,0x04101008L,0x04001108L,0x04101108L, +0x00020000L,0x00120000L,0x00020100L,0x00120100L, +0x00020008L,0x00120008L,0x00020108L,0x00120108L, +0x00021000L,0x00121000L,0x00021100L,0x00121100L, +0x00021008L,0x00121008L,0x00021108L,0x00121108L, +0x04020000L,0x04120000L,0x04020100L,0x04120100L, +0x04020008L,0x04120008L,0x04020108L,0x04120108L, +0x04021000L,0x04121000L,0x04021100L,0x04121100L, +0x04021008L,0x04121008L,0x04021108L,0x04121108L, +},{ +/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ +0x00000000L,0x10000000L,0x00010000L,0x10010000L, +0x00000004L,0x10000004L,0x00010004L,0x10010004L, +0x20000000L,0x30000000L,0x20010000L,0x30010000L, +0x20000004L,0x30000004L,0x20010004L,0x30010004L, +0x00100000L,0x10100000L,0x00110000L,0x10110000L, +0x00100004L,0x10100004L,0x00110004L,0x10110004L, +0x20100000L,0x30100000L,0x20110000L,0x30110000L, +0x20100004L,0x30100004L,0x20110004L,0x30110004L, +0x00001000L,0x10001000L,0x00011000L,0x10011000L, +0x00001004L,0x10001004L,0x00011004L,0x10011004L, +0x20001000L,0x30001000L,0x20011000L,0x30011000L, +0x20001004L,0x30001004L,0x20011004L,0x30011004L, +0x00101000L,0x10101000L,0x00111000L,0x10111000L, +0x00101004L,0x10101004L,0x00111004L,0x10111004L, +0x20101000L,0x30101000L,0x20111000L,0x30111000L, +0x20101004L,0x30101004L,0x20111004L,0x30111004L, +},{ +/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ +0x00000000L,0x08000000L,0x00000008L,0x08000008L, +0x00000400L,0x08000400L,0x00000408L,0x08000408L, +0x00020000L,0x08020000L,0x00020008L,0x08020008L, +0x00020400L,0x08020400L,0x00020408L,0x08020408L, +0x00000001L,0x08000001L,0x00000009L,0x08000009L, +0x00000401L,0x08000401L,0x00000409L,0x08000409L, +0x00020001L,0x08020001L,0x00020009L,0x08020009L, +0x00020401L,0x08020401L,0x00020409L,0x08020409L, +0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, +0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, +0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, +0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, +0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, +0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, +0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, +0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, +},{ +/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ +0x00000000L,0x00000100L,0x00080000L,0x00080100L, +0x01000000L,0x01000100L,0x01080000L,0x01080100L, +0x00000010L,0x00000110L,0x00080010L,0x00080110L, +0x01000010L,0x01000110L,0x01080010L,0x01080110L, +0x00200000L,0x00200100L,0x00280000L,0x00280100L, +0x01200000L,0x01200100L,0x01280000L,0x01280100L, +0x00200010L,0x00200110L,0x00280010L,0x00280110L, +0x01200010L,0x01200110L,0x01280010L,0x01280110L, +0x00000200L,0x00000300L,0x00080200L,0x00080300L, +0x01000200L,0x01000300L,0x01080200L,0x01080300L, +0x00000210L,0x00000310L,0x00080210L,0x00080310L, +0x01000210L,0x01000310L,0x01080210L,0x01080310L, +0x00200200L,0x00200300L,0x00280200L,0x00280300L, +0x01200200L,0x01200300L,0x01280200L,0x01280300L, +0x00200210L,0x00200310L,0x00280210L,0x00280310L, +0x01200210L,0x01200310L,0x01280210L,0x01280310L, +},{ +/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ +0x00000000L,0x04000000L,0x00040000L,0x04040000L, +0x00000002L,0x04000002L,0x00040002L,0x04040002L, +0x00002000L,0x04002000L,0x00042000L,0x04042000L, +0x00002002L,0x04002002L,0x00042002L,0x04042002L, +0x00000020L,0x04000020L,0x00040020L,0x04040020L, +0x00000022L,0x04000022L,0x00040022L,0x04040022L, +0x00002020L,0x04002020L,0x00042020L,0x04042020L, +0x00002022L,0x04002022L,0x00042022L,0x04042022L, +0x00000800L,0x04000800L,0x00040800L,0x04040800L, +0x00000802L,0x04000802L,0x00040802L,0x04040802L, +0x00002800L,0x04002800L,0x00042800L,0x04042800L, +0x00002802L,0x04002802L,0x00042802L,0x04042802L, +0x00000820L,0x04000820L,0x00040820L,0x04040820L, +0x00000822L,0x04000822L,0x00040822L,0x04040822L, +0x00002820L,0x04002820L,0x00042820L,0x04042820L, +0x00002822L,0x04002822L,0x00042822L,0x04042822L, +}}; diff --git a/src/utils/crypto/spr.h b/src/utils/crypto/spr.h new file mode 100644 index 00000000000..ef72408c4da --- /dev/null +++ b/src/utils/crypto/spr.h @@ -0,0 +1,206 @@ +/* Deprecated/legacy */ + +/* crypto/des/spr.h */ +/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) + * All rights reserved. + * + * This package is an SSL implementation written + * by Eric Young (eay@cryptsoft.com). + * The implementation was written so as to conform with Netscapes SSL. + * + * This library is free for commercial and non-commercial use as long as + * the following conditions are aheared to. The following conditions + * apply to all code found in this distribution, be it the RC4, RSA, + * lhash, DES, etc., code; not just the SSL code. The SSL documentation + * included with this distribution is covered by the same copyright terms + * except that the holder is Tim Hudson (tjh@cryptsoft.com). + * + * Copyright remains Eric Young's, and as such any Copyright notices in + * the code are not to be removed. + * If this package is used in a product, Eric Young should be given attribution + * as the author of the parts of the library used. + * This can be in the form of a textual message at program startup or + * in documentation (online or textual) provided with the package. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * "This product includes cryptographic software written by + * Eric Young (eay@cryptsoft.com)" + * The word 'cryptographic' can be left out if the rouines from the library + * being used are not cryptographic related :-). + * 4. If you include any Windows specific code (or a derivative thereof) from + * the apps directory (application code) you must include an acknowledgement: + * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" + * + * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * The licence and distribution terms for any publically available version or + * derivative of this code cannot be changed. i.e. this code cannot simply be + * copied and put under another distribution licence + * [including the GNU Public Licence.] + */ + +const DES_LONG des_SPtrans[8][64]={ +{ +/* nibble 0 */ +0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, +0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, +0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, +0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, +0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, +0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, +0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, +0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, +0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, +0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, +0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, +0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, +0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, +0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, +0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, +0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, +},{ +/* nibble 1 */ +0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, +0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, +0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, +0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, +0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, +0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, +0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, +0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, +0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, +0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, +0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, +0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, +0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, +0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, +0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, +0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, +},{ +/* nibble 2 */ +0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, +0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, +0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, +0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, +0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, +0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, +0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, +0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, +0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, +0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, +0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, +0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, +0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, +0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, +0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, +0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, +},{ +/* nibble 3 */ +0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, +0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, +0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, +0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, +0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, +0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, +0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, +0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, +0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, +0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, +0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, +0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, +0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, +0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, +0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, +0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, +},{ +/* nibble 4 */ +0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, +0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, +0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, +0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, +0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, +0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, +0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, +0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, +0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, +0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, +0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, +0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, +0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, +0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, +0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, +0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, +},{ +/* nibble 5 */ +0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, +0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, +0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, +0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, +0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, +0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, +0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, +0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, +0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, +0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, +0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, +0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, +0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, +0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, +0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, +0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, +},{ +/* nibble 6 */ +0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, +0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, +0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, +0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, +0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, +0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, +0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, +0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, +0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, +0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, +0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, +0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, +0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, +0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, +0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, +0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, +},{ +/* nibble 7 */ +0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, +0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, +0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, +0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, +0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, +0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, +0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, +0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, +0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, +0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, +0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, +0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, +0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, +0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, +0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, +0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, +}}; diff --git a/src/utils/crypto/twofish.c b/src/utils/crypto/twofish.c new file mode 100644 index 00000000000..981acdba87d --- /dev/null +++ b/src/utils/crypto/twofish.c @@ -0,0 +1,548 @@ +/* + --------------------------------------------------------------------------- + Copyright (c) 1999, Dr Brian Gladman, Worcester, UK. All rights reserved. + + LICENSE TERMS + + The free distribution and use of this software is allowed (with or without + changes) provided that: + + 1. source code distributions include the above copyright notice, this + list of conditions and the following disclaimer; + + 2. binary distributions include the above copyright notice, this list + of conditions and the following disclaimer in their documentation; + + 3. the name of the copyright holder is not used to endorse products + built using this software without specific written permission. + + DISCLAIMER + + This software is provided 'as is' with no explicit or implied warranties + in respect of its properties, including, but not limited to, correctness + and/or fitness for purpose. + --------------------------------------------------------------------------- + + My thanks to Doug Whiting and Niels Ferguson for comments that led + to improvements in this implementation. + + Issue Date: 14th January 1999 +*/ + +/* Adapted for TrueCrypt by the TrueCrypt Foundation */ + + +#ifdef TC_WINDOWS_BOOT +#pragma optimize ("tl", on) +#endif + +#include "twofish.h" +#include "../common/endian.h" + +#define Q_TABLES +#define M_TABLE + +#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH) +# define MK_TABLE +# define ONE_STEP +#endif + +/* finite field arithmetic for GF(2**8) with the modular */ +/* polynomial x^8 + x^6 + x^5 + x^3 + 1 (0x169) */ + +#define G_M 0x0169 + +static u1byte tab_5b[4] = { 0, G_M >> 2, G_M >> 1, (G_M >> 1) ^ (G_M >> 2) }; +static u1byte tab_ef[4] = { 0, (G_M >> 1) ^ (G_M >> 2), G_M >> 1, G_M >> 2 }; + +#define ffm_01(x) (x) +#define ffm_5b(x) ((x) ^ ((x) >> 2) ^ tab_5b[(x) & 3]) +#define ffm_ef(x) ((x) ^ ((x) >> 1) ^ ((x) >> 2) ^ tab_ef[(x) & 3]) + +static u1byte ror4[16] = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 }; +static u1byte ashx[16] = { 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 5, 14, 7 }; + +static u1byte qt0[2][16] = +{ { 8, 1, 7, 13, 6, 15, 3, 2, 0, 11, 5, 9, 14, 12, 10, 4 }, + { 2, 8, 11, 13, 15, 7, 6, 14, 3, 1, 9, 4, 0, 10, 12, 5 } +}; + +static u1byte qt1[2][16] = +{ { 14, 12, 11, 8, 1, 2, 3, 5, 15, 4, 10, 6, 7, 0, 9, 13 }, + { 1, 14, 2, 11, 4, 12, 3, 7, 6, 13, 10, 5, 15, 9, 0, 8 } +}; + +static u1byte qt2[2][16] = +{ { 11, 10, 5, 14, 6, 13, 9, 0, 12, 8, 15, 3, 2, 4, 7, 1 }, + { 4, 12, 7, 5, 1, 6, 9, 10, 0, 14, 13, 8, 2, 11, 3, 15 } +}; + +static u1byte qt3[2][16] = +{ { 13, 7, 15, 4, 1, 2, 6, 14, 9, 11, 3, 0, 8, 5, 12, 10 }, + { 11, 9, 5, 1, 12, 3, 13, 14, 6, 4, 7, 15, 2, 0, 8, 10 } +}; + +static u1byte qp(const u4byte n, const u1byte x) +{ u1byte a0, a1, a2, a3, a4, b0, b1, b2, b3, b4; + + a0 = x >> 4; b0 = x & 15; + a1 = a0 ^ b0; b1 = ror4[b0] ^ ashx[a0]; + a2 = qt0[n][a1]; b2 = qt1[n][b1]; + a3 = a2 ^ b2; b3 = ror4[b2] ^ ashx[a2]; + a4 = qt2[n][a3]; b4 = qt3[n][b3]; + return (b4 << 4) | a4; +}; + +#ifdef Q_TABLES + +static u4byte qt_gen = 0; +static u1byte q_tab[2][256]; + +#define q(n,x) q_tab[n][x] + +static void gen_qtab(void) +{ u4byte i; + + for(i = 0; i < 256; ++i) + { + q(0,i) = qp(0, (u1byte)i); + q(1,i) = qp(1, (u1byte)i); + } +}; + +#else + +#define q(n,x) qp(n, x) + +#endif + +#ifdef M_TABLE + +static u4byte mt_gen = 0; +static u4byte m_tab[4][256]; + +static void gen_mtab(void) +{ u4byte i, f01, f5b, fef; + + for(i = 0; i < 256; ++i) + { + f01 = q(1,i); f5b = ffm_5b(f01); fef = ffm_ef(f01); + m_tab[0][i] = f01 + (f5b << 8) + (fef << 16) + (fef << 24); + m_tab[2][i] = f5b + (fef << 8) + (f01 << 16) + (fef << 24); + + f01 = q(0,i); f5b = ffm_5b(f01); fef = ffm_ef(f01); + m_tab[1][i] = fef + (fef << 8) + (f5b << 16) + (f01 << 24); + m_tab[3][i] = f5b + (f01 << 8) + (fef << 16) + (f5b << 24); + } +}; + +#define mds(n,x) m_tab[n][x] + +#else + +#define fm_00 ffm_01 +#define fm_10 ffm_5b +#define fm_20 ffm_ef +#define fm_30 ffm_ef +#define q_0(x) q(1,x) + +#define fm_01 ffm_ef +#define fm_11 ffm_ef +#define fm_21 ffm_5b +#define fm_31 ffm_01 +#define q_1(x) q(0,x) + +#define fm_02 ffm_5b +#define fm_12 ffm_ef +#define fm_22 ffm_01 +#define fm_32 ffm_ef +#define q_2(x) q(1,x) + +#define fm_03 ffm_5b +#define fm_13 ffm_01 +#define fm_23 ffm_ef +#define fm_33 ffm_5b +#define q_3(x) q(0,x) + +#define f_0(n,x) ((u4byte)fm_0##n(x)) +#define f_1(n,x) ((u4byte)fm_1##n(x) << 8) +#define f_2(n,x) ((u4byte)fm_2##n(x) << 16) +#define f_3(n,x) ((u4byte)fm_3##n(x) << 24) + +#define mds(n,x) f_0(n,q_##n(x)) ^ f_1(n,q_##n(x)) ^ f_2(n,q_##n(x)) ^ f_3(n,q_##n(x)) + +#endif + +static u4byte h_fun(TwofishInstance *instance, const u4byte x, const u4byte key[]) +{ u4byte b0, b1, b2, b3; + +#ifndef M_TABLE + u4byte m5b_b0, m5b_b1, m5b_b2, m5b_b3; + u4byte mef_b0, mef_b1, mef_b2, mef_b3; +#endif + + b0 = extract_byte(x, 0); b1 = extract_byte(x, 1); b2 = extract_byte(x, 2); b3 = extract_byte(x, 3); + + switch(instance->k_len) + { + case 4: b0 = q(1, (u1byte) b0) ^ extract_byte(key[3],0); + b1 = q(0, (u1byte) b1) ^ extract_byte(key[3],1); + b2 = q(0, (u1byte) b2) ^ extract_byte(key[3],2); + b3 = q(1, (u1byte) b3) ^ extract_byte(key[3],3); + case 3: b0 = q(1, (u1byte) b0) ^ extract_byte(key[2],0); + b1 = q(1, (u1byte) b1) ^ extract_byte(key[2],1); + b2 = q(0, (u1byte) b2) ^ extract_byte(key[2],2); + b3 = q(0, (u1byte) b3) ^ extract_byte(key[2],3); + case 2: b0 = q(0, (u1byte) (q(0, (u1byte) b0) ^ extract_byte(key[1],0))) ^ extract_byte(key[0],0); + b1 = q(0, (u1byte) (q(1, (u1byte) b1) ^ extract_byte(key[1],1))) ^ extract_byte(key[0],1); + b2 = q(1, (u1byte) (q(0, (u1byte) b2) ^ extract_byte(key[1],2))) ^ extract_byte(key[0],2); + b3 = q(1, (u1byte) (q(1, (u1byte) b3) ^ extract_byte(key[1],3))) ^ extract_byte(key[0],3); + } +#ifdef M_TABLE + + return mds(0, b0) ^ mds(1, b1) ^ mds(2, b2) ^ mds(3, b3); + +#else + + b0 = q(1, (u1byte) b0); b1 = q(0, (u1byte) b1); b2 = q(1, (u1byte) b2); b3 = q(0, (u1byte) b3); + m5b_b0 = ffm_5b(b0); m5b_b1 = ffm_5b(b1); m5b_b2 = ffm_5b(b2); m5b_b3 = ffm_5b(b3); + mef_b0 = ffm_ef(b0); mef_b1 = ffm_ef(b1); mef_b2 = ffm_ef(b2); mef_b3 = ffm_ef(b3); + b0 ^= mef_b1 ^ m5b_b2 ^ m5b_b3; b3 ^= m5b_b0 ^ mef_b1 ^ mef_b2; + b2 ^= mef_b0 ^ m5b_b1 ^ mef_b3; b1 ^= mef_b0 ^ mef_b2 ^ m5b_b3; + + return b0 | (b3 << 8) | (b2 << 16) | (b1 << 24); + +#endif +}; + +#ifdef MK_TABLE + +#ifdef ONE_STEP +//u4byte mk_tab[4][256]; +#else +static u1byte sb[4][256]; +#endif + +#define q20(x) q(0,q(0,x) ^ extract_byte(key[1],0)) ^ extract_byte(key[0],0) +#define q21(x) q(0,q(1,x) ^ extract_byte(key[1],1)) ^ extract_byte(key[0],1) +#define q22(x) q(1,q(0,x) ^ extract_byte(key[1],2)) ^ extract_byte(key[0],2) +#define q23(x) q(1,q(1,x) ^ extract_byte(key[1],3)) ^ extract_byte(key[0],3) + +#define q30(x) q(0,q(0,q(1, x) ^ extract_byte(key[2],0)) ^ extract_byte(key[1],0)) ^ extract_byte(key[0],0) +#define q31(x) q(0,q(1,q(1, x) ^ extract_byte(key[2],1)) ^ extract_byte(key[1],1)) ^ extract_byte(key[0],1) +#define q32(x) q(1,q(0,q(0, x) ^ extract_byte(key[2],2)) ^ extract_byte(key[1],2)) ^ extract_byte(key[0],2) +#define q33(x) q(1,q(1,q(0, x) ^ extract_byte(key[2],3)) ^ extract_byte(key[1],3)) ^ extract_byte(key[0],3) + +#define q40(x) q(0,q(0,q(1, q(1, x) ^ extract_byte(key[3],0)) ^ extract_byte(key[2],0)) ^ extract_byte(key[1],0)) ^ extract_byte(key[0],0) +#define q41(x) q(0,q(1,q(1, q(0, x) ^ extract_byte(key[3],1)) ^ extract_byte(key[2],1)) ^ extract_byte(key[1],1)) ^ extract_byte(key[0],1) +#define q42(x) q(1,q(0,q(0, q(0, x) ^ extract_byte(key[3],2)) ^ extract_byte(key[2],2)) ^ extract_byte(key[1],2)) ^ extract_byte(key[0],2) +#define q43(x) q(1,q(1,q(0, q(1, x) ^ extract_byte(key[3],3)) ^ extract_byte(key[2],3)) ^ extract_byte(key[1],3)) ^ extract_byte(key[0],3) + +static void gen_mk_tab(TwofishInstance *instance, u4byte key[]) +{ u4byte i; + u1byte by; + + u4byte *mk_tab = instance->mk_tab; + + switch(instance->k_len) + { + case 2: for(i = 0; i < 256; ++i) + { + by = (u1byte)i; +#ifdef ONE_STEP + mk_tab[0 + 4*i] = mds(0, q20(by)); mk_tab[1 + 4*i] = mds(1, q21(by)); + mk_tab[2 + 4*i] = mds(2, q22(by)); mk_tab[3 + 4*i] = mds(3, q23(by)); +#else + sb[0][i] = q20(by); sb[1][i] = q21(by); + sb[2][i] = q22(by); sb[3][i] = q23(by); +#endif + } + break; + + case 3: for(i = 0; i < 256; ++i) + { + by = (u1byte)i; +#ifdef ONE_STEP + mk_tab[0 + 4*i] = mds(0, q30(by)); mk_tab[1 + 4*i] = mds(1, q31(by)); + mk_tab[2 + 4*i] = mds(2, q32(by)); mk_tab[3 + 4*i] = mds(3, q33(by)); +#else + sb[0][i] = q30(by); sb[1][i] = q31(by); + sb[2][i] = q32(by); sb[3][i] = q33(by); +#endif + } + break; + + case 4: for(i = 0; i < 256; ++i) + { + by = (u1byte)i; +#ifdef ONE_STEP + mk_tab[0 + 4*i] = mds(0, q40(by)); mk_tab[1 + 4*i] = mds(1, q41(by)); + mk_tab[2 + 4*i] = mds(2, q42(by)); mk_tab[3 + 4*i] = mds(3, q43(by)); +#else + sb[0][i] = q40(by); sb[1][i] = q41(by); + sb[2][i] = q42(by); sb[3][i] = q43(by); +#endif + } + } +}; + +# ifdef ONE_STEP +# define g0_fun(x) ( mk_tab[0 + 4*extract_byte(x,0)] ^ mk_tab[1 + 4*extract_byte(x,1)] \ + ^ mk_tab[2 + 4*extract_byte(x,2)] ^ mk_tab[3 + 4*extract_byte(x,3)] ) +# define g1_fun(x) ( mk_tab[0 + 4*extract_byte(x,3)] ^ mk_tab[1 + 4*extract_byte(x,0)] \ + ^ mk_tab[2 + 4*extract_byte(x,1)] ^ mk_tab[3 + 4*extract_byte(x,2)] ) + + +# else +# define g0_fun(x) ( mds(0, sb[0][extract_byte(x,0)]) ^ mds(1, sb[1][extract_byte(x,1)]) \ + ^ mds(2, sb[2][extract_byte(x,2)]) ^ mds(3, sb[3][extract_byte(x,3)]) ) +# define g1_fun(x) ( mds(0, sb[0][extract_byte(x,3)]) ^ mds(1, sb[1][extract_byte(x,0)]) \ + ^ mds(2, sb[2][extract_byte(x,1)]) ^ mds(3, sb[3][extract_byte(x,2)]) ) +# endif + +#else + +#define g0_fun(x) h_fun(instance, x, instance->s_key) +#define g1_fun(x) h_fun(instance, rotl(x,8), instance->s_key) + +#endif + +/* The (12,8) Reed Soloman code has the generator polynomial + + g(x) = x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1 + +where the coefficients are in the finite field GF(2^8) with a +modular polynomial a^8 + a^6 + a^3 + a^2 + 1. To generate the +remainder we have to start with a 12th order polynomial with our +eight input bytes as the coefficients of the 4th to 11th terms. +That is: + + m[7] * x^11 + m[6] * x^10 ... + m[0] * x^4 + 0 * x^3 +... + 0 + +We then multiply the generator polynomial by m[7] * x^7 and subtract +it - xor in GF(2^8) - from the above to eliminate the x^7 term (the +artihmetic on the coefficients is done in GF(2^8). We then multiply +the generator polynomial by x^6 * coeff(x^10) and use this to remove +the x^10 term. We carry on in this way until the x^4 term is removed +so that we are left with: + + r[3] * x^3 + r[2] * x^2 + r[1] 8 x^1 + r[0] + +which give the resulting 4 bytes of the remainder. This is equivalent +to the matrix multiplication in the Twofish description but much faster +to implement. + +*/ + +#define G_MOD 0x0000014d + +static u4byte mds_rem(u4byte p0, u4byte p1) +{ u4byte i, t, u; + + for(i = 0; i < 8; ++i) + { + t = p1 >> 24; // get most significant coefficient + + p1 = (p1 << 8) | (p0 >> 24); p0 <<= 8; // shift others up + + // multiply t by a (the primitive element - i.e. left shift) + + u = (t << 1); + + if(t & 0x80) // subtract modular polynomial on overflow + + u ^= G_MOD; + + p1 ^= t ^ (u << 16); // remove t * (a * x^2 + 1) + + u ^= (t >> 1); // form u = a * t + t / a = t * (a + 1 / a); + + if(t & 0x01) // add the modular polynomial on underflow + + u ^= G_MOD >> 1; + + p1 ^= (u << 24) | (u << 8); // remove t * (a + 1/a) * (x^3 + x) + } + + return p1; +}; + +/* initialise the key schedule from the user supplied key */ + +u4byte *twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len) +{ u4byte i, a, b, me_key[4], mo_key[4]; + u4byte *l_key, *s_key; + + l_key = instance->l_key; + s_key = instance->s_key; + +#ifdef Q_TABLES + if(!qt_gen) + { + gen_qtab(); qt_gen = 1; + } +#endif + +#ifdef M_TABLE + if(!mt_gen) + { + gen_mtab(); mt_gen = 1; + } +#endif + + instance->k_len = key_len / 64; /* 2, 3 or 4 */ + + for(i = 0; i < instance->k_len; ++i) + { + a = LE32(in_key[i + i]); me_key[i] = a; + b = LE32(in_key[i + i + 1]); mo_key[i] = b; + s_key[instance->k_len - i - 1] = mds_rem(a, b); + } + + for(i = 0; i < 40; i += 2) + { + a = 0x01010101 * i; b = a + 0x01010101; + a = h_fun(instance, a, me_key); + b = rotl(h_fun(instance, b, mo_key), 8); + l_key[i] = a + b; + l_key[i + 1] = rotl(a + 2 * b, 9); + } + +#ifdef MK_TABLE + gen_mk_tab(instance, s_key); +#endif + + return l_key; +}; + +/* encrypt a block of text */ + +#ifndef TC_MINIMIZE_CODE_SIZE + +#define f_rnd(i) \ + t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); \ + blk[2] = rotr(blk[2] ^ (t0 + t1 + l_key[4 * (i) + 8]), 1); \ + blk[3] = rotl(blk[3], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]); \ + t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); \ + blk[0] = rotr(blk[0] ^ (t0 + t1 + l_key[4 * (i) + 10]), 1); \ + blk[1] = rotl(blk[1], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]) + +void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]) +{ u4byte t0, t1, blk[4]; + + u4byte *l_key = instance->l_key; + u4byte *mk_tab = instance->mk_tab; + + blk[0] = LE32(in_blk[0]) ^ l_key[0]; + blk[1] = LE32(in_blk[1]) ^ l_key[1]; + blk[2] = LE32(in_blk[2]) ^ l_key[2]; + blk[3] = LE32(in_blk[3]) ^ l_key[3]; + + f_rnd(0); f_rnd(1); f_rnd(2); f_rnd(3); + f_rnd(4); f_rnd(5); f_rnd(6); f_rnd(7); + + out_blk[0] = LE32(blk[2] ^ l_key[4]); + out_blk[1] = LE32(blk[3] ^ l_key[5]); + out_blk[2] = LE32(blk[0] ^ l_key[6]); + out_blk[3] = LE32(blk[1] ^ l_key[7]); +}; + +#else // TC_MINIMIZE_CODE_SIZE + +void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]) +{ u4byte t0, t1, blk[4]; + + u4byte *l_key = instance->l_key; +#ifdef TC_WINDOWS_BOOT_TWOFISH + u4byte *mk_tab = instance->mk_tab; +#endif + int i; + + blk[0] = LE32(in_blk[0]) ^ l_key[0]; + blk[1] = LE32(in_blk[1]) ^ l_key[1]; + blk[2] = LE32(in_blk[2]) ^ l_key[2]; + blk[3] = LE32(in_blk[3]) ^ l_key[3]; + + for (i = 0; i <= 7; ++i) + { + t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); + blk[2] = rotr(blk[2] ^ (t0 + t1 + l_key[4 * (i) + 8]), 1); + blk[3] = rotl(blk[3], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]); + t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); + blk[0] = rotr(blk[0] ^ (t0 + t1 + l_key[4 * (i) + 10]), 1); + blk[1] = rotl(blk[1], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]); + } + + out_blk[0] = LE32(blk[2] ^ l_key[4]); + out_blk[1] = LE32(blk[3] ^ l_key[5]); + out_blk[2] = LE32(blk[0] ^ l_key[6]); + out_blk[3] = LE32(blk[1] ^ l_key[7]); +}; + +#endif // TC_MINIMIZE_CODE_SIZE + +/* decrypt a block of text */ + +#ifndef TC_MINIMIZE_CODE_SIZE + +#define i_rnd(i) \ + t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); \ + blk[2] = rotl(blk[2], 1) ^ (t0 + t1 + l_key[4 * (i) + 10]); \ + blk[3] = rotr(blk[3] ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]), 1); \ + t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); \ + blk[0] = rotl(blk[0], 1) ^ (t0 + t1 + l_key[4 * (i) + 8]); \ + blk[1] = rotr(blk[1] ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]), 1) + +void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]) +{ u4byte t0, t1, blk[4]; + + u4byte *l_key = instance->l_key; + u4byte *mk_tab = instance->mk_tab; + + blk[0] = LE32(in_blk[0]) ^ l_key[4]; + blk[1] = LE32(in_blk[1]) ^ l_key[5]; + blk[2] = LE32(in_blk[2]) ^ l_key[6]; + blk[3] = LE32(in_blk[3]) ^ l_key[7]; + + i_rnd(7); i_rnd(6); i_rnd(5); i_rnd(4); + i_rnd(3); i_rnd(2); i_rnd(1); i_rnd(0); + + out_blk[0] = LE32(blk[2] ^ l_key[0]); + out_blk[1] = LE32(blk[3] ^ l_key[1]); + out_blk[2] = LE32(blk[0] ^ l_key[2]); + out_blk[3] = LE32(blk[1] ^ l_key[3]); +}; + +#else // TC_MINIMIZE_CODE_SIZE + +void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]) +{ u4byte t0, t1, blk[4]; + + u4byte *l_key = instance->l_key; +#ifdef TC_WINDOWS_BOOT_TWOFISH + u4byte *mk_tab = instance->mk_tab; +#endif + int i; + + blk[0] = LE32(in_blk[0]) ^ l_key[4]; + blk[1] = LE32(in_blk[1]) ^ l_key[5]; + blk[2] = LE32(in_blk[2]) ^ l_key[6]; + blk[3] = LE32(in_blk[3]) ^ l_key[7]; + + for (i = 7; i >= 0; --i) + { + t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); + blk[2] = rotl(blk[2], 1) ^ (t0 + t1 + l_key[4 * (i) + 10]); + blk[3] = rotr(blk[3] ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]), 1); + t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); + blk[0] = rotl(blk[0], 1) ^ (t0 + t1 + l_key[4 * (i) + 8]); + blk[1] = rotr(blk[1] ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]), 1); + } + + out_blk[0] = LE32(blk[2] ^ l_key[0]); + out_blk[1] = LE32(blk[3] ^ l_key[1]); + out_blk[2] = LE32(blk[0] ^ l_key[2]); + out_blk[3] = LE32(blk[1] ^ l_key[3]); +}; + +#endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/utils/crypto/twofish.h b/src/utils/crypto/twofish.h new file mode 100644 index 00000000000..b63ae69cd70 --- /dev/null +++ b/src/utils/crypto/twofish.h @@ -0,0 +1,56 @@ +#ifndef TWOFISH_H +#define TWOFISH_H + +#include + + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#ifndef u4byte +#define u4byte uint32_t +#endif +#ifndef u1byte +#define u1byte uint8_t +#endif + +#ifndef extract_byte +#define extract_byte(x,n) ((u1byte)((x) >> (8 * n))) +#endif + +#ifndef rotl + +#ifdef _WIN32 +#include +// #pragma intrinsic(_lrotr,_lrotl) +#define rotr(x,n) _lrotr(x,n) +#define rotl(x,n) _lrotl(x,n) +#else +#define rotr(x,n) (((x)>>(n))|((x)<<(32-(n)))) +#define rotl(x,n) (((x)<<(n))|((x)>>(32-(n)))) +#endif + +#endif +typedef struct +{ + u4byte l_key[40]; + u4byte s_key[4]; +#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH) + u4byte mk_tab[4 * 256]; +#endif + u4byte k_len; +} TwofishInstance; + +#define TWOFISH_KS sizeof(TwofishInstance) + +u4byte * twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len); +void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]); +void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]); + +#if defined(__cplusplus) +} +#endif + +#endif // TWOFISH_H diff --git a/src/utils/crypto/whirlpool.c b/src/utils/crypto/whirlpool.c new file mode 100644 index 00000000000..baaedb5d02d --- /dev/null +++ b/src/utils/crypto/whirlpool.c @@ -0,0 +1,1058 @@ +/** + * The Whirlpool hashing function. + * + *

+ * References + * + *

+ * The Whirlpool algorithm was developed by + * Paulo S. L. M. Barreto and + * Vincent Rijmen. + * + * See + * P.S.L.M. Barreto, V. Rijmen, + * ``The Whirlpool hashing function,'' + * NESSIE submission, 2000 (tweaked version, 2001), + * + * + * @author Paulo S.L.M. Barreto + * @author Vincent Rijmen. + * Minor modifications by TrueCrypt Foundation. + * + * @version 3.0 (2003.03.12) + * + * ============================================================================= + * + * Differences from version 2.1: + * + * - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2, 9). + * + * ============================================================================= + * + * Differences from version 2.0: + * + * - Generation of ISO/IEC 10118-3 test vectors. + * - Bug fix: nonzero carry was ignored when tallying the data length + * (this bug apparently only manifested itself when feeding data + * in pieces rather than in a single chunk at once). + * - Support for MS Visual C++ 64-bit integer arithmetic. + * + * Differences from version 1.0: + * + * - Original S-box replaced by the tweaked, hardware-efficient version. + * + * ============================================================================= + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS + * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR + * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, + * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE + * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + /* The code contained in this file (Whirlpool.c) is in the public domain. */ + +#include +#include +#include +#include + +#include "whirlpool.h" + +/* #define TRACE_INTERMEDIATE_VALUES */ + +/* + * The number of rounds of the internal dedicated block cipher. + */ +#define R 10 + +/* + * Though Whirlpool is endianness-neutral, the encryption tables are listed + * in BIG-ENDIAN format, which is adopted throughout this implementation + * (but little-endian notation would be equally suitable if consistently + * employed). + */ + +static const u64 C0[256] = { + LL(0x18186018c07830d8), LL(0x23238c2305af4626), LL(0xc6c63fc67ef991b8), LL(0xe8e887e8136fcdfb), + LL(0x878726874ca113cb), LL(0xb8b8dab8a9626d11), LL(0x0101040108050209), LL(0x4f4f214f426e9e0d), + LL(0x3636d836adee6c9b), LL(0xa6a6a2a6590451ff), LL(0xd2d26fd2debdb90c), LL(0xf5f5f3f5fb06f70e), + LL(0x7979f979ef80f296), LL(0x6f6fa16f5fcede30), LL(0x91917e91fcef3f6d), LL(0x52525552aa07a4f8), + LL(0x60609d6027fdc047), LL(0xbcbccabc89766535), LL(0x9b9b569baccd2b37), LL(0x8e8e028e048c018a), + LL(0xa3a3b6a371155bd2), LL(0x0c0c300c603c186c), LL(0x7b7bf17bff8af684), LL(0x3535d435b5e16a80), + LL(0x1d1d741de8693af5), LL(0xe0e0a7e05347ddb3), LL(0xd7d77bd7f6acb321), LL(0xc2c22fc25eed999c), + LL(0x2e2eb82e6d965c43), LL(0x4b4b314b627a9629), LL(0xfefedffea321e15d), LL(0x575741578216aed5), + LL(0x15155415a8412abd), LL(0x7777c1779fb6eee8), LL(0x3737dc37a5eb6e92), LL(0xe5e5b3e57b56d79e), + LL(0x9f9f469f8cd92313), LL(0xf0f0e7f0d317fd23), LL(0x4a4a354a6a7f9420), LL(0xdada4fda9e95a944), + LL(0x58587d58fa25b0a2), LL(0xc9c903c906ca8fcf), LL(0x2929a429558d527c), LL(0x0a0a280a5022145a), + LL(0xb1b1feb1e14f7f50), LL(0xa0a0baa0691a5dc9), LL(0x6b6bb16b7fdad614), LL(0x85852e855cab17d9), + LL(0xbdbdcebd8173673c), LL(0x5d5d695dd234ba8f), LL(0x1010401080502090), LL(0xf4f4f7f4f303f507), + LL(0xcbcb0bcb16c08bdd), LL(0x3e3ef83eedc67cd3), LL(0x0505140528110a2d), LL(0x676781671fe6ce78), + LL(0xe4e4b7e47353d597), LL(0x27279c2725bb4e02), LL(0x4141194132588273), LL(0x8b8b168b2c9d0ba7), + LL(0xa7a7a6a7510153f6), LL(0x7d7de97dcf94fab2), LL(0x95956e95dcfb3749), LL(0xd8d847d88e9fad56), + LL(0xfbfbcbfb8b30eb70), LL(0xeeee9fee2371c1cd), LL(0x7c7ced7cc791f8bb), LL(0x6666856617e3cc71), + LL(0xdddd53dda68ea77b), LL(0x17175c17b84b2eaf), LL(0x4747014702468e45), LL(0x9e9e429e84dc211a), + LL(0xcaca0fca1ec589d4), LL(0x2d2db42d75995a58), LL(0xbfbfc6bf9179632e), LL(0x07071c07381b0e3f), + LL(0xadad8ead012347ac), LL(0x5a5a755aea2fb4b0), LL(0x838336836cb51bef), LL(0x3333cc3385ff66b6), + LL(0x636391633ff2c65c), LL(0x02020802100a0412), LL(0xaaaa92aa39384993), LL(0x7171d971afa8e2de), + LL(0xc8c807c80ecf8dc6), LL(0x19196419c87d32d1), LL(0x494939497270923b), LL(0xd9d943d9869aaf5f), + LL(0xf2f2eff2c31df931), LL(0xe3e3abe34b48dba8), LL(0x5b5b715be22ab6b9), LL(0x88881a8834920dbc), + LL(0x9a9a529aa4c8293e), LL(0x262698262dbe4c0b), LL(0x3232c8328dfa64bf), LL(0xb0b0fab0e94a7d59), + LL(0xe9e983e91b6acff2), LL(0x0f0f3c0f78331e77), LL(0xd5d573d5e6a6b733), LL(0x80803a8074ba1df4), + LL(0xbebec2be997c6127), LL(0xcdcd13cd26de87eb), LL(0x3434d034bde46889), LL(0x48483d487a759032), + LL(0xffffdbffab24e354), LL(0x7a7af57af78ff48d), LL(0x90907a90f4ea3d64), LL(0x5f5f615fc23ebe9d), + LL(0x202080201da0403d), LL(0x6868bd6867d5d00f), LL(0x1a1a681ad07234ca), LL(0xaeae82ae192c41b7), + LL(0xb4b4eab4c95e757d), LL(0x54544d549a19a8ce), LL(0x93937693ece53b7f), LL(0x222288220daa442f), + LL(0x64648d6407e9c863), LL(0xf1f1e3f1db12ff2a), LL(0x7373d173bfa2e6cc), LL(0x12124812905a2482), + LL(0x40401d403a5d807a), LL(0x0808200840281048), LL(0xc3c32bc356e89b95), LL(0xecec97ec337bc5df), + LL(0xdbdb4bdb9690ab4d), LL(0xa1a1bea1611f5fc0), LL(0x8d8d0e8d1c830791), LL(0x3d3df43df5c97ac8), + LL(0x97976697ccf1335b), LL(0x0000000000000000), LL(0xcfcf1bcf36d483f9), LL(0x2b2bac2b4587566e), + LL(0x7676c57697b3ece1), LL(0x8282328264b019e6), LL(0xd6d67fd6fea9b128), LL(0x1b1b6c1bd87736c3), + LL(0xb5b5eeb5c15b7774), LL(0xafaf86af112943be), LL(0x6a6ab56a77dfd41d), LL(0x50505d50ba0da0ea), + LL(0x45450945124c8a57), LL(0xf3f3ebf3cb18fb38), LL(0x3030c0309df060ad), LL(0xefef9bef2b74c3c4), + LL(0x3f3ffc3fe5c37eda), LL(0x55554955921caac7), LL(0xa2a2b2a2791059db), LL(0xeaea8fea0365c9e9), + LL(0x656589650fecca6a), LL(0xbabad2bab9686903), LL(0x2f2fbc2f65935e4a), LL(0xc0c027c04ee79d8e), + LL(0xdede5fdebe81a160), LL(0x1c1c701ce06c38fc), LL(0xfdfdd3fdbb2ee746), LL(0x4d4d294d52649a1f), + LL(0x92927292e4e03976), LL(0x7575c9758fbceafa), LL(0x06061806301e0c36), LL(0x8a8a128a249809ae), + LL(0xb2b2f2b2f940794b), LL(0xe6e6bfe66359d185), LL(0x0e0e380e70361c7e), LL(0x1f1f7c1ff8633ee7), + LL(0x6262956237f7c455), LL(0xd4d477d4eea3b53a), LL(0xa8a89aa829324d81), LL(0x96966296c4f43152), + LL(0xf9f9c3f99b3aef62), LL(0xc5c533c566f697a3), LL(0x2525942535b14a10), LL(0x59597959f220b2ab), + LL(0x84842a8454ae15d0), LL(0x7272d572b7a7e4c5), LL(0x3939e439d5dd72ec), LL(0x4c4c2d4c5a619816), + LL(0x5e5e655eca3bbc94), LL(0x7878fd78e785f09f), LL(0x3838e038ddd870e5), LL(0x8c8c0a8c14860598), + LL(0xd1d163d1c6b2bf17), LL(0xa5a5aea5410b57e4), LL(0xe2e2afe2434dd9a1), LL(0x616199612ff8c24e), + LL(0xb3b3f6b3f1457b42), LL(0x2121842115a54234), LL(0x9c9c4a9c94d62508), LL(0x1e1e781ef0663cee), + LL(0x4343114322528661), LL(0xc7c73bc776fc93b1), LL(0xfcfcd7fcb32be54f), LL(0x0404100420140824), + LL(0x51515951b208a2e3), LL(0x99995e99bcc72f25), LL(0x6d6da96d4fc4da22), LL(0x0d0d340d68391a65), + LL(0xfafacffa8335e979), LL(0xdfdf5bdfb684a369), LL(0x7e7ee57ed79bfca9), LL(0x242490243db44819), + LL(0x3b3bec3bc5d776fe), LL(0xabab96ab313d4b9a), LL(0xcece1fce3ed181f0), LL(0x1111441188552299), + LL(0x8f8f068f0c890383), LL(0x4e4e254e4a6b9c04), LL(0xb7b7e6b7d1517366), LL(0xebeb8beb0b60cbe0), + LL(0x3c3cf03cfdcc78c1), LL(0x81813e817cbf1ffd), LL(0x94946a94d4fe3540), LL(0xf7f7fbf7eb0cf31c), + LL(0xb9b9deb9a1676f18), LL(0x13134c13985f268b), LL(0x2c2cb02c7d9c5851), LL(0xd3d36bd3d6b8bb05), + LL(0xe7e7bbe76b5cd38c), LL(0x6e6ea56e57cbdc39), LL(0xc4c437c46ef395aa), LL(0x03030c03180f061b), + LL(0x565645568a13acdc), LL(0x44440d441a49885e), LL(0x7f7fe17fdf9efea0), LL(0xa9a99ea921374f88), + LL(0x2a2aa82a4d825467), LL(0xbbbbd6bbb16d6b0a), LL(0xc1c123c146e29f87), LL(0x53535153a202a6f1), + LL(0xdcdc57dcae8ba572), LL(0x0b0b2c0b58271653), LL(0x9d9d4e9d9cd32701), LL(0x6c6cad6c47c1d82b), + LL(0x3131c43195f562a4), LL(0x7474cd7487b9e8f3), LL(0xf6f6fff6e309f115), LL(0x464605460a438c4c), + LL(0xacac8aac092645a5), LL(0x89891e893c970fb5), LL(0x14145014a04428b4), LL(0xe1e1a3e15b42dfba), + LL(0x16165816b04e2ca6), LL(0x3a3ae83acdd274f7), LL(0x6969b9696fd0d206), LL(0x09092409482d1241), + LL(0x7070dd70a7ade0d7), LL(0xb6b6e2b6d954716f), LL(0xd0d067d0ceb7bd1e), LL(0xeded93ed3b7ec7d6), + LL(0xcccc17cc2edb85e2), LL(0x424215422a578468), LL(0x98985a98b4c22d2c), LL(0xa4a4aaa4490e55ed), + LL(0x2828a0285d885075), LL(0x5c5c6d5cda31b886), LL(0xf8f8c7f8933fed6b), LL(0x8686228644a411c2), +}; + +static const u64 C1[256] = { + LL(0xd818186018c07830), LL(0x2623238c2305af46), LL(0xb8c6c63fc67ef991), LL(0xfbe8e887e8136fcd), + LL(0xcb878726874ca113), LL(0x11b8b8dab8a9626d), LL(0x0901010401080502), LL(0x0d4f4f214f426e9e), + LL(0x9b3636d836adee6c), LL(0xffa6a6a2a6590451), LL(0x0cd2d26fd2debdb9), LL(0x0ef5f5f3f5fb06f7), + LL(0x967979f979ef80f2), LL(0x306f6fa16f5fcede), LL(0x6d91917e91fcef3f), LL(0xf852525552aa07a4), + LL(0x4760609d6027fdc0), LL(0x35bcbccabc897665), LL(0x379b9b569baccd2b), LL(0x8a8e8e028e048c01), + LL(0xd2a3a3b6a371155b), LL(0x6c0c0c300c603c18), LL(0x847b7bf17bff8af6), LL(0x803535d435b5e16a), + LL(0xf51d1d741de8693a), LL(0xb3e0e0a7e05347dd), LL(0x21d7d77bd7f6acb3), LL(0x9cc2c22fc25eed99), + LL(0x432e2eb82e6d965c), LL(0x294b4b314b627a96), LL(0x5dfefedffea321e1), LL(0xd5575741578216ae), + LL(0xbd15155415a8412a), LL(0xe87777c1779fb6ee), LL(0x923737dc37a5eb6e), LL(0x9ee5e5b3e57b56d7), + LL(0x139f9f469f8cd923), LL(0x23f0f0e7f0d317fd), LL(0x204a4a354a6a7f94), LL(0x44dada4fda9e95a9), + LL(0xa258587d58fa25b0), LL(0xcfc9c903c906ca8f), LL(0x7c2929a429558d52), LL(0x5a0a0a280a502214), + LL(0x50b1b1feb1e14f7f), LL(0xc9a0a0baa0691a5d), LL(0x146b6bb16b7fdad6), LL(0xd985852e855cab17), + LL(0x3cbdbdcebd817367), LL(0x8f5d5d695dd234ba), LL(0x9010104010805020), LL(0x07f4f4f7f4f303f5), + LL(0xddcbcb0bcb16c08b), LL(0xd33e3ef83eedc67c), LL(0x2d0505140528110a), LL(0x78676781671fe6ce), + LL(0x97e4e4b7e47353d5), LL(0x0227279c2725bb4e), LL(0x7341411941325882), LL(0xa78b8b168b2c9d0b), + LL(0xf6a7a7a6a7510153), LL(0xb27d7de97dcf94fa), LL(0x4995956e95dcfb37), LL(0x56d8d847d88e9fad), + LL(0x70fbfbcbfb8b30eb), LL(0xcdeeee9fee2371c1), LL(0xbb7c7ced7cc791f8), LL(0x716666856617e3cc), + LL(0x7bdddd53dda68ea7), LL(0xaf17175c17b84b2e), LL(0x454747014702468e), LL(0x1a9e9e429e84dc21), + LL(0xd4caca0fca1ec589), LL(0x582d2db42d75995a), LL(0x2ebfbfc6bf917963), LL(0x3f07071c07381b0e), + LL(0xacadad8ead012347), LL(0xb05a5a755aea2fb4), LL(0xef838336836cb51b), LL(0xb63333cc3385ff66), + LL(0x5c636391633ff2c6), LL(0x1202020802100a04), LL(0x93aaaa92aa393849), LL(0xde7171d971afa8e2), + LL(0xc6c8c807c80ecf8d), LL(0xd119196419c87d32), LL(0x3b49493949727092), LL(0x5fd9d943d9869aaf), + LL(0x31f2f2eff2c31df9), LL(0xa8e3e3abe34b48db), LL(0xb95b5b715be22ab6), LL(0xbc88881a8834920d), + LL(0x3e9a9a529aa4c829), LL(0x0b262698262dbe4c), LL(0xbf3232c8328dfa64), LL(0x59b0b0fab0e94a7d), + LL(0xf2e9e983e91b6acf), LL(0x770f0f3c0f78331e), LL(0x33d5d573d5e6a6b7), LL(0xf480803a8074ba1d), + LL(0x27bebec2be997c61), LL(0xebcdcd13cd26de87), LL(0x893434d034bde468), LL(0x3248483d487a7590), + LL(0x54ffffdbffab24e3), LL(0x8d7a7af57af78ff4), LL(0x6490907a90f4ea3d), LL(0x9d5f5f615fc23ebe), + LL(0x3d202080201da040), LL(0x0f6868bd6867d5d0), LL(0xca1a1a681ad07234), LL(0xb7aeae82ae192c41), + LL(0x7db4b4eab4c95e75), LL(0xce54544d549a19a8), LL(0x7f93937693ece53b), LL(0x2f222288220daa44), + LL(0x6364648d6407e9c8), LL(0x2af1f1e3f1db12ff), LL(0xcc7373d173bfa2e6), LL(0x8212124812905a24), + LL(0x7a40401d403a5d80), LL(0x4808082008402810), LL(0x95c3c32bc356e89b), LL(0xdfecec97ec337bc5), + LL(0x4ddbdb4bdb9690ab), LL(0xc0a1a1bea1611f5f), LL(0x918d8d0e8d1c8307), LL(0xc83d3df43df5c97a), + LL(0x5b97976697ccf133), LL(0x0000000000000000), LL(0xf9cfcf1bcf36d483), LL(0x6e2b2bac2b458756), + LL(0xe17676c57697b3ec), LL(0xe68282328264b019), LL(0x28d6d67fd6fea9b1), LL(0xc31b1b6c1bd87736), + LL(0x74b5b5eeb5c15b77), LL(0xbeafaf86af112943), LL(0x1d6a6ab56a77dfd4), LL(0xea50505d50ba0da0), + LL(0x5745450945124c8a), LL(0x38f3f3ebf3cb18fb), LL(0xad3030c0309df060), LL(0xc4efef9bef2b74c3), + LL(0xda3f3ffc3fe5c37e), LL(0xc755554955921caa), LL(0xdba2a2b2a2791059), LL(0xe9eaea8fea0365c9), + LL(0x6a656589650fecca), LL(0x03babad2bab96869), LL(0x4a2f2fbc2f65935e), LL(0x8ec0c027c04ee79d), + LL(0x60dede5fdebe81a1), LL(0xfc1c1c701ce06c38), LL(0x46fdfdd3fdbb2ee7), LL(0x1f4d4d294d52649a), + LL(0x7692927292e4e039), LL(0xfa7575c9758fbcea), LL(0x3606061806301e0c), LL(0xae8a8a128a249809), + LL(0x4bb2b2f2b2f94079), LL(0x85e6e6bfe66359d1), LL(0x7e0e0e380e70361c), LL(0xe71f1f7c1ff8633e), + LL(0x556262956237f7c4), LL(0x3ad4d477d4eea3b5), LL(0x81a8a89aa829324d), LL(0x5296966296c4f431), + LL(0x62f9f9c3f99b3aef), LL(0xa3c5c533c566f697), LL(0x102525942535b14a), LL(0xab59597959f220b2), + LL(0xd084842a8454ae15), LL(0xc57272d572b7a7e4), LL(0xec3939e439d5dd72), LL(0x164c4c2d4c5a6198), + LL(0x945e5e655eca3bbc), LL(0x9f7878fd78e785f0), LL(0xe53838e038ddd870), LL(0x988c8c0a8c148605), + LL(0x17d1d163d1c6b2bf), LL(0xe4a5a5aea5410b57), LL(0xa1e2e2afe2434dd9), LL(0x4e616199612ff8c2), + LL(0x42b3b3f6b3f1457b), LL(0x342121842115a542), LL(0x089c9c4a9c94d625), LL(0xee1e1e781ef0663c), + LL(0x6143431143225286), LL(0xb1c7c73bc776fc93), LL(0x4ffcfcd7fcb32be5), LL(0x2404041004201408), + LL(0xe351515951b208a2), LL(0x2599995e99bcc72f), LL(0x226d6da96d4fc4da), LL(0x650d0d340d68391a), + LL(0x79fafacffa8335e9), LL(0x69dfdf5bdfb684a3), LL(0xa97e7ee57ed79bfc), LL(0x19242490243db448), + LL(0xfe3b3bec3bc5d776), LL(0x9aabab96ab313d4b), LL(0xf0cece1fce3ed181), LL(0x9911114411885522), + LL(0x838f8f068f0c8903), LL(0x044e4e254e4a6b9c), LL(0x66b7b7e6b7d15173), LL(0xe0ebeb8beb0b60cb), + LL(0xc13c3cf03cfdcc78), LL(0xfd81813e817cbf1f), LL(0x4094946a94d4fe35), LL(0x1cf7f7fbf7eb0cf3), + LL(0x18b9b9deb9a1676f), LL(0x8b13134c13985f26), LL(0x512c2cb02c7d9c58), LL(0x05d3d36bd3d6b8bb), + LL(0x8ce7e7bbe76b5cd3), LL(0x396e6ea56e57cbdc), LL(0xaac4c437c46ef395), LL(0x1b03030c03180f06), + LL(0xdc565645568a13ac), LL(0x5e44440d441a4988), LL(0xa07f7fe17fdf9efe), LL(0x88a9a99ea921374f), + LL(0x672a2aa82a4d8254), LL(0x0abbbbd6bbb16d6b), LL(0x87c1c123c146e29f), LL(0xf153535153a202a6), + LL(0x72dcdc57dcae8ba5), LL(0x530b0b2c0b582716), LL(0x019d9d4e9d9cd327), LL(0x2b6c6cad6c47c1d8), + LL(0xa43131c43195f562), LL(0xf37474cd7487b9e8), LL(0x15f6f6fff6e309f1), LL(0x4c464605460a438c), + LL(0xa5acac8aac092645), LL(0xb589891e893c970f), LL(0xb414145014a04428), LL(0xbae1e1a3e15b42df), + LL(0xa616165816b04e2c), LL(0xf73a3ae83acdd274), LL(0x066969b9696fd0d2), LL(0x4109092409482d12), + LL(0xd77070dd70a7ade0), LL(0x6fb6b6e2b6d95471), LL(0x1ed0d067d0ceb7bd), LL(0xd6eded93ed3b7ec7), + LL(0xe2cccc17cc2edb85), LL(0x68424215422a5784), LL(0x2c98985a98b4c22d), LL(0xeda4a4aaa4490e55), + LL(0x752828a0285d8850), LL(0x865c5c6d5cda31b8), LL(0x6bf8f8c7f8933fed), LL(0xc28686228644a411), +}; + +static const u64 C2[256] = { + LL(0x30d818186018c078), LL(0x462623238c2305af), LL(0x91b8c6c63fc67ef9), LL(0xcdfbe8e887e8136f), + LL(0x13cb878726874ca1), LL(0x6d11b8b8dab8a962), LL(0x0209010104010805), LL(0x9e0d4f4f214f426e), + LL(0x6c9b3636d836adee), LL(0x51ffa6a6a2a65904), LL(0xb90cd2d26fd2debd), LL(0xf70ef5f5f3f5fb06), + LL(0xf2967979f979ef80), LL(0xde306f6fa16f5fce), LL(0x3f6d91917e91fcef), LL(0xa4f852525552aa07), + LL(0xc04760609d6027fd), LL(0x6535bcbccabc8976), LL(0x2b379b9b569baccd), LL(0x018a8e8e028e048c), + LL(0x5bd2a3a3b6a37115), LL(0x186c0c0c300c603c), LL(0xf6847b7bf17bff8a), LL(0x6a803535d435b5e1), + LL(0x3af51d1d741de869), LL(0xddb3e0e0a7e05347), LL(0xb321d7d77bd7f6ac), LL(0x999cc2c22fc25eed), + LL(0x5c432e2eb82e6d96), LL(0x96294b4b314b627a), LL(0xe15dfefedffea321), LL(0xaed5575741578216), + LL(0x2abd15155415a841), LL(0xeee87777c1779fb6), LL(0x6e923737dc37a5eb), LL(0xd79ee5e5b3e57b56), + LL(0x23139f9f469f8cd9), LL(0xfd23f0f0e7f0d317), LL(0x94204a4a354a6a7f), LL(0xa944dada4fda9e95), + LL(0xb0a258587d58fa25), LL(0x8fcfc9c903c906ca), LL(0x527c2929a429558d), LL(0x145a0a0a280a5022), + LL(0x7f50b1b1feb1e14f), LL(0x5dc9a0a0baa0691a), LL(0xd6146b6bb16b7fda), LL(0x17d985852e855cab), + LL(0x673cbdbdcebd8173), LL(0xba8f5d5d695dd234), LL(0x2090101040108050), LL(0xf507f4f4f7f4f303), + LL(0x8bddcbcb0bcb16c0), LL(0x7cd33e3ef83eedc6), LL(0x0a2d050514052811), LL(0xce78676781671fe6), + LL(0xd597e4e4b7e47353), LL(0x4e0227279c2725bb), LL(0x8273414119413258), LL(0x0ba78b8b168b2c9d), + LL(0x53f6a7a7a6a75101), LL(0xfab27d7de97dcf94), LL(0x374995956e95dcfb), LL(0xad56d8d847d88e9f), + LL(0xeb70fbfbcbfb8b30), LL(0xc1cdeeee9fee2371), LL(0xf8bb7c7ced7cc791), LL(0xcc716666856617e3), + LL(0xa77bdddd53dda68e), LL(0x2eaf17175c17b84b), LL(0x8e45474701470246), LL(0x211a9e9e429e84dc), + LL(0x89d4caca0fca1ec5), LL(0x5a582d2db42d7599), LL(0x632ebfbfc6bf9179), LL(0x0e3f07071c07381b), + LL(0x47acadad8ead0123), LL(0xb4b05a5a755aea2f), LL(0x1bef838336836cb5), LL(0x66b63333cc3385ff), + LL(0xc65c636391633ff2), LL(0x041202020802100a), LL(0x4993aaaa92aa3938), LL(0xe2de7171d971afa8), + LL(0x8dc6c8c807c80ecf), LL(0x32d119196419c87d), LL(0x923b494939497270), LL(0xaf5fd9d943d9869a), + LL(0xf931f2f2eff2c31d), LL(0xdba8e3e3abe34b48), LL(0xb6b95b5b715be22a), LL(0x0dbc88881a883492), + LL(0x293e9a9a529aa4c8), LL(0x4c0b262698262dbe), LL(0x64bf3232c8328dfa), LL(0x7d59b0b0fab0e94a), + LL(0xcff2e9e983e91b6a), LL(0x1e770f0f3c0f7833), LL(0xb733d5d573d5e6a6), LL(0x1df480803a8074ba), + LL(0x6127bebec2be997c), LL(0x87ebcdcd13cd26de), LL(0x68893434d034bde4), LL(0x903248483d487a75), + LL(0xe354ffffdbffab24), LL(0xf48d7a7af57af78f), LL(0x3d6490907a90f4ea), LL(0xbe9d5f5f615fc23e), + LL(0x403d202080201da0), LL(0xd00f6868bd6867d5), LL(0x34ca1a1a681ad072), LL(0x41b7aeae82ae192c), + LL(0x757db4b4eab4c95e), LL(0xa8ce54544d549a19), LL(0x3b7f93937693ece5), LL(0x442f222288220daa), + LL(0xc86364648d6407e9), LL(0xff2af1f1e3f1db12), LL(0xe6cc7373d173bfa2), LL(0x248212124812905a), + LL(0x807a40401d403a5d), LL(0x1048080820084028), LL(0x9b95c3c32bc356e8), LL(0xc5dfecec97ec337b), + LL(0xab4ddbdb4bdb9690), LL(0x5fc0a1a1bea1611f), LL(0x07918d8d0e8d1c83), LL(0x7ac83d3df43df5c9), + LL(0x335b97976697ccf1), LL(0x0000000000000000), LL(0x83f9cfcf1bcf36d4), LL(0x566e2b2bac2b4587), + LL(0xece17676c57697b3), LL(0x19e68282328264b0), LL(0xb128d6d67fd6fea9), LL(0x36c31b1b6c1bd877), + LL(0x7774b5b5eeb5c15b), LL(0x43beafaf86af1129), LL(0xd41d6a6ab56a77df), LL(0xa0ea50505d50ba0d), + LL(0x8a5745450945124c), LL(0xfb38f3f3ebf3cb18), LL(0x60ad3030c0309df0), LL(0xc3c4efef9bef2b74), + LL(0x7eda3f3ffc3fe5c3), LL(0xaac755554955921c), LL(0x59dba2a2b2a27910), LL(0xc9e9eaea8fea0365), + LL(0xca6a656589650fec), LL(0x6903babad2bab968), LL(0x5e4a2f2fbc2f6593), LL(0x9d8ec0c027c04ee7), + LL(0xa160dede5fdebe81), LL(0x38fc1c1c701ce06c), LL(0xe746fdfdd3fdbb2e), LL(0x9a1f4d4d294d5264), + LL(0x397692927292e4e0), LL(0xeafa7575c9758fbc), LL(0x0c3606061806301e), LL(0x09ae8a8a128a2498), + LL(0x794bb2b2f2b2f940), LL(0xd185e6e6bfe66359), LL(0x1c7e0e0e380e7036), LL(0x3ee71f1f7c1ff863), + LL(0xc4556262956237f7), LL(0xb53ad4d477d4eea3), LL(0x4d81a8a89aa82932), LL(0x315296966296c4f4), + LL(0xef62f9f9c3f99b3a), LL(0x97a3c5c533c566f6), LL(0x4a102525942535b1), LL(0xb2ab59597959f220), + LL(0x15d084842a8454ae), LL(0xe4c57272d572b7a7), LL(0x72ec3939e439d5dd), LL(0x98164c4c2d4c5a61), + LL(0xbc945e5e655eca3b), LL(0xf09f7878fd78e785), LL(0x70e53838e038ddd8), LL(0x05988c8c0a8c1486), + LL(0xbf17d1d163d1c6b2), LL(0x57e4a5a5aea5410b), LL(0xd9a1e2e2afe2434d), LL(0xc24e616199612ff8), + LL(0x7b42b3b3f6b3f145), LL(0x42342121842115a5), LL(0x25089c9c4a9c94d6), LL(0x3cee1e1e781ef066), + LL(0x8661434311432252), LL(0x93b1c7c73bc776fc), LL(0xe54ffcfcd7fcb32b), LL(0x0824040410042014), + LL(0xa2e351515951b208), LL(0x2f2599995e99bcc7), LL(0xda226d6da96d4fc4), LL(0x1a650d0d340d6839), + LL(0xe979fafacffa8335), LL(0xa369dfdf5bdfb684), LL(0xfca97e7ee57ed79b), LL(0x4819242490243db4), + LL(0x76fe3b3bec3bc5d7), LL(0x4b9aabab96ab313d), LL(0x81f0cece1fce3ed1), LL(0x2299111144118855), + LL(0x03838f8f068f0c89), LL(0x9c044e4e254e4a6b), LL(0x7366b7b7e6b7d151), LL(0xcbe0ebeb8beb0b60), + LL(0x78c13c3cf03cfdcc), LL(0x1ffd81813e817cbf), LL(0x354094946a94d4fe), LL(0xf31cf7f7fbf7eb0c), + LL(0x6f18b9b9deb9a167), LL(0x268b13134c13985f), LL(0x58512c2cb02c7d9c), LL(0xbb05d3d36bd3d6b8), + LL(0xd38ce7e7bbe76b5c), LL(0xdc396e6ea56e57cb), LL(0x95aac4c437c46ef3), LL(0x061b03030c03180f), + LL(0xacdc565645568a13), LL(0x885e44440d441a49), LL(0xfea07f7fe17fdf9e), LL(0x4f88a9a99ea92137), + LL(0x54672a2aa82a4d82), LL(0x6b0abbbbd6bbb16d), LL(0x9f87c1c123c146e2), LL(0xa6f153535153a202), + LL(0xa572dcdc57dcae8b), LL(0x16530b0b2c0b5827), LL(0x27019d9d4e9d9cd3), LL(0xd82b6c6cad6c47c1), + LL(0x62a43131c43195f5), LL(0xe8f37474cd7487b9), LL(0xf115f6f6fff6e309), LL(0x8c4c464605460a43), + LL(0x45a5acac8aac0926), LL(0x0fb589891e893c97), LL(0x28b414145014a044), LL(0xdfbae1e1a3e15b42), + LL(0x2ca616165816b04e), LL(0x74f73a3ae83acdd2), LL(0xd2066969b9696fd0), LL(0x124109092409482d), + LL(0xe0d77070dd70a7ad), LL(0x716fb6b6e2b6d954), LL(0xbd1ed0d067d0ceb7), LL(0xc7d6eded93ed3b7e), + LL(0x85e2cccc17cc2edb), LL(0x8468424215422a57), LL(0x2d2c98985a98b4c2), LL(0x55eda4a4aaa4490e), + LL(0x50752828a0285d88), LL(0xb8865c5c6d5cda31), LL(0xed6bf8f8c7f8933f), LL(0x11c28686228644a4), +}; + +static const u64 C3[256] = { + LL(0x7830d818186018c0), LL(0xaf462623238c2305), LL(0xf991b8c6c63fc67e), LL(0x6fcdfbe8e887e813), + LL(0xa113cb878726874c), LL(0x626d11b8b8dab8a9), LL(0x0502090101040108), LL(0x6e9e0d4f4f214f42), + LL(0xee6c9b3636d836ad), LL(0x0451ffa6a6a2a659), LL(0xbdb90cd2d26fd2de), LL(0x06f70ef5f5f3f5fb), + LL(0x80f2967979f979ef), LL(0xcede306f6fa16f5f), LL(0xef3f6d91917e91fc), LL(0x07a4f852525552aa), + LL(0xfdc04760609d6027), LL(0x766535bcbccabc89), LL(0xcd2b379b9b569bac), LL(0x8c018a8e8e028e04), + LL(0x155bd2a3a3b6a371), LL(0x3c186c0c0c300c60), LL(0x8af6847b7bf17bff), LL(0xe16a803535d435b5), + LL(0x693af51d1d741de8), LL(0x47ddb3e0e0a7e053), LL(0xacb321d7d77bd7f6), LL(0xed999cc2c22fc25e), + LL(0x965c432e2eb82e6d), LL(0x7a96294b4b314b62), LL(0x21e15dfefedffea3), LL(0x16aed55757415782), + LL(0x412abd15155415a8), LL(0xb6eee87777c1779f), LL(0xeb6e923737dc37a5), LL(0x56d79ee5e5b3e57b), + LL(0xd923139f9f469f8c), LL(0x17fd23f0f0e7f0d3), LL(0x7f94204a4a354a6a), LL(0x95a944dada4fda9e), + LL(0x25b0a258587d58fa), LL(0xca8fcfc9c903c906), LL(0x8d527c2929a42955), LL(0x22145a0a0a280a50), + LL(0x4f7f50b1b1feb1e1), LL(0x1a5dc9a0a0baa069), LL(0xdad6146b6bb16b7f), LL(0xab17d985852e855c), + LL(0x73673cbdbdcebd81), LL(0x34ba8f5d5d695dd2), LL(0x5020901010401080), LL(0x03f507f4f4f7f4f3), + LL(0xc08bddcbcb0bcb16), LL(0xc67cd33e3ef83eed), LL(0x110a2d0505140528), LL(0xe6ce78676781671f), + LL(0x53d597e4e4b7e473), LL(0xbb4e0227279c2725), LL(0x5882734141194132), LL(0x9d0ba78b8b168b2c), + LL(0x0153f6a7a7a6a751), LL(0x94fab27d7de97dcf), LL(0xfb374995956e95dc), LL(0x9fad56d8d847d88e), + LL(0x30eb70fbfbcbfb8b), LL(0x71c1cdeeee9fee23), LL(0x91f8bb7c7ced7cc7), LL(0xe3cc716666856617), + LL(0x8ea77bdddd53dda6), LL(0x4b2eaf17175c17b8), LL(0x468e454747014702), LL(0xdc211a9e9e429e84), + LL(0xc589d4caca0fca1e), LL(0x995a582d2db42d75), LL(0x79632ebfbfc6bf91), LL(0x1b0e3f07071c0738), + LL(0x2347acadad8ead01), LL(0x2fb4b05a5a755aea), LL(0xb51bef838336836c), LL(0xff66b63333cc3385), + LL(0xf2c65c636391633f), LL(0x0a04120202080210), LL(0x384993aaaa92aa39), LL(0xa8e2de7171d971af), + LL(0xcf8dc6c8c807c80e), LL(0x7d32d119196419c8), LL(0x70923b4949394972), LL(0x9aaf5fd9d943d986), + LL(0x1df931f2f2eff2c3), LL(0x48dba8e3e3abe34b), LL(0x2ab6b95b5b715be2), LL(0x920dbc88881a8834), + LL(0xc8293e9a9a529aa4), LL(0xbe4c0b262698262d), LL(0xfa64bf3232c8328d), LL(0x4a7d59b0b0fab0e9), + LL(0x6acff2e9e983e91b), LL(0x331e770f0f3c0f78), LL(0xa6b733d5d573d5e6), LL(0xba1df480803a8074), + LL(0x7c6127bebec2be99), LL(0xde87ebcdcd13cd26), LL(0xe468893434d034bd), LL(0x75903248483d487a), + LL(0x24e354ffffdbffab), LL(0x8ff48d7a7af57af7), LL(0xea3d6490907a90f4), LL(0x3ebe9d5f5f615fc2), + LL(0xa0403d202080201d), LL(0xd5d00f6868bd6867), LL(0x7234ca1a1a681ad0), LL(0x2c41b7aeae82ae19), + LL(0x5e757db4b4eab4c9), LL(0x19a8ce54544d549a), LL(0xe53b7f93937693ec), LL(0xaa442f222288220d), + LL(0xe9c86364648d6407), LL(0x12ff2af1f1e3f1db), LL(0xa2e6cc7373d173bf), LL(0x5a24821212481290), + LL(0x5d807a40401d403a), LL(0x2810480808200840), LL(0xe89b95c3c32bc356), LL(0x7bc5dfecec97ec33), + LL(0x90ab4ddbdb4bdb96), LL(0x1f5fc0a1a1bea161), LL(0x8307918d8d0e8d1c), LL(0xc97ac83d3df43df5), + LL(0xf1335b97976697cc), LL(0x0000000000000000), LL(0xd483f9cfcf1bcf36), LL(0x87566e2b2bac2b45), + LL(0xb3ece17676c57697), LL(0xb019e68282328264), LL(0xa9b128d6d67fd6fe), LL(0x7736c31b1b6c1bd8), + LL(0x5b7774b5b5eeb5c1), LL(0x2943beafaf86af11), LL(0xdfd41d6a6ab56a77), LL(0x0da0ea50505d50ba), + LL(0x4c8a574545094512), LL(0x18fb38f3f3ebf3cb), LL(0xf060ad3030c0309d), LL(0x74c3c4efef9bef2b), + LL(0xc37eda3f3ffc3fe5), LL(0x1caac75555495592), LL(0x1059dba2a2b2a279), LL(0x65c9e9eaea8fea03), + LL(0xecca6a656589650f), LL(0x686903babad2bab9), LL(0x935e4a2f2fbc2f65), LL(0xe79d8ec0c027c04e), + LL(0x81a160dede5fdebe), LL(0x6c38fc1c1c701ce0), LL(0x2ee746fdfdd3fdbb), LL(0x649a1f4d4d294d52), + LL(0xe0397692927292e4), LL(0xbceafa7575c9758f), LL(0x1e0c360606180630), LL(0x9809ae8a8a128a24), + LL(0x40794bb2b2f2b2f9), LL(0x59d185e6e6bfe663), LL(0x361c7e0e0e380e70), LL(0x633ee71f1f7c1ff8), + LL(0xf7c4556262956237), LL(0xa3b53ad4d477d4ee), LL(0x324d81a8a89aa829), LL(0xf4315296966296c4), + LL(0x3aef62f9f9c3f99b), LL(0xf697a3c5c533c566), LL(0xb14a102525942535), LL(0x20b2ab59597959f2), + LL(0xae15d084842a8454), LL(0xa7e4c57272d572b7), LL(0xdd72ec3939e439d5), LL(0x6198164c4c2d4c5a), + LL(0x3bbc945e5e655eca), LL(0x85f09f7878fd78e7), LL(0xd870e53838e038dd), LL(0x8605988c8c0a8c14), + LL(0xb2bf17d1d163d1c6), LL(0x0b57e4a5a5aea541), LL(0x4dd9a1e2e2afe243), LL(0xf8c24e616199612f), + LL(0x457b42b3b3f6b3f1), LL(0xa542342121842115), LL(0xd625089c9c4a9c94), LL(0x663cee1e1e781ef0), + LL(0x5286614343114322), LL(0xfc93b1c7c73bc776), LL(0x2be54ffcfcd7fcb3), LL(0x1408240404100420), + LL(0x08a2e351515951b2), LL(0xc72f2599995e99bc), LL(0xc4da226d6da96d4f), LL(0x391a650d0d340d68), + LL(0x35e979fafacffa83), LL(0x84a369dfdf5bdfb6), LL(0x9bfca97e7ee57ed7), LL(0xb44819242490243d), + LL(0xd776fe3b3bec3bc5), LL(0x3d4b9aabab96ab31), LL(0xd181f0cece1fce3e), LL(0x5522991111441188), + LL(0x8903838f8f068f0c), LL(0x6b9c044e4e254e4a), LL(0x517366b7b7e6b7d1), LL(0x60cbe0ebeb8beb0b), + LL(0xcc78c13c3cf03cfd), LL(0xbf1ffd81813e817c), LL(0xfe354094946a94d4), LL(0x0cf31cf7f7fbf7eb), + LL(0x676f18b9b9deb9a1), LL(0x5f268b13134c1398), LL(0x9c58512c2cb02c7d), LL(0xb8bb05d3d36bd3d6), + LL(0x5cd38ce7e7bbe76b), LL(0xcbdc396e6ea56e57), LL(0xf395aac4c437c46e), LL(0x0f061b03030c0318), + LL(0x13acdc565645568a), LL(0x49885e44440d441a), LL(0x9efea07f7fe17fdf), LL(0x374f88a9a99ea921), + LL(0x8254672a2aa82a4d), LL(0x6d6b0abbbbd6bbb1), LL(0xe29f87c1c123c146), LL(0x02a6f153535153a2), + LL(0x8ba572dcdc57dcae), LL(0x2716530b0b2c0b58), LL(0xd327019d9d4e9d9c), LL(0xc1d82b6c6cad6c47), + LL(0xf562a43131c43195), LL(0xb9e8f37474cd7487), LL(0x09f115f6f6fff6e3), LL(0x438c4c464605460a), + LL(0x2645a5acac8aac09), LL(0x970fb589891e893c), LL(0x4428b414145014a0), LL(0x42dfbae1e1a3e15b), + LL(0x4e2ca616165816b0), LL(0xd274f73a3ae83acd), LL(0xd0d2066969b9696f), LL(0x2d12410909240948), + LL(0xade0d77070dd70a7), LL(0x54716fb6b6e2b6d9), LL(0xb7bd1ed0d067d0ce), LL(0x7ec7d6eded93ed3b), + LL(0xdb85e2cccc17cc2e), LL(0x578468424215422a), LL(0xc22d2c98985a98b4), LL(0x0e55eda4a4aaa449), + LL(0x8850752828a0285d), LL(0x31b8865c5c6d5cda), LL(0x3fed6bf8f8c7f893), LL(0xa411c28686228644), +}; + +static const u64 C4[256] = { + LL(0xc07830d818186018), LL(0x05af462623238c23), LL(0x7ef991b8c6c63fc6), LL(0x136fcdfbe8e887e8), + LL(0x4ca113cb87872687), LL(0xa9626d11b8b8dab8), LL(0x0805020901010401), LL(0x426e9e0d4f4f214f), + LL(0xadee6c9b3636d836), LL(0x590451ffa6a6a2a6), LL(0xdebdb90cd2d26fd2), LL(0xfb06f70ef5f5f3f5), + LL(0xef80f2967979f979), LL(0x5fcede306f6fa16f), LL(0xfcef3f6d91917e91), LL(0xaa07a4f852525552), + LL(0x27fdc04760609d60), LL(0x89766535bcbccabc), LL(0xaccd2b379b9b569b), LL(0x048c018a8e8e028e), + LL(0x71155bd2a3a3b6a3), LL(0x603c186c0c0c300c), LL(0xff8af6847b7bf17b), LL(0xb5e16a803535d435), + LL(0xe8693af51d1d741d), LL(0x5347ddb3e0e0a7e0), LL(0xf6acb321d7d77bd7), LL(0x5eed999cc2c22fc2), + LL(0x6d965c432e2eb82e), LL(0x627a96294b4b314b), LL(0xa321e15dfefedffe), LL(0x8216aed557574157), + LL(0xa8412abd15155415), LL(0x9fb6eee87777c177), LL(0xa5eb6e923737dc37), LL(0x7b56d79ee5e5b3e5), + LL(0x8cd923139f9f469f), LL(0xd317fd23f0f0e7f0), LL(0x6a7f94204a4a354a), LL(0x9e95a944dada4fda), + LL(0xfa25b0a258587d58), LL(0x06ca8fcfc9c903c9), LL(0x558d527c2929a429), LL(0x5022145a0a0a280a), + LL(0xe14f7f50b1b1feb1), LL(0x691a5dc9a0a0baa0), LL(0x7fdad6146b6bb16b), LL(0x5cab17d985852e85), + LL(0x8173673cbdbdcebd), LL(0xd234ba8f5d5d695d), LL(0x8050209010104010), LL(0xf303f507f4f4f7f4), + LL(0x16c08bddcbcb0bcb), LL(0xedc67cd33e3ef83e), LL(0x28110a2d05051405), LL(0x1fe6ce7867678167), + LL(0x7353d597e4e4b7e4), LL(0x25bb4e0227279c27), LL(0x3258827341411941), LL(0x2c9d0ba78b8b168b), + LL(0x510153f6a7a7a6a7), LL(0xcf94fab27d7de97d), LL(0xdcfb374995956e95), LL(0x8e9fad56d8d847d8), + LL(0x8b30eb70fbfbcbfb), LL(0x2371c1cdeeee9fee), LL(0xc791f8bb7c7ced7c), LL(0x17e3cc7166668566), + LL(0xa68ea77bdddd53dd), LL(0xb84b2eaf17175c17), LL(0x02468e4547470147), LL(0x84dc211a9e9e429e), + LL(0x1ec589d4caca0fca), LL(0x75995a582d2db42d), LL(0x9179632ebfbfc6bf), LL(0x381b0e3f07071c07), + LL(0x012347acadad8ead), LL(0xea2fb4b05a5a755a), LL(0x6cb51bef83833683), LL(0x85ff66b63333cc33), + LL(0x3ff2c65c63639163), LL(0x100a041202020802), LL(0x39384993aaaa92aa), LL(0xafa8e2de7171d971), + LL(0x0ecf8dc6c8c807c8), LL(0xc87d32d119196419), LL(0x7270923b49493949), LL(0x869aaf5fd9d943d9), + LL(0xc31df931f2f2eff2), LL(0x4b48dba8e3e3abe3), LL(0xe22ab6b95b5b715b), LL(0x34920dbc88881a88), + LL(0xa4c8293e9a9a529a), LL(0x2dbe4c0b26269826), LL(0x8dfa64bf3232c832), LL(0xe94a7d59b0b0fab0), + LL(0x1b6acff2e9e983e9), LL(0x78331e770f0f3c0f), LL(0xe6a6b733d5d573d5), LL(0x74ba1df480803a80), + LL(0x997c6127bebec2be), LL(0x26de87ebcdcd13cd), LL(0xbde468893434d034), LL(0x7a75903248483d48), + LL(0xab24e354ffffdbff), LL(0xf78ff48d7a7af57a), LL(0xf4ea3d6490907a90), LL(0xc23ebe9d5f5f615f), + LL(0x1da0403d20208020), LL(0x67d5d00f6868bd68), LL(0xd07234ca1a1a681a), LL(0x192c41b7aeae82ae), + LL(0xc95e757db4b4eab4), LL(0x9a19a8ce54544d54), LL(0xece53b7f93937693), LL(0x0daa442f22228822), + LL(0x07e9c86364648d64), LL(0xdb12ff2af1f1e3f1), LL(0xbfa2e6cc7373d173), LL(0x905a248212124812), + LL(0x3a5d807a40401d40), LL(0x4028104808082008), LL(0x56e89b95c3c32bc3), LL(0x337bc5dfecec97ec), + LL(0x9690ab4ddbdb4bdb), LL(0x611f5fc0a1a1bea1), LL(0x1c8307918d8d0e8d), LL(0xf5c97ac83d3df43d), + LL(0xccf1335b97976697), LL(0x0000000000000000), LL(0x36d483f9cfcf1bcf), LL(0x4587566e2b2bac2b), + LL(0x97b3ece17676c576), LL(0x64b019e682823282), LL(0xfea9b128d6d67fd6), LL(0xd87736c31b1b6c1b), + LL(0xc15b7774b5b5eeb5), LL(0x112943beafaf86af), LL(0x77dfd41d6a6ab56a), LL(0xba0da0ea50505d50), + LL(0x124c8a5745450945), LL(0xcb18fb38f3f3ebf3), LL(0x9df060ad3030c030), LL(0x2b74c3c4efef9bef), + LL(0xe5c37eda3f3ffc3f), LL(0x921caac755554955), LL(0x791059dba2a2b2a2), LL(0x0365c9e9eaea8fea), + LL(0x0fecca6a65658965), LL(0xb9686903babad2ba), LL(0x65935e4a2f2fbc2f), LL(0x4ee79d8ec0c027c0), + LL(0xbe81a160dede5fde), LL(0xe06c38fc1c1c701c), LL(0xbb2ee746fdfdd3fd), LL(0x52649a1f4d4d294d), + LL(0xe4e0397692927292), LL(0x8fbceafa7575c975), LL(0x301e0c3606061806), LL(0x249809ae8a8a128a), + LL(0xf940794bb2b2f2b2), LL(0x6359d185e6e6bfe6), LL(0x70361c7e0e0e380e), LL(0xf8633ee71f1f7c1f), + LL(0x37f7c45562629562), LL(0xeea3b53ad4d477d4), LL(0x29324d81a8a89aa8), LL(0xc4f4315296966296), + LL(0x9b3aef62f9f9c3f9), LL(0x66f697a3c5c533c5), LL(0x35b14a1025259425), LL(0xf220b2ab59597959), + LL(0x54ae15d084842a84), LL(0xb7a7e4c57272d572), LL(0xd5dd72ec3939e439), LL(0x5a6198164c4c2d4c), + LL(0xca3bbc945e5e655e), LL(0xe785f09f7878fd78), LL(0xddd870e53838e038), LL(0x148605988c8c0a8c), + LL(0xc6b2bf17d1d163d1), LL(0x410b57e4a5a5aea5), LL(0x434dd9a1e2e2afe2), LL(0x2ff8c24e61619961), + LL(0xf1457b42b3b3f6b3), LL(0x15a5423421218421), LL(0x94d625089c9c4a9c), LL(0xf0663cee1e1e781e), + LL(0x2252866143431143), LL(0x76fc93b1c7c73bc7), LL(0xb32be54ffcfcd7fc), LL(0x2014082404041004), + LL(0xb208a2e351515951), LL(0xbcc72f2599995e99), LL(0x4fc4da226d6da96d), LL(0x68391a650d0d340d), + LL(0x8335e979fafacffa), LL(0xb684a369dfdf5bdf), LL(0xd79bfca97e7ee57e), LL(0x3db4481924249024), + LL(0xc5d776fe3b3bec3b), LL(0x313d4b9aabab96ab), LL(0x3ed181f0cece1fce), LL(0x8855229911114411), + LL(0x0c8903838f8f068f), LL(0x4a6b9c044e4e254e), LL(0xd1517366b7b7e6b7), LL(0x0b60cbe0ebeb8beb), + LL(0xfdcc78c13c3cf03c), LL(0x7cbf1ffd81813e81), LL(0xd4fe354094946a94), LL(0xeb0cf31cf7f7fbf7), + LL(0xa1676f18b9b9deb9), LL(0x985f268b13134c13), LL(0x7d9c58512c2cb02c), LL(0xd6b8bb05d3d36bd3), + LL(0x6b5cd38ce7e7bbe7), LL(0x57cbdc396e6ea56e), LL(0x6ef395aac4c437c4), LL(0x180f061b03030c03), + LL(0x8a13acdc56564556), LL(0x1a49885e44440d44), LL(0xdf9efea07f7fe17f), LL(0x21374f88a9a99ea9), + LL(0x4d8254672a2aa82a), LL(0xb16d6b0abbbbd6bb), LL(0x46e29f87c1c123c1), LL(0xa202a6f153535153), + LL(0xae8ba572dcdc57dc), LL(0x582716530b0b2c0b), LL(0x9cd327019d9d4e9d), LL(0x47c1d82b6c6cad6c), + LL(0x95f562a43131c431), LL(0x87b9e8f37474cd74), LL(0xe309f115f6f6fff6), LL(0x0a438c4c46460546), + LL(0x092645a5acac8aac), LL(0x3c970fb589891e89), LL(0xa04428b414145014), LL(0x5b42dfbae1e1a3e1), + LL(0xb04e2ca616165816), LL(0xcdd274f73a3ae83a), LL(0x6fd0d2066969b969), LL(0x482d124109092409), + LL(0xa7ade0d77070dd70), LL(0xd954716fb6b6e2b6), LL(0xceb7bd1ed0d067d0), LL(0x3b7ec7d6eded93ed), + LL(0x2edb85e2cccc17cc), LL(0x2a57846842421542), LL(0xb4c22d2c98985a98), LL(0x490e55eda4a4aaa4), + LL(0x5d8850752828a028), LL(0xda31b8865c5c6d5c), LL(0x933fed6bf8f8c7f8), LL(0x44a411c286862286), +}; + +static const u64 C5[256] = { + LL(0x18c07830d8181860), LL(0x2305af462623238c), LL(0xc67ef991b8c6c63f), LL(0xe8136fcdfbe8e887), + LL(0x874ca113cb878726), LL(0xb8a9626d11b8b8da), LL(0x0108050209010104), LL(0x4f426e9e0d4f4f21), + LL(0x36adee6c9b3636d8), LL(0xa6590451ffa6a6a2), LL(0xd2debdb90cd2d26f), LL(0xf5fb06f70ef5f5f3), + LL(0x79ef80f2967979f9), LL(0x6f5fcede306f6fa1), LL(0x91fcef3f6d91917e), LL(0x52aa07a4f8525255), + LL(0x6027fdc04760609d), LL(0xbc89766535bcbcca), LL(0x9baccd2b379b9b56), LL(0x8e048c018a8e8e02), + LL(0xa371155bd2a3a3b6), LL(0x0c603c186c0c0c30), LL(0x7bff8af6847b7bf1), LL(0x35b5e16a803535d4), + LL(0x1de8693af51d1d74), LL(0xe05347ddb3e0e0a7), LL(0xd7f6acb321d7d77b), LL(0xc25eed999cc2c22f), + LL(0x2e6d965c432e2eb8), LL(0x4b627a96294b4b31), LL(0xfea321e15dfefedf), LL(0x578216aed5575741), + LL(0x15a8412abd151554), LL(0x779fb6eee87777c1), LL(0x37a5eb6e923737dc), LL(0xe57b56d79ee5e5b3), + LL(0x9f8cd923139f9f46), LL(0xf0d317fd23f0f0e7), LL(0x4a6a7f94204a4a35), LL(0xda9e95a944dada4f), + LL(0x58fa25b0a258587d), LL(0xc906ca8fcfc9c903), LL(0x29558d527c2929a4), LL(0x0a5022145a0a0a28), + LL(0xb1e14f7f50b1b1fe), LL(0xa0691a5dc9a0a0ba), LL(0x6b7fdad6146b6bb1), LL(0x855cab17d985852e), + LL(0xbd8173673cbdbdce), LL(0x5dd234ba8f5d5d69), LL(0x1080502090101040), LL(0xf4f303f507f4f4f7), + LL(0xcb16c08bddcbcb0b), LL(0x3eedc67cd33e3ef8), LL(0x0528110a2d050514), LL(0x671fe6ce78676781), + LL(0xe47353d597e4e4b7), LL(0x2725bb4e0227279c), LL(0x4132588273414119), LL(0x8b2c9d0ba78b8b16), + LL(0xa7510153f6a7a7a6), LL(0x7dcf94fab27d7de9), LL(0x95dcfb374995956e), LL(0xd88e9fad56d8d847), + LL(0xfb8b30eb70fbfbcb), LL(0xee2371c1cdeeee9f), LL(0x7cc791f8bb7c7ced), LL(0x6617e3cc71666685), + LL(0xdda68ea77bdddd53), LL(0x17b84b2eaf17175c), LL(0x4702468e45474701), LL(0x9e84dc211a9e9e42), + LL(0xca1ec589d4caca0f), LL(0x2d75995a582d2db4), LL(0xbf9179632ebfbfc6), LL(0x07381b0e3f07071c), + LL(0xad012347acadad8e), LL(0x5aea2fb4b05a5a75), LL(0x836cb51bef838336), LL(0x3385ff66b63333cc), + LL(0x633ff2c65c636391), LL(0x02100a0412020208), LL(0xaa39384993aaaa92), LL(0x71afa8e2de7171d9), + LL(0xc80ecf8dc6c8c807), LL(0x19c87d32d1191964), LL(0x497270923b494939), LL(0xd9869aaf5fd9d943), + LL(0xf2c31df931f2f2ef), LL(0xe34b48dba8e3e3ab), LL(0x5be22ab6b95b5b71), LL(0x8834920dbc88881a), + LL(0x9aa4c8293e9a9a52), LL(0x262dbe4c0b262698), LL(0x328dfa64bf3232c8), LL(0xb0e94a7d59b0b0fa), + LL(0xe91b6acff2e9e983), LL(0x0f78331e770f0f3c), LL(0xd5e6a6b733d5d573), LL(0x8074ba1df480803a), + LL(0xbe997c6127bebec2), LL(0xcd26de87ebcdcd13), LL(0x34bde468893434d0), LL(0x487a75903248483d), + LL(0xffab24e354ffffdb), LL(0x7af78ff48d7a7af5), LL(0x90f4ea3d6490907a), LL(0x5fc23ebe9d5f5f61), + LL(0x201da0403d202080), LL(0x6867d5d00f6868bd), LL(0x1ad07234ca1a1a68), LL(0xae192c41b7aeae82), + LL(0xb4c95e757db4b4ea), LL(0x549a19a8ce54544d), LL(0x93ece53b7f939376), LL(0x220daa442f222288), + LL(0x6407e9c86364648d), LL(0xf1db12ff2af1f1e3), LL(0x73bfa2e6cc7373d1), LL(0x12905a2482121248), + LL(0x403a5d807a40401d), LL(0x0840281048080820), LL(0xc356e89b95c3c32b), LL(0xec337bc5dfecec97), + LL(0xdb9690ab4ddbdb4b), LL(0xa1611f5fc0a1a1be), LL(0x8d1c8307918d8d0e), LL(0x3df5c97ac83d3df4), + LL(0x97ccf1335b979766), LL(0x0000000000000000), LL(0xcf36d483f9cfcf1b), LL(0x2b4587566e2b2bac), + LL(0x7697b3ece17676c5), LL(0x8264b019e6828232), LL(0xd6fea9b128d6d67f), LL(0x1bd87736c31b1b6c), + LL(0xb5c15b7774b5b5ee), LL(0xaf112943beafaf86), LL(0x6a77dfd41d6a6ab5), LL(0x50ba0da0ea50505d), + LL(0x45124c8a57454509), LL(0xf3cb18fb38f3f3eb), LL(0x309df060ad3030c0), LL(0xef2b74c3c4efef9b), + LL(0x3fe5c37eda3f3ffc), LL(0x55921caac7555549), LL(0xa2791059dba2a2b2), LL(0xea0365c9e9eaea8f), + LL(0x650fecca6a656589), LL(0xbab9686903babad2), LL(0x2f65935e4a2f2fbc), LL(0xc04ee79d8ec0c027), + LL(0xdebe81a160dede5f), LL(0x1ce06c38fc1c1c70), LL(0xfdbb2ee746fdfdd3), LL(0x4d52649a1f4d4d29), + LL(0x92e4e03976929272), LL(0x758fbceafa7575c9), LL(0x06301e0c36060618), LL(0x8a249809ae8a8a12), + LL(0xb2f940794bb2b2f2), LL(0xe66359d185e6e6bf), LL(0x0e70361c7e0e0e38), LL(0x1ff8633ee71f1f7c), + LL(0x6237f7c455626295), LL(0xd4eea3b53ad4d477), LL(0xa829324d81a8a89a), LL(0x96c4f43152969662), + LL(0xf99b3aef62f9f9c3), LL(0xc566f697a3c5c533), LL(0x2535b14a10252594), LL(0x59f220b2ab595979), + LL(0x8454ae15d084842a), LL(0x72b7a7e4c57272d5), LL(0x39d5dd72ec3939e4), LL(0x4c5a6198164c4c2d), + LL(0x5eca3bbc945e5e65), LL(0x78e785f09f7878fd), LL(0x38ddd870e53838e0), LL(0x8c148605988c8c0a), + LL(0xd1c6b2bf17d1d163), LL(0xa5410b57e4a5a5ae), LL(0xe2434dd9a1e2e2af), LL(0x612ff8c24e616199), + LL(0xb3f1457b42b3b3f6), LL(0x2115a54234212184), LL(0x9c94d625089c9c4a), LL(0x1ef0663cee1e1e78), + LL(0x4322528661434311), LL(0xc776fc93b1c7c73b), LL(0xfcb32be54ffcfcd7), LL(0x0420140824040410), + LL(0x51b208a2e3515159), LL(0x99bcc72f2599995e), LL(0x6d4fc4da226d6da9), LL(0x0d68391a650d0d34), + LL(0xfa8335e979fafacf), LL(0xdfb684a369dfdf5b), LL(0x7ed79bfca97e7ee5), LL(0x243db44819242490), + LL(0x3bc5d776fe3b3bec), LL(0xab313d4b9aabab96), LL(0xce3ed181f0cece1f), LL(0x1188552299111144), + LL(0x8f0c8903838f8f06), LL(0x4e4a6b9c044e4e25), LL(0xb7d1517366b7b7e6), LL(0xeb0b60cbe0ebeb8b), + LL(0x3cfdcc78c13c3cf0), LL(0x817cbf1ffd81813e), LL(0x94d4fe354094946a), LL(0xf7eb0cf31cf7f7fb), + LL(0xb9a1676f18b9b9de), LL(0x13985f268b13134c), LL(0x2c7d9c58512c2cb0), LL(0xd3d6b8bb05d3d36b), + LL(0xe76b5cd38ce7e7bb), LL(0x6e57cbdc396e6ea5), LL(0xc46ef395aac4c437), LL(0x03180f061b03030c), + LL(0x568a13acdc565645), LL(0x441a49885e44440d), LL(0x7fdf9efea07f7fe1), LL(0xa921374f88a9a99e), + LL(0x2a4d8254672a2aa8), LL(0xbbb16d6b0abbbbd6), LL(0xc146e29f87c1c123), LL(0x53a202a6f1535351), + LL(0xdcae8ba572dcdc57), LL(0x0b582716530b0b2c), LL(0x9d9cd327019d9d4e), LL(0x6c47c1d82b6c6cad), + LL(0x3195f562a43131c4), LL(0x7487b9e8f37474cd), LL(0xf6e309f115f6f6ff), LL(0x460a438c4c464605), + LL(0xac092645a5acac8a), LL(0x893c970fb589891e), LL(0x14a04428b4141450), LL(0xe15b42dfbae1e1a3), + LL(0x16b04e2ca6161658), LL(0x3acdd274f73a3ae8), LL(0x696fd0d2066969b9), LL(0x09482d1241090924), + LL(0x70a7ade0d77070dd), LL(0xb6d954716fb6b6e2), LL(0xd0ceb7bd1ed0d067), LL(0xed3b7ec7d6eded93), + LL(0xcc2edb85e2cccc17), LL(0x422a578468424215), LL(0x98b4c22d2c98985a), LL(0xa4490e55eda4a4aa), + LL(0x285d8850752828a0), LL(0x5cda31b8865c5c6d), LL(0xf8933fed6bf8f8c7), LL(0x8644a411c2868622), +}; + +static const u64 C6[256] = { + LL(0x6018c07830d81818), LL(0x8c2305af46262323), LL(0x3fc67ef991b8c6c6), LL(0x87e8136fcdfbe8e8), + LL(0x26874ca113cb8787), LL(0xdab8a9626d11b8b8), LL(0x0401080502090101), LL(0x214f426e9e0d4f4f), + LL(0xd836adee6c9b3636), LL(0xa2a6590451ffa6a6), LL(0x6fd2debdb90cd2d2), LL(0xf3f5fb06f70ef5f5), + LL(0xf979ef80f2967979), LL(0xa16f5fcede306f6f), LL(0x7e91fcef3f6d9191), LL(0x5552aa07a4f85252), + LL(0x9d6027fdc0476060), LL(0xcabc89766535bcbc), LL(0x569baccd2b379b9b), LL(0x028e048c018a8e8e), + LL(0xb6a371155bd2a3a3), LL(0x300c603c186c0c0c), LL(0xf17bff8af6847b7b), LL(0xd435b5e16a803535), + LL(0x741de8693af51d1d), LL(0xa7e05347ddb3e0e0), LL(0x7bd7f6acb321d7d7), LL(0x2fc25eed999cc2c2), + LL(0xb82e6d965c432e2e), LL(0x314b627a96294b4b), LL(0xdffea321e15dfefe), LL(0x41578216aed55757), + LL(0x5415a8412abd1515), LL(0xc1779fb6eee87777), LL(0xdc37a5eb6e923737), LL(0xb3e57b56d79ee5e5), + LL(0x469f8cd923139f9f), LL(0xe7f0d317fd23f0f0), LL(0x354a6a7f94204a4a), LL(0x4fda9e95a944dada), + LL(0x7d58fa25b0a25858), LL(0x03c906ca8fcfc9c9), LL(0xa429558d527c2929), LL(0x280a5022145a0a0a), + LL(0xfeb1e14f7f50b1b1), LL(0xbaa0691a5dc9a0a0), LL(0xb16b7fdad6146b6b), LL(0x2e855cab17d98585), + LL(0xcebd8173673cbdbd), LL(0x695dd234ba8f5d5d), LL(0x4010805020901010), LL(0xf7f4f303f507f4f4), + LL(0x0bcb16c08bddcbcb), LL(0xf83eedc67cd33e3e), LL(0x140528110a2d0505), LL(0x81671fe6ce786767), + LL(0xb7e47353d597e4e4), LL(0x9c2725bb4e022727), LL(0x1941325882734141), LL(0x168b2c9d0ba78b8b), + LL(0xa6a7510153f6a7a7), LL(0xe97dcf94fab27d7d), LL(0x6e95dcfb37499595), LL(0x47d88e9fad56d8d8), + LL(0xcbfb8b30eb70fbfb), LL(0x9fee2371c1cdeeee), LL(0xed7cc791f8bb7c7c), LL(0x856617e3cc716666), + LL(0x53dda68ea77bdddd), LL(0x5c17b84b2eaf1717), LL(0x014702468e454747), LL(0x429e84dc211a9e9e), + LL(0x0fca1ec589d4caca), LL(0xb42d75995a582d2d), LL(0xc6bf9179632ebfbf), LL(0x1c07381b0e3f0707), + LL(0x8ead012347acadad), LL(0x755aea2fb4b05a5a), LL(0x36836cb51bef8383), LL(0xcc3385ff66b63333), + LL(0x91633ff2c65c6363), LL(0x0802100a04120202), LL(0x92aa39384993aaaa), LL(0xd971afa8e2de7171), + LL(0x07c80ecf8dc6c8c8), LL(0x6419c87d32d11919), LL(0x39497270923b4949), LL(0x43d9869aaf5fd9d9), + LL(0xeff2c31df931f2f2), LL(0xabe34b48dba8e3e3), LL(0x715be22ab6b95b5b), LL(0x1a8834920dbc8888), + LL(0x529aa4c8293e9a9a), LL(0x98262dbe4c0b2626), LL(0xc8328dfa64bf3232), LL(0xfab0e94a7d59b0b0), + LL(0x83e91b6acff2e9e9), LL(0x3c0f78331e770f0f), LL(0x73d5e6a6b733d5d5), LL(0x3a8074ba1df48080), + LL(0xc2be997c6127bebe), LL(0x13cd26de87ebcdcd), LL(0xd034bde468893434), LL(0x3d487a7590324848), + LL(0xdbffab24e354ffff), LL(0xf57af78ff48d7a7a), LL(0x7a90f4ea3d649090), LL(0x615fc23ebe9d5f5f), + LL(0x80201da0403d2020), LL(0xbd6867d5d00f6868), LL(0x681ad07234ca1a1a), LL(0x82ae192c41b7aeae), + LL(0xeab4c95e757db4b4), LL(0x4d549a19a8ce5454), LL(0x7693ece53b7f9393), LL(0x88220daa442f2222), + LL(0x8d6407e9c8636464), LL(0xe3f1db12ff2af1f1), LL(0xd173bfa2e6cc7373), LL(0x4812905a24821212), + LL(0x1d403a5d807a4040), LL(0x2008402810480808), LL(0x2bc356e89b95c3c3), LL(0x97ec337bc5dfecec), + LL(0x4bdb9690ab4ddbdb), LL(0xbea1611f5fc0a1a1), LL(0x0e8d1c8307918d8d), LL(0xf43df5c97ac83d3d), + LL(0x6697ccf1335b9797), LL(0x0000000000000000), LL(0x1bcf36d483f9cfcf), LL(0xac2b4587566e2b2b), + LL(0xc57697b3ece17676), LL(0x328264b019e68282), LL(0x7fd6fea9b128d6d6), LL(0x6c1bd87736c31b1b), + LL(0xeeb5c15b7774b5b5), LL(0x86af112943beafaf), LL(0xb56a77dfd41d6a6a), LL(0x5d50ba0da0ea5050), + LL(0x0945124c8a574545), LL(0xebf3cb18fb38f3f3), LL(0xc0309df060ad3030), LL(0x9bef2b74c3c4efef), + LL(0xfc3fe5c37eda3f3f), LL(0x4955921caac75555), LL(0xb2a2791059dba2a2), LL(0x8fea0365c9e9eaea), + LL(0x89650fecca6a6565), LL(0xd2bab9686903baba), LL(0xbc2f65935e4a2f2f), LL(0x27c04ee79d8ec0c0), + LL(0x5fdebe81a160dede), LL(0x701ce06c38fc1c1c), LL(0xd3fdbb2ee746fdfd), LL(0x294d52649a1f4d4d), + LL(0x7292e4e039769292), LL(0xc9758fbceafa7575), LL(0x1806301e0c360606), LL(0x128a249809ae8a8a), + LL(0xf2b2f940794bb2b2), LL(0xbfe66359d185e6e6), LL(0x380e70361c7e0e0e), LL(0x7c1ff8633ee71f1f), + LL(0x956237f7c4556262), LL(0x77d4eea3b53ad4d4), LL(0x9aa829324d81a8a8), LL(0x6296c4f431529696), + LL(0xc3f99b3aef62f9f9), LL(0x33c566f697a3c5c5), LL(0x942535b14a102525), LL(0x7959f220b2ab5959), + LL(0x2a8454ae15d08484), LL(0xd572b7a7e4c57272), LL(0xe439d5dd72ec3939), LL(0x2d4c5a6198164c4c), + LL(0x655eca3bbc945e5e), LL(0xfd78e785f09f7878), LL(0xe038ddd870e53838), LL(0x0a8c148605988c8c), + LL(0x63d1c6b2bf17d1d1), LL(0xaea5410b57e4a5a5), LL(0xafe2434dd9a1e2e2), LL(0x99612ff8c24e6161), + LL(0xf6b3f1457b42b3b3), LL(0x842115a542342121), LL(0x4a9c94d625089c9c), LL(0x781ef0663cee1e1e), + LL(0x1143225286614343), LL(0x3bc776fc93b1c7c7), LL(0xd7fcb32be54ffcfc), LL(0x1004201408240404), + LL(0x5951b208a2e35151), LL(0x5e99bcc72f259999), LL(0xa96d4fc4da226d6d), LL(0x340d68391a650d0d), + LL(0xcffa8335e979fafa), LL(0x5bdfb684a369dfdf), LL(0xe57ed79bfca97e7e), LL(0x90243db448192424), + LL(0xec3bc5d776fe3b3b), LL(0x96ab313d4b9aabab), LL(0x1fce3ed181f0cece), LL(0x4411885522991111), + LL(0x068f0c8903838f8f), LL(0x254e4a6b9c044e4e), LL(0xe6b7d1517366b7b7), LL(0x8beb0b60cbe0ebeb), + LL(0xf03cfdcc78c13c3c), LL(0x3e817cbf1ffd8181), LL(0x6a94d4fe35409494), LL(0xfbf7eb0cf31cf7f7), + LL(0xdeb9a1676f18b9b9), LL(0x4c13985f268b1313), LL(0xb02c7d9c58512c2c), LL(0x6bd3d6b8bb05d3d3), + LL(0xbbe76b5cd38ce7e7), LL(0xa56e57cbdc396e6e), LL(0x37c46ef395aac4c4), LL(0x0c03180f061b0303), + LL(0x45568a13acdc5656), LL(0x0d441a49885e4444), LL(0xe17fdf9efea07f7f), LL(0x9ea921374f88a9a9), + LL(0xa82a4d8254672a2a), LL(0xd6bbb16d6b0abbbb), LL(0x23c146e29f87c1c1), LL(0x5153a202a6f15353), + LL(0x57dcae8ba572dcdc), LL(0x2c0b582716530b0b), LL(0x4e9d9cd327019d9d), LL(0xad6c47c1d82b6c6c), + LL(0xc43195f562a43131), LL(0xcd7487b9e8f37474), LL(0xfff6e309f115f6f6), LL(0x05460a438c4c4646), + LL(0x8aac092645a5acac), LL(0x1e893c970fb58989), LL(0x5014a04428b41414), LL(0xa3e15b42dfbae1e1), + LL(0x5816b04e2ca61616), LL(0xe83acdd274f73a3a), LL(0xb9696fd0d2066969), LL(0x2409482d12410909), + LL(0xdd70a7ade0d77070), LL(0xe2b6d954716fb6b6), LL(0x67d0ceb7bd1ed0d0), LL(0x93ed3b7ec7d6eded), + LL(0x17cc2edb85e2cccc), LL(0x15422a5784684242), LL(0x5a98b4c22d2c9898), LL(0xaaa4490e55eda4a4), + LL(0xa0285d8850752828), LL(0x6d5cda31b8865c5c), LL(0xc7f8933fed6bf8f8), LL(0x228644a411c28686), +}; + +static const u64 C7[256] = { + LL(0x186018c07830d818), LL(0x238c2305af462623), LL(0xc63fc67ef991b8c6), LL(0xe887e8136fcdfbe8), + LL(0x8726874ca113cb87), LL(0xb8dab8a9626d11b8), LL(0x0104010805020901), LL(0x4f214f426e9e0d4f), + LL(0x36d836adee6c9b36), LL(0xa6a2a6590451ffa6), LL(0xd26fd2debdb90cd2), LL(0xf5f3f5fb06f70ef5), + LL(0x79f979ef80f29679), LL(0x6fa16f5fcede306f), LL(0x917e91fcef3f6d91), LL(0x525552aa07a4f852), + LL(0x609d6027fdc04760), LL(0xbccabc89766535bc), LL(0x9b569baccd2b379b), LL(0x8e028e048c018a8e), + LL(0xa3b6a371155bd2a3), LL(0x0c300c603c186c0c), LL(0x7bf17bff8af6847b), LL(0x35d435b5e16a8035), + LL(0x1d741de8693af51d), LL(0xe0a7e05347ddb3e0), LL(0xd77bd7f6acb321d7), LL(0xc22fc25eed999cc2), + LL(0x2eb82e6d965c432e), LL(0x4b314b627a96294b), LL(0xfedffea321e15dfe), LL(0x5741578216aed557), + LL(0x155415a8412abd15), LL(0x77c1779fb6eee877), LL(0x37dc37a5eb6e9237), LL(0xe5b3e57b56d79ee5), + LL(0x9f469f8cd923139f), LL(0xf0e7f0d317fd23f0), LL(0x4a354a6a7f94204a), LL(0xda4fda9e95a944da), + LL(0x587d58fa25b0a258), LL(0xc903c906ca8fcfc9), LL(0x29a429558d527c29), LL(0x0a280a5022145a0a), + LL(0xb1feb1e14f7f50b1), LL(0xa0baa0691a5dc9a0), LL(0x6bb16b7fdad6146b), LL(0x852e855cab17d985), + LL(0xbdcebd8173673cbd), LL(0x5d695dd234ba8f5d), LL(0x1040108050209010), LL(0xf4f7f4f303f507f4), + LL(0xcb0bcb16c08bddcb), LL(0x3ef83eedc67cd33e), LL(0x05140528110a2d05), LL(0x6781671fe6ce7867), + LL(0xe4b7e47353d597e4), LL(0x279c2725bb4e0227), LL(0x4119413258827341), LL(0x8b168b2c9d0ba78b), + LL(0xa7a6a7510153f6a7), LL(0x7de97dcf94fab27d), LL(0x956e95dcfb374995), LL(0xd847d88e9fad56d8), + LL(0xfbcbfb8b30eb70fb), LL(0xee9fee2371c1cdee), LL(0x7ced7cc791f8bb7c), LL(0x66856617e3cc7166), + LL(0xdd53dda68ea77bdd), LL(0x175c17b84b2eaf17), LL(0x47014702468e4547), LL(0x9e429e84dc211a9e), + LL(0xca0fca1ec589d4ca), LL(0x2db42d75995a582d), LL(0xbfc6bf9179632ebf), LL(0x071c07381b0e3f07), + LL(0xad8ead012347acad), LL(0x5a755aea2fb4b05a), LL(0x8336836cb51bef83), LL(0x33cc3385ff66b633), + LL(0x6391633ff2c65c63), LL(0x020802100a041202), LL(0xaa92aa39384993aa), LL(0x71d971afa8e2de71), + LL(0xc807c80ecf8dc6c8), LL(0x196419c87d32d119), LL(0x4939497270923b49), LL(0xd943d9869aaf5fd9), + LL(0xf2eff2c31df931f2), LL(0xe3abe34b48dba8e3), LL(0x5b715be22ab6b95b), LL(0x881a8834920dbc88), + LL(0x9a529aa4c8293e9a), LL(0x2698262dbe4c0b26), LL(0x32c8328dfa64bf32), LL(0xb0fab0e94a7d59b0), + LL(0xe983e91b6acff2e9), LL(0x0f3c0f78331e770f), LL(0xd573d5e6a6b733d5), LL(0x803a8074ba1df480), + LL(0xbec2be997c6127be), LL(0xcd13cd26de87ebcd), LL(0x34d034bde4688934), LL(0x483d487a75903248), + LL(0xffdbffab24e354ff), LL(0x7af57af78ff48d7a), LL(0x907a90f4ea3d6490), LL(0x5f615fc23ebe9d5f), + LL(0x2080201da0403d20), LL(0x68bd6867d5d00f68), LL(0x1a681ad07234ca1a), LL(0xae82ae192c41b7ae), + LL(0xb4eab4c95e757db4), LL(0x544d549a19a8ce54), LL(0x937693ece53b7f93), LL(0x2288220daa442f22), + LL(0x648d6407e9c86364), LL(0xf1e3f1db12ff2af1), LL(0x73d173bfa2e6cc73), LL(0x124812905a248212), + LL(0x401d403a5d807a40), LL(0x0820084028104808), LL(0xc32bc356e89b95c3), LL(0xec97ec337bc5dfec), + LL(0xdb4bdb9690ab4ddb), LL(0xa1bea1611f5fc0a1), LL(0x8d0e8d1c8307918d), LL(0x3df43df5c97ac83d), + LL(0x976697ccf1335b97), LL(0x0000000000000000), LL(0xcf1bcf36d483f9cf), LL(0x2bac2b4587566e2b), + LL(0x76c57697b3ece176), LL(0x82328264b019e682), LL(0xd67fd6fea9b128d6), LL(0x1b6c1bd87736c31b), + LL(0xb5eeb5c15b7774b5), LL(0xaf86af112943beaf), LL(0x6ab56a77dfd41d6a), LL(0x505d50ba0da0ea50), + LL(0x450945124c8a5745), LL(0xf3ebf3cb18fb38f3), LL(0x30c0309df060ad30), LL(0xef9bef2b74c3c4ef), + LL(0x3ffc3fe5c37eda3f), LL(0x554955921caac755), LL(0xa2b2a2791059dba2), LL(0xea8fea0365c9e9ea), + LL(0x6589650fecca6a65), LL(0xbad2bab9686903ba), LL(0x2fbc2f65935e4a2f), LL(0xc027c04ee79d8ec0), + LL(0xde5fdebe81a160de), LL(0x1c701ce06c38fc1c), LL(0xfdd3fdbb2ee746fd), LL(0x4d294d52649a1f4d), + LL(0x927292e4e0397692), LL(0x75c9758fbceafa75), LL(0x061806301e0c3606), LL(0x8a128a249809ae8a), + LL(0xb2f2b2f940794bb2), LL(0xe6bfe66359d185e6), LL(0x0e380e70361c7e0e), LL(0x1f7c1ff8633ee71f), + LL(0x62956237f7c45562), LL(0xd477d4eea3b53ad4), LL(0xa89aa829324d81a8), LL(0x966296c4f4315296), + LL(0xf9c3f99b3aef62f9), LL(0xc533c566f697a3c5), LL(0x25942535b14a1025), LL(0x597959f220b2ab59), + LL(0x842a8454ae15d084), LL(0x72d572b7a7e4c572), LL(0x39e439d5dd72ec39), LL(0x4c2d4c5a6198164c), + LL(0x5e655eca3bbc945e), LL(0x78fd78e785f09f78), LL(0x38e038ddd870e538), LL(0x8c0a8c148605988c), + LL(0xd163d1c6b2bf17d1), LL(0xa5aea5410b57e4a5), LL(0xe2afe2434dd9a1e2), LL(0x6199612ff8c24e61), + LL(0xb3f6b3f1457b42b3), LL(0x21842115a5423421), LL(0x9c4a9c94d625089c), LL(0x1e781ef0663cee1e), + LL(0x4311432252866143), LL(0xc73bc776fc93b1c7), LL(0xfcd7fcb32be54ffc), LL(0x0410042014082404), + LL(0x515951b208a2e351), LL(0x995e99bcc72f2599), LL(0x6da96d4fc4da226d), LL(0x0d340d68391a650d), + LL(0xfacffa8335e979fa), LL(0xdf5bdfb684a369df), LL(0x7ee57ed79bfca97e), LL(0x2490243db4481924), + LL(0x3bec3bc5d776fe3b), LL(0xab96ab313d4b9aab), LL(0xce1fce3ed181f0ce), LL(0x1144118855229911), + LL(0x8f068f0c8903838f), LL(0x4e254e4a6b9c044e), LL(0xb7e6b7d1517366b7), LL(0xeb8beb0b60cbe0eb), + LL(0x3cf03cfdcc78c13c), LL(0x813e817cbf1ffd81), LL(0x946a94d4fe354094), LL(0xf7fbf7eb0cf31cf7), + LL(0xb9deb9a1676f18b9), LL(0x134c13985f268b13), LL(0x2cb02c7d9c58512c), LL(0xd36bd3d6b8bb05d3), + LL(0xe7bbe76b5cd38ce7), LL(0x6ea56e57cbdc396e), LL(0xc437c46ef395aac4), LL(0x030c03180f061b03), + LL(0x5645568a13acdc56), LL(0x440d441a49885e44), LL(0x7fe17fdf9efea07f), LL(0xa99ea921374f88a9), + LL(0x2aa82a4d8254672a), LL(0xbbd6bbb16d6b0abb), LL(0xc123c146e29f87c1), LL(0x535153a202a6f153), + LL(0xdc57dcae8ba572dc), LL(0x0b2c0b582716530b), LL(0x9d4e9d9cd327019d), LL(0x6cad6c47c1d82b6c), + LL(0x31c43195f562a431), LL(0x74cd7487b9e8f374), LL(0xf6fff6e309f115f6), LL(0x4605460a438c4c46), + LL(0xac8aac092645a5ac), LL(0x891e893c970fb589), LL(0x145014a04428b414), LL(0xe1a3e15b42dfbae1), + LL(0x165816b04e2ca616), LL(0x3ae83acdd274f73a), LL(0x69b9696fd0d20669), LL(0x092409482d124109), + LL(0x70dd70a7ade0d770), LL(0xb6e2b6d954716fb6), LL(0xd067d0ceb7bd1ed0), LL(0xed93ed3b7ec7d6ed), + LL(0xcc17cc2edb85e2cc), LL(0x4215422a57846842), LL(0x985a98b4c22d2c98), LL(0xa4aaa4490e55eda4), + LL(0x28a0285d88507528), LL(0x5c6d5cda31b8865c), LL(0xf8c7f8933fed6bf8), LL(0x86228644a411c286), +}; + +static const u64 rc[R + 1] = { + LL(0x0000000000000000), + LL(0x1823c6e887b8014f), + LL(0x36a6d2f5796f9152), + LL(0x60bc9b8ea30c7b35), + LL(0x1de0d7c22e4bfe57), + LL(0x157737e59ff04ada), + LL(0x58c9290ab1a06b85), + LL(0xbd5d10f4cb3e0567), + LL(0xe427418ba77d95d8), + LL(0xfbee7c66dd17479e), + LL(0xca2dbf07ad5a8333), +}; + +/** + * The core Whirlpool transform. + */ +static void processBuffer(struct NESSIEstruct * const structpointer) { + int i, r; + u64 K[8]; /* the round key */ + u64 block[8]; /* mu(buffer) */ + u64 state[8]; /* the cipher state */ + u64 L[8]; + u8 *buffer = structpointer->buffer; + /* + * map the buffer to a block: + */ + for (i = 0; i < 8; i++, buffer += 8) { + block[i] = + (((u64)buffer[0] ) << 56) ^ + (((u64)buffer[1] & 0xffL) << 48) ^ + (((u64)buffer[2] & 0xffL) << 40) ^ + (((u64)buffer[3] & 0xffL) << 32) ^ + (((u64)buffer[4] & 0xffL) << 24) ^ + (((u64)buffer[5] & 0xffL) << 16) ^ + (((u64)buffer[6] & 0xffL) << 8) ^ + (((u64)buffer[7] & 0xffL) ); + } + /* + * compute and apply K^0 to the cipher state: + */ + state[0] = block[0] ^ (K[0] = structpointer->hash[0]); + state[1] = block[1] ^ (K[1] = structpointer->hash[1]); + state[2] = block[2] ^ (K[2] = structpointer->hash[2]); + state[3] = block[3] ^ (K[3] = structpointer->hash[3]); + state[4] = block[4] ^ (K[4] = structpointer->hash[4]); + state[5] = block[5] ^ (K[5] = structpointer->hash[5]); + state[6] = block[6] ^ (K[6] = structpointer->hash[6]); + state[7] = block[7] ^ (K[7] = structpointer->hash[7]); + /* + * iterate over all rounds: + */ + for (r = 1; r <= R; r++) { + /* + * compute K^r from K^{r-1}: + */ + L[0] = + C0[(int)(K[0] >> 56) ] ^ + C1[(int)(K[7] >> 48) & 0xff] ^ + C2[(int)(K[6] >> 40) & 0xff] ^ + C3[(int)(K[5] >> 32) & 0xff] ^ + C4[(int)(K[4] >> 24) & 0xff] ^ + C5[(int)(K[3] >> 16) & 0xff] ^ + C6[(int)(K[2] >> 8) & 0xff] ^ + C7[(int)(K[1] ) & 0xff] ^ + rc[r]; + L[1] = + C0[(int)(K[1] >> 56) ] ^ + C1[(int)(K[0] >> 48) & 0xff] ^ + C2[(int)(K[7] >> 40) & 0xff] ^ + C3[(int)(K[6] >> 32) & 0xff] ^ + C4[(int)(K[5] >> 24) & 0xff] ^ + C5[(int)(K[4] >> 16) & 0xff] ^ + C6[(int)(K[3] >> 8) & 0xff] ^ + C7[(int)(K[2] ) & 0xff]; + L[2] = + C0[(int)(K[2] >> 56) ] ^ + C1[(int)(K[1] >> 48) & 0xff] ^ + C2[(int)(K[0] >> 40) & 0xff] ^ + C3[(int)(K[7] >> 32) & 0xff] ^ + C4[(int)(K[6] >> 24) & 0xff] ^ + C5[(int)(K[5] >> 16) & 0xff] ^ + C6[(int)(K[4] >> 8) & 0xff] ^ + C7[(int)(K[3] ) & 0xff]; + L[3] = + C0[(int)(K[3] >> 56) ] ^ + C1[(int)(K[2] >> 48) & 0xff] ^ + C2[(int)(K[1] >> 40) & 0xff] ^ + C3[(int)(K[0] >> 32) & 0xff] ^ + C4[(int)(K[7] >> 24) & 0xff] ^ + C5[(int)(K[6] >> 16) & 0xff] ^ + C6[(int)(K[5] >> 8) & 0xff] ^ + C7[(int)(K[4] ) & 0xff]; + L[4] = + C0[(int)(K[4] >> 56) ] ^ + C1[(int)(K[3] >> 48) & 0xff] ^ + C2[(int)(K[2] >> 40) & 0xff] ^ + C3[(int)(K[1] >> 32) & 0xff] ^ + C4[(int)(K[0] >> 24) & 0xff] ^ + C5[(int)(K[7] >> 16) & 0xff] ^ + C6[(int)(K[6] >> 8) & 0xff] ^ + C7[(int)(K[5] ) & 0xff]; + L[5] = + C0[(int)(K[5] >> 56) ] ^ + C1[(int)(K[4] >> 48) & 0xff] ^ + C2[(int)(K[3] >> 40) & 0xff] ^ + C3[(int)(K[2] >> 32) & 0xff] ^ + C4[(int)(K[1] >> 24) & 0xff] ^ + C5[(int)(K[0] >> 16) & 0xff] ^ + C6[(int)(K[7] >> 8) & 0xff] ^ + C7[(int)(K[6] ) & 0xff]; + L[6] = + C0[(int)(K[6] >> 56) ] ^ + C1[(int)(K[5] >> 48) & 0xff] ^ + C2[(int)(K[4] >> 40) & 0xff] ^ + C3[(int)(K[3] >> 32) & 0xff] ^ + C4[(int)(K[2] >> 24) & 0xff] ^ + C5[(int)(K[1] >> 16) & 0xff] ^ + C6[(int)(K[0] >> 8) & 0xff] ^ + C7[(int)(K[7] ) & 0xff]; + L[7] = + C0[(int)(K[7] >> 56) ] ^ + C1[(int)(K[6] >> 48) & 0xff] ^ + C2[(int)(K[5] >> 40) & 0xff] ^ + C3[(int)(K[4] >> 32) & 0xff] ^ + C4[(int)(K[3] >> 24) & 0xff] ^ + C5[(int)(K[2] >> 16) & 0xff] ^ + C6[(int)(K[1] >> 8) & 0xff] ^ + C7[(int)(K[0] ) & 0xff]; + K[0] = L[0]; + K[1] = L[1]; + K[2] = L[2]; + K[3] = L[3]; + K[4] = L[4]; + K[5] = L[5]; + K[6] = L[6]; + K[7] = L[7]; + /* + * apply the r-th round transformation: + */ + L[0] = + C0[(int)(state[0] >> 56) ] ^ + C1[(int)(state[7] >> 48) & 0xff] ^ + C2[(int)(state[6] >> 40) & 0xff] ^ + C3[(int)(state[5] >> 32) & 0xff] ^ + C4[(int)(state[4] >> 24) & 0xff] ^ + C5[(int)(state[3] >> 16) & 0xff] ^ + C6[(int)(state[2] >> 8) & 0xff] ^ + C7[(int)(state[1] ) & 0xff] ^ + K[0]; + L[1] = + C0[(int)(state[1] >> 56) ] ^ + C1[(int)(state[0] >> 48) & 0xff] ^ + C2[(int)(state[7] >> 40) & 0xff] ^ + C3[(int)(state[6] >> 32) & 0xff] ^ + C4[(int)(state[5] >> 24) & 0xff] ^ + C5[(int)(state[4] >> 16) & 0xff] ^ + C6[(int)(state[3] >> 8) & 0xff] ^ + C7[(int)(state[2] ) & 0xff] ^ + K[1]; + L[2] = + C0[(int)(state[2] >> 56) ] ^ + C1[(int)(state[1] >> 48) & 0xff] ^ + C2[(int)(state[0] >> 40) & 0xff] ^ + C3[(int)(state[7] >> 32) & 0xff] ^ + C4[(int)(state[6] >> 24) & 0xff] ^ + C5[(int)(state[5] >> 16) & 0xff] ^ + C6[(int)(state[4] >> 8) & 0xff] ^ + C7[(int)(state[3] ) & 0xff] ^ + K[2]; + L[3] = + C0[(int)(state[3] >> 56) ] ^ + C1[(int)(state[2] >> 48) & 0xff] ^ + C2[(int)(state[1] >> 40) & 0xff] ^ + C3[(int)(state[0] >> 32) & 0xff] ^ + C4[(int)(state[7] >> 24) & 0xff] ^ + C5[(int)(state[6] >> 16) & 0xff] ^ + C6[(int)(state[5] >> 8) & 0xff] ^ + C7[(int)(state[4] ) & 0xff] ^ + K[3]; + L[4] = + C0[(int)(state[4] >> 56) ] ^ + C1[(int)(state[3] >> 48) & 0xff] ^ + C2[(int)(state[2] >> 40) & 0xff] ^ + C3[(int)(state[1] >> 32) & 0xff] ^ + C4[(int)(state[0] >> 24) & 0xff] ^ + C5[(int)(state[7] >> 16) & 0xff] ^ + C6[(int)(state[6] >> 8) & 0xff] ^ + C7[(int)(state[5] ) & 0xff] ^ + K[4]; + L[5] = + C0[(int)(state[5] >> 56) ] ^ + C1[(int)(state[4] >> 48) & 0xff] ^ + C2[(int)(state[3] >> 40) & 0xff] ^ + C3[(int)(state[2] >> 32) & 0xff] ^ + C4[(int)(state[1] >> 24) & 0xff] ^ + C5[(int)(state[0] >> 16) & 0xff] ^ + C6[(int)(state[7] >> 8) & 0xff] ^ + C7[(int)(state[6] ) & 0xff] ^ + K[5]; + L[6] = + C0[(int)(state[6] >> 56) ] ^ + C1[(int)(state[5] >> 48) & 0xff] ^ + C2[(int)(state[4] >> 40) & 0xff] ^ + C3[(int)(state[3] >> 32) & 0xff] ^ + C4[(int)(state[2] >> 24) & 0xff] ^ + C5[(int)(state[1] >> 16) & 0xff] ^ + C6[(int)(state[0] >> 8) & 0xff] ^ + C7[(int)(state[7] ) & 0xff] ^ + K[6]; + L[7] = + C0[(int)(state[7] >> 56) ] ^ + C1[(int)(state[6] >> 48) & 0xff] ^ + C2[(int)(state[5] >> 40) & 0xff] ^ + C3[(int)(state[4] >> 32) & 0xff] ^ + C4[(int)(state[3] >> 24) & 0xff] ^ + C5[(int)(state[2] >> 16) & 0xff] ^ + C6[(int)(state[1] >> 8) & 0xff] ^ + C7[(int)(state[0] ) & 0xff] ^ + K[7]; + state[0] = L[0]; + state[1] = L[1]; + state[2] = L[2]; + state[3] = L[3]; + state[4] = L[4]; + state[5] = L[5]; + state[6] = L[6]; + state[7] = L[7]; + } + /* + * apply the Miyaguchi-Preneel compression function: + */ + structpointer->hash[0] ^= state[0] ^ block[0]; + structpointer->hash[1] ^= state[1] ^ block[1]; + structpointer->hash[2] ^= state[2] ^ block[2]; + structpointer->hash[3] ^= state[3] ^ block[3]; + structpointer->hash[4] ^= state[4] ^ block[4]; + structpointer->hash[5] ^= state[5] ^ block[5]; + structpointer->hash[6] ^= state[6] ^ block[6]; + structpointer->hash[7] ^= state[7] ^ block[7]; +} + +/** + * Initialize the hashing state. + */ +void WHIRLPOOL_init(struct NESSIEstruct * const structpointer) { + int i; + + memset(structpointer->bitLength, 0, 32); + structpointer->bufferBits = structpointer->bufferPos = 0; + structpointer->buffer[0] = 0; /* it's only necessary to cleanup buffer[bufferPos] */ + for (i = 0; i < 8; i++) { + structpointer->hash[i] = 0L; /* initial value */ + } +} + +/** + * Delivers input data to the hashing algorithm. + * + * @param source plaintext data to hash. + * @param sourceBits how many bits of plaintext to process. + * + * This method maintains the invariant: bufferBits < DIGESTBITS + */ +void WHIRLPOOL_add(const unsigned char * const source, + uint32_t sourceBits, + struct NESSIEstruct * const structpointer) { + /* + sourcePos + | + +-------+-------+------- + ||||||||||||||||||||| source + +-------+-------+------- + +-------+-------+-------+-------+-------+------- + |||||||||||||||||||||| buffer + +-------+-------+-------+-------+-------+------- + | + bufferPos + */ + int sourcePos = 0; /* index of leftmost source u8 containing data (1 to 8 bits). */ + int sourceGap = (8 - ((int)sourceBits & 7)) & 7; /* space on source[sourcePos]. */ + int bufferRem = structpointer->bufferBits & 7; /* occupied bits on buffer[bufferPos]. */ + int i; + u32 b, carry; + u8 *buffer = structpointer->buffer; + u8 *bitLength = structpointer->bitLength; + int bufferBits = structpointer->bufferBits; + int bufferPos = structpointer->bufferPos; + + /* + * tally the length of the added data: + */ + u64 value = sourceBits; + for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != LL(0)); i--) { + carry += bitLength[i] + ((u32)value & 0xff); + bitLength[i] = (u8)carry; + carry >>= 8; + value >>= 8; + } + /* + * process data in chunks of 8 bits (a more efficient approach would be to take whole-word chunks): + */ + while (sourceBits > 8) { + /* N.B. at least source[sourcePos] and source[sourcePos+1] contain data. */ + /* + * take a byte from the source: + */ + b = ((source[sourcePos] << sourceGap) & 0xff) | + ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); + /* + * process this byte: + */ + buffer[bufferPos++] |= (u8)(b >> bufferRem); + bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ + if (bufferBits == DIGESTBITS) { + /* + * process data block: + */ + processBuffer(structpointer); + /* + * reset buffer: + */ + bufferBits = bufferPos = 0; + } + buffer[bufferPos] = (u8) (b << (8 - bufferRem)); + bufferBits += bufferRem; + /* + * proceed to remaining data: + */ + sourceBits -= 8; + sourcePos++; + } + /* now 0 <= sourceBits <= 8; + * furthermore, all data (if any is left) is in source[sourcePos]. + */ + if (sourceBits > 0) { + b = (source[sourcePos] << sourceGap) & 0xff; /* bits are left-justified on b. */ + /* + * process the remaining bits: + */ + buffer[bufferPos] |= b >> bufferRem; + } else { + b = 0; + } + if (bufferRem + sourceBits < 8) { + /* + * all remaining data fits on buffer[bufferPos], + * and there still remains some space. + */ + bufferBits += sourceBits; + } else { + /* + * buffer[bufferPos] is full: + */ + bufferPos++; + bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ + sourceBits -= 8 - bufferRem; + /* now 0 <= sourceBits < 8; + * furthermore, all data (if any is left) is in source[sourcePos]. + */ + if (bufferBits == DIGESTBITS) { + /* + * process data block: + */ + processBuffer(structpointer); + /* + * reset buffer: + */ + bufferBits = bufferPos = 0; + } + buffer[bufferPos] = (u8) (b << (8 - bufferRem)); + bufferBits += (int)sourceBits; + } + structpointer->bufferBits = bufferBits; + structpointer->bufferPos = bufferPos; +} + +/** + * Get the hash value from the hashing state. + * + * This method uses the invariant: bufferBits < DIGESTBITS + */ +void WHIRLPOOL_finalize(struct NESSIEstruct * const structpointer, + unsigned char * const result) { + int i; + u8 *buffer = structpointer->buffer; + u8 *bitLength = structpointer->bitLength; + int bufferBits = structpointer->bufferBits; + int bufferPos = structpointer->bufferPos; + u8 *digest = result; + + /* + * append a '1'-bit: + */ + buffer[bufferPos] |= 0x80U >> (bufferBits & 7); + bufferPos++; /* all remaining bits on the current u8 are set to zero. */ + /* + * pad with zero bits to complete (N*WBLOCKBITS - LENGTHBITS) bits: + */ + if (bufferPos > WBLOCKBYTES - LENGTHBYTES) { + if (bufferPos < WBLOCKBYTES) { + memset(&buffer[bufferPos], 0, WBLOCKBYTES - bufferPos); + } + /* + * process data block: + */ + processBuffer(structpointer); + /* + * reset buffer: + */ + bufferPos = 0; + } + if (bufferPos < WBLOCKBYTES - LENGTHBYTES) { + memset(&buffer[bufferPos], 0, (WBLOCKBYTES - LENGTHBYTES) - bufferPos); + } + bufferPos = WBLOCKBYTES - LENGTHBYTES; + /* + * append bit length of hashed data: + */ + memcpy(&buffer[WBLOCKBYTES - LENGTHBYTES], bitLength, LENGTHBYTES); + /* + * process data block: + */ + processBuffer(structpointer); + /* + * return the completed message digest: + */ + for (i = 0; i < DIGESTBYTES/8; i++) { + digest[0] = (u8)(structpointer->hash[i] >> 56); + digest[1] = (u8)(structpointer->hash[i] >> 48); + digest[2] = (u8)(structpointer->hash[i] >> 40); + digest[3] = (u8)(structpointer->hash[i] >> 32); + digest[4] = (u8)(structpointer->hash[i] >> 24); + digest[5] = (u8)(structpointer->hash[i] >> 16); + digest[6] = (u8)(structpointer->hash[i] >> 8); + digest[7] = (u8)(structpointer->hash[i] ); + digest += 8; + } + structpointer->bufferBits = bufferBits; + structpointer->bufferPos = bufferPos; +} diff --git a/src/utils/crypto/whirlpool.h b/src/utils/crypto/whirlpool.h new file mode 100644 index 00000000000..3a88006de87 --- /dev/null +++ b/src/utils/crypto/whirlpool.h @@ -0,0 +1,150 @@ +#ifndef WHIRLPOOL_H +#define WHIRLPOOL_H 1 + +#if defined(__cplusplus) +extern "C" +{ +#endif + +#ifndef PORTABLE_C__ +#define PORTABLE_C__ + +#include +#include + +/* Definition of minimum-width integer types + * + * u8 -> unsigned integer type, at least 8 bits, equivalent to unsigned char + * u16 -> unsigned integer type, at least 16 bits + * u32 -> unsigned integer type, at least 32 bits + * + * s8, s16, s32 -> signed counterparts of u8, u16, u32 + * + * Always use macro's T8(), T16() or T32() to obtain exact-width results, + * i.e., to specify the size of the result of each expression. + */ + +typedef int8_t s8; +typedef uint8_t u8; + +#if UINT_MAX >= 4294967295UL + +typedef int16_t s16; +typedef int32_t s32; +typedef uint16_t u16; +typedef uint32_t u32; + +#define ONE32 0xffffffffU + +#else + +typedef int16_t s16; +typedef int32_t s32; +typedef uint16_t u16; +typedef uint32_t u32; + +#define ONE32 0xffffffffUL + +#endif + +#define ONE8 0xffU +#define ONE16 0xffffU + +#define T8(x) ((x) & ONE8) +#define T16(x) ((x) & ONE16) +#define T32(x) ((x) & ONE32) + +#ifdef _MSC_VER +typedef uint64_t u64; +typedef int64_t s64; +#define LL(v) (v##i64) +#define ONE64 LL(0xffffffffffffffff) +#else /* !_MSC_VER */ +typedef uint64_t u64; +typedef int64_t s64; +#define LL(v) (v##ULL) +#define ONE64 LL(0xffffffffffffffff) +#endif /* ?_MSC_VER */ +#define T64(x) ((x) & ONE64) +#define ROTR64(v, n) (((v) >> (n)) | T64((v) << (64 - (n)))) +/* + * Note: the test is used to detect native 64-bit architectures; + * if the unsigned long is strictly greater than 32-bit, it is + * assumed to be at least 64-bit. This will not work correctly + * on (old) 36-bit architectures (PDP-11 for instance). + * + * On non-64-bit architectures, "long long" is used. + */ + +/* + * U8TO32_BIG(c) returns the 32-bit value stored in big-endian convention + * in the unsigned char array pointed to by c. + */ +#define U8TO32_BIG(c) (((u32)T8(*(c)) << 24) | ((u32)T8(*((c) + 1)) << 16) | ((u32)T8(*((c) + 2)) << 8) | ((u32)T8(*((c) + 3)))) + +/* + * U8TO32_LITTLE(c) returns the 32-bit value stored in little-endian convention + * in the unsigned char array pointed to by c. + */ +#define U8TO32_LITTLE(c) (((u32)T8(*(c))) | ((u32)T8(*((c) + 1)) << 8) | (u32)T8(*((c) + 2)) << 16) | ((u32)T8(*((c) + 3)) << 24)) + +/* + * U8TO32_BIG(c, v) stores the 32-bit-value v in big-endian convention + * into the unsigned char array pointed to by c. + */ +#define U32TO8_BIG(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x >> 24); d[1] = T8(x >> 16); d[2] = T8(x >> 8); d[3] = T8(x); } while (0) + +/* + * U8TO32_LITTLE(c, v) stores the 32-bit-value v in little-endian convention + * into the unsigned char array pointed to by c. + */ +#define U32TO8_LITTLE(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x); d[1] = T8(x >> 8); d[2] = T8(x >> 16); d[3] = T8(x >> 24); } while (0) + +/* + * ROTL32(v, n) returns the value of the 32-bit unsigned value v after + * a rotation of n bits to the left. It might be replaced by the appropriate + * architecture-specific macro. + * + * It evaluates v and n twice. + * + * The compiler might emit a warning if n is the constant 0. The result + * is undefined if n is greater than 31. + */ +#define ROTL32(v, n) (T32((v) << (n)) | ((v) >> (32 - (n)))) + +/* + * Whirlpool-specific definitions. + */ + +#define DIGESTBYTES 64 +#define DIGESTBITS (8*DIGESTBYTES) /* 512 */ + +#define WBLOCKBYTES 64 +#define WBLOCKBITS (8*WBLOCKBYTES) /* 512 */ + +#define LENGTHBYTES 32 +#define LENGTHBITS (8*LENGTHBYTES) /* 256 */ + +typedef struct NESSIEstruct { + u8 bitLength[LENGTHBYTES]; /* global number of hashed bits (256-bit counter) */ + u8 buffer[WBLOCKBYTES]; /* buffer of data to hash */ + int bufferBits; /* current number of bits on the buffer */ + int bufferPos; /* current (possibly incomplete) byte slot on the buffer */ + u64 hash[DIGESTBYTES/8]; /* the hashing state */ +} NESSIEstruct; + +#endif /* PORTABLE_C__ */ + +// ------------- + +typedef NESSIEstruct WHIRLPOOL_CTX; + +void WHIRLPOOL_add(const uint8_t * const source, uint32_t sourceBits, struct NESSIEstruct * const structpointer); +void WHIRLPOOL_finalize(struct NESSIEstruct * const structpointer, uint8_t * const result); +void WHIRLPOOL_init(struct NESSIEstruct * const structpointer); + +#if defined(__cplusplus) +} +#endif + +#endif /* WHIRLPOOL_H */ diff --git a/src/utils/decode.c b/src/utils/decode.c new file mode 100644 index 00000000000..8221428ba6c --- /dev/null +++ b/src/utils/decode.c @@ -0,0 +1,462 @@ +#include "mds.h" +#include "edc.h" + + +#include "common/tcdefs.h" +#include "common/crypto.h" +#include "common/endian.h" +#include "common/pkcs5.h" +#include "common/crc.h" + +#include + + + +void unshuffle1(u8 *data) +{ + u32 val = getEDC(data, 0x40) ^ 0x567372ff; + for(int i = 0; i < 0x40; i += 4) + { + val = (val * 0x35e85a6d) + 0x1548dce9; + u32 ud = getU32(data + i); + setU32(data + i, ud ^ val ^ 0xec564717); + + if (data[i] == 0) + data[i] = 0x5f; + if (data[i+1] == 0) + data[i+1] = 0x5f; + if (data[i+2] == 0) + data[i+2] = 0x5f; + if (data[i+3] == 0) + data[i+3] = 0x5f; + } +} + +void DecryptBlock(u8 *buf, + TC_LARGEST_COMPILER_UINT len, + u32 secSz, + u64 secN, + u8 flags, + PCRYPTO_INFO cryptoInfo) +{ + const int blockSize = CipherGetBlockSize( EAGetFirstCipher(cryptoInfo->ea) ); + + u64 blk = 0x200; + if (blockSize <= secSz) + blk = secSz; + + const u64 asz = blk - (blk % blockSize); + if ((flags & 4) == 0) + { + const u32 c = len / blk; + for (int i = 0; i < c; i++) + { + DecryptBuffer(buf + i * blk, asz, asz, secN + i, flags, cryptoInfo); + } + } + else + { + u32 adsz = len - (len % blockSize); + u64 pos = 0; + int i = 0; + while(adsz > 0) + { + u32 bsz = asz; + if (adsz <= asz) + bsz = adsz; + + DecryptBuffer(buf + pos, bsz, adsz, secN + i, flags, cryptoInfo); + + pos += bsz; + adsz -= bsz; + i++; + } + } +} + + + +// From volumes.c + modifies + +#define HEADER_OFFSET_CRC 64 +#define HEADER_OFFSET_MAGIC 68 +#define HEADER_OFFSET_DATA 80 +#define HEADER_DATA_SIZE 0x100 +#define HEADER_OFFSET_DATASZ 74 + + +uint16 GetHeaderField16 (byte *header, size_t offset) +{ + /* modify BE->LE */ + return LE16 (*(uint16 *) (header + offset)); +} + + +uint32 GetHeaderField32 (byte *header, size_t offset) +{ + /* modify BE->LE */ + return LE32 (*(uint32 *) (header + offset)); +} + + +UINT64_STRUCT GetHeaderField64 (byte *header, size_t offset) +{ + /* modify BE->LE */ + UINT64_STRUCT uint64Struct; + +#ifndef TC_NO_COMPILER_INT64 + uint64Struct.Value = LE64 (*(uint64 *) (header + offset)); +#else + uint64Struct.HighPart = LE32 (*(uint32 *) (header + offset)); + uint64Struct.LowPart = LE32 (*(uint32 *) (header + offset + 4)); +#endif + return uint64Struct; +} + + +int ReadHeader (int bBoot, char *encryptedHeader, Password *password, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo) +{ + char header[HEADER_SIZE]; + KEY_INFO keyInfo; + PCRYPTO_INFO cryptoInfo; + char dk[MASTER_KEYDATA_SIZE]; + int pkcs5_prf; + int status; + int primaryKeyOffset; + + + if (retHeaderCryptoInfo != NULL) + { + cryptoInfo = retHeaderCryptoInfo; + } + else + { + cryptoInfo = *retInfo = crypto_open (); + if (cryptoInfo == NULL) + return ERR_OUTOFMEMORY; + } + + crypto_loadkey (&keyInfo, (char *) password->Text, (int) password->Length); + + // PKCS5 is used to derive the primary header key(s) and secondary header key(s) (XTS mode) from the password + memcpy (keyInfo.salt, encryptedHeader + HEADER_SALT_OFFSET, PKCS5_SALT_SIZE); + + memset(dk, 0, sizeof(dk)); + + // Use this legacy incorrect(for XTS) size, because Daemon Tools use it in this way + // seems DTools manual upgrade their pre-TrueCrypt5.0 sources + int keysize = EAGetLargestKey() + LEGACY_VOL_IV_SIZE; + + // Test only rp160/sha1/whirlpool only + for (pkcs5_prf = FIRST_PRF_ID; pkcs5_prf <= WHIRLPOOL; pkcs5_prf++) + { + int lrw64InitDone = 0; // Deprecated/legacy + int lrw128InitDone = 0; // Deprecated/legacy + + keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, bBoot); + + switch (pkcs5_prf) + { + case RIPEMD160: + derive_key_ripemd160 ((char *) keyInfo.userKey, keyInfo.keyLength, (char *) keyInfo.salt, + PKCS5_SALT_SIZE, keyInfo.noIterations, dk, keysize); + break; + + case SHA1: + // Deprecated/legacy + derive_key_sha1 ((char *) keyInfo.userKey, keyInfo.keyLength, (char *) keyInfo.salt, + PKCS5_SALT_SIZE, keyInfo.noIterations, dk, keysize); + break; + + case WHIRLPOOL: + derive_key_whirlpool ((char *) keyInfo.userKey, keyInfo.keyLength, (char *) keyInfo.salt, + PKCS5_SALT_SIZE, keyInfo.noIterations, dk, keysize); + break; + + default: + // Unknown/wrong ID + TC_THROW_FATAL_EXCEPTION; + } + + // Test all available modes of operation + for (cryptoInfo->mode = FIRST_MODE_OF_OPERATION_ID; + cryptoInfo->mode <= LAST_MODE_OF_OPERATION; + cryptoInfo->mode++) + { + switch (cryptoInfo->mode) + { + case LRW: + case CBC: + case INNER_CBC: + case OUTER_CBC: + + // For LRW (deprecated/legacy), copy the tweak key + // For CBC (deprecated/legacy), copy the IV/whitening seed + memcpy (cryptoInfo->k2, dk, LEGACY_VOL_IV_SIZE); + primaryKeyOffset = LEGACY_VOL_IV_SIZE; + break; + + default: + primaryKeyOffset = 0; + } + + // Test all available encryption algorithms + for (cryptoInfo->ea = EAGetFirst (); + cryptoInfo->ea != 0; + cryptoInfo->ea = EAGetNext (cryptoInfo->ea)) + { + int blockSize; + + if (!EAIsModeSupported (cryptoInfo->ea, cryptoInfo->mode)) + continue; // This encryption algorithm has never been available with this mode of operation + + blockSize = CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea)); + + status = EAInit (cryptoInfo->ea, (unsigned char *) (dk + primaryKeyOffset), cryptoInfo->ks); + if (status == ERR_CIPHER_INIT_FAILURE) + goto err; + + // Init objects related to the mode of operation + + if (cryptoInfo->mode == XTS) + { + // Copy the secondary key (if cascade, multiple concatenated) + memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea)); + + // Secondary key schedule + if (!EAInitMode (cryptoInfo)) + { + status = ERR_MODE_INIT_FAILED; + goto err; + } + } + else if (cryptoInfo->mode == LRW + && ((blockSize == 8 && !lrw64InitDone) || (blockSize == 16 && !lrw128InitDone))) + { + // Deprecated/legacy + + if (!EAInitMode (cryptoInfo)) + { + status = ERR_MODE_INIT_FAILED; + goto err; + } + + if (blockSize == 8) + lrw64InitDone = 1; + else if (blockSize == 16) + lrw128InitDone = 1; + } + + // Copy the header for decryption + memcpy (header, encryptedHeader, HEADER_SIZE); + + // Try to decrypt header + DecryptBlock((unsigned char *) (header + HEADER_ENCRYPTED_DATA_OFFSET), HEADER_ENCRYPTED_DATA_SIZE, HEADER_SIZE, 0, 4, cryptoInfo); + + // Magic 'TRUE' + if (GetHeaderField32 ((unsigned char *) header, HEADER_OFFSET_MAGIC) != 0x54525545) + continue; + + uint32_t crc = GetHeaderField32 ((unsigned char *) header, HEADER_OFFSET_CRC); + if (crc != GetCrc32 ((unsigned char *) ((unsigned char *) (header + HEADER_OFFSET_DATA)), HEADER_DATA_SIZE) ) + continue; + + if ( GetHeaderField16((unsigned char *) header, HEADER_OFFSET_DATASZ) > 0x100 ) + continue; + + + memcpy(dk, header + HEADER_OFFSET_DATA, HEADER_DATA_SIZE); + + memcpy(encryptedHeader, header, 0x200); + + switch (cryptoInfo->mode) + { + case LRW: + case CBC: + case INNER_CBC: + case OUTER_CBC: + + // For LRW (deprecated/legacy), copy the tweak key + // For CBC (deprecated/legacy), copy the IV/whitening seed + memcpy (cryptoInfo->k2, dk, LEGACY_VOL_IV_SIZE); + primaryKeyOffset = LEGACY_VOL_IV_SIZE; + break; + + default: + primaryKeyOffset = 0; + } + + if (EAInit (cryptoInfo->ea, (unsigned char *) (dk + primaryKeyOffset), cryptoInfo->ks) != 0 ) + { + status = ERR_MODE_INIT_FAILED; + goto err; + } + + if (cryptoInfo->mode == XTS) + memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea)); + + if (!EAInitMode (cryptoInfo)) + { + status = ERR_MODE_INIT_FAILED; + goto err; + } + + // Clear out the temporary key buffers +// ret: + burn (dk, sizeof(dk)); + burn (&keyInfo, sizeof (keyInfo)); + + return 0; + } + } + } + status = ERR_PASSWORD_WRONG; + +err: + if (cryptoInfo != retHeaderCryptoInfo) + { + crypto_close(cryptoInfo); + *retInfo = NULL; + } + + burn (&keyInfo, sizeof (keyInfo)); + burn (dk, sizeof(dk)); + return status; +} + + + +int decode1(u8 *data, const char *pass, PCRYPTO_INFO *ci) +{ + u32 passlen = 0; + u8 unsh[0x101]; + memset(unsh, 0, 0x101); + if (!pass) + { + memcpy(unsh, data, 0x40); + unshuffle1(unsh); + passlen = 0x40; + } + else + { + passlen = strlen(pass); + if (passlen > 0x40) + passlen = 0x40; + memcpy(unsh, pass, passlen); + } + + Password pwd; + pwd.Length = passlen; + memcpy(pwd.Text, unsh, passlen); + + return ReadHeader(0, (char *) data, &pwd, ci, NULL); +} + + + +void decryptMode2(Decoder *ctx, u8 *buffer, u32 length, u64 blockIndex) +{ + u8 *p = buffer; + u8 i[8]; + u8 t[16]; + u64 b; + + *(u64 *)i = BE64(blockIndex); + + for (b = 0; b < length >> 4; b++) + { + Gf128MulBy64Tab (i, t, &ctx->gf_ctx); + Xor128 ((u64 *)p, (u64 *)t); + + aes_decrypt (p, p, &ctx->decr); + + Xor128 ((u64 *)p, (u64 *)t); + + p += 16; + + if (i[7] != 0xff) + i[7]++; + else + *(u64 *)i = BE64 ( BE64(*(u64 *)i) + 1 ); + } +} + + +void MdxDecryptBufferCBC (Decoder *ctx, u32 *data, unsigned int len, u32 *iv, u32 *whitening) +{ + u32 bufIV[4]; + u64 i; + u32 ct[4]; + + // IV + bufIV[0] = iv[0]; + bufIV[1] = iv[1]; + bufIV[2] = iv[2]; + bufIV[3] = iv[3]; + + // Decrypt each block + for (i = 0; i < len/16; i++) + { + // Dewhitening + if (whitening) + { + data[0] ^= whitening[0]; + data[1] ^= whitening[1]; + data[2] ^= whitening[0]; + data[3] ^= whitening[1]; + + //CBC + ct[0] = data[0]; + ct[1] = data[1]; + ct[2] = data[2]; + ct[3] = data[3]; + } + + aes_decrypt((u8 *)data, (u8 *)data, &ctx->decr); + + // CBC + data[0] ^= bufIV[0]; + data[1] ^= bufIV[1]; + data[2] ^= bufIV[2]; + data[3] ^= bufIV[3]; + + if (whitening) + { + bufIV[0] = ct[0]; + bufIV[1] = ct[1]; + bufIV[2] = ct[2]; + bufIV[3] = ct[3]; + } + + data += 4; + } +} + +void decryptMdxData(Decoder *ctx, u8 *buffer, u32 length, u64 blockSize, u64 blockIndex) +{ + if (ctx->mode == 1) + { + if (ctx->ctr) + { + u32 sectorIV[4]; + u32 secWhitening[4]; + InitSectorIVAndWhitening (blockIndex, 16, sectorIV, (u64 *)(ctx->dg + 16), secWhitening); + MdxDecryptBufferCBC (ctx, (u32 *)buffer, length, sectorIV, secWhitening); + } + else + { + MdxDecryptBufferCBC (ctx, (u32 *)buffer, length, (u32 *)ctx->dg, (u32 *)(ctx->dg + 8)); + } + } + else if (ctx->mode == 2) + { + if (ctx->ctr) + decryptMode2(ctx, buffer, length, 1 + (blockSize / 16) * blockIndex); + else + decryptMode2(ctx, buffer, length, 1); + } + else + { + MdxDecryptBufferCBC (ctx, (u32 *)buffer, length, (u32 *)ctx->dg, NULL); + } +} diff --git a/src/utils/defines.h b/src/utils/defines.h new file mode 100644 index 00000000000..fb8f5c79cd1 --- /dev/null +++ b/src/utils/defines.h @@ -0,0 +1,13 @@ +#ifndef DEFINES_H +#define DEFINES_H + +#include + +typedef uint64_t u64; +typedef int64_t s64; +typedef uint32_t u32; +typedef int32_t s32; +typedef uint8_t u8; +typedef int BOOL; + +#endif diff --git a/src/utils/edc.c b/src/utils/edc.c new file mode 100644 index 00000000000..c21ef9e22cb --- /dev/null +++ b/src/utils/edc.c @@ -0,0 +1,78 @@ +#include "defines.h" + +u32 EDC_crctable[256] = { + 0x0, 0x90910101, 0x91210201, 0x1B00300, +0x92410401, 0x2D00500, 0x3600600, 0x93F10701, +0x94810801, 0x4100900, 0x5A00A00, 0x95310B01, +0x6C00C00, 0x96510D01, 0x97E10E01, 0x7700F00, +0x99011001, 0x9901100, 0x8201200, 0x98B11301, +0xB401400, 0x9BD11501, 0x9A611601, 0xAF01700, +0xD801800, 0x9D111901, 0x9CA11A01, 0xC301B00, +0x9FC11C01, 0xF501D00, 0xEE01E00, 0x9E711F01, +0x82012001, 0x12902100, 0x13202200, 0x83B12301, +0x10402400, 0x80D12501, 0x81612601, 0x11F02700, +0x16802800, 0x86112901, 0x87A12A01, 0x17302B00, +0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01, +0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300, +0x89413401, 0x19D03500, 0x18603600, 0x88F13701, +0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01, +0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00, +0xB4014001, 0x24904100, 0x25204200, 0xB5B14301, +0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700, +0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00, +0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01, +0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300, +0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701, +0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01, +0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00, +0x36006000, 0xA6916101, 0xA7216201, 0x37B06300, +0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701, +0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01, +0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00, +0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301, +0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700, +0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00, +0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01, +0xD8018001, 0x48908100, 0x49208200, 0xD9B18301, +0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700, +0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00, +0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01, +0x41009000, 0xD1919101, 0xD0219201, 0x40B09300, +0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701, +0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01, +0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00, +0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300, +0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701, +0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01, +0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00, +0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301, +0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700, +0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00, +0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01, +0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300, +0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701, +0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01, +0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00, +0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301, +0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700, +0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00, +0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01, +0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301, +0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700, +0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00, +0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01, +0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300, +0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701, +0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01, +0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00 }; + + +u32 getEDC(void *data, u32 num) +{ + u8 *d = (u8 *)data; + u32 result = 0; + for(u32 i = 0; i < num; i++) { + result = EDC_crctable[ (result ^ d[i]) & 0xff ] ^ (result >> 8); + } + return result; +} diff --git a/src/utils/edc.h b/src/utils/edc.h new file mode 100644 index 00000000000..dd6639bc80a --- /dev/null +++ b/src/utils/edc.h @@ -0,0 +1,8 @@ +#ifndef EDC_H +#define EDC_H + +#include "defines.h" + +u32 getEDC(void *data, u32 num); + +#endif diff --git a/src/utils/mds.h b/src/utils/mds.h new file mode 100644 index 00000000000..d080b0e4242 --- /dev/null +++ b/src/utils/mds.h @@ -0,0 +1,188 @@ +#ifndef MDS_H +#define MDS_H + +#include +#include +#include + +#include "defines.h" +#include "common/crypto.h" + +typedef struct Decoder_t +{ + u8 dg[32]; + GfCtx gf_ctx; + aes_encrypt_ctx encr; + aes_decrypt_ctx decr; + u8 bsize; + + int mode; + int ctr; +} Decoder; + + + +enum TRACK_TYPE +{ + TRK_T_MAINTENANCE = 0, + TRK_T_AUDIO = 1, + TRK_T_MODE1 = 2, + TRK_T_MODE2 = 3, + TRK_T_MODE2_FORM1 = 4, + TRK_T_MODE2_FORM2 = 5 +}; + +enum TRACK_FLAG +{ + TRK_F_TYPE_MASK = 7, + TRK_F_EDC = 8, + TRK_F_10 = 0x10, + TRK_F_HEADER = 0x20, + TRK_F_SUBHEADER = 0x40, + TRK_F_SYNC = 0x80 +}; + + +typedef struct __attribute__((packed)) +{ + u32 f0; + u32 f1; + u64 f3; //or two u32? +} UNK4; + +typedef struct __attribute__((packed)) +{ + char signature[16]; + u8 major; // 0x10 + u8 minor; + u16 medium_type; // 0x12 + u16 num_sessions; // 0x14 + u16 _unk1_; + u16 _unk2_size_; // 0x18 + u16 bca_len; + u16 _unk3_size_; // 0x1c + u16 _unk4_size_; // 0x1e + u32 _unk2_offset_; // 0x20 + u32 bca_data_offset; // 0x24 + u32 _unk3_offset_; // 0x28 + u32 _unk4_offset_; // 0x2c 0x10 byte elements UNK4 + u8 _unk5_; // 0x30 + u32 _unk6_; // 0x31 + u8 _unk7_; // 0x35 + u64 _unk8_; // 0x36 + u16 _unk9_; // 0x3e + u32 disc_structures_offset; // 0x40 + u32 _unk10_offset_; // 0x44 + u16 _unk10_size_; // 0x48 + u8 _dummy1_[6]; // 0x4a not used by DT + u32 sessions_blocks_offset; // 0x50 + u32 dpm_blocks_offset; // 0x54 + u32 encryption_block_offset; // 0x58 + u8 _dummy2_[4]; // 0x5c +} MDX_Header; // 0x60 + +typedef struct __attribute__((packed)) +{ + u64 session_start; + u16 session_number; // 0x8 + u8 num_all_blocks; // 0xa + u8 num_nontrack_blocks; // 0xb + u16 first_track; // 0xc + u16 last_track; // 0xe + u32 _dummy_; // 0x10 + u32 tracks_blocks_offset; // 0x14 + u64 session_end; // 0x18 +} MDX_SessionBlock; // 0x20 + +typedef struct __attribute__((packed)) +{ + u8 mode; + u8 subchannel; + u8 adr_ctl; + u8 tno; + u8 point; // 4 + u8 min; + u8 sec; + u8 frame; + u8 zero; // 8 + u8 pmin; + u8 psec; + u8 pframe; + u32 extra_offset; // 0xc + u16 file_block_size; // 0x10 original name. represent full size of data and additional data per sector + u8 _unk1_; // 0x12 + u8 _dummy1_[5]; // 0x13 + u32 _unk2_; // 0x18; + u32 _unk3_; // 0x1c; + u32 _unk4_; // 0x20; + u32 start_sector; // 0x24 + u64 start_offset; // 0x28 + u32 footer_count; // 0x30 + u32 footer_offset; // 0x34 + u64 start_sector64; // 0x38 major >= 2 + u64 track_size64; // 0x40 major >= 2 + u8 _dummy2_[8]; // 0x48 +} MDX_TrackBlock; // 0x50 + +typedef struct __attribute__((packed)) +{ + u32 filename_offset; + u8 flags; // 4 + u8 _dummy1_; // 5 + u16 _unk1_size_; // 6 + u32 _unk2_size_; // 8 + u32 blocks_in_compression_group; // c major >= 2 + u64 track_data_length; // 10 major >= 2 + u64 compress_table_offset; // 18 +} MDX_Footer; // 0x20 + + + + +// decode.c +void DecryptBlock(u8 *buf, TC_LARGEST_COMPILER_UINT len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); + +int decode1(u8 *data, const char *pass, PCRYPTO_INFO *ci); + +void decryptMdxData(Decoder *ctx, u8 *buffer, u32 length, u64 blockSize, u64 blockIndex); + + +// utils.c +inline static u64 getU64(const void *mem) +{ + const u8 *mem8 = (const u8 *)mem; + return ((u64)mem8[0] | ((u64)mem8[1] << 8) | ((u64)mem8[2] << 16) | ((u64)mem8[3] << 24) | ((u64)mem8[4] << 32) | ((u64)mem8[5] << 40) | ((u64)mem8[6] << 48) | ((u64)mem8[7] << 56)); +} + +inline static u32 getU32(const void *mem) +{ + const u8 *mem8 = (const u8 *)mem; + return ((u32)mem8[0] | ((u32)mem8[1] << 8) | ((u32)mem8[2] << 16) | ((u32)mem8[3] << 24)); +} + +inline static u16 getU16(const void *mem) +{ + const u8 *mem8 = (const u8 *)mem; + return ((u16)mem8[0] | ((u16)mem8[1] << 8)); +} + +inline static u8 getU8(const void *mem) +{ + const u8 *mem8 = (const u8 *)mem; + return (u8)mem8[0]; +} + +inline static void setU32(void *mem, u32 val) +{ + u8 *mem8 = (u8 *)mem; + mem8[0] = val & 0xff; + mem8[1] = (val >> 8) & 0xff; + mem8[2] = (val >> 16) & 0xff; + mem8[3] = (val >> 24) & 0xff; +} + +u32 freadU32(FILE *f); +u64 freadU64(FILE *f); +void printHex(void *data, int num); + +#endif diff --git a/src/utils/utils.c b/src/utils/utils.c new file mode 100644 index 00000000000..e2bc6647320 --- /dev/null +++ b/src/utils/utils.c @@ -0,0 +1,27 @@ +#include "mds.h" + +u32 freadU32(FILE *f) +{ + u8 val[4] = {0, 0, 0, 0}; + fread(val, 4, 1, f); + return getU32(val); +} + +u64 freadU64(FILE *f) +{ + u8 val[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + fread(val, 8, 1, f); + return getU64(val); +} + +void printHex(void *data, int num) +{ + u8 *m = (u8 *)data; + while(num > 0) + { + printf("%02x", *m); + m++; + num--; + } + printf("\n"); +} From 71869e028bcbad9507b441a4e85ed3e78357d304 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 05:02:14 +0100 Subject: [PATCH 307/320] Fix warnings and compilation on Linux. --- src/utils/CMakeLists.txt | 1 - src/utils/crypto/aescrypt.c | 311 ------------------------------------ src/utils/crypto/aessmall.c | 16 +- 3 files changed, 8 insertions(+), 320 deletions(-) delete mode 100644 src/utils/crypto/aescrypt.c diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 55525752bc1..2655cbe243b 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -39,7 +39,6 @@ add_library(utils OBJECT common/xts.c # Crypto - crypto/aescrypt.c crypto/aeskey.c crypto/aessmall.c crypto/aestab.c diff --git a/src/utils/crypto/aescrypt.c b/src/utils/crypto/aescrypt.c deleted file mode 100644 index 7724431dde4..00000000000 --- a/src/utils/crypto/aescrypt.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 -*/ - -#include "aesopt.h" -#include "aestab.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define si(y,x,k,c) (s(y,c) = word_in(x, c) ^ (k)[c]) -#define so(y,x,c) word_out(y, c, s(x,c)) - -#if defined(ARRAYS) -#define locals(y,x) x[4],y[4] -#else -#define locals(y,x) x##0,x##1,x##2,x##3,y##0,y##1,y##2,y##3 -#endif - -#define l_copy(y, x) s(y,0) = s(x,0); s(y,1) = s(x,1); \ - s(y,2) = s(x,2); s(y,3) = s(x,3); -#define state_in(y,x,k) si(y,x,k,0); si(y,x,k,1); si(y,x,k,2); si(y,x,k,3) -#define state_out(y,x) so(y,x,0); so(y,x,1); so(y,x,2); so(y,x,3) -#define round(rm,y,x,k) rm(y,x,k,0); rm(y,x,k,1); rm(y,x,k,2); rm(y,x,k,3) - -#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) - -/* Visual C++ .Net v7.1 provides the fastest encryption code when using - Pentium optimiation with small code but this is poor for decryption - so we need to control this with the following VC++ pragmas -*/ - -#if defined( _MSC_VER ) && !defined( _WIN64 ) -#pragma optimize( "s", on ) -#endif - -/* Given the column (c) of the output state variable, the following - macros give the input state variables which are needed in its - computation for each row (r) of the state. All the alternative - macros give the same end values but expand into different ways - of calculating these values. In particular the complex macro - used for dynamically variable block sizes is designed to expand - to a compile time constant whenever possible but will expand to - conditional clauses on some branches (I am grateful to Frank - Yellin for this construction) -*/ - -#define fwd_var(x,r,c)\ - ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ - : r == 1 ? ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))\ - : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ - : ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))) - -#if defined(FT4_SET) -#undef dec_fmvars -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,n),fwd_var,rf1,c)) -#elif defined(FT1_SET) -#undef dec_fmvars -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(f,n),fwd_var,rf1,c)) -#else -#define fwd_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ fwd_mcol(no_table(x,t_use(s,box),fwd_var,rf1,c))) -#endif - -#if defined(FL4_SET) -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(f,l),fwd_var,rf1,c)) -#elif defined(FL1_SET) -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(f,l),fwd_var,rf1,c)) -#else -#define fwd_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(s,box),fwd_var,rf1,c)) -#endif - -AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]) -{ uint_32t locals(b0, b1); - const uint_32t *kp; -#if defined( dec_fmvars ) - dec_fmvars; /* declare variables for fwd_mcol() if needed */ -#endif - -#if defined( AES_ERR_CHK ) - if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) - return EXIT_FAILURE; -#endif - - kp = cx->ks; - state_in(b0, in, kp); - -#if (ENC_UNROLL == FULL) - - switch(cx->inf.b[0]) - { - case 14 * 16: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - kp += 2 * N_COLS; - case 12 * 16: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - kp += 2 * N_COLS; - case 10 * 16: - round(fwd_rnd, b1, b0, kp + 1 * N_COLS); - round(fwd_rnd, b0, b1, kp + 2 * N_COLS); - round(fwd_rnd, b1, b0, kp + 3 * N_COLS); - round(fwd_rnd, b0, b1, kp + 4 * N_COLS); - round(fwd_rnd, b1, b0, kp + 5 * N_COLS); - round(fwd_rnd, b0, b1, kp + 6 * N_COLS); - round(fwd_rnd, b1, b0, kp + 7 * N_COLS); - round(fwd_rnd, b0, b1, kp + 8 * N_COLS); - round(fwd_rnd, b1, b0, kp + 9 * N_COLS); - round(fwd_lrnd, b0, b1, kp +10 * N_COLS); - } - -#else - -#if (ENC_UNROLL == PARTIAL) - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) - { - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); - kp += N_COLS; - round(fwd_rnd, b0, b1, kp); - } - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); -#else - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) - { - kp += N_COLS; - round(fwd_rnd, b1, b0, kp); - l_copy(b0, b1); - } -#endif - kp += N_COLS; - round(fwd_lrnd, b0, b1, kp); - } -#endif - - state_out(out, b0); - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if ( FUNCS_IN_C & DECRYPTION_IN_C) - -/* Visual C++ .Net v7.1 provides the fastest encryption code when using - Pentium optimiation with small code but this is poor for decryption - so we need to control this with the following VC++ pragmas -*/ - -#if defined( _MSC_VER ) && !defined( _WIN64 ) -#pragma optimize( "t", on ) -#endif - -/* Given the column (c) of the output state variable, the following - macros give the input state variables which are needed in its - computation for each row (r) of the state. All the alternative - macros give the same end values but expand into different ways - of calculating these values. In particular the complex macro - used for dynamically variable block sizes is designed to expand - to a compile time constant whenever possible but will expand to - conditional clauses on some branches (I am grateful to Frank - Yellin for this construction) -*/ - -#define inv_var(x,r,c)\ - ( r == 0 ? ( c == 0 ? s(x,0) : c == 1 ? s(x,1) : c == 2 ? s(x,2) : s(x,3))\ - : r == 1 ? ( c == 0 ? s(x,3) : c == 1 ? s(x,0) : c == 2 ? s(x,1) : s(x,2))\ - : r == 2 ? ( c == 0 ? s(x,2) : c == 1 ? s(x,3) : c == 2 ? s(x,0) : s(x,1))\ - : ( c == 0 ? s(x,1) : c == 1 ? s(x,2) : c == 2 ? s(x,3) : s(x,0))) - -#if defined(IT4_SET) -#undef dec_imvars -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,n),inv_var,rf1,c)) -#elif defined(IT1_SET) -#undef dec_imvars -#define inv_rnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,upr,t_use(i,n),inv_var,rf1,c)) -#else -#define inv_rnd(y,x,k,c) (s(y,c) = inv_mcol((k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c))) -#endif - -#if defined(IL4_SET) -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ four_tables(x,t_use(i,l),inv_var,rf1,c)) -#elif defined(IL1_SET) -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ one_table(x,ups,t_use(i,l),inv_var,rf1,c)) -#else -#define inv_lrnd(y,x,k,c) (s(y,c) = (k)[c] ^ no_table(x,t_use(i,box),inv_var,rf1,c)) -#endif - -/* This code can work with the decryption key schedule in the */ -/* order that is used for encrytpion (where the 1st decryption */ -/* round key is at the high end ot the schedule) or with a key */ -/* schedule that has been reversed to put the 1st decryption */ -/* round key at the low end of the schedule in memory (when */ -/* AES_REV_DKS is defined) */ - -#ifdef AES_REV_DKS -#define key_ofs 0 -#define rnd_key(n) (kp + n * N_COLS) -#else -#define key_ofs 1 -#define rnd_key(n) (kp - n * N_COLS) -#endif - -AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]) -{ uint_32t locals(b0, b1); -#if defined( dec_imvars ) - dec_imvars; /* declare variables for inv_mcol() if needed */ -#endif - const uint_32t *kp; - -#if defined( AES_ERR_CHK ) - if( cx->inf.b[0] != 10 * 16 && cx->inf.b[0] != 12 * 16 && cx->inf.b[0] != 14 * 16 ) - return EXIT_FAILURE; -#endif - - kp = cx->ks + (key_ofs ? (cx->inf.b[0] >> 2) : 0); - state_in(b0, in, kp); - -#if (DEC_UNROLL == FULL) - - kp = cx->ks + (key_ofs ? 0 : (cx->inf.b[0] >> 2)); - switch(cx->inf.b[0]) - { - case 14 * 16: - round(inv_rnd, b1, b0, rnd_key(-13)); - round(inv_rnd, b0, b1, rnd_key(-12)); - case 12 * 16: - round(inv_rnd, b1, b0, rnd_key(-11)); - round(inv_rnd, b0, b1, rnd_key(-10)); - case 10 * 16: - round(inv_rnd, b1, b0, rnd_key(-9)); - round(inv_rnd, b0, b1, rnd_key(-8)); - round(inv_rnd, b1, b0, rnd_key(-7)); - round(inv_rnd, b0, b1, rnd_key(-6)); - round(inv_rnd, b1, b0, rnd_key(-5)); - round(inv_rnd, b0, b1, rnd_key(-4)); - round(inv_rnd, b1, b0, rnd_key(-3)); - round(inv_rnd, b0, b1, rnd_key(-2)); - round(inv_rnd, b1, b0, rnd_key(-1)); - round(inv_lrnd, b0, b1, rnd_key( 0)); - } - -#else - -#if (DEC_UNROLL == PARTIAL) - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 5) - 1; ++rnd) - { - kp = rnd_key(1); - round(inv_rnd, b1, b0, kp); - kp = rnd_key(1); - round(inv_rnd, b0, b1, kp); - } - kp = rnd_key(1); - round(inv_rnd, b1, b0, kp); -#else - { uint_32t rnd; - for(rnd = 0; rnd < (cx->inf.b[0] >> 4) - 1; ++rnd) - { - kp = rnd_key(1); - round(inv_rnd, b1, b0, kp); - l_copy(b0, b1); - } -#endif - kp = rnd_key(1); - round(inv_lrnd, b0, b1, kp); - } -#endif - - state_out(out, b0); - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(__cplusplus) -} -#endif diff --git a/src/utils/crypto/aessmall.c b/src/utils/crypto/aessmall.c index 3296f13917b..69d5732217a 100644 --- a/src/utils/crypto/aessmall.c +++ b/src/utils/crypto/aessmall.c @@ -373,10 +373,10 @@ static const uint_8t gfmul_e[256] = { static void copy_block16( void *d, const void *s ) { #if defined( HAVE_UINT_32T ) - ((uint_32t*)d)[ 0] = ((uint_32t*)s)[ 0]; - ((uint_32t*)d)[ 1] = ((uint_32t*)s)[ 1]; - ((uint_32t*)d)[ 2] = ((uint_32t*)s)[ 2]; - ((uint_32t*)d)[ 3] = ((uint_32t*)s)[ 3]; + ((uint32_t *)d)[ 0] = ((uint32_t *)s)[ 0]; + ((uint32_t *)d)[ 1] = ((uint32_t *)s)[ 1]; + ((uint32_t *)d)[ 2] = ((uint32_t *)s)[ 2]; + ((uint32_t *)d)[ 3] = ((uint32_t *)s)[ 3]; #else ((uint_8t*)d)[ 0] = ((uint_8t*)s)[ 0]; ((uint_8t*)d)[ 1] = ((uint_8t*)s)[ 1]; @@ -407,10 +407,10 @@ static void copy_block( void * d, void *s, uint_8t nn ) static void copy_and_key( void *d, const void *s, const void *k ) { #if defined( HAVE_UINT_32T ) - ((uint_32t*)d)[ 0] = ((uint_32t*)s)[ 0] ^ ((uint_32t*)k)[ 0]; - ((uint_32t*)d)[ 1] = ((uint_32t*)s)[ 1] ^ ((uint_32t*)k)[ 1]; - ((uint_32t*)d)[ 2] = ((uint_32t*)s)[ 2] ^ ((uint_32t*)k)[ 2]; - ((uint_32t*)d)[ 3] = ((uint_32t*)s)[ 3] ^ ((uint_32t*)k)[ 3]; + ((uint32_t *)d)[ 0] = ((uint32_t *)s)[ 0] ^ ((uint32_t *)k)[ 0]; + ((uint32_t *)d)[ 1] = ((uint32_t *)s)[ 1] ^ ((uint32_t *)k)[ 1]; + ((uint32_t *)d)[ 2] = ((uint32_t *)s)[ 2] ^ ((uint32_t *)k)[ 2]; + ((uint32_t *)d)[ 3] = ((uint32_t *)s)[ 3] ^ ((uint32_t *)k)[ 3]; #elif 1 ((uint_8t*)d)[ 0] = ((uint_8t*)s)[ 0] ^ ((uint_8t*)k)[ 0]; ((uint_8t*)d)[ 1] = ((uint_8t*)s)[ 1] ^ ((uint_8t*)k)[ 1]; From 64b73696051f63ac91fe6a00c7b971bd35d74bfb Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 05:18:56 +0100 Subject: [PATCH 308/320] Built-in TrueCrypt: Actually use 86Box's fatal() for TC_THROW_FATAL_EXCEPTION instead of deliberately crashing on a NULL pointer dereference, should fix compile warnings on MacOS. --- src/utils/common/tcdefs.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/utils/common/tcdefs.h b/src/utils/common/tcdefs.h index 49dc6bde254..427cab6e818 100644 --- a/src/utils/common/tcdefs.h +++ b/src/utils/common/tcdefs.h @@ -15,6 +15,8 @@ #include #include +#include <86box/86box.h> + #define TC_APP_NAME "TrueCrypt" // Version displayed to user @@ -103,7 +105,11 @@ typedef union } UINT64_STRUCT; +#ifdef ORIGINAL_FATAL #define TC_THROW_FATAL_EXCEPTION *(char *) 0 = 0 +#else +#define TC_THROW_FATAL_EXCEPTION fatal("TrueCrypt: Fatal exception"); +#endif #define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; while (burnc--) *burnm++ = 0; } while (0) From ef9ef0f5dd617b305e197ffa1727dda9aa77bfaf Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 05:40:04 +0100 Subject: [PATCH 309/320] Attempt to fix compilation of Mac. --- src/utils/common/endian.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/common/endian.h b/src/utils/common/endian.h index 787c6fa2172..b4978b5356f 100644 --- a/src/utils/common/endian.h +++ b/src/utils/common/endian.h @@ -30,7 +30,7 @@ extern "C" #elif !defined(BYTE_ORDER) -# ifdef TC_MACOSX +# if defined (__APPLE__) || defined (TC_MACOSX) # include # elif defined (TC_BSD) # include From 6f48edba9aab0468bf9d119c4628cc18b3f43842 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 05:40:53 +0100 Subject: [PATCH 310/320] And the BSD family. --- src/utils/common/endian.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/common/endian.h b/src/utils/common/endian.h index b4978b5356f..21d28e725d6 100644 --- a/src/utils/common/endian.h +++ b/src/utils/common/endian.h @@ -32,7 +32,7 @@ extern "C" # if defined (__APPLE__) || defined (TC_MACOSX) # include -# elif defined (TC_BSD) +# elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined (TC_BSD) # include # else # include From 246b16e0982615ac5af08728fd4cd6cc16e033dd Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 05:43:03 +0100 Subject: [PATCH 311/320] Add the missing #define for FILE. --- src/utils/common/tcdefs.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/utils/common/tcdefs.h b/src/utils/common/tcdefs.h index 427cab6e818..3da186fa870 100644 --- a/src/utils/common/tcdefs.h +++ b/src/utils/common/tcdefs.h @@ -13,6 +13,7 @@ #define TCDEFS_H #include +#include #include #include <86box/86box.h> From 38b6712eca73a65f008bf9bdae198fda5a2ec272 Mon Sep 17 00:00:00 2001 From: OBattler Date: Sun, 18 Jan 2026 07:53:50 +0100 Subject: [PATCH 312/320] De-TrueCrypt'ization: Phase 1. --- src/utils/common/crc.c | 38 ---- src/utils/common/crc.h | 8 +- src/utils/common/crypto.c | 326 +++----------------------------- src/utils/common/crypto.h | 28 +-- src/utils/common/endian.c | 3 - src/utils/common/endian.h | 17 +- src/utils/common/gfmul.c | 19 +- src/utils/common/gfmul.h | 2 - src/utils/common/pkcs5.c | 80 ++++---- src/utils/common/pkcs5.h | 8 +- src/utils/common/tcdefs.h | 174 ----------------- src/utils/common/xts.c | 76 +++----- src/utils/common/xts.h | 33 +--- src/utils/crypto/aes.h | 5 +- src/utils/crypto/aesopt.h | 4 +- src/utils/crypto/aestab.c | 40 ---- src/utils/crypto/rmd160.c | 130 ------------- src/utils/crypto/rmd160.h | 4 - src/utils/crypto/serpent.c | 373 ------------------------------------- src/utils/crypto/sha2.h | 12 +- src/utils/crypto/twofish.c | 78 -------- src/utils/crypto/twofish.h | 2 - src/utils/decode.c | 27 +-- src/utils/mds.h | 7 +- 24 files changed, 164 insertions(+), 1330 deletions(-) delete mode 100644 src/utils/common/tcdefs.h diff --git a/src/utils/common/crc.c b/src/utils/common/crc.c index 7e06b95b544..055be2d1c6c 100644 --- a/src/utils/common/crc.c +++ b/src/utils/common/crc.c @@ -9,12 +9,9 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#include "tcdefs.h" #include "crc.h" #include "../common/endian.h" -#ifndef TC_MINIMIZE_CODE_SIZE - /* CRC polynomial 0x04c11db7 */ uint32_t crc_32_tab[]= { @@ -96,38 +93,3 @@ int crc32_selftests (void) return bSuccess; } - -#else // TC_MINIMIZE_CODE_SIZE - -uint32_t GetCrc32 (unsigned char *data, int length) -{ - uint32_t r = 0xFFFFFFFFUL; - int i, b; - - for (i = 0; i < length; ++i) - { - r ^= data[i]; - for (b = 0; b < 8; ++b) - { - if ((unsigned __int8) r & 1) - r = (r >> 1) ^ 0xEDB88320UL; - else - r >>= 1; - } - } - - return r ^ 0xFFFFFFFFUL; -} - -int crc32_selftests () -{ - unsigned __int8 testData[32]; - unsigned __int8 i; - - for (i = 0; i < sizeof (testData); ++i) - testData[i] = i; - - return GetCrc32 (testData, sizeof (testData)) == 0x91267E8AUL; -} - -#endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/utils/common/crc.h b/src/utils/common/crc.h index 0fef2a311ed..ff49ae66ec6 100644 --- a/src/utils/common/crc.h +++ b/src/utils/common/crc.h @@ -9,13 +9,11 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#ifndef TC_HEADER_CRC -#define TC_HEADER_CRC +#ifndef HEADER_CRC +#define HEADER_CRC #include -#include "tcdefs.h" - #if defined(__cplusplus) extern "C" { @@ -34,4 +32,4 @@ extern uint32_t crc_32_tab[]; } #endif -#endif // TC_HEADER_CRC +#endif // HEADER_CRC diff --git a/src/utils/common/crypto.c b/src/utils/common/crypto.c index 8edef29bbe9..9bf86501bbe 100644 --- a/src/utils/common/crypto.c +++ b/src/utils/common/crypto.c @@ -9,7 +9,6 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#include "tcdefs.h" #include "crypto.h" #include "xts.h" #include "crc.h" @@ -206,7 +205,7 @@ void EncipherBlock(int cipher, void *data, void *ks) case CAST: CAST_ecb_encrypt (data, data, ks, 1); break; // Deprecated/legacy case TRIPLEDES: des_ecb3_encrypt (data, data, ks, // Deprecated/legacy (void*)((char*) ks + CipherGetKeyScheduleSize (DES56)), (void*)((char*) ks + CipherGetKeyScheduleSize (DES56) * 2), 1); break; - default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID + default: fatal("EncipherBlock(): Unknown/wrong ID\n"); // Unknown/wrong ID } } @@ -226,7 +225,7 @@ void DecipherBlock(int cipher, void *data, void *ks) case TRIPLEDES: des_ecb3_encrypt (data, data, ks, // Deprecated/legacy (void*)((char*) ks + CipherGetKeyScheduleSize (DES56)), (void*)((char*) ks + CipherGetKeyScheduleSize (DES56) * 2), 0); break; - default: TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID + default: fatal("DecipherBlock(): Unknown/wrong ID\n"); // Unknown/wrong ID } } @@ -344,7 +343,7 @@ int EAInitMode (PCRYPTO_INFO ci) return Gf128Tab64Init (ci->k2, &ci->gf_ctx); default: - TC_THROW_FATAL_EXCEPTION; + fatal("EAInitMode(): Fatal exception\n"); } break; @@ -357,7 +356,7 @@ int EAInitMode (PCRYPTO_INFO ci) default: // Unknown/wrong ID - TC_THROW_FATAL_EXCEPTION; + fatal("EAInitMode(): Unknown/wrong ID\n"); } return 1; } @@ -635,7 +634,7 @@ int HashIsDeprecated (int hashId) PCRYPTO_INFO crypto_open (void) { /* Do the crt allocation */ - PCRYPTO_INFO cryptoInfo = (PCRYPTO_INFO) TCalloc (sizeof (CRYPTO_INFO)); + PCRYPTO_INFO cryptoInfo = (PCRYPTO_INFO) malloc (sizeof (CRYPTO_INFO)); memset (cryptoInfo, 0, sizeof (CRYPTO_INFO)); if (cryptoInfo == NULL) @@ -648,21 +647,17 @@ PCRYPTO_INFO crypto_open (void) void crypto_loadkey (PKEY_INFO keyInfo, char *lpszUserKey, int nUserKeyLen) { keyInfo->keyLength = nUserKeyLen; - burn (keyInfo->userKey, sizeof (keyInfo->userKey)); + memset (keyInfo->userKey, 0x00, sizeof (keyInfo->userKey)); memcpy (keyInfo->userKey, lpszUserKey, nUserKeyLen); } void crypto_close (PCRYPTO_INFO cryptoInfo) { if (cryptoInfo != NULL) - { - burn (cryptoInfo, sizeof (CRYPTO_INFO)); - TCfree (cryptoInfo); - } + free (cryptoInfo); } -#ifndef TC_NO_COMPILER_INT64 void Xor128 (uint64_t *a, uint64_t *b) { *a++ ^= *b++; @@ -691,7 +686,7 @@ void EncryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64(blockIndex); if (length % 16) - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBufferLRW128(): Length not divisible by 16\n"); // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). @@ -727,7 +722,7 @@ void EncryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); } - FAST_ERASE64 (t, sizeof(t)); + memset (t, 0x00, sizeof(t)); } @@ -745,7 +740,7 @@ void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64(blockIndex); if (length % 8) - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBufferLRW64(): Length not divisible by 8\n"); for (b = 0; b < length >> 3; b++) { @@ -764,7 +759,7 @@ void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); } - FAST_ERASE64 (t, sizeof(t)); + memset (t, 0x00, sizeof(t)); } @@ -783,7 +778,7 @@ void DecryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64(blockIndex); if (length % 16) - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptufferLRW128(): Length not divisible by 16\n"); // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). @@ -820,7 +815,7 @@ void DecryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); } - FAST_ERASE64 (t, sizeof(t)); + memset (t, 0x00, sizeof(t)); } @@ -839,7 +834,7 @@ void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64(blockIndex); if (length % 8) - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptufferLRW64(): Length not divisible by 64\n"); for (b = 0; b < length >> 3; b++) { @@ -858,7 +853,7 @@ void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); } - FAST_ERASE64 (t, sizeof(t)); + memset (t, 0x00, sizeof(t)); } @@ -910,7 +905,7 @@ InitSectorIVAndWhitening (uint64_t unitNo, break; default: - TC_THROW_FATAL_EXCEPTION; + fatal("InitSectorIVAndWhitening(): Invalid length: %i\n", blockSize); } } @@ -941,7 +936,7 @@ EncryptBufferCBC (uint32_t *data, int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher); if (len % blockSize) - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBufferCBC(): Length not divisible by %i\n", blockSize); // IV bufIV[0] = iv[0]; @@ -1031,7 +1026,7 @@ DecryptBufferCBC (uint32_t *data, int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher); if (len % blockSize) - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptBufferCBC(): Length not divisible by %i\n", blockSize); // IV bufIV[0] = iv[0]; @@ -1104,7 +1099,6 @@ DecryptBufferCBC (uint32_t *data, data += blockSize / sizeof(*data); } } -#endif // #ifndef TC_NO_COMPILER_INT64 // EncryptBuffer @@ -1113,7 +1107,7 @@ DecryptBufferCBC (uint32_t *data, // len: number of bytes to encrypt; must be divisible by the block size (for cascaded // ciphers divisible by the largest block size used within the cascade) void EncryptBuffer (uint8_t *buf, - TC_LARGEST_COMPILER_UINT len, + uint64_t len, PCRYPTO_INFO cryptoInfo) { switch (cryptoInfo->mode) @@ -1143,7 +1137,6 @@ void EncryptBuffer (uint8_t *buf, } break; -#ifndef TC_NO_COMPILER_INT64 case LRW: /* Deprecated/legacy */ @@ -1159,7 +1152,7 @@ void EncryptBuffer (uint8_t *buf, break; default: - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBuffer(): Invalid length: %i\n", CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))); } break; @@ -1201,167 +1194,20 @@ void EncryptBuffer (uint8_t *buf, 0); break; -#endif // #ifndef TC_NO_COMPILER_INT64 default: // Unknown/wrong ID - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBuffer(): Unknown/wrong ID\n"); } } -// #ifndef TC_NO_COMPILER_INT64 -// // Converts a data unit number to the index of the first LRW block in the data unit. -// // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). -// uint64_t DataUnit2LRWIndex (uint64_t dataUnit, int blockSize, PCRYPTO_INFO ci) -// { -// /* Deprecated/legacy */ - -// if (ci->hiddenVolume) -// dataUnit -= ci->hiddenVolumeOffset / ENCRYPTION_DATA_UNIT_SIZE; -// else -// dataUnit -= HEADER_SIZE / ENCRYPTION_DATA_UNIT_SIZE; // Compensate for the volume header size - -// switch (blockSize) -// { -// case 8: -// return (dataUnit << 6) | 1; - -// case 16: -// return (dataUnit << 5) | 1; - -// default: -// TC_THROW_FATAL_EXCEPTION; -// } - -// return 0; -// } -// #endif // #ifndef TC_NO_COMPILER_INT64 - - -// // buf: data to be encrypted -// // unitNo: sequential number of the data unit with which the buffer starts -// // nbrUnits: number of data units in the buffer -// void EncryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci) -// { -// int ea = ci->ea; -// uint8_t *ks = ci->ks; -// uint8_t *ks2 = ci->ks2; -// int cipher; - -// #ifndef TC_NO_COMPILER_INT64 -// void *iv = ci->k2; // Deprecated/legacy -// uint64_t unitNo = structUnitNo->Value; -// uint64_t *iv64 = (uint64_t *) iv; // Deprecated/legacy -// uint32_t sectorIV[4]; // Deprecated/legacy -// uint32_t secWhitening[2]; // Deprecated/legacy -// #endif - -// switch (ci->mode) -// { -// case XTS: -// for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher)) -// { -// EncryptBufferXTS (buf, -// nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, -// structUnitNo, -// 0, -// ks, -// ks2, -// cipher); - -// ks += CipherGetKeyScheduleSize (cipher); -// ks2 += CipherGetKeyScheduleSize (cipher); -// } -// break; - -// #ifndef TC_NO_COMPILER_INT64 -// case LRW: - -// /* Deprecated/legacy */ - -// switch (CipherGetBlockSize (EAGetFirstCipher (ea))) -// { -// case 8: -// EncryptBufferLRW64 (buf, -// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, -// DataUnit2LRWIndex (unitNo, 8, ci), -// ci); -// break; - -// case 16: -// EncryptBufferLRW128 (buf, -// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, -// DataUnit2LRWIndex (unitNo, 16, ci), -// ci); -// break; - -// default: -// TC_THROW_FATAL_EXCEPTION; -// } -// break; - -// case CBC: -// case INNER_CBC: - -// /* Deprecated/legacy */ - -// while (nbrUnits--) -// { -// for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher)) -// { -// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening); - -// EncryptBufferCBC ((uint32_t *) buf, -// ENCRYPTION_DATA_UNIT_SIZE, -// ks, -// sectorIV, -// secWhitening, -// 0, -// cipher); - -// ks += CipherGetKeyScheduleSize (cipher); -// } -// ks -= EAGetKeyScheduleSize (ea); -// buf += ENCRYPTION_DATA_UNIT_SIZE; -// unitNo++; -// } -// break; - -// case OUTER_CBC: - -// /* Deprecated/legacy */ - -// while (nbrUnits--) -// { -// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (EAGetFirstCipher (ea)), sectorIV, iv64, secWhitening); - -// EncryptBufferCBC ((uint32_t *) buf, -// ENCRYPTION_DATA_UNIT_SIZE, -// ks, -// sectorIV, -// secWhitening, -// ea, -// 0); - -// buf += ENCRYPTION_DATA_UNIT_SIZE; -// unitNo++; -// } -// break; -// #endif // #ifndef TC_NO_COMPILER_INT64 - -// default: -// // Unknown/wrong ID -// TC_THROW_FATAL_EXCEPTION; -// } -// } - // DecryptBuffer // // buf: data to be decrypted // len: number of bytes to decrypt; must be divisible by the block size (for cascaded // ciphers divisible by the largest block size used within the cascade) void DecryptBuffer (uint8_t *buf, - TC_LARGEST_COMPILER_UINT len, + uint64_t len, uint32_t secSz, uint64_t secN, uint8_t flags, @@ -1398,7 +1244,6 @@ void DecryptBuffer (uint8_t *buf, } break; -#ifndef TC_NO_COMPILER_INT64 case LRW: { uint32_t n = 0; @@ -1416,7 +1261,7 @@ void DecryptBuffer (uint8_t *buf, break; default: - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptBuffer(): Invalid length: %i\n", CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))); } break; } @@ -1503,136 +1348,13 @@ void DecryptBuffer (uint8_t *buf, } break; -#endif // #ifndef TC_NO_COMPILER_INT64 default: // Unknown/wrong ID - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptBuffer(): Unknown/wrong ID\n"); } } -// // buf: data to be decrypted -// // unitNo: sequential number of the data unit with which the buffer starts -// // nbrUnits: number of data units in the buffer -// void DecryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci) -// { -// int ea = ci->ea; -// uint8_t *ks = ci->ks; -// uint8_t *ks2 = ci->ks2; -// int cipher; - -// #ifndef TC_NO_COMPILER_INT64 -// void *iv = ci->k2; // Deprecated/legacy -// uint64_t unitNo = structUnitNo->Value; -// uint64_t *iv64 = (uint64_t *) iv; // Deprecated/legacy -// uint32_t sectorIV[4]; // Deprecated/legacy -// uint32_t secWhitening[2]; // Deprecated/legacy -// #endif // #ifndef TC_NO_COMPILER_INT64 - - -// switch (ci->mode) -// { -// case XTS: -// ks += EAGetKeyScheduleSize (ea); -// ks2 += EAGetKeyScheduleSize (ea); - -// for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher)) -// { -// ks -= CipherGetKeyScheduleSize (cipher); -// ks2 -= CipherGetKeyScheduleSize (cipher); - -// DecryptBufferXTS (buf, -// nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, -// structUnitNo, -// 0, -// ks, -// ks2, -// cipher); -// } -// break; - -// #ifndef TC_NO_COMPILER_INT64 -// case LRW: - -// /* Deprecated/legacy */ - -// switch (CipherGetBlockSize (EAGetFirstCipher (ea))) -// { -// case 8: -// DecryptBufferLRW64 (buf, -// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, -// DataUnit2LRWIndex (unitNo, 8, ci), -// ci); -// break; - -// case 16: -// DecryptBufferLRW128 (buf, -// (uint64_t) nbrUnits * ENCRYPTION_DATA_UNIT_SIZE, -// DataUnit2LRWIndex (unitNo, 16, ci), -// ci); -// break; - -// default: -// TC_THROW_FATAL_EXCEPTION; -// } -// break; - -// case CBC: -// case INNER_CBC: - -// /* Deprecated/legacy */ - -// while (nbrUnits--) -// { -// ks += EAGetKeyScheduleSize (ea); -// for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher)) -// { -// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening); - -// ks -= CipherGetKeyScheduleSize (cipher); - -// DecryptBufferCBC ((uint32_t *) buf, -// ENCRYPTION_DATA_UNIT_SIZE, -// ks, -// sectorIV, -// secWhitening, -// 0, -// cipher); -// } -// buf += ENCRYPTION_DATA_UNIT_SIZE; -// unitNo++; -// } -// break; - -// case OUTER_CBC: - -// /* Deprecated/legacy */ - -// while (nbrUnits--) -// { -// InitSectorIVAndWhitening (unitNo, CipherGetBlockSize (EAGetFirstCipher (ea)), sectorIV, iv64, secWhitening); - -// DecryptBufferCBC ((uint32_t *) buf, -// ENCRYPTION_DATA_UNIT_SIZE, -// ks, -// sectorIV, -// secWhitening, -// ea, -// 0); - -// buf += ENCRYPTION_DATA_UNIT_SIZE; -// unitNo++; -// } -// break; -// #endif // #ifndef TC_NO_COMPILER_INT64 - -// default: -// // Unknown/wrong ID -// TC_THROW_FATAL_EXCEPTION; -// } -// } - - // Returns the maximum number of bytes necessary to be generated by the PBKDF2 (PKCS #5) int GetMaxPkcs5OutSize (void) { diff --git a/src/utils/common/crypto.h b/src/utils/common/crypto.h index 8c3960e0873..4e23a915c22 100644 --- a/src/utils/common/crypto.h +++ b/src/utils/common/crypto.h @@ -28,7 +28,19 @@ #define CRYPTO_H #include -#include "tcdefs.h" + +enum +{ + ERR_SUCCESS = 0, + + ERR_OUTOFMEMORY = 2, + ERR_PASSWORD_WRONG, + + ERR_CIPHER_INIT_FAILURE = 17, + ERR_CIPHER_INIT_WEAK_KEY, + + ERR_MODE_INIT_FAILED = 27 +}; #ifdef __cplusplus extern "C" { @@ -171,11 +183,7 @@ typedef struct #define PRAND_DISK_WIPE_PASSES 200 -#if !defined (TC_WINDOWS_BOOT) || defined (TC_WINDOWS_BOOT_AES) # include "../crypto/aes.h" -#else -# include "../crypto/aesSmall.h" -#endif #include "../crypto/blowfish.h" #include "../crypto/cast.h" @@ -278,12 +286,8 @@ int HashIsDeprecated (int hashId); int GetMaxPkcs5OutSize (void); -//void EncryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci); -//void DecryptDataUnits (uint8_t *buf, const UINT64_STRUCT *structUnitNo, TC_LARGEST_COMPILER_UINT nbrUnits, PCRYPTO_INFO ci); -void EncryptBuffer (uint8_t *buf, TC_LARGEST_COMPILER_UINT len, PCRYPTO_INFO cryptoInfo); -void DecryptBuffer (uint8_t *buf, TC_LARGEST_COMPILER_UINT len, uint32_t secSz, uint64_t secN, uint8_t flags, PCRYPTO_INFO cryptoInfo); - -#ifndef TC_NO_COMPILER_INT64 +void EncryptBuffer (uint8_t *buf, uint64_t len, PCRYPTO_INFO cryptoInfo); +void DecryptBuffer (uint8_t *buf, uint64_t len, uint32_t secSz, uint64_t secN, uint8_t flags, PCRYPTO_INFO cryptoInfo); void Xor128 (uint64_t *a, uint64_t *b); void Xor64 (uint64_t *a, uint64_t *b); @@ -294,8 +298,6 @@ void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); void InitSectorIVAndWhitening (uint64_t unitNo, int blockSize, uint32_t *iv, uint64_t *ivSeed, uint32_t *whitening); -//uint64_t DataUnit2LRWIndex (uint64_t dataUnit, int blockSize, PCRYPTO_INFO ci); -#endif // #ifndef TC_NO_COMPILER_INT64 #ifdef __cplusplus } diff --git a/src/utils/common/endian.c b/src/utils/common/endian.c index 90d2115daf7..e4c75cf0748 100644 --- a/src/utils/common/endian.c +++ b/src/utils/common/endian.c @@ -9,7 +9,6 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#include "tcdefs.h" #include "../common/endian.h" @@ -27,7 +26,6 @@ uint32_t MirrorBytes32 (uint32_t x) return (n << 8) | (uint8_t) (x >> 24); } -#ifndef TC_NO_COMPILER_INT64 uint64_t MirrorBytes64 (uint64_t x) { uint64_t n = (uint8_t) x; @@ -39,7 +37,6 @@ uint64_t MirrorBytes64 (uint64_t x) n <<= 8; n |= (uint8_t) (x >> 48); return (n << 8) | (uint8_t) (x >> 56); } -#endif void LongReverse (uint32_t *buffer, unsigned byteCount) diff --git a/src/utils/common/endian.h b/src/utils/common/endian.h index 21d28e725d6..2d9ea7f9f9e 100644 --- a/src/utils/common/endian.h +++ b/src/utils/common/endian.h @@ -9,8 +9,8 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#ifndef TC_ENDIAN_H -#define TC_ENDIAN_H +#ifndef ENDIAN_H +#define ENDIAN_H #include @@ -19,6 +19,11 @@ extern "C" { #endif +#define uint16 uint16_t +#define uint32 uint32_t + +#define uint64 uint64_t + #ifdef _WIN32 # ifndef LITTLE_ENDIAN @@ -30,9 +35,9 @@ extern "C" #elif !defined(BYTE_ORDER) -# if defined (__APPLE__) || defined (TC_MACOSX) +# if defined (__APPLE__) # include -# elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) || defined (TC_BSD) +# elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) # include # else # include @@ -126,13 +131,11 @@ extern "C" uint16_t MirrorBytes16 (uint16_t x); uint32_t MirrorBytes32 (uint32_t x); -#ifndef TC_NO_COMPILER_INT64 uint64_t MirrorBytes64 (uint64_t x); -#endif void LongReverse ( uint32_t *buffer , unsigned byteCount ); #if defined(__cplusplus) } #endif -#endif /* TC_ENDIAN_H */ +#endif /* ENDIAN_H */ diff --git a/src/utils/common/gfmul.c b/src/utils/common/gfmul.c index 9536d2ea9a7..cadb5320770 100644 --- a/src/utils/common/gfmul.c +++ b/src/utils/common/gfmul.c @@ -49,7 +49,6 @@ #include #include #include "gfmul.h" -#include "tcdefs.h" #include "../common/endian.h" /* BUFFER_ALIGN32 or BUFFER_ALIGN64 must be defined at this point to */ @@ -595,7 +594,6 @@ void MirrorBits128 (uint8_t *a) SetBit128 (127 - i, t); } memcpy (a, t, sizeof (t)); - burn (t,sizeof (t)); } void MirrorBits64 (uint8_t *a) @@ -609,7 +607,6 @@ void MirrorBits64 (uint8_t *a) SetBit64 (63 - i, t); } memcpy (a, t, sizeof (t)); - burn (t,sizeof (t)); } /* Allocate and initialize speed optimization table @@ -620,7 +617,7 @@ int Gf128Tab64Init (uint8_t *a, GfCtx *ctx) uint8_t am[16]; int i, j; - ctx8k = (GfCtx8k *) TCalloc (sizeof (GfCtx8k)); + ctx8k = (GfCtx8k *) malloc (sizeof (GfCtx8k)); if (!ctx8k) return 0; @@ -644,9 +641,7 @@ int Gf128Tab64Init (uint8_t *a, GfCtx *ctx) } } - burn (ctx8k ,sizeof (*ctx8k)); - burn (am, sizeof (am)); - TCfree (ctx8k); + free (ctx8k); return 1; } @@ -658,7 +653,7 @@ int Gf64TabInit (uint8_t *a, GfCtx *ctx) uint8_t am[8]; int i, j; - ctx4k = (GfCtx4k64 *) TCalloc (sizeof (GfCtx4k64)); + ctx4k = (GfCtx4k64 *) malloc (sizeof (GfCtx4k64)); if (!ctx4k) return 0; @@ -682,9 +677,7 @@ int Gf64TabInit (uint8_t *a, GfCtx *ctx) } } - burn (ctx4k,sizeof (*ctx4k)); - burn (am, sizeof (am)); - TCfree (ctx4k); + free (ctx4k); return 1; } @@ -842,7 +835,7 @@ int GfMulSelfTest (void) uint8_t b[16]; uint8_t p1[16]; uint8_t p2[16]; - GfCtx *gfCtx = (GfCtx *) TCalloc (sizeof (GfCtx)); + GfCtx *gfCtx = (GfCtx *) malloc (sizeof (GfCtx)); int i, j; if (!gfCtx) @@ -884,7 +877,7 @@ int GfMulSelfTest (void) result = 0; } - TCfree (gfCtx); + free (gfCtx); return result; } diff --git a/src/utils/common/gfmul.h b/src/utils/common/gfmul.h index da411ed6748..0f974161285 100644 --- a/src/utils/common/gfmul.h +++ b/src/utils/common/gfmul.h @@ -32,8 +32,6 @@ #include -#include "tcdefs.h" - #if defined(__cplusplus) extern "C" { diff --git a/src/utils/common/pkcs5.c b/src/utils/common/pkcs5.c index 2e55472b2f1..9a23e7ecb5e 100644 --- a/src/utils/common/pkcs5.c +++ b/src/utils/common/pkcs5.c @@ -9,8 +9,6 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#include "tcdefs.h" - #include #include "../crypto/rmd160.h" #include "../crypto/sha1.h" @@ -61,7 +59,7 @@ void hmac_sha512 k = key; lk = SHA512_DIGESTSIZE; - burn (&tctx, sizeof(tctx)); // Prevent leaks + memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks } /**** Inner Digest ****/ @@ -98,12 +96,12 @@ void hmac_sha512 hmac_truncate (osha, out, t); /* Prevent leaks */ - burn (&ictx, sizeof(ictx)); - burn (&octx, sizeof(octx)); - burn (isha, sizeof(isha)); - burn (osha, sizeof(osha)); - burn (buf, sizeof(buf)); - burn (key, sizeof(key)); + memset (&ictx, 0x00, sizeof(ictx)); + memset (&octx, 0x00, sizeof(octx)); + memset (isha, 0x00, sizeof(isha)); + memset (osha, 0x00, sizeof(osha)); + memset (buf, 0x00, sizeof(buf)); + memset (key, 0x00, sizeof(key)); } @@ -134,8 +132,8 @@ void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iter } /* Prevent possible leaks. */ - burn (j, sizeof(j)); - burn (k, sizeof(k)); + memset (j, 0x00, sizeof(j)); + memset (k, 0x00, sizeof(k)); } @@ -169,7 +167,7 @@ void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int it /* Prevent possible leaks. */ - burn (u, sizeof(u)); + memset (u, 0x00, sizeof(u)); } @@ -203,7 +201,7 @@ void hmac_sha1 k = key; lk = SHA1_DIGESTSIZE; - burn (&tctx, sizeof(tctx)); // Prevent leaks + memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks } /**** Inner Digest ****/ @@ -240,12 +238,12 @@ void hmac_sha1 hmac_truncate (osha, out, t); /* Prevent leaks */ - burn (&ictx, sizeof(ictx)); - burn (&octx, sizeof(octx)); - burn (isha, sizeof(isha)); - burn (osha, sizeof(osha)); - burn (buf, sizeof(buf)); - burn (key, sizeof(key)); + memset (&ictx, 0x00, sizeof(ictx)); + memset (&octx, 0x00, sizeof(octx)); + memset (isha, 0x00, sizeof(isha)); + memset (osha, 0x00, sizeof(osha)); + memset (buf, 0x00, sizeof(buf)); + memset (key, 0x00, sizeof(key)); } @@ -277,8 +275,8 @@ void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterat } /* Prevent possible leaks. */ - burn (j, sizeof(j)); - burn (k, sizeof(k)); + memset (j, 0x00, sizeof(j)); + memset (k, 0x00, sizeof(k)); } @@ -313,7 +311,7 @@ void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iter /* Prevent possible leaks. */ - burn (u, sizeof(u)); + memset (u, 0x00, sizeof(u)); } @@ -338,7 +336,7 @@ void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest) key = (char *) tk; keylen = RIPEMD160_DIGESTSIZE; - burn (&tctx, sizeof(tctx)); // Prevent leaks + memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks } /* @@ -377,10 +375,10 @@ void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest) RMD160Final((uint8_t *) digest, &context); /* finish up 2nd pass */ /* Prevent possible leaks. */ - burn (k_ipad, sizeof(k_ipad)); - burn (k_opad, sizeof(k_opad)); - burn (tk, sizeof(tk)); - burn (&context, sizeof(context)); + memset (k_ipad, 0x00, sizeof(k_ipad)); + memset (k_opad, 0x00, sizeof(k_opad)); + memset (tk, 0x00, sizeof(tk)); + memset (&context, 0x00, sizeof(context)); } void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) @@ -410,8 +408,8 @@ void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int i } /* Prevent possible leaks. */ - burn (j, sizeof(j)); - burn (k, sizeof(k)); + memset (j, 0x00, sizeof(j)); + memset (k, 0x00, sizeof(k)); } void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) @@ -444,7 +442,7 @@ void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int /* Prevent possible leaks. */ - burn (u, sizeof(u)); + memset (u, 0x00, sizeof(u)); } void hmac_whirlpool @@ -476,7 +474,7 @@ void hmac_whirlpool k = key; lk = WHIRLPOOL_DIGESTSIZE; - burn (&tctx, sizeof(tctx)); // Prevent leaks + memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks } /**** Inner Digest ****/ @@ -513,12 +511,12 @@ void hmac_whirlpool hmac_truncate (owhi, out, t); /* Prevent possible leaks. */ - burn (&ictx, sizeof(ictx)); - burn (&octx, sizeof(octx)); - burn (owhi, sizeof(owhi)); - burn (iwhi, sizeof(iwhi)); - burn (buf, sizeof(buf)); - burn (key, sizeof(key)); + memset (&ictx, 0x00, sizeof(ictx)); + memset (&octx, 0x00, sizeof(octx)); + memset (owhi, 0x00, sizeof(owhi)); + memset (iwhi, 0x00, sizeof(iwhi)); + memset (buf, 0x00, sizeof(buf)); + memset (key, 0x00, sizeof(key)); } void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) @@ -548,8 +546,8 @@ void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int i } /* Prevent possible leaks. */ - burn (j, sizeof(j)); - burn (k, sizeof(k)); + memset (j, 0x00, sizeof(j)); + memset (k, 0x00, sizeof(k)); } void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) @@ -582,7 +580,7 @@ void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int /* Prevent possible leaks. */ - burn (u, sizeof(u)); + memset (u, 0x00, sizeof(u)); } @@ -625,7 +623,7 @@ int get_pkcs5_iteration_count (int pkcs5_prf_id, int bBoot) return 1000; default: - TC_THROW_FATAL_EXCEPTION; // Unknown/wrong ID + fatal("get_pkcs5_iteration_count(): Unknown/wrong ID\n"); // Unknown/wrong ID } return 0; } diff --git a/src/utils/common/pkcs5.h b/src/utils/common/pkcs5.h index efd2cc9ed56..4e05753dd49 100644 --- a/src/utils/common/pkcs5.h +++ b/src/utils/common/pkcs5.h @@ -9,10 +9,8 @@ file License.txt included in TrueCrypt binary and source code distribution packages. */ -#ifndef TC_HEADER_PKCS5 -#define TC_HEADER_PKCS5 - -#include "tcdefs.h" +#ifndef HEADER_PKCS5 +#define HEADER_PKCS5 #if defined(__cplusplus) extern "C" @@ -38,4 +36,4 @@ char *get_pkcs5_prf_name (int pkcs5_prf_id); } #endif -#endif // TC_HEADER_PKCS5 +#endif // HEADER_PKCS5 diff --git a/src/utils/common/tcdefs.h b/src/utils/common/tcdefs.h deleted file mode 100644 index 3da186fa870..00000000000 --- a/src/utils/common/tcdefs.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#ifndef TCDEFS_H -#define TCDEFS_H - -#include -#include -#include - -#include <86box/86box.h> - -#define TC_APP_NAME "TrueCrypt" - -// Version displayed to user -#define VERSION_STRING "5.1a" - -// Version number to compare against driver -#define VERSION_NUM 0x051a - -// Version number written to volume header during format, -// specifies the minimum program version required to mount the volume -#define VOL_REQ_PROG_VERSION 0x0500 - -// Volume header version -#define VOLUME_HEADER_VERSION 0x0003 - -// Sector size of encrypted filesystem, which may differ from sector size -// of host filesystem/device (this is fully supported since v4.3). -#define SECTOR_SIZE 512 - -#define BYTES_PER_KB 1024LL -#define BYTES_PER_MB 1048576LL -#define BYTES_PER_GB 1073741824LL -#define BYTES_PER_TB 1099511627776LL -#define BYTES_PER_PB 1125899906842624LL - -/* GUI/driver errors */ - -#define MAX_128BIT_BLOCK_VOLUME_SIZE BYTES_PER_PB // Security bound (128-bit block XTS mode) -#define MAX_VOLUME_SIZE_GENERAL 0x7fffFFFFffffFFFFLL // Signed 64-bit integer file offset values -#define MAX_VOLUME_SIZE MAX_128BIT_BLOCK_VOLUME_SIZE -#define MIN_FAT_VOLUME_SIZE 19456 -#define MAX_FAT_VOLUME_SIZE 0x20000000000LL -#define MIN_NTFS_VOLUME_SIZE 2634752 -#define OPTIMAL_MIN_NTFS_VOLUME_SIZE (4 * BYTES_PER_GB) -#define MAX_NTFS_VOLUME_SIZE (128LL * BYTES_PER_TB) // NTFS volume can theoretically be up to 16 exabytes, but Windows XP and 2003 limit the size to that addressable with 32-bit clusters, i.e. max size is 128 TB (if 64-KB clusters are used). -#define MAX_HIDDEN_VOLUME_HOST_SIZE MAX_NTFS_VOLUME_SIZE -#define MAX_HIDDEN_VOLUME_SIZE ( MAX_HIDDEN_VOLUME_HOST_SIZE - HIDDEN_VOL_HEADER_OFFSET - HEADER_SIZE ) -#define MIN_VOLUME_SIZE MIN_FAT_VOLUME_SIZE -#define MIN_HIDDEN_VOLUME_HOST_SIZE ( MIN_VOLUME_SIZE * 2 + HIDDEN_VOL_HEADER_OFFSET + HEADER_SIZE ) - -#ifndef TC_NO_COMPILER_INT64 -#if MAX_VOLUME_SIZE > MAX_VOLUME_SIZE_GENERAL -#error MAX_VOLUME_SIZE must be less than or equal to MAX_VOLUME_SIZE_GENERAL -#endif -#endif - -#define TCalloc(X) calloc(1, X) -#define TCfree free - -#define WIDE(x) (LPWSTR)L##x - -typedef int8_t int8; -typedef int16_t int16; -typedef int32_t int32; -typedef uint8_t byte; -typedef uint16_t uint16; -typedef uint32_t uint32; - -#ifdef TC_NO_COMPILER_INT64 -typedef uint32_t TC_LARGEST_COMPILER_UINT; -#else -typedef uint64_t TC_LARGEST_COMPILER_UINT; -typedef int64_t int64; -typedef uint64_t uint64; -#endif - -// Needed by Cryptolib -typedef uint8_t uint_8t; -typedef uint16_t uint_16t; -typedef uint32_t uint_32t; -#ifndef TC_NO_COMPILER_INT64 -typedef uint64_t uint_64t; -#endif - -typedef union -{ - struct - { - uint32_t LowPart; - uint32_t HighPart; - }; -#ifndef TC_NO_COMPILER_INT64 - uint64_t Value; -#endif - -} UINT64_STRUCT; - - -#ifdef ORIGINAL_FATAL -#define TC_THROW_FATAL_EXCEPTION *(char *) 0 = 0 -#else -#define TC_THROW_FATAL_EXCEPTION fatal("TrueCrypt: Fatal exception"); -#endif - -#define burn(mem,size) do { volatile char *burnm = (volatile char *)(mem); int burnc = size; while (burnc--) *burnm++ = 0; } while (0) - -// The size of the memory area to wipe is in bytes amd it must be a multiple of 8. -#ifndef TC_NO_COMPILER_INT64 -# define FAST_ERASE64(mem,size) do { volatile uint64_t *burnm = (volatile uint64_t *)(mem); int burnc = size >> 3; while (burnc--) *burnm++ = 0; } while (0) -#else -# define FAST_ERASE64(mem,size) do { volatile uint32_t *burnm = (volatile uint32_t *)(mem); int burnc = size >> 2; while (burnc--) *burnm++ = 0; } while (0) -#endif - - -#ifdef MAX_PATH -#define TC_MAX_PATH MAX_PATH -#else -#define TC_MAX_PATH 260 /* Includes the null terminator */ -#endif - -#define MAX_URL_LENGTH 2084 /* Internet Explorer limit. Includes the terminating null character. */ - - -enum -{ - /* WARNING: Add any new codes at the end (do NOT insert them between existing). Do NOT delete any - existing codes. Changing these values or their meanings may cause incompatibility with other - versions (for example, if a new version of the TrueCrypt installer receives an error code from - an installed driver whose version is lower, it will interpret the error incorrectly). */ - - ERR_SUCCESS = 0, - ERR_OS_ERROR = 1, - ERR_OUTOFMEMORY, - ERR_PASSWORD_WRONG, - ERR_VOL_FORMAT_BAD, - ERR_DRIVE_NOT_FOUND, - ERR_FILES_OPEN, - ERR_VOL_SIZE_WRONG, - ERR_COMPRESSION_NOT_SUPPORTED, - ERR_PASSWORD_CHANGE_VOL_TYPE, - ERR_PASSWORD_CHANGE_VOL_VERSION, - ERR_VOL_SEEKING, - ERR_VOL_WRITING, - ERR_FILES_OPEN_LOCK, - ERR_VOL_READING, - ERR_DRIVER_VERSION, - ERR_NEW_VERSION_REQUIRED, - ERR_CIPHER_INIT_FAILURE, - ERR_CIPHER_INIT_WEAK_KEY, - ERR_SELF_TESTS_FAILED, - ERR_SECTOR_SIZE_INCOMPATIBLE, - ERR_VOL_ALREADY_MOUNTED, - ERR_NO_FREE_DRIVES, - ERR_FILE_OPEN_FAILED, - ERR_VOL_MOUNT_FAILED, - ERR_INVALID_DEVICE, - ERR_ACCESS_DENIED, - ERR_MODE_INIT_FAILED, - ERR_DONT_REPORT, - ERR_ENCRYPTION_NOT_COMPLETED, - ERR_PARAMETER_INCORRECT -}; - -#endif // #ifndef TCDEFS_H diff --git a/src/utils/common/xts.c b/src/utils/common/xts.c index 47fcc2f90ad..0b73da5547a 100644 --- a/src/utils/common/xts.c +++ b/src/utils/common/xts.c @@ -6,31 +6,6 @@ distribution packages. */ -/* For low-memory environments, define XTS_LOW_RESOURCE_VERSION, which will save -0.5 KB of RAM, but the speed will be 15-20% lower. However, on multi-core CPUs, -the XTS_LOW_RESOURCE_VERSION code might eventually be faster when parallelized, -because it processes the buffer continuously as a whole -- it does not divide the -buffer into data units (nevertheless, note that GenerateWhiteningValues supports -more than one data unit). - -Note that when TC_NO_COMPILER_INT64 is defined, XTS_LOW_RESOURCE_VERSION is implicitly -defined as well (because the non-low-resource version needs 64-bit types). - -For big-endian platforms (PowerPC, SPARC, etc.) define BYTE_ORDER as BIG_ENDIAN. */ - - -#ifdef TC_MINIMIZE_CODE_SIZE -# define XTS_LOW_RESOURCE_VERSION -# pragma optimize ("tl", on) -#endif - -#ifdef TC_NO_COMPILER_INT64 -# ifndef XTS_LOW_RESOURCE_VERSION -# define XTS_LOW_RESOURCE_VERSION -# endif -#endif - - #include "xts.h" @@ -47,7 +22,7 @@ For big-endian platforms (PowerPC, SPARC, etc.) define BYTE_ORDER as BIG_ENDIAN. // aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it // is not aligned, startCipherBlockNo must reflect the misalignment accordingly. void EncryptBufferXTS (uint8_t *buffer, - TC_LARGEST_COMPILER_UINT length, + uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, @@ -63,7 +38,7 @@ void EncryptBufferXTS (uint8_t *buffer, uint64_t *bufPtr = (uint64_t *) buffer; unsigned int startBlock = startCipherBlockNo, endBlock, block; uint64_t *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; - TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; + uint64_t blockCount, dataUnitNo; /* The encrypted data unit number (i.e. the resultant ciphertext block) is to be multiplied in the finite field GF(2^128) by j-th power of n, where j is the sequential plaintext/ciphertext block @@ -79,7 +54,7 @@ void EncryptBufferXTS (uint8_t *buffer, *((uint64_t *) byteBufUnitNo + 1) = 0; if (length % BYTES_PER_XTS_BLOCK) - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBufferXTS: Length not divisible by %i\n", BYTES_PER_XTS_BLOCK); blockCount = length / BYTES_PER_XTS_BLOCK; @@ -177,14 +152,14 @@ void EncryptBufferXTS (uint8_t *buffer, *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); } - FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); - FAST_ERASE64 (whiteningValues, sizeof(whiteningValues)); + memset (whiteningValue, 0x00, sizeof(whiteningValue)); + memset (whiteningValues, 0x00, sizeof(whiteningValues)); } // For descriptions of the input parameters, see EncryptBufferXTS(). void DecryptBufferXTS (uint8_t *buffer, - TC_LARGEST_COMPILER_UINT length, + uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, @@ -200,7 +175,7 @@ void DecryptBufferXTS (uint8_t *buffer, uint64_t *bufPtr = (uint64_t *) buffer; unsigned int startBlock = startCipherBlockNo, endBlock, block; uint64_t *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; - TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; + uint64_t blockCount, dataUnitNo; // Convert the 64-bit data unit number into a little-endian 16-byte array. // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. @@ -209,7 +184,7 @@ void DecryptBufferXTS (uint8_t *buffer, *((uint64_t *) byteBufUnitNo + 1) = 0; if (length % BYTES_PER_XTS_BLOCK) - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptBufferXTS: Length not divisible by %i\n", BYTES_PER_XTS_BLOCK); blockCount = length / BYTES_PER_XTS_BLOCK; @@ -304,8 +279,8 @@ void DecryptBufferXTS (uint8_t *buffer, *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); } - FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); - FAST_ERASE64 (whiteningValues, sizeof(whiteningValues)); + memset (whiteningValue, 0x00, sizeof(whiteningValue)); + memset (whiteningValues, 0x00, sizeof(whiteningValues)); } @@ -317,7 +292,7 @@ void DecryptBufferXTS (uint8_t *buffer, // are stored in memory as a sequence of 64-bit integers in reverse order. For descriptions of the input // parameters, see EncryptBufferXTS(). static void GenerateWhiteningValues (uint64_t *bufPtr64, - TC_LARGEST_COMPILER_UINT length, + uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startBlock, uint8_t *ks2, @@ -330,7 +305,7 @@ static void GenerateWhiteningValues (uint64_t *bufPtr64, uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; uint8_t finalCarry; uint64_t *const finalInt64WhiteningValuePtr = whiteningValuePtr64 + sizeof (whiteningValue) / sizeof (*whiteningValuePtr64) - 1; - TC_LARGEST_COMPILER_UINT blockCount, dataUnitNo; + uint64_t blockCount, dataUnitNo; dataUnitNo = startDataUnitNo->Value; @@ -415,7 +390,7 @@ static void GenerateWhiteningValues (uint64_t *bufPtr64, *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); } - FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); + memset (whiteningValue, 0x00, sizeof(whiteningValue)); } #endif // #if 0 @@ -431,14 +406,7 @@ static void GenerateWhiteningValues (uint64_t *bufPtr64, // Increases a 64-bit value by one in a way compatible with non-64-bit environments/platforms static void IncUint64Struct (UINT64_STRUCT *uint64Struct) { -#ifdef TC_NO_COMPILER_INT64 - if (!++uint64Struct->LowPart) - { - uint64Struct->HighPart++; - } -#else uint64Struct->Value++; -#endif } @@ -460,13 +428,13 @@ static void Uint64ToLE16ByteArray (uint8_t *byteBuf, unsigned __int32 highInt32, // Generates and XORs XTS whitening values into blocks in the buffer. // For descriptions of the input parameters, see EncryptBufferXTS(). static void WhiteningPass (uint8_t *buffer, - TC_LARGEST_COMPILER_UINT length, + uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startBlock, uint8_t *ks2, int cipher) { - TC_LARGEST_COMPILER_UINT blockCount; + uint64_t blockCount; UINT64_STRUCT dataUnitNo; unsigned int block; unsigned int endBlock; @@ -555,7 +523,7 @@ static void WhiteningPass (uint8_t *buffer, Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); } - FAST_ERASE64 (whiteningValue, sizeof(whiteningValue)); + memset (whiteningValue, 0x00, sizeof(whiteningValue)); } @@ -570,18 +538,18 @@ static void WhiteningPass (uint8_t *buffer, // aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it // is not aligned, startCipherBlockNo must reflect the misalignment accordingly. void EncryptBufferXTS (uint8_t *buffer, - TC_LARGEST_COMPILER_UINT length, + uint64_t length, const UINT64_STRUCT *dataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher) { - TC_LARGEST_COMPILER_UINT blockCount; + uint64_t blockCount; uint8_t *bufPtr = buffer; if (length % BYTES_PER_XTS_BLOCK) - TC_THROW_FATAL_EXCEPTION; + fatal("EncryptBufferXTS(): Length not divisibly by %i\n", BYTES_PER_XTS_BLOCK); // Pre-whitening (all plaintext blocks in the buffer) WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); @@ -600,18 +568,18 @@ void EncryptBufferXTS (uint8_t *buffer, // For descriptions of the input parameters, see EncryptBufferXTS(). void DecryptBufferXTS (uint8_t *buffer, - TC_LARGEST_COMPILER_UINT length, + uint64_t length, const UINT64_STRUCT *dataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher) { - TC_LARGEST_COMPILER_UINT blockCount; + uint64_t blockCount; uint8_t *bufPtr = buffer; if (length % BYTES_PER_XTS_BLOCK) - TC_THROW_FATAL_EXCEPTION; + fatal("DecryptBufferXTS(): Length not disivibly by %i\n", BYTES_PER_XTS_BLOCK); WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); diff --git a/src/utils/common/xts.h b/src/utils/common/xts.h index cce7877b8df..509c7403fa8 100644 --- a/src/utils/common/xts.h +++ b/src/utils/common/xts.h @@ -13,7 +13,6 @@ #include -#include "tcdefs.h" #include "../common/endian.h" #include "crypto.h" @@ -43,34 +42,18 @@ extern "C" { #endif // Custom data types - -#ifndef TC_LARGEST_COMPILER_UINT -# ifdef TC_NO_COMPILER_INT64 - typedef uint32_t TC_LARGEST_COMPILER_UINT; -# else - typedef uint64_t TC_LARGEST_COMPILER_UINT; -# endif -#endif - -#ifndef TCDEFS_H -typedef union -{ - struct - { - uint32_t LowPart; - uint32_t HighPart; - }; -# ifndef TC_NO_COMPILER_INT64 - uint64_t Value; -# endif - +typedef union { + struct { + uint32_t LowPart; + uint32_t HighPart; + }; + uint64_t Value; } UINT64_STRUCT; -#endif // Public function prototypes -void EncryptBufferXTS (uint8_t *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); -void DecryptBufferXTS (uint8_t *buffer, TC_LARGEST_COMPILER_UINT length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); +void EncryptBufferXTS (uint8_t *buffer, uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); +void DecryptBufferXTS (uint8_t *buffer, uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); #ifdef __cplusplus } diff --git a/src/utils/crypto/aes.h b/src/utils/crypto/aes.h index e8ae33e9da2..42136fb519a 100644 --- a/src/utils/crypto/aes.h +++ b/src/utils/crypto/aes.h @@ -33,7 +33,10 @@ #ifndef _AES_H #define _AES_H -#include "../common/tcdefs.h" +#include + +#define uint_32t uint32_t +#define uint_8t uint8_t #ifndef EXIT_SUCCESS #define EXIT_SUCCESS 0 diff --git a/src/utils/crypto/aesopt.h b/src/utils/crypto/aesopt.h index 1a977822229..8a76dc6dee2 100644 --- a/src/utils/crypto/aesopt.h +++ b/src/utils/crypto/aesopt.h @@ -302,9 +302,7 @@ If this section is included, tables are used to provide faster finite field arithmetic (this has no effect if FIXED_TABLES is defined). */ -#if !defined (TC_WINDOWS_BOOT) #define FF_TABLES -#endif /* 7. INTERNAL STATE VARIABLE FORMAT @@ -323,7 +321,7 @@ statically into the binary file. Otherwise the subroutine aes_init() must be called to compute them before the code is first used. */ -#if !defined (TC_WINDOWS_BOOT) && !(defined( _MSC_VER ) && ( _MSC_VER <= 800 )) +#if !(defined( _MSC_VER ) && ( _MSC_VER <= 800 )) #define FIXED_TABLES #endif diff --git a/src/utils/crypto/aestab.c b/src/utils/crypto/aestab.c index 07102a978c5..d0cf1912ba2 100644 --- a/src/utils/crypto/aestab.c +++ b/src/utils/crypto/aestab.c @@ -263,47 +263,9 @@ static uint_8t fi(const uint_8t x) static int init = 0; -#ifdef TC_WINDOWS_BOOT - -#pragma optimize ("l", on) -uint_8t aes_enc_tab[256][8]; -uint_8t aes_dec_tab[256][8]; - -#endif - AES_RETURN aes_init(void) { uint_32t i, w; -#ifdef TC_WINDOWS_BOOT - - if (init) - return EXIT_SUCCESS; - - for (i = 0; i < 256; ++i) - { - uint_8t x = fwd_affine(fi((uint_8t)i)); - aes_enc_tab[i][0] = 0; - aes_enc_tab[i][1] = x; - aes_enc_tab[i][2] = x; - aes_enc_tab[i][3] = f3(x); - aes_enc_tab[i][4] = f2(x); - aes_enc_tab[i][5] = x; - aes_enc_tab[i][6] = x; - aes_enc_tab[i][7] = f3(x); - - x = fi((uint_8t)inv_affine((uint_8t)i)); - aes_dec_tab[i][0] = fe(x); - aes_dec_tab[i][1] = f9(x); - aes_dec_tab[i][2] = fd(x); - aes_dec_tab[i][3] = fb(x); - aes_dec_tab[i][4] = fe(x); - aes_dec_tab[i][5] = f9(x); - aes_dec_tab[i][6] = fd(x); - aes_dec_tab[i][7] = x; - } - -#else // TC_WINDOWS_BOOT - #if defined(FF_TABLES) uint_8t pow[512], log[256]; @@ -414,8 +376,6 @@ AES_RETURN aes_init(void) #endif } -#endif // TC_WINDOWS_BOOT - init = 1; return EXIT_SUCCESS; } diff --git a/src/utils/crypto/rmd160.c b/src/utils/crypto/rmd160.c index 7a273022f89..85c0bf444ba 100644 --- a/src/utils/crypto/rmd160.c +++ b/src/utils/crypto/rmd160.c @@ -91,20 +91,12 @@ #define X(i) x[i] -#ifndef TC_MINIMIZE_CODE_SIZE - static u_char PADDING[64] = { 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -#else - -static u_char PADDING[64]; - -#endif - void RMD160Init(RMD160_CTX *ctx) { @@ -157,12 +149,7 @@ void RMD160Final(u_char digest[20], RMD160_CTX *ctx) u_char size[8]; u_int32_t padlen; -#ifndef TC_NO_COMPILER_INT64 PUT_64BIT_LE(size, ctx->count); -#else - *(uint32_t *) (size + 4) = 0; - PUT_32BIT_LE(size, ctx->count); -#endif /* * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes * for the size @@ -180,8 +167,6 @@ void RMD160Final(u_char digest[20], RMD160_CTX *ctx) memset(ctx, 0, sizeof (*ctx)); } -#ifndef TC_MINIMIZE_CODE_SIZE - void RMD160Transform(u_int32_t state[5], const u_char block[64]) { @@ -393,118 +378,3 @@ RMD160Transform(u_int32_t state[5], const u_char block[64]) state[4] = state[0] + bb + c; state[0] = t; } - -#else // TC_MINIMIZE_CODE_SIZE - -/* - Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. - - Governed by the TrueCrypt License 2.4 the full text of which is contained - in the file License.txt included in TrueCrypt binary and source code - distribution packages. -*/ - -#pragma optimize ("tl", on) - -typedef uint32_t uint32; -typedef unsigned __int8 byte; - -static const byte OrderTab[] = { - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, - 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, - 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, - 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13, - 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, - 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, - 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, - 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, - 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 -}; - -static const byte RolTab[] = { - 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, - 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, - 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, - 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, - 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6, - 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, - 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, - 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, - 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, - 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 -}; - -static const uint32 KTab[] = { - 0x00000000UL, - 0x5A827999UL, - 0x6ED9EBA1UL, - 0x8F1BBCDCUL, - 0xA953FD4EUL, - 0x50A28BE6UL, - 0x5C4DD124UL, - 0x6D703EF3UL, - 0x7A6D76E9UL, - 0x00000000UL -}; - - -void RMD160Transform (u_int32_t state[5], const u_char block[64]) -{ - uint32 a, b, c, d, e; - uint32 a2, b2, c2, d2, e2; - uint32 *data = (uint32 *) block; - byte pos; - uint32 tmp; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - for (pos = 0; pos < 160; ++pos) - { - tmp = a + data[OrderTab[pos]] + KTab[pos >> 4]; - - switch (pos >> 4) - { - case 0: case 9: tmp += F0 (b, c, d); break; - case 1: case 8: tmp += F1 (b, c, d); break; - case 2: case 7: tmp += F2 (b, c, d); break; - case 3: case 6: tmp += F3 (b, c, d); break; - case 4: case 5: tmp += F4 (b, c, d); break; - } - - tmp = ROL (RolTab[pos], tmp) + e; - a = e; - e = d; - d = ROL (10, c); - c = b; - b = tmp; - - if (pos == 79) - { - a2 = a; - b2 = b; - c2 = c; - d2 = d; - e2 = e; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - } - } - - tmp = state[1] + c2 + d; - state[1] = state[2] + d2 + e; - state[2] = state[3] + e2 + a; - state[3] = state[4] + a2 + b; - state[4] = state[0] + b2 + c; - state[0] = tmp; -} - -#endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/utils/crypto/rmd160.h b/src/utils/crypto/rmd160.h index c97f65439c2..4e7cb310842 100644 --- a/src/utils/crypto/rmd160.h +++ b/src/utils/crypto/rmd160.h @@ -43,11 +43,7 @@ extern "C" /* RMD160 context. */ typedef struct RMD160Context { u_int32_t state[5]; /* state */ -#ifndef TC_NO_COMPILER_INT64 u_int64_t count; /* number of bits, modulo 2^64 */ -#else - u_int32_t count; -#endif u_char buffer[64]; /* input buffer */ } RMD160_CTX; diff --git a/src/utils/crypto/serpent.c b/src/utils/crypto/serpent.c index 5edf17c3d23..f088a619469 100644 --- a/src/utils/crypto/serpent.c +++ b/src/utils/crypto/serpent.c @@ -433,200 +433,6 @@ d ^= k[4 * r + 3];} -#ifdef TC_MINIMIZE_CODE_SIZE - -static void S0f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r3 ^= *r0; - *r4 = *r1; - *r1 &= *r3; - *r4 ^= *r2; - *r1 ^= *r0; - *r0 |= *r3; - *r0 ^= *r4; - *r4 ^= *r3; - *r3 ^= *r2; - *r2 |= *r1; - *r2 ^= *r4; - *r4 = ~*r4; - *r4 |= *r1; - *r1 ^= *r3; - *r1 ^= *r4; - *r3 |= *r0; - *r1 ^= *r3; - *r4 ^= *r3; -} - -static void S1f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r0 = ~*r0; - *r2 = ~*r2; - *r4 = *r0; - *r0 &= *r1; - *r2 ^= *r0; - *r0 |= *r3; - *r3 ^= *r2; - *r1 ^= *r0; - *r0 ^= *r4; - *r4 |= *r1; - *r1 ^= *r3; - *r2 |= *r0; - *r2 &= *r4; - *r0 ^= *r1; - *r1 &= *r2; - *r1 ^= *r0; - *r0 &= *r2; - *r0 ^= *r4; -} - -static void S2f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r4 = *r0; - *r0 &= *r2; - *r0 ^= *r3; - *r2 ^= *r1; - *r2 ^= *r0; - *r3 |= *r4; - *r3 ^= *r1; - *r4 ^= *r2; - *r1 = *r3; - *r3 |= *r4; - *r3 ^= *r0; - *r0 &= *r1; - *r4 ^= *r0; - *r1 ^= *r3; - *r1 ^= *r4; - *r4 = ~*r4; -} - -static void S3f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r4 = *r0; - *r0 |= *r3; - *r3 ^= *r1; - *r1 &= *r4; - *r4 ^= *r2; - *r2 ^= *r3; - *r3 &= *r0; - *r4 |= *r1; - *r3 ^= *r4; - *r0 ^= *r1; - *r4 &= *r0; - *r1 ^= *r3; - *r4 ^= *r2; - *r1 |= *r0; - *r1 ^= *r2; - *r0 ^= *r3; - *r2 = *r1; - *r1 |= *r3; - *r1 ^= *r0; -} - -static void S4f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r1 ^= *r3; - *r3 = ~*r3; - *r2 ^= *r3; - *r3 ^= *r0; - *r4 = *r1; - *r1 &= *r3; - *r1 ^= *r2; - *r4 ^= *r3; - *r0 ^= *r4; - *r2 &= *r4; - *r2 ^= *r0; - *r0 &= *r1; - *r3 ^= *r0; - *r4 |= *r1; - *r4 ^= *r0; - *r0 |= *r3; - *r0 ^= *r2; - *r2 &= *r3; - *r0 = ~*r0; - *r4 ^= *r2; -} - -static void S5f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r0 ^= *r1; - *r1 ^= *r3; - *r3 = ~*r3; - *r4 = *r1; - *r1 &= *r0; - *r2 ^= *r3; - *r1 ^= *r2; - *r2 |= *r4; - *r4 ^= *r3; - *r3 &= *r1; - *r3 ^= *r0; - *r4 ^= *r1; - *r4 ^= *r2; - *r2 ^= *r0; - *r0 &= *r3; - *r2 = ~*r2; - *r0 ^= *r4; - *r4 |= *r3; - *r2 ^= *r4; -} - -static void S6f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r2 = ~*r2; - *r4 = *r3; - *r3 &= *r0; - *r0 ^= *r4; - *r3 ^= *r2; - *r2 |= *r4; - *r1 ^= *r3; - *r2 ^= *r0; - *r0 |= *r1; - *r2 ^= *r1; - *r4 ^= *r0; - *r0 |= *r3; - *r0 ^= *r2; - *r4 ^= *r3; - *r4 ^= *r0; - *r3 = ~*r3; - *r2 &= *r4; - *r2 ^= *r3; -} - -static void S7f (uint32_t *r0, uint32_t *r1, uint32_t *r2, uint32_t *r3, uint32_t *r4) -{ - *r4 = *r2; - *r2 &= *r1; - *r2 ^= *r3; - *r3 &= *r1; - *r4 ^= *r2; - *r2 ^= *r1; - *r1 ^= *r0; - *r0 |= *r4; - *r0 ^= *r2; - *r3 ^= *r1; - *r2 ^= *r3; - *r3 &= *r0; - *r3 ^= *r4; - *r4 ^= *r2; - *r2 &= *r0; - *r4 = ~*r4; - *r2 ^= *r4; - *r4 &= *r0; - *r1 ^= *r3; - *r4 ^= *r1; -} - -static void KXf (const uint32_t *k, unsigned int r, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) -{ - *a ^= k[r]; - *b ^= k[r + 1]; - *c ^= k[r + 2]; - *d ^= k[r + 3]; -} - -#endif // TC_MINIMIZE_CODE_SIZE - -#ifndef TC_MINIMIZE_CODE_SIZE - void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks) { uint32_t a,b,c,d,e; @@ -673,63 +479,6 @@ void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks) afterS2(LK); afterS2(S3); afterS3(SK); } -#else // TC_MINIMIZE_CODE_SIZE - -static void LKf (uint32_t *k, unsigned int r, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) -{ - *a = k[r]; - *b = k[r + 1]; - *c = k[r + 2]; - *d = k[r + 3]; -} - -static void SKf (uint32_t *k, unsigned int r, uint32_t *a, uint32_t *b, uint32_t *c, uint32_t *d) -{ - k[r + 4] = *a; - k[r + 5] = *b; - k[r + 6] = *c; - k[r + 7] = *d; -} - -void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks) -{ - uint32_t a,b,c,d,e; - uint32_t *k = (uint32_t *)ks; - uint32_t t; - int i; - - for (i = 0; i < keylen / (int)sizeof(__int32); i++) - k[i] = LE32(((uint32_t*)userKey)[i]); - - if (keylen < 32) - k[keylen/4] |= (uint32_t)1 << ((keylen%4)*8); - - k += 8; - t = k[-1]; - for (i = 0; i < 132; ++i) - k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11); - k -= 20; - - for (i=0; i<4; i++) - { - LKf (k, 20, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); SKf (k, 16, &e, &b, &d, &c); - LKf (k, 24, &c, &b, &a, &e); S2f (&c, &b, &a, &e, &d); SKf (k, 20, &a, &e, &b, &d); - LKf (k, 28, &b, &e, &c, &a); S1f (&b, &e, &c, &a, &d); SKf (k, 24, &c, &b, &a, &e); - LKf (k, 32, &a, &b, &c, &d); S0f (&a, &b, &c, &d, &e); SKf (k, 28, &b, &e, &c, &a); - k += 8*4; - LKf (k, 4, &a, &c, &d, &b); S7f (&a, &c, &d, &b, &e); SKf (k, 0, &d, &e, &b, &a); - LKf (k, 8, &a, &c, &b, &e); S6f (&a, &c, &b, &e, &d); SKf (k, 4, &a, &c, &d, &b); - LKf (k, 12, &b, &a, &e, &c); S5f (&b, &a, &e, &c, &d); SKf (k, 8, &a, &c, &b, &e); - LKf (k, 16, &e, &b, &d, &c); S4f (&e, &b, &d, &c, &a); SKf (k, 12, &b, &a, &e, &c); - } - LKf (k, 20, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); SKf (k, 16, &e, &b, &d, &c); -} - -#endif // TC_MINIMIZE_CODE_SIZE - - -#ifndef TC_MINIMIZE_CODE_SIZE - void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) { uint32_t a, b, c, d, e; @@ -776,70 +525,6 @@ void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) out[3] = LE32(a); } -#else // TC_MINIMIZE_CODE_SIZE - -typedef uint32_t uint32; - -static void LTf (uint32 *a, uint32 *b, uint32 *c, uint32 *d) -{ - *a = rotlFixed(*a, 13); - *c = rotlFixed(*c, 3); - *d = rotlFixed(*d ^ *c ^ (*a << 3), 7); - *b = rotlFixed(*b ^ *a ^ *c, 1); - *a = rotlFixed(*a ^ *b ^ *d, 5); - *c = rotlFixed(*c ^ *d ^ (*b << 7), 22); -} - -void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) -{ - uint32_t a, b, c, d, e; - unsigned int i=1; - const uint32_t *k = (uint32_t *)ks + 8; - uint32_t *in = (uint32_t *) inBlock; - uint32_t *out = (uint32_t *) outBlock; - - a = LE32(in[0]); - b = LE32(in[1]); - c = LE32(in[2]); - d = LE32(in[3]); - - do - { - KXf (k, 0, &a, &b, &c, &d); S0f (&a, &b, &c, &d, &e); LTf (&b, &e, &c, &a); - KXf (k, 4, &b, &e, &c, &a); S1f (&b, &e, &c, &a, &d); LTf (&c, &b, &a, &e); - KXf (k, 8, &c, &b, &a, &e); S2f (&c, &b, &a, &e, &d); LTf (&a, &e, &b, &d); - KXf (k, 12, &a, &e, &b, &d); S3f (&a, &e, &b, &d, &c); LTf (&e, &b, &d, &c); - KXf (k, 16, &e, &b, &d, &c); S4f (&e, &b, &d, &c, &a); LTf (&b, &a, &e, &c); - KXf (k, 20, &b, &a, &e, &c); S5f (&b, &a, &e, &c, &d); LTf (&a, &c, &b, &e); - KXf (k, 24, &a, &c, &b, &e); S6f (&a, &c, &b, &e, &d); LTf (&a, &c, &d, &b); - KXf (k, 28, &a, &c, &d, &b); S7f (&a, &c, &d, &b, &e); - - if (i == 4) - break; - - ++i; - c = b; - b = e; - e = d; - d = a; - a = e; - k += 32; - LTf (&a,&b,&c,&d); - } - while (1); - - KXf (k, 32, &d, &e, &b, &a); - - out[0] = LE32(d); - out[1] = LE32(e); - out[2] = LE32(b); - out[3] = LE32(a); -} - -#endif // TC_MINIMIZE_CODE_SIZE - -#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_SERPENT) - void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) { uint32_t a, b, c, d, e; @@ -880,61 +565,3 @@ void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) out[2] = LE32(b); out[3] = LE32(e); } - -#else // TC_MINIMIZE_CODE_SIZE && !TC_WINDOWS_BOOT_SERPENT - -static void ILTf (uint32 *a, uint32 *b, uint32 *c, uint32 *d) -{ - *c = rotrFixed(*c, 22); - *a = rotrFixed(*a, 5); - *c ^= *d ^ (*b << 7); - *a ^= *b ^ *d; - *b = rotrFixed(*b, 1); - *d = rotrFixed(*d, 7) ^ *c ^ (*a << 3); - *b ^= *a ^ *c; - *c = rotrFixed(*c, 3); - *a = rotrFixed(*a, 13); -} - -void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) -{ - uint32_t a, b, c, d, e; - const uint32_t *k = (uint32_t *)ks + 104; - unsigned int i=4; - uint32_t *in = (uint32_t *) inBlock; - uint32_t *out = (uint32_t *) outBlock; - - a = LE32(in[0]); - b = LE32(in[1]); - c = LE32(in[2]); - d = LE32(in[3]); - - KXf (k, 32, &a, &b, &c, &d); - goto start; - - do - { - c = b; - b = d; - d = e; - k -= 32; - beforeI7(ILT); -start: - beforeI7(I7); KXf (k, 28, &d, &a, &b, &e); - ILTf (&d, &a, &b, &e); afterI7(I6); KXf (k, 24, &a, &b, &c, &e); - ILTf (&a, &b, &c, &e); afterI6(I5); KXf (k, 20, &b, &d, &e, &c); - ILTf (&b, &d, &e, &c); afterI5(I4); KXf (k, 16, &b, &c, &e, &a); - ILTf (&b, &c, &e, &a); afterI4(I3); KXf (k, 12, &a, &b, &e, &c); - ILTf (&a, &b, &e, &c); afterI3(I2); KXf (k, 8, &b, &d, &e, &c); - ILTf (&b, &d, &e, &c); afterI2(I1); KXf (k, 4, &a, &b, &c, &e); - ILTf (&a, &b, &c, &e); afterI1(I0); KXf (k, 0, &a, &d, &b, &e); - } - while (--i != 0); - - out[0] = LE32(a); - out[1] = LE32(d); - out[2] = LE32(b); - out[3] = LE32(e); -} - -#endif // TC_MINIMIZE_CODE_SIZE && !TC_WINDOWS_BOOT_SERPENT diff --git a/src/utils/crypto/sha2.h b/src/utils/crypto/sha2.h index 3ebf6671005..791288caf3a 100644 --- a/src/utils/crypto/sha2.h +++ b/src/utils/crypto/sha2.h @@ -28,7 +28,17 @@ #ifndef _SHA2_H #define _SHA2_H -#include "../common/tcdefs.h" +#include +#include +#include +#include +#include <86box/86box.h> + +#define uint_64t uint64_t + +#define uint_32t uint32_t +#define uint_8t uint8_t + #include "../common/endian.h" #define SHA_64BIT diff --git a/src/utils/crypto/twofish.c b/src/utils/crypto/twofish.c index 981acdba87d..62abfd7a311 100644 --- a/src/utils/crypto/twofish.c +++ b/src/utils/crypto/twofish.c @@ -32,20 +32,14 @@ /* Adapted for TrueCrypt by the TrueCrypt Foundation */ -#ifdef TC_WINDOWS_BOOT -#pragma optimize ("tl", on) -#endif - #include "twofish.h" #include "../common/endian.h" #define Q_TABLES #define M_TABLE -#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH) # define MK_TABLE # define ONE_STEP -#endif /* finite field arithmetic for GF(2**8) with the modular */ /* polynomial x^8 + x^6 + x^5 + x^3 + 1 (0x169) */ @@ -417,8 +411,6 @@ u4byte *twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const /* encrypt a block of text */ -#ifndef TC_MINIMIZE_CODE_SIZE - #define f_rnd(i) \ t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); \ blk[2] = rotr(blk[2] ^ (t0 + t1 + l_key[4 * (i) + 8]), 1); \ @@ -447,44 +439,8 @@ void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o out_blk[3] = LE32(blk[1] ^ l_key[7]); }; -#else // TC_MINIMIZE_CODE_SIZE - -void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]) -{ u4byte t0, t1, blk[4]; - - u4byte *l_key = instance->l_key; -#ifdef TC_WINDOWS_BOOT_TWOFISH - u4byte *mk_tab = instance->mk_tab; -#endif - int i; - - blk[0] = LE32(in_blk[0]) ^ l_key[0]; - blk[1] = LE32(in_blk[1]) ^ l_key[1]; - blk[2] = LE32(in_blk[2]) ^ l_key[2]; - blk[3] = LE32(in_blk[3]) ^ l_key[3]; - - for (i = 0; i <= 7; ++i) - { - t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); - blk[2] = rotr(blk[2] ^ (t0 + t1 + l_key[4 * (i) + 8]), 1); - blk[3] = rotl(blk[3], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]); - t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); - blk[0] = rotr(blk[0] ^ (t0 + t1 + l_key[4 * (i) + 10]), 1); - blk[1] = rotl(blk[1], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]); - } - - out_blk[0] = LE32(blk[2] ^ l_key[4]); - out_blk[1] = LE32(blk[3] ^ l_key[5]); - out_blk[2] = LE32(blk[0] ^ l_key[6]); - out_blk[3] = LE32(blk[1] ^ l_key[7]); -}; - -#endif // TC_MINIMIZE_CODE_SIZE - /* decrypt a block of text */ -#ifndef TC_MINIMIZE_CODE_SIZE - #define i_rnd(i) \ t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); \ blk[2] = rotl(blk[2], 1) ^ (t0 + t1 + l_key[4 * (i) + 10]); \ @@ -512,37 +468,3 @@ void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte o out_blk[2] = LE32(blk[0] ^ l_key[2]); out_blk[3] = LE32(blk[1] ^ l_key[3]); }; - -#else // TC_MINIMIZE_CODE_SIZE - -void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]) -{ u4byte t0, t1, blk[4]; - - u4byte *l_key = instance->l_key; -#ifdef TC_WINDOWS_BOOT_TWOFISH - u4byte *mk_tab = instance->mk_tab; -#endif - int i; - - blk[0] = LE32(in_blk[0]) ^ l_key[4]; - blk[1] = LE32(in_blk[1]) ^ l_key[5]; - blk[2] = LE32(in_blk[2]) ^ l_key[6]; - blk[3] = LE32(in_blk[3]) ^ l_key[7]; - - for (i = 7; i >= 0; --i) - { - t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); - blk[2] = rotl(blk[2], 1) ^ (t0 + t1 + l_key[4 * (i) + 10]); - blk[3] = rotr(blk[3] ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]), 1); - t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); - blk[0] = rotl(blk[0], 1) ^ (t0 + t1 + l_key[4 * (i) + 8]); - blk[1] = rotr(blk[1] ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]), 1); - } - - out_blk[0] = LE32(blk[2] ^ l_key[0]); - out_blk[1] = LE32(blk[3] ^ l_key[1]); - out_blk[2] = LE32(blk[0] ^ l_key[2]); - out_blk[3] = LE32(blk[1] ^ l_key[3]); -}; - -#endif // TC_MINIMIZE_CODE_SIZE diff --git a/src/utils/crypto/twofish.h b/src/utils/crypto/twofish.h index b63ae69cd70..59725de5d3b 100644 --- a/src/utils/crypto/twofish.h +++ b/src/utils/crypto/twofish.h @@ -37,9 +37,7 @@ typedef struct { u4byte l_key[40]; u4byte s_key[4]; -#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH) u4byte mk_tab[4 * 256]; -#endif u4byte k_len; } TwofishInstance; diff --git a/src/utils/decode.c b/src/utils/decode.c index 8221428ba6c..a717ab8b6d5 100644 --- a/src/utils/decode.c +++ b/src/utils/decode.c @@ -2,7 +2,6 @@ #include "edc.h" -#include "common/tcdefs.h" #include "common/crypto.h" #include "common/endian.h" #include "common/pkcs5.h" @@ -10,7 +9,16 @@ #include +#define byte uint8_t +#define uint64 uint64_t +typedef union { + struct { + uint32_t LowPart; + uint32_t HighPart; + }; + uint64_t Value; +} UINT64_STRUCT; void unshuffle1(u8 *data) { @@ -33,7 +41,7 @@ void unshuffle1(u8 *data) } void DecryptBlock(u8 *buf, - TC_LARGEST_COMPILER_UINT len, + uint64_t len, u32 secSz, u64 secN, u8 flags, @@ -104,12 +112,7 @@ UINT64_STRUCT GetHeaderField64 (byte *header, size_t offset) /* modify BE->LE */ UINT64_STRUCT uint64Struct; -#ifndef TC_NO_COMPILER_INT64 uint64Struct.Value = LE64 (*(uint64 *) (header + offset)); -#else - uint64Struct.HighPart = LE32 (*(uint32 *) (header + offset)); - uint64Struct.LowPart = LE32 (*(uint32 *) (header + offset + 4)); -#endif return uint64Struct; } @@ -175,7 +178,7 @@ int ReadHeader (int bBoot, char *encryptedHeader, Password *password, PCRYPTO_IN default: // Unknown/wrong ID - TC_THROW_FATAL_EXCEPTION; + fatal("ReadHeader(): Unknown/wrong ID\n"); } // Test all available modes of operation @@ -303,8 +306,8 @@ int ReadHeader (int bBoot, char *encryptedHeader, Password *password, PCRYPTO_IN // Clear out the temporary key buffers // ret: - burn (dk, sizeof(dk)); - burn (&keyInfo, sizeof (keyInfo)); + memset (dk, 0x00, sizeof(dk)); + memset (&keyInfo, 0x00, sizeof (keyInfo)); return 0; } @@ -319,8 +322,8 @@ int ReadHeader (int bBoot, char *encryptedHeader, Password *password, PCRYPTO_IN *retInfo = NULL; } - burn (&keyInfo, sizeof (keyInfo)); - burn (dk, sizeof(dk)); + memset (&keyInfo, 0x00, sizeof (keyInfo)); + memset (dk, 0x00, sizeof(dk)); return status; } diff --git a/src/utils/mds.h b/src/utils/mds.h index d080b0e4242..0eba0bfe905 100644 --- a/src/utils/mds.h +++ b/src/utils/mds.h @@ -1,8 +1,9 @@ #ifndef MDS_H #define MDS_H -#include +#include #include +#include #include #include "defines.h" @@ -20,8 +21,6 @@ typedef struct Decoder_t int ctr; } Decoder; - - enum TRACK_TYPE { TRK_T_MAINTENANCE = 0, @@ -140,7 +139,7 @@ typedef struct __attribute__((packed)) // decode.c -void DecryptBlock(u8 *buf, TC_LARGEST_COMPILER_UINT len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); +void DecryptBlock(u8 *buf, uint64_t len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); int decode1(u8 *data, const char *pass, PCRYPTO_INFO *ci); From 82a1f2908d56fdff211cad1a9b9c51dfccf16ca3 Mon Sep 17 00:00:00 2001 From: kotochi98 <185547947+kotochi98@users.noreply.github.com> Date: Sun, 18 Jan 2026 14:27:05 +0300 Subject: [PATCH 313/320] Add the Intel Classic R/R Plus (Monsoon) machine --- src/include/86box/machine.h | 1 + src/machine/m_at_socket2.c | 27 +++++++++++++++++++++++ src/machine/machine_table.c | 44 +++++++++++++++++++++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/src/include/86box/machine.h b/src/include/86box/machine.h index a7920bad082..92b448eebe8 100644 --- a/src/include/86box/machine.h +++ b/src/include/86box/machine.h @@ -734,6 +734,7 @@ extern int machine_at_dell466np_init(const machine_t *); extern int machine_at_valuepoint433_init(const machine_t *); /* VLSI 82C480 */ +extern int machine_at_monsoon_init(const machine_t *); extern int machine_at_martin_init(const machine_t *); /* m_at_socket3.c */ diff --git a/src/machine/m_at_socket2.c b/src/machine/m_at_socket2.c index d338eddaf99..d8fdd79f128 100644 --- a/src/machine/m_at_socket2.c +++ b/src/machine/m_at_socket2.c @@ -365,6 +365,33 @@ machine_at_valuepoint433_init(const machine_t *model) // hangs without the PS/2 } /* VLSI 82C480 */ +int +machine_at_monsoon_init(const machine_t *model) +{ + int ret; + + ret = bios_load_linear_combined("roms/machines/monsoon/1009AC0_.BIO", + "roms/machines/monsoon/1009AC0_.BI1", 0x1c000, 128); + + if (bios_only || !ret) + return ret; + + machine_at_common_init_ex(model, 2); + + device_add(&vl82c480_device); + device_add(&vl82c113_device); + + device_add(&ide_vlb_device); + device_add_params(&fdc37c6xx_device, (void *) (FDC37C651 | FDC37C6XX_IDE_PRI)); + + device_add(&intel_flash_bxt_device); + + if (gfxcard[0] == VID_INTERNAL) + device_add(machine_get_vid_device(machine)); + + return ret; +} + int machine_at_martin_init(const machine_t *model) { diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index 9b7211d8c0f..b0048fef21d 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -8450,6 +8450,50 @@ const machine_t machines[] = { .net_device = NULL }, /* Has a VLSI VL82C113A SCAMP Combination I/O which holds the KBC. */ + { + .name = "[VLSI 82C480] Intel Classic R/R Plus (Monsoon)", + .internal_name = "monsoon", + .type = MACHINE_TYPE_486_S2, + .chipset = MACHINE_CHIPSET_VLSI_VL82C480, + .init = machine_at_monsoon_init, + .p1_handler = machine_generic_p1_handler, + .gpio_handler = NULL, + .available_flag = MACHINE_AVAILABLE, + .gpio_acpi_handler = NULL, + .cpu = { + .package = CPU_PKG_SOCKET3, + .block = CPU_BLOCK_NONE, + .min_bus = 0, + .max_bus = 0, + .min_voltage = 0, + .max_voltage = 0, + .min_multi = 0, + .max_multi = 0 + }, + .bus_flags = MACHINE_PS2_VLB, + .flags = MACHINE_IDE | MACHINE_VIDEO | MACHINE_APM, + .ram = { + .min = 2048, + .max = 32768, + .step = 2048 + }, + .nvrmask = 127, + .jumpered_ecp_dma = 0, + .default_jumpered_ecp_dma = -1, + .kbc_device = NULL, + .kbc_params = 0x00000000, + .kbc_p1 = 0x000004f0, + .gpio = 0xffffffff, + .gpio_acpi = 0xffffffff, + .device = NULL, + .kbd_device = NULL, + .fdc_device = NULL, + .sio_device = NULL, + .vid_device = &gd5428_vlb_onboard_device, + .snd_device = NULL, + .net_device = NULL + }, + /* Has a VLSI VL82C113A SCAMP Combination I/O which holds the KBC. */ { .name = "[VLSI 82C480] ZEOS Martin", .internal_name = "martin", From 815f2e293d9e591fac5e2ab2092f4565e34c770e Mon Sep 17 00:00:00 2001 From: kotochi98 <185547947+kotochi98@users.noreply.github.com> Date: Sun, 18 Jan 2026 17:16:03 +0300 Subject: [PATCH 314/320] Change the Classic R/R Plus' bus flag to ISA only as the riser doesn't have any VLB slots --- src/machine/machine_table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index b0048fef21d..d08742f9c64 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -8470,7 +8470,7 @@ const machine_t machines[] = { .min_multi = 0, .max_multi = 0 }, - .bus_flags = MACHINE_PS2_VLB, + .bus_flags = MACHINE_PS2, .flags = MACHINE_IDE | MACHINE_VIDEO | MACHINE_APM, .ram = { .min = 2048, From d3ddb4e08039207ff82dcc4a2bf268f5b2838d1e Mon Sep 17 00:00:00 2001 From: richardg867 Date: Sun, 18 Jan 2026 17:05:40 -0300 Subject: [PATCH 315/320] Jenkins: Unbundle GL libs from the AppImage, fixes #6642 --- .ci/AppImageBuilder.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.ci/AppImageBuilder.yml b/.ci/AppImageBuilder.yml index 08d7be1aee7..61bbcba95e4 100644 --- a/.ci/AppImageBuilder.yml +++ b/.ci/AppImageBuilder.yml @@ -46,11 +46,6 @@ AppDir: - libedit2 # if (CLI:BOOL=ON|QT:BOOL=OFF) - libevdev2 # if QT:BOOL=ON - libfreetype6 - - libgbm1 # if QT:BOOL=ON - - libgl1 # if QT:BOOL=ON - - libgles2 # if QT:BOOL=ON - - libglvnd0 # if QT:BOOL=ON - - libglx0 # if QT:BOOL=ON - libgomp1 - libgs9 - libpng16-16 From c2dcd285f199fd7596c379426ddef94f0415ae54 Mon Sep 17 00:00:00 2001 From: Maxwell Scott Date: Mon, 19 Jan 2026 03:23:26 +0700 Subject: [PATCH 316/320] Some OEM BIOS renames --- src/machine/m_at_slot1.c | 6 +++--- src/machine/m_at_socket370.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/machine/m_at_slot1.c b/src/machine/m_at_slot1.c index a05642e9b9f..713ab09c05c 100644 --- a/src/machine/m_at_slot1.c +++ b/src/machine/m_at_slot1.c @@ -1699,7 +1699,7 @@ static const device_config_t ms6199va_config[] = { .files = { "roms/machines/ms6199va/w6199vms.350", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq OEM)", + .name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq ProSignia/Deskpro 693A)", .internal_name = "ms6199va_200", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -1708,7 +1708,7 @@ static const device_config_t ms6199va_config[] = { .files = { "roms/machines/ms6199va/W6199VC8.BIN", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq OEM) [Patched for larger drives]", + .name = "Award Modular BIOS v4.51PG - Revision 2.0 (Compaq ProSignia/Deskpro 693A) [Patched for larger drives]", .internal_name = "ms6199va_200p", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -1717,7 +1717,7 @@ static const device_config_t ms6199va_config[] = { .files = { "roms/machines/ms6199va/W6199VC8.PCD", "" } }, { - .name = "Award Modular BIOS v4.51PG - Revision 3.7 (Packard Bell OEM)", + .name = "Award Modular BIOS v4.51PG - Revision 3.7 (Packard Bell Phoenix)", .internal_name = "ms6199va_370", .bios_type = BIOS_NORMAL, .files_no = 1, diff --git a/src/machine/m_at_socket370.c b/src/machine/m_at_socket370.c index a1ec1a30c75..6627c709719 100644 --- a/src/machine/m_at_socket370.c +++ b/src/machine/m_at_socket370.c @@ -512,7 +512,7 @@ static const device_config_t ms6318_config[] = { .files = { "roms/machines/ms6318/ms-6318-ver5.bin", "" } }, { - .name = "Award Modular BIOS v6.00PG - Revision 1.8 (HP OEM)", + .name = "Award Modular BIOS v6.00PG - Revision 1.8 (HP Pavilion A7xx)", .internal_name = "ms6318_180", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -521,7 +521,7 @@ static const device_config_t ms6318_config[] = { .files = { "roms/machines/ms6318/med2000v2.bin", "" } }, { - .name = "Award Modular BIOS v6.00PG - Revision 1.9 (HP OEM)", + .name = "Award Modular BIOS v6.00PG - Revision 1.9 (HP Pavilion A8xx)", .internal_name = "ms6318_190", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -530,7 +530,7 @@ static const device_config_t ms6318_config[] = { .files = { "roms/machines/ms6318/med2000.bin", "" } }, { - .name = "Award Modular BIOS v6.00PG - Revision 2.02 (HP OEM)", + .name = "Award Modular BIOS v6.00PG - Revision 2.02 (HP Medion 2000A)", .internal_name = "ms6318_202", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -539,7 +539,7 @@ static const device_config_t ms6318_config[] = { .files = { "roms/machines/ms6318/ms6318hp.bin", "" } }, { - .name = "Award Modular BIOS v6.00PG - Revision 1.3 (Medion OEM)", + .name = "Award Modular BIOS v6.00PG - Revision 1.3 (Medion MED 2000)", .internal_name = "ms6318_130", .bios_type = BIOS_NORMAL, .files_no = 1, @@ -548,7 +548,7 @@ static const device_config_t ms6318_config[] = { .files = { "roms/machines/ms6318/ms6318.bin", "" } }, { - .name = "Award Modular BIOS v6.00PG - Revision 7.51 (Medion OEM)", + .name = "Award Modular BIOS v6.00PG - Revision 7.51 (Medion MD6318)", .internal_name = "ms6318_751", .bios_type = BIOS_NORMAL, .files_no = 1, From af6011a5b4f914569f0bbec94b74357fd3eb74c8 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 19 Jan 2026 08:54:56 +0100 Subject: [PATCH 317/320] MDS v2/MDX support: Move to a .DLL/.so/.DyLib file (not yet provided, working on it) because of license incompatibility with TrueCrypt's code. --- src/CMakeLists.txt | 1 + src/cdrom/cdrom_image.c | 240 ++++- src/qt/qt_mediamenu.cpp | 2 +- src/utils/CMakeLists.txt | 35 +- src/utils/common/crc.c | 95 -- src/utils/common/crc.h | 35 - src/utils/common/crypto.c | 1375 --------------------------- src/utils/common/crypto.h | 306 ------ src/utils/common/endian.c | 54 -- src/utils/common/endian.h | 141 --- src/utils/common/gfmul.c | 886 ------------------ src/utils/common/gfmul.h | 76 -- src/utils/common/password.h | 39 - src/utils/common/pkcs5.c | 629 ------------- src/utils/common/pkcs5.h | 39 - src/utils/common/xts.c | 595 ------------ src/utils/common/xts.h | 62 -- src/utils/crypto/aes.h | 218 ----- src/utils/crypto/aes_x64.asm | 904 ------------------ src/utils/crypto/aes_x86.asm | 644 ------------- src/utils/crypto/aeskey.c | 577 ------------ src/utils/crypto/aesopt.h | 729 --------------- src/utils/crypto/aessmall.c | 921 ------------------ src/utils/crypto/aessmall.h | 169 ---- src/utils/crypto/aessmall_x86.asm | 1444 ----------------------------- src/utils/crypto/aestab.c | 387 -------- src/utils/crypto/aestab.h | 174 ---- src/utils/crypto/bf_ecb.c | 113 --- src/utils/crypto/bf_enc.c | 235 ----- src/utils/crypto/bf_locl.h | 246 ----- src/utils/crypto/bf_pi.h | 327 ------- src/utils/crypto/bf_skey.c | 118 --- src/utils/crypto/blowfish.h | 120 --- src/utils/crypto/c_ecb.c | 80 -- src/utils/crypto/c_enc.c | 201 ---- src/utils/crypto/c_skey.c | 164 ---- src/utils/crypto/cast.h | 113 --- src/utils/crypto/cast_lcl.h | 225 ----- src/utils/crypto/cast_s.h | 530 ----------- src/utils/crypto/des.c | 4 - src/utils/crypto/des.h | 292 ------ src/utils/crypto/des_enc.c | 479 ---------- src/utils/crypto/des_locl.h | 518 ----------- src/utils/crypto/ecb3_enc.c | 84 -- src/utils/crypto/podd.h | 77 -- src/utils/crypto/rmd160.c | 380 -------- src/utils/crypto/rmd160.h | 59 -- src/utils/crypto/serpent.c | 567 ----------- src/utils/crypto/serpent.h | 19 - src/utils/crypto/set_key.c | 233 ----- src/utils/crypto/set_key.h | 6 - src/utils/crypto/sha1.c | 280 ------ src/utils/crypto/sha1.h | 80 -- src/utils/crypto/sha2.c | 770 --------------- src/utils/crypto/sha2.h | 165 ---- src/utils/crypto/sk.h | 206 ---- src/utils/crypto/spr.h | 206 ---- src/utils/crypto/twofish.c | 470 ---------- src/utils/crypto/twofish.h | 54 -- src/utils/crypto/whirlpool.c | 1058 --------------------- src/utils/crypto/whirlpool.h | 150 --- src/utils/decode.c | 465 ---------- src/utils/edc.c | 78 -- src/utils/edc.h | 8 - src/utils/mds.h | 105 ++- src/utils/mdsx_dll.c | 90 ++ src/utils/utils.c | 27 - 67 files changed, 422 insertions(+), 19757 deletions(-) delete mode 100644 src/utils/common/crc.c delete mode 100644 src/utils/common/crc.h delete mode 100644 src/utils/common/crypto.c delete mode 100644 src/utils/common/crypto.h delete mode 100644 src/utils/common/endian.c delete mode 100644 src/utils/common/endian.h delete mode 100644 src/utils/common/gfmul.c delete mode 100644 src/utils/common/gfmul.h delete mode 100644 src/utils/common/password.h delete mode 100644 src/utils/common/pkcs5.c delete mode 100644 src/utils/common/pkcs5.h delete mode 100644 src/utils/common/xts.c delete mode 100644 src/utils/common/xts.h delete mode 100644 src/utils/crypto/aes.h delete mode 100644 src/utils/crypto/aes_x64.asm delete mode 100644 src/utils/crypto/aes_x86.asm delete mode 100644 src/utils/crypto/aeskey.c delete mode 100644 src/utils/crypto/aesopt.h delete mode 100644 src/utils/crypto/aessmall.c delete mode 100644 src/utils/crypto/aessmall.h delete mode 100644 src/utils/crypto/aessmall_x86.asm delete mode 100644 src/utils/crypto/aestab.c delete mode 100644 src/utils/crypto/aestab.h delete mode 100644 src/utils/crypto/bf_ecb.c delete mode 100644 src/utils/crypto/bf_enc.c delete mode 100644 src/utils/crypto/bf_locl.h delete mode 100644 src/utils/crypto/bf_pi.h delete mode 100644 src/utils/crypto/bf_skey.c delete mode 100644 src/utils/crypto/blowfish.h delete mode 100644 src/utils/crypto/c_ecb.c delete mode 100644 src/utils/crypto/c_enc.c delete mode 100644 src/utils/crypto/c_skey.c delete mode 100644 src/utils/crypto/cast.h delete mode 100644 src/utils/crypto/cast_lcl.h delete mode 100644 src/utils/crypto/cast_s.h delete mode 100644 src/utils/crypto/des.c delete mode 100644 src/utils/crypto/des.h delete mode 100644 src/utils/crypto/des_enc.c delete mode 100644 src/utils/crypto/des_locl.h delete mode 100644 src/utils/crypto/ecb3_enc.c delete mode 100644 src/utils/crypto/podd.h delete mode 100644 src/utils/crypto/rmd160.c delete mode 100644 src/utils/crypto/rmd160.h delete mode 100644 src/utils/crypto/serpent.c delete mode 100644 src/utils/crypto/serpent.h delete mode 100644 src/utils/crypto/set_key.c delete mode 100644 src/utils/crypto/set_key.h delete mode 100644 src/utils/crypto/sha1.c delete mode 100644 src/utils/crypto/sha1.h delete mode 100644 src/utils/crypto/sha2.c delete mode 100644 src/utils/crypto/sha2.h delete mode 100644 src/utils/crypto/sk.h delete mode 100644 src/utils/crypto/spr.h delete mode 100644 src/utils/crypto/twofish.c delete mode 100644 src/utils/crypto/twofish.h delete mode 100644 src/utils/crypto/whirlpool.c delete mode 100644 src/utils/crypto/whirlpool.h delete mode 100644 src/utils/decode.c delete mode 100644 src/utils/edc.c delete mode 100644 src/utils/edc.h create mode 100644 src/utils/mdsx_dll.c delete mode 100644 src/utils/utils.c diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7c389c368a8..4b50879eb71 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -134,6 +134,7 @@ target_link_libraries(86Box scsi sio snd + mdsx_dll utils vid voodoo diff --git a/src/cdrom/cdrom_image.c b/src/cdrom/cdrom_image.c index 6712912add5..252eca52612 100644 --- a/src/cdrom/cdrom_image.c +++ b/src/cdrom/cdrom_image.c @@ -19,6 +19,7 @@ #define __STDC_FORMAT_MACROS #include #include +#define ENABLE_IMAGE_LOG 1 #ifdef ENABLE_IMAGE_LOG #include #endif @@ -27,12 +28,14 @@ #include #include #include +#include #include #ifndef _WIN32 # include #endif #include <86box/86box.h> #include <86box/log.h> +#include <86box/nvr.h> #include <86box/path.h> #include <86box/plat.h> #include <86box/cdrom.h> @@ -41,11 +44,15 @@ #include +#define NO_CHIPHER_IDS_ENUM +#include "../utils/mds.h" + #define MAX_LINE_LENGTH 512 #define MAX_FILENAME_LENGTH 256 #define CROSS_LEN 512 static char temp_keyword[1024]; +static char temp_file[260] = { 0 }; #define INDEX_SPECIAL -2 /* Track A0h onwards. */ #define INDEX_NONE -1 /* Empty block. */ @@ -138,12 +145,6 @@ typedef enum MODE2_FORM2 = 0xad /* sector size = 2324 (+4) */ } mds_trk_mode_t; -typedef enum -{ - NONE = 0x00, /* no subchannel */ - PW_INTERLEAVED = 0x08 /* 96-byte PW subchannel, interleaved */ -} mds_subch_mode_t; - #pragma pack(push, 1) typedef struct { @@ -1967,6 +1968,187 @@ long int utf16_to_utf8(const uint16_t *u16_str, size_t u16_str_len, return (long int)j; } +int +mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) +{ + int is_mdx = 0; + + uint64_t mdx_offset = 0ULL; + uint64_t mdx_size_1 = 0ULL; + + if (*fp == NULL) { +#ifdef ENABLE_IMAGE_LOG + log_warning(img->log, " [MDS ] \"%s\" is not open\n", + mdsfile); +#else + warning("\"%s\" is not open\n", mdsfile); +#endif + return 0; + } + + pclog("mds_decrypt_track_data(): Decrypting MDS...\n"); + /* + If we are here, them we have already determined in + image_load_mds() that the version is 2.x. + */ + fseek(*fp, 0x2c, SEEK_SET); + + uint64_t offset = 0ULL; + fread(&offset, 1, 4, *fp); + pclog("mds_decrypt_track_data(): Offset is %016" PRIX64 "\n", offset); + + if (offset == 0xffffffff) { + pclog("mds_decrypt_track_data(): File is MDX\n"); + is_mdx = 1; + + fread(&mdx_offset, 1, 8, *fp); + fread(&mdx_size_1, 1, 8, *fp); + pclog("mds_decrypt_track_data(): MDX footer is %" PRIi64 " bytes at offset %016" PRIX64 "\n", mdx_size_1, mdx_offset); + + offset = mdx_offset + (mdx_size_1 - 0x40); + pclog("mds_decrypt_track_data(): MDX offset is %016" PRIX64 "\n", offset); + } + + fseek(*fp, offset, SEEK_SET); + + uint8_t data1[0x200]; + + fread(data1, 0x200, 1, *fp); + pclog("mds_decrypt_track_data(): Read the first data buffer\n"); + + PCRYPTO_INFO ci; + decode1(data1, NULL, &ci); + printf("data1: %02X %02X %02X %02X\n", data1[0], data1[1], data1[2], data1[3]); + FILE *d1f = fopen("data1.tmp", "wb"); + fwrite(data1, 1, 0x200, d1f); + fclose(d1f); + pclog("mds_decrypt_track_data(): Decoded the first data buffer\n"); + + /* Compressed size at 0x150? */ + uint32_t decSize = getU32(data1 + 0x154); /* Decompressed size? */ + pclog("mds_decrypt_track_data(): Decompressed size is %i bytes\n", decSize); + + uint64_t data2Offset = 0x30; /* For MDS v2. */ + uint64_t data2Size = offset - 0x30; /* For MDS v2. */ + + if (is_mdx) { + data2Offset = mdx_offset; + data2Size = mdx_size_1 - 0x40; + } + pclog("mds_decrypt_track_data(): Second data buffer is %" PRIi64 " bytes at offset %016" PRIX64 "\n", data2Size, data2Offset); + + fseek(*fp, data2Offset, SEEK_SET); + + u8 *data2 = (u8 *)malloc(data2Size); + fread(data2, 1, data2Size, *fp); + pclog("mds_decrypt_track_data(): Read the second data buffer\n"); + + DecryptBlock(data2, data2Size, 0, 0, 4, ci); + pclog("mds_decrypt_track_data(): Decoded the second data buffer\n"); + + u8 *mdxHeader = (u8 *)malloc(decSize + 0x12); + + z_stream infstream; + infstream.zalloc = Z_NULL; + infstream.zfree = Z_NULL; + infstream.opaque = Z_NULL; + infstream.avail_in = data2Size; + infstream.next_in = data2; + infstream.avail_out = decSize; + infstream.next_out = mdxHeader + 0x12; + + inflateInit(&infstream); + + inflate(&infstream, Z_NO_FLUSH); + inflateEnd(&infstream); + + fseek(*fp, 0, SEEK_SET); + fread(mdxHeader, 1, 0x12, *fp); + + u8 medium_type = getU8(mdxHeader + offsetof(MDX_Header, medium_type)); + int isDVD = 1; + + if (medium_type < 3) // 0, 1, 2 + isDVD = 0; + + Decoder encryptInfo; + encryptInfo.mode = -1; + encryptInfo.ctr = 1; + + u32 keyBlockOff = getU32(mdxHeader + offsetof(MDX_Header, encryption_block_offset)); + + if (keyBlockOff) { + pclog("Encryption detected\n"); + + const char *password = NULL; + + pclog("Trying without password\n"); + + PCRYPTO_INFO ci2; + if (decode1(mdxHeader + keyBlockOff, password, &ci2) == 0) { + if (password) + pclog("Password \"%s\": OK\n", password); + else + pclog("It's encrypted with NULL password. OK!\n"); + } else { + if (password) + pclog("Password \"%s\": WRONG\n", password); + else + pclog("Please specify password. Seems it's necessery.\n"); + + pclog("But we save header_not_decrypted.out with encrypted key block\n"); + +#if 0 + FILE *b = fopen("header_not_decrypted.out", "wb"); + fwrite(mdxHeader, 1, decSize + 0x12, b); + fclose(b); +#else +#ifdef ENABLE_IMAGE_LOG + log_warning(img->log, " [MDS ] \"%s\" is an unsupported password-protected file\n", + mdsfile); +#else + warning("\"%s\" is an unsupported password-protected file\n", mdsfile); +#endif + fclose(*fp); + *fp = NULL; +#endif + + return 0; + } + + /* + Seems it's always use one mode AES 256 with GF. */ + encryptInfo.bsize = 32; + encryptInfo.mode = 2; + + u8 *keyblock = mdxHeader + keyBlockOff; + memcpy(encryptInfo.dg, keyblock + 0x50, 0x20); + Gf128Tab64Init(keyblock + 0x50, &encryptInfo.gf_ctx); + aes_encrypt_key(keyblock + 0x70, encryptInfo.bsize, &encryptInfo.encr); + aes_decrypt_key(keyblock + 0x70, encryptInfo.bsize, &encryptInfo.decr); + } else + pclog("No encryption detected\n"); + + fclose(*fp); + *fp = NULL; + + /* Dump mdxHeader */ + pclog("\nDumping header into header.out... "); + + plat_tempfile(temp_file, "mds_v2", ".tmp"); + *fp = plat_fopen64(nvr_path(temp_file), "wb"); + fwrite(mdxHeader, 1, decSize + 0x12, *fp); + fclose(*fp); + + fclose(*fp); + *fp = NULL; + + *fp = plat_fopen64(nvr_path(temp_file), "rb"); + + pclog("Done\n"); + return isDVD + 1; +} + static int image_load_mds(cd_image_t *img, const char *mdsfile) { @@ -2018,28 +2200,49 @@ image_load_mds(cd_image_t *img, const char *mdsfile) if (memcmp(mds_hdr.file_sig, "MEDIA DESCRIPTOR", 16)) { #ifdef ENABLE_IMAGE_LOG - log_warning(img->log, " [MDS ] \"%s\"\n is not an actual MDF file", + log_warning(img->log, " [MDS ] \"%s\" is not an actual MDF file\n", mdsfile); #else - warning("\"%s\"\n is not an actual MDF file", mdsfile); + warning("\"%s\" is not an actual MDF file\n", mdsfile); #endif fclose(fp); return 0; } if (mds_hdr.file_ver[0] == 0x02) { + int mdsx = mdsx_init(); + if (!mdsx) { #ifdef ENABLE_IMAGE_LOG - log_warning(img->log, " [MDS ] \"%s\" is a Daemon Tools encrypted MDS which is not supported\n", - mdsfile); + log_warning(img->log, " [MDS ] Error initializing dynamic library\n"); #else - warning("\"%s\" is a Daemon Tools encrypted MDS which is not supported\n", mdsfile); + warning("Error initializing dynamic library\n", mdsfile); #endif - version = 2; - fclose(fp); - return 0; - } + if (fp != NULL) + fclose(fp); + return 0; + } - img->is_dvd = (mds_hdr.medium_type >= 0x10); + image_log(img->log, "Pass 1.5 (decrypting the Media Descriptor Sheet)...\n"); + + fseek(fp, 0, SEEK_SET); + int ret = mds_decrypt_track_data(img, mdsfile, &fp); + + mdsx_close(); + + if (ret == 0) { +#ifdef ENABLE_IMAGE_LOG + log_warning(img->log, " [MDS ] Error decrypting \"%s\"\n", + mdsfile); +#else + warning("Error decrypting \"%s\"\n", mdsfile); +#endif + if (fp != NULL) + fclose(fp); + return 0; + } else + img->is_dvd = ret - 1; + } else + img->is_dvd = (mds_hdr.medium_type >= 0x10); if (img->is_dvd) { if (mds_hdr.disc_struct_offs != 0x00) { @@ -2702,6 +2905,11 @@ image_close(void *local) free(img->bad_sectors); free(img); + + if (temp_file[0] != 0x00) { + remove(temp_file); + temp_file[0] = 0x00; + } } } diff --git a/src/qt/qt_mediamenu.cpp b/src/qt/qt_mediamenu.cpp index c9defba9615..968858dd28e 100644 --- a/src/qt/qt_mediamenu.cpp +++ b/src/qt/qt_mediamenu.cpp @@ -596,7 +596,7 @@ MediaMenu::cdromMount(int i, int dir, const QString &arg) else { filename = QFileDialog::getOpenFileName(parentWidget, QString(), QString(), - tr("CD-ROM images") % util::DlgFilter({ "iso", "cue", "mds" }) % tr("All files") % util::DlgFilter({ "*" }, true)); + tr("CD-ROM images") % util::DlgFilter({ "iso", "cue", "mds", "mdx" }) % tr("All files") % util::DlgFilter({ "*" }, true)); } if (filename.isEmpty()) diff --git a/src/utils/CMakeLists.txt b/src/utils/CMakeLists.txt index 2655cbe243b..27be335afed 100644 --- a/src/utils/CMakeLists.txt +++ b/src/utils/CMakeLists.txt @@ -21,42 +21,17 @@ add_library(utils OBJECT cJSON.c crc.c crc32.c - decode.c - edc.c fifo.c fifo8.c ini.c log.c random.c - utils.c - # Common - common/crc.c - common/crypto.c - common/endian.c - common/gfmul.c - common/pkcs5.c - common/xts.c +) + +add_library(mdsx_dll OBJECT - # Crypto - crypto/aeskey.c - crypto/aessmall.c - crypto/aestab.c - crypto/bf_ecb.c - crypto/bf_enc.c - crypto/bf_skey.c - crypto/c_ecb.c - crypto/c_enc.c - crypto/c_skey.c - crypto/des.c - crypto/des_enc.c - crypto/ecb3_enc.c - crypto/rmd160.c - crypto/serpent.c - crypto/set_key.c - crypto/sha1.c - crypto/sha2.c - crypto/twofish.c - crypto/whirlpool.c + # MDSX DLL Core + mdsx_dll.c ) diff --git a/src/utils/common/crc.c b/src/utils/common/crc.c deleted file mode 100644 index 055be2d1c6c..00000000000 --- a/src/utils/common/crc.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#include "crc.h" -#include "../common/endian.h" - -/* CRC polynomial 0x04c11db7 */ -uint32_t crc_32_tab[]= -{ - 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f, 0xe963a535, 0x9e6495a3, - 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, - 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, - 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9, 0xfa0f3d63, 0x8d080df5, - 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, - 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59, - 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599, 0xb8bda50f, - 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924, 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, - 0x76dc4190, 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433, - 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01, - 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, - 0x65b0d9c6, 0x12b7e950, 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65, - 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, - 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, - 0x5005713c, 0x270241aa, 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f, - 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, - 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, - 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, - 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb, 0x196c3671, 0x6e6b06e7, - 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, - 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b, - 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef, 0x4669be79, - 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236, 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, - 0xc5ba3bbe, 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d, - 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713, - 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, - 0x86d3d2d4, 0xf1d4e242, 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777, - 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, - 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, - 0xaed16a4a, 0xd9d65adc, 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9, - 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693, 0x54de5729, 0x23d967bf, - 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d -}; - -uint32_t GetCrc32 (unsigned char *data, int length) -{ - uint32_t CRC = 0xffffffff; - - while (length--) - { - CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *data++) & 0xFF ]; - } - - return CRC ^ 0xffffffff; -} - -uint32_t crc32int (uint32_t *data) -{ - unsigned char *d = (unsigned char *) data; - uint32_t CRC = 0xffffffff; - - CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d++) & 0xFF ]; - CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d++) & 0xFF ]; - CRC = (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d++) & 0xFF ]; - return (CRC >> 8) ^ crc_32_tab[ (CRC ^ *d) & 0xFF ] ^ 0xffffffff; -} - -#if BYTE_ORDER == LITTLE_ENDIAN -# define CRC_SELFTEST 0x6fcf9e13 -#else -# define CRC_SELFTEST 0xca87914d -#endif - -int crc32_selftests (void) -{ - int i; - uint32_t crc = 0xffffffff; - int bSuccess = 0; - - for (i = 0; i < (int)sizeof(crc_32_tab); i++) - crc = UPDC32 (((unsigned char *) crc_32_tab)[i], crc); - - bSuccess = CRC_SELFTEST == (crc ^ 0xffffffff); - - bSuccess &= GetCrc32 ((unsigned char *)crc_32_tab, sizeof crc_32_tab) == CRC_SELFTEST; - - return bSuccess; -} diff --git a/src/utils/common/crc.h b/src/utils/common/crc.h deleted file mode 100644 index ff49ae66ec6..00000000000 --- a/src/utils/common/crc.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#ifndef HEADER_CRC -#define HEADER_CRC - -#include - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define UPDC32(octet, crc)\ - (uint32_t)((crc_32_tab[(((uint32_t)(crc)) ^ ((unsigned char)(octet))) & 0xff] ^ (((uint32_t)(crc)) >> 8))) - -uint32_t GetCrc32 (unsigned char *data, int length); -uint32_t crc32int (uint32_t *data); -int crc32_selftests (void); - -extern uint32_t crc_32_tab[]; - -#if defined(__cplusplus) -} -#endif - -#endif // HEADER_CRC diff --git a/src/utils/common/crypto.c b/src/utils/common/crypto.c deleted file mode 100644 index 9bf86501bbe..00000000000 --- a/src/utils/common/crypto.c +++ /dev/null @@ -1,1375 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#include "crypto.h" -#include "xts.h" -#include "crc.h" -#include "../common/endian.h" -#include - -/* Update the following when adding a new cipher or EA: - - Crypto.h: - ID #define - MAX_EXPANDED_KEY #define - - Crypto.c: - Ciphers[] - EncryptionAlgorithms[] - CipherInit() - EncipherBlock() - DecipherBlock() - -*/ - -// Cipher configuration -static Cipher Ciphers[] = -{ -// Block Size Key Size Key Schedule Size -// ID Name (Bytes) (Bytes) (Bytes) - { AES256, "AES256", 16, 32, AES_KS }, - { AES192, "AES192", 16, 24, AES_KS }, - { AES128, "AES128", 16, 16, AES_KS }, - { BLOWFISH, "Blowfish", 8, 56, 4168 }, // Deprecated/legacy - { CAST, "CAST5", 8, 16, 128 }, // Deprecated/legacy - { DES56, "DES", 8, 7, 128 }, // Deprecated/legacy - { SERPENT, "Serpent", 16, 32, 140*4 }, - { TRIPLEDES,"Triple DES", 8, 8*3, 128*3 }, // Deprecated/legacy - { TWOFISH, "Twofish", 16, 32, TWOFISH_KS }, - { 0, 0, 0, 0, 0 } -}; - - -// Encryption algorithm configuration -// The following modes have been deprecated (legacy): LRW, CBC, INNER_CBC, OUTER_CBC -static EncryptionAlgorithm EncryptionAlgorithms[] = -{ - // Cipher(s) Modes FormatEnabled - - { { 0, 0 }, { 0, 0, 0, 0 }, 0 }, // Must be all-zero - { { AES256, 0 }, { XTS, LRW, CBC, 0 }, 1 }, - { { AES192, 0 }, { XTS, LRW, CBC, 0 }, 1 }, - { { AES128, 0 }, { XTS, LRW, CBC, 0 }, 1 }, - { { BLOWFISH, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy - { { CAST, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy - { { SERPENT, 0 }, { XTS, LRW, CBC, 0 }, 1 }, - { { TRIPLEDES, 0 }, { LRW, CBC, 0, 0 }, 0 }, // Deprecated/legacy - { { TWOFISH, 0 }, { XTS, LRW, CBC, 0 }, 1 }, - { { TWOFISH, AES256, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, - { { SERPENT, TWOFISH, AES256, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, - { { AES256, SERPENT, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, - { { AES256, TWOFISH, SERPENT, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, - { { SERPENT, TWOFISH, 0 }, { XTS, LRW, OUTER_CBC, 0 }, 1 }, - { { BLOWFISH, AES256, 0 }, { INNER_CBC, 0, 0, 0 }, 0 }, // Deprecated/legacy - { { SERPENT, BLOWFISH, AES256, 0 }, { INNER_CBC, 0, 0, 0 }, 0 }, // Deprecated/legacy - { { 0, 0 }, { 0, 0, 0, 0 }, 0 } // Must be all-zero - -}; - - - -// Hash algorithms -static Hash Hashes[] = -{ // ID Name Deprecated System Encryption - { RIPEMD160, "RIPEMD-160", 0, 1 }, - { SHA512, "SHA-512", 0, 0 }, - { WHIRLPOOL, "Whirlpool", 0, 0 }, - { SHA1, "SHA-1", 1, 0 }, // Deprecated/legacy - { 0, 0, 0 } -}; - -/* Return values: 0 = success, ERR_CIPHER_INIT_FAILURE (fatal), ERR_CIPHER_INIT_WEAK_KEY (non-fatal) */ -int CipherInit (int cipher, unsigned char *key, uint8_t *ks) -{ - int retVal = ERR_SUCCESS; - - switch (cipher) - { - case AES256: - if (aes_encrypt_key256 (key, (aes_encrypt_ctx *) ks) != EXIT_SUCCESS) - return ERR_CIPHER_INIT_FAILURE; - - if (aes_decrypt_key256 (key, (aes_decrypt_ctx *) (ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS) - return ERR_CIPHER_INIT_FAILURE; - break; - - case AES192: - if (aes_encrypt_key192 (key, (aes_encrypt_ctx *) ks) != EXIT_SUCCESS) - return ERR_CIPHER_INIT_FAILURE; - - if (aes_decrypt_key192 (key, (aes_decrypt_ctx *) (ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS) - return ERR_CIPHER_INIT_FAILURE; - break; - - case AES128: - if (aes_encrypt_key128 (key, (aes_encrypt_ctx *) ks) != EXIT_SUCCESS) - return ERR_CIPHER_INIT_FAILURE; - - if (aes_decrypt_key128 (key, (aes_decrypt_ctx *) (ks + sizeof(aes_encrypt_ctx))) != EXIT_SUCCESS) - return ERR_CIPHER_INIT_FAILURE; - break; - - case SERPENT: - serpent_set_key (key, CipherGetKeySize(SERPENT) * 8, ks); - break; - - case TWOFISH: - twofish_set_key ((TwofishInstance *)ks, (const u4byte *)key, CipherGetKeySize(TWOFISH) * 8); - break; - - case BLOWFISH: - /* Deprecated/legacy */ - BF_set_key ((BF_KEY *)ks, CipherGetKeySize(BLOWFISH), key); - break; - - case DES56: - /* Deprecated/legacy */ - switch (des_key_sched ((des_cblock *) key, (struct des_ks_struct *) ks)) - { - case -1: - return ERR_CIPHER_INIT_FAILURE; - case -2: - retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error - break; - } - break; - - case CAST: - /* Deprecated/legacy */ - CAST_set_key((CAST_KEY *) ks, CipherGetKeySize(CAST), key); - break; - - case TRIPLEDES: - /* Deprecated/legacy */ - switch (des_key_sched ((des_cblock *) key, (struct des_ks_struct *) ks)) - { - case -1: - return ERR_CIPHER_INIT_FAILURE; - case -2: - retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error - break; - } - switch (des_key_sched ((des_cblock *) ((char*)(key)+8), (struct des_ks_struct *) (ks + CipherGetKeyScheduleSize (DES56)))) - { - case -1: - return ERR_CIPHER_INIT_FAILURE; - case -2: - retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error - break; - } - switch (des_key_sched ((des_cblock *) ((char*)(key)+16), (struct des_ks_struct *) (ks + CipherGetKeyScheduleSize (DES56) * 2))) - { - case -1: - return ERR_CIPHER_INIT_FAILURE; - case -2: - retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error - break; - } - - // Verify whether all three DES keys are mutually different - if (((*((int64_t *) key) ^ *((int64_t *) key+1)) & 0xFEFEFEFEFEFEFEFEULL) == 0 - || ((*((int64_t *) key+1) ^ *((int64_t *) key+2)) & 0xFEFEFEFEFEFEFEFEULL) == 0 - || ((*((int64_t *) key) ^ *((int64_t *) key+2)) & 0xFEFEFEFEFEFEFEFEULL) == 0) - retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error - - break; - - default: - // Unknown/wrong cipher ID - return ERR_CIPHER_INIT_FAILURE; - } - - return retVal; -} - -void EncipherBlock(int cipher, void *data, void *ks) -{ - switch (cipher) - { - case AES256: - case AES192: - case AES128: - aes_encrypt (data, data, ks); break; - case TWOFISH: twofish_encrypt (ks, data, data); break; - case SERPENT: serpent_encrypt (data, data, ks); break; - case BLOWFISH: BF_ecb_le_encrypt (data, data, ks, 1); break; // Deprecated/legacy - case DES56: des_encrypt (data, ks, 1); break; // Deprecated/legacy - case CAST: CAST_ecb_encrypt (data, data, ks, 1); break; // Deprecated/legacy - case TRIPLEDES: des_ecb3_encrypt (data, data, ks, // Deprecated/legacy - (void*)((char*) ks + CipherGetKeyScheduleSize (DES56)), (void*)((char*) ks + CipherGetKeyScheduleSize (DES56) * 2), 1); break; - default: fatal("EncipherBlock(): Unknown/wrong ID\n"); // Unknown/wrong ID - } -} - -void DecipherBlock(int cipher, void *data, void *ks) -{ - switch (cipher) - { - case SERPENT: serpent_decrypt (data, data, ks); break; - case TWOFISH: twofish_decrypt (ks, data, data); break; - case AES256: - case AES192: - case AES128: - aes_decrypt (data, data, (void *) ((char *) ks + sizeof(aes_encrypt_ctx))); break; - case BLOWFISH: BF_ecb_le_encrypt (data, data, ks, 0); break; // Deprecated/legacy - case DES56: des_encrypt (data, ks, 0); break; // Deprecated/legacy - case CAST: CAST_ecb_encrypt (data, data, ks,0); break; // Deprecated/legacy - case TRIPLEDES: des_ecb3_encrypt (data, data, ks, // Deprecated/legacy - (void*)((char*) ks + CipherGetKeyScheduleSize (DES56)), - (void*)((char*) ks + CipherGetKeyScheduleSize (DES56) * 2), 0); break; - default: fatal("DecipherBlock(): Unknown/wrong ID\n"); // Unknown/wrong ID - } -} - -// Ciphers support - -Cipher *CipherGet (int id) -{ - int i; - for (i = 0; Ciphers[i].Id != 0; i++) - if (Ciphers[i].Id == id) - return &Ciphers[i]; - - return NULL; -} - -char *CipherGetName (int cipherId) -{ - return CipherGet (cipherId) -> Name; -} - -int CipherGetBlockSize (int cipherId) -{ - return CipherGet (cipherId) -> BlockSize; -} - -int CipherGetKeySize (int cipherId) -{ - return CipherGet (cipherId) -> KeySize; -} - -int CipherGetKeyScheduleSize (int cipherId) -{ - return CipherGet (cipherId) -> KeyScheduleSize; -} - - -// Encryption algorithms support - -int EAGetFirst (void) -{ - return 1; -} - -// Returns number of EAs -int EAGetCount (void) -{ - int ea, count = 0; - - for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea)) - { - count++; - } - return count; -} - -int EAGetNext (int previousEA) -{ - int id = previousEA + 1; - if (EncryptionAlgorithms[id].Ciphers[0] != 0) return id; - return 0; -} - - -// Return values: 0 = success, ERR_CIPHER_INIT_FAILURE (fatal), ERR_CIPHER_INIT_WEAK_KEY (non-fatal) -int EAInit (int ea, unsigned char *key, uint8_t *ks) -{ - int c, retVal = ERR_SUCCESS; - - if (ea == 0) - return ERR_CIPHER_INIT_FAILURE; - - for (c = EAGetFirstCipher (ea); c != 0; c = EAGetNextCipher (ea, c)) - { - switch (CipherInit (c, key, ks)) - { - case ERR_CIPHER_INIT_FAILURE: - return ERR_CIPHER_INIT_FAILURE; - - case ERR_CIPHER_INIT_WEAK_KEY: - retVal = ERR_CIPHER_INIT_WEAK_KEY; // Non-fatal error - break; - } - - key += CipherGetKeySize (c); - ks += CipherGetKeyScheduleSize (c); - } - return retVal; -} - - -int EAInitMode (PCRYPTO_INFO ci) -{ - switch (ci->mode) - { - case XTS: - // Secondary key schedule - if (EAInit (ci->ea, ci->k2, ci->ks2) != ERR_SUCCESS) - return 0; - - /* Note: XTS mode could potentially be initialized with a weak key causing all blocks in one data unit - on the volume to be tweaked with zero tweaks (i.e. 512 bytes of the volume would be encrypted in ECB - mode). However, to create a TrueCrypt volume with such a weak key, each human being on Earth would have - to create approximately 11,378,125,361,078,862 (about eleven quadrillion) TrueCrypt volumes (provided - that the size of each of the volumes is 1024 terabytes). */ - break; - - case LRW: - switch (CipherGetBlockSize (EAGetFirstCipher (ci->ea))) - { - case 8: - /* Deprecated/legacy */ - return Gf64TabInit (ci->k2, &ci->gf_ctx); - - case 16: - return Gf128Tab64Init (ci->k2, &ci->gf_ctx); - - default: - fatal("EAInitMode(): Fatal exception\n"); - } - - break; - - case CBC: - case INNER_CBC: - case OUTER_CBC: - // The mode does not need to be initialized or is initialized elsewhere - return 1; - - default: - // Unknown/wrong ID - fatal("EAInitMode(): Unknown/wrong ID\n"); - } - return 1; -} - - -// Returns name of EA, cascaded cipher names are separated by hyphens -char *EAGetName (char *buf, int ea) -{ - int i = EAGetLastCipher(ea); - strcpy (buf, (i != 0) ? CipherGetName (i) : "?"); - - while ((i = EAGetPreviousCipher(ea, i))) - { - strcat (buf, "-"); - strcat (buf, CipherGetName (i)); - } - - return buf; -} - - -int EAGetByName (char *name) -{ - int ea = EAGetFirst (); - char n[128]; - - do - { - EAGetName (n, ea); - if (strcmp (n, name) == 0) - return ea; - } - while ((ea = EAGetNext (ea))); - - return 0; -} - -// Returns sum of key sizes of all ciphers of the EA (in bytes) -int EAGetKeySize (int ea) -{ - int i = EAGetFirstCipher (ea); - int size = CipherGetKeySize (i); - - while ((i = EAGetNextCipher (ea, i))) - { - size += CipherGetKeySize (i); - } - - return size; -} - - -// Returns the first mode of operation of EA -int EAGetFirstMode (int ea) -{ - return (EncryptionAlgorithms[ea].Modes[0]); -} - - -int EAGetNextMode (int ea, int previousModeId) -{ - int c, i = 0; - while ((c = EncryptionAlgorithms[ea].Modes[i++])) - { - if (c == previousModeId) - return EncryptionAlgorithms[ea].Modes[i]; - } - - return 0; -} - - -// Returns the name of the mode of operation of the whole EA -char *EAGetModeName (int ea, int mode, int capitalLetters) -{ - switch (mode) - { - case XTS: - - return "XTS"; - - case LRW: - - /* Deprecated/legacy */ - - return "LRW"; - - case CBC: - { - /* Deprecated/legacy */ - - char eaName[100]; - EAGetName (eaName, ea); - - if (strcmp (eaName, "Triple DES") == 0) - return capitalLetters ? "Outer-CBC" : "outer-CBC"; - - return "CBC"; - } - - case OUTER_CBC: - - /* Deprecated/legacy */ - - return capitalLetters ? "Outer-CBC" : "outer-CBC"; - - case INNER_CBC: - - /* Deprecated/legacy */ - - return capitalLetters ? "Inner-CBC" : "inner-CBC"; - - } - return "[unknown]"; -} - - - -// Returns sum of key schedule sizes of all ciphers of the EA -int EAGetKeyScheduleSize (int ea) -{ - int i = EAGetFirstCipher(ea); - int size = CipherGetKeyScheduleSize (i); - - while ((i = EAGetNextCipher(ea, i))) - { - size += CipherGetKeyScheduleSize (i); - } - - return size; -} - - -// Returns the largest key size needed by an EA for the specified mode of operation -int EAGetLargestKeyForMode (int mode) -{ - int ea, key = 0; - - for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea)) - { - if (!EAIsModeSupported (ea, mode)) - continue; - - if (EAGetKeySize (ea) >= key) - key = EAGetKeySize (ea); - } - return key; -} - - -// Returns the largest key needed by any EA for any mode -int EAGetLargestKey (void) -{ - int ea, key = 0; - - for (ea = EAGetFirst (); ea != 0; ea = EAGetNext (ea)) - { - if (EAGetKeySize (ea) >= key) - key = EAGetKeySize (ea); - } - - return key; -} - - -// Returns number of ciphers in EA -int EAGetCipherCount (int ea) -{ - int i = 0; - while (EncryptionAlgorithms[ea].Ciphers[i++]); - - return i - 1; -} - - -int EAGetFirstCipher (int ea) -{ - return EncryptionAlgorithms[ea].Ciphers[0]; -} - - -int EAGetLastCipher (int ea) -{ - int c, i = 0; - while ((c = EncryptionAlgorithms[ea].Ciphers[i++])); - - return EncryptionAlgorithms[ea].Ciphers[i - 2]; -} - - -int EAGetNextCipher (int ea, int previousCipherId) -{ - int c, i = 0; - while ((c = EncryptionAlgorithms[ea].Ciphers[i++])) - { - if (c == previousCipherId) - return EncryptionAlgorithms[ea].Ciphers[i]; - } - - return 0; -} - - -int EAGetPreviousCipher (int ea, int previousCipherId) -{ - int c, i = 0; - - if (EncryptionAlgorithms[ea].Ciphers[i++] == previousCipherId) - return 0; - - while ((c = EncryptionAlgorithms[ea].Ciphers[i++])) - { - if (c == previousCipherId) - return EncryptionAlgorithms[ea].Ciphers[i - 2]; - } - - return 0; -} - - -int EAIsFormatEnabled (int ea) -{ - return EncryptionAlgorithms[ea].FormatEnabled; -} - - -// Returns TRUE if the mode of operation is supported for the encryption algorithm -int EAIsModeSupported (int ea, int testedMode) -{ - int mode; - - for (mode = EAGetFirstMode (ea); mode != 0; mode = EAGetNextMode (ea, mode)) - { - if (mode == testedMode) - return 1; - } - return 0; -} - - -Hash *HashGet (int id) -{ - int i; - for (i = 0; Hashes[i].Id != 0; i++) - if (Hashes[i].Id == id) - return &Hashes[i]; - - return 0; -} - - -int HashGetIdByName (char *name) -{ - int i; - for (i = 0; Hashes[i].Id != 0; i++) - if (strcmp (Hashes[i].Name, name) == 0) - return Hashes[i].Id; - - return 0; -} - - -char *HashGetName (int hashId) -{ - return HashGet (hashId) -> Name; -} - - -int HashIsDeprecated (int hashId) -{ - return HashGet (hashId) -> Deprecated; -} - - -PCRYPTO_INFO crypto_open (void) -{ - /* Do the crt allocation */ - PCRYPTO_INFO cryptoInfo = (PCRYPTO_INFO) malloc (sizeof (CRYPTO_INFO)); - memset (cryptoInfo, 0, sizeof (CRYPTO_INFO)); - - if (cryptoInfo == NULL) - return NULL; - - cryptoInfo->ea = -1; - return cryptoInfo; -} - -void crypto_loadkey (PKEY_INFO keyInfo, char *lpszUserKey, int nUserKeyLen) -{ - keyInfo->keyLength = nUserKeyLen; - memset (keyInfo->userKey, 0x00, sizeof (keyInfo->userKey)); - memcpy (keyInfo->userKey, lpszUserKey, nUserKeyLen); -} - -void crypto_close (PCRYPTO_INFO cryptoInfo) -{ - if (cryptoInfo != NULL) - free (cryptoInfo); -} - - -void Xor128 (uint64_t *a, uint64_t *b) -{ - *a++ ^= *b++; - *a ^= *b; -} - - -void Xor64 (uint64_t *a, uint64_t *b) -{ - *a ^= *b; -} - - -void EncryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) -{ - /* Deprecated/legacy */ - - int cipher = EAGetFirstCipher (cryptoInfo->ea); - int cipherCount = EAGetCipherCount (cryptoInfo->ea); - uint8_t *p = buffer; - uint8_t *ks = cryptoInfo->ks; - uint8_t i[8]; - uint8_t t[16]; - uint64_t b; - - *(uint64_t *)i = BE64(blockIndex); - - if (length % 16) - fatal("EncryptBufferLRW128(): Length not divisible by 16\n"); - - // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). - - for (b = 0; b < length >> 4; b++) - { - Gf128MulBy64Tab (i, t, &cryptoInfo->gf_ctx); - Xor128 ((uint64_t *)p, (uint64_t *)t); - - if (cipherCount > 1) - { - // Cipher cascade - for (cipher = EAGetFirstCipher (cryptoInfo->ea); - cipher != 0; - cipher = EAGetNextCipher (cryptoInfo->ea, cipher)) - { - EncipherBlock (cipher, p, ks); - ks += CipherGetKeyScheduleSize (cipher); - } - ks = cryptoInfo->ks; - } - else - { - EncipherBlock (cipher, p, ks); - } - - Xor128 ((uint64_t *)p, (uint64_t *)t); - - p += 16; - - if (i[7] != 0xff) - i[7]++; - else - *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); - } - - memset (t, 0x00, sizeof(t)); -} - - -void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) -{ - /* Deprecated/legacy */ - - int cipher = EAGetFirstCipher (cryptoInfo->ea); - uint8_t *p = buffer; - uint8_t *ks = cryptoInfo->ks; - uint8_t i[8]; - uint8_t t[8]; - uint64_t b; - - *(uint64_t *)i = BE64(blockIndex); - - if (length % 8) - fatal("EncryptBufferLRW64(): Length not divisible by 8\n"); - - for (b = 0; b < length >> 3; b++) - { - Gf64MulTab (i, t, &cryptoInfo->gf_ctx); - Xor64 ((uint64_t *)p, (uint64_t *)t); - - EncipherBlock (cipher, p, ks); - - Xor64 ((uint64_t *)p, (uint64_t *)t); - - p += 8; - - if (i[7] != 0xff) - i[7]++; - else - *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); - } - - memset (t, 0x00, sizeof(t)); -} - - -void DecryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) -{ - /* Deprecated/legacy */ - - int cipher = EAGetFirstCipher (cryptoInfo->ea); - int cipherCount = EAGetCipherCount (cryptoInfo->ea); - uint8_t *p = buffer; - uint8_t *ks = cryptoInfo->ks; - uint8_t i[8]; - uint8_t t[16]; - uint64_t b; - - *(uint64_t *)i = BE64(blockIndex); - - if (length % 16) - fatal("DecryptufferLRW128(): Length not divisible by 16\n"); - - // Note that the maximum supported volume size is 8589934592 GB (i.e., 2^63 bytes). - - for (b = 0; b < length >> 4; b++) - { - Gf128MulBy64Tab (i, t, &cryptoInfo->gf_ctx); - Xor128 ((uint64_t *)p, (uint64_t *)t); - - if (cipherCount > 1) - { - // Cipher cascade - ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea); - - for (cipher = EAGetLastCipher (cryptoInfo->ea); - cipher != 0; - cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher)) - { - ks -= CipherGetKeyScheduleSize (cipher); - DecipherBlock (cipher, p, ks); - } - } - else - { - DecipherBlock (cipher, p, ks); - } - - Xor128 ((uint64_t *)p, (uint64_t *)t); - - p += 16; - - if (i[7] != 0xff) - i[7]++; - else - *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); - } - - memset (t, 0x00, sizeof(t)); -} - - - -void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo) -{ - /* Deprecated/legacy */ - - int cipher = EAGetFirstCipher (cryptoInfo->ea); - uint8_t *p = buffer; - uint8_t *ks = cryptoInfo->ks; - uint8_t i[8]; - uint8_t t[8]; - uint64_t b; - - *(uint64_t *)i = BE64(blockIndex); - - if (length % 8) - fatal("DecryptufferLRW64(): Length not divisible by 64\n"); - - for (b = 0; b < length >> 3; b++) - { - Gf64MulTab (i, t, &cryptoInfo->gf_ctx); - Xor64 ((uint64_t *)p, (uint64_t *)t); - - DecipherBlock (cipher, p, ks); - - Xor64 ((uint64_t *)p, (uint64_t *)t); - - p += 8; - - if (i[7] != 0xff) - i[7]++; - else - *(uint64_t *)i = BE64 ( BE64(*(uint64_t *)i) + 1 ); - } - - memset (t, 0x00, sizeof(t)); -} - - -// Initializes IV and whitening values for sector encryption/decryption in CBC mode. -// IMPORTANT: This function has been deprecated (legacy). -void -InitSectorIVAndWhitening (uint64_t unitNo, - int blockSize, - uint32_t *iv, - uint64_t *ivSeed, - uint32_t *whitening) -{ - - /* IMPORTANT: This function has been deprecated (legacy) */ - - uint64_t iv64[4]; - uint32_t *iv32 = (uint32_t *) iv64; - - iv64[0] = ivSeed[0] ^ LE64(unitNo); - iv64[1] = ivSeed[1] ^ LE64(unitNo); - iv64[2] = ivSeed[2] ^ LE64(unitNo); - if (blockSize == 16) - { - iv64[3] = ivSeed[3] ^ LE64(unitNo); - } - - iv[0] = iv32[0]; - iv[1] = iv32[1]; - - switch (blockSize) - { - case 16: - - // 128-bit block - - iv[2] = iv32[2]; - iv[3] = iv32[3]; - - whitening[0] = LE32( crc32int ( &iv32[4] ) ^ crc32int ( &iv32[7] ) ); - whitening[1] = LE32( crc32int ( &iv32[5] ) ^ crc32int ( &iv32[6] ) ); - break; - - case 8: - - // 64-bit block - - whitening[0] = LE32( crc32int ( &iv32[2] ) ^ crc32int ( &iv32[5] ) ); - whitening[1] = LE32( crc32int ( &iv32[3] ) ^ crc32int ( &iv32[4] ) ); - break; - - default: - fatal("InitSectorIVAndWhitening(): Invalid length: %i\n", blockSize); - } -} - - -// EncryptBufferCBC (deprecated/legacy) -// -// data: data to be encrypted -// len: number of bytes to encrypt (must be divisible by the largest cipher block size) -// ks: scheduled key -// iv: IV -// whitening: whitening constants -// ea: outer-CBC cascade ID (0 = CBC/inner-CBC) -// cipher: CBC/inner-CBC cipher ID (0 = outer-CBC) - -static void -EncryptBufferCBC (uint32_t *data, - unsigned int len, - uint8_t *ks, - uint32_t *iv, - uint32_t *whitening, - int ea, - int cipher) -{ - /* IMPORTANT: This function has been deprecated (legacy) */ - - uint32_t bufIV[4] = { 0 }; - uint64_t i; - int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher); - - if (len % blockSize) - fatal("EncryptBufferCBC(): Length not divisible by %i\n", blockSize); - - // IV - bufIV[0] = iv[0]; - bufIV[1] = iv[1]; - if (blockSize == 16) - { - bufIV[2] = iv[2]; - bufIV[3] = iv[3]; - } - - // Encrypt each block - for (i = 0; i < len/blockSize; i++) - { - // CBC - data[0] ^= bufIV[0]; - data[1] ^= bufIV[1]; - if (blockSize == 16) - { - data[2] ^= bufIV[2]; - data[3] ^= bufIV[3]; - } - - if (ea != 0) - { - // Outer-CBC - for (cipher = EAGetFirstCipher (ea); cipher != 0; cipher = EAGetNextCipher (ea, cipher)) - { - EncipherBlock (cipher, data, ks); - ks += CipherGetKeyScheduleSize (cipher); - } - ks -= EAGetKeyScheduleSize (ea); - } - else - { - // CBC/inner-CBC - EncipherBlock (cipher, data, ks); - } - - // CBC - bufIV[0] = data[0]; - bufIV[1] = data[1]; - if (blockSize == 16) - { - bufIV[2] = data[2]; - bufIV[3] = data[3]; - } - - // Whitening - data[0] ^= whitening[0]; - data[1] ^= whitening[1]; - if (blockSize == 16) - { - data[2] ^= whitening[0]; - data[3] ^= whitening[1]; - } - - data += blockSize / sizeof(*data); - } -} - - -// DecryptBufferCBC (deprecated/legacy) -// -// data: data to be decrypted -// len: number of bytes to decrypt (must be divisible by the largest cipher block size) -// ks: scheduled key -// iv: IV -// whitening: whitening constants -// ea: outer-CBC cascade ID (0 = CBC/inner-CBC) -// cipher: CBC/inner-CBC cipher ID (0 = outer-CBC) - -static void -DecryptBufferCBC (uint32_t *data, - unsigned int len, - uint8_t *ks, - uint32_t *iv, - uint32_t *whitening, - int ea, - int cipher) -{ - - /* IMPORTANT: This function has been deprecated (legacy) */ - - uint32_t bufIV[4] = { 0 }; - uint64_t i; - uint32_t ct[4]; - int blockSize = CipherGetBlockSize (ea != 0 ? EAGetFirstCipher (ea) : cipher); - - if (len % blockSize) - fatal("DecryptBufferCBC(): Length not divisible by %i\n", blockSize); - - // IV - bufIV[0] = iv[0]; - bufIV[1] = iv[1]; - if (blockSize == 16) - { - bufIV[2] = iv[2]; - bufIV[3] = iv[3]; - } - - // Decrypt each block - for (i = 0; i < len/blockSize; i++) - { - // Dewhitening - if (whitening) - { - data[0] ^= whitening[0]; - data[1] ^= whitening[1]; - if (blockSize == 16) - { - data[2] ^= whitening[0]; - data[3] ^= whitening[1]; - } - - // CBC - ct[0] = data[0]; - ct[1] = data[1]; - if (blockSize == 16) - { - ct[2] = data[2]; - ct[3] = data[3]; - } - } - - if (ea != 0) - { - // Outer-CBC - ks += EAGetKeyScheduleSize (ea); - for (cipher = EAGetLastCipher (ea); cipher != 0; cipher = EAGetPreviousCipher (ea, cipher)) - { - ks -= CipherGetKeyScheduleSize (cipher); - DecipherBlock (cipher, data, ks); - } - } - else - { - // CBC/inner-CBC - DecipherBlock (cipher, data, ks); - } - - // CBC - data[0] ^= bufIV[0]; - data[1] ^= bufIV[1]; - if (whitening) - { - bufIV[0] = ct[0]; - bufIV[1] = ct[1]; - } - if (blockSize == 16) - { - data[2] ^= bufIV[2]; - data[3] ^= bufIV[3]; - if (whitening) - { - bufIV[2] = ct[2]; - bufIV[3] = ct[3]; - } - } - - data += blockSize / sizeof(*data); - } -} - - -// EncryptBuffer -// -// buf: data to be encrypted -// len: number of bytes to encrypt; must be divisible by the block size (for cascaded -// ciphers divisible by the largest block size used within the cascade) -void EncryptBuffer (uint8_t *buf, - uint64_t len, - PCRYPTO_INFO cryptoInfo) -{ - switch (cryptoInfo->mode) - { - case XTS: - { - uint8_t *ks = cryptoInfo->ks; - uint8_t *ks2 = cryptoInfo->ks2; - UINT64_STRUCT dataUnitNo; - int cipher; - - // When encrypting/decrypting a buffer (typically a volume header) the sequential number - // of the first XTS data unit in the buffer is always 0 and the start of the buffer is - // always considered aligned with the start of a data unit. - dataUnitNo.LowPart = 0; - dataUnitNo.HighPart = 0; - - for (cipher = EAGetFirstCipher (cryptoInfo->ea); - cipher != 0; - cipher = EAGetNextCipher (cryptoInfo->ea, cipher)) - { - EncryptBufferXTS (buf, len, &dataUnitNo, 0, ks, ks2, cipher); - - ks += CipherGetKeyScheduleSize (cipher); - ks2 += CipherGetKeyScheduleSize (cipher); - } - } - break; - - case LRW: - - /* Deprecated/legacy */ - - switch (CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))) - { - case 8: - EncryptBufferLRW64 ((uint8_t *)buf, (uint64_t) len, 1, cryptoInfo); - break; - - case 16: - EncryptBufferLRW128 ((uint8_t *)buf, (uint64_t) len, 1, cryptoInfo); - break; - - default: - fatal("EncryptBuffer(): Invalid length: %i\n", CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))); - } - break; - - case CBC: - case INNER_CBC: - { - /* Deprecated/legacy */ - - uint8_t *ks = cryptoInfo->ks; - int cipher; - - for (cipher = EAGetFirstCipher (cryptoInfo->ea); - cipher != 0; - cipher = EAGetNextCipher (cryptoInfo->ea, cipher)) - { - EncryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - ks, - (uint32_t *) cryptoInfo->k2, - (uint32_t *) &cryptoInfo->k2[8], - 0, - cipher); - - ks += CipherGetKeyScheduleSize (cipher); - } - } - break; - - case OUTER_CBC: - - /* Deprecated/legacy */ - - EncryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - cryptoInfo->ks, - (uint32_t *) cryptoInfo->k2, - (uint32_t *) &cryptoInfo->k2[8], - cryptoInfo->ea, - 0); - - break; - - default: - // Unknown/wrong ID - fatal("EncryptBuffer(): Unknown/wrong ID\n"); - } -} - -// DecryptBuffer -// -// buf: data to be decrypted -// len: number of bytes to decrypt; must be divisible by the block size (for cascaded -// ciphers divisible by the largest block size used within the cascade) -void DecryptBuffer (uint8_t *buf, - uint64_t len, - uint32_t secSz, - uint64_t secN, - uint8_t flags, - PCRYPTO_INFO cryptoInfo) -{ - - void *iv = cryptoInfo->k2; - uint32_t sectorIV[4]; - uint32_t secWhitening[2]; - uint64_t *iv64 = (uint64_t *) iv; - - switch (cryptoInfo->mode) - { - case XTS: - { - uint8_t *ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea); - uint8_t *ks2 = cryptoInfo->ks2 + EAGetKeyScheduleSize (cryptoInfo->ea); - UINT64_STRUCT dataUnitNo; - int cipher; - - // When encrypting/decrypting a buffer (typically a volume header) the sequential number - // of the first XTS data unit in the buffer is always 0 and the start of the buffer is - // always considered aligned with the start of the data unit 0. - dataUnitNo.Value = secN; - - for (cipher = EAGetLastCipher (cryptoInfo->ea); - cipher != 0; - cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher)) - { - ks -= CipherGetKeyScheduleSize (cipher); - ks2 -= CipherGetKeyScheduleSize (cipher); - DecryptBufferXTS (buf, len, &dataUnitNo, 0, ks, ks2, cipher); - } - } - break; - - case LRW: - { - uint32_t n = 0; - if (flags & 2) - n = secN; - - switch (CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))) - { - case 8: - DecryptBufferLRW64 (buf, (uint64_t) len, 1 + (secSz / 8) * n, cryptoInfo); - break; - - case 16: - DecryptBufferLRW128 (buf, (uint64_t) len, 1 + (secSz / 16) * n, cryptoInfo); - break; - - default: - fatal("DecryptBuffer(): Invalid length: %i\n", CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea))); - } - break; - } - - case CBC: - case INNER_CBC: - { - /* Deprecated/legacy */ - - uint8_t *ks = cryptoInfo->ks + EAGetKeyScheduleSize (cryptoInfo->ea); - int cipher; - for (cipher = EAGetLastCipher (cryptoInfo->ea); - cipher != 0; - cipher = EAGetPreviousCipher (cryptoInfo->ea, cipher)) - { - ks -= CipherGetKeyScheduleSize (cipher); - - if (flags & 1) - { - DecryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - ks, - (uint32_t *) cryptoInfo->k2, - NULL, - 0, - cipher); - } - else if (flags & 2) - { - InitSectorIVAndWhitening (secN, CipherGetBlockSize (cipher), sectorIV, iv64, secWhitening); - DecryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - cryptoInfo->ks, - sectorIV, - secWhitening, - 0, - cipher); - } - else - { - DecryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - ks, - (uint32_t *) cryptoInfo->k2, - (uint32_t *) &cryptoInfo->k2[8], - 0, - cipher); - } - } - } - break; - - case OUTER_CBC: - if (flags & 1) - { - DecryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - cryptoInfo->ks, - (uint32_t *) cryptoInfo->k2, - NULL, - cryptoInfo->ea, - 0); - } - else if (flags & 2) - { - InitSectorIVAndWhitening (secN, CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea)), sectorIV, iv64, secWhitening); - DecryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - cryptoInfo->ks, - sectorIV, - secWhitening, - cryptoInfo->ea, - 0); - } - else - { - DecryptBufferCBC ((uint32_t *) buf, - (unsigned int) len, - cryptoInfo->ks, - (uint32_t *) cryptoInfo->k2, - (uint32_t *) &cryptoInfo->k2[8], - cryptoInfo->ea, - 0); - } - - break; - - default: - // Unknown/wrong ID - fatal("DecryptBuffer(): Unknown/wrong ID\n"); - } -} - -// Returns the maximum number of bytes necessary to be generated by the PBKDF2 (PKCS #5) -int GetMaxPkcs5OutSize (void) -{ - int size = 32; - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - - size = max (size, EAGetLargestKeyForMode (XTS) * 2); // Sizes of primary + secondary keys - - size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (LRW)); // Deprecated/legacy - size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (CBC)); // Deprecated/legacy - size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (OUTER_CBC)); // Deprecated/legacy - size = max (size, LEGACY_VOL_IV_SIZE + EAGetLargestKeyForMode (INNER_CBC)); // Deprecated/legacy - - return size; -} diff --git a/src/utils/common/crypto.h b/src/utils/common/crypto.h deleted file mode 100644 index 4e23a915c22..00000000000 --- a/src/utils/common/crypto.h +++ /dev/null @@ -1,306 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -/* Update the following when adding a new cipher or EA: - - Crypto.h: - ID #define - MAX_EXPANDED_KEY #define - - Crypto.c: - Ciphers[] - EncryptionAlgorithms[] - CipherInit() - EncipherBlock() - DecipherBlock() - -*/ - -#ifndef CRYPTO_H -#define CRYPTO_H - -#include - -enum -{ - ERR_SUCCESS = 0, - - ERR_OUTOFMEMORY = 2, - ERR_PASSWORD_WRONG, - - ERR_CIPHER_INIT_FAILURE = 17, - ERR_CIPHER_INIT_WEAK_KEY, - - ERR_MODE_INIT_FAILED = 27 -}; - -#ifdef __cplusplus -extern "C" { -#endif - -// Encryption data unit size, which may differ from the sector size and must always be 512 -#define ENCRYPTION_DATA_UNIT_SIZE 512 - -// Size of the salt (in bytes) -#define PKCS5_SALT_SIZE 64 - -// Size of the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode) -#define MASTER_KEYDATA_SIZE 256 - -// Size of the deprecated volume header item containing either an IV seed (CBC mode) or tweak key (LRW mode) -#define LEGACY_VOL_IV_SIZE 32 - -// Volume header byte offsets -#define HEADER_SALT_OFFSET 0 -#define HEADER_ENCRYPTED_DATA_OFFSET PKCS5_SALT_SIZE -#define HEADER_MASTER_KEYDATA_OFFSET 256 - -// Volume header sizes -#define HEADER_SIZE 512 -#define HEADER_ENCRYPTED_DATA_SIZE (HEADER_SIZE - HEADER_ENCRYPTED_DATA_OFFSET) - -/* The offset, in bytes, of the hidden volume header position from the end of the file (a positive value). - The extra offset (SECTOR_SIZE * 2) was added because FAT file system fills the last sector with zeroes - (marked as free; observed when quick format was performed using the OS format tool). One extra sector was - added to the offset for future expandability (should the header size increase, or should header backup be - introduced). */ -#define HIDDEN_VOL_HEADER_OFFSET (HEADER_SIZE + SECTOR_SIZE * 2) - - -// The first PRF to try when mounting -#define FIRST_PRF_ID 1 - -// Hash algorithms (pseudorandom functions). -enum -{ - RIPEMD160 = FIRST_PRF_ID, - SHA1, - WHIRLPOOL, - SHA512, - HASH_ENUM_END_ID -}; - -// The last PRF to try when mounting and also the number of implemented PRFs -#define LAST_PRF_ID (HASH_ENUM_END_ID - 1) - -#define RIPEMD160_BLOCKSIZE 64 -#define RIPEMD160_DIGESTSIZE 20 - -#define SHA1_BLOCKSIZE 64 -#define SHA1_DIGESTSIZE 20 - -#define SHA512_BLOCKSIZE 128 -#define SHA512_DIGESTSIZE 64 - -#define WHIRLPOOL_BLOCKSIZE 64 -#define WHIRLPOOL_DIGESTSIZE 64 - -#define MAX_DIGESTSIZE WHIRLPOOL_DIGESTSIZE - -#define DEFAULT_HASH_ALGORITHM FIRST_PRF_ID -#define DEFAULT_HASH_ALGORITHM_BOOT RIPEMD160 - -// The mode of operation used for newly created volumes and first to try when mounting -#define FIRST_MODE_OF_OPERATION_ID 1 - -// Modes of operation -enum -{ - /* If you add/remove a mode, update the following: GetMaxPkcs5OutSize(), EAInitMode() */ - - XTS = FIRST_MODE_OF_OPERATION_ID, - LRW, // Deprecated/legacy - CBC, // Deprecated/legacy - OUTER_CBC, // Deprecated/legacy - INNER_CBC, // Deprecated/legacy - MODE_ENUM_END_ID -}; - - -// The last mode of operation to try when mounting and also the number of implemented modes -#define LAST_MODE_OF_OPERATION (MODE_ENUM_END_ID - 1) - -// Ciphertext/plaintext block size for XTS mode (in bytes) -#define BYTES_PER_XTS_BLOCK 16 - -// Number of ciphertext/plaintext blocks per XTS data unit -#define BLOCKS_PER_XTS_DATA_UNIT (ENCRYPTION_DATA_UNIT_SIZE / BYTES_PER_XTS_BLOCK) - - -// Cipher IDs -enum -{ - NONE = 0, - AES256, - AES192, - AES128, - BLOWFISH, // Deprecated/legacy - CAST, // Deprecated/legacy - SERPENT, - TRIPLEDES, // Deprecated/legacy - TWOFISH, - DES56 // Deprecated/legacy (used only by Triple DES) -}; - -typedef struct -{ - int Id; // Cipher ID - char *Name; // Name - int BlockSize; // Block size (bytes) - int KeySize; // Key size (bytes) - int KeyScheduleSize; // Scheduled key size (bytes) -} Cipher; - -typedef struct -{ - int Ciphers[4]; // Null terminated array of ciphers used by encryption algorithm - int Modes[LAST_MODE_OF_OPERATION + 1]; // Null terminated array of modes of operation - int FormatEnabled; -} EncryptionAlgorithm; - -typedef struct -{ - int Id; // Hash ID - char *Name; // Name - int Deprecated; - int SystemEncryption; // Available for system encryption -} Hash; - -// Maxium length of scheduled key -#define AES_KS (sizeof(aes_encrypt_ctx) + sizeof(aes_decrypt_ctx)) - -#define SERPENT_KS (140 * 4) - -#define MAX_EXPANDED_KEY (AES_KS + SERPENT_KS + TWOFISH_KS) - -#define PRAND_DISK_WIPE_PASSES 200 - -# include "../crypto/aes.h" - -#include "../crypto/blowfish.h" -#include "../crypto/cast.h" -#include "../crypto/des.h" -#include "../crypto/serpent.h" -#include "../crypto/twofish.h" - -#include "../crypto/rmd160.h" -# include "../crypto/sha1.h" -# include "../crypto/sha2.h" -# include "../crypto/whirlpool.h" - -#include "gfmul.h" -#include "password.h" - -typedef struct keyInfo_t -{ - int noIterations; /* Number of times to iterate (PKCS-5) */ - int keyLength; /* Length of the key */ - int8_t userKey[MAX_PASSWORD]; /* Password (to which keyfiles may have been applied). WITHOUT +1 for the null terminator. */ - int8_t salt[PKCS5_SALT_SIZE]; /* PKCS-5 salt */ - int8_t master_keydata[MASTER_KEYDATA_SIZE]; /* Concatenated master primary and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */ -} KEY_INFO, *PKEY_INFO; - -typedef struct CRYPTO_INFO_t -{ - int ea; /* Encryption algorithm ID */ - int mode; /* Mode of operation (e.g., XTS) */ - uint8_t ks[MAX_EXPANDED_KEY]; /* Primary key schedule (if it is a cascade, it conatins multiple concatenated keys) */ - uint8_t ks2[MAX_EXPANDED_KEY]; /* Secondary key schedule (if cascade, multiple concatenated) for XTS mode. */ - - GfCtx gf_ctx; - - uint8_t master_keydata[MASTER_KEYDATA_SIZE]; /* This holds the volume header area containing concatenated master key(s) and secondary key(s) (XTS mode). For LRW (deprecated/legacy), it contains the tweak key before the master key(s). For CBC (deprecated/legacy), it contains the IV seed before the master key(s). */ - uint8_t k2[MASTER_KEYDATA_SIZE]; /* For XTS, this contains the secondary key (if cascade, multiple concatenated). For LRW (deprecated/legacy), it contains the tweak key. For CBC (deprecated/legacy), it contains the IV seed. */ - uint8_t salt[PKCS5_SALT_SIZE]; - int noIterations; - int pkcs5; - - // uint64_t volume_creation_time; - // uint64_t header_creation_time; - - // // Hidden volume status & parameters - // int hiddenVolume; // Indicates whether the volume is mounted/mountable as hidden volume - // int bProtectHiddenVolume; // Indicates whether the volume contains a hidden volume to be protected against overwriting - // int bHiddenVolProtectionAction; // TRUE if a write operation has been denied by the driver in order to prevent the hidden volume from being overwritten (set to FALSE upon volume mount). - - // uint64_t hiddenVolumeSize; // Size of the hidden volume excluding the header (in bytes). Set to 0 for standard volumes. - // uint64_t hiddenVolumeOffset; // Absolute position, in bytes, of the first hidden volume data sector within the host volume (provided that there is a hidden volume within). This must be set for all hidden volumes; in case of a normal volume, this variable is only used when protecting a hidden volume within it. - // uint64_t volDataAreaOffset; // Absolute position, in bytes, of the first data sector of the volume. - - // int bPartitionInInactiveSysEncScope; // If TRUE, the volume is a partition located on an encrypted system drive and mounted without pre-boot authentication. - - // UINT64_STRUCT FirstDataUnitNo; // First data unit number of the volume. This is 0 for file-hosted and non-system partition-hosted volumes. For partitions within key scope of system encryption this reflects real physical offset within the device (this is used e.g. when such a partition is mounted as a regular volume without pre-boot authentication). - // UINT64_STRUCT VolumeSize; - - // UINT64_STRUCT EncryptedAreaStart; - // UINT64_STRUCT EncryptedAreaLength; - -} CRYPTO_INFO, *PCRYPTO_INFO; - -PCRYPTO_INFO crypto_open (void); -void crypto_loadkey (PKEY_INFO keyInfo, char *lpszUserKey, int nUserKeyLen); -void crypto_close (PCRYPTO_INFO cryptoInfo); - -int CipherGetBlockSize (int cipher); -int CipherGetKeySize (int cipher); -int CipherGetKeyScheduleSize (int cipher); -char * CipherGetName (int cipher); - -int CipherInit (int cipher, unsigned char *key, unsigned char *ks); -int EAInit (int ea, unsigned char *key, unsigned char *ks); -int EAInitMode (PCRYPTO_INFO ci); -void EncipherBlock(int cipher, void *data, void *ks); -void DecipherBlock(int cipher, void *data, void *ks); - -int EAGetFirst (void); -int EAGetCount (void); -int EAGetNext (int previousEA); -char * EAGetName (char *buf, int ea); -int EAGetByName (char *name); -int EAGetKeySize (int ea); -int EAGetFirstMode (int ea); -int EAGetNextMode (int ea, int previousModeId); -char * EAGetModeName (int ea, int mode, int capitalLetters); -int EAGetKeyScheduleSize (int ea); -int EAGetLargestKey (void); -int EAGetLargestKeyForMode (int mode); - -int EAGetCipherCount (int ea); -int EAGetFirstCipher (int ea); -int EAGetLastCipher (int ea); -int EAGetNextCipher (int ea, int previousCipherId); -int EAGetPreviousCipher (int ea, int previousCipherId); -int EAIsFormatEnabled (int ea); -int EAIsModeSupported (int ea, int testedMode); - -char *HashGetName (int hash_algo_id); -int HashIsDeprecated (int hashId); - -int GetMaxPkcs5OutSize (void); - -void EncryptBuffer (uint8_t *buf, uint64_t len, PCRYPTO_INFO cryptoInfo); -void DecryptBuffer (uint8_t *buf, uint64_t len, uint32_t secSz, uint64_t secN, uint8_t flags, PCRYPTO_INFO cryptoInfo); - -void Xor128 (uint64_t *a, uint64_t *b); -void Xor64 (uint64_t *a, uint64_t *b); - -void EncryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); -void DecryptBufferLRW128 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); -void EncryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); -void DecryptBufferLRW64 (uint8_t *buffer, uint64_t length, uint64_t blockIndex, PCRYPTO_INFO cryptoInfo); - -void InitSectorIVAndWhitening (uint64_t unitNo, int blockSize, uint32_t *iv, uint64_t *ivSeed, uint32_t *whitening); - -#ifdef __cplusplus -} -#endif - -#endif /* CRYPTO_H */ diff --git a/src/utils/common/endian.c b/src/utils/common/endian.c deleted file mode 100644 index e4c75cf0748..00000000000 --- a/src/utils/common/endian.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#include "../common/endian.h" - - -uint16_t MirrorBytes16 (uint16_t x) -{ - return (x << 8) | (x >> 8); -} - - -uint32_t MirrorBytes32 (uint32_t x) -{ - uint32_t n = (uint8_t) x; - n <<= 8; n |= (uint8_t) (x >> 8); - n <<= 8; n |= (uint8_t) (x >> 16); - return (n << 8) | (uint8_t) (x >> 24); -} - -uint64_t MirrorBytes64 (uint64_t x) -{ - uint64_t n = (uint8_t) x; - n <<= 8; n |= (uint8_t) (x >> 8); - n <<= 8; n |= (uint8_t) (x >> 16); - n <<= 8; n |= (uint8_t) (x >> 24); - n <<= 8; n |= (uint8_t) (x >> 32); - n <<= 8; n |= (uint8_t) (x >> 40); - n <<= 8; n |= (uint8_t) (x >> 48); - return (n << 8) | (uint8_t) (x >> 56); -} - -void -LongReverse (uint32_t *buffer, unsigned byteCount) -{ - uint32_t value; - - byteCount /= sizeof (uint32_t); - while (byteCount--) - { - value = *buffer; - value = ((value & 0xFF00FF00L) >> 8) | \ - ((value & 0x00FF00FFL) << 8); - *buffer++ = (value << 16) | (value >> 16); - } -} diff --git a/src/utils/common/endian.h b/src/utils/common/endian.h deleted file mode 100644 index 2d9ea7f9f9e..00000000000 --- a/src/utils/common/endian.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#ifndef ENDIAN_H -#define ENDIAN_H - -#include - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define uint16 uint16_t -#define uint32 uint32_t - -#define uint64 uint64_t - -#ifdef _WIN32 - -# ifndef LITTLE_ENDIAN -# define LITTLE_ENDIAN 1234 -# endif -# ifndef BYTE_ORDER -# define BYTE_ORDER LITTLE_ENDIAN -# endif - -#elif !defined(BYTE_ORDER) - -# if defined (__APPLE__) -# include -# elif defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__DragonFly__) -# include -# else -# include -# endif - -# ifndef BYTE_ORDER -# ifndef __BYTE_ORDER -# error Byte order cannot be determined (BYTE_ORDER undefined) -# endif - -# define BYTE_ORDER __BYTE_ORDER -# endif - -# ifndef LITTLE_ENDIAN -# define LITTLE_ENDIAN __LITTLE_ENDIAN -# endif - -# ifndef BIG_ENDIAN -# define BIG_ENDIAN __BIG_ENDIAN -# endif - -#endif // !BYTE_ORDER - -/* Macros to read and write 16, 32, and 64-bit quantities in a portable manner. - These functions are implemented as macros rather than true functions as - the need to adjust the memory pointers makes them somewhat painful to call - in user code */ - -#define mputInt64(memPtr,data) \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 56 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 48 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 40 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 32 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 24 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 16 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 8 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( data ) & 0xFF ) - -#define mputLong(memPtr,data) \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 24 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 16 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 8 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( data ) & 0xFF ) - -#define mputWord(memPtr,data) \ - *memPtr++ = ( unsigned char ) ( ( ( data ) >> 8 ) & 0xFF ), \ - *memPtr++ = ( unsigned char ) ( ( data ) & 0xFF ) - -#define mputByte(memPtr,data) \ - *memPtr++ = ( unsigned char ) data - -#define mputBytes(memPtr,data,len) \ - memcpy (memPtr,data,len); \ - memPtr += len; - -#define mgetInt64(memPtr) \ - ( memPtr += 8, ( ( unsigned __int64 ) memPtr[ -8 ] << 56 ) | ( ( unsigned __int64 ) memPtr[ -7 ] << 48 ) | \ - ( ( unsigned __int64 ) memPtr[ -6 ] << 40 ) | ( ( unsigned __int64 ) memPtr[ -5 ] << 32 ) | \ - ( ( unsigned __int64 ) memPtr[ -4 ] << 24 ) | ( ( unsigned __int64 ) memPtr[ -3 ] << 16 ) | \ - ( ( unsigned __int64 ) memPtr[ -2 ] << 8 ) | ( unsigned __int64 ) memPtr[ -1 ] ) - -#define mgetLong(memPtr) \ - ( memPtr += 4, ( ( unsigned __int32 ) memPtr[ -4 ] << 24 ) | ( ( unsigned __int32 ) memPtr[ -3 ] << 16 ) | \ - ( ( unsigned __int32 ) memPtr[ -2 ] << 8 ) | ( unsigned __int32 ) memPtr[ -1 ] ) - -#define mgetWord(memPtr) \ - ( memPtr += 2, ( unsigned short ) memPtr[ -2 ] << 8 ) | ( ( unsigned short ) memPtr[ -1 ] ) - -#define mgetByte(memPtr) \ - ( ( unsigned char ) *memPtr++ ) - -#if BYTE_ORDER == BIG_ENDIAN -# define LE16(x) MirrorBytes16(x) -# define LE32(x) MirrorBytes32(x) -# define LE64(x) MirrorBytes64(x) -#else -# define LE16(x) (x) -# define LE32(x) (x) -# define LE64(x) (x) -#endif - -#if BYTE_ORDER == LITTLE_ENDIAN -# define BE16(x) MirrorBytes16(x) -# define BE32(x) MirrorBytes32(x) -# define BE64(x) MirrorBytes64(x) -#else -# define BE16(x) (x) -# define BE32(x) (x) -# define BE64(x) (x) -#endif - -uint16_t MirrorBytes16 (uint16_t x); -uint32_t MirrorBytes32 (uint32_t x); -uint64_t MirrorBytes64 (uint64_t x); -void LongReverse ( uint32_t *buffer , unsigned byteCount ); - -#if defined(__cplusplus) -} -#endif - -#endif /* ENDIAN_H */ diff --git a/src/utils/common/gfmul.c b/src/utils/common/gfmul.c deleted file mode 100644 index cadb5320770..00000000000 --- a/src/utils/common/gfmul.c +++ /dev/null @@ -1,886 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 31/01/2004 - - My thanks to John Viega and David McGrew for their support in developing - this code and to David for testing it on a big-endain system. -*/ - -/* - Portions Copyright (c) 2005 TrueCrypt Foundation - - TrueCrypt Foundation made the following changes: - - - Added multiplication in the finite field GF(2^128) optimized for - cases involving a 64-bit operand. - - - Added multiplication in the finite field GF(2^64). - - - Added MSB-first mode. - - - Added basic test algorithms. - - - Removed GCM. -*/ - -#include -#include -#include -#include "gfmul.h" -#include "../common/endian.h" - -/* BUFFER_ALIGN32 or BUFFER_ALIGN64 must be defined at this point to */ -/* enable faster operation by taking advantage of memory aligned values */ -/* NOTE: the BUFFER_ALIGN64 option has not been tested extensively */ - -#define BUFFER_ALIGN32 -#define UNROLL_LOOPS /* define to unroll some loops */ -#define IN_LINES /* define to use inline functions */ - /* in place of macros */ - -#define mode(x) GM_##x - -#if defined(__cplusplus) -extern "C" -{ -#endif - -typedef uint32_t mode(32t); -typedef uint64_t mode(64t); - -#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ -#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ - -#if BYTE_ORDER == LITTLE_ENDIAN -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -#endif - -#if BYTE_ORDER == BIG_ENDIAN -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -#endif - -#ifdef _MSC_VER -#pragma intrinsic(memcpy) -#define in_line __inline -#else -#define in_line -#endif - -#if 0 && defined(_MSC_VER) -#define rotl32 _lrotl -#define rotr32 _lrotr -#else -#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) -#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) -#endif - -#if !defined(bswap_32) -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) -#endif - -#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) -#define SWAP_BYTES -#else -#undef SWAP_BYTES -#endif - -#if defined(SWAP_BYTES) - -#if defined ( IN_LINES ) - -in_line void bsw_32(void * p, unsigned int n) -{ unsigned int i = n; - while(i--) - ((mode(32t)*)p)[i] = bswap_32(((mode(32t)*)p)[i]); -} - -#else - -#define bsw_32(p,n) \ - { int _i = (n); while(_i--) ((mode(32t)*)p)[_i] = bswap_32(((mode(32t)*)p)[_i]); } - -#endif - -#else -#define bsw_32(p,n) -#endif - -/* These values are used to detect long word alignment in order */ -/* to speed up some GCM buffer operations. This facility may */ -/* not work on some machines */ - -#define lp08(x) ((unsigned char*)(x)) -#define lp32(x) ((mode(32t)*)(x)) -#define lp64(x) ((mode(64t)*)(x)) - -#define A32_MASK 3 -#define A64_MASK 7 -#define aligned32(x) (!(((mode(32t))(x)) & A32_MASK)) -#define aligned64(x) (!(((mode(32t))(x)) & A64_MASK)) - -#if defined( BUFFER_ALIGN32 ) - -#define ADR_MASK A32_MASK -#define aligned aligned32 -#define lp lp32 -#define lp_inc 4 - -#if defined( IN_LINES ) - -in_line void move_block_aligned( void *p, const void *q) -{ - lp32(p)[0] = lp32(q)[0], lp32(p)[1] = lp32(q)[1], - lp32(p)[2] = lp32(q)[2], lp32(p)[3] = lp32(q)[3]; -} - -in_line void move_block_aligned64( void *p, const void *q) -{ - lp32(p)[0] = lp32(q)[0], lp32(p)[1] = lp32(q)[1]; -} - -in_line void xor_block_aligned( void *p, const void *q) -{ - lp32(p)[0] ^= lp32(q)[0], lp32(p)[1] ^= lp32(q)[1], - lp32(p)[2] ^= lp32(q)[2], lp32(p)[3] ^= lp32(q)[3]; -} - -in_line void xor_block_aligned64( void *p, const void *q) -{ - lp32(p)[0] ^= lp32(q)[0], lp32(p)[1] ^= lp32(q)[1]; -} - -#else - -#define move_block_aligned(p,q) \ - lp32(p)[0] = lp32(q)[0], lp32(p)[1] = lp32(q)[1], \ - lp32(p)[2] = lp32(q)[2], lp32(p)[3] = lp32(q)[3] - -#define xor_block_aligned(p,q) \ - lp32(p)[0] ^= lp32(q)[0], lp32(p)[1] ^= lp32(q)[1], \ - lp32(p)[2] ^= lp32(q)[2], lp32(p)[3] ^= lp32(q)[3] - -#endif - -#elif defined( BUFFER_ALIGN64 ) - -#define ADR_MASK A64_MASK -#define aligned aligned64 -#define lp lp64 -#define lp_inc 8 - -#define move_block_aligned(p,q) \ - lp64(p)[0] = lp64(q)[0], lp64(p)[1] = lp64(q)[1] - -#define xor_block_aligned(p,q) \ - lp64(p)[0] ^= lp64(q)[0], lp64(p)[1] ^= lp64(q)[1] - -#else -#define aligned(x) 0 -#endif - -#define move_block(p,q) memcpy((p), (q), BLOCK_LEN) - -#define xor_block(p,q) \ - lp08(p)[ 0] ^= lp08(q)[ 0], lp08(p)[ 1] ^= lp08(q)[ 1], \ - lp08(p)[ 2] ^= lp08(q)[ 2], lp08(p)[ 3] ^= lp08(q)[ 3], \ - lp08(p)[ 4] ^= lp08(q)[ 4], lp08(p)[ 5] ^= lp08(q)[ 5], \ - lp08(p)[ 6] ^= lp08(q)[ 6], lp08(p)[ 7] ^= lp08(q)[ 7], \ - lp08(p)[ 8] ^= lp08(q)[ 8], lp08(p)[ 9] ^= lp08(q)[ 9], \ - lp08(p)[10] ^= lp08(q)[10], lp08(p)[11] ^= lp08(q)[11], \ - lp08(p)[12] ^= lp08(q)[12], lp08(p)[13] ^= lp08(q)[13], \ - lp08(p)[14] ^= lp08(q)[14], lp08(p)[15] ^= lp08(q)[15] - - -#define gf_dat(q) {\ - q(0x00), q(0x01), q(0x02), q(0x03), q(0x04), q(0x05), q(0x06), q(0x07),\ - q(0x08), q(0x09), q(0x0a), q(0x0b), q(0x0c), q(0x0d), q(0x0e), q(0x0f),\ - q(0x10), q(0x11), q(0x12), q(0x13), q(0x14), q(0x15), q(0x16), q(0x17),\ - q(0x18), q(0x19), q(0x1a), q(0x1b), q(0x1c), q(0x1d), q(0x1e), q(0x1f),\ - q(0x20), q(0x21), q(0x22), q(0x23), q(0x24), q(0x25), q(0x26), q(0x27),\ - q(0x28), q(0x29), q(0x2a), q(0x2b), q(0x2c), q(0x2d), q(0x2e), q(0x2f),\ - q(0x30), q(0x31), q(0x32), q(0x33), q(0x34), q(0x35), q(0x36), q(0x37),\ - q(0x38), q(0x39), q(0x3a), q(0x3b), q(0x3c), q(0x3d), q(0x3e), q(0x3f),\ - q(0x40), q(0x41), q(0x42), q(0x43), q(0x44), q(0x45), q(0x46), q(0x47),\ - q(0x48), q(0x49), q(0x4a), q(0x4b), q(0x4c), q(0x4d), q(0x4e), q(0x4f),\ - q(0x50), q(0x51), q(0x52), q(0x53), q(0x54), q(0x55), q(0x56), q(0x57),\ - q(0x58), q(0x59), q(0x5a), q(0x5b), q(0x5c), q(0x5d), q(0x5e), q(0x5f),\ - q(0x60), q(0x61), q(0x62), q(0x63), q(0x64), q(0x65), q(0x66), q(0x67),\ - q(0x68), q(0x69), q(0x6a), q(0x6b), q(0x6c), q(0x6d), q(0x6e), q(0x6f),\ - q(0x70), q(0x71), q(0x72), q(0x73), q(0x74), q(0x75), q(0x76), q(0x77),\ - q(0x78), q(0x79), q(0x7a), q(0x7b), q(0x7c), q(0x7d), q(0x7e), q(0x7f),\ - q(0x80), q(0x81), q(0x82), q(0x83), q(0x84), q(0x85), q(0x86), q(0x87),\ - q(0x88), q(0x89), q(0x8a), q(0x8b), q(0x8c), q(0x8d), q(0x8e), q(0x8f),\ - q(0x90), q(0x91), q(0x92), q(0x93), q(0x94), q(0x95), q(0x96), q(0x97),\ - q(0x98), q(0x99), q(0x9a), q(0x9b), q(0x9c), q(0x9d), q(0x9e), q(0x9f),\ - q(0xa0), q(0xa1), q(0xa2), q(0xa3), q(0xa4), q(0xa5), q(0xa6), q(0xa7),\ - q(0xa8), q(0xa9), q(0xaa), q(0xab), q(0xac), q(0xad), q(0xae), q(0xaf),\ - q(0xb0), q(0xb1), q(0xb2), q(0xb3), q(0xb4), q(0xb5), q(0xb6), q(0xb7),\ - q(0xb8), q(0xb9), q(0xba), q(0xbb), q(0xbc), q(0xbd), q(0xbe), q(0xbf),\ - q(0xc0), q(0xc1), q(0xc2), q(0xc3), q(0xc4), q(0xc5), q(0xc6), q(0xc7),\ - q(0xc8), q(0xc9), q(0xca), q(0xcb), q(0xcc), q(0xcd), q(0xce), q(0xcf),\ - q(0xd0), q(0xd1), q(0xd2), q(0xd3), q(0xd4), q(0xd5), q(0xd6), q(0xd7),\ - q(0xd8), q(0xd9), q(0xda), q(0xdb), q(0xdc), q(0xdd), q(0xde), q(0xdf),\ - q(0xe0), q(0xe1), q(0xe2), q(0xe3), q(0xe4), q(0xe5), q(0xe6), q(0xe7),\ - q(0xe8), q(0xe9), q(0xea), q(0xeb), q(0xec), q(0xed), q(0xee), q(0xef),\ - q(0xf0), q(0xf1), q(0xf2), q(0xf3), q(0xf4), q(0xf5), q(0xf6), q(0xf7),\ - q(0xf8), q(0xf9), q(0xfa), q(0xfb), q(0xfc), q(0xfd), q(0xfe), q(0xff) } - -/* given the value i in 0..255 as the byte overflow when a a field */ -/* element in GHASH is multipled by x^8, this function will return */ -/* the values that are generated in the lo 16-bit word of the field */ -/* value by applying the modular polynomial. The values lo_byte and */ -/* hi_byte are returned via the macro xp_fun(lo_byte, hi_byte) so */ -/* that the values can be assembled into memory as required by a */ -/* suitable definition of this macro operating on the table above */ - -#define xp(i) xp_fun( \ - (i & 0x80 ? 0xe1 : 0) ^ (i & 0x40 ? 0x70 : 0) ^ \ - (i & 0x20 ? 0x38 : 0) ^ (i & 0x10 ? 0x1c : 0) ^ \ - (i & 0x08 ? 0x0e : 0) ^ (i & 0x04 ? 0x07 : 0) ^ \ - (i & 0x02 ? 0x03 : 0) ^ (i & 0x01 ? 0x01 : 0), \ - (i & 0x80 ? 0x00 : 0) ^ (i & 0x40 ? 0x80 : 0) ^ \ - (i & 0x20 ? 0x40 : 0) ^ (i & 0x10 ? 0x20 : 0) ^ \ - (i & 0x08 ? 0x10 : 0) ^ (i & 0x04 ? 0x08 : 0) ^ \ - (i & 0x02 ? 0x84 : 0) ^ (i & 0x01 ? 0xc2 : 0) ) - -#define xp64(i) xp_fun( \ - (i & 0x80 ? 0xd8 : 0) ^ (i & 0x40 ? 0x6c : 0) ^ \ - (i & 0x20 ? 0x36 : 0) ^ (i & 0x10 ? 0x1b : 0) ^ \ - (i & 0x08 ? 0x0d : 0) ^ (i & 0x04 ? 0x06 : 0) ^ \ - (i & 0x02 ? 0x03 : 0) ^ (i & 0x01 ? 0x01 : 0), \ - (i & 0x80 ? 0x00 : 0) ^ (i & 0x40 ? 0x00 : 0) ^ \ - (i & 0x20 ? 0x00 : 0) ^ (i & 0x10 ? 0x00 : 0) ^ \ - (i & 0x08 ? 0x80 : 0) ^ (i & 0x04 ? 0xc0 : 0) ^ \ - (i & 0x02 ? 0x60 : 0) ^ (i & 0x01 ? 0xb0 : 0) ) - -static mode(32t) gf_poly[2] = { 0, 0xe1000000 }; -static mode(32t) gf_poly64[2] = { 0, 0xd8000000 }; - -/* Multiply of a GF128 field element by x. The field element */ -/* is held in an array of bytes in which field bits 8n..8n + 7 */ -/* are held in byte[n], with lower indexed bits placed in the */ -/* more numerically significant bit positions in bytes. */ - -/* This function multiples a field element x, in the polynomial */ -/* field representation. It uses 32-bit word operations to gain */ -/* speed but compensates for machine endianess and hence works */ -/* correctly on both styles of machine */ - -in_line void mul_x(mode(32t) x[4]) -{ mode(32t) t; - - bsw_32(x, 4); - - /* at this point the filed element bits 0..127 are set out */ - /* as follows in 32-bit words (where the most significant */ - /* (ms) numeric bits are to the left) */ - /* */ - /* x[0] x[1] x[2] x[3] */ - /* ms ls ms ls ms ls ms ls */ - /* field: 0 ... 31 32 .. 63 64 .. 95 96 .. 127 */ - - t = gf_poly[x[3] & 1]; /* bit 127 of the element */ - x[3] = (x[3] >> 1) | (x[2] << 31); /* shift bits up by one */ - x[2] = (x[2] >> 1) | (x[1] << 31); /* position */ - x[1] = (x[1] >> 1) | (x[0] << 31); /* if bit 7 is 1 xor in */ - x[0] = (x[0] >> 1) ^ t; /* the field polynomial */ - bsw_32(x, 4); -} - -in_line void mul_x64(mode(32t) x[2]) -{ mode(32t) t; - - bsw_32(x, 2); - - /* at this point the filed element bits 0..127 are set out */ - /* as follows in 32-bit words (where the most significant */ - /* (ms) numeric bits are to the left) */ - /* */ - /* x[0] x[1] x[2] x[3] */ - /* ms ls ms ls ms ls ms ls */ - /* field: 0 ... 31 32 .. 63 64 .. 95 96 .. 127 */ - - t = gf_poly64[x[1] & 1]; /* bit 127 of the element */ - /* shift bits up by one */ - /* position */ - x[1] = (x[1] >> 1) | (x[0] << 31); /* if bit 7 is 1 xor in */ - x[0] = (x[0] >> 1) ^ t; /* the field polynomial */ - bsw_32(x, 2); -} - -/* Multiply of a GF128 field element by x^8 using 32-bit words */ -/* for speed - machine endianess matters here */ - -#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) - -#define xp_fun(x,y) ((mode(32t))(x)) | (((mode(32t))(y)) << 8) -static const uint16_t gft_le[256] = gf_dat(xp); -static const uint16_t gft_le64[256] = gf_dat(xp64); - -in_line void mul_lex8(mode(32t) x[4]) /* mutiply with long words */ -{ mode(32t) t = (x[3] >> 24); /* in little endian format */ - x[3] = (x[3] << 8) | (x[2] >> 24); - x[2] = (x[2] << 8) | (x[1] >> 24); - x[1] = (x[1] << 8) | (x[0] >> 24); - x[0] = (x[0] << 8) ^ gft_le[t]; -} - -in_line void mul_lex8_64(mode(32t) x[2]) /* mutiply with long words */ -{ mode(32t) t = (x[1] >> 24); /* in little endian format */ - x[1] = (x[1] << 8) | (x[0] >> 24); - x[0] = (x[0] << 8) ^ gft_le64[t]; -} - -#endif - -#if 1 || (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) - -#undef xp_fun -#define xp_fun(x,y) ((mode(32t))(y)) | (((mode(32t))(x)) << 8) -static const uint16_t gft_be[256] = gf_dat(xp); -static const uint16_t gft_be64[256] = gf_dat(xp64); - -in_line void mul_bex8(mode(32t) x[4]) /* mutiply with long words */ -{ mode(32t) t = (x[3] & 0xff); /* in big endian format */ - x[3] = (x[3] >> 8) | (x[2] << 24); - x[2] = (x[2] >> 8) | (x[1] << 24); - x[1] = (x[1] >> 8) | (x[0] << 24); - x[0] = (x[0] >> 8) ^ (((mode(32t))gft_be[t]) << 16); -} - -in_line void mul_bex8_64(mode(32t) x[2]) /* mutiply with long words */ -{ mode(32t) t = (x[1] & 0xff); /* in big endian format */ - x[1] = (x[1] >> 8) | (x[0] << 24); - x[0] = (x[0] >> 8) ^ (((mode(32t))gft_be64[t]) << 16); -} - -#endif - -/* hence choose the correct version for the machine endianess */ - -#if PLATFORM_BYTE_ORDER == BRG_BIG_ENDIAN -#define mul_x8 mul_bex8 -#define mul_x8_64 mul_bex8_64 -#else -#define mul_x8 mul_lex8 -#define mul_x8_64 mul_lex8_64 -#endif - -/* different versions of the general gf_mul function are provided */ -/* here. Sadly none are very fast :-( */ - -void GfMul128 (void *a, const void* b) -{ mode(32t) r[CBLK_LEN >> 2], p[8][CBLK_LEN >> 2]; - int i; - - move_block_aligned(p[0], b); - bsw_32(p[0], 4); - for(i = 0; i < 7; ++i) - { - p[i + 1][3] = (p[i][3] >> 1) | (p[i][2] << 31); - p[i + 1][2] = (p[i][2] >> 1) | (p[i][1] << 31); - p[i + 1][1] = (p[i][1] >> 1) | (p[i][0] << 31); - p[i + 1][0] = (p[i][0] >> 1) ^ gf_poly[p[i][3] & 1]; - } - - memset(r, 0, CBLK_LEN); - for(i = 0; i < 16; ++i) - { - if(i) mul_bex8(r); /* order is always big endian here */ - - if(((unsigned char*)a)[15 - i] & 0x80) - xor_block_aligned(r, p[0]); - if(((unsigned char*)a)[15 - i] & 0x40) - xor_block_aligned(r, p[1]); - if(((unsigned char*)a)[15 - i] & 0x20) - xor_block_aligned(r, p[2]); - if(((unsigned char*)a)[15 - i] & 0x10) - xor_block_aligned(r, p[3]); - if(((unsigned char*)a)[15 - i] & 0x08) - xor_block_aligned(r, p[4]); - if(((unsigned char*)a)[15 - i] & 0x04) - xor_block_aligned(r, p[5]); - if(((unsigned char*)a)[15 - i] & 0x02) - xor_block_aligned(r, p[6]); - if(((unsigned char*)a)[15 - i] & 0x01) - xor_block_aligned(r, p[7]); - } - bsw_32(r, 4); - move_block_aligned(a, r); -} - -#if defined( UNROLL_LOOPS ) - -#define xor_8k(i) \ - xor_block_aligned(r, ctx->gf_t8k[i + i][a[i] & 15]); \ - xor_block_aligned(r, ctx->gf_t8k[i + i + 1][a[i] >> 4]) - - -void GfMul128Tab (unsigned char a[CBLK_LEN], GfCtx8k *ctx) -{ uint32_t r[CBLK_LEN >> 2]; - - move_block_aligned(r, ctx->gf_t8k[0][a[0] & 15]); - xor_block_aligned(r, ctx->gf_t8k[1][a[0] >> 4]); - xor_8k( 1); xor_8k( 2); xor_8k( 3); - xor_8k( 4); xor_8k( 5); xor_8k( 6); xor_8k( 7); - xor_8k( 8); xor_8k( 9); xor_8k(10); xor_8k(11); - xor_8k(12); xor_8k(13); xor_8k(14); xor_8k(15); - move_block_aligned(a, r); -} - -#else - -void GfMul128Tab (unsigned char a[CBLK_LEN], GfCtx8k *ctx) -{ uint32_t r[CBLK_LEN >> 2], *p; - int i; - - p = ctx->gf_t8k[0][a[0] & 15]; - memcpy(r, p, CBLK_LEN); - p = ctx->gf_t8k[1][a[0] >> 4]; - xor_block_aligned(r, p); - for(i = 1; i < CBLK_LEN; ++i) - { - xor_block_aligned(r, ctx->gf_t8k[i + i][a[i] & 15]); - xor_block_aligned(r, ctx->gf_t8k[i + i + 1][a[i] >> 4]); - } - memcpy(a, r, CBLK_LEN); -} - -#endif - -void compile_8k_table(uint8_t *a, GfCtx8k *ctx) -{ int i, j, k; - - memset(ctx->gf_t8k, 0, 32 * 16 * 16); - for(i = 0; i < 2 * CBLK_LEN; ++i) - { - if(i == 0) - { - memcpy(ctx->gf_t8k[1][8], a, CBLK_LEN); - for(j = 4; j > 0; j >>= 1) - { - memcpy(ctx->gf_t8k[1][j], ctx->gf_t8k[1][j + j], CBLK_LEN); - mul_x(ctx->gf_t8k[1][j]); - } - memcpy(ctx->gf_t8k[0][8], ctx->gf_t8k[1][1], CBLK_LEN); - mul_x(ctx->gf_t8k[0][8]); - for(j = 4; j > 0; j >>= 1) - { - memcpy(ctx->gf_t8k[0][j], ctx->gf_t8k[0][j + j], CBLK_LEN); - mul_x(ctx->gf_t8k[0][j]); - } - } - else if(i > 1) - for(j = 8; j > 0; j >>= 1) - { - memcpy(ctx->gf_t8k[i][j], ctx->gf_t8k[i - 2][j], CBLK_LEN); - mul_x8(ctx->gf_t8k[i][j]); - } - - for(j = 2; j < 16; j += j) - { - mode(32t) *pj = ctx->gf_t8k[i][j]; - mode(32t) *pk = ctx->gf_t8k[i][1]; - mode(32t) *pl = ctx->gf_t8k[i][j + 1]; - - for(k = 1; k < j; ++k) - { - *pl++ = pj[0] ^ *pk++; - *pl++ = pj[1] ^ *pk++; - *pl++ = pj[2] ^ *pk++; - *pl++ = pj[3] ^ *pk++; - } - } - } -} - - -void compile_4k_table64(uint8_t *a, GfCtx4k64 *ctx) -{ int i, j, k; - - memset(ctx->gf_t4k, 0, sizeof(ctx->gf_t4k)); - for(i = 0; i < 2 * CBLK_LEN8; ++i) - { - if(i == 0) - { - memcpy(ctx->gf_t4k[1][8], a, CBLK_LEN8); - for(j = 4; j > 0; j >>= 1) - { - memcpy(ctx->gf_t4k[1][j], ctx->gf_t4k[1][j + j], CBLK_LEN8); - mul_x64(ctx->gf_t4k[1][j]); - } - memcpy(ctx->gf_t4k[0][8], ctx->gf_t4k[1][1], CBLK_LEN8); - mul_x64(ctx->gf_t4k[0][8]); - for(j = 4; j > 0; j >>= 1) - { - memcpy(ctx->gf_t4k[0][j], ctx->gf_t4k[0][j + j], CBLK_LEN8); - mul_x64(ctx->gf_t4k[0][j]); - } - } - else if(i > 1) - for(j = 8; j > 0; j >>= 1) - { - memcpy(ctx->gf_t4k[i][j], ctx->gf_t4k[i - 2][j], CBLK_LEN8); - mul_x8_64(ctx->gf_t4k[i][j]); - } - - for(j = 2; j < 16; j += j) - { - mode(32t) *pj = ctx->gf_t4k[i][j]; - mode(32t) *pk = ctx->gf_t4k[i][1]; - mode(32t) *pl = ctx->gf_t4k[i][j + 1]; - - for(k = 1; k < j; ++k) - { - *pl++ = pj[0] ^ *pk++; - *pl++ = pj[1] ^ *pk++; - *pl++ = pj[2] ^ *pk++; - *pl++ = pj[3] ^ *pk++; - } - } - } -} - -static int IsBitSet128 (unsigned int bit, uint8_t *a) -{ - return a[(127 - bit) / 8] & (0x80 >> ((127 - bit) % 8)); -} - -static int IsBitSet64 (unsigned int bit, uint8_t *a) -{ - return a[(63 - bit) / 8] & (0x80 >> ((63 - bit) % 8)); -} - -static void SetBit128 (unsigned int bit, uint8_t *a) -{ - a[(127 - bit) / 8] |= 0x80 >> ((127 - bit) % 8); -} - -static void SetBit64 (unsigned int bit, uint8_t *a) -{ - a[(63 - bit) / 8] |= 0x80 >> ((63 - bit) % 8); -} - -void MirrorBits128 (uint8_t *a) -{ - uint8_t t[128 / 8]; - int i; - memset (t,0,16); - for (i = 0; i < 128; i++) - { - if (IsBitSet128(i, a)) - SetBit128 (127 - i, t); - } - memcpy (a, t, sizeof (t)); -} - -void MirrorBits64 (uint8_t *a) -{ - uint8_t t[64 / 8]; - int i; - memset (t,0,8); - for (i = 0; i < 64; i++) - { - if (IsBitSet64(i, a)) - SetBit64 (63 - i, t); - } - memcpy (a, t, sizeof (t)); -} - -/* Allocate and initialize speed optimization table - for multiplication by 64-bit operand in MSB-first mode */ -int Gf128Tab64Init (uint8_t *a, GfCtx *ctx) -{ - GfCtx8k *ctx8k; - uint8_t am[16]; - int i, j; - - ctx8k = (GfCtx8k *) malloc (sizeof (GfCtx8k)); - if (!ctx8k) - return 0; - - memcpy (am, a, 16); - MirrorBits128 (am); - compile_8k_table (am, ctx8k); - - /* Convert 8k LSB-first table to 4k MSB-first */ - for (i = 16; i < 32; i++) - { - for (j = 0; j < 16; j++) - { - int jm = 0; - jm |= (j & 0x1) << 3; - jm |= (j & 0x2) << 1; - jm |= (j & 0x4) >> 1; - jm |= (j & 0x8) >> 3; - - memcpy (&ctx->gf_t128[i-16][jm], (unsigned char *)&ctx8k->gf_t8k[31-i][j], 16); - MirrorBits128 ((unsigned char *)&ctx->gf_t128[i-16][jm]); - } - } - - free (ctx8k); - return 1; -} - -int Gf64TabInit (uint8_t *a, GfCtx *ctx) -{ - /* Deprecated/legacy */ - - GfCtx4k64 *ctx4k; - uint8_t am[8]; - int i, j; - - ctx4k = (GfCtx4k64 *) malloc (sizeof (GfCtx4k64)); - if (!ctx4k) - return 0; - - memcpy (am, a, 8); - MirrorBits64 (am); - compile_4k_table64 (am, ctx4k); - - /* Convert LSB-first table to MSB-first */ - for (i = 0; i < 16; i++) - { - for (j = 0; j < 16; j++) - { - int jm = 0; - jm |= (j & 0x1) << 3; - jm |= (j & 0x2) << 1; - jm |= (j & 0x4) >> 1; - jm |= (j & 0x8) >> 3; - - memcpy (&ctx->gf_t64[i][jm], (unsigned char *)&ctx4k->gf_t4k[15-i][j], 8); - MirrorBits64 ((unsigned char *)&ctx->gf_t64[i][jm]); - } - } - - free (ctx4k); - return 1; -} - -#define xor_8kt64(i) \ - xor_block_aligned(r, ctx->gf_t128[i + i][a[i] & 15]); \ - xor_block_aligned(r, ctx->gf_t128[i + i + 1][a[i] >> 4]) - -/* Multiply a 128-bit number by a 64-bit number in the finite field GF(2^128) */ -void Gf128MulBy64Tab (uint8_t a[8], uint8_t p[16], GfCtx *ctx) -{ - uint32_t r[CBLK_LEN >> 2]; - - move_block_aligned(r, ctx->gf_t128[7*2][a[7] & 15]); - xor_block_aligned(r, ctx->gf_t128[7*2+1][a[7] >> 4]); - - if (*(uint16_t *)a) - { - xor_8kt64(0); - xor_8kt64(1); - } - if (a[2]) - { - xor_8kt64(2); - } - xor_8kt64(3); - xor_8kt64(4); - xor_8kt64(5); - xor_8kt64(6); - - move_block_aligned(p, r); -} - -#define xor_8k64(i) \ - xor_block_aligned64(r, ctx->gf_t64[i + i][a[i] & 15]); \ - xor_block_aligned64(r, ctx->gf_t64[i + i + 1][a[i] >> 4]) - -/* Multiply two 64-bit numbers in the finite field GF(2^64) */ -void Gf64MulTab (unsigned char a[8], unsigned char p[8], GfCtx *ctx) -{ - /* Deprecated/legacy */ - - uint32_t r[CBLK_LEN8 >> 2]; - - move_block_aligned64(r, ctx->gf_t64[7*2][a[7] & 15]); - xor_block_aligned64(r, ctx->gf_t64[7*2+1][a[7] >> 4]); - - if (*(uint16_t *)a) - { - xor_8k64(0); - xor_8k64(1); - } - if (a[2]) - { - xor_8k64(2); - } - xor_8k64(3); - xor_8k64(4); - xor_8k64(5); - xor_8k64(6); - - move_block_aligned64(p, r); -} - - -/* Basic algorithms for testing of optimized algorithms */ - -static void xor128 (uint64_t *a, uint64_t *b) -{ - *a++ ^= *b++; - *a ^= *b; -} - -static void shl128 (uint8_t *a) -{ - int i, x = 0, xx; - for (i = 15; i >= 0; i--) - { - xx = (a[i] & 0x80) >> 7; - a[i] = (a[i] << 1) | x; - x = xx; - } -} - -static void GfMul128Basic (uint8_t *a, uint8_t *b, uint8_t *p) -{ - int i; - uint8_t la[16]; - memcpy (la, a, 16); - memset (p, 0, 16); - - for (i = 0; i < 128; i++) - { - if (IsBitSet128 (i, b)) - xor128 ((uint64_t *)p, (uint64_t *)la); - - if (la[0] & 0x80) - { - shl128 (la); - la[15] ^= 0x87; - } - else - { - shl128 (la); - } - } -} - -static void xor64 (uint64_t *a, uint64_t *b) -{ - *a ^= *b; -} - -static void shl64 (uint8_t *a) -{ - int i, x = 0, xx; - for (i = 7; i >= 0; i--) - { - xx = (a[i] & 0x80) >> 7; - a[i] = (a[i] << 1) | x; - x = xx; - } -} - -static void GfMul64Basic (uint8_t *a, uint8_t *b, uint8_t* p) -{ - /* Deprecated/legacy */ - - int i; - uint8_t la[8]; - memcpy (la, a, 8); - memset (p, 0, 8); - - for (i = 0; i < 64; i++) - { - if (IsBitSet64 (i, b)) - xor64 ((uint64_t *)p, (uint64_t *)la); - - if (la[0] & 0x80) - { - shl64 (la); - la[7] ^= 0x1b; - } - else - { - shl64 (la); - } - } -} - - -int GfMulSelfTest (void) -{ - int result = 1; - uint8_t a[16]; - uint8_t b[16]; - uint8_t p1[16]; - uint8_t p2[16]; - GfCtx *gfCtx = (GfCtx *) malloc (sizeof (GfCtx)); - int i, j; - - if (!gfCtx) - return 0; - - /* GF(2^64) - deprecated/legacy */ - for (i = 0; i < 0x100; i++) - { - for (j = 0; j < 8; j++) - { - a[j] = (uint8_t) i; - b[j] = a[j] ^ 0xff; - } - - GfMul64Basic (a, b, p1); - - Gf64TabInit (a, gfCtx); - Gf64MulTab (b, p2, gfCtx); - - if (memcmp (p1, p2, 8) != 0) - result = 0; - } - - /* GF(2^128) */ - for (i = 0; i < 0x100; i++) - { - for (j = 0; j < 16; j++) - { - a[j] = (uint8_t) i; - b[j] = j < 8 ? 0 : a[j] ^ 0xff; - } - - GfMul128Basic (a, b, p1); - - Gf128Tab64Init (a, gfCtx); - Gf128MulBy64Tab (b + 8, p2, gfCtx); - - if (memcmp (p1, p2, 16) != 0) - result = 0; - } - - free (gfCtx); - return result; -} - -#if defined(__cplusplus) -} -#endif diff --git a/src/utils/common/gfmul.h b/src/utils/common/gfmul.h deleted file mode 100644 index 0f974161285..00000000000 --- a/src/utils/common/gfmul.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2003, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 31/01/2004 -*/ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - -#ifndef _GCM_H -#define _GCM_H - -#include - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define CBLK_LEN 16 /* encryption block length */ -#define CBLK_LEN8 8 - -typedef struct -{ - uint32_t gf_t8k[CBLK_LEN * 2][16][CBLK_LEN / 4]; -} GfCtx8k; - -typedef struct -{ - uint32_t gf_t4k[CBLK_LEN8 * 2][16][CBLK_LEN / 4]; -} GfCtx4k64; - -typedef struct -{ - /* union not used to support faster mounting */ - uint32_t gf_t128[CBLK_LEN * 2 / 2][16][CBLK_LEN / 4]; - uint32_t gf_t64[CBLK_LEN8 * 2][16][CBLK_LEN8 / 4]; -} GfCtx; - -typedef int ret_type; - -void GfMul128 (void *a, const void* b); -void GfMul128Tab(unsigned char a[16], GfCtx8k *ctx); -int Gf128Tab64Init (uint8_t *a, GfCtx *ctx); -void Gf128MulBy64Tab (uint8_t a[8], uint8_t p[16], GfCtx *ctx); -int Gf64TabInit (uint8_t *a, GfCtx *ctx); -void Gf64MulTab (unsigned char a[8], unsigned char p[8], GfCtx *ctx); -void MirrorBits128 (uint8_t *a); -void MirrorBits64 (uint8_t *a); -int GfMulSelfTest (void); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/src/utils/common/password.h b/src/utils/common/password.h deleted file mode 100644 index cbf4cc53bd5..00000000000 --- a/src/utils/common/password.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#ifndef PASSWORD_H -#define PASSWORD_H - -#include - -// User text input limits -#define MIN_PASSWORD 1 // Minimum password length -#define MAX_PASSWORD 64 // Maximum password length - -#define PASSWORD_LEN_WARNING 20 // Display a warning when a password is shorter than this - -#ifdef __cplusplus -extern "C" { -#endif - -typedef struct -{ - // Modifying this structure can introduce incompatibility with previous versions - int32_t Length; - unsigned char Text[MAX_PASSWORD + 1]; - char Pad[3]; // keep 64-bit alignment -} Password; - -#ifdef __cplusplus -} -#endif - -#endif // PASSWORD_H diff --git a/src/utils/common/pkcs5.c b/src/utils/common/pkcs5.c deleted file mode 100644 index 9a23e7ecb5e..00000000000 --- a/src/utils/common/pkcs5.c +++ /dev/null @@ -1,629 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#include -#include "../crypto/rmd160.h" -#include "../crypto/sha1.h" -#include "../crypto/sha2.h" -#include "../crypto/whirlpool.h" -#include "pkcs5.h" -#include "crypto.h" - -void hmac_truncate - ( - char *d1, /* data to be truncated */ - char *d2, /* truncated data */ - int len /* length in bytes to keep */ -) -{ - int i; - for (i = 0; i < len; i++) - d2[i] = d1[i]; -} - - -void hmac_sha512 -( - char *k, /* secret key */ - int lk, /* length of the key in bytes */ - char *d, /* data */ - int ld, /* length of data in bytes */ - char *out, /* output buffer, at least "t" bytes */ - int t -) -{ - sha512_ctx ictx, octx; - char isha[SHA512_DIGESTSIZE], osha[SHA512_DIGESTSIZE]; - char key[SHA512_DIGESTSIZE]; - char buf[SHA512_BLOCKSIZE]; - int i; - - /* If the key is longer than the hash algorithm block size, - let key = sha512(key), as per HMAC specifications. */ - if (lk > SHA512_BLOCKSIZE) - { - sha512_ctx tctx; - - sha512_begin (&tctx); - sha512_hash ((unsigned char *) k, lk, &tctx); - sha512_end ((unsigned char *) key, &tctx); - - k = key; - lk = SHA512_DIGESTSIZE; - - memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks - } - - /**** Inner Digest ****/ - - sha512_begin (&ictx); - - /* Pad the key for inner digest */ - for (i = 0; i < lk; ++i) - buf[i] = (char) (k[i] ^ 0x36); - for (i = lk; i < SHA512_BLOCKSIZE; ++i) - buf[i] = 0x36; - - sha512_hash ((unsigned char *) buf, SHA512_BLOCKSIZE, &ictx); - sha512_hash ((unsigned char *) d, ld, &ictx); - - sha512_end ((unsigned char *) isha, &ictx); - - /**** Outer Digest ****/ - - sha512_begin (&octx); - - for (i = 0; i < lk; ++i) - buf[i] = (char) (k[i] ^ 0x5C); - for (i = lk; i < SHA512_BLOCKSIZE; ++i) - buf[i] = 0x5C; - - sha512_hash ((unsigned char *) buf, SHA512_BLOCKSIZE, &octx); - sha512_hash ((unsigned char *) isha, SHA512_DIGESTSIZE, &octx); - - sha512_end ((unsigned char *) osha, &octx); - - /* truncate and print the results */ - t = t > SHA512_DIGESTSIZE ? SHA512_DIGESTSIZE : t; - hmac_truncate (osha, out, t); - - /* Prevent leaks */ - memset (&ictx, 0x00, sizeof(ictx)); - memset (&octx, 0x00, sizeof(octx)); - memset (isha, 0x00, sizeof(isha)); - memset (osha, 0x00, sizeof(osha)); - memset (buf, 0x00, sizeof(buf)); - memset (key, 0x00, sizeof(key)); -} - - -void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) -{ - char j[SHA512_DIGESTSIZE], k[SHA512_DIGESTSIZE]; - char init[128]; - char counter[4]; - int c, i; - - /* iteration 1 */ - memset (counter, 0, 4); - counter[3] = (char) b; - memcpy (init, salt, salt_len); /* salt */ - memcpy (&init[salt_len], counter, 4); /* big-endian block number */ - hmac_sha512 (pwd, pwd_len, init, salt_len + 4, j, SHA512_DIGESTSIZE); - memcpy (u, j, SHA512_DIGESTSIZE); - - /* remaining iterations */ - for (c = 1; c < iterations; c++) - { - hmac_sha512 (pwd, pwd_len, j, SHA512_DIGESTSIZE, k, SHA512_DIGESTSIZE); - for (i = 0; i < SHA512_DIGESTSIZE; i++) - { - u[i] ^= k[i]; - j[i] = k[i]; - } - } - - /* Prevent possible leaks. */ - memset (j, 0x00, sizeof(j)); - memset (k, 0x00, sizeof(k)); -} - - -void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) -{ - char u[SHA512_DIGESTSIZE]; - int b, l, r; - - if (dklen % SHA512_DIGESTSIZE) - { - l = 1 + dklen / SHA512_DIGESTSIZE; - } - else - { - l = dklen / SHA512_DIGESTSIZE; - } - - r = dklen - (l - 1) * SHA512_DIGESTSIZE; - - /* first l - 1 blocks */ - for (b = 1; b < l; b++) - { - derive_u_sha512 (pwd, pwd_len, salt, salt_len, iterations, u, b); - memcpy (dk, u, SHA512_DIGESTSIZE); - dk += SHA512_DIGESTSIZE; - } - - /* last block */ - derive_u_sha512 (pwd, pwd_len, salt, salt_len, iterations, u, b); - memcpy (dk, u, r); - - - /* Prevent possible leaks. */ - memset (u, 0x00, sizeof(u)); -} - - -/* Deprecated/legacy */ -void hmac_sha1 -( - char *k, /* secret key */ - int lk, /* length of the key in bytes */ - char *d, /* data */ - int ld, /* length of data in bytes */ - char *out, /* output buffer, at least "t" bytes */ - int t -) -{ - sha1_ctx ictx, octx; - char isha[SHA1_DIGESTSIZE], osha[SHA1_DIGESTSIZE]; - char key[SHA1_DIGESTSIZE]; - char buf[SHA1_BLOCKSIZE]; - int i; - - /* If the key is longer than the hash algorithm block size, - let key = sha1(key), as per HMAC specifications. */ - if (lk > SHA1_BLOCKSIZE) - { - sha1_ctx tctx; - - sha1_begin (&tctx); - sha1_hash ((unsigned char *) k, lk, &tctx); - sha1_end ((unsigned char *) key, &tctx); - - k = key; - lk = SHA1_DIGESTSIZE; - - memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks - } - - /**** Inner Digest ****/ - - sha1_begin (&ictx); - - /* Pad the key for inner digest */ - for (i = 0; i < lk; ++i) - buf[i] = (char) (k[i] ^ 0x36); - for (i = lk; i < SHA1_BLOCKSIZE; ++i) - buf[i] = 0x36; - - sha1_hash ((unsigned char *) buf, SHA1_BLOCKSIZE, &ictx); - sha1_hash ((unsigned char *) d, ld, &ictx); - - sha1_end ((unsigned char *) isha, &ictx); - - /**** Outer Digest ****/ - - sha1_begin (&octx); - - for (i = 0; i < lk; ++i) - buf[i] = (char) (k[i] ^ 0x5C); - for (i = lk; i < SHA1_BLOCKSIZE; ++i) - buf[i] = 0x5C; - - sha1_hash ((unsigned char *) buf, SHA1_BLOCKSIZE, &octx); - sha1_hash ((unsigned char *) isha, SHA1_DIGESTSIZE, &octx); - - sha1_end ((unsigned char *) osha, &octx); - - /* truncate and print the results */ - t = t > SHA1_DIGESTSIZE ? SHA1_DIGESTSIZE : t; - hmac_truncate (osha, out, t); - - /* Prevent leaks */ - memset (&ictx, 0x00, sizeof(ictx)); - memset (&octx, 0x00, sizeof(octx)); - memset (isha, 0x00, sizeof(isha)); - memset (osha, 0x00, sizeof(osha)); - memset (buf, 0x00, sizeof(buf)); - memset (key, 0x00, sizeof(key)); -} - - -/* Deprecated/legacy */ -void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) -{ - char j[SHA1_DIGESTSIZE], k[SHA1_DIGESTSIZE]; - char init[128]; - char counter[4]; - int c, i; - - /* iteration 1 */ - memset (counter, 0, 4); - counter[3] = (char) b; - memcpy (init, salt, salt_len); /* salt */ - memcpy (&init[salt_len], counter, 4); /* big-endian block number */ - hmac_sha1 (pwd, pwd_len, init, salt_len + 4, j, SHA1_DIGESTSIZE); - memcpy (u, j, SHA1_DIGESTSIZE); - - /* remaining iterations */ - for (c = 1; c < iterations; c++) - { - hmac_sha1 (pwd, pwd_len, j, SHA1_DIGESTSIZE, k, SHA1_DIGESTSIZE); - for (i = 0; i < SHA1_DIGESTSIZE; i++) - { - u[i] ^= k[i]; - j[i] = k[i]; - } - } - - /* Prevent possible leaks. */ - memset (j, 0x00, sizeof(j)); - memset (k, 0x00, sizeof(k)); -} - - -/* Deprecated/legacy */ -void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) -{ - char u[SHA1_DIGESTSIZE]; - int b, l, r; - - if (dklen % SHA1_DIGESTSIZE) - { - l = 1 + dklen / SHA1_DIGESTSIZE; - } - else - { - l = dklen / SHA1_DIGESTSIZE; - } - - r = dklen - (l - 1) * SHA1_DIGESTSIZE; - - /* first l - 1 blocks */ - for (b = 1; b < l; b++) - { - derive_u_sha1 (pwd, pwd_len, salt, salt_len, iterations, u, b); - memcpy (dk, u, SHA1_DIGESTSIZE); - dk += SHA1_DIGESTSIZE; - } - - /* last block */ - derive_u_sha1 (pwd, pwd_len, salt, salt_len, iterations, u, b); - memcpy (dk, u, r); - - - /* Prevent possible leaks. */ - memset (u, 0x00, sizeof(u)); -} - - -void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest) -{ - RMD160_CTX context; - unsigned char k_ipad[65]; /* inner padding - key XORd with ipad */ - unsigned char k_opad[65]; /* outer padding - key XORd with opad */ - unsigned char tk[RIPEMD160_DIGESTSIZE]; - int i; - - /* If the key is longer than the hash algorithm block size, - let key = ripemd160(key), as per HMAC specifications. */ - if (keylen > RIPEMD160_BLOCKSIZE) - { - RMD160_CTX tctx; - - RMD160Init(&tctx); - RMD160Update(&tctx, (const uint8_t *) key, keylen); - RMD160Final(tk, &tctx); - - key = (char *) tk; - keylen = RIPEMD160_DIGESTSIZE; - - memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks - } - - /* - - RMD160(K XOR opad, RMD160(K XOR ipad, text)) - - where K is an n byte key - ipad is the byte 0x36 repeated RIPEMD160_BLOCKSIZE times - opad is the byte 0x5c repeated RIPEMD160_BLOCKSIZE times - and text is the data being protected */ - - - /* start out by storing key in pads */ - memset(k_ipad, 0x36, sizeof(k_ipad)); - memset(k_opad, 0x5c, sizeof(k_opad)); - - /* XOR key with ipad and opad values */ - for (i=0; i WHIRLPOOL_BLOCKSIZE) - { - WHIRLPOOL_CTX tctx; - - WHIRLPOOL_init (&tctx); - WHIRLPOOL_add ((unsigned char *) k, lk * 8, &tctx); - WHIRLPOOL_finalize (&tctx, (unsigned char *) key); - - k = key; - lk = WHIRLPOOL_DIGESTSIZE; - - memset (&tctx, 0x00, sizeof(tctx)); // Prevent leaks - } - - /**** Inner Digest ****/ - - WHIRLPOOL_init (&ictx); - - /* Pad the key for inner digest */ - for (i = 0; i < lk; ++i) - buf[i] = (char) (k[i] ^ 0x36); - for (i = lk; i < WHIRLPOOL_BLOCKSIZE; ++i) - buf[i] = 0x36; - - WHIRLPOOL_add ((unsigned char *) buf, WHIRLPOOL_BLOCKSIZE * 8, &ictx); - WHIRLPOOL_add ((unsigned char *) d, ld * 8, &ictx); - - WHIRLPOOL_finalize (&ictx, (unsigned char *) iwhi); - - /**** Outer Digest ****/ - - WHIRLPOOL_init (&octx); - - for (i = 0; i < lk; ++i) - buf[i] = (char) (k[i] ^ 0x5C); - for (i = lk; i < WHIRLPOOL_BLOCKSIZE; ++i) - buf[i] = 0x5C; - - WHIRLPOOL_add ((unsigned char *) buf, WHIRLPOOL_BLOCKSIZE * 8, &octx); - WHIRLPOOL_add ((unsigned char *) iwhi, WHIRLPOOL_DIGESTSIZE * 8, &octx); - - WHIRLPOOL_finalize (&octx, (unsigned char *) owhi); - - /* truncate and print the results */ - t = t > WHIRLPOOL_DIGESTSIZE ? WHIRLPOOL_DIGESTSIZE : t; - hmac_truncate (owhi, out, t); - - /* Prevent possible leaks. */ - memset (&ictx, 0x00, sizeof(ictx)); - memset (&octx, 0x00, sizeof(octx)); - memset (owhi, 0x00, sizeof(owhi)); - memset (iwhi, 0x00, sizeof(iwhi)); - memset (buf, 0x00, sizeof(buf)); - memset (key, 0x00, sizeof(key)); -} - -void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b) -{ - char j[WHIRLPOOL_DIGESTSIZE], k[WHIRLPOOL_DIGESTSIZE]; - char init[128]; - char counter[4]; - int c, i; - - /* iteration 1 */ - memset (counter, 0, 4); - counter[3] = (char) b; - memcpy (init, salt, salt_len); /* salt */ - memcpy (&init[salt_len], counter, 4); /* big-endian block number */ - hmac_whirlpool (pwd, pwd_len, init, salt_len + 4, j, WHIRLPOOL_DIGESTSIZE); - memcpy (u, j, WHIRLPOOL_DIGESTSIZE); - - /* remaining iterations */ - for (c = 1; c < iterations; c++) - { - hmac_whirlpool (pwd, pwd_len, j, WHIRLPOOL_DIGESTSIZE, k, WHIRLPOOL_DIGESTSIZE); - for (i = 0; i < WHIRLPOOL_DIGESTSIZE; i++) - { - u[i] ^= k[i]; - j[i] = k[i]; - } - } - - /* Prevent possible leaks. */ - memset (j, 0x00, sizeof(j)); - memset (k, 0x00, sizeof(k)); -} - -void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen) -{ - char u[WHIRLPOOL_DIGESTSIZE]; - int b, l, r; - - if (dklen % WHIRLPOOL_DIGESTSIZE) - { - l = 1 + dklen / WHIRLPOOL_DIGESTSIZE; - } - else - { - l = dklen / WHIRLPOOL_DIGESTSIZE; - } - - r = dklen - (l - 1) * WHIRLPOOL_DIGESTSIZE; - - /* first l - 1 blocks */ - for (b = 1; b < l; b++) - { - derive_u_whirlpool (pwd, pwd_len, salt, salt_len, iterations, u, b); - memcpy (dk, u, WHIRLPOOL_DIGESTSIZE); - dk += WHIRLPOOL_DIGESTSIZE; - } - - /* last block */ - derive_u_whirlpool (pwd, pwd_len, salt, salt_len, iterations, u, b); - memcpy (dk, u, r); - - - /* Prevent possible leaks. */ - memset (u, 0x00, sizeof(u)); -} - - -char *get_pkcs5_prf_name (int pkcs5_prf_id) -{ - switch (pkcs5_prf_id) - { - case SHA512: - return "HMAC-SHA-512"; - - case SHA1: // Deprecated/legacy - return "HMAC-SHA-1"; - - case RIPEMD160: - return "HMAC-RIPEMD-160"; - - case WHIRLPOOL: - return "HMAC-Whirlpool"; - - default: - return "(Unknown)"; - } -} - - -int get_pkcs5_iteration_count (int pkcs5_prf_id, int bBoot) -{ - switch (pkcs5_prf_id) - { - case RIPEMD160: - return (bBoot ? 1000 : 2000); - - case SHA512: - return 1000; - - case SHA1: // Deprecated/legacy - return 2000; - - case WHIRLPOOL: - return 1000; - - default: - fatal("get_pkcs5_iteration_count(): Unknown/wrong ID\n"); // Unknown/wrong ID - } - return 0; -} diff --git a/src/utils/common/pkcs5.h b/src/utils/common/pkcs5.h deleted file mode 100644 index 4e05753dd49..00000000000 --- a/src/utils/common/pkcs5.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - Legal Notice: Some portions of the source code contained in this file were - derived from the source code of Encryption for the Masses 2.02a, which is - Copyright (c) 1998-2000 Paul Le Roux and which is governed by the 'License - Agreement for Encryption for the Masses'. Modifications and additions to - the original source code (contained in this file) and all other portions of - this file are Copyright (c) 2003-2008 TrueCrypt Foundation and are governed - by the TrueCrypt License 2.4 the full text of which is contained in the - file License.txt included in TrueCrypt binary and source code distribution - packages. */ - -#ifndef HEADER_PKCS5 -#define HEADER_PKCS5 - -#if defined(__cplusplus) -extern "C" -{ -#endif - -void hmac_sha512 (char *k, int lk, char *d, int ld, char *out, int t); -void derive_u_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); -void derive_key_sha512 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); -void hmac_sha1 (char *k, int lk, char *d, int ld, char *out, int t); -void derive_u_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); -void derive_key_sha1 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); -void hmac_ripemd160 (char *key, int keylen, char *input, int len, char *digest); -void derive_u_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); -void derive_key_ripemd160 (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); -void hmac_whirlpool (char *k, int lk, char *d, int ld, char *out, int t); -void derive_u_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *u, int b); -void derive_key_whirlpool (char *pwd, int pwd_len, char *salt, int salt_len, int iterations, char *dk, int dklen); -int get_pkcs5_iteration_count (int pkcs5_prf_id, int bBoot); -char *get_pkcs5_prf_name (int pkcs5_prf_id); - -#if defined(__cplusplus) -} -#endif - -#endif // HEADER_PKCS5 diff --git a/src/utils/common/xts.c b/src/utils/common/xts.c deleted file mode 100644 index 0b73da5547a..00000000000 --- a/src/utils/common/xts.c +++ /dev/null @@ -1,595 +0,0 @@ -/* - Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. - - Governed by the TrueCrypt License 2.4 the full text of which is contained - in the file License.txt included in TrueCrypt binary and source code - distribution packages. -*/ - -#include "xts.h" - - -#ifndef XTS_LOW_RESOURCE_VERSION - -// length: number of bytes to encrypt; may be larger than one data unit and must be divisible by the cipher block size -// ks: the primary key schedule -// ks2: the secondary key schedule -// startDataUnitNo: The sequential number of the data unit with which the buffer starts. -// startCipherBlockNo: The sequential number of the first plaintext block to encrypt inside the data unit startDataUnitNo. -// When encrypting the data unit from its first block, startCipherBlockNo is 0. -// The startCipherBlockNo value applies only to the first data unit in the buffer; each successive -// data unit is encrypted from its first block. The start of the buffer does not have to be -// aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it -// is not aligned, startCipherBlockNo must reflect the misalignment accordingly. -void EncryptBufferXTS (uint8_t *buffer, - uint64_t length, - const UINT64_STRUCT *startDataUnitNo, - unsigned int startCipherBlockNo, - uint8_t *ks, - uint8_t *ks2, - int cipher) -{ - uint8_t finalCarry; - uint8_t whiteningValues [ENCRYPTION_DATA_UNIT_SIZE]; - uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; - uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; - uint64_t *whiteningValuesPtr64 = (uint64_t *) whiteningValues; - uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; - uint64_t *bufPtr = (uint64_t *) buffer; - unsigned int startBlock = startCipherBlockNo, endBlock, block; - uint64_t *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; - uint64_t blockCount, dataUnitNo; - - /* The encrypted data unit number (i.e. the resultant ciphertext block) is to be multiplied in the - finite field GF(2^128) by j-th power of n, where j is the sequential plaintext/ciphertext block - number and n is 2, a primitive element of GF(2^128). This can be (and is) simplified and implemented - as a left shift of the preceding whitening value by one bit (with carry propagating). In addition, if - the shift of the highest byte results in a carry, 135 is XORed into the lowest byte. The value 135 is - derived from the modulus of the Galois Field (x^128+x^7+x^2+x+1). */ - - // Convert the 64-bit data unit number into a little-endian 16-byte array. - // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. - dataUnitNo = startDataUnitNo->Value; - *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); - *((uint64_t *) byteBufUnitNo + 1) = 0; - - if (length % BYTES_PER_XTS_BLOCK) - fatal("EncryptBufferXTS: Length not divisible by %i\n", BYTES_PER_XTS_BLOCK); - - blockCount = length / BYTES_PER_XTS_BLOCK; - - // Process all blocks in the buffer - // When length > ENCRYPTION_DATA_UNIT_SIZE, this can be parallelized (one data unit per core) - while (blockCount > 0) - { - if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) - endBlock = startBlock + (unsigned int) blockCount; - else - endBlock = BLOCKS_PER_XTS_DATA_UNIT; - - whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; - whiteningValuePtr64 = (uint64_t *) whiteningValue; - - // Encrypt the data unit number using the secondary key (in order to generate the first - // whitening value for this data unit) - *whiteningValuePtr64 = *((uint64_t *) byteBufUnitNo); - *(whiteningValuePtr64 + 1) = 0; - EncipherBlock (cipher, whiteningValue, ks2); - - // Generate subsequent whitening values for blocks in this data unit. Note that all generated 128-bit - // whitening values are stored in memory as a sequence of 64-bit integers in reverse order. - for (block = 0; block < endBlock; block++) - { - if (block >= startBlock) - { - *whiteningValuesPtr64-- = *whiteningValuePtr64++; - *whiteningValuesPtr64-- = *whiteningValuePtr64; - } - else - whiteningValuePtr64++; - - // Derive the next whitening value - -#if BYTE_ORDER == LITTLE_ENDIAN - - // Little-endian platforms (Intel, AMD, etc.) - - finalCarry = - (*whiteningValuePtr64 & 0x8000000000000000) ? - 135 : 0; - - *whiteningValuePtr64-- <<= 1; - - if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; - - *whiteningValuePtr64 <<= 1; - -#else - // Big-endian platforms (PowerPC, Motorola, etc.) - - finalCarry = - (*whiteningValuePtr64 & 0x80) ? - 135 : 0; - - *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); - - whiteningValuePtr64--; - - if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; - - *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); -#endif - - whiteningValue[0] ^= finalCarry; - } - - whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; - - // Encrypt all blocks in this data unit - // TO DO: This should be parallelized (one block per core) - for (block = startBlock; block < endBlock; block++) - { - // Pre-whitening - *bufPtr++ ^= *whiteningValuesPtr64--; - *bufPtr-- ^= *whiteningValuesPtr64++; - - // Actual encryption - EncipherBlock (cipher, bufPtr, ks); - - // Post-whitening - *bufPtr++ ^= *whiteningValuesPtr64--; - *bufPtr++ ^= *whiteningValuesPtr64--; - - blockCount--; - } - - startBlock = 0; - - dataUnitNo++; - - *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); - } - - memset (whiteningValue, 0x00, sizeof(whiteningValue)); - memset (whiteningValues, 0x00, sizeof(whiteningValues)); -} - - -// For descriptions of the input parameters, see EncryptBufferXTS(). -void DecryptBufferXTS (uint8_t *buffer, - uint64_t length, - const UINT64_STRUCT *startDataUnitNo, - unsigned int startCipherBlockNo, - uint8_t *ks, - uint8_t *ks2, - int cipher) -{ - uint8_t finalCarry; - uint8_t whiteningValues [ENCRYPTION_DATA_UNIT_SIZE]; - uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; - uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; - uint64_t *whiteningValuesPtr64 = (uint64_t *) whiteningValues; - uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; - uint64_t *bufPtr = (uint64_t *) buffer; - unsigned int startBlock = startCipherBlockNo, endBlock, block; - uint64_t *const finalInt64WhiteningValuesPtr = whiteningValuesPtr64 + sizeof (whiteningValues) / sizeof (*whiteningValuesPtr64) - 1; - uint64_t blockCount, dataUnitNo; - - // Convert the 64-bit data unit number into a little-endian 16-byte array. - // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. - dataUnitNo = startDataUnitNo->Value; - *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); - *((uint64_t *) byteBufUnitNo + 1) = 0; - - if (length % BYTES_PER_XTS_BLOCK) - fatal("DecryptBufferXTS: Length not divisible by %i\n", BYTES_PER_XTS_BLOCK); - - blockCount = length / BYTES_PER_XTS_BLOCK; - - // Process all blocks in the buffer - // When length > ENCRYPTION_DATA_UNIT_SIZE, this can be parallelized (one data unit per core) - while (blockCount > 0) - { - if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) - endBlock = startBlock + (unsigned int) blockCount; - else - endBlock = BLOCKS_PER_XTS_DATA_UNIT; - - whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; - whiteningValuePtr64 = (uint64_t *) whiteningValue; - - // Encrypt the data unit number using the secondary key (in order to generate the first - // whitening value for this data unit) - *whiteningValuePtr64 = *((uint64_t *) byteBufUnitNo); - *(whiteningValuePtr64 + 1) = 0; - EncipherBlock (cipher, whiteningValue, ks2); - - // Generate subsequent whitening values for blocks in this data unit. Note that all generated 128-bit - // whitening values are stored in memory as a sequence of 64-bit integers in reverse order. - for (block = 0; block < endBlock; block++) - { - if (block >= startBlock) - { - *whiteningValuesPtr64-- = *whiteningValuePtr64++; - *whiteningValuesPtr64-- = *whiteningValuePtr64; - } - else - whiteningValuePtr64++; - - // Derive the next whitening value - -#if BYTE_ORDER == LITTLE_ENDIAN - - // Little-endian platforms (Intel, AMD, etc.) - - finalCarry = - (*whiteningValuePtr64 & 0x8000000000000000) ? - 135 : 0; - - *whiteningValuePtr64-- <<= 1; - - if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; - - *whiteningValuePtr64 <<= 1; - -#else - // Big-endian platforms (PowerPC, Motorola, etc.) - - finalCarry = - (*whiteningValuePtr64 & 0x80) ? - 135 : 0; - - *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); - - whiteningValuePtr64--; - - if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; - - *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); -#endif - - whiteningValue[0] ^= finalCarry; - } - - whiteningValuesPtr64 = finalInt64WhiteningValuesPtr; - - // Decrypt blocks in this data unit - // TO DO: This should be parallelized (one block per core) - for (block = startBlock; block < endBlock; block++) - { - *bufPtr++ ^= *whiteningValuesPtr64--; - *bufPtr-- ^= *whiteningValuesPtr64++; - - DecipherBlock (cipher, bufPtr, ks); - - *bufPtr++ ^= *whiteningValuesPtr64--; - *bufPtr++ ^= *whiteningValuesPtr64--; - - blockCount--; - } - - startBlock = 0; - - dataUnitNo++; - - *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); - } - - memset (whiteningValue, 0x00, sizeof(whiteningValue)); - memset (whiteningValues, 0x00, sizeof(whiteningValues)); -} - - -#if 0 // The following function is currently unused but may be useful in future - -// Generates XTS whitening values. Use this function if you need to generate whitening values for more than -// one data unit in one pass (the value 'length' may be greater than the data unit size). 'buffer' must point -// to the LAST 8 bytes of the buffer for the whitening values. Note that the generated 128-bit whitening values -// are stored in memory as a sequence of 64-bit integers in reverse order. For descriptions of the input -// parameters, see EncryptBufferXTS(). -static void GenerateWhiteningValues (uint64_t *bufPtr64, - uint64_t length, - const UINT64_STRUCT *startDataUnitNo, - unsigned int startBlock, - uint8_t *ks2, - int cipher) -{ - unsigned int block; - unsigned int endBlock; - uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; - uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; - uint64_t *whiteningValuePtr64 = (uint64_t *) whiteningValue; - uint8_t finalCarry; - uint64_t *const finalInt64WhiteningValuePtr = whiteningValuePtr64 + sizeof (whiteningValue) / sizeof (*whiteningValuePtr64) - 1; - uint64_t blockCount, dataUnitNo; - - dataUnitNo = startDataUnitNo->Value; - - blockCount = length / BYTES_PER_XTS_BLOCK; - - // Convert the 64-bit data unit number into a little-endian 16-byte array. - // Note that as we are converting a 64-bit number into a 16-byte array we can always zero the last 8 bytes. - *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); - *((uint64_t *) byteBufUnitNo + 1) = 0; - - // Generate the whitening values. - // When length > ENCRYPTION_DATA_UNIT_SIZE, this can be parallelized (one data unit per core) - while (blockCount > 0) - { - if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) - endBlock = startBlock + (unsigned int) blockCount; - else - endBlock = BLOCKS_PER_XTS_DATA_UNIT; - - // Encrypt the data unit number using the secondary key (in order to generate the first - // whitening value for this data unit) - memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK); - EncipherBlock (cipher, whiteningValue, ks2); - - // Process all blocks in this data unit - for (block = 0; block < endBlock; block++) - { - if (block >= startBlock) - { - whiteningValuePtr64 = (uint64_t *) whiteningValue; - - *bufPtr64-- = *whiteningValuePtr64++; - *bufPtr64-- = *whiteningValuePtr64; - - blockCount--; - } - - // Derive the next whitening value - - whiteningValuePtr64 = finalInt64WhiteningValuePtr; - -#if BYTE_ORDER == LITTLE_ENDIAN - - // Little-endian platforms (Intel, AMD, etc.) - - finalCarry = - (*whiteningValuePtr64 & 0x8000000000000000) ? - 135 : 0; - - *whiteningValuePtr64-- <<= 1; - - if (*whiteningValuePtr64 & 0x8000000000000000) - *(whiteningValuePtr64 + 1) |= 1; - - *whiteningValuePtr64 <<= 1; - -#else - // Big-endian platforms (PowerPC, Motorola, etc.) - - finalCarry = - (*whiteningValuePtr64 & 0x80) ? - 135 : 0; - - *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); - - whiteningValuePtr64--; - - if (*whiteningValuePtr64 & 0x80) - *(whiteningValuePtr64 + 1) |= 0x0100000000000000; - - *whiteningValuePtr64 = LE64 (LE64 (*whiteningValuePtr64) << 1); -#endif - - whiteningValue[0] ^= finalCarry; - } - - startBlock = 0; - - dataUnitNo++; - - // Convert the 64-bit data unit number into a little-endian 16-byte array. - *((uint64_t *) byteBufUnitNo) = LE64 (dataUnitNo); - } - - memset (whiteningValue, 0x00, sizeof(whiteningValue)); -} -#endif // #if 0 - - -#else // XTS_LOW_RESOURCE_VERSION - - -#if BYTE_ORDER == BIG_ENDIAN -#error XTS_LOW_RESOURCE_VERSION is not compatible with big-endian platforms -#endif - - -// Increases a 64-bit value by one in a way compatible with non-64-bit environments/platforms -static void IncUint64Struct (UINT64_STRUCT *uint64Struct) -{ - uint64Struct->Value++; -} - - -// Converts a 64-bit unsigned integer (passed as two 32-bit integers for compatibility with non-64-bit -// environments/platforms) into a little-endian 16-byte array. -static void Uint64ToLE16ByteArray (uint8_t *byteBuf, unsigned __int32 highInt32, unsigned __int32 lowInt32) -{ - unsigned __int32 *bufPtr32 = (unsigned __int32 *) byteBuf; - - *bufPtr32++ = lowInt32; - *bufPtr32++ = highInt32; - - // We're converting a 64-bit number into a little-endian 16-byte array so we can zero the last 8 bytes - *bufPtr32++ = 0; - *bufPtr32 = 0; -} - - -// Generates and XORs XTS whitening values into blocks in the buffer. -// For descriptions of the input parameters, see EncryptBufferXTS(). -static void WhiteningPass (uint8_t *buffer, - uint64_t length, - const UINT64_STRUCT *startDataUnitNo, - unsigned int startBlock, - uint8_t *ks2, - int cipher) -{ - uint64_t blockCount; - UINT64_STRUCT dataUnitNo; - unsigned int block; - unsigned int endBlock; - uint8_t byteBufUnitNo [BYTES_PER_XTS_BLOCK]; - uint8_t whiteningValue [BYTES_PER_XTS_BLOCK]; - unsigned __int32 *bufPtr32 = (unsigned __int32 *) buffer; - unsigned __int32 *whiteningValuePtr32 = (unsigned __int32 *) whiteningValue; - uint8_t finalCarry; - unsigned __int32 *const finalDwordWhiteningValuePtr = whiteningValuePtr32 + sizeof (whiteningValue) / sizeof (*whiteningValuePtr32) - 1; - - // Store the 64-bit data unit number in a way compatible with non-64-bit environments/platforms - dataUnitNo.HighPart = startDataUnitNo->HighPart; - dataUnitNo.LowPart = startDataUnitNo->LowPart; - - blockCount = length / BYTES_PER_XTS_BLOCK; - - // Convert the 64-bit data unit number into a little-endian 16-byte array. - // (Passed as two 32-bit integers for compatibility with non-64-bit environments/platforms.) - Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); - - // Generate whitening values for all blocks in the buffer - while (blockCount > 0) - { - if (blockCount < BLOCKS_PER_XTS_DATA_UNIT) - endBlock = startBlock + (unsigned int) blockCount; - else - endBlock = BLOCKS_PER_XTS_DATA_UNIT; - - // Encrypt the data unit number using the secondary key (in order to generate the first - // whitening value for this data unit) - memcpy (whiteningValue, byteBufUnitNo, BYTES_PER_XTS_BLOCK); - EncipherBlock (cipher, whiteningValue, ks2); - - // Generate subsequent whitening values and XOR each whitening value into corresponding - // ciphertext/plaintext block - - for (block = 0; block < endBlock; block++) - { - if (block >= startBlock) - { - whiteningValuePtr32 = (unsigned __int32 *) whiteningValue; - - // XOR the whitening value into this ciphertext/plaintext block - *bufPtr32++ ^= *whiteningValuePtr32++; - *bufPtr32++ ^= *whiteningValuePtr32++; - *bufPtr32++ ^= *whiteningValuePtr32++; - *bufPtr32++ ^= *whiteningValuePtr32; - - blockCount--; - } - - // Derive the next whitening value - - finalCarry = 0; - - for (whiteningValuePtr32 = finalDwordWhiteningValuePtr; - whiteningValuePtr32 >= (unsigned __int32 *) whiteningValue; - whiteningValuePtr32--) - { - if (*whiteningValuePtr32 & 0x80000000) // If the following shift results in a carry - { - if (whiteningValuePtr32 != finalDwordWhiteningValuePtr) // If not processing the highest double word - { - // A regular carry - *(whiteningValuePtr32 + 1) |= 1; - } - else - { - // The highest byte shift will result in a carry - finalCarry = 135; - } - } - - *whiteningValuePtr32 <<= 1; - } - - whiteningValue[0] ^= finalCarry; - } - - startBlock = 0; - - // Increase the data unit number by one - IncUint64Struct (&dataUnitNo); - - // Convert the 64-bit data unit number into a little-endian 16-byte array. - Uint64ToLE16ByteArray (byteBufUnitNo, dataUnitNo.HighPart, dataUnitNo.LowPart); - } - - memset (whiteningValue, 0x00, sizeof(whiteningValue)); -} - - -// length: number of bytes to encrypt; may be larger than one data unit and must be divisible by the cipher block size -// ks: the primary key schedule -// ks2: the secondary key schedule -// dataUnitNo: The sequential number of the data unit with which the buffer starts. -// startCipherBlockNo: The sequential number of the first plaintext block to encrypt inside the data unit dataUnitNo. -// When encrypting the data unit from its first block, startCipherBlockNo is 0. -// The startCipherBlockNo value applies only to the first data unit in the buffer; each successive -// data unit is encrypted from its first block. The start of the buffer does not have to be -// aligned with the start of a data unit. If it is aligned, startCipherBlockNo must be 0; if it -// is not aligned, startCipherBlockNo must reflect the misalignment accordingly. -void EncryptBufferXTS (uint8_t *buffer, - uint64_t length, - const UINT64_STRUCT *dataUnitNo, - unsigned int startCipherBlockNo, - uint8_t *ks, - uint8_t *ks2, - int cipher) -{ - uint64_t blockCount; - uint8_t *bufPtr = buffer; - - if (length % BYTES_PER_XTS_BLOCK) - fatal("EncryptBufferXTS(): Length not divisibly by %i\n", BYTES_PER_XTS_BLOCK); - - // Pre-whitening (all plaintext blocks in the buffer) - WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); - - // Encrypt all plaintext blocks in the buffer - for (blockCount = 0; blockCount < length / BYTES_PER_XTS_BLOCK; blockCount++) - { - EncipherBlock (cipher, bufPtr, ks); - bufPtr += BYTES_PER_XTS_BLOCK; - } - - // Post-whitening (all ciphertext blocks in the buffer) - WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); -} - - -// For descriptions of the input parameters, see EncryptBufferXTS(). -void DecryptBufferXTS (uint8_t *buffer, - uint64_t length, - const UINT64_STRUCT *dataUnitNo, - unsigned int startCipherBlockNo, - uint8_t *ks, - uint8_t *ks2, - int cipher) -{ - uint64_t blockCount; - uint8_t *bufPtr = buffer; - - if (length % BYTES_PER_XTS_BLOCK) - fatal("DecryptBufferXTS(): Length not disivibly by %i\n", BYTES_PER_XTS_BLOCK); - - WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); - - for (blockCount = 0; blockCount < length / BYTES_PER_XTS_BLOCK; blockCount++) - { - DecipherBlock (cipher, bufPtr, ks); - bufPtr += BYTES_PER_XTS_BLOCK; - } - - WhiteningPass (buffer, length, dataUnitNo, startCipherBlockNo, ks2, cipher); -} - -#endif // XTS_LOW_RESOURCE_VERSION diff --git a/src/utils/common/xts.h b/src/utils/common/xts.h deleted file mode 100644 index 509c7403fa8..00000000000 --- a/src/utils/common/xts.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - Copyright (c) 2008 TrueCrypt Foundation. All rights reserved. - - Governed by the TrueCrypt License 2.4 the full text of which is contained - in the file License.txt included in TrueCrypt binary and source code - distribution packages. -*/ - -#ifndef XTS_H -#define XTS_H - -// Header files (optional) - -#include - -#include "../common/endian.h" -#include "crypto.h" - - -#ifdef __cplusplus -extern "C" { -#endif - -// Macros - -#ifndef LITTLE_ENDIAN -# define LITTLE_ENDIAN 1 -#endif - -#ifndef BIG_ENDIAN -# define BIG_ENDIAN 2 -#endif - -#ifndef BYTE_ORDER -# define BYTE_ORDER LITTLE_ENDIAN -#endif - -#ifndef LE64 -# if BYTE_ORDER == LITTLE_ENDIAN -# define LE64(x) (x) -# endif -#endif - -// Custom data types -typedef union { - struct { - uint32_t LowPart; - uint32_t HighPart; - }; - uint64_t Value; -} UINT64_STRUCT; - -// Public function prototypes - -void EncryptBufferXTS (uint8_t *buffer, uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); -void DecryptBufferXTS (uint8_t *buffer, uint64_t length, const UINT64_STRUCT *startDataUnitNo, unsigned int startCipherBlockNo, uint8_t *ks, uint8_t *ks2, int cipher); - -#ifdef __cplusplus -} -#endif - -#endif // #ifndef XTS_H diff --git a/src/utils/crypto/aes.h b/src/utils/crypto/aes.h deleted file mode 100644 index 42136fb519a..00000000000 --- a/src/utils/crypto/aes.h +++ /dev/null @@ -1,218 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 - - This file contains the definitions required to use AES in C. See aesopt.h - for optimisation details. -*/ - -/* Adapted by the TrueCrypt Foundation */ - -#ifndef _AES_H -#define _AES_H - -#include - -#define uint_32t uint32_t -#define uint_8t uint8_t - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 -#endif -#define INT_RETURN int - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#define AES_128 /* define if AES with 128 bit keys is needed */ -#define AES_192 /* define if AES with 192 bit keys is needed */ -#define AES_256 /* define if AES with 256 bit keys is needed */ -#define AES_VAR /* define if a variable key size is needed */ -// #define AES_MODES /* define if support is needed for modes */ - -/* The following must also be set in assembler files if being used */ - -#define AES_ENCRYPT /* if support for encryption is needed */ -#define AES_DECRYPT /* if support for decryption is needed */ -#define AES_ERR_CHK /* for parameter checks & error return codes */ -#define AES_REV_DKS /* define to reverse decryption key schedule */ - -#define AES_BLOCK_SIZE 16 /* the AES block size in bytes */ -#define N_COLS 4 /* the number of columns in the state */ - -/* The key schedule length is 11, 13 or 15 16-byte blocks for 128, */ -/* 192 or 256-bit keys respectively. That is 176, 208 or 240 bytes */ -/* or 44, 52 or 60 32-bit words. */ - -#if defined( AES_VAR ) || defined( AES_256 ) -#define KS_LENGTH 60 -#elif defined( AES_192 ) -#define KS_LENGTH 52 -#else -#define KS_LENGTH 44 -#endif - -#if defined( AES_ERR_CHK ) -#define AES_RETURN INT_RETURN -#else -#define AES_RETURN VOID_RETURN -#endif - -/* the character array 'inf' in the following structures is used */ -/* to hold AES context information. This AES code uses cx->inf.b[0] */ -/* to hold the number of rounds multiplied by 16. The other three */ -/* elements can be used by code that implements additional modes */ - -typedef union -{ uint_32t l; - uint_8t b[4]; -} aes_inf; - -typedef struct -{ uint_32t ks[KS_LENGTH]; - aes_inf inf; -} aes_encrypt_ctx; - -typedef struct -{ uint_32t ks[KS_LENGTH]; - aes_inf inf; -} aes_decrypt_ctx; - -/* This routine must be called before first use if non-static */ -/* tables are being used */ - -AES_RETURN aes_init(void); - -/* Key lengths in the range 16 <= key_len <= 32 are given in bytes, */ -/* those in the range 128 <= key_len <= 256 are given in bits */ - -#if defined( AES_ENCRYPT ) - -#if defined(AES_128) || defined(AES_VAR) -AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_192) || defined(AES_VAR) -AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_256) || defined(AES_VAR) -AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); -#endif - -#if defined(AES_VAR) -AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]); -#endif - -AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, const aes_encrypt_ctx cx[1]); - -#endif - -#if defined( AES_DECRYPT ) - -#if defined(AES_128) || defined(AES_VAR) -AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_192) || defined(AES_VAR) -AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_256) || defined(AES_VAR) -AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); -#endif - -#if defined(AES_VAR) -AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]); -#endif - -AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, const aes_decrypt_ctx cx[1]); - -#endif - -#if defined(AES_MODES) - -/* Multiple calls to the following subroutines for multiple block */ -/* ECB, CBC, CFB, OFB and CTR mode encryption can be used to handle */ -/* long messages incremantally provided that the context AND the iv */ -/* are preserved between all such calls. For the ECB and CBC modes */ -/* each individual call within a series of incremental calls must */ -/* process only full blocks (i.e. len must be a multiple of 16) but */ -/* the CFB, OFB and CTR mode calls can handle multiple incremental */ -/* calls of any length. Each mode is reset when a new AES key is */ -/* set but ECB and CBC operations can be reset without setting a */ -/* new key by setting a new IV value. To reset CFB, OFB and CTR */ -/* without setting the key, aes_mode_reset() must be called and the */ -/* IV must be set. NOTE: All these calls update the IV on exit so */ -/* this has to be reset if a new operation with the same IV as the */ -/* previous one is required (or decryption follows encryption with */ -/* the same IV array). */ - -AES_RETURN aes_test_alignment_detection(unsigned int n); - -AES_RETURN aes_ecb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_encrypt_ctx cx[1]); - -AES_RETURN aes_ecb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, const aes_decrypt_ctx cx[1]); - -AES_RETURN aes_cbc_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, const aes_encrypt_ctx cx[1]); - -AES_RETURN aes_cbc_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, const aes_decrypt_ctx cx[1]); - -AES_RETURN aes_mode_reset(aes_encrypt_ctx cx[1]); - -AES_RETURN aes_cfb_encrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx cx[1]); - -AES_RETURN aes_cfb_decrypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx cx[1]); - -#define aes_ofb_encrypt aes_ofb_crypt -#define aes_ofb_decrypt aes_ofb_crypt - -AES_RETURN aes_ofb_crypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *iv, aes_encrypt_ctx cx[1]); - -typedef void cbuf_inc(unsigned char *cbuf); - -#define aes_ctr_encrypt aes_ctr_crypt -#define aes_ctr_decrypt aes_ctr_crypt - -AES_RETURN aes_ctr_crypt(const unsigned char *ibuf, unsigned char *obuf, - int len, unsigned char *cbuf, cbuf_inc ctr_inc, aes_encrypt_ctx cx[1]); - -#endif - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/src/utils/crypto/aes_x64.asm b/src/utils/crypto/aes_x64.asm deleted file mode 100644 index f86afcf4dd6..00000000000 --- a/src/utils/crypto/aes_x64.asm +++ /dev/null @@ -1,904 +0,0 @@ - -; --------------------------------------------------------------------------- -; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. -; -; LICENSE TERMS -; -; The free distribution and use of this software is allowed (with or without -; changes) provided that: -; -; 1. source code distributions include the above copyright notice, this -; list of conditions and the following disclaimer; -; -; 2. binary distributions include the above copyright notice, this list -; of conditions and the following disclaimer in their documentation; -; -; 3. the name of the copyright holder is not used to endorse products -; built using this software without specific written permission. -; -; DISCLAIMER -; -; This software is provided 'as is' with no explicit or implied warranties -; in respect of its properties, including, but not limited to, correctness -; and/or fitness for purpose. -; --------------------------------------------------------------------------- -; Issue 20/12/2007 -; -; I am grateful to Dag Arne Osvik for many discussions of the techniques that -; can be used to optimise AES assembler code on AMD64/EM64T architectures. -; Some of the techniques used in this implementation are the result of -; suggestions made by him for which I am most grateful. - -; An AES implementation for AMD64 processors using the YASM assembler. This -; implemetation provides only encryption, decryption and hence requires key -; scheduling support in C. It uses 8k bytes of tables but its encryption and -; decryption performance is very close to that obtained using large tables. -; It can use either Windows or Gnu/Linux calling conventions, which are as -; follows: -; windows gnu/linux -; -; in_blk rcx rdi -; out_blk rdx rsi -; context (cx) r8 rdx -; -; preserved rsi - + rbx, rbp, rsp, r12, r13, r14 & r15 -; registers rdi - on both -; -; destroyed - rsi + rax, rcx, rdx, r8, r9, r10 & r11 -; registers - rdi on both -; -; The default convention is that for windows, the gnu/linux convention being -; used if __GNUC__ is defined. -; -; Define _SEH_ to include support for Win64 structured exception handling -; (this requires YASM version 0.6 or later). -; -; This code provides the standard AES block size (128 bits, 16 bytes) and the -; three standard AES key sizes (128, 192 and 256 bits). It has the same call -; interface as my C implementation. It uses the Microsoft C AMD64 calling -; conventions in which the three parameters are placed in rcx, rdx and r8 -; respectively. The rbx, rsi, rdi, rbp and r12..r15 registers are preserved. -; -; AES_RETURN aes_encrypt(const unsigned char in_blk[], -; unsigned char out_blk[], const aes_encrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt(const unsigned char in_blk[], -; unsigned char out_blk[], const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_encrypt_key(const unsigned char key[], -; const aes_encrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt_key(const unsigned char key[], -; const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_encrypt_key(const unsigned char key[], -; unsigned int len, const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt_key(const unsigned char key[], -; unsigned int len, const aes_decrypt_ctx cx[1]); -; -; where is 128, 102 or 256. In the last two calls the length can be in -; either bits or bytes. -; -; Comment in/out the following lines to obtain the desired subroutines. These -; selections MUST match those in the C header file aes.h - -; %define AES_128 ; define if AES with 128 bit keys is needed -; %define AES_192 ; define if AES with 192 bit keys is needed -%define AES_256 ; define if AES with 256 bit keys is needed -; %define AES_VAR ; define if a variable key size is needed -%define ENCRYPTION ; define if encryption is needed -%define DECRYPTION ; define if decryption is needed -%define AES_REV_DKS ; define if key decryption schedule is reversed -%define LAST_ROUND_TABLES ; define for the faster version using extra tables - -; The encryption key schedule has the following in memory layout where N is the -; number of rounds (10, 12 or 14): -; -; lo: | input key (round 0) | ; each round is four 32-bit words -; | encryption round 1 | -; | encryption round 2 | -; .... -; | encryption round N-1 | -; hi: | encryption round N | -; -; The decryption key schedule is normally set up so that it has the same -; layout as above by actually reversing the order of the encryption key -; schedule in memory (this happens when AES_REV_DKS is set): -; -; lo: | decryption round 0 | = | encryption round N | -; | decryption round 1 | = INV_MIX_COL[ | encryption round N-1 | ] -; | decryption round 2 | = INV_MIX_COL[ | encryption round N-2 | ] -; .... .... -; | decryption round N-1 | = INV_MIX_COL[ | encryption round 1 | ] -; hi: | decryption round N | = | input key (round 0) | -; -; with rounds except the first and last modified using inv_mix_column() -; But if AES_REV_DKS is NOT set the order of keys is left as it is for -; encryption so that it has to be accessed in reverse when used for -; decryption (although the inverse mix column modifications are done) -; -; lo: | decryption round 0 | = | input key (round 0) | -; | decryption round 1 | = INV_MIX_COL[ | encryption round 1 | ] -; | decryption round 2 | = INV_MIX_COL[ | encryption round 2 | ] -; .... .... -; | decryption round N-1 | = INV_MIX_COL[ | encryption round N-1 | ] -; hi: | decryption round N | = | encryption round N | -; -; This layout is faster when the assembler key scheduling provided here -; is used. -; -; The DLL interface must use the _stdcall convention in which the number -; of bytes of parameter space is added after an @ to the sutine's name. -; We must also remove our parameters from the stack before return (see -; the do_exit macro). Define DLL_EXPORT for the Dynamic Link Library version. - -;%define DLL_EXPORT - -; End of user defines - -%ifdef AES_VAR -%ifndef AES_128 -%define AES_128 -%endif -%ifndef AES_192 -%define AES_192 -%endif -%ifndef AES_256 -%define AES_256 -%endif -%endif - -%ifdef AES_VAR -%define KS_LENGTH 60 -%elifdef AES_256 -%define KS_LENGTH 60 -%elifdef AES_192 -%define KS_LENGTH 52 -%else -%define KS_LENGTH 44 -%endif - -%define r0 rax -%define r1 rdx -%define r2 rcx -%define r3 rbx -%define r4 rsi -%define r5 rdi -%define r6 rbp -%define r7 rsp - -%define raxd eax -%define rdxd edx -%define rcxd ecx -%define rbxd ebx -%define rsid esi -%define rdid edi -%define rbpd ebp -%define rspd esp - -%define raxb al -%define rdxb dl -%define rcxb cl -%define rbxb bl -%define rsib sil -%define rdib dil -%define rbpb bpl -%define rspb spl - -%define r0h ah -%define r1h dh -%define r2h ch -%define r3h bh - -%define r0d eax -%define r1d edx -%define r2d ecx -%define r3d ebx - -; finite field multiplies by {02}, {04} and {08} - -%define f2(x) ((x<<1)^(((x>>7)&1)*0x11b)) -%define f4(x) ((x<<2)^(((x>>6)&1)*0x11b)^(((x>>6)&2)*0x11b)) -%define f8(x) ((x<<3)^(((x>>5)&1)*0x11b)^(((x>>5)&2)*0x11b)^(((x>>5)&4)*0x11b)) - -; finite field multiplies required in table generation - -%define f3(x) (f2(x) ^ x) -%define f9(x) (f8(x) ^ x) -%define fb(x) (f8(x) ^ f2(x) ^ x) -%define fd(x) (f8(x) ^ f4(x) ^ x) -%define fe(x) (f8(x) ^ f4(x) ^ f2(x)) - -; macro for expanding S-box data - -%macro enc_vals 1 - db %1(0x63),%1(0x7c),%1(0x77),%1(0x7b),%1(0xf2),%1(0x6b),%1(0x6f),%1(0xc5) - db %1(0x30),%1(0x01),%1(0x67),%1(0x2b),%1(0xfe),%1(0xd7),%1(0xab),%1(0x76) - db %1(0xca),%1(0x82),%1(0xc9),%1(0x7d),%1(0xfa),%1(0x59),%1(0x47),%1(0xf0) - db %1(0xad),%1(0xd4),%1(0xa2),%1(0xaf),%1(0x9c),%1(0xa4),%1(0x72),%1(0xc0) - db %1(0xb7),%1(0xfd),%1(0x93),%1(0x26),%1(0x36),%1(0x3f),%1(0xf7),%1(0xcc) - db %1(0x34),%1(0xa5),%1(0xe5),%1(0xf1),%1(0x71),%1(0xd8),%1(0x31),%1(0x15) - db %1(0x04),%1(0xc7),%1(0x23),%1(0xc3),%1(0x18),%1(0x96),%1(0x05),%1(0x9a) - db %1(0x07),%1(0x12),%1(0x80),%1(0xe2),%1(0xeb),%1(0x27),%1(0xb2),%1(0x75) - db %1(0x09),%1(0x83),%1(0x2c),%1(0x1a),%1(0x1b),%1(0x6e),%1(0x5a),%1(0xa0) - db %1(0x52),%1(0x3b),%1(0xd6),%1(0xb3),%1(0x29),%1(0xe3),%1(0x2f),%1(0x84) - db %1(0x53),%1(0xd1),%1(0x00),%1(0xed),%1(0x20),%1(0xfc),%1(0xb1),%1(0x5b) - db %1(0x6a),%1(0xcb),%1(0xbe),%1(0x39),%1(0x4a),%1(0x4c),%1(0x58),%1(0xcf) - db %1(0xd0),%1(0xef),%1(0xaa),%1(0xfb),%1(0x43),%1(0x4d),%1(0x33),%1(0x85) - db %1(0x45),%1(0xf9),%1(0x02),%1(0x7f),%1(0x50),%1(0x3c),%1(0x9f),%1(0xa8) - db %1(0x51),%1(0xa3),%1(0x40),%1(0x8f),%1(0x92),%1(0x9d),%1(0x38),%1(0xf5) - db %1(0xbc),%1(0xb6),%1(0xda),%1(0x21),%1(0x10),%1(0xff),%1(0xf3),%1(0xd2) - db %1(0xcd),%1(0x0c),%1(0x13),%1(0xec),%1(0x5f),%1(0x97),%1(0x44),%1(0x17) - db %1(0xc4),%1(0xa7),%1(0x7e),%1(0x3d),%1(0x64),%1(0x5d),%1(0x19),%1(0x73) - db %1(0x60),%1(0x81),%1(0x4f),%1(0xdc),%1(0x22),%1(0x2a),%1(0x90),%1(0x88) - db %1(0x46),%1(0xee),%1(0xb8),%1(0x14),%1(0xde),%1(0x5e),%1(0x0b),%1(0xdb) - db %1(0xe0),%1(0x32),%1(0x3a),%1(0x0a),%1(0x49),%1(0x06),%1(0x24),%1(0x5c) - db %1(0xc2),%1(0xd3),%1(0xac),%1(0x62),%1(0x91),%1(0x95),%1(0xe4),%1(0x79) - db %1(0xe7),%1(0xc8),%1(0x37),%1(0x6d),%1(0x8d),%1(0xd5),%1(0x4e),%1(0xa9) - db %1(0x6c),%1(0x56),%1(0xf4),%1(0xea),%1(0x65),%1(0x7a),%1(0xae),%1(0x08) - db %1(0xba),%1(0x78),%1(0x25),%1(0x2e),%1(0x1c),%1(0xa6),%1(0xb4),%1(0xc6) - db %1(0xe8),%1(0xdd),%1(0x74),%1(0x1f),%1(0x4b),%1(0xbd),%1(0x8b),%1(0x8a) - db %1(0x70),%1(0x3e),%1(0xb5),%1(0x66),%1(0x48),%1(0x03),%1(0xf6),%1(0x0e) - db %1(0x61),%1(0x35),%1(0x57),%1(0xb9),%1(0x86),%1(0xc1),%1(0x1d),%1(0x9e) - db %1(0xe1),%1(0xf8),%1(0x98),%1(0x11),%1(0x69),%1(0xd9),%1(0x8e),%1(0x94) - db %1(0x9b),%1(0x1e),%1(0x87),%1(0xe9),%1(0xce),%1(0x55),%1(0x28),%1(0xdf) - db %1(0x8c),%1(0xa1),%1(0x89),%1(0x0d),%1(0xbf),%1(0xe6),%1(0x42),%1(0x68) - db %1(0x41),%1(0x99),%1(0x2d),%1(0x0f),%1(0xb0),%1(0x54),%1(0xbb),%1(0x16) -%endmacro - -%macro dec_vals 1 - db %1(0x52),%1(0x09),%1(0x6a),%1(0xd5),%1(0x30),%1(0x36),%1(0xa5),%1(0x38) - db %1(0xbf),%1(0x40),%1(0xa3),%1(0x9e),%1(0x81),%1(0xf3),%1(0xd7),%1(0xfb) - db %1(0x7c),%1(0xe3),%1(0x39),%1(0x82),%1(0x9b),%1(0x2f),%1(0xff),%1(0x87) - db %1(0x34),%1(0x8e),%1(0x43),%1(0x44),%1(0xc4),%1(0xde),%1(0xe9),%1(0xcb) - db %1(0x54),%1(0x7b),%1(0x94),%1(0x32),%1(0xa6),%1(0xc2),%1(0x23),%1(0x3d) - db %1(0xee),%1(0x4c),%1(0x95),%1(0x0b),%1(0x42),%1(0xfa),%1(0xc3),%1(0x4e) - db %1(0x08),%1(0x2e),%1(0xa1),%1(0x66),%1(0x28),%1(0xd9),%1(0x24),%1(0xb2) - db %1(0x76),%1(0x5b),%1(0xa2),%1(0x49),%1(0x6d),%1(0x8b),%1(0xd1),%1(0x25) - db %1(0x72),%1(0xf8),%1(0xf6),%1(0x64),%1(0x86),%1(0x68),%1(0x98),%1(0x16) - db %1(0xd4),%1(0xa4),%1(0x5c),%1(0xcc),%1(0x5d),%1(0x65),%1(0xb6),%1(0x92) - db %1(0x6c),%1(0x70),%1(0x48),%1(0x50),%1(0xfd),%1(0xed),%1(0xb9),%1(0xda) - db %1(0x5e),%1(0x15),%1(0x46),%1(0x57),%1(0xa7),%1(0x8d),%1(0x9d),%1(0x84) - db %1(0x90),%1(0xd8),%1(0xab),%1(0x00),%1(0x8c),%1(0xbc),%1(0xd3),%1(0x0a) - db %1(0xf7),%1(0xe4),%1(0x58),%1(0x05),%1(0xb8),%1(0xb3),%1(0x45),%1(0x06) - db %1(0xd0),%1(0x2c),%1(0x1e),%1(0x8f),%1(0xca),%1(0x3f),%1(0x0f),%1(0x02) - db %1(0xc1),%1(0xaf),%1(0xbd),%1(0x03),%1(0x01),%1(0x13),%1(0x8a),%1(0x6b) - db %1(0x3a),%1(0x91),%1(0x11),%1(0x41),%1(0x4f),%1(0x67),%1(0xdc),%1(0xea) - db %1(0x97),%1(0xf2),%1(0xcf),%1(0xce),%1(0xf0),%1(0xb4),%1(0xe6),%1(0x73) - db %1(0x96),%1(0xac),%1(0x74),%1(0x22),%1(0xe7),%1(0xad),%1(0x35),%1(0x85) - db %1(0xe2),%1(0xf9),%1(0x37),%1(0xe8),%1(0x1c),%1(0x75),%1(0xdf),%1(0x6e) - db %1(0x47),%1(0xf1),%1(0x1a),%1(0x71),%1(0x1d),%1(0x29),%1(0xc5),%1(0x89) - db %1(0x6f),%1(0xb7),%1(0x62),%1(0x0e),%1(0xaa),%1(0x18),%1(0xbe),%1(0x1b) - db %1(0xfc),%1(0x56),%1(0x3e),%1(0x4b),%1(0xc6),%1(0xd2),%1(0x79),%1(0x20) - db %1(0x9a),%1(0xdb),%1(0xc0),%1(0xfe),%1(0x78),%1(0xcd),%1(0x5a),%1(0xf4) - db %1(0x1f),%1(0xdd),%1(0xa8),%1(0x33),%1(0x88),%1(0x07),%1(0xc7),%1(0x31) - db %1(0xb1),%1(0x12),%1(0x10),%1(0x59),%1(0x27),%1(0x80),%1(0xec),%1(0x5f) - db %1(0x60),%1(0x51),%1(0x7f),%1(0xa9),%1(0x19),%1(0xb5),%1(0x4a),%1(0x0d) - db %1(0x2d),%1(0xe5),%1(0x7a),%1(0x9f),%1(0x93),%1(0xc9),%1(0x9c),%1(0xef) - db %1(0xa0),%1(0xe0),%1(0x3b),%1(0x4d),%1(0xae),%1(0x2a),%1(0xf5),%1(0xb0) - db %1(0xc8),%1(0xeb),%1(0xbb),%1(0x3c),%1(0x83),%1(0x53),%1(0x99),%1(0x61) - db %1(0x17),%1(0x2b),%1(0x04),%1(0x7e),%1(0xba),%1(0x77),%1(0xd6),%1(0x26) - db %1(0xe1),%1(0x69),%1(0x14),%1(0x63),%1(0x55),%1(0x21),%1(0x0c),%1(0x7d) -%endmacro - -%define u8(x) f2(x), x, x, f3(x), f2(x), x, x, f3(x) -%define v8(x) fe(x), f9(x), fd(x), fb(x), fe(x), f9(x), fd(x), x -%define w8(x) x, 0, 0, 0, x, 0, 0, 0 - -%define tptr rbp ; table pointer -%define kptr r8 ; key schedule pointer -%define fofs 128 ; adjust offset in key schedule to keep |disp| < 128 -%define fk_ref(x,y) [kptr-16*x+fofs+4*y] -%ifdef AES_REV_DKS -%define rofs 128 -%define ik_ref(x,y) [kptr-16*x+rofs+4*y] -%else -%define rofs -128 -%define ik_ref(x,y) [kptr+16*x+rofs+4*y] -%endif - -%define tab_0(x) [tptr+8*x] -%define tab_1(x) [tptr+8*x+3] -%define tab_2(x) [tptr+8*x+2] -%define tab_3(x) [tptr+8*x+1] -%define tab_f(x) byte [tptr+8*x+1] -%define tab_i(x) byte [tptr+8*x+7] -%define t_ref(x,r) tab_ %+ x(r) - -%macro ff_rnd 5 ; normal forward round - mov %1d, fk_ref(%5,0) - mov %2d, fk_ref(%5,1) - mov %3d, fk_ref(%5,2) - mov %4d, fk_ref(%5,3) - - movzx esi, al - movzx edi, ah - shr eax, 16 - xor %1d, t_ref(0,rsi) - xor %4d, t_ref(1,rdi) - movzx esi, al - movzx edi, ah - xor %3d, t_ref(2,rsi) - xor %2d, t_ref(3,rdi) - - movzx esi, bl - movzx edi, bh - shr ebx, 16 - xor %2d, t_ref(0,rsi) - xor %1d, t_ref(1,rdi) - movzx esi, bl - movzx edi, bh - xor %4d, t_ref(2,rsi) - xor %3d, t_ref(3,rdi) - - movzx esi, cl - movzx edi, ch - shr ecx, 16 - xor %3d, t_ref(0,rsi) - xor %2d, t_ref(1,rdi) - movzx esi, cl - movzx edi, ch - xor %1d, t_ref(2,rsi) - xor %4d, t_ref(3,rdi) - - movzx esi, dl - movzx edi, dh - shr edx, 16 - xor %4d, t_ref(0,rsi) - xor %3d, t_ref(1,rdi) - movzx esi, dl - movzx edi, dh - xor %2d, t_ref(2,rsi) - xor %1d, t_ref(3,rdi) - - mov eax,%1d - mov ebx,%2d - mov ecx,%3d - mov edx,%4d -%endmacro - -%ifdef LAST_ROUND_TABLES - -%macro fl_rnd 5 ; last forward round - add tptr, 2048 - mov %1d, fk_ref(%5,0) - mov %2d, fk_ref(%5,1) - mov %3d, fk_ref(%5,2) - mov %4d, fk_ref(%5,3) - - movzx esi, al - movzx edi, ah - shr eax, 16 - xor %1d, t_ref(0,rsi) - xor %4d, t_ref(1,rdi) - movzx esi, al - movzx edi, ah - xor %3d, t_ref(2,rsi) - xor %2d, t_ref(3,rdi) - - movzx esi, bl - movzx edi, bh - shr ebx, 16 - xor %2d, t_ref(0,rsi) - xor %1d, t_ref(1,rdi) - movzx esi, bl - movzx edi, bh - xor %4d, t_ref(2,rsi) - xor %3d, t_ref(3,rdi) - - movzx esi, cl - movzx edi, ch - shr ecx, 16 - xor %3d, t_ref(0,rsi) - xor %2d, t_ref(1,rdi) - movzx esi, cl - movzx edi, ch - xor %1d, t_ref(2,rsi) - xor %4d, t_ref(3,rdi) - - movzx esi, dl - movzx edi, dh - shr edx, 16 - xor %4d, t_ref(0,rsi) - xor %3d, t_ref(1,rdi) - movzx esi, dl - movzx edi, dh - xor %2d, t_ref(2,rsi) - xor %1d, t_ref(3,rdi) -%endmacro - -%else - -%macro fl_rnd 5 ; last forward round - mov %1d, fk_ref(%5,0) - mov %2d, fk_ref(%5,1) - mov %3d, fk_ref(%5,2) - mov %4d, fk_ref(%5,3) - - movzx esi, al - movzx edi, ah - shr eax, 16 - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - xor %1d, esi - rol edi, 8 - xor %4d, edi - movzx esi, al - movzx edi, ah - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - rol esi, 16 - rol edi, 24 - xor %3d, esi - xor %2d, edi - - movzx esi, bl - movzx edi, bh - shr ebx, 16 - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - xor %2d, esi - rol edi, 8 - xor %1d, edi - movzx esi, bl - movzx edi, bh - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - rol esi, 16 - rol edi, 24 - xor %4d, esi - xor %3d, edi - - movzx esi, cl - movzx edi, ch - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - shr ecx, 16 - xor %3d, esi - rol edi, 8 - xor %2d, edi - movzx esi, cl - movzx edi, ch - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - rol esi, 16 - rol edi, 24 - xor %1d, esi - xor %4d, edi - - movzx esi, dl - movzx edi, dh - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - shr edx, 16 - xor %4d, esi - rol edi, 8 - xor %3d, edi - movzx esi, dl - movzx edi, dh - movzx esi, t_ref(f,rsi) - movzx edi, t_ref(f,rdi) - rol esi, 16 - rol edi, 24 - xor %2d, esi - xor %1d, edi -%endmacro - -%endif - -%macro ii_rnd 5 ; normal inverse round - mov %1d, ik_ref(%5,0) - mov %2d, ik_ref(%5,1) - mov %3d, ik_ref(%5,2) - mov %4d, ik_ref(%5,3) - - movzx esi, al - movzx edi, ah - shr eax, 16 - xor %1d, t_ref(0,rsi) - xor %2d, t_ref(1,rdi) - movzx esi, al - movzx edi, ah - xor %3d, t_ref(2,rsi) - xor %4d, t_ref(3,rdi) - - movzx esi, bl - movzx edi, bh - shr ebx, 16 - xor %2d, t_ref(0,rsi) - xor %3d, t_ref(1,rdi) - movzx esi, bl - movzx edi, bh - xor %4d, t_ref(2,rsi) - xor %1d, t_ref(3,rdi) - - movzx esi, cl - movzx edi, ch - shr ecx, 16 - xor %3d, t_ref(0,rsi) - xor %4d, t_ref(1,rdi) - movzx esi, cl - movzx edi, ch - xor %1d, t_ref(2,rsi) - xor %2d, t_ref(3,rdi) - - movzx esi, dl - movzx edi, dh - shr edx, 16 - xor %4d, t_ref(0,rsi) - xor %1d, t_ref(1,rdi) - movzx esi, dl - movzx edi, dh - xor %2d, t_ref(2,rsi) - xor %3d, t_ref(3,rdi) - - mov eax,%1d - mov ebx,%2d - mov ecx,%3d - mov edx,%4d -%endmacro - -%ifdef LAST_ROUND_TABLES - -%macro il_rnd 5 ; last inverse round - add tptr, 2048 - mov %1d, ik_ref(%5,0) - mov %2d, ik_ref(%5,1) - mov %3d, ik_ref(%5,2) - mov %4d, ik_ref(%5,3) - - movzx esi, al - movzx edi, ah - shr eax, 16 - xor %1d, t_ref(0,rsi) - xor %2d, t_ref(1,rdi) - movzx esi, al - movzx edi, ah - xor %3d, t_ref(2,rsi) - xor %4d, t_ref(3,rdi) - - movzx esi, bl - movzx edi, bh - shr ebx, 16 - xor %2d, t_ref(0,rsi) - xor %3d, t_ref(1,rdi) - movzx esi, bl - movzx edi, bh - xor %4d, t_ref(2,rsi) - xor %1d, t_ref(3,rdi) - - movzx esi, cl - movzx edi, ch - shr ecx, 16 - xor %3d, t_ref(0,rsi) - xor %4d, t_ref(1,rdi) - movzx esi, cl - movzx edi, ch - xor %1d, t_ref(2,rsi) - xor %2d, t_ref(3,rdi) - - movzx esi, dl - movzx edi, dh - shr edx, 16 - xor %4d, t_ref(0,rsi) - xor %1d, t_ref(1,rdi) - movzx esi, dl - movzx edi, dh - xor %2d, t_ref(2,rsi) - xor %3d, t_ref(3,rdi) -%endmacro - -%else - -%macro il_rnd 5 ; last inverse round - mov %1d, ik_ref(%5,0) - mov %2d, ik_ref(%5,1) - mov %3d, ik_ref(%5,2) - mov %4d, ik_ref(%5,3) - - movzx esi, al - movzx edi, ah - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - shr eax, 16 - xor %1d, esi - rol edi, 8 - xor %2d, edi - movzx esi, al - movzx edi, ah - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - rol esi, 16 - rol edi, 24 - xor %3d, esi - xor %4d, edi - - movzx esi, bl - movzx edi, bh - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - shr ebx, 16 - xor %2d, esi - rol edi, 8 - xor %3d, edi - movzx esi, bl - movzx edi, bh - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - rol esi, 16 - rol edi, 24 - xor %4d, esi - xor %1d, edi - - movzx esi, cl - movzx edi, ch - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - shr ecx, 16 - xor %3d, esi - rol edi, 8 - xor %4d, edi - movzx esi, cl - movzx edi, ch - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - rol esi, 16 - rol edi, 24 - xor %1d, esi - xor %2d, edi - - movzx esi, dl - movzx edi, dh - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - shr edx, 16 - xor %4d, esi - rol edi, 8 - xor %1d, edi - movzx esi, dl - movzx edi, dh - movzx esi, t_ref(i,rsi) - movzx edi, t_ref(i,rdi) - rol esi, 16 - rol edi, 24 - xor %2d, esi - xor %3d, edi -%endmacro - -%endif - -%ifdef ENCRYPTION - - global aes_encrypt -%ifdef DLL_EXPORT - export aes_encrypt -%endif - - section .data align=64 - align 64 -enc_tab: - enc_vals u8 -%ifdef LAST_ROUND_TABLES - enc_vals w8 -%endif - - section .text align=16 - align 16 - -%ifdef _SEH_ -proc_frame aes_encrypt - alloc_stack 7*8 ; 7 to align stack to 16 bytes - save_reg rsi,4*8 - save_reg rdi,5*8 - save_reg rbx,1*8 - save_reg rbp,2*8 - save_reg r12,3*8 -end_prologue - mov rdi, rcx ; input pointer - mov [rsp+0*8], rdx ; output pointer -%else - aes_encrypt: - %ifdef __GNUC__ - sub rsp, 4*8 ; gnu/linux binary interface - mov [rsp+0*8], rsi ; output pointer - mov r8, rdx ; context - %else - sub rsp, 6*8 ; windows binary interface - mov [rsp+4*8], rsi - mov [rsp+5*8], rdi - mov rdi, rcx ; input pointer - mov [rsp+0*8], rdx ; output pointer - %endif - mov [rsp+1*8], rbx ; input pointer in rdi - mov [rsp+2*8], rbp ; output pointer in [rsp] - mov [rsp+3*8], r12 ; context in r8 -%endif - - movzx esi, byte [kptr+4*KS_LENGTH] - lea tptr,[enc_tab wrt rip] - sub kptr, fofs - - mov eax, [rdi+0*4] - mov ebx, [rdi+1*4] - mov ecx, [rdi+2*4] - mov edx, [rdi+3*4] - - xor eax, [kptr+fofs] - xor ebx, [kptr+fofs+4] - xor ecx, [kptr+fofs+8] - xor edx, [kptr+fofs+12] - - lea kptr,[kptr+rsi] - cmp esi, 10*16 - je .3 - cmp esi, 12*16 - je .2 - cmp esi, 14*16 - je .1 - mov rax, -1 - jmp .4 - -.1: ff_rnd r9, r10, r11, r12, 13 - ff_rnd r9, r10, r11, r12, 12 -.2: ff_rnd r9, r10, r11, r12, 11 - ff_rnd r9, r10, r11, r12, 10 -.3: ff_rnd r9, r10, r11, r12, 9 - ff_rnd r9, r10, r11, r12, 8 - ff_rnd r9, r10, r11, r12, 7 - ff_rnd r9, r10, r11, r12, 6 - ff_rnd r9, r10, r11, r12, 5 - ff_rnd r9, r10, r11, r12, 4 - ff_rnd r9, r10, r11, r12, 3 - ff_rnd r9, r10, r11, r12, 2 - ff_rnd r9, r10, r11, r12, 1 - fl_rnd r9, r10, r11, r12, 0 - - mov rbx, [rsp] - mov [rbx], r9d - mov [rbx+4], r10d - mov [rbx+8], r11d - mov [rbx+12], r12d - xor rax, rax -.4: - mov rbx, [rsp+1*8] - mov rbp, [rsp+2*8] - mov r12, [rsp+3*8] -%ifdef __GNUC__ - add rsp, 4*8 - ret -%else - mov rsi, [rsp+4*8] - mov rdi, [rsp+5*8] - %ifdef _SEH_ - add rsp, 7*8 - ret - endproc_frame - %else - add rsp, 6*8 - ret - %endif -%endif - -%endif - -%ifdef DECRYPTION - - global aes_decrypt -%ifdef DLL_EXPORT - export aes_decrypt -%endif - - section .data - align 64 -dec_tab: - dec_vals v8 -%ifdef LAST_ROUND_TABLES - dec_vals w8 -%endif - - section .text - align 16 - -%ifdef _SEH_ -proc_frame aes_decrypt - alloc_stack 7*8 ; 7 to align stack to 16 bytes - save_reg rsi,4*8 - save_reg rdi,5*8 - save_reg rbx,1*8 - save_reg rbp,2*8 - save_reg r12,3*8 -end_prologue - mov rdi, rcx ; input pointer - mov [rsp+0*8], rdx ; output pointer -%else - aes_decrypt: - %ifdef __GNUC__ - sub rsp, 4*8 ; gnu/linux binary interface - mov [rsp+0*8], rsi ; output pointer - mov r8, rdx ; context - %else - sub rsp, 6*8 ; windows binary interface - mov [rsp+4*8], rsi - mov [rsp+5*8], rdi - mov rdi, rcx ; input pointer - mov [rsp+0*8], rdx ; output pointer - %endif - mov [rsp+1*8], rbx ; input pointer in rdi - mov [rsp+2*8], rbp ; output pointer in [rsp] - mov [rsp+3*8], r12 ; context in r8 -%endif - - movzx esi,byte[kptr+4*KS_LENGTH] - lea tptr,[dec_tab wrt rip] - sub kptr, rofs - - mov eax, [rdi+0*4] - mov ebx, [rdi+1*4] - mov ecx, [rdi+2*4] - mov edx, [rdi+3*4] - -%ifdef AES_REV_DKS - mov rdi, kptr - lea kptr,[kptr+rsi] -%else - lea rdi,[kptr+rsi] -%endif - - xor eax, [rdi+rofs] - xor ebx, [rdi+rofs+4] - xor ecx, [rdi+rofs+8] - xor edx, [rdi+rofs+12] - - cmp esi, 10*16 - je .3 - cmp esi, 12*16 - je .2 - cmp esi, 14*16 - je .1 - mov rax, -1 - jmp .4 - -.1: ii_rnd r9, r10, r11, r12, 13 - ii_rnd r9, r10, r11, r12, 12 -.2: ii_rnd r9, r10, r11, r12, 11 - ii_rnd r9, r10, r11, r12, 10 -.3: ii_rnd r9, r10, r11, r12, 9 - ii_rnd r9, r10, r11, r12, 8 - ii_rnd r9, r10, r11, r12, 7 - ii_rnd r9, r10, r11, r12, 6 - ii_rnd r9, r10, r11, r12, 5 - ii_rnd r9, r10, r11, r12, 4 - ii_rnd r9, r10, r11, r12, 3 - ii_rnd r9, r10, r11, r12, 2 - ii_rnd r9, r10, r11, r12, 1 - il_rnd r9, r10, r11, r12, 0 - - mov rbx, [rsp] - mov [rbx], r9d - mov [rbx+4], r10d - mov [rbx+8], r11d - mov [rbx+12], r12d - xor rax, rax -.4: mov rbx, [rsp+1*8] - mov rbp, [rsp+2*8] - mov r12, [rsp+3*8] -%ifdef __GNUC__ - add rsp, 4*8 - ret -%else - mov rsi, [rsp+4*8] - mov rdi, [rsp+5*8] - %ifdef _SEH_ - add rsp, 7*8 - ret - endproc_frame - %else - add rsp, 6*8 - ret - %endif -%endif - -%endif - - end diff --git a/src/utils/crypto/aes_x86.asm b/src/utils/crypto/aes_x86.asm deleted file mode 100644 index 7fc9093ec0e..00000000000 --- a/src/utils/crypto/aes_x86.asm +++ /dev/null @@ -1,644 +0,0 @@ - -; --------------------------------------------------------------------------- -; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. -; -; LICENSE TERMS -; -; The free distribution and use of this software is allowed (with or without -; changes) provided that: -; -; 1. source code distributions include the above copyright notice, this -; list of conditions and the following disclaimer; -; -; 2. binary distributions include the above copyright notice, this list -; of conditions and the following disclaimer in their documentation; -; -; 3. the name of the copyright holder is not used to endorse products -; built using this software without specific written permission. -; -; DISCLAIMER -; -; This software is provided 'as is' with no explicit or implied warranties -; in respect of its properties, including, but not limited to, correctness -; and/or fitness for purpose. -; --------------------------------------------------------------------------- -; Issue 20/12/2007 -; -; This code requires ASM_X86_V1C to be set in aesopt.h. It requires the C files -; aeskey.c and aestab.c for support. - -; An AES implementation for x86 processors using the YASM (or NASM) assembler. -; This is an assembler implementation that covers encryption and decryption -; only and is intended as a replacement of the C file aescrypt.c. It hence -; requires the file aeskey.c for keying and aestab.c for the AES tables. It -; employs full tables rather than compressed tables. - -; This code provides the standard AES block size (128 bits, 16 bytes) and the -; three standard AES key sizes (128, 192 and 256 bits). It has the same call -; interface as my C implementation. The ebx, esi, edi and ebp registers are -; preserved across calls but eax, ecx and edx and the artihmetic status flags -; are not. It is also important that the defines below match those used in the -; C code. This code uses the VC++ register saving conentions; if it is used -; with another compiler, conventions for using and saving registers may need to -; be checked (and calling conventions). The YASM command line for the VC++ -; custom build step is: -; -; yasm -Xvc -f win32 -o "$(TargetDir)\$(InputName).obj" "$(InputPath)" -; -; The calling intefaces are: -; -; AES_RETURN aes_encrypt(const unsigned char in_blk[], -; unsigned char out_blk[], const aes_encrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt(const unsigned char in_blk[], -; unsigned char out_blk[], const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_encrypt_key(const unsigned char key[], -; const aes_encrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt_key(const unsigned char key[], -; const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_encrypt_key(const unsigned char key[], -; unsigned int len, const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt_key(const unsigned char key[], -; unsigned int len, const aes_decrypt_ctx cx[1]); -; -; where is 128, 102 or 256. In the last two calls the length can be in -; either bits or bytes. -; -; Comment in/out the following lines to obtain the desired subroutines. These -; selections MUST match those in the C header file aes.h - -; %define AES_128 ; define if AES with 128 bit keys is needed -; %define AES_192 ; define if AES with 192 bit keys is needed -%define AES_256 ; define if AES with 256 bit keys is needed -; %define AES_VAR ; define if a variable key size is needed -%define ENCRYPTION ; define if encryption is needed -%define DECRYPTION ; define if decryption is needed -%define AES_REV_DKS ; define if key decryption schedule is reversed -%define LAST_ROUND_TABLES ; define if tables are to be used for last round - -; offsets to parameters - -in_blk equ 4 ; input byte array address parameter -out_blk equ 8 ; output byte array address parameter -ctx equ 12 ; AES context structure -stk_spc equ 20 ; stack space -%define parms 12 ; parameter space on stack - -; The encryption key schedule has the following in memory layout where N is the -; number of rounds (10, 12 or 14): -; -; lo: | input key (round 0) | ; each round is four 32-bit words -; | encryption round 1 | -; | encryption round 2 | -; .... -; | encryption round N-1 | -; hi: | encryption round N | -; -; The decryption key schedule is normally set up so that it has the same -; layout as above by actually reversing the order of the encryption key -; schedule in memory (this happens when AES_REV_DKS is set): -; -; lo: | decryption round 0 | = | encryption round N | -; | decryption round 1 | = INV_MIX_COL[ | encryption round N-1 | ] -; | decryption round 2 | = INV_MIX_COL[ | encryption round N-2 | ] -; .... .... -; | decryption round N-1 | = INV_MIX_COL[ | encryption round 1 | ] -; hi: | decryption round N | = | input key (round 0) | -; -; with rounds except the first and last modified using inv_mix_column() -; But if AES_REV_DKS is NOT set the order of keys is left as it is for -; encryption so that it has to be accessed in reverse when used for -; decryption (although the inverse mix column modifications are done) -; -; lo: | decryption round 0 | = | input key (round 0) | -; | decryption round 1 | = INV_MIX_COL[ | encryption round 1 | ] -; | decryption round 2 | = INV_MIX_COL[ | encryption round 2 | ] -; .... .... -; | decryption round N-1 | = INV_MIX_COL[ | encryption round N-1 | ] -; hi: | decryption round N | = | encryption round N | -; -; This layout is faster when the assembler key scheduling provided here -; is used. -; -; The DLL interface must use the _stdcall convention in which the number -; of bytes of parameter space is added after an @ to the sutine's name. -; We must also remove our parameters from the stack before return (see -; the do_exit macro). Define DLL_EXPORT for the Dynamic Link Library version. - -;%define DLL_EXPORT - -; End of user defines - -%ifdef AES_VAR -%ifndef AES_128 -%define AES_128 -%endif -%ifndef AES_192 -%define AES_192 -%endif -%ifndef AES_256 -%define AES_256 -%endif -%endif - -%ifdef AES_VAR -%define KS_LENGTH 60 -%elifdef AES_256 -%define KS_LENGTH 60 -%elifdef AES_192 -%define KS_LENGTH 52 -%else -%define KS_LENGTH 44 -%endif - -; These macros implement stack based local variables - -%macro save 2 - mov [esp+4*%1],%2 -%endmacro - -%macro restore 2 - mov %1,[esp+4*%2] -%endmacro - -; the DLL has to implement the _stdcall calling interface on return -; In this case we have to take our parameters (3 4-byte pointers) -; off the stack - -%macro do_name 1-2 parms -%ifndef DLL_EXPORT - align 32 - global %1 -%1: -%else - align 32 - global %1@%2 - export %1@%2 -%1@%2: -%endif -%endmacro - -%macro do_call 1-2 parms -%ifndef DLL_EXPORT - call %1 - add esp,%2 -%else - call %1@%2 -%endif -%endmacro - -%macro do_exit 0-1 parms -%ifdef DLL_EXPORT - ret %1 -%else - ret -%endif -%endmacro - -%ifdef ENCRYPTION - - extern _t_fn - -%define etab_0(x) [_t_fn+4*x] -%define etab_1(x) [_t_fn+1024+4*x] -%define etab_2(x) [_t_fn+2048+4*x] -%define etab_3(x) [_t_fn+3072+4*x] - -%ifdef LAST_ROUND_TABLES - - extern _t_fl - -%define eltab_0(x) [_t_fl+4*x] -%define eltab_1(x) [_t_fl+1024+4*x] -%define eltab_2(x) [_t_fl+2048+4*x] -%define eltab_3(x) [_t_fl+3072+4*x] - -%else - -%define etab_b(x) byte [_t_fn+3072+4*x] - -%endif - -; ROUND FUNCTION. Build column[2] on ESI and column[3] on EDI that have the -; round keys pre-loaded. Build column[0] in EBP and column[1] in EBX. -; -; Input: -; -; EAX column[0] -; EBX column[1] -; ECX column[2] -; EDX column[3] -; ESI column key[round][2] -; EDI column key[round][3] -; EBP scratch -; -; Output: -; -; EBP column[0] unkeyed -; EBX column[1] unkeyed -; ESI column[2] keyed -; EDI column[3] keyed -; EAX scratch -; ECX scratch -; EDX scratch - -%macro rnd_fun 2 - - rol ebx,16 - %1 esi, cl, 0, ebp - %1 esi, dh, 1, ebp - %1 esi, bh, 3, ebp - %1 edi, dl, 0, ebp - %1 edi, ah, 1, ebp - %1 edi, bl, 2, ebp - %2 ebp, al, 0, ebp - shr ebx,16 - and eax,0xffff0000 - or eax,ebx - shr edx,16 - %1 ebp, ah, 1, ebx - %1 ebp, dh, 3, ebx - %2 ebx, dl, 2, ebx - %1 ebx, ch, 1, edx - %1 ebx, al, 0, edx - shr eax,16 - shr ecx,16 - %1 ebp, cl, 2, edx - %1 edi, ch, 3, edx - %1 esi, al, 2, edx - %1 ebx, ah, 3, edx - -%endmacro - -; Basic MOV and XOR Operations for normal rounds - -%macro nr_xor 4 - movzx %4,%2 - xor %1,etab_%3(%4) -%endmacro - -%macro nr_mov 4 - movzx %4,%2 - mov %1,etab_%3(%4) -%endmacro - -; Basic MOV and XOR Operations for last round - -%ifdef LAST_ROUND_TABLES - - %macro lr_xor 4 - movzx %4,%2 - xor %1,eltab_%3(%4) - %endmacro - - %macro lr_mov 4 - movzx %4,%2 - mov %1,eltab_%3(%4) - %endmacro - -%else - - %macro lr_xor 4 - movzx %4,%2 - movzx %4,etab_b(%4) - %if %3 != 0 - shl %4,8*%3 - %endif - xor %1,%4 - %endmacro - - %macro lr_mov 4 - movzx %4,%2 - movzx %1,etab_b(%4) - %if %3 != 0 - shl %1,8*%3 - %endif - %endmacro - -%endif - -%macro enc_round 0 - - add ebp,16 - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - rnd_fun nr_xor, nr_mov - - mov eax,ebp - mov ecx,esi - mov edx,edi - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - -%macro enc_last_round 0 - - add ebp,16 - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - rnd_fun lr_xor, lr_mov - - mov eax,ebp - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - - section .text align=32 - -; AES Encryption Subroutine - - do_name _aes_encrypt - - sub esp,stk_spc - mov [esp+16],ebp - mov [esp+12],ebx - mov [esp+ 8],esi - mov [esp+ 4],edi - - mov esi,[esp+in_blk+stk_spc] ; input pointer - mov eax,[esi ] - mov ebx,[esi+ 4] - mov ecx,[esi+ 8] - mov edx,[esi+12] - - mov ebp,[esp+ctx+stk_spc] ; key pointer - movzx edi,byte [ebp+4*KS_LENGTH] - xor eax,[ebp ] - xor ebx,[ebp+ 4] - xor ecx,[ebp+ 8] - xor edx,[ebp+12] - -; determine the number of rounds - - cmp edi,10*16 - je .3 - cmp edi,12*16 - je .2 - cmp edi,14*16 - je .1 - mov eax,-1 - jmp .5 - -.1: enc_round - enc_round -.2: enc_round - enc_round -.3: enc_round - enc_round - enc_round - enc_round - enc_round - enc_round - enc_round - enc_round - enc_round - enc_last_round - - mov edx,[esp+out_blk+stk_spc] - mov [edx],eax - mov [edx+4],ebx - mov [edx+8],esi - mov [edx+12],edi - xor eax,eax - -.5: mov ebp,[esp+16] - mov ebx,[esp+12] - mov esi,[esp+ 8] - mov edi,[esp+ 4] - add esp,stk_spc - do_exit - -%endif - -%ifdef DECRYPTION - - extern _t_in - -%define dtab_0(x) [_t_in+4*x] -%define dtab_1(x) [_t_in+1024+4*x] -%define dtab_2(x) [_t_in+2048+4*x] -%define dtab_3(x) [_t_in+3072+4*x] - -%ifdef LAST_ROUND_TABLES - - extern _t_il - -%define dltab_0(x) [_t_il+4*x] -%define dltab_1(x) [_t_il+1024+4*x] -%define dltab_2(x) [_t_il+2048+4*x] -%define dltab_3(x) [_t_il+3072+4*x] - -%else - - extern _t_ibox - -%define dtab_x(x) byte [_t_ibox+x] - -%endif - -%macro irn_fun 2 - - rol eax,16 - %1 esi, cl, 0, ebp - %1 esi, bh, 1, ebp - %1 esi, al, 2, ebp - %1 edi, dl, 0, ebp - %1 edi, ch, 1, ebp - %1 edi, ah, 3, ebp - %2 ebp, bl, 0, ebp - shr eax,16 - and ebx,0xffff0000 - or ebx,eax - shr ecx,16 - %1 ebp, bh, 1, eax - %1 ebp, ch, 3, eax - %2 eax, cl, 2, ecx - %1 eax, bl, 0, ecx - %1 eax, dh, 1, ecx - shr ebx,16 - shr edx,16 - %1 esi, dh, 3, ecx - %1 ebp, dl, 2, ecx - %1 eax, bh, 3, ecx - %1 edi, bl, 2, ecx - -%endmacro - -; Basic MOV and XOR Operations for normal rounds - -%macro ni_xor 4 - movzx %4,%2 - xor %1,dtab_%3(%4) -%endmacro - -%macro ni_mov 4 - movzx %4,%2 - mov %1,dtab_%3(%4) -%endmacro - -; Basic MOV and XOR Operations for last round - -%ifdef LAST_ROUND_TABLES - -%macro li_xor 4 - movzx %4,%2 - xor %1,dltab_%3(%4) -%endmacro - -%macro li_mov 4 - movzx %4,%2 - mov %1,dltab_%3(%4) -%endmacro - -%else - - %macro li_xor 4 - movzx %4,%2 - movzx %4,dtab_x(%4) - %if %3 != 0 - shl %4,8*%3 - %endif - xor %1,%4 - %endmacro - - %macro li_mov 4 - movzx %4,%2 - movzx %1,dtab_x(%4) - %if %3 != 0 - shl %1,8*%3 - %endif - %endmacro - -%endif - -%macro dec_round 0 - -%ifdef AES_REV_DKS - add ebp,16 -%else - sub ebp,16 -%endif - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - irn_fun ni_xor, ni_mov - - mov ebx,ebp - mov ecx,esi - mov edx,edi - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - -%macro dec_last_round 0 - -%ifdef AES_REV_DKS - add ebp,16 -%else - sub ebp,16 -%endif - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - irn_fun li_xor, li_mov - - mov ebx,ebp - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - - section .text - -; AES Decryption Subroutine - - do_name _aes_decrypt - - sub esp,stk_spc - mov [esp+16],ebp - mov [esp+12],ebx - mov [esp+ 8],esi - mov [esp+ 4],edi - -; input four columns and xor in first round key - - mov esi,[esp+in_blk+stk_spc] ; input pointer - mov eax,[esi ] - mov ebx,[esi+ 4] - mov ecx,[esi+ 8] - mov edx,[esi+12] - lea esi,[esi+16] - - mov ebp,[esp+ctx+stk_spc] ; key pointer - movzx edi,byte[ebp+4*KS_LENGTH] -%ifndef AES_REV_DKS ; if decryption key schedule is not reversed - lea ebp,[ebp+edi] ; we have to access it from the top down -%endif - xor eax,[ebp ] ; key schedule - xor ebx,[ebp+ 4] - xor ecx,[ebp+ 8] - xor edx,[ebp+12] - -; determine the number of rounds - - cmp edi,10*16 - je .3 - cmp edi,12*16 - je .2 - cmp edi,14*16 - je .1 - mov eax,-1 - jmp .5 - -.1: dec_round - dec_round -.2: dec_round - dec_round -.3: dec_round - dec_round - dec_round - dec_round - dec_round - dec_round - dec_round - dec_round - dec_round - dec_last_round - -; move final values to the output array. - - mov ebp,[esp+out_blk+stk_spc] - mov [ebp],eax - mov [ebp+4],ebx - mov [ebp+8],esi - mov [ebp+12],edi - xor eax,eax - -.5: mov ebp,[esp+16] - mov ebx,[esp+12] - mov esi,[esp+ 8] - mov edi,[esp+ 4] - add esp,stk_spc - do_exit - -%endif - - end - diff --git a/src/utils/crypto/aeskey.c b/src/utils/crypto/aeskey.c deleted file mode 100644 index 8e6264f933b..00000000000 --- a/src/utils/crypto/aeskey.c +++ /dev/null @@ -1,577 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 -*/ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wsequence-point" - -#include "aesopt.h" -#include "aestab.h" - -#ifdef USE_VIA_ACE_IF_PRESENT -# include "aes_via_ace.h" -#endif - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Initialise the key schedule from the user supplied key. The key - length can be specified in bytes, with legal values of 16, 24 - and 32, or in bits, with legal values of 128, 192 and 256. These - values correspond with Nk values of 4, 6 and 8 respectively. - - The following macros implement a single cycle in the key - schedule generation process. The number of cycles needed - for each cx->n_col and nk value is: - - nk = 4 5 6 7 8 - ------------------------------ - cx->n_col = 4 10 9 8 7 7 - cx->n_col = 5 14 11 10 9 9 - cx->n_col = 6 19 15 12 11 11 - cx->n_col = 7 21 19 16 13 14 - cx->n_col = 8 29 23 19 17 14 -*/ - -#if (FUNCS_IN_C & ENC_KEYING_IN_C) - -#if defined(AES_128) || defined(AES_VAR) - -#define ke4(k,i) \ -{ k[4*(i)+4] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - k[4*(i)+5] = ss[1] ^= ss[0]; \ - k[4*(i)+6] = ss[2] ^= ss[1]; \ - k[4*(i)+7] = ss[3] ^= ss[2]; \ -} - -AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ uint_32t ss[4]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - -#if ENC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 9; ++i) - ke4(cx->ks, i); - } -#else - ke4(cx->ks, 0); ke4(cx->ks, 1); - ke4(cx->ks, 2); ke4(cx->ks, 3); - ke4(cx->ks, 4); ke4(cx->ks, 5); - ke4(cx->ks, 6); ke4(cx->ks, 7); - ke4(cx->ks, 8); -#endif - ke4(cx->ks, 9); - cx->inf.l = 0; - cx->inf.b[0] = 10 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_192) || defined(AES_VAR) - -#define kef6(k,i) \ -{ k[6*(i)+ 6] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - k[6*(i)+ 7] = ss[1] ^= ss[0]; \ - k[6*(i)+ 8] = ss[2] ^= ss[1]; \ - k[6*(i)+ 9] = ss[3] ^= ss[2]; \ -} - -#define ke6(k,i) \ -{ kef6(k,i); \ - k[6*(i)+10] = ss[4] ^= ss[3]; \ - k[6*(i)+11] = ss[5] ^= ss[4]; \ -} - -AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ uint_32t ss[6]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - -#if ENC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 7; ++i) - ke6(cx->ks, i); - } -#else - ke6(cx->ks, 0); ke6(cx->ks, 1); - ke6(cx->ks, 2); ke6(cx->ks, 3); - ke6(cx->ks, 4); ke6(cx->ks, 5); - ke6(cx->ks, 6); -#endif - kef6(cx->ks, 7); - cx->inf.l = 0; - cx->inf.b[0] = 12 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_256) || defined(AES_VAR) - -#define kef8(k,i) \ -{ k[8*(i)+ 8] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - k[8*(i)+ 9] = ss[1] ^= ss[0]; \ - k[8*(i)+10] = ss[2] ^= ss[1]; \ - k[8*(i)+11] = ss[3] ^= ss[2]; \ -} - -#define ke8(k,i) \ -{ kef8(k,i); \ - k[8*(i)+12] = ss[4] ^= ls_box(ss[3],0); \ - k[8*(i)+13] = ss[5] ^= ss[4]; \ - k[8*(i)+14] = ss[6] ^= ss[5]; \ - k[8*(i)+15] = ss[7] ^= ss[6]; \ -} - -AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]) -{ uint_32t ss[8]; - - cx->ks[0] = ss[0] = word_in(key, 0); - cx->ks[1] = ss[1] = word_in(key, 1); - cx->ks[2] = ss[2] = word_in(key, 2); - cx->ks[3] = ss[3] = word_in(key, 3); - cx->ks[4] = ss[4] = word_in(key, 4); - cx->ks[5] = ss[5] = word_in(key, 5); - cx->ks[6] = ss[6] = word_in(key, 6); - cx->ks[7] = ss[7] = word_in(key, 7); - -#if ENC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 6; ++i) - ke8(cx->ks, i); - } -#else - ke8(cx->ks, 0); ke8(cx->ks, 1); - ke8(cx->ks, 2); ke8(cx->ks, 3); - ke8(cx->ks, 4); ke8(cx->ks, 5); -#endif - kef8(cx->ks, 6); - cx->inf.l = 0; - cx->inf.b[0] = 14 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_VAR) - -AES_RETURN aes_encrypt_key(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]) -{ - switch(key_len) - { -#if defined( AES_ERR_CHK ) - case 16: case 128: return aes_encrypt_key128(key, cx); - case 24: case 192: return aes_encrypt_key192(key, cx); - case 32: case 256: return aes_encrypt_key256(key, cx); - default: return EXIT_FAILURE; -#else - case 16: case 128: aes_encrypt_key128(key, cx); return; - case 24: case 192: aes_encrypt_key192(key, cx); return; - case 32: case 256: aes_encrypt_key256(key, cx); return; -#endif - } -} - -#endif - -#endif - -#if (FUNCS_IN_C & DEC_KEYING_IN_C) - -/* this is used to store the decryption round keys */ -/* in forward or reverse order */ - -#ifdef AES_REV_DKS -#define v(n,i) ((n) - (i) + 2 * ((i) & 3)) -#else -#define v(n,i) (i) -#endif - -#if DEC_ROUND == NO_TABLES -#define ff(x) (x) -#else -#define ff(x) inv_mcol(x) -#if defined( dec_imvars ) -#define d_vars dec_imvars -#endif -#endif - -#if defined(AES_128) || defined(AES_VAR) - -#define k4e(k,i) \ -{ k[v(40,(4*(i))+4)] = ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - k[v(40,(4*(i))+5)] = ss[1] ^= ss[0]; \ - k[v(40,(4*(i))+6)] = ss[2] ^= ss[1]; \ - k[v(40,(4*(i))+7)] = ss[3] ^= ss[2]; \ -} - -#if 1 - -#define kdf4(k,i) \ -{ ss[0] = ss[0] ^ ss[2] ^ ss[1] ^ ss[3]; \ - ss[1] = ss[1] ^ ss[3]; \ - ss[2] = ss[2] ^ ss[3]; \ - ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ - ss[i % 4] ^= ss[4]; \ - ss[4] ^= k[v(40,(4*(i)))]; k[v(40,(4*(i))+4)] = ff(ss[4]); \ - ss[4] ^= k[v(40,(4*(i))+1)]; k[v(40,(4*(i))+5)] = ff(ss[4]); \ - ss[4] ^= k[v(40,(4*(i))+2)]; k[v(40,(4*(i))+6)] = ff(ss[4]); \ - ss[4] ^= k[v(40,(4*(i))+3)]; k[v(40,(4*(i))+7)] = ff(ss[4]); \ -} - -#define kd4(k,i) \ -{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; \ - ss[i % 4] ^= ss[4]; ss[4] = ff(ss[4]); \ - k[v(40,(4*(i))+4)] = ss[4] ^= k[v(40,(4*(i)))]; \ - k[v(40,(4*(i))+5)] = ss[4] ^= k[v(40,(4*(i))+1)]; \ - k[v(40,(4*(i))+6)] = ss[4] ^= k[v(40,(4*(i))+2)]; \ - k[v(40,(4*(i))+7)] = ss[4] ^= k[v(40,(4*(i))+3)]; \ -} - -#define kdl4(k,i) \ -{ ss[4] = ls_box(ss[(i+3) % 4], 3) ^ t_use(r,c)[i]; ss[i % 4] ^= ss[4]; \ - k[v(40,(4*(i))+4)] = (ss[0] ^= ss[1]) ^ ss[2] ^ ss[3]; \ - k[v(40,(4*(i))+5)] = ss[1] ^ ss[3]; \ - k[v(40,(4*(i))+6)] = ss[0]; \ - k[v(40,(4*(i))+7)] = ss[1]; \ -} - -#else - -#define kdf4(k,i) \ -{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ff(ss[0]); \ - ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ff(ss[2]); \ - ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ff(ss[3]); \ -} - -#define kd4(k,i) \ -{ ss[4] = ls_box(ss[3],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[4]; ss[4] = ff(ss[4]); k[v(40,(4*(i))+ 4)] = ss[4] ^= k[v(40,(4*(i)))]; \ - ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[4] ^= k[v(40,(4*(i))+ 1)]; \ - ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[4] ^= k[v(40,(4*(i))+ 2)]; \ - ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[4] ^= k[v(40,(4*(i))+ 3)]; \ -} - -#define kdl4(k,i) \ -{ ss[0] ^= ls_box(ss[3],3) ^ t_use(r,c)[i]; k[v(40,(4*(i))+ 4)] = ss[0]; \ - ss[1] ^= ss[0]; k[v(40,(4*(i))+ 5)] = ss[1]; \ - ss[2] ^= ss[1]; k[v(40,(4*(i))+ 6)] = ss[2]; \ - ss[3] ^= ss[2]; k[v(40,(4*(i))+ 7)] = ss[3]; \ -} - -#endif - -AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ uint_32t ss[5]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[v(40,(0))] = ss[0] = word_in(key, 0); - cx->ks[v(40,(1))] = ss[1] = word_in(key, 1); - cx->ks[v(40,(2))] = ss[2] = word_in(key, 2); - cx->ks[v(40,(3))] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - { uint_32t i; - for(i = 0; i < 10; ++i) - k4e(cx->ks, i); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 10 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); -#endif - } -#else - kdf4(cx->ks, 0); kd4(cx->ks, 1); - kd4(cx->ks, 2); kd4(cx->ks, 3); - kd4(cx->ks, 4); kd4(cx->ks, 5); - kd4(cx->ks, 6); kd4(cx->ks, 7); - kd4(cx->ks, 8); kdl4(cx->ks, 9); -#endif - cx->inf.l = 0; - cx->inf.b[0] = 10 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_192) || defined(AES_VAR) - -#define k6ef(k,i) \ -{ k[v(48,(6*(i))+ 6)] = ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - k[v(48,(6*(i))+ 7)] = ss[1] ^= ss[0]; \ - k[v(48,(6*(i))+ 8)] = ss[2] ^= ss[1]; \ - k[v(48,(6*(i))+ 9)] = ss[3] ^= ss[2]; \ -} - -#define k6e(k,i) \ -{ k6ef(k,i); \ - k[v(48,(6*(i))+10)] = ss[4] ^= ss[3]; \ - k[v(48,(6*(i))+11)] = ss[5] ^= ss[4]; \ -} - -#define kdf6(k,i) \ -{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ff(ss[0]); \ - ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ff(ss[2]); \ - ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ff(ss[3]); \ - ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ff(ss[4]); \ - ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ff(ss[5]); \ -} - -#define kd6(k,i) \ -{ ss[6] = ls_box(ss[5],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[6]; ss[6] = ff(ss[6]); k[v(48,(6*(i))+ 6)] = ss[6] ^= k[v(48,(6*(i)))]; \ - ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[6] ^= k[v(48,(6*(i))+ 1)]; \ - ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[6] ^= k[v(48,(6*(i))+ 2)]; \ - ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[6] ^= k[v(48,(6*(i))+ 3)]; \ - ss[4] ^= ss[3]; k[v(48,(6*(i))+10)] = ss[6] ^= k[v(48,(6*(i))+ 4)]; \ - ss[5] ^= ss[4]; k[v(48,(6*(i))+11)] = ss[6] ^= k[v(48,(6*(i))+ 5)]; \ -} - -#define kdl6(k,i) \ -{ ss[0] ^= ls_box(ss[5],3) ^ t_use(r,c)[i]; k[v(48,(6*(i))+ 6)] = ss[0]; \ - ss[1] ^= ss[0]; k[v(48,(6*(i))+ 7)] = ss[1]; \ - ss[2] ^= ss[1]; k[v(48,(6*(i))+ 8)] = ss[2]; \ - ss[3] ^= ss[2]; k[v(48,(6*(i))+ 9)] = ss[3]; \ -} - -AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ uint_32t ss[7]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[v(48,(0))] = ss[0] = word_in(key, 0); - cx->ks[v(48,(1))] = ss[1] = word_in(key, 1); - cx->ks[v(48,(2))] = ss[2] = word_in(key, 2); - cx->ks[v(48,(3))] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - cx->ks[v(48,(4))] = ss[4] = word_in(key, 4); - cx->ks[v(48,(5))] = ss[5] = word_in(key, 5); - { uint_32t i; - - for(i = 0; i < 7; ++i) - k6e(cx->ks, i); - k6ef(cx->ks, 7); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 12 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); -#endif - } -#else - cx->ks[v(48,(4))] = ff(ss[4] = word_in(key, 4)); - cx->ks[v(48,(5))] = ff(ss[5] = word_in(key, 5)); - kdf6(cx->ks, 0); kd6(cx->ks, 1); - kd6(cx->ks, 2); kd6(cx->ks, 3); - kd6(cx->ks, 4); kd6(cx->ks, 5); - kd6(cx->ks, 6); kdl6(cx->ks, 7); -#endif - cx->inf.l = 0; - cx->inf.b[0] = 12 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_256) || defined(AES_VAR) - -#define k8ef(k,i) \ -{ k[v(56,(8*(i))+ 8)] = ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - k[v(56,(8*(i))+ 9)] = ss[1] ^= ss[0]; \ - k[v(56,(8*(i))+10)] = ss[2] ^= ss[1]; \ - k[v(56,(8*(i))+11)] = ss[3] ^= ss[2]; \ -} - -#define k8e(k,i) \ -{ k8ef(k,i); \ - k[v(56,(8*(i))+12)] = ss[4] ^= ls_box(ss[3],0); \ - k[v(56,(8*(i))+13)] = ss[5] ^= ss[4]; \ - k[v(56,(8*(i))+14)] = ss[6] ^= ss[5]; \ - k[v(56,(8*(i))+15)] = ss[7] ^= ss[6]; \ -} - -#define kdf8(k,i) \ -{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ff(ss[0]); \ - ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ff(ss[1]); \ - ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ff(ss[2]); \ - ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ff(ss[3]); \ - ss[4] ^= ls_box(ss[3],0); k[v(56,(8*(i))+12)] = ff(ss[4]); \ - ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ff(ss[5]); \ - ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ff(ss[6]); \ - ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ff(ss[7]); \ -} - -#define kd8(k,i) \ -{ ss[8] = ls_box(ss[7],3) ^ t_use(r,c)[i]; \ - ss[0] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+ 8)] = ss[8] ^= k[v(56,(8*(i)))]; \ - ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[8] ^= k[v(56,(8*(i))+ 1)]; \ - ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[8] ^= k[v(56,(8*(i))+ 2)]; \ - ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[8] ^= k[v(56,(8*(i))+ 3)]; \ - ss[8] = ls_box(ss[3],0); \ - ss[4] ^= ss[8]; ss[8] = ff(ss[8]); k[v(56,(8*(i))+12)] = ss[8] ^= k[v(56,(8*(i))+ 4)]; \ - ss[5] ^= ss[4]; k[v(56,(8*(i))+13)] = ss[8] ^= k[v(56,(8*(i))+ 5)]; \ - ss[6] ^= ss[5]; k[v(56,(8*(i))+14)] = ss[8] ^= k[v(56,(8*(i))+ 6)]; \ - ss[7] ^= ss[6]; k[v(56,(8*(i))+15)] = ss[8] ^= k[v(56,(8*(i))+ 7)]; \ -} - -#define kdl8(k,i) \ -{ ss[0] ^= ls_box(ss[7],3) ^ t_use(r,c)[i]; k[v(56,(8*(i))+ 8)] = ss[0]; \ - ss[1] ^= ss[0]; k[v(56,(8*(i))+ 9)] = ss[1]; \ - ss[2] ^= ss[1]; k[v(56,(8*(i))+10)] = ss[2]; \ - ss[3] ^= ss[2]; k[v(56,(8*(i))+11)] = ss[3]; \ -} - -AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]) -{ uint_32t ss[9]; -#if defined( d_vars ) - d_vars; -#endif - cx->ks[v(56,(0))] = ss[0] = word_in(key, 0); - cx->ks[v(56,(1))] = ss[1] = word_in(key, 1); - cx->ks[v(56,(2))] = ss[2] = word_in(key, 2); - cx->ks[v(56,(3))] = ss[3] = word_in(key, 3); - -#if DEC_UNROLL == NONE - cx->ks[v(56,(4))] = ss[4] = word_in(key, 4); - cx->ks[v(56,(5))] = ss[5] = word_in(key, 5); - cx->ks[v(56,(6))] = ss[6] = word_in(key, 6); - cx->ks[v(56,(7))] = ss[7] = word_in(key, 7); - { uint_32t i; - - for(i = 0; i < 6; ++i) - k8e(cx->ks, i); - k8ef(cx->ks, 6); -#if !(DEC_ROUND == NO_TABLES) - for(i = N_COLS; i < 14 * N_COLS; ++i) - cx->ks[i] = inv_mcol(cx->ks[i]); - -#endif - } -#else - cx->ks[v(56,(4))] = ff(ss[4] = word_in(key, 4)); - cx->ks[v(56,(5))] = ff(ss[5] = word_in(key, 5)); - cx->ks[v(56,(6))] = ff(ss[6] = word_in(key, 6)); - cx->ks[v(56,(7))] = ff(ss[7] = word_in(key, 7)); - kdf8(cx->ks, 0); kd8(cx->ks, 1); - kd8(cx->ks, 2); kd8(cx->ks, 3); - kd8(cx->ks, 4); kd8(cx->ks, 5); - kdl8(cx->ks, 6); -#endif - cx->inf.l = 0; - cx->inf.b[0] = 14 * 16; - -#ifdef USE_VIA_ACE_IF_PRESENT - if(VIA_ACE_AVAILABLE) - cx->inf.b[1] = 0xff; -#endif - -#if defined( AES_ERR_CHK ) - return EXIT_SUCCESS; -#endif -} - -#endif - -#if defined(AES_VAR) - -AES_RETURN aes_decrypt_key(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]) -{ - switch(key_len) - { -#if defined( AES_ERR_CHK ) - case 16: case 128: return aes_decrypt_key128(key, cx); - case 24: case 192: return aes_decrypt_key192(key, cx); - case 32: case 256: return aes_decrypt_key256(key, cx); - default: return EXIT_FAILURE; -#else - case 16: case 128: aes_decrypt_key128(key, cx); return; - case 24: case 192: aes_decrypt_key192(key, cx); return; - case 32: case 256: aes_decrypt_key256(key, cx); return; -#endif - } -} - -#endif - -#endif - -#if defined(__cplusplus) -} -#endif - -#pragma GCC diagnostic pop diff --git a/src/utils/crypto/aesopt.h b/src/utils/crypto/aesopt.h deleted file mode 100644 index 8a76dc6dee2..00000000000 --- a/src/utils/crypto/aesopt.h +++ /dev/null @@ -1,729 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 - - This file contains the compilation options for AES (Rijndael) and code - that is common across encryption, key scheduling and table generation. - - OPERATION - - These source code files implement the AES algorithm Rijndael designed by - Joan Daemen and Vincent Rijmen. This version is designed for the standard - block size of 16 bytes and for key sizes of 128, 192 and 256 bits (16, 24 - and 32 bytes). - - This version is designed for flexibility and speed using operations on - 32-bit words rather than operations on bytes. It can be compiled with - either big or little endian internal byte order but is faster when the - native byte order for the processor is used. - - THE CIPHER INTERFACE - - The cipher interface is implemented as an array of bytes in which lower - AES bit sequence indexes map to higher numeric significance within bytes. - - uint_8t (an unsigned 8-bit type) - uint_32t (an unsigned 32-bit type) - struct aes_encrypt_ctx (structure for the cipher encryption context) - struct aes_decrypt_ctx (structure for the cipher decryption context) - AES_RETURN the function return type - - C subroutine calls: - - AES_RETURN aes_encrypt_key128(const unsigned char *key, aes_encrypt_ctx cx[1]); - AES_RETURN aes_encrypt_key192(const unsigned char *key, aes_encrypt_ctx cx[1]); - AES_RETURN aes_encrypt_key256(const unsigned char *key, aes_encrypt_ctx cx[1]); - AES_RETURN aes_encrypt(const unsigned char *in, unsigned char *out, - const aes_encrypt_ctx cx[1]); - - AES_RETURN aes_decrypt_key128(const unsigned char *key, aes_decrypt_ctx cx[1]); - AES_RETURN aes_decrypt_key192(const unsigned char *key, aes_decrypt_ctx cx[1]); - AES_RETURN aes_decrypt_key256(const unsigned char *key, aes_decrypt_ctx cx[1]); - AES_RETURN aes_decrypt(const unsigned char *in, unsigned char *out, - const aes_decrypt_ctx cx[1]); - - IMPORTANT NOTE: If you are using this C interface with dynamic tables make sure that - you call aes_init() before AES is used so that the tables are initialised. - - C++ aes class subroutines: - - Class AESencrypt for encryption - - Construtors: - AESencrypt(void) - AESencrypt(const unsigned char *key) - 128 bit key - Members: - AES_RETURN key128(const unsigned char *key) - AES_RETURN key192(const unsigned char *key) - AES_RETURN key256(const unsigned char *key) - AES_RETURN encrypt(const unsigned char *in, unsigned char *out) const - - Class AESdecrypt for encryption - Construtors: - AESdecrypt(void) - AESdecrypt(const unsigned char *key) - 128 bit key - Members: - AES_RETURN key128(const unsigned char *key) - AES_RETURN key192(const unsigned char *key) - AES_RETURN key256(const unsigned char *key) - AES_RETURN decrypt(const unsigned char *in, unsigned char *out) const -*/ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - -#if !defined( _AESOPT_H ) -#define _AESOPT_H - - -#if defined( __cplusplus ) -#include "aescpp.h" -#else -#include "aes.h" -#endif - - -#include "../common/endian.h" -#define IS_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ -#define IS_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ - -#if BYTE_ORDER == LITTLE_ENDIAN -# define PLATFORM_BYTE_ORDER IS_LITTLE_ENDIAN -#endif - -#if BYTE_ORDER == BIG_ENDIAN -# define PLATFORM_BYTE_ORDER IS_BIG_ENDIAN -#endif - - -/* CONFIGURATION - THE USE OF DEFINES - - Later in this section there are a number of defines that control the - operation of the code. In each section, the purpose of each define is - explained so that the relevant form can be included or excluded by - setting either 1's or 0's respectively on the branches of the related - #if clauses. The following local defines should not be changed. -*/ - -#define ENCRYPTION_IN_C 1 -#define DECRYPTION_IN_C 2 -#define ENC_KEYING_IN_C 4 -#define DEC_KEYING_IN_C 8 - -#define NO_TABLES 0 -#define ONE_TABLE 1 -#define FOUR_TABLES 4 -#define NONE 0 -#define PARTIAL 1 -#define FULL 2 - -/* --- START OF USER CONFIGURED OPTIONS --- */ - -/* 1. BYTE ORDER WITHIN 32 BIT WORDS - - The fundamental data processing units in Rijndael are 8-bit bytes. The - input, output and key input are all enumerated arrays of bytes in which - bytes are numbered starting at zero and increasing to one less than the - number of bytes in the array in question. This enumeration is only used - for naming bytes and does not imply any adjacency or order relationship - from one byte to another. When these inputs and outputs are considered - as bit sequences, bits 8*n to 8*n+7 of the bit sequence are mapped to - byte[n] with bit 8n+i in the sequence mapped to bit 7-i within the byte. - In this implementation bits are numbered from 0 to 7 starting at the - numerically least significant end of each byte (bit n represents 2^n). - - However, Rijndael can be implemented more efficiently using 32-bit - words by packing bytes into words so that bytes 4*n to 4*n+3 are placed - into word[n]. While in principle these bytes can be assembled into words - in any positions, this implementation only supports the two formats in - which bytes in adjacent positions within words also have adjacent byte - numbers. This order is called big-endian if the lowest numbered bytes - in words have the highest numeric significance and little-endian if the - opposite applies. - - This code can work in either order irrespective of the order used by the - machine on which it runs. Normally the internal byte order will be set - to the order of the processor on which the code is to be run but this - define can be used to reverse this in special situations - - WARNING: Assembler code versions rely on PLATFORM_BYTE_ORDER being set. - This define will hence be redefined later (in section 4) if necessary -*/ - -#if 1 -#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER -#elif 0 -#define ALGORITHM_BYTE_ORDER IS_LITTLE_ENDIAN -#elif 0 -#define ALGORITHM_BYTE_ORDER IS_BIG_ENDIAN -#else -#error The algorithm byte order is not defined -#endif - -/* 2. VIA ACE SUPPORT - - Define this option if support for the VIA ACE is required. This uses - inline assembler instructions and is only implemented for the Microsoft, - Intel and GCC compilers. If VIA ACE is known to be present, then defining - ASSUME_VIA_ACE_PRESENT will remove the ordinary encryption/decryption - code. If USE_VIA_ACE_IF_PRESENT is defined then VIA ACE will be used if - it is detected (both present and enabled) but the normal AES code will - also be present. - - When VIA ACE is to be used, all AES encryption contexts MUST be 16 byte - aligned; other input/output buffers do not need to be 16 byte aligned - but there are very large performance gains if this can be arranged. - VIA ACE also requires the decryption key schedule to be in reverse - order (which later checks below ensure). -*/ - -#if 0 && !defined( USE_VIA_ACE_IF_PRESENT ) -# define USE_VIA_ACE_IF_PRESENT -#endif - -#if 0 && !defined( ASSUME_VIA_ACE_PRESENT ) -# define ASSUME_VIA_ACE_PRESENT -# endif - -#if defined ( _WIN64 ) || defined( _WIN32_WCE ) || \ - defined( _MSC_VER ) && ( _MSC_VER <= 800 ) -# if defined( USE_VIA_ACE_IF_PRESENT ) -# undef USE_VIA_ACE_IF_PRESENT -# endif -# if defined( ASSUME_VIA_ACE_PRESENT ) -# undef ASSUME_VIA_ACE_PRESENT -# endif -#endif - -/* 3. ASSEMBLER SUPPORT - - This define (which can be on the command line) enables the use of the - assembler code routines for encryption, decryption and key scheduling - as follows: - - ASM_X86_V1C uses the assembler (aes_x86_v1.asm) with large tables for - encryption and decryption and but with key scheduling in C - ASM_X86_V2 uses assembler (aes_x86_v2.asm) with compressed tables for - encryption, decryption and key scheduling - ASM_X86_V2C uses assembler (aes_x86_v2.asm) with compressed tables for - encryption and decryption and but with key scheduling in C - ASM_AMD64_C uses assembler (aes_amd64.asm) with compressed tables for - encryption and decryption and but with key scheduling in C - - Change one 'if 0' below to 'if 1' to select the version or define - as a compilation option. -*/ - -#if 0 && !defined( ASM_X86_V1C ) -# define ASM_X86_V1C -#elif 0 && !defined( ASM_X86_V2 ) -# define ASM_X86_V2 -#elif 0 && !defined( ASM_X86_V2C ) -# define ASM_X86_V2C -#elif 0 && !defined( ASM_AMD64_C ) -# define ASM_AMD64_C -#endif - -#if (defined ( ASM_X86_V1C ) || defined( ASM_X86_V2 ) || defined( ASM_X86_V2C )) \ - && !defined( _M_IX86 ) || defined( ASM_AMD64_C ) && !defined( _M_X64 ) -//# error Assembler code is only available for x86 and AMD64 systems -#endif - -/* 4. FAST INPUT/OUTPUT OPERATIONS. - - On some machines it is possible to improve speed by transferring the - bytes in the input and output arrays to and from the internal 32-bit - variables by addressing these arrays as if they are arrays of 32-bit - words. On some machines this will always be possible but there may - be a large performance penalty if the byte arrays are not aligned on - the normal word boundaries. On other machines this technique will - lead to memory access errors when such 32-bit word accesses are not - properly aligned. The option SAFE_IO avoids such problems but will - often be slower on those machines that support misaligned access - (especially so if care is taken to align the input and output byte - arrays on 32-bit word boundaries). If SAFE_IO is not defined it is - assumed that access to byte arrays as if they are arrays of 32-bit - words will not cause problems when such accesses are misaligned. -*/ -#if 1 && !defined( _MSC_VER ) -#define SAFE_IO -#endif - -/* 5. LOOP UNROLLING - - The code for encryption and decrytpion cycles through a number of rounds - that can be implemented either in a loop or by expanding the code into a - long sequence of instructions, the latter producing a larger program but - one that will often be much faster. The latter is called loop unrolling. - There are also potential speed advantages in expanding two iterations in - a loop with half the number of iterations, which is called partial loop - unrolling. The following options allow partial or full loop unrolling - to be set independently for encryption and decryption -*/ -#if 1 -#define ENC_UNROLL FULL -#elif 0 -#define ENC_UNROLL PARTIAL -#else -#define ENC_UNROLL NONE -#endif - -#if 1 -#define DEC_UNROLL FULL -#elif 0 -#define DEC_UNROLL PARTIAL -#else -#define DEC_UNROLL NONE -#endif - -/* 6. FAST FINITE FIELD OPERATIONS - - If this section is included, tables are used to provide faster finite - field arithmetic (this has no effect if FIXED_TABLES is defined). -*/ -#define FF_TABLES - -/* 7. INTERNAL STATE VARIABLE FORMAT - - The internal state of Rijndael is stored in a number of local 32-bit - word varaibles which can be defined either as an array or as individual - names variables. Include this section if you want to store these local - varaibles in arrays. Otherwise individual local variables will be used. -*/ -#if 1 -#define ARRAYS -#endif - -/* 8. FIXED OR DYNAMIC TABLES - - When this section is included the tables used by the code are compiled - statically into the binary file. Otherwise the subroutine aes_init() - must be called to compute them before the code is first used. -*/ -#if !(defined( _MSC_VER ) && ( _MSC_VER <= 800 )) -#define FIXED_TABLES -#endif - -/* 9. TABLE ALIGNMENT - - On some sytsems speed will be improved by aligning the AES large lookup - tables on particular boundaries. This define should be set to a power of - two giving the desired alignment. It can be left undefined if alignment - is not needed. This option is specific to the Microsft VC++ compiler - - it seems to sometimes cause trouble for the VC++ version 6 compiler. -*/ - -#if 1 && defined( _MSC_VER ) && ( _MSC_VER >= 1300 ) -#define TABLE_ALIGN 32 -#endif - -/* 10. TABLE OPTIONS - - This cipher proceeds by repeating in a number of cycles known as 'rounds' - which are implemented by a round function which can optionally be speeded - up using tables. The basic tables are each 256 32-bit words, with either - one or four tables being required for each round function depending on - how much speed is required. The encryption and decryption round functions - are different and the last encryption and decrytpion round functions are - different again making four different round functions in all. - - This means that: - 1. Normal encryption and decryption rounds can each use either 0, 1 - or 4 tables and table spaces of 0, 1024 or 4096 bytes each. - 2. The last encryption and decryption rounds can also use either 0, 1 - or 4 tables and table spaces of 0, 1024 or 4096 bytes each. - - Include or exclude the appropriate definitions below to set the number - of tables used by this implementation. -*/ - -#if 1 /* set tables for the normal encryption round */ -#define ENC_ROUND FOUR_TABLES -#elif 0 -#define ENC_ROUND ONE_TABLE -#else -#define ENC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the last encryption round */ -#define LAST_ENC_ROUND FOUR_TABLES -#elif 0 -#define LAST_ENC_ROUND ONE_TABLE -#else -#define LAST_ENC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the normal decryption round */ -#define DEC_ROUND FOUR_TABLES -#elif 0 -#define DEC_ROUND ONE_TABLE -#else -#define DEC_ROUND NO_TABLES -#endif - -#if 1 /* set tables for the last decryption round */ -#define LAST_DEC_ROUND FOUR_TABLES -#elif 0 -#define LAST_DEC_ROUND ONE_TABLE -#else -#define LAST_DEC_ROUND NO_TABLES -#endif - -/* The decryption key schedule can be speeded up with tables in the same - way that the round functions can. Include or exclude the following - defines to set this requirement. -*/ -#if 1 -#define KEY_SCHED FOUR_TABLES -#elif 0 -#define KEY_SCHED ONE_TABLE -#else -#define KEY_SCHED NO_TABLES -#endif - -/* ---- END OF USER CONFIGURED OPTIONS ---- */ - -/* VIA ACE support is only available for VC++ and GCC */ - -#if !defined( _MSC_VER ) && !defined( __GNUC__ ) -# if defined( ASSUME_VIA_ACE_PRESENT ) -# undef ASSUME_VIA_ACE_PRESENT -# endif -# if defined( USE_VIA_ACE_IF_PRESENT ) -# undef USE_VIA_ACE_IF_PRESENT -# endif -#endif - -#if defined( ASSUME_VIA_ACE_PRESENT ) && !defined( USE_VIA_ACE_IF_PRESENT ) -#define USE_VIA_ACE_IF_PRESENT -#endif - -#if defined( USE_VIA_ACE_IF_PRESENT ) && !defined ( AES_REV_DKS ) -#define AES_REV_DKS -#endif - -/* Assembler support requires the use of platform byte order */ - -#if ( defined( ASM_X86_V1C ) || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) ) \ - && (ALGORITHM_BYTE_ORDER != PLATFORM_BYTE_ORDER) -#undef ALGORITHM_BYTE_ORDER -#define ALGORITHM_BYTE_ORDER PLATFORM_BYTE_ORDER -#endif - -/* In this implementation the columns of the state array are each held in - 32-bit words. The state array can be held in various ways: in an array - of words, in a number of individual word variables or in a number of - processor registers. The following define maps a variable name x and - a column number c to the way the state array variable is to be held. - The first define below maps the state into an array x[c] whereas the - second form maps the state into a number of individual variables x0, - x1, etc. Another form could map individual state colums to machine - register names. -*/ - -#if defined( ARRAYS ) -#define s(x,c) x[c] -#else -#define s(x,c) x##c -#endif - -/* This implementation provides subroutines for encryption, decryption - and for setting the three key lengths (separately) for encryption - and decryption. Since not all functions are needed, masks are set - up here to determine which will be implemented in C -*/ - -#if !defined( AES_ENCRYPT ) -# define EFUNCS_IN_C 0 -#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ - || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) -# define EFUNCS_IN_C ENC_KEYING_IN_C -#elif !defined( ASM_X86_V2 ) -# define EFUNCS_IN_C ( ENCRYPTION_IN_C | ENC_KEYING_IN_C ) -#else -# define EFUNCS_IN_C 0 -#endif - -#if !defined( AES_DECRYPT ) -# define DFUNCS_IN_C 0 -#elif defined( ASSUME_VIA_ACE_PRESENT ) || defined( ASM_X86_V1C ) \ - || defined( ASM_X86_V2C ) || defined( ASM_AMD64_C ) -# define DFUNCS_IN_C DEC_KEYING_IN_C -#elif !defined( ASM_X86_V2 ) -# define DFUNCS_IN_C ( DECRYPTION_IN_C | DEC_KEYING_IN_C ) -#else -# define DFUNCS_IN_C 0 -#endif - -#define FUNCS_IN_C ( EFUNCS_IN_C | DFUNCS_IN_C ) - -/* END OF CONFIGURATION OPTIONS */ - -#define RC_LENGTH (5 * (AES_BLOCK_SIZE / 4 - 2)) - -/* Disable or report errors on some combinations of options */ - -#if ENC_ROUND == NO_TABLES && LAST_ENC_ROUND != NO_TABLES -#undef LAST_ENC_ROUND -#define LAST_ENC_ROUND NO_TABLES -#elif ENC_ROUND == ONE_TABLE && LAST_ENC_ROUND == FOUR_TABLES -#undef LAST_ENC_ROUND -#define LAST_ENC_ROUND ONE_TABLE -#endif - -#if ENC_ROUND == NO_TABLES && ENC_UNROLL != NONE -#undef ENC_UNROLL -#define ENC_UNROLL NONE -#endif - -#if DEC_ROUND == NO_TABLES && LAST_DEC_ROUND != NO_TABLES -#undef LAST_DEC_ROUND -#define LAST_DEC_ROUND NO_TABLES -#elif DEC_ROUND == ONE_TABLE && LAST_DEC_ROUND == FOUR_TABLES -#undef LAST_DEC_ROUND -#define LAST_DEC_ROUND ONE_TABLE -#endif - -#if DEC_ROUND == NO_TABLES && DEC_UNROLL != NONE -#undef DEC_UNROLL -#define DEC_UNROLL NONE -#endif - -#if defined( bswap32 ) -#define aes_sw32 bswap32 -#elif defined( bswap_32 ) -#define aes_sw32 bswap_32 -#else -#define brot(x,n) (((uint_32t)(x) << n) | ((uint_32t)(x) >> (32 - n))) -#define aes_sw32(x) ((brot((x),8) & 0x00ff00ff) | (brot((x),24) & 0xff00ff00)) -#endif - -/* upr(x,n): rotates bytes within words by n positions, moving bytes to - higher index positions with wrap around into low positions - ups(x,n): moves bytes by n positions to higher index positions in - words but without wrap around - bval(x,n): extracts a byte from a word - - WARNING: The definitions given here are intended only for use with - unsigned variables and with shift counts that are compile - time constants -*/ - -#if ( ALGORITHM_BYTE_ORDER == IS_LITTLE_ENDIAN ) -#define upr(x,n) (((uint_32t)(x) << (8 * (n))) | ((uint_32t)(x) >> (32 - 8 * (n)))) -#define ups(x,n) ((uint_32t) (x) << (8 * (n))) -#define bval(x,n) ((uint_8t)((x) >> (8 * (n)))) -#define bytes2word(b0, b1, b2, b3) \ - (((uint_32t)(b3) << 24) | ((uint_32t)(b2) << 16) | ((uint_32t)(b1) << 8) | (b0)) -#endif - -#if ( ALGORITHM_BYTE_ORDER == IS_BIG_ENDIAN ) -#define upr(x,n) (((uint_32t)(x) >> (8 * (n))) | ((uint_32t)(x) << (32 - 8 * (n)))) -#define ups(x,n) ((uint_32t) (x) >> (8 * (n))) -#define bval(x,n) ((uint_8t)((x) >> (24 - 8 * (n)))) -#define bytes2word(b0, b1, b2, b3) \ - (((uint_32t)(b0) << 24) | ((uint_32t)(b1) << 16) | ((uint_32t)(b2) << 8) | (b3)) -#endif - -#if defined( SAFE_IO ) - -#define word_in(x,c) bytes2word(((const uint_8t*)(x)+4*c)[0], ((const uint_8t*)(x)+4*c)[1], \ - ((const uint_8t*)(x)+4*c)[2], ((const uint_8t*)(x)+4*c)[3]) -#define word_out(x,c,v) { ((uint_8t*)(x)+4*c)[0] = bval(v,0); ((uint_8t*)(x)+4*c)[1] = bval(v,1); \ - ((uint_8t*)(x)+4*c)[2] = bval(v,2); ((uint_8t*)(x)+4*c)[3] = bval(v,3); } - -#elif ( ALGORITHM_BYTE_ORDER == PLATFORM_BYTE_ORDER ) - -#define word_in(x,c) (*((uint_32t*)(x)+(c))) -#define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = (v)) - -#else - -#define word_in(x,c) aes_sw32(*((uint_32t*)(x)+(c))) -#define word_out(x,c,v) (*((uint_32t*)(x)+(c)) = aes_sw32(v)) - -#endif - -/* the finite field modular polynomial and elements */ - -#define WPOLY 0x011b -#define BPOLY 0x1b - -/* multiply four bytes in GF(2^8) by 'x' {02} in parallel */ - -#define m1 0x80808080 -#define m2 0x7f7f7f7f -#define gf_mulx(x) ((((x) & m2) << 1) ^ ((((x) & m1) >> 7) * BPOLY)) - -/* The following defines provide alternative definitions of gf_mulx that might - give improved performance if a fast 32-bit multiply is not available. Note - that a temporary variable u needs to be defined where gf_mulx is used. - -#define gf_mulx(x) (u = (x) & m1, u |= (u >> 1), ((x) & m2) << 1) ^ ((u >> 3) | (u >> 6)) -#define m4 (0x01010101 * BPOLY) -#define gf_mulx(x) (u = (x) & m1, ((x) & m2) << 1) ^ ((u - (u >> 7)) & m4) -*/ - -/* Work out which tables are needed for the different options */ - -#if defined( ASM_X86_V1C ) -#if defined( ENC_ROUND ) -#undef ENC_ROUND -#endif -#define ENC_ROUND FOUR_TABLES -#if defined( LAST_ENC_ROUND ) -#undef LAST_ENC_ROUND -#endif -#define LAST_ENC_ROUND FOUR_TABLES -#if defined( DEC_ROUND ) -#undef DEC_ROUND -#endif -#define DEC_ROUND FOUR_TABLES -#if defined( LAST_DEC_ROUND ) -#undef LAST_DEC_ROUND -#endif -#define LAST_DEC_ROUND FOUR_TABLES -#if defined( KEY_SCHED ) -#undef KEY_SCHED -#define KEY_SCHED FOUR_TABLES -#endif -#endif - -#if ( FUNCS_IN_C & ENCRYPTION_IN_C ) || defined( ASM_X86_V1C ) -#if ENC_ROUND == ONE_TABLE -#define FT1_SET -#elif ENC_ROUND == FOUR_TABLES -#define FT4_SET -#else -#define SBX_SET -#endif -#if LAST_ENC_ROUND == ONE_TABLE -#define FL1_SET -#elif LAST_ENC_ROUND == FOUR_TABLES -#define FL4_SET -#elif !defined( SBX_SET ) -#define SBX_SET -#endif -#endif - -#if ( FUNCS_IN_C & DECRYPTION_IN_C ) || defined( ASM_X86_V1C ) -#if DEC_ROUND == ONE_TABLE -#define IT1_SET -#elif DEC_ROUND == FOUR_TABLES -#define IT4_SET -#else -#define ISB_SET -#endif -#if LAST_DEC_ROUND == ONE_TABLE -#define IL1_SET -#elif LAST_DEC_ROUND == FOUR_TABLES -#define IL4_SET -#elif !defined(ISB_SET) -#define ISB_SET -#endif -#endif - -#if (FUNCS_IN_C & ENC_KEYING_IN_C) || (FUNCS_IN_C & DEC_KEYING_IN_C) -#if KEY_SCHED == ONE_TABLE -#define LS1_SET -#elif KEY_SCHED == FOUR_TABLES -#define LS4_SET -#elif !defined( SBX_SET ) -#define SBX_SET -#endif -#endif - -#if (FUNCS_IN_C & DEC_KEYING_IN_C) -#if KEY_SCHED == ONE_TABLE -#define IM1_SET -#elif KEY_SCHED == FOUR_TABLES -#define IM4_SET -#elif !defined( SBX_SET ) -#define SBX_SET -#endif -#endif - -/* generic definitions of Rijndael macros that use tables */ - -#define no_table(x,box,vf,rf,c) bytes2word( \ - box[bval(vf(x,0,c),rf(0,c))], \ - box[bval(vf(x,1,c),rf(1,c))], \ - box[bval(vf(x,2,c),rf(2,c))], \ - box[bval(vf(x,3,c),rf(3,c))]) - -#define one_table(x,op,tab,vf,rf,c) \ - ( tab[bval(vf(x,0,c),rf(0,c))] \ - ^ op(tab[bval(vf(x,1,c),rf(1,c))],1) \ - ^ op(tab[bval(vf(x,2,c),rf(2,c))],2) \ - ^ op(tab[bval(vf(x,3,c),rf(3,c))],3)) - -#define four_tables(x,tab,vf,rf,c) \ - ( tab[0][bval(vf(x,0,c),rf(0,c))] \ - ^ tab[1][bval(vf(x,1,c),rf(1,c))] \ - ^ tab[2][bval(vf(x,2,c),rf(2,c))] \ - ^ tab[3][bval(vf(x,3,c),rf(3,c))]) - -#define vf1(x,r,c) (x) -#define rf1(r,c) (r) -#define rf2(r,c) ((8+r-c)&3) - -/* perform forward and inverse column mix operation on four bytes in long word x in */ -/* parallel. NOTE: x must be a simple variable, NOT an expression in these macros. */ - -#if defined( FM4_SET ) /* not currently used */ -#define fwd_mcol(x) four_tables(x,t_use(f,m),vf1,rf1,0) -#elif defined( FM1_SET ) /* not currently used */ -#define fwd_mcol(x) one_table(x,upr,t_use(f,m),vf1,rf1,0) -#else -#define dec_fmvars uint_32t g2 -#define fwd_mcol(x) (g2 = gf_mulx(x), g2 ^ upr((x) ^ g2, 3) ^ upr((x), 2) ^ upr((x), 1)) -#endif - -#if defined( IM4_SET ) -#define inv_mcol(x) four_tables(x,t_use(i,m),vf1,rf1,0) -#elif defined( IM1_SET ) -#define inv_mcol(x) one_table(x,upr,t_use(i,m),vf1,rf1,0) -#else -#define dec_imvars uint_32t g2, g4, g9 -#define inv_mcol(x) (g2 = gf_mulx(x), g4 = gf_mulx(g2), g9 = (x) ^ gf_mulx(g4), g4 ^= g9, \ - (x) ^ g2 ^ g4 ^ upr(g2 ^ g9, 3) ^ upr(g4, 2) ^ upr(g9, 1)) -#endif - -#if defined( FL4_SET ) -#define ls_box(x,c) four_tables(x,t_use(f,l),vf1,rf2,c) -#elif defined( LS4_SET ) -#define ls_box(x,c) four_tables(x,t_use(l,s),vf1,rf2,c) -#elif defined( FL1_SET ) -#define ls_box(x,c) one_table(x,upr,t_use(f,l),vf1,rf2,c) -#elif defined( LS1_SET ) -#define ls_box(x,c) one_table(x,upr,t_use(l,s),vf1,rf2,c) -#else -#define ls_box(x,c) no_table(x,t_use(s,box),vf1,rf2,c) -#endif - -#if defined( ASM_X86_V1C ) && defined( AES_DECRYPT ) && !defined( ISB_SET ) -#define ISB_SET -#endif - -#endif diff --git a/src/utils/crypto/aessmall.c b/src/utils/crypto/aessmall.c deleted file mode 100644 index 69d5732217a..00000000000 --- a/src/utils/crypto/aessmall.c +++ /dev/null @@ -1,921 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - This is an AES implementation that uses only 8-bit byte operations on the - cipher state (there are options to use 32-bit types if available). - - The combination of mix columns and byte substitution used here is based on - that developed by Karl Malbrain. His contribution is acknowledged. - */ - -/* Adapted by TrueCrypt Foundation: - - Macro-generated tables were replaced with static data to enable compiling - with MSVC++ 1.5 which runs out of resources when expanding large macros. -*/ - -// #pragma optimize ("t", on) - -/* define if you have a fast memcpy function on your system */ -#if 1 -# define HAVE_MEMCPY -# include -# if defined( _MSC_VER ) -# ifndef DEBUG -# pragma intrinsic( memcpy ) -# endif -# endif -#endif - -/* define if you have fast 32-bit types on your system */ -#if 1 -# define HAVE_UINT_32T -#endif - -/* alternative versions (test for performance on your system) */ -#if 0 -# define VERSION_1 -#endif - -#include -#include "aessmall.h" - -#define WPOLY 0x011b -#define DPOLY 0x008d -#define f1(x) (x) -#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) -#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) -#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ - ^ (((x>>5) & 4) * WPOLY)) -#define d2(x) (((x) >> 1) ^ ((x) & 1 ? DPOLY : 0)) - -#define f3(x) (f2(x) ^ x) -#define f9(x) (f8(x) ^ x) -#define fb(x) (f8(x) ^ f2(x) ^ x) -#define fd(x) (f8(x) ^ f4(x) ^ x) -#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) - -static const uint_8t s_box[256] = { - 0x63,0x7c,0x77,0x7b,0xf2,0x6b,0x6f,0xc5, - 0x30,0x01,0x67,0x2b,0xfe,0xd7,0xab,0x76, - 0xca,0x82,0xc9,0x7d,0xfa,0x59,0x47,0xf0, - 0xad,0xd4,0xa2,0xaf,0x9c,0xa4,0x72,0xc0, - 0xb7,0xfd,0x93,0x26,0x36,0x3f,0xf7,0xcc, - 0x34,0xa5,0xe5,0xf1,0x71,0xd8,0x31,0x15, - 0x04,0xc7,0x23,0xc3,0x18,0x96,0x05,0x9a, - 0x07,0x12,0x80,0xe2,0xeb,0x27,0xb2,0x75, - 0x09,0x83,0x2c,0x1a,0x1b,0x6e,0x5a,0xa0, - 0x52,0x3b,0xd6,0xb3,0x29,0xe3,0x2f,0x84, - 0x53,0xd1,0x00,0xed,0x20,0xfc,0xb1,0x5b, - 0x6a,0xcb,0xbe,0x39,0x4a,0x4c,0x58,0xcf, - 0xd0,0xef,0xaa,0xfb,0x43,0x4d,0x33,0x85, - 0x45,0xf9,0x02,0x7f,0x50,0x3c,0x9f,0xa8, - 0x51,0xa3,0x40,0x8f,0x92,0x9d,0x38,0xf5, - 0xbc,0xb6,0xda,0x21,0x10,0xff,0xf3,0xd2, - 0xcd,0x0c,0x13,0xec,0x5f,0x97,0x44,0x17, - 0xc4,0xa7,0x7e,0x3d,0x64,0x5d,0x19,0x73, - 0x60,0x81,0x4f,0xdc,0x22,0x2a,0x90,0x88, - 0x46,0xee,0xb8,0x14,0xde,0x5e,0x0b,0xdb, - 0xe0,0x32,0x3a,0x0a,0x49,0x06,0x24,0x5c, - 0xc2,0xd3,0xac,0x62,0x91,0x95,0xe4,0x79, - 0xe7,0xc8,0x37,0x6d,0x8d,0xd5,0x4e,0xa9, - 0x6c,0x56,0xf4,0xea,0x65,0x7a,0xae,0x08, - 0xba,0x78,0x25,0x2e,0x1c,0xa6,0xb4,0xc6, - 0xe8,0xdd,0x74,0x1f,0x4b,0xbd,0x8b,0x8a, - 0x70,0x3e,0xb5,0x66,0x48,0x03,0xf6,0x0e, - 0x61,0x35,0x57,0xb9,0x86,0xc1,0x1d,0x9e, - 0xe1,0xf8,0x98,0x11,0x69,0xd9,0x8e,0x94, - 0x9b,0x1e,0x87,0xe9,0xce,0x55,0x28,0xdf, - 0x8c,0xa1,0x89,0x0d,0xbf,0xe6,0x42,0x68, - 0x41,0x99,0x2d,0x0f,0xb0,0x54,0xbb,0x16 -}; - -static const uint_8t inv_s_box[256] = { - 0x52,0x09,0x6a,0xd5,0x30,0x36,0xa5,0x38, - 0xbf,0x40,0xa3,0x9e,0x81,0xf3,0xd7,0xfb, - 0x7c,0xe3,0x39,0x82,0x9b,0x2f,0xff,0x87, - 0x34,0x8e,0x43,0x44,0xc4,0xde,0xe9,0xcb, - 0x54,0x7b,0x94,0x32,0xa6,0xc2,0x23,0x3d, - 0xee,0x4c,0x95,0x0b,0x42,0xfa,0xc3,0x4e, - 0x08,0x2e,0xa1,0x66,0x28,0xd9,0x24,0xb2, - 0x76,0x5b,0xa2,0x49,0x6d,0x8b,0xd1,0x25, - 0x72,0xf8,0xf6,0x64,0x86,0x68,0x98,0x16, - 0xd4,0xa4,0x5c,0xcc,0x5d,0x65,0xb6,0x92, - 0x6c,0x70,0x48,0x50,0xfd,0xed,0xb9,0xda, - 0x5e,0x15,0x46,0x57,0xa7,0x8d,0x9d,0x84, - 0x90,0xd8,0xab,0x00,0x8c,0xbc,0xd3,0x0a, - 0xf7,0xe4,0x58,0x05,0xb8,0xb3,0x45,0x06, - 0xd0,0x2c,0x1e,0x8f,0xca,0x3f,0x0f,0x02, - 0xc1,0xaf,0xbd,0x03,0x01,0x13,0x8a,0x6b, - 0x3a,0x91,0x11,0x41,0x4f,0x67,0xdc,0xea, - 0x97,0xf2,0xcf,0xce,0xf0,0xb4,0xe6,0x73, - 0x96,0xac,0x74,0x22,0xe7,0xad,0x35,0x85, - 0xe2,0xf9,0x37,0xe8,0x1c,0x75,0xdf,0x6e, - 0x47,0xf1,0x1a,0x71,0x1d,0x29,0xc5,0x89, - 0x6f,0xb7,0x62,0x0e,0xaa,0x18,0xbe,0x1b, - 0xfc,0x56,0x3e,0x4b,0xc6,0xd2,0x79,0x20, - 0x9a,0xdb,0xc0,0xfe,0x78,0xcd,0x5a,0xf4, - 0x1f,0xdd,0xa8,0x33,0x88,0x07,0xc7,0x31, - 0xb1,0x12,0x10,0x59,0x27,0x80,0xec,0x5f, - 0x60,0x51,0x7f,0xa9,0x19,0xb5,0x4a,0x0d, - 0x2d,0xe5,0x7a,0x9f,0x93,0xc9,0x9c,0xef, - 0xa0,0xe0,0x3b,0x4d,0xae,0x2a,0xf5,0xb0, - 0xc8,0xeb,0xbb,0x3c,0x83,0x53,0x99,0x61, - 0x17,0x2b,0x04,0x7e,0xba,0x77,0xd6,0x26, - 0xe1,0x69,0x14,0x63,0x55,0x21,0x0c,0x7d -}; - -static const uint_8t gfm2_s_box[256] = { - 0xc6,0xf8,0xee,0xf6,0xff,0xd6,0xde,0x91, - 0x60,0x02,0xce,0x56,0xe7,0xb5,0x4d,0xec, - 0x8f,0x1f,0x89,0xfa,0xef,0xb2,0x8e,0xfb, - 0x41,0xb3,0x5f,0x45,0x23,0x53,0xe4,0x9b, - 0x75,0xe1,0x3d,0x4c,0x6c,0x7e,0xf5,0x83, - 0x68,0x51,0xd1,0xf9,0xe2,0xab,0x62,0x2a, - 0x08,0x95,0x46,0x9d,0x30,0x37,0x0a,0x2f, - 0x0e,0x24,0x1b,0xdf,0xcd,0x4e,0x7f,0xea, - 0x12,0x1d,0x58,0x34,0x36,0xdc,0xb4,0x5b, - 0xa4,0x76,0xb7,0x7d,0x52,0xdd,0x5e,0x13, - 0xa6,0xb9,0x00,0xc1,0x40,0xe3,0x79,0xb6, - 0xd4,0x8d,0x67,0x72,0x94,0x98,0xb0,0x85, - 0xbb,0xc5,0x4f,0xed,0x86,0x9a,0x66,0x11, - 0x8a,0xe9,0x04,0xfe,0xa0,0x78,0x25,0x4b, - 0xa2,0x5d,0x80,0x05,0x3f,0x21,0x70,0xf1, - 0x63,0x77,0xaf,0x42,0x20,0xe5,0xfd,0xbf, - 0x81,0x18,0x26,0xc3,0xbe,0x35,0x88,0x2e, - 0x93,0x55,0xfc,0x7a,0xc8,0xba,0x32,0xe6, - 0xc0,0x19,0x9e,0xa3,0x44,0x54,0x3b,0x0b, - 0x8c,0xc7,0x6b,0x28,0xa7,0xbc,0x16,0xad, - 0xdb,0x64,0x74,0x14,0x92,0x0c,0x48,0xb8, - 0x9f,0xbd,0x43,0xc4,0x39,0x31,0xd3,0xf2, - 0xd5,0x8b,0x6e,0xda,0x01,0xb1,0x9c,0x49, - 0xd8,0xac,0xf3,0xcf,0xca,0xf4,0x47,0x10, - 0x6f,0xf0,0x4a,0x5c,0x38,0x57,0x73,0x97, - 0xcb,0xa1,0xe8,0x3e,0x96,0x61,0x0d,0x0f, - 0xe0,0x7c,0x71,0xcc,0x90,0x06,0xf7,0x1c, - 0xc2,0x6a,0xae,0x69,0x17,0x99,0x3a,0x27, - 0xd9,0xeb,0x2b,0x22,0xd2,0xa9,0x07,0x33, - 0x2d,0x3c,0x15,0xc9,0x87,0xaa,0x50,0xa5, - 0x03,0x59,0x09,0x1a,0x65,0xd7,0x84,0xd0, - 0x82,0x29,0x5a,0x1e,0x7b,0xa8,0x6d,0x2c -}; - -static const uint_8t gfm3_s_box[256] = { - 0xa5,0x84,0x99,0x8d,0x0d,0xbd,0xb1,0x54, - 0x50,0x03,0xa9,0x7d,0x19,0x62,0xe6,0x9a, - 0x45,0x9d,0x40,0x87,0x15,0xeb,0xc9,0x0b, - 0xec,0x67,0xfd,0xea,0xbf,0xf7,0x96,0x5b, - 0xc2,0x1c,0xae,0x6a,0x5a,0x41,0x02,0x4f, - 0x5c,0xf4,0x34,0x08,0x93,0x73,0x53,0x3f, - 0x0c,0x52,0x65,0x5e,0x28,0xa1,0x0f,0xb5, - 0x09,0x36,0x9b,0x3d,0x26,0x69,0xcd,0x9f, - 0x1b,0x9e,0x74,0x2e,0x2d,0xb2,0xee,0xfb, - 0xf6,0x4d,0x61,0xce,0x7b,0x3e,0x71,0x97, - 0xf5,0x68,0x00,0x2c,0x60,0x1f,0xc8,0xed, - 0xbe,0x46,0xd9,0x4b,0xde,0xd4,0xe8,0x4a, - 0x6b,0x2a,0xe5,0x16,0xc5,0xd7,0x55,0x94, - 0xcf,0x10,0x06,0x81,0xf0,0x44,0xba,0xe3, - 0xf3,0xfe,0xc0,0x8a,0xad,0xbc,0x48,0x04, - 0xdf,0xc1,0x75,0x63,0x30,0x1a,0x0e,0x6d, - 0x4c,0x14,0x35,0x2f,0xe1,0xa2,0xcc,0x39, - 0x57,0xf2,0x82,0x47,0xac,0xe7,0x2b,0x95, - 0xa0,0x98,0xd1,0x7f,0x66,0x7e,0xab,0x83, - 0xca,0x29,0xd3,0x3c,0x79,0xe2,0x1d,0x76, - 0x3b,0x56,0x4e,0x1e,0xdb,0x0a,0x6c,0xe4, - 0x5d,0x6e,0xef,0xa6,0xa8,0xa4,0x37,0x8b, - 0x32,0x43,0x59,0xb7,0x8c,0x64,0xd2,0xe0, - 0xb4,0xfa,0x07,0x25,0xaf,0x8e,0xe9,0x18, - 0xd5,0x88,0x6f,0x72,0x24,0xf1,0xc7,0x51, - 0x23,0x7c,0x9c,0x21,0xdd,0xdc,0x86,0x85, - 0x90,0x42,0xc4,0xaa,0xd8,0x05,0x01,0x12, - 0xa3,0x5f,0xf9,0xd0,0x91,0x58,0x27,0xb9, - 0x38,0x13,0xb3,0x33,0xbb,0x70,0x89,0xa7, - 0xb6,0x22,0x92,0x20,0x49,0xff,0x78,0x7a, - 0x8f,0xf8,0x80,0x17,0xda,0x31,0xc6,0xb8, - 0xc3,0xb0,0x77,0x11,0xcb,0xfc,0xd6,0x3a -}; - -static const uint_8t gfmul_9[256] = { - 0x00,0x09,0x12,0x1b,0x24,0x2d,0x36,0x3f, - 0x48,0x41,0x5a,0x53,0x6c,0x65,0x7e,0x77, - 0x90,0x99,0x82,0x8b,0xb4,0xbd,0xa6,0xaf, - 0xd8,0xd1,0xca,0xc3,0xfc,0xf5,0xee,0xe7, - 0x3b,0x32,0x29,0x20,0x1f,0x16,0x0d,0x04, - 0x73,0x7a,0x61,0x68,0x57,0x5e,0x45,0x4c, - 0xab,0xa2,0xb9,0xb0,0x8f,0x86,0x9d,0x94, - 0xe3,0xea,0xf1,0xf8,0xc7,0xce,0xd5,0xdc, - 0x76,0x7f,0x64,0x6d,0x52,0x5b,0x40,0x49, - 0x3e,0x37,0x2c,0x25,0x1a,0x13,0x08,0x01, - 0xe6,0xef,0xf4,0xfd,0xc2,0xcb,0xd0,0xd9, - 0xae,0xa7,0xbc,0xb5,0x8a,0x83,0x98,0x91, - 0x4d,0x44,0x5f,0x56,0x69,0x60,0x7b,0x72, - 0x05,0x0c,0x17,0x1e,0x21,0x28,0x33,0x3a, - 0xdd,0xd4,0xcf,0xc6,0xf9,0xf0,0xeb,0xe2, - 0x95,0x9c,0x87,0x8e,0xb1,0xb8,0xa3,0xaa, - 0xec,0xe5,0xfe,0xf7,0xc8,0xc1,0xda,0xd3, - 0xa4,0xad,0xb6,0xbf,0x80,0x89,0x92,0x9b, - 0x7c,0x75,0x6e,0x67,0x58,0x51,0x4a,0x43, - 0x34,0x3d,0x26,0x2f,0x10,0x19,0x02,0x0b, - 0xd7,0xde,0xc5,0xcc,0xf3,0xfa,0xe1,0xe8, - 0x9f,0x96,0x8d,0x84,0xbb,0xb2,0xa9,0xa0, - 0x47,0x4e,0x55,0x5c,0x63,0x6a,0x71,0x78, - 0x0f,0x06,0x1d,0x14,0x2b,0x22,0x39,0x30, - 0x9a,0x93,0x88,0x81,0xbe,0xb7,0xac,0xa5, - 0xd2,0xdb,0xc0,0xc9,0xf6,0xff,0xe4,0xed, - 0x0a,0x03,0x18,0x11,0x2e,0x27,0x3c,0x35, - 0x42,0x4b,0x50,0x59,0x66,0x6f,0x74,0x7d, - 0xa1,0xa8,0xb3,0xba,0x85,0x8c,0x97,0x9e, - 0xe9,0xe0,0xfb,0xf2,0xcd,0xc4,0xdf,0xd6, - 0x31,0x38,0x23,0x2a,0x15,0x1c,0x07,0x0e, - 0x79,0x70,0x6b,0x62,0x5d,0x54,0x4f,0x46 -}; - -static const uint_8t gfmul_b[256] = { - 0x00,0x0b,0x16,0x1d,0x2c,0x27,0x3a,0x31, - 0x58,0x53,0x4e,0x45,0x74,0x7f,0x62,0x69, - 0xb0,0xbb,0xa6,0xad,0x9c,0x97,0x8a,0x81, - 0xe8,0xe3,0xfe,0xf5,0xc4,0xcf,0xd2,0xd9, - 0x7b,0x70,0x6d,0x66,0x57,0x5c,0x41,0x4a, - 0x23,0x28,0x35,0x3e,0x0f,0x04,0x19,0x12, - 0xcb,0xc0,0xdd,0xd6,0xe7,0xec,0xf1,0xfa, - 0x93,0x98,0x85,0x8e,0xbf,0xb4,0xa9,0xa2, - 0xf6,0xfd,0xe0,0xeb,0xda,0xd1,0xcc,0xc7, - 0xae,0xa5,0xb8,0xb3,0x82,0x89,0x94,0x9f, - 0x46,0x4d,0x50,0x5b,0x6a,0x61,0x7c,0x77, - 0x1e,0x15,0x08,0x03,0x32,0x39,0x24,0x2f, - 0x8d,0x86,0x9b,0x90,0xa1,0xaa,0xb7,0xbc, - 0xd5,0xde,0xc3,0xc8,0xf9,0xf2,0xef,0xe4, - 0x3d,0x36,0x2b,0x20,0x11,0x1a,0x07,0x0c, - 0x65,0x6e,0x73,0x78,0x49,0x42,0x5f,0x54, - 0xf7,0xfc,0xe1,0xea,0xdb,0xd0,0xcd,0xc6, - 0xaf,0xa4,0xb9,0xb2,0x83,0x88,0x95,0x9e, - 0x47,0x4c,0x51,0x5a,0x6b,0x60,0x7d,0x76, - 0x1f,0x14,0x09,0x02,0x33,0x38,0x25,0x2e, - 0x8c,0x87,0x9a,0x91,0xa0,0xab,0xb6,0xbd, - 0xd4,0xdf,0xc2,0xc9,0xf8,0xf3,0xee,0xe5, - 0x3c,0x37,0x2a,0x21,0x10,0x1b,0x06,0x0d, - 0x64,0x6f,0x72,0x79,0x48,0x43,0x5e,0x55, - 0x01,0x0a,0x17,0x1c,0x2d,0x26,0x3b,0x30, - 0x59,0x52,0x4f,0x44,0x75,0x7e,0x63,0x68, - 0xb1,0xba,0xa7,0xac,0x9d,0x96,0x8b,0x80, - 0xe9,0xe2,0xff,0xf4,0xc5,0xce,0xd3,0xd8, - 0x7a,0x71,0x6c,0x67,0x56,0x5d,0x40,0x4b, - 0x22,0x29,0x34,0x3f,0x0e,0x05,0x18,0x13, - 0xca,0xc1,0xdc,0xd7,0xe6,0xed,0xf0,0xfb, - 0x92,0x99,0x84,0x8f,0xbe,0xb5,0xa8,0xa3 -}; - -static const uint_8t gfmul_d[256] = { - 0x00,0x0d,0x1a,0x17,0x34,0x39,0x2e,0x23, - 0x68,0x65,0x72,0x7f,0x5c,0x51,0x46,0x4b, - 0xd0,0xdd,0xca,0xc7,0xe4,0xe9,0xfe,0xf3, - 0xb8,0xb5,0xa2,0xaf,0x8c,0x81,0x96,0x9b, - 0xbb,0xb6,0xa1,0xac,0x8f,0x82,0x95,0x98, - 0xd3,0xde,0xc9,0xc4,0xe7,0xea,0xfd,0xf0, - 0x6b,0x66,0x71,0x7c,0x5f,0x52,0x45,0x48, - 0x03,0x0e,0x19,0x14,0x37,0x3a,0x2d,0x20, - 0x6d,0x60,0x77,0x7a,0x59,0x54,0x43,0x4e, - 0x05,0x08,0x1f,0x12,0x31,0x3c,0x2b,0x26, - 0xbd,0xb0,0xa7,0xaa,0x89,0x84,0x93,0x9e, - 0xd5,0xd8,0xcf,0xc2,0xe1,0xec,0xfb,0xf6, - 0xd6,0xdb,0xcc,0xc1,0xe2,0xef,0xf8,0xf5, - 0xbe,0xb3,0xa4,0xa9,0x8a,0x87,0x90,0x9d, - 0x06,0x0b,0x1c,0x11,0x32,0x3f,0x28,0x25, - 0x6e,0x63,0x74,0x79,0x5a,0x57,0x40,0x4d, - 0xda,0xd7,0xc0,0xcd,0xee,0xe3,0xf4,0xf9, - 0xb2,0xbf,0xa8,0xa5,0x86,0x8b,0x9c,0x91, - 0x0a,0x07,0x10,0x1d,0x3e,0x33,0x24,0x29, - 0x62,0x6f,0x78,0x75,0x56,0x5b,0x4c,0x41, - 0x61,0x6c,0x7b,0x76,0x55,0x58,0x4f,0x42, - 0x09,0x04,0x13,0x1e,0x3d,0x30,0x27,0x2a, - 0xb1,0xbc,0xab,0xa6,0x85,0x88,0x9f,0x92, - 0xd9,0xd4,0xc3,0xce,0xed,0xe0,0xf7,0xfa, - 0xb7,0xba,0xad,0xa0,0x83,0x8e,0x99,0x94, - 0xdf,0xd2,0xc5,0xc8,0xeb,0xe6,0xf1,0xfc, - 0x67,0x6a,0x7d,0x70,0x53,0x5e,0x49,0x44, - 0x0f,0x02,0x15,0x18,0x3b,0x36,0x21,0x2c, - 0x0c,0x01,0x16,0x1b,0x38,0x35,0x22,0x2f, - 0x64,0x69,0x7e,0x73,0x50,0x5d,0x4a,0x47, - 0xdc,0xd1,0xc6,0xcb,0xe8,0xe5,0xf2,0xff, - 0xb4,0xb9,0xae,0xa3,0x80,0x8d,0x9a,0x97 -}; - -static const uint_8t gfmul_e[256] = { - 0x00,0x0e,0x1c,0x12,0x38,0x36,0x24,0x2a, - 0x70,0x7e,0x6c,0x62,0x48,0x46,0x54,0x5a, - 0xe0,0xee,0xfc,0xf2,0xd8,0xd6,0xc4,0xca, - 0x90,0x9e,0x8c,0x82,0xa8,0xa6,0xb4,0xba, - 0xdb,0xd5,0xc7,0xc9,0xe3,0xed,0xff,0xf1, - 0xab,0xa5,0xb7,0xb9,0x93,0x9d,0x8f,0x81, - 0x3b,0x35,0x27,0x29,0x03,0x0d,0x1f,0x11, - 0x4b,0x45,0x57,0x59,0x73,0x7d,0x6f,0x61, - 0xad,0xa3,0xb1,0xbf,0x95,0x9b,0x89,0x87, - 0xdd,0xd3,0xc1,0xcf,0xe5,0xeb,0xf9,0xf7, - 0x4d,0x43,0x51,0x5f,0x75,0x7b,0x69,0x67, - 0x3d,0x33,0x21,0x2f,0x05,0x0b,0x19,0x17, - 0x76,0x78,0x6a,0x64,0x4e,0x40,0x52,0x5c, - 0x06,0x08,0x1a,0x14,0x3e,0x30,0x22,0x2c, - 0x96,0x98,0x8a,0x84,0xae,0xa0,0xb2,0xbc, - 0xe6,0xe8,0xfa,0xf4,0xde,0xd0,0xc2,0xcc, - 0x41,0x4f,0x5d,0x53,0x79,0x77,0x65,0x6b, - 0x31,0x3f,0x2d,0x23,0x09,0x07,0x15,0x1b, - 0xa1,0xaf,0xbd,0xb3,0x99,0x97,0x85,0x8b, - 0xd1,0xdf,0xcd,0xc3,0xe9,0xe7,0xf5,0xfb, - 0x9a,0x94,0x86,0x88,0xa2,0xac,0xbe,0xb0, - 0xea,0xe4,0xf6,0xf8,0xd2,0xdc,0xce,0xc0, - 0x7a,0x74,0x66,0x68,0x42,0x4c,0x5e,0x50, - 0x0a,0x04,0x16,0x18,0x32,0x3c,0x2e,0x20, - 0xec,0xe2,0xf0,0xfe,0xd4,0xda,0xc8,0xc6, - 0x9c,0x92,0x80,0x8e,0xa4,0xaa,0xb8,0xb6, - 0x0c,0x02,0x10,0x1e,0x34,0x3a,0x28,0x26, - 0x7c,0x72,0x60,0x6e,0x44,0x4a,0x58,0x56, - 0x37,0x39,0x2b,0x25,0x0f,0x01,0x13,0x1d, - 0x47,0x49,0x5b,0x55,0x7f,0x71,0x63,0x6d, - 0xd7,0xd9,0xcb,0xc5,0xef,0xe1,0xf3,0xfd, - 0xa7,0xa9,0xbb,0xb5,0x9f,0x91,0x83,0x8d -}; - -#if defined( HAVE_UINT_32T ) - typedef unsigned long uint_32t; -#endif - -#if defined( HAVE_MEMCPY ) -# define block_copy(d, s, l) memcpy(d, s, l) -# define block16_copy(d, s) memcpy(d, s, N_BLOCK) -#else -# define block_copy(d, s, l) copy_block(d, s, l) -# define block16_copy(d, s) copy_block16(d, s) - -/* block size 'nn' must be a multiple of four */ - -static void copy_block16( void *d, const void *s ) -{ -#if defined( HAVE_UINT_32T ) - ((uint32_t *)d)[ 0] = ((uint32_t *)s)[ 0]; - ((uint32_t *)d)[ 1] = ((uint32_t *)s)[ 1]; - ((uint32_t *)d)[ 2] = ((uint32_t *)s)[ 2]; - ((uint32_t *)d)[ 3] = ((uint32_t *)s)[ 3]; -#else - ((uint_8t*)d)[ 0] = ((uint_8t*)s)[ 0]; - ((uint_8t*)d)[ 1] = ((uint_8t*)s)[ 1]; - ((uint_8t*)d)[ 2] = ((uint_8t*)s)[ 2]; - ((uint_8t*)d)[ 3] = ((uint_8t*)s)[ 3]; - ((uint_8t*)d)[ 4] = ((uint_8t*)s)[ 4]; - ((uint_8t*)d)[ 5] = ((uint_8t*)s)[ 5]; - ((uint_8t*)d)[ 6] = ((uint_8t*)s)[ 6]; - ((uint_8t*)d)[ 7] = ((uint_8t*)s)[ 7]; - ((uint_8t*)d)[ 8] = ((uint_8t*)s)[ 8]; - ((uint_8t*)d)[ 9] = ((uint_8t*)s)[ 9]; - ((uint_8t*)d)[10] = ((uint_8t*)s)[10]; - ((uint_8t*)d)[11] = ((uint_8t*)s)[11]; - ((uint_8t*)d)[12] = ((uint_8t*)s)[12]; - ((uint_8t*)d)[13] = ((uint_8t*)s)[13]; - ((uint_8t*)d)[14] = ((uint_8t*)s)[14]; - ((uint_8t*)d)[15] = ((uint_8t*)s)[15]; -#endif -} - -static void copy_block( void * d, void *s, uint_8t nn ) -{ - while( nn-- ) - *((uint8_t*)d)++ = *((uint8_t*)s)++; -} -#endif - -static void copy_and_key( void *d, const void *s, const void *k ) -{ -#if defined( HAVE_UINT_32T ) - ((uint32_t *)d)[ 0] = ((uint32_t *)s)[ 0] ^ ((uint32_t *)k)[ 0]; - ((uint32_t *)d)[ 1] = ((uint32_t *)s)[ 1] ^ ((uint32_t *)k)[ 1]; - ((uint32_t *)d)[ 2] = ((uint32_t *)s)[ 2] ^ ((uint32_t *)k)[ 2]; - ((uint32_t *)d)[ 3] = ((uint32_t *)s)[ 3] ^ ((uint32_t *)k)[ 3]; -#elif 1 - ((uint_8t*)d)[ 0] = ((uint_8t*)s)[ 0] ^ ((uint_8t*)k)[ 0]; - ((uint_8t*)d)[ 1] = ((uint_8t*)s)[ 1] ^ ((uint_8t*)k)[ 1]; - ((uint_8t*)d)[ 2] = ((uint_8t*)s)[ 2] ^ ((uint_8t*)k)[ 2]; - ((uint_8t*)d)[ 3] = ((uint_8t*)s)[ 3] ^ ((uint_8t*)k)[ 3]; - ((uint_8t*)d)[ 4] = ((uint_8t*)s)[ 4] ^ ((uint_8t*)k)[ 4]; - ((uint_8t*)d)[ 5] = ((uint_8t*)s)[ 5] ^ ((uint_8t*)k)[ 5]; - ((uint_8t*)d)[ 6] = ((uint_8t*)s)[ 6] ^ ((uint_8t*)k)[ 6]; - ((uint_8t*)d)[ 7] = ((uint_8t*)s)[ 7] ^ ((uint_8t*)k)[ 7]; - ((uint_8t*)d)[ 8] = ((uint_8t*)s)[ 8] ^ ((uint_8t*)k)[ 8]; - ((uint_8t*)d)[ 9] = ((uint_8t*)s)[ 9] ^ ((uint_8t*)k)[ 9]; - ((uint_8t*)d)[10] = ((uint_8t*)s)[10] ^ ((uint_8t*)k)[10]; - ((uint_8t*)d)[11] = ((uint_8t*)s)[11] ^ ((uint_8t*)k)[11]; - ((uint_8t*)d)[12] = ((uint_8t*)s)[12] ^ ((uint_8t*)k)[12]; - ((uint_8t*)d)[13] = ((uint_8t*)s)[13] ^ ((uint_8t*)k)[13]; - ((uint_8t*)d)[14] = ((uint_8t*)s)[14] ^ ((uint_8t*)k)[14]; - ((uint_8t*)d)[15] = ((uint_8t*)s)[15] ^ ((uint_8t*)k)[15]; -#else - block16_copy(d, s); - xor_block(d, k); -#endif -} - -static void shift_sub_rows( uint_8t st[N_BLOCK] ) -{ uint_8t tt; - - st[ 0] = s_box[st[ 0]]; st[ 4] = s_box[st[ 4]]; - st[ 8] = s_box[st[ 8]]; st[12] = s_box[st[12]]; - - tt = st[1]; st[ 1] = s_box[st[ 5]]; st[ 5] = s_box[st[ 9]]; - st[ 9] = s_box[st[13]]; st[13] = s_box[ tt ]; - - tt = st[2]; st[ 2] = s_box[st[10]]; st[10] = s_box[ tt ]; - tt = st[6]; st[ 6] = s_box[st[14]]; st[14] = s_box[ tt ]; - - tt = st[15]; st[15] = s_box[st[11]]; st[11] = s_box[st[ 7]]; - st[ 7] = s_box[st[ 3]]; st[ 3] = s_box[ tt ]; -} - -static void inv_shift_sub_rows( uint_8t st[N_BLOCK] ) -{ uint_8t tt; - - st[ 0] = inv_s_box[st[ 0]]; st[ 4] = inv_s_box[st[ 4]]; - st[ 8] = inv_s_box[st[ 8]]; st[12] = inv_s_box[st[12]]; - - tt = st[13]; st[13] = inv_s_box[st[9]]; st[ 9] = inv_s_box[st[5]]; - st[ 5] = inv_s_box[st[1]]; st[ 1] = inv_s_box[ tt ]; - - tt = st[2]; st[ 2] = inv_s_box[st[10]]; st[10] = inv_s_box[ tt ]; - tt = st[6]; st[ 6] = inv_s_box[st[14]]; st[14] = inv_s_box[ tt ]; - - tt = st[3]; st[ 3] = inv_s_box[st[ 7]]; st[ 7] = inv_s_box[st[11]]; - st[11] = inv_s_box[st[15]]; st[15] = inv_s_box[ tt ]; -} - -#if defined( VERSION_1 ) - static void mix_sub_columns( uint_8t dt[N_BLOCK] ) - { uint_8t st[N_BLOCK]; - block16_copy(st, dt); -#else - static void mix_sub_columns( uint_8t dt[N_BLOCK], uint_8t st[N_BLOCK] ) - { -#endif - dt[ 0] = gfm2_s_box[st[0]] ^ gfm3_s_box[st[5]] ^ s_box[st[10]] ^ s_box[st[15]]; - dt[ 1] = s_box[st[0]] ^ gfm2_s_box[st[5]] ^ gfm3_s_box[st[10]] ^ s_box[st[15]]; - dt[ 2] = s_box[st[0]] ^ s_box[st[5]] ^ gfm2_s_box[st[10]] ^ gfm3_s_box[st[15]]; - dt[ 3] = gfm3_s_box[st[0]] ^ s_box[st[5]] ^ s_box[st[10]] ^ gfm2_s_box[st[15]]; - - dt[ 4] = gfm2_s_box[st[4]] ^ gfm3_s_box[st[9]] ^ s_box[st[14]] ^ s_box[st[3]]; - dt[ 5] = s_box[st[4]] ^ gfm2_s_box[st[9]] ^ gfm3_s_box[st[14]] ^ s_box[st[3]]; - dt[ 6] = s_box[st[4]] ^ s_box[st[9]] ^ gfm2_s_box[st[14]] ^ gfm3_s_box[st[3]]; - dt[ 7] = gfm3_s_box[st[4]] ^ s_box[st[9]] ^ s_box[st[14]] ^ gfm2_s_box[st[3]]; - - dt[ 8] = gfm2_s_box[st[8]] ^ gfm3_s_box[st[13]] ^ s_box[st[2]] ^ s_box[st[7]]; - dt[ 9] = s_box[st[8]] ^ gfm2_s_box[st[13]] ^ gfm3_s_box[st[2]] ^ s_box[st[7]]; - dt[10] = s_box[st[8]] ^ s_box[st[13]] ^ gfm2_s_box[st[2]] ^ gfm3_s_box[st[7]]; - dt[11] = gfm3_s_box[st[8]] ^ s_box[st[13]] ^ s_box[st[2]] ^ gfm2_s_box[st[7]]; - - dt[12] = gfm2_s_box[st[12]] ^ gfm3_s_box[st[1]] ^ s_box[st[6]] ^ s_box[st[11]]; - dt[13] = s_box[st[12]] ^ gfm2_s_box[st[1]] ^ gfm3_s_box[st[6]] ^ s_box[st[11]]; - dt[14] = s_box[st[12]] ^ s_box[st[1]] ^ gfm2_s_box[st[6]] ^ gfm3_s_box[st[11]]; - dt[15] = gfm3_s_box[st[12]] ^ s_box[st[1]] ^ s_box[st[6]] ^ gfm2_s_box[st[11]]; - } - -#if defined( VERSION_1 ) - static void inv_mix_sub_columns( uint_8t dt[N_BLOCK] ) - { uint_8t st[N_BLOCK]; - block16_copy(st, dt); -#else - static void inv_mix_sub_columns( uint_8t dt[N_BLOCK], uint_8t st[N_BLOCK] ) - { -#endif - dt[ 0] = inv_s_box[gfmul_e[st[ 0]] ^ gfmul_b[st[ 1]] ^ gfmul_d[st[ 2]] ^ gfmul_9[st[ 3]]]; - dt[ 5] = inv_s_box[gfmul_9[st[ 0]] ^ gfmul_e[st[ 1]] ^ gfmul_b[st[ 2]] ^ gfmul_d[st[ 3]]]; - dt[10] = inv_s_box[gfmul_d[st[ 0]] ^ gfmul_9[st[ 1]] ^ gfmul_e[st[ 2]] ^ gfmul_b[st[ 3]]]; - dt[15] = inv_s_box[gfmul_b[st[ 0]] ^ gfmul_d[st[ 1]] ^ gfmul_9[st[ 2]] ^ gfmul_e[st[ 3]]]; - - dt[ 4] = inv_s_box[gfmul_e[st[ 4]] ^ gfmul_b[st[ 5]] ^ gfmul_d[st[ 6]] ^ gfmul_9[st[ 7]]]; - dt[ 9] = inv_s_box[gfmul_9[st[ 4]] ^ gfmul_e[st[ 5]] ^ gfmul_b[st[ 6]] ^ gfmul_d[st[ 7]]]; - dt[14] = inv_s_box[gfmul_d[st[ 4]] ^ gfmul_9[st[ 5]] ^ gfmul_e[st[ 6]] ^ gfmul_b[st[ 7]]]; - dt[ 3] = inv_s_box[gfmul_b[st[ 4]] ^ gfmul_d[st[ 5]] ^ gfmul_9[st[ 6]] ^ gfmul_e[st[ 7]]]; - - dt[ 8] = inv_s_box[gfmul_e[st[ 8]] ^ gfmul_b[st[ 9]] ^ gfmul_d[st[10]] ^ gfmul_9[st[11]]]; - dt[13] = inv_s_box[gfmul_9[st[ 8]] ^ gfmul_e[st[ 9]] ^ gfmul_b[st[10]] ^ gfmul_d[st[11]]]; - dt[ 2] = inv_s_box[gfmul_d[st[ 8]] ^ gfmul_9[st[ 9]] ^ gfmul_e[st[10]] ^ gfmul_b[st[11]]]; - dt[ 7] = inv_s_box[gfmul_b[st[ 8]] ^ gfmul_d[st[ 9]] ^ gfmul_9[st[10]] ^ gfmul_e[st[11]]]; - - dt[12] = inv_s_box[gfmul_e[st[12]] ^ gfmul_b[st[13]] ^ gfmul_d[st[14]] ^ gfmul_9[st[15]]]; - dt[ 1] = inv_s_box[gfmul_9[st[12]] ^ gfmul_e[st[13]] ^ gfmul_b[st[14]] ^ gfmul_d[st[15]]]; - dt[ 6] = inv_s_box[gfmul_d[st[12]] ^ gfmul_9[st[13]] ^ gfmul_e[st[14]] ^ gfmul_b[st[15]]]; - dt[11] = inv_s_box[gfmul_b[st[12]] ^ gfmul_d[st[13]] ^ gfmul_9[st[14]] ^ gfmul_e[st[15]]]; - } - -#if defined( AES_ENC_PREKEYED ) || defined( AES_DEC_PREKEYED ) - -/* Set the cipher key for the pre-keyed version */ - -return_type aes_set_key( const unsigned char key[], length_type keylen, aes_context ctx[1] ) -{ - uint_8t cc, rc, hi; - - switch( keylen ) - { - case 16: - case 128: - keylen = 16; - break; - case 24: - case 192: - keylen = 24; - break; - case 32: - keylen = 32; - break; - default: - ctx->rnd = 0; - return -1; - } - block_copy(ctx->ksch, key, keylen); - hi = (keylen + 28) << 2; - ctx->rnd = (hi >> 4) - 1; - for( cc = keylen, rc = 1; cc < hi; cc += 4 ) - { uint_8t tt, t0, t1, t2, t3; - - t0 = ctx->ksch[cc - 4]; - t1 = ctx->ksch[cc - 3]; - t2 = ctx->ksch[cc - 2]; - t3 = ctx->ksch[cc - 1]; - if( cc % keylen == 0 ) - { - tt = t0; - t0 = s_box[t1] ^ rc; - t1 = s_box[t2]; - t2 = s_box[t3]; - t3 = s_box[tt]; - rc = f2(rc); - } - else if( keylen > 24 && cc % keylen == 16 ) - { - t0 = s_box[t0]; - t1 = s_box[t1]; - t2 = s_box[t2]; - t3 = s_box[t3]; - } - tt = cc - keylen; - ctx->ksch[cc + 0] = ctx->ksch[tt + 0] ^ t0; - ctx->ksch[cc + 1] = ctx->ksch[tt + 1] ^ t1; - ctx->ksch[cc + 2] = ctx->ksch[tt + 2] ^ t2; - ctx->ksch[cc + 3] = ctx->ksch[tt + 3] ^ t3; - } - return 0; -} - -#endif - -#if defined( AES_ENC_PREKEYED ) - -/* Encrypt a single block of 16 bytes */ - -return_type aes_encrypt( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], const aes_context ctx[1] ) -{ - if( ctx->rnd ) - { - uint_8t s1[N_BLOCK], r; - copy_and_key( s1, in, ctx->ksch ); - - for( r = 1 ; r < ctx->rnd ; ++r ) -#if defined( VERSION_1 ) - { - mix_sub_columns( s1 ); - add_round_key( s1, ctx->ksch + r * N_BLOCK); - } -#else - { uint_8t s2[N_BLOCK]; - mix_sub_columns( s2, s1 ); - copy_and_key( s1, s2, ctx->ksch + r * N_BLOCK); - } -#endif - shift_sub_rows( s1 ); - copy_and_key( out, s1, ctx->ksch + r * N_BLOCK ); - } - else - return -1; - return 0; -} - -#endif - -#if defined( AES_DEC_PREKEYED ) - -/* Decrypt a single block of 16 bytes */ - -return_type aes_decrypt( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], const aes_context ctx[1] ) -{ - if( ctx->rnd ) - { - uint_8t s1[N_BLOCK], r; - copy_and_key( s1, in, ctx->ksch + ctx->rnd * N_BLOCK ); - inv_shift_sub_rows( s1 ); - - for( r = ctx->rnd ; --r ; ) -#if defined( VERSION_1 ) - { - add_round_key( s1, ctx->ksch + r * N_BLOCK ); - inv_mix_sub_columns( s1 ); - } -#else - { uint_8t s2[N_BLOCK]; - copy_and_key( s2, s1, ctx->ksch + r * N_BLOCK ); - inv_mix_sub_columns( s1, s2 ); - } -#endif - copy_and_key( out, s1, ctx->ksch ); - } - else - return -1; - return 0; -} - -#endif - -#if defined( AES_ENC_128_OTFK ) - -/* The 'on the fly' encryption key update for for 128 bit keys */ - -static void update_encrypt_key_128( uint_8t k[N_BLOCK], uint_8t *rc ) -{ uint_8t cc; - - k[0] ^= s_box[k[13]] ^ *rc; - k[1] ^= s_box[k[14]]; - k[2] ^= s_box[k[15]]; - k[3] ^= s_box[k[12]]; - *rc = f2( *rc ); - - for(cc = 4; cc < 16; cc += 4 ) - { - k[cc + 0] ^= k[cc - 4]; - k[cc + 1] ^= k[cc - 3]; - k[cc + 2] ^= k[cc - 2]; - k[cc + 3] ^= k[cc - 1]; - } -} - -/* Encrypt a single block of 16 bytes with 'on the fly' 128 bit keying */ - -void aes_encrypt_128( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], - const unsigned char key[N_BLOCK], unsigned char o_key[N_BLOCK] ) -{ uint_8t s1[N_BLOCK], r, rc = 1; - - if(o_key != key) - block16_copy( o_key, key ); - copy_and_key( s1, in, o_key ); - - for( r = 1 ; r < 10 ; ++r ) -#if defined( VERSION_1 ) - { - mix_sub_columns( s1 ); - update_encrypt_key_128( o_key, &rc ); - add_round_key( s1, o_key ); - } -#else - { uint_8t s2[N_BLOCK]; - mix_sub_columns( s2, s1 ); - update_encrypt_key_128( o_key, &rc ); - copy_and_key( s1, s2, o_key ); - } -#endif - - shift_sub_rows( s1 ); - update_encrypt_key_128( o_key, &rc ); - copy_and_key( out, s1, o_key ); -} - -#endif - -#if defined( AES_DEC_128_OTFK ) - -/* The 'on the fly' decryption key update for for 128 bit keys */ - -static void update_decrypt_key_128( uint_8t k[N_BLOCK], uint_8t *rc ) -{ uint_8t cc; - - for( cc = 12; cc > 0; cc -= 4 ) - { - k[cc + 0] ^= k[cc - 4]; - k[cc + 1] ^= k[cc - 3]; - k[cc + 2] ^= k[cc - 2]; - k[cc + 3] ^= k[cc - 1]; - } - *rc = d2(*rc); - k[0] ^= s_box[k[13]] ^ *rc; - k[1] ^= s_box[k[14]]; - k[2] ^= s_box[k[15]]; - k[3] ^= s_box[k[12]]; -} - -/* Decrypt a single block of 16 bytes with 'on the fly' 128 bit keying */ - -void aes_decrypt_128( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], - const unsigned char key[N_BLOCK], unsigned char o_key[N_BLOCK] ) -{ - uint_8t s1[N_BLOCK], r, rc = 0x6c; - if(o_key != key) - block16_copy( o_key, key ); - - copy_and_key( s1, in, o_key ); - inv_shift_sub_rows( s1 ); - - for( r = 10 ; --r ; ) -#if defined( VERSION_1 ) - { - update_decrypt_key_128( o_key, &rc ); - add_round_key( s1, o_key ); - inv_mix_sub_columns( s1 ); - } -#else - { uint_8t s2[N_BLOCK]; - update_decrypt_key_128( o_key, &rc ); - copy_and_key( s2, s1, o_key ); - inv_mix_sub_columns( s1, s2 ); - } -#endif - update_decrypt_key_128( o_key, &rc ); - copy_and_key( out, s1, o_key ); -} - -#endif - -#if defined( AES_ENC_256_OTFK ) - -/* The 'on the fly' encryption key update for for 256 bit keys */ - -static void update_encrypt_key_256( uint_8t k[2 * N_BLOCK], uint_8t *rc ) -{ uint_8t cc; - - k[0] ^= s_box[k[29]] ^ *rc; - k[1] ^= s_box[k[30]]; - k[2] ^= s_box[k[31]]; - k[3] ^= s_box[k[28]]; - *rc = f2( *rc ); - - for(cc = 4; cc < 16; cc += 4) - { - k[cc + 0] ^= k[cc - 4]; - k[cc + 1] ^= k[cc - 3]; - k[cc + 2] ^= k[cc - 2]; - k[cc + 3] ^= k[cc - 1]; - } - - k[16] ^= s_box[k[12]]; - k[17] ^= s_box[k[13]]; - k[18] ^= s_box[k[14]]; - k[19] ^= s_box[k[15]]; - - for( cc = 20; cc < 32; cc += 4 ) - { - k[cc + 0] ^= k[cc - 4]; - k[cc + 1] ^= k[cc - 3]; - k[cc + 2] ^= k[cc - 2]; - k[cc + 3] ^= k[cc - 1]; - } -} - -/* Encrypt a single block of 16 bytes with 'on the fly' 256 bit keying */ - -void aes_encrypt_256( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], - const unsigned char key[2 * N_BLOCK], unsigned char o_key[2 * N_BLOCK] ) -{ - uint_8t s1[N_BLOCK], r, rc = 1; - if(o_key != key) - { - block16_copy( o_key, key ); - block16_copy( o_key + 16, key + 16 ); - } - copy_and_key( s1, in, o_key ); - - for( r = 1 ; r < 14 ; ++r ) -#if defined( VERSION_1 ) - { - mix_sub_columns(s1); - if( r & 1 ) - add_round_key( s1, o_key + 16 ); - else - { - update_encrypt_key_256( o_key, &rc ); - add_round_key( s1, o_key ); - } - } -#else - { uint_8t s2[N_BLOCK]; - mix_sub_columns( s2, s1 ); - if( r & 1 ) - copy_and_key( s1, s2, o_key + 16 ); - else - { - update_encrypt_key_256( o_key, &rc ); - copy_and_key( s1, s2, o_key ); - } - } -#endif - - shift_sub_rows( s1 ); - update_encrypt_key_256( o_key, &rc ); - copy_and_key( out, s1, o_key ); -} - -#endif - -#if defined( AES_DEC_256_OTFK ) - -/* The 'on the fly' encryption key update for for 256 bit keys */ - -static void update_decrypt_key_256( uint_8t k[2 * N_BLOCK], uint_8t *rc ) -{ uint_8t cc; - - for(cc = 28; cc > 16; cc -= 4) - { - k[cc + 0] ^= k[cc - 4]; - k[cc + 1] ^= k[cc - 3]; - k[cc + 2] ^= k[cc - 2]; - k[cc + 3] ^= k[cc - 1]; - } - - k[16] ^= s_box[k[12]]; - k[17] ^= s_box[k[13]]; - k[18] ^= s_box[k[14]]; - k[19] ^= s_box[k[15]]; - - for(cc = 12; cc > 0; cc -= 4) - { - k[cc + 0] ^= k[cc - 4]; - k[cc + 1] ^= k[cc - 3]; - k[cc + 2] ^= k[cc - 2]; - k[cc + 3] ^= k[cc - 1]; - } - - *rc = d2(*rc); - k[0] ^= s_box[k[29]] ^ *rc; - k[1] ^= s_box[k[30]]; - k[2] ^= s_box[k[31]]; - k[3] ^= s_box[k[28]]; -} - -/* Decrypt a single block of 16 bytes with 'on the fly' - 256 bit keying -*/ -void aes_decrypt_256( const unsigned char in[N_BLOCK], unsigned char out[N_BLOCK], - const unsigned char key[2 * N_BLOCK], unsigned char o_key[2 * N_BLOCK] ) -{ - uint_8t s1[N_BLOCK], r, rc = 0x80; - - if(o_key != key) - { - block16_copy( o_key, key ); - block16_copy( o_key + 16, key + 16 ); - } - - copy_and_key( s1, in, o_key ); - inv_shift_sub_rows( s1 ); - - for( r = 14 ; --r ; ) -#if defined( VERSION_1 ) - { - if( ( r & 1 ) ) - { - update_decrypt_key_256( o_key, &rc ); - add_round_key( s1, o_key + 16 ); - } - else - add_round_key( s1, o_key ); - inv_mix_sub_columns( s1 ); - } -#else - { uint_8t s2[N_BLOCK]; - if( ( r & 1 ) ) - { - update_decrypt_key_256( o_key, &rc ); - copy_and_key( s2, s1, o_key + 16 ); - } - else - copy_and_key( s2, s1, o_key ); - inv_mix_sub_columns( s1, s2 ); - } -#endif - copy_and_key( out, s1, o_key ); -} - -#endif diff --git a/src/utils/crypto/aessmall.h b/src/utils/crypto/aessmall.h deleted file mode 100644 index ebeb24efd0f..00000000000 --- a/src/utils/crypto/aessmall.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2006, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software in both source and binary - form is allowed (with or without changes) provided that: - - 1. distributions of this source code include the above copyright - notice, this list of conditions and the following disclaimer; - - 2. distributions in binary form include the above copyright - notice, this list of conditions and the following disclaimer - in the documentation and/or other associated materials; - - 3. the copyright holder's name is not used to endorse products - built using this software without specific written permission. - - ALTERNATIVELY, provided that this notice is retained in full, this product - may be distributed under the terms of the GNU General Public License (GPL), - in which case the provisions of the GPL apply INSTEAD OF those given above. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue 09/09/2006 - - This is an AES implementation that uses only 8-bit byte operations on the - cipher state. - */ - -#ifndef AES_H -#define AES_H - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* This provides speed optimisation opportunities if 32-bit word - operations are available -*/ -#if 1 -# define HAVE_UINT_32T -#endif - -#if 1 -# define AES_ENC_PREKEYED /* AES encryption with a precomputed key schedule */ -#endif -#if 1 -# define AES_DEC_PREKEYED /* AES decryption with a precomputed key schedule */ -#endif -#if 0 -# define AES_ENC_128_OTFK /* AES encryption with 'on the fly' 128 bit keying */ -#endif -#if 0 -# define AES_DEC_128_OTFK /* AES decryption with 'on the fly' 128 bit keying */ -#endif -#if 0 -# define AES_ENC_256_OTFK /* AES encryption with 'on the fly' 256 bit keying */ -#endif -#if 0 -# define AES_DEC_256_OTFK /* AES decryption with 'on the fly' 256 bit keying */ -#endif - -#define N_ROW 4 -#define N_COL 4 -#define N_BLOCK (N_ROW * N_COL) -#define N_MAX_ROUNDS 14 - -typedef unsigned char uint_8t; - -typedef uint_8t return_type; -typedef uint_8t length_type; -typedef uint_8t uint_type; - -typedef unsigned char uint_8t; - -typedef struct -{ uint_8t ksch[(N_MAX_ROUNDS + 1) * N_BLOCK]; - uint_8t rnd; -} aes_context; - -/* The following calls are for a precomputed key schedule - - NOTE: If the length_type used for the key length is an - unsigned 8-bit character, a key length of 256 bits must - be entered as a length in bytes (valid inputs are hence - 128, 192, 16, 24 and 32). -*/ - -#if defined( AES_ENC_PREKEYED ) || defined( AES_DEC_PREKEYED ) - -return_type aes_set_key( const unsigned char key[], - length_type keylen, - aes_context ctx[1] ); -#endif - -#if defined( AES_ENC_PREKEYED ) - -return_type aes_encrypt( const unsigned char in[N_BLOCK], - unsigned char out[N_BLOCK], - const aes_context ctx[1] ); -#endif - -#if defined( AES_DEC_PREKEYED ) - -return_type aes_decrypt( const unsigned char in[N_BLOCK], - unsigned char out[N_BLOCK], - const aes_context ctx[1] ); -#endif - -/* The following calls are for 'on the fly' keying. In this case the - encryption and decryption keys are different. - - The encryption subroutines take a key in an array of bytes in - key[L] where L is 16, 24 or 32 bytes for key lengths of 128, - 192, and 256 bits respectively. They then encrypts the input - data, in[] with this key and put the reult in the output array - out[]. In addition, the second key array, o_key[L], is used - to output the key that is needed by the decryption subroutine - to reverse the encryption operation. The two key arrays can - be the same array but in this case the original key will be - overwritten. - - In the same way, the decryption subroutines output keys that - can be used to reverse their effect when used for encryption. - - Only 128 and 256 bit keys are supported in these 'on the fly' - modes. -*/ - -#if defined( AES_ENC_128_OTFK ) -void aes_encrypt_128( const unsigned char in[N_BLOCK], - unsigned char out[N_BLOCK], - const unsigned char key[N_BLOCK], - uint_8t o_key[N_BLOCK] ); -#endif - -#if defined( AES_DEC_128_OTFK ) -void aes_decrypt_128( const unsigned char in[N_BLOCK], - unsigned char out[N_BLOCK], - const unsigned char key[N_BLOCK], - unsigned char o_key[N_BLOCK] ); -#endif - -#if defined( AES_ENC_256_OTFK ) -void aes_encrypt_256( const unsigned char in[N_BLOCK], - unsigned char out[N_BLOCK], - const unsigned char key[2 * N_BLOCK], - unsigned char o_key[2 * N_BLOCK] ); -#endif - -#if defined( AES_DEC_256_OTFK ) -void aes_decrypt_256( const unsigned char in[N_BLOCK], - unsigned char out[N_BLOCK], - const unsigned char key[2 * N_BLOCK], - unsigned char o_key[2 * N_BLOCK] ); -#endif - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/src/utils/crypto/aessmall_x86.asm b/src/utils/crypto/aessmall_x86.asm deleted file mode 100644 index 9356a65c05a..00000000000 --- a/src/utils/crypto/aessmall_x86.asm +++ /dev/null @@ -1,1444 +0,0 @@ - -; --------------------------------------------------------------------------- -; Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. -; -; LICENSE TERMS -; -; The free distribution and use of this software is allowed (with or without -; changes) provided that: -; -; 1. source code distributions include the above copyright notice, this -; list of conditions and the following disclaimer; -; -; 2. binary distributions include the above copyright notice, this list -; of conditions and the following disclaimer in their documentation; -; -; 3. the name of the copyright holder is not used to endorse products -; built using this software without specific written permission. -; -; DISCLAIMER -; -; This software is provided 'as is' with no explicit or implied warranties -; in respect of its properties, including, but not limited to, correctness -; and/or fitness for purpose. -; --------------------------------------------------------------------------- -; Issue 20/12/2007 -; -; This code requires either ASM_X86_V2 or ASM_X86_V2C to be set in aesopt.h -; and the same define to be set here as well. If AES_V2C is set this file -; requires the C files aeskey.c and aestab.c for support. - -; An AES implementation for x86 processors using the YASM (or NASM) assembler. -; This is a full assembler implementation covering encryption, decryption and -; key scheduling. It uses 2k bytes of tables but its encryption and decryption -; performance is very close to that obtained using large tables. Key schedule -; expansion is slower for both encryption and decryption but this is likely to -; be offset by the much smaller load that this version places on the processor -; cache. I acknowledge the contribution made by Daniel Bernstein to aspects of -; the design of the AES round function used here. -; -; This code provides the standard AES block size (128 bits, 16 bytes) and the -; three standard AES key sizes (128, 192 and 256 bits). It has the same call -; interface as my C implementation. The ebx, esi, edi and ebp registers are -; preserved across calls but eax, ecx and edx and the artihmetic status flags -; are not. Although this is a full assembler implementation, it can be used -; in conjunction with my C code which provides faster key scheduling using -; large tables. In this case aeskey.c should be compiled with ASM_X86_V2C -; defined. It is also important that the defines below match those used in the -; C code. This code uses the VC++ register saving conentions; if it is used -; with another compiler, conventions for using and saving registers may need -; to be checked (and calling conventions). The YASM command line for the VC++ -; custom build step is: -; -; yasm -Xvc -f win32 -D -o "$(TargetDir)\$(InputName).obj" "$(InputPath)" -; -; For the cryptlib build this is (pcg): -; -; yasm -Xvc -f win32 -D ASM_X86_V2C -o aescrypt2.obj aes_x86_v2.asm -; -; where is ASM_X86_V2 or ASM_X86_V2C. The calling intefaces are: -; -; AES_RETURN aes_encrypt(const unsigned char in_blk[], -; unsigned char out_blk[], const aes_encrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt(const unsigned char in_blk[], -; unsigned char out_blk[], const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_encrypt_key(const unsigned char key[], -; const aes_encrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt_key(const unsigned char key[], -; const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_encrypt_key(const unsigned char key[], -; unsigned int len, const aes_decrypt_ctx cx[1]); -; -; AES_RETURN aes_decrypt_key(const unsigned char key[], -; unsigned int len, const aes_decrypt_ctx cx[1]); -; -; where is 128, 102 or 256. In the last two calls the length can be in -; either bits or bytes. - -; The DLL interface must use the _stdcall convention in which the number -; of bytes of parameter space is added after an @ to the sutine's name. -; We must also remove our parameters from the stack before return (see -; the do_exit macro). Define DLL_EXPORT for the Dynamic Link Library version. - -; -; Adapted for TrueCrypt by the TrueCrypt Foundation: -; - All tables generated at run-time -; - Adapted for 16-bit environment -; - -CPU 386 -USE16 -SEGMENT _TEXT PUBLIC CLASS=CODE USE16 -SEGMENT _DATA PUBLIC CLASS=DATA USE16 - -GROUP DGROUP _TEXT _DATA - -extern _aes_dec_tab ; Aestab.c -extern _aes_enc_tab - -; %define DLL_EXPORT - -; The size of the code can be reduced by using functions for the encryption -; and decryption rounds in place of macro expansion - -%define REDUCE_CODE_SIZE - -; Comment in/out the following lines to obtain the desired subroutines. These -; selections MUST match those in the C header file aes.h - -; %define AES_128 ; define if AES with 128 bit keys is needed -; %define AES_192 ; define if AES with 192 bit keys is needed -%define AES_256 ; define if AES with 256 bit keys is needed -; %define AES_VAR ; define if a variable key size is needed -%define ENCRYPTION ; define if encryption is needed -%define DECRYPTION ; define if decryption is needed -; %define AES_REV_DKS ; define if key decryption schedule is reversed - -%ifndef ASM_X86_V2C -%define ENCRYPTION_KEY_SCHEDULE ; define if encryption key expansion is needed -%define DECRYPTION_KEY_SCHEDULE ; define if decryption key expansion is needed -%endif - -; The encryption key schedule has the following in memory layout where N is the -; number of rounds (10, 12 or 14): -; -; lo: | input key (round 0) | ; each round is four 32-bit words -; | encryption round 1 | -; | encryption round 2 | -; .... -; | encryption round N-1 | -; hi: | encryption round N | -; -; The decryption key schedule is normally set up so that it has the same -; layout as above by actually reversing the order of the encryption key -; schedule in memory (this happens when AES_REV_DKS is set): -; -; lo: | decryption round 0 | = | encryption round N | -; | decryption round 1 | = INV_MIX_COL[ | encryption round N-1 | ] -; | decryption round 2 | = INV_MIX_COL[ | encryption round N-2 | ] -; .... .... -; | decryption round N-1 | = INV_MIX_COL[ | encryption round 1 | ] -; hi: | decryption round N | = | input key (round 0) | -; -; with rounds except the first and last modified using inv_mix_column() -; But if AES_REV_DKS is NOT set the order of keys is left as it is for -; encryption so that it has to be accessed in reverse when used for -; decryption (although the inverse mix column modifications are done) -; -; lo: | decryption round 0 | = | input key (round 0) | -; | decryption round 1 | = INV_MIX_COL[ | encryption round 1 | ] -; | decryption round 2 | = INV_MIX_COL[ | encryption round 2 | ] -; .... .... -; | decryption round N-1 | = INV_MIX_COL[ | encryption round N-1 | ] -; hi: | decryption round N | = | encryption round N | -; -; This layout is faster when the assembler key scheduling provided here -; is used. -; -; End of user defines - -%ifdef AES_VAR -%ifndef AES_128 -%define AES_128 -%endif -%ifndef AES_192 -%define AES_192 -%endif -%ifndef AES_256 -%define AES_256 -%endif -%endif - -%ifdef AES_VAR -%define KS_LENGTH 60 -%elifdef AES_256 -%define KS_LENGTH 60 -%elifdef AES_192 -%define KS_LENGTH 52 -%else -%define KS_LENGTH 44 -%endif - -; These macros implement stack based local variables - -%macro save 2 - mov [esp+4*%1],%2 -%endmacro - -%macro restore 2 - mov %1,[esp+4*%2] -%endmacro - -%ifdef REDUCE_CODE_SIZE - %macro mf_call 1 - call %1 - %endmacro -%else - %macro mf_call 1 - %1 - %endmacro -%endif - -; the DLL has to implement the _stdcall calling interface on return -; In this case we have to take our parameters (3 4-byte pointers) -; off the stack - -%define parms 12 - -%macro do_name 1-2 parms -%ifndef DLL_EXPORT - global %1 -%1: -%else - global %1@%2 - export %1@%2 -%1@%2: -%endif -%endmacro - -%macro do_call 1-2 parms -%ifndef DLL_EXPORT - call %1 - add esp,%2 -%else - call %1@%2 -%endif -%endmacro - -%macro do_exit 0-1 parms -%ifdef DLL_EXPORT - ret %1 -%else - ret -%endif -%endmacro - -; finite field multiplies by {02}, {04} and {08} - -%define f2(x) ((x<<1)^(((x>>7)&1)*0x11b)) -%define f4(x) ((x<<2)^(((x>>6)&1)*0x11b)^(((x>>6)&2)*0x11b)) -%define f8(x) ((x<<3)^(((x>>5)&1)*0x11b)^(((x>>5)&2)*0x11b)^(((x>>5)&4)*0x11b)) - -; finite field multiplies required in table generation - -%define f3(x) (f2(x) ^ x) -%define f9(x) (f8(x) ^ x) -%define fb(x) (f8(x) ^ f2(x) ^ x) -%define fd(x) (f8(x) ^ f4(x) ^ x) -%define fe(x) (f8(x) ^ f4(x) ^ f2(x)) - -%define etab_0(x) [_aes_enc_tab+4+8*x] -%define etab_1(x) [_aes_enc_tab+3+8*x] -%define etab_2(x) [_aes_enc_tab+2+8*x] -%define etab_3(x) [_aes_enc_tab+1+8*x] -%define etab_b(x) byte [_aes_enc_tab+1+8*x] ; used with movzx for 0x000000xx -%define etab_w(x) word [_aes_enc_tab+8*x] ; used with movzx for 0x0000xx00 - -%define btab_0(x) [_aes_enc_tab+6+8*x] -%define btab_1(x) [_aes_enc_tab+5+8*x] -%define btab_2(x) [_aes_enc_tab+4+8*x] -%define btab_3(x) [_aes_enc_tab+3+8*x] - -; ROUND FUNCTION. Build column[2] on ESI and column[3] on EDI that have the -; round keys pre-loaded. Build column[0] in EBP and column[1] in EBX. -; -; Input: -; -; EAX column[0] -; EBX column[1] -; ECX column[2] -; EDX column[3] -; ESI column key[round][2] -; EDI column key[round][3] -; EBP scratch -; -; Output: -; -; EBP column[0] unkeyed -; EBX column[1] unkeyed -; ESI column[2] keyed -; EDI column[3] keyed -; EAX scratch -; ECX scratch -; EDX scratch - -%macro rnd_fun 2 - - rol ebx,16 - %1 esi, cl, 0, ebp - %1 esi, dh, 1, ebp - %1 esi, bh, 3, ebp - %1 edi, dl, 0, ebp - %1 edi, ah, 1, ebp - %1 edi, bl, 2, ebp - %2 ebp, al, 0, ebp - shr ebx,16 - and eax,0xffff0000 - or eax,ebx - shr edx,16 - %1 ebp, ah, 1, ebx - %1 ebp, dh, 3, ebx - %2 ebx, dl, 2, ebx - %1 ebx, ch, 1, edx - %1 ebx, al, 0, edx - shr eax,16 - shr ecx,16 - %1 ebp, cl, 2, edx - %1 edi, ch, 3, edx - %1 esi, al, 2, edx - %1 ebx, ah, 3, edx - -%endmacro - -; Basic MOV and XOR Operations for normal rounds - -%macro nr_xor 4 - movzx %4,%2 - xor %1,etab_%3(%4) -%endmacro - -%macro nr_mov 4 - movzx %4,%2 - mov %1,etab_%3(%4) -%endmacro - -; Basic MOV and XOR Operations for last round - -%if 1 - - %macro lr_xor 4 - movzx %4,%2 - movzx %4,etab_b(%4) - %if %3 != 0 - shl %4,8*%3 - %endif - xor %1,%4 - %endmacro - - %macro lr_mov 4 - movzx %4,%2 - movzx %1,etab_b(%4) - %if %3 != 0 - shl %1,8*%3 - %endif - %endmacro - -%else ; less effective but worth leaving as an option - - %macro lr_xor 4 - movzx %4,%2 - mov %4,btab_%3(%4) - and %4,0x000000ff << 8 * %3 - xor %1,%4 - %endmacro - - %macro lr_mov 4 - movzx %4,%2 - mov %1,btab_%3(%4) - and %1,0x000000ff << 8 * %3 - %endmacro - -%endif - -; Apply S-Box to the 4 bytes in a 32-bit word and rotate byte positions - -%ifdef REDUCE_CODE_SIZE - -l3s_col: - movzx ecx,al ; in eax - movzx ecx, etab_b(ecx) ; out eax - xor edx,ecx ; scratch ecx,edx - movzx ecx,ah - movzx ecx, etab_b(ecx) - shl ecx,8 - xor edx,ecx - shr eax,16 - movzx ecx,al - movzx ecx, etab_b(ecx) - shl ecx,16 - xor edx,ecx - movzx ecx,ah - movzx ecx, etab_b(ecx) - shl ecx,24 - xor edx,ecx - mov eax,edx - ret - -%else - -%macro l3s_col 0 - - movzx ecx,al ; in eax - movzx ecx, etab_b(ecx) ; out eax - xor edx,ecx ; scratch ecx,edx - movzx ecx,ah - movzx ecx, etab_b(ecx) - shl ecx,8 - xor edx,ecx - shr eax,16 - movzx ecx,al - movzx ecx, etab_b(ecx) - shl ecx,16 - xor edx,ecx - movzx ecx,ah - movzx ecx, etab_b(ecx) - shl ecx,24 - xor edx,ecx - mov eax,edx - -%endmacro - -%endif - -; offsets to parameters - -in_blk equ 2 ; input byte array address parameter -out_blk equ 4 ; output byte array address parameter -ctx equ 6 ; AES context structure -stk_spc equ 20 ; stack space - -%ifdef ENCRYPTION - -; %define ENCRYPTION_TABLE - -%ifdef REDUCE_CODE_SIZE - -enc_round: - sub sp, 2 - add ebp,16 - save 1,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - rnd_fun nr_xor, nr_mov - - mov eax,ebp - mov ecx,esi - mov edx,edi - restore ebp,1 - xor eax,[ebp] - xor ebx,[ebp+4] - add sp, 2 - ret - -%else - -%macro enc_round 0 - - add ebp,16 - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - rnd_fun nr_xor, nr_mov - - mov eax,ebp - mov ecx,esi - mov edx,edi - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - -%endif - -%macro enc_last_round 0 - - add ebp,16 - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - rnd_fun lr_xor, lr_mov - - mov eax,ebp - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - - section _TEXT - -; AES Encryption Subroutine - - do_name _aes_encrypt,12 - - mov ax, sp - movzx esp, ax - - sub esp,stk_spc - mov [esp+16],ebp - mov [esp+12],ebx - mov [esp+ 8],esi - mov [esp+ 4],edi - - movzx esi,word [esp+in_blk+stk_spc] ; input pointer - mov eax,[esi ] - mov ebx,[esi+ 4] - mov ecx,[esi+ 8] - mov edx,[esi+12] - - movzx ebp,word [esp+ctx+stk_spc] ; key pointer - movzx edi,byte [ebp+4*KS_LENGTH] - xor eax,[ebp ] - xor ebx,[ebp+ 4] - xor ecx,[ebp+ 8] - xor edx,[ebp+12] - -; determine the number of rounds - -%ifndef AES_256 - cmp edi,10*16 - je .3 - cmp edi,12*16 - je .2 - cmp edi,14*16 - je .1 - mov eax,-1 - jmp .5 -%endif - -.1: mf_call enc_round - mf_call enc_round -.2: mf_call enc_round - mf_call enc_round -.3: mf_call enc_round - mf_call enc_round - mf_call enc_round - mf_call enc_round - mf_call enc_round - mf_call enc_round - mf_call enc_round - mf_call enc_round - mf_call enc_round - enc_last_round - - movzx edx,word [esp+out_blk+stk_spc] - mov [edx],eax - mov [edx+4],ebx - mov [edx+8],esi - mov [edx+12],edi - xor eax,eax - -.5: mov ebp,[esp+16] - mov ebx,[esp+12] - mov esi,[esp+ 8] - mov edi,[esp+ 4] - add esp,stk_spc - do_exit 12 - -%endif - -%macro f_key 2 - - push ecx - push edx - mov edx,esi - ror eax,8 - mf_call l3s_col - mov esi,eax - pop edx - pop ecx - xor esi,rc_val - - mov [ebp+%1*%2],esi - xor edi,esi - mov [ebp+%1*%2+4],edi - xor ecx,edi - mov [ebp+%1*%2+8],ecx - xor edx,ecx - mov [ebp+%1*%2+12],edx - mov eax,edx - -%if %2 == 24 - -%if %1 < 7 - xor eax,[ebp+%1*%2+16-%2] - mov [ebp+%1*%2+16],eax - xor eax,[ebp+%1*%2+20-%2] - mov [ebp+%1*%2+20],eax -%endif - -%elif %2 == 32 - -%if %1 < 6 - push ecx - push edx - mov edx,[ebp+%1*%2+16-%2] - mf_call l3s_col - pop edx - pop ecx - mov [ebp+%1*%2+16],eax - xor eax,[ebp+%1*%2+20-%2] - mov [ebp+%1*%2+20],eax - xor eax,[ebp+%1*%2+24-%2] - mov [ebp+%1*%2+24],eax - xor eax,[ebp+%1*%2+28-%2] - mov [ebp+%1*%2+28],eax -%endif - -%endif - -%assign rc_val f2(rc_val) - -%endmacro - -%ifdef ENCRYPTION_KEY_SCHEDULE - -%ifdef AES_128 - -%ifndef ENCRYPTION_TABLE -; %define ENCRYPTION_TABLE -%endif - -%assign rc_val 1 - - do_name _aes_encrypt_key128,8 - - push ebp - push ebx - push esi - push edi - - mov ebp,[esp+24] - mov [ebp+4*KS_LENGTH],dword 10*16 - mov ebx,[esp+20] - - mov esi,[ebx] - mov [ebp],esi - mov edi,[ebx+4] - mov [ebp+4],edi - mov ecx,[ebx+8] - mov [ebp+8],ecx - mov edx,[ebx+12] - mov [ebp+12],edx - add ebp,16 - mov eax,edx - - f_key 0,16 ; 11 * 4 = 44 unsigned longs - f_key 1,16 ; 4 + 4 * 10 generated = 44 - f_key 2,16 - f_key 3,16 - f_key 4,16 - f_key 5,16 - f_key 6,16 - f_key 7,16 - f_key 8,16 - f_key 9,16 - - pop edi - pop esi - pop ebx - pop ebp - xor eax,eax - do_exit 8 - -%endif - -%ifdef AES_192 - -%ifndef ENCRYPTION_TABLE -; %define ENCRYPTION_TABLE -%endif - -%assign rc_val 1 - - do_name _aes_encrypt_key192,8 - - push ebp - push ebx - push esi - push edi - - mov ebp,[esp+24] - mov [ebp+4*KS_LENGTH],dword 12 * 16 - mov ebx,[esp+20] - - mov esi,[ebx] - mov [ebp],esi - mov edi,[ebx+4] - mov [ebp+4],edi - mov ecx,[ebx+8] - mov [ebp+8],ecx - mov edx,[ebx+12] - mov [ebp+12],edx - mov eax,[ebx+16] - mov [ebp+16],eax - mov eax,[ebx+20] - mov [ebp+20],eax - add ebp,24 - - f_key 0,24 ; 13 * 4 = 52 unsigned longs - f_key 1,24 ; 6 + 6 * 8 generated = 54 - f_key 2,24 - f_key 3,24 - f_key 4,24 - f_key 5,24 - f_key 6,24 - f_key 7,24 - - pop edi - pop esi - pop ebx - pop ebp - xor eax,eax - do_exit 8 - -%endif - -%ifdef AES_256 - -%ifndef ENCRYPTION_TABLE -; %define ENCRYPTION_TABLE -%endif - -%assign rc_val 1 - - do_name _aes_encrypt_key256,8 - - mov ax, sp - movzx esp, ax - - push ebp - push ebx - push esi - push edi - - movzx ebp, word [esp+20] ; ks - mov [ebp+4*KS_LENGTH],dword 14 * 16 - movzx ebx, word [esp+18] ; key - - mov esi,[ebx] - mov [ebp],esi - mov edi,[ebx+4] - mov [ebp+4],edi - mov ecx,[ebx+8] - mov [ebp+8],ecx - mov edx,[ebx+12] - mov [ebp+12],edx - mov eax,[ebx+16] - mov [ebp+16],eax - mov eax,[ebx+20] - mov [ebp+20],eax - mov eax,[ebx+24] - mov [ebp+24],eax - mov eax,[ebx+28] - mov [ebp+28],eax - add ebp,32 - - f_key 0,32 ; 15 * 4 = 60 unsigned longs - f_key 1,32 ; 8 + 8 * 7 generated = 64 - f_key 2,32 - f_key 3,32 - f_key 4,32 - f_key 5,32 - f_key 6,32 - - pop edi - pop esi - pop ebx - pop ebp - xor eax,eax - do_exit 8 - -%endif - -%ifdef AES_VAR - -%ifndef ENCRYPTION_TABLE -; %define ENCRYPTION_TABLE -%endif - - do_name _aes_encrypt_key,12 - - mov ecx,[esp+4] - mov eax,[esp+8] - mov edx,[esp+12] - push edx - push ecx - - cmp eax,16 - je .1 - cmp eax,128 - je .1 - - cmp eax,24 - je .2 - cmp eax,192 - je .2 - - cmp eax,32 - je .3 - cmp eax,256 - je .3 - mov eax,-1 - add esp,8 - do_exit 12 - -.1: do_call _aes_encrypt_key128,8 - do_exit 12 -.2: do_call _aes_encrypt_key192,8 - do_exit 12 -.3: do_call _aes_encrypt_key256,8 - do_exit 12 - -%endif - -%endif - -%ifdef ENCRYPTION_TABLE - -; S-box data - 256 entries - - section _DATA - -%define u8(x) 0, x, x, f3(x), f2(x), x, x, f3(x) - -_aes_enc_tab: - db u8(0x63),u8(0x7c),u8(0x77),u8(0x7b),u8(0xf2),u8(0x6b),u8(0x6f),u8(0xc5) - db u8(0x30),u8(0x01),u8(0x67),u8(0x2b),u8(0xfe),u8(0xd7),u8(0xab),u8(0x76) - db u8(0xca),u8(0x82),u8(0xc9),u8(0x7d),u8(0xfa),u8(0x59),u8(0x47),u8(0xf0) - db u8(0xad),u8(0xd4),u8(0xa2),u8(0xaf),u8(0x9c),u8(0xa4),u8(0x72),u8(0xc0) - db u8(0xb7),u8(0xfd),u8(0x93),u8(0x26),u8(0x36),u8(0x3f),u8(0xf7),u8(0xcc) - db u8(0x34),u8(0xa5),u8(0xe5),u8(0xf1),u8(0x71),u8(0xd8),u8(0x31),u8(0x15) - db u8(0x04),u8(0xc7),u8(0x23),u8(0xc3),u8(0x18),u8(0x96),u8(0x05),u8(0x9a) - db u8(0x07),u8(0x12),u8(0x80),u8(0xe2),u8(0xeb),u8(0x27),u8(0xb2),u8(0x75) - db u8(0x09),u8(0x83),u8(0x2c),u8(0x1a),u8(0x1b),u8(0x6e),u8(0x5a),u8(0xa0) - db u8(0x52),u8(0x3b),u8(0xd6),u8(0xb3),u8(0x29),u8(0xe3),u8(0x2f),u8(0x84) - db u8(0x53),u8(0xd1),u8(0x00),u8(0xed),u8(0x20),u8(0xfc),u8(0xb1),u8(0x5b) - db u8(0x6a),u8(0xcb),u8(0xbe),u8(0x39),u8(0x4a),u8(0x4c),u8(0x58),u8(0xcf) - db u8(0xd0),u8(0xef),u8(0xaa),u8(0xfb),u8(0x43),u8(0x4d),u8(0x33),u8(0x85) - db u8(0x45),u8(0xf9),u8(0x02),u8(0x7f),u8(0x50),u8(0x3c),u8(0x9f),u8(0xa8) - db u8(0x51),u8(0xa3),u8(0x40),u8(0x8f),u8(0x92),u8(0x9d),u8(0x38),u8(0xf5) - db u8(0xbc),u8(0xb6),u8(0xda),u8(0x21),u8(0x10),u8(0xff),u8(0xf3),u8(0xd2) - db u8(0xcd),u8(0x0c),u8(0x13),u8(0xec),u8(0x5f),u8(0x97),u8(0x44),u8(0x17) - db u8(0xc4),u8(0xa7),u8(0x7e),u8(0x3d),u8(0x64),u8(0x5d),u8(0x19),u8(0x73) - db u8(0x60),u8(0x81),u8(0x4f),u8(0xdc),u8(0x22),u8(0x2a),u8(0x90),u8(0x88) - db u8(0x46),u8(0xee),u8(0xb8),u8(0x14),u8(0xde),u8(0x5e),u8(0x0b),u8(0xdb) - db u8(0xe0),u8(0x32),u8(0x3a),u8(0x0a),u8(0x49),u8(0x06),u8(0x24),u8(0x5c) - db u8(0xc2),u8(0xd3),u8(0xac),u8(0x62),u8(0x91),u8(0x95),u8(0xe4),u8(0x79) - db u8(0xe7),u8(0xc8),u8(0x37),u8(0x6d),u8(0x8d),u8(0xd5),u8(0x4e),u8(0xa9) - db u8(0x6c),u8(0x56),u8(0xf4),u8(0xea),u8(0x65),u8(0x7a),u8(0xae),u8(0x08) - db u8(0xba),u8(0x78),u8(0x25),u8(0x2e),u8(0x1c),u8(0xa6),u8(0xb4),u8(0xc6) - db u8(0xe8),u8(0xdd),u8(0x74),u8(0x1f),u8(0x4b),u8(0xbd),u8(0x8b),u8(0x8a) - db u8(0x70),u8(0x3e),u8(0xb5),u8(0x66),u8(0x48),u8(0x03),u8(0xf6),u8(0x0e) - db u8(0x61),u8(0x35),u8(0x57),u8(0xb9),u8(0x86),u8(0xc1),u8(0x1d),u8(0x9e) - db u8(0xe1),u8(0xf8),u8(0x98),u8(0x11),u8(0x69),u8(0xd9),u8(0x8e),u8(0x94) - db u8(0x9b),u8(0x1e),u8(0x87),u8(0xe9),u8(0xce),u8(0x55),u8(0x28),u8(0xdf) - db u8(0x8c),u8(0xa1),u8(0x89),u8(0x0d),u8(0xbf),u8(0xe6),u8(0x42),u8(0x68) - db u8(0x41),u8(0x99),u8(0x2d),u8(0x0f),u8(0xb0),u8(0x54),u8(0xbb),u8(0x16) - -%endif - -%ifdef DECRYPTION - -; %define DECRYPTION_TABLE - -%define dtab_0(x) [_aes_dec_tab+ 8*x] -%define dtab_1(x) [_aes_dec_tab+3+8*x] -%define dtab_2(x) [_aes_dec_tab+2+8*x] -%define dtab_3(x) [_aes_dec_tab+1+8*x] -%define dtab_x(x) byte [_aes_dec_tab+7+8*x] - -%macro irn_fun 2 - - rol eax,16 - %1 esi, cl, 0, ebp - %1 esi, bh, 1, ebp - %1 esi, al, 2, ebp - %1 edi, dl, 0, ebp - %1 edi, ch, 1, ebp - %1 edi, ah, 3, ebp - %2 ebp, bl, 0, ebp - shr eax,16 - and ebx,0xffff0000 - or ebx,eax - shr ecx,16 - %1 ebp, bh, 1, eax - %1 ebp, ch, 3, eax - %2 eax, cl, 2, ecx - %1 eax, bl, 0, ecx - %1 eax, dh, 1, ecx - shr ebx,16 - shr edx,16 - %1 esi, dh, 3, ecx - %1 ebp, dl, 2, ecx - %1 eax, bh, 3, ecx - %1 edi, bl, 2, ecx - -%endmacro - -; Basic MOV and XOR Operations for normal rounds - -%macro ni_xor 4 - movzx %4,%2 - xor %1,dtab_%3(%4) -%endmacro - -%macro ni_mov 4 - movzx %4,%2 - mov %1,dtab_%3(%4) -%endmacro - -; Basic MOV and XOR Operations for last round - -%macro li_xor 4 - movzx %4,%2 - movzx %4,dtab_x(%4) -%if %3 != 0 - shl %4,8*%3 -%endif - xor %1,%4 -%endmacro - -%macro li_mov 4 - movzx %4,%2 - movzx %1,dtab_x(%4) -%if %3 != 0 - shl %1,8*%3 -%endif -%endmacro - -%ifdef REDUCE_CODE_SIZE - -dec_round: - sub sp, 2 -%ifdef AES_REV_DKS - add ebp,16 -%else - sub ebp,16 -%endif - save 1,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - irn_fun ni_xor, ni_mov - - mov ebx,ebp - mov ecx,esi - mov edx,edi - restore ebp,1 - xor eax,[ebp] - xor ebx,[ebp+4] - add sp, 2 - ret - -%else - -%macro dec_round 0 - -%ifdef AES_REV_DKS - add ebp,16 -%else - sub ebp,16 -%endif - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - irn_fun ni_xor, ni_mov - - mov ebx,ebp - mov ecx,esi - mov edx,edi - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - -%endif - -%macro dec_last_round 0 - -%ifdef AES_REV_DKS - add ebp,16 -%else - sub ebp,16 -%endif - save 0,ebp - mov esi,[ebp+8] - mov edi,[ebp+12] - - irn_fun li_xor, li_mov - - mov ebx,ebp - restore ebp,0 - xor eax,[ebp] - xor ebx,[ebp+4] - -%endmacro - - section _TEXT - -; AES Decryption Subroutine - - do_name _aes_decrypt,12 - - mov ax, sp - movzx esp, ax - - sub esp,stk_spc - mov [esp+16],ebp - mov [esp+12],ebx - mov [esp+ 8],esi - mov [esp+ 4],edi - -; input four columns and xor in first round key - - movzx esi,word [esp+in_blk+stk_spc] ; input pointer - mov eax,[esi ] - mov ebx,[esi+ 4] - mov ecx,[esi+ 8] - mov edx,[esi+12] - lea esi,[esi+16] - - movzx ebp, word [esp+ctx+stk_spc] ; key pointer - movzx edi,byte[ebp+4*KS_LENGTH] -%ifndef AES_REV_DKS ; if decryption key schedule is not reversed - lea ebp,[ebp+edi] ; we have to access it from the top down -%endif - xor eax,[ebp ] ; key schedule - xor ebx,[ebp+ 4] - xor ecx,[ebp+ 8] - xor edx,[ebp+12] - -; determine the number of rounds - -%ifndef AES_256 - cmp edi,10*16 - je .3 - cmp edi,12*16 - je .2 - cmp edi,14*16 - je .1 - mov eax,-1 - jmp .5 -%endif - -.1: mf_call dec_round - mf_call dec_round -.2: mf_call dec_round - mf_call dec_round -.3: mf_call dec_round - mf_call dec_round - mf_call dec_round - mf_call dec_round - mf_call dec_round - mf_call dec_round - mf_call dec_round - mf_call dec_round - mf_call dec_round - dec_last_round - -; move final values to the output array. - - movzx ebp,word [esp+out_blk+stk_spc] - mov [ebp],eax - mov [ebp+4],ebx - mov [ebp+8],esi - mov [ebp+12],edi - xor eax,eax - -.5: mov ebp,[esp+16] - mov ebx,[esp+12] - mov esi,[esp+ 8] - mov edi,[esp+ 4] - add esp,stk_spc - do_exit 12 - -%endif - -%ifdef REDUCE_CODE_SIZE - -inv_mix_col: - movzx ecx,dl ; input eax, edx - movzx ecx,etab_b(ecx) ; output eax - mov eax,dtab_0(ecx) ; used ecx - movzx ecx,dh - shr edx,16 - movzx ecx,etab_b(ecx) - xor eax,dtab_1(ecx) - movzx ecx,dl - movzx ecx,etab_b(ecx) - xor eax,dtab_2(ecx) - movzx ecx,dh - movzx ecx,etab_b(ecx) - xor eax,dtab_3(ecx) - ret - -%else - -%macro inv_mix_col 0 - - movzx ecx,dl ; input eax, edx - movzx ecx,etab_b(ecx) ; output eax - mov eax,dtab_0(ecx) ; used ecx - movzx ecx,dh - shr edx,16 - movzx ecx,etab_b(ecx) - xor eax,dtab_1(ecx) - movzx ecx,dl - movzx ecx,etab_b(ecx) - xor eax,dtab_2(ecx) - movzx ecx,dh - movzx ecx,etab_b(ecx) - xor eax,dtab_3(ecx) - -%endmacro - -%endif - -%ifdef DECRYPTION_KEY_SCHEDULE - -%ifdef AES_128 - -%ifndef DECRYPTION_TABLE -; %define DECRYPTION_TABLE -%endif - - do_name _aes_decrypt_key128,8 - - push ebp - push ebx - push esi - push edi - mov eax,[esp+24] ; context - mov edx,[esp+20] ; key - push eax - push edx - do_call _aes_encrypt_key128,8 ; generate expanded encryption key - mov eax,10*16 - mov esi,[esp+24] ; pointer to first round key - lea edi,[esi+eax] ; pointer to last round key - add esi,32 - ; the inverse mix column transformation - mov edx,[esi-16] ; needs to be applied to all round keys - mf_call inv_mix_col ; except first and last. Hence start by - mov [esi-16],eax ; transforming the four sub-keys in the - mov edx,[esi-12] ; second round key - mf_call inv_mix_col - mov [esi-12],eax ; transformations for subsequent rounds - mov edx,[esi-8] ; can then be made more efficient by - mf_call inv_mix_col ; noting that for three of the four sub-keys - mov [esi-8],eax ; in the encryption round key ek[r]: - mov edx,[esi-4] ; - mf_call inv_mix_col ; ek[r][n] = ek[r][n-1] ^ ek[r-1][n] - mov [esi-4],eax ; - ; where n is 1..3. Hence the corresponding -.0: mov edx,[esi] ; subkeys in the decryption round key dk[r] - mf_call inv_mix_col ; also obey since inv_mix_col is linear in - mov [esi],eax ; GF(256): - xor eax,[esi-12] ; - mov [esi+4],eax ; dk[r][n] = dk[r][n-1] ^ dk[r-1][n] - xor eax,[esi-8] ; - mov [esi+8],eax ; So we only need one inverse mix column - xor eax,[esi-4] ; operation (n = 0) for each four word cycle - mov [esi+12],eax ; in the expanded key. - add esi,16 - cmp edi,esi - jg .0 - jmp dec_end - -%endif - -%ifdef AES_192 - -%ifndef DECRYPTION_TABLE -; %define DECRYPTION_TABLE -%endif - - do_name _aes_decrypt_key192,8 - - push ebp - push ebx - push esi - push edi - mov eax,[esp+24] ; context - mov edx,[esp+20] ; key - push eax - push edx - do_call _aes_encrypt_key192,8 ; generate expanded encryption key - mov eax,12*16 - mov esi,[esp+24] ; first round key - lea edi,[esi+eax] ; last round key - add esi,48 ; the first 6 words are the key, of - ; which the top 2 words are part of - mov edx,[esi-32] ; the second round key and hence - mf_call inv_mix_col ; need to be modified. After this we - mov [esi-32],eax ; need to do a further six values prior - mov edx,[esi-28] ; to using a more efficient technique - mf_call inv_mix_col ; based on: - mov [esi-28],eax ; - ; dk[r][n] = dk[r][n-1] ^ dk[r-1][n] - mov edx,[esi-24] ; - mf_call inv_mix_col ; for n = 1 .. 5 where the key expansion - mov [esi-24],eax ; cycle is now 6 words long - mov edx,[esi-20] - mf_call inv_mix_col - mov [esi-20],eax - mov edx,[esi-16] - mf_call inv_mix_col - mov [esi-16],eax - mov edx,[esi-12] - mf_call inv_mix_col - mov [esi-12],eax - mov edx,[esi-8] - mf_call inv_mix_col - mov [esi-8],eax - mov edx,[esi-4] - mf_call inv_mix_col - mov [esi-4],eax - -.0: mov edx,[esi] ; the expanded key is 13 * 4 = 44 32-bit words - mf_call inv_mix_col ; of which 11 * 4 = 44 have to be modified - mov [esi],eax ; using inv_mix_col. We have already done 8 - xor eax,[esi-20] ; of these so 36 are left - hence we need - mov [esi+4],eax ; exactly 6 loops of six here - xor eax,[esi-16] - mov [esi+8],eax - xor eax,[esi-12] - mov [esi+12],eax - xor eax,[esi-8] - mov [esi+16],eax - xor eax,[esi-4] - mov [esi+20],eax - add esi,24 - cmp edi,esi - jg .0 - jmp dec_end - -%endif - -%ifdef AES_256 - -%ifndef DECRYPTION_TABLE -; %define DECRYPTION_TABLE -%endif - - do_name _aes_decrypt_key256,8 - - mov ax, sp - movzx esp, ax - push ebp - push ebx - push esi - push edi - - movzx eax, word [esp+20] ; ks - movzx edx, word [esp+18] ; key - push ax - push dx - do_call _aes_encrypt_key256,4 ; generate expanded encryption key - mov eax,14*16 - movzx esi, word [esp+20] ; ks - lea edi,[esi+eax] - add esi,64 - - mov edx,[esi-48] ; the primary key is 8 words, of which - mf_call inv_mix_col ; the top four require modification - mov [esi-48],eax - mov edx,[esi-44] - mf_call inv_mix_col - mov [esi-44],eax - mov edx,[esi-40] - mf_call inv_mix_col - mov [esi-40],eax - mov edx,[esi-36] - mf_call inv_mix_col - mov [esi-36],eax - - mov edx,[esi-32] ; the encryption key expansion cycle is - mf_call inv_mix_col ; now eight words long so we need to - mov [esi-32],eax ; start by doing one complete block - mov edx,[esi-28] - mf_call inv_mix_col - mov [esi-28],eax - mov edx,[esi-24] - mf_call inv_mix_col - mov [esi-24],eax - mov edx,[esi-20] - mf_call inv_mix_col - mov [esi-20],eax - mov edx,[esi-16] - mf_call inv_mix_col - mov [esi-16],eax - mov edx,[esi-12] - mf_call inv_mix_col - mov [esi-12],eax - mov edx,[esi-8] - mf_call inv_mix_col - mov [esi-8],eax - mov edx,[esi-4] - mf_call inv_mix_col - mov [esi-4],eax - -.0: mov edx,[esi] ; we can now speed up the remaining - mf_call inv_mix_col ; rounds by using the technique - mov [esi],eax ; outlined earlier. But note that - xor eax,[esi-28] ; there is one extra inverse mix - mov [esi+4],eax ; column operation as the 256 bit - xor eax,[esi-24] ; key has an extra non-linear step - mov [esi+8],eax ; for the midway element. - xor eax,[esi-20] - mov [esi+12],eax ; the expanded key is 15 * 4 = 60 - mov edx,[esi+16] ; 32-bit words of which 52 need to - mf_call inv_mix_col ; be modified. We have already done - mov [esi+16],eax ; 12 so 40 are left - which means - xor eax,[esi-12] ; that we need exactly 5 loops of 8 - mov [esi+20],eax - xor eax,[esi-8] - mov [esi+24],eax - xor eax,[esi-4] - mov [esi+28],eax - add esi,32 - cmp edi,esi - jg .0 - -%endif - -dec_end: - -%ifdef AES_REV_DKS - - movzx esi,word [esp+20] ; this reverses the order of the -.1: mov eax,[esi] ; round keys if required - mov ebx,[esi+4] - mov ebp,[edi] - mov edx,[edi+4] - mov [esi],ebp - mov [esi+4],edx - mov [edi],eax - mov [edi+4],ebx - - mov eax,[esi+8] - mov ebx,[esi+12] - mov ebp,[edi+8] - mov edx,[edi+12] - mov [esi+8],ebp - mov [esi+12],edx - mov [edi+8],eax - mov [edi+12],ebx - - add esi,16 - sub edi,16 - cmp edi,esi - jg .1 - -%endif - - pop edi - pop esi - pop ebx - pop ebp - xor eax,eax - do_exit 8 - -%ifdef AES_VAR - - do_name _aes_decrypt_key,12 - - mov ecx,[esp+4] - mov eax,[esp+8] - mov edx,[esp+12] - push edx - push ecx - - cmp eax,16 - je .1 - cmp eax,128 - je .1 - - cmp eax,24 - je .2 - cmp eax,192 - je .2 - - cmp eax,32 - je .3 - cmp eax,256 - je .3 - mov eax,-1 - add esp,8 - do_exit 12 - -.1: do_call _aes_decrypt_key128,8 - do_exit 12 -.2: do_call _aes_decrypt_key192,8 - do_exit 12 -.3: do_call _aes_decrypt_key256,8 - do_exit 12 - -%endif - -%endif - -%ifdef DECRYPTION_TABLE - -; Inverse S-box data - 256 entries - - section _DATA - -%define v8(x) fe(x), f9(x), fd(x), fb(x), fe(x), f9(x), fd(x), x - -_aes_dec_tab: - db v8(0x52),v8(0x09),v8(0x6a),v8(0xd5),v8(0x30),v8(0x36),v8(0xa5),v8(0x38) - db v8(0xbf),v8(0x40),v8(0xa3),v8(0x9e),v8(0x81),v8(0xf3),v8(0xd7),v8(0xfb) - db v8(0x7c),v8(0xe3),v8(0x39),v8(0x82),v8(0x9b),v8(0x2f),v8(0xff),v8(0x87) - db v8(0x34),v8(0x8e),v8(0x43),v8(0x44),v8(0xc4),v8(0xde),v8(0xe9),v8(0xcb) - db v8(0x54),v8(0x7b),v8(0x94),v8(0x32),v8(0xa6),v8(0xc2),v8(0x23),v8(0x3d) - db v8(0xee),v8(0x4c),v8(0x95),v8(0x0b),v8(0x42),v8(0xfa),v8(0xc3),v8(0x4e) - db v8(0x08),v8(0x2e),v8(0xa1),v8(0x66),v8(0x28),v8(0xd9),v8(0x24),v8(0xb2) - db v8(0x76),v8(0x5b),v8(0xa2),v8(0x49),v8(0x6d),v8(0x8b),v8(0xd1),v8(0x25) - db v8(0x72),v8(0xf8),v8(0xf6),v8(0x64),v8(0x86),v8(0x68),v8(0x98),v8(0x16) - db v8(0xd4),v8(0xa4),v8(0x5c),v8(0xcc),v8(0x5d),v8(0x65),v8(0xb6),v8(0x92) - db v8(0x6c),v8(0x70),v8(0x48),v8(0x50),v8(0xfd),v8(0xed),v8(0xb9),v8(0xda) - db v8(0x5e),v8(0x15),v8(0x46),v8(0x57),v8(0xa7),v8(0x8d),v8(0x9d),v8(0x84) - db v8(0x90),v8(0xd8),v8(0xab),v8(0x00),v8(0x8c),v8(0xbc),v8(0xd3),v8(0x0a) - db v8(0xf7),v8(0xe4),v8(0x58),v8(0x05),v8(0xb8),v8(0xb3),v8(0x45),v8(0x06) - db v8(0xd0),v8(0x2c),v8(0x1e),v8(0x8f),v8(0xca),v8(0x3f),v8(0x0f),v8(0x02) - db v8(0xc1),v8(0xaf),v8(0xbd),v8(0x03),v8(0x01),v8(0x13),v8(0x8a),v8(0x6b) - db v8(0x3a),v8(0x91),v8(0x11),v8(0x41),v8(0x4f),v8(0x67),v8(0xdc),v8(0xea) - db v8(0x97),v8(0xf2),v8(0xcf),v8(0xce),v8(0xf0),v8(0xb4),v8(0xe6),v8(0x73) - db v8(0x96),v8(0xac),v8(0x74),v8(0x22),v8(0xe7),v8(0xad),v8(0x35),v8(0x85) - db v8(0xe2),v8(0xf9),v8(0x37),v8(0xe8),v8(0x1c),v8(0x75),v8(0xdf),v8(0x6e) - db v8(0x47),v8(0xf1),v8(0x1a),v8(0x71),v8(0x1d),v8(0x29),v8(0xc5),v8(0x89) - db v8(0x6f),v8(0xb7),v8(0x62),v8(0x0e),v8(0xaa),v8(0x18),v8(0xbe),v8(0x1b) - db v8(0xfc),v8(0x56),v8(0x3e),v8(0x4b),v8(0xc6),v8(0xd2),v8(0x79),v8(0x20) - db v8(0x9a),v8(0xdb),v8(0xc0),v8(0xfe),v8(0x78),v8(0xcd),v8(0x5a),v8(0xf4) - db v8(0x1f),v8(0xdd),v8(0xa8),v8(0x33),v8(0x88),v8(0x07),v8(0xc7),v8(0x31) - db v8(0xb1),v8(0x12),v8(0x10),v8(0x59),v8(0x27),v8(0x80),v8(0xec),v8(0x5f) - db v8(0x60),v8(0x51),v8(0x7f),v8(0xa9),v8(0x19),v8(0xb5),v8(0x4a),v8(0x0d) - db v8(0x2d),v8(0xe5),v8(0x7a),v8(0x9f),v8(0x93),v8(0xc9),v8(0x9c),v8(0xef) - db v8(0xa0),v8(0xe0),v8(0x3b),v8(0x4d),v8(0xae),v8(0x2a),v8(0xf5),v8(0xb0) - db v8(0xc8),v8(0xeb),v8(0xbb),v8(0x3c),v8(0x83),v8(0x53),v8(0x99),v8(0x61) - db v8(0x17),v8(0x2b),v8(0x04),v8(0x7e),v8(0xba),v8(0x77),v8(0xd6),v8(0x26) - db v8(0xe1),v8(0x69),v8(0x14),v8(0x63),v8(0x55),v8(0x21),v8(0x0c),v8(0x7d) - -%endif diff --git a/src/utils/crypto/aestab.c b/src/utils/crypto/aestab.c deleted file mode 100644 index d0cf1912ba2..00000000000 --- a/src/utils/crypto/aestab.c +++ /dev/null @@ -1,387 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 -*/ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation: - - Added run-time table generator for Aes_x86_v2.asm -*/ - -#define DO_TABLES - -#include "aes.h" -#include "aesopt.h" - -#if defined(FIXED_TABLES) - -#define sb_data(w) {\ - w(0x63), w(0x7c), w(0x77), w(0x7b), w(0xf2), w(0x6b), w(0x6f), w(0xc5),\ - w(0x30), w(0x01), w(0x67), w(0x2b), w(0xfe), w(0xd7), w(0xab), w(0x76),\ - w(0xca), w(0x82), w(0xc9), w(0x7d), w(0xfa), w(0x59), w(0x47), w(0xf0),\ - w(0xad), w(0xd4), w(0xa2), w(0xaf), w(0x9c), w(0xa4), w(0x72), w(0xc0),\ - w(0xb7), w(0xfd), w(0x93), w(0x26), w(0x36), w(0x3f), w(0xf7), w(0xcc),\ - w(0x34), w(0xa5), w(0xe5), w(0xf1), w(0x71), w(0xd8), w(0x31), w(0x15),\ - w(0x04), w(0xc7), w(0x23), w(0xc3), w(0x18), w(0x96), w(0x05), w(0x9a),\ - w(0x07), w(0x12), w(0x80), w(0xe2), w(0xeb), w(0x27), w(0xb2), w(0x75),\ - w(0x09), w(0x83), w(0x2c), w(0x1a), w(0x1b), w(0x6e), w(0x5a), w(0xa0),\ - w(0x52), w(0x3b), w(0xd6), w(0xb3), w(0x29), w(0xe3), w(0x2f), w(0x84),\ - w(0x53), w(0xd1), w(0x00), w(0xed), w(0x20), w(0xfc), w(0xb1), w(0x5b),\ - w(0x6a), w(0xcb), w(0xbe), w(0x39), w(0x4a), w(0x4c), w(0x58), w(0xcf),\ - w(0xd0), w(0xef), w(0xaa), w(0xfb), w(0x43), w(0x4d), w(0x33), w(0x85),\ - w(0x45), w(0xf9), w(0x02), w(0x7f), w(0x50), w(0x3c), w(0x9f), w(0xa8),\ - w(0x51), w(0xa3), w(0x40), w(0x8f), w(0x92), w(0x9d), w(0x38), w(0xf5),\ - w(0xbc), w(0xb6), w(0xda), w(0x21), w(0x10), w(0xff), w(0xf3), w(0xd2),\ - w(0xcd), w(0x0c), w(0x13), w(0xec), w(0x5f), w(0x97), w(0x44), w(0x17),\ - w(0xc4), w(0xa7), w(0x7e), w(0x3d), w(0x64), w(0x5d), w(0x19), w(0x73),\ - w(0x60), w(0x81), w(0x4f), w(0xdc), w(0x22), w(0x2a), w(0x90), w(0x88),\ - w(0x46), w(0xee), w(0xb8), w(0x14), w(0xde), w(0x5e), w(0x0b), w(0xdb),\ - w(0xe0), w(0x32), w(0x3a), w(0x0a), w(0x49), w(0x06), w(0x24), w(0x5c),\ - w(0xc2), w(0xd3), w(0xac), w(0x62), w(0x91), w(0x95), w(0xe4), w(0x79),\ - w(0xe7), w(0xc8), w(0x37), w(0x6d), w(0x8d), w(0xd5), w(0x4e), w(0xa9),\ - w(0x6c), w(0x56), w(0xf4), w(0xea), w(0x65), w(0x7a), w(0xae), w(0x08),\ - w(0xba), w(0x78), w(0x25), w(0x2e), w(0x1c), w(0xa6), w(0xb4), w(0xc6),\ - w(0xe8), w(0xdd), w(0x74), w(0x1f), w(0x4b), w(0xbd), w(0x8b), w(0x8a),\ - w(0x70), w(0x3e), w(0xb5), w(0x66), w(0x48), w(0x03), w(0xf6), w(0x0e),\ - w(0x61), w(0x35), w(0x57), w(0xb9), w(0x86), w(0xc1), w(0x1d), w(0x9e),\ - w(0xe1), w(0xf8), w(0x98), w(0x11), w(0x69), w(0xd9), w(0x8e), w(0x94),\ - w(0x9b), w(0x1e), w(0x87), w(0xe9), w(0xce), w(0x55), w(0x28), w(0xdf),\ - w(0x8c), w(0xa1), w(0x89), w(0x0d), w(0xbf), w(0xe6), w(0x42), w(0x68),\ - w(0x41), w(0x99), w(0x2d), w(0x0f), w(0xb0), w(0x54), w(0xbb), w(0x16) } - -#define isb_data(w) {\ - w(0x52), w(0x09), w(0x6a), w(0xd5), w(0x30), w(0x36), w(0xa5), w(0x38),\ - w(0xbf), w(0x40), w(0xa3), w(0x9e), w(0x81), w(0xf3), w(0xd7), w(0xfb),\ - w(0x7c), w(0xe3), w(0x39), w(0x82), w(0x9b), w(0x2f), w(0xff), w(0x87),\ - w(0x34), w(0x8e), w(0x43), w(0x44), w(0xc4), w(0xde), w(0xe9), w(0xcb),\ - w(0x54), w(0x7b), w(0x94), w(0x32), w(0xa6), w(0xc2), w(0x23), w(0x3d),\ - w(0xee), w(0x4c), w(0x95), w(0x0b), w(0x42), w(0xfa), w(0xc3), w(0x4e),\ - w(0x08), w(0x2e), w(0xa1), w(0x66), w(0x28), w(0xd9), w(0x24), w(0xb2),\ - w(0x76), w(0x5b), w(0xa2), w(0x49), w(0x6d), w(0x8b), w(0xd1), w(0x25),\ - w(0x72), w(0xf8), w(0xf6), w(0x64), w(0x86), w(0x68), w(0x98), w(0x16),\ - w(0xd4), w(0xa4), w(0x5c), w(0xcc), w(0x5d), w(0x65), w(0xb6), w(0x92),\ - w(0x6c), w(0x70), w(0x48), w(0x50), w(0xfd), w(0xed), w(0xb9), w(0xda),\ - w(0x5e), w(0x15), w(0x46), w(0x57), w(0xa7), w(0x8d), w(0x9d), w(0x84),\ - w(0x90), w(0xd8), w(0xab), w(0x00), w(0x8c), w(0xbc), w(0xd3), w(0x0a),\ - w(0xf7), w(0xe4), w(0x58), w(0x05), w(0xb8), w(0xb3), w(0x45), w(0x06),\ - w(0xd0), w(0x2c), w(0x1e), w(0x8f), w(0xca), w(0x3f), w(0x0f), w(0x02),\ - w(0xc1), w(0xaf), w(0xbd), w(0x03), w(0x01), w(0x13), w(0x8a), w(0x6b),\ - w(0x3a), w(0x91), w(0x11), w(0x41), w(0x4f), w(0x67), w(0xdc), w(0xea),\ - w(0x97), w(0xf2), w(0xcf), w(0xce), w(0xf0), w(0xb4), w(0xe6), w(0x73),\ - w(0x96), w(0xac), w(0x74), w(0x22), w(0xe7), w(0xad), w(0x35), w(0x85),\ - w(0xe2), w(0xf9), w(0x37), w(0xe8), w(0x1c), w(0x75), w(0xdf), w(0x6e),\ - w(0x47), w(0xf1), w(0x1a), w(0x71), w(0x1d), w(0x29), w(0xc5), w(0x89),\ - w(0x6f), w(0xb7), w(0x62), w(0x0e), w(0xaa), w(0x18), w(0xbe), w(0x1b),\ - w(0xfc), w(0x56), w(0x3e), w(0x4b), w(0xc6), w(0xd2), w(0x79), w(0x20),\ - w(0x9a), w(0xdb), w(0xc0), w(0xfe), w(0x78), w(0xcd), w(0x5a), w(0xf4),\ - w(0x1f), w(0xdd), w(0xa8), w(0x33), w(0x88), w(0x07), w(0xc7), w(0x31),\ - w(0xb1), w(0x12), w(0x10), w(0x59), w(0x27), w(0x80), w(0xec), w(0x5f),\ - w(0x60), w(0x51), w(0x7f), w(0xa9), w(0x19), w(0xb5), w(0x4a), w(0x0d),\ - w(0x2d), w(0xe5), w(0x7a), w(0x9f), w(0x93), w(0xc9), w(0x9c), w(0xef),\ - w(0xa0), w(0xe0), w(0x3b), w(0x4d), w(0xae), w(0x2a), w(0xf5), w(0xb0),\ - w(0xc8), w(0xeb), w(0xbb), w(0x3c), w(0x83), w(0x53), w(0x99), w(0x61),\ - w(0x17), w(0x2b), w(0x04), w(0x7e), w(0xba), w(0x77), w(0xd6), w(0x26),\ - w(0xe1), w(0x69), w(0x14), w(0x63), w(0x55), w(0x21), w(0x0c), w(0x7d) } - -#define mm_data(w) {\ - w(0x00), w(0x01), w(0x02), w(0x03), w(0x04), w(0x05), w(0x06), w(0x07),\ - w(0x08), w(0x09), w(0x0a), w(0x0b), w(0x0c), w(0x0d), w(0x0e), w(0x0f),\ - w(0x10), w(0x11), w(0x12), w(0x13), w(0x14), w(0x15), w(0x16), w(0x17),\ - w(0x18), w(0x19), w(0x1a), w(0x1b), w(0x1c), w(0x1d), w(0x1e), w(0x1f),\ - w(0x20), w(0x21), w(0x22), w(0x23), w(0x24), w(0x25), w(0x26), w(0x27),\ - w(0x28), w(0x29), w(0x2a), w(0x2b), w(0x2c), w(0x2d), w(0x2e), w(0x2f),\ - w(0x30), w(0x31), w(0x32), w(0x33), w(0x34), w(0x35), w(0x36), w(0x37),\ - w(0x38), w(0x39), w(0x3a), w(0x3b), w(0x3c), w(0x3d), w(0x3e), w(0x3f),\ - w(0x40), w(0x41), w(0x42), w(0x43), w(0x44), w(0x45), w(0x46), w(0x47),\ - w(0x48), w(0x49), w(0x4a), w(0x4b), w(0x4c), w(0x4d), w(0x4e), w(0x4f),\ - w(0x50), w(0x51), w(0x52), w(0x53), w(0x54), w(0x55), w(0x56), w(0x57),\ - w(0x58), w(0x59), w(0x5a), w(0x5b), w(0x5c), w(0x5d), w(0x5e), w(0x5f),\ - w(0x60), w(0x61), w(0x62), w(0x63), w(0x64), w(0x65), w(0x66), w(0x67),\ - w(0x68), w(0x69), w(0x6a), w(0x6b), w(0x6c), w(0x6d), w(0x6e), w(0x6f),\ - w(0x70), w(0x71), w(0x72), w(0x73), w(0x74), w(0x75), w(0x76), w(0x77),\ - w(0x78), w(0x79), w(0x7a), w(0x7b), w(0x7c), w(0x7d), w(0x7e), w(0x7f),\ - w(0x80), w(0x81), w(0x82), w(0x83), w(0x84), w(0x85), w(0x86), w(0x87),\ - w(0x88), w(0x89), w(0x8a), w(0x8b), w(0x8c), w(0x8d), w(0x8e), w(0x8f),\ - w(0x90), w(0x91), w(0x92), w(0x93), w(0x94), w(0x95), w(0x96), w(0x97),\ - w(0x98), w(0x99), w(0x9a), w(0x9b), w(0x9c), w(0x9d), w(0x9e), w(0x9f),\ - w(0xa0), w(0xa1), w(0xa2), w(0xa3), w(0xa4), w(0xa5), w(0xa6), w(0xa7),\ - w(0xa8), w(0xa9), w(0xaa), w(0xab), w(0xac), w(0xad), w(0xae), w(0xaf),\ - w(0xb0), w(0xb1), w(0xb2), w(0xb3), w(0xb4), w(0xb5), w(0xb6), w(0xb7),\ - w(0xb8), w(0xb9), w(0xba), w(0xbb), w(0xbc), w(0xbd), w(0xbe), w(0xbf),\ - w(0xc0), w(0xc1), w(0xc2), w(0xc3), w(0xc4), w(0xc5), w(0xc6), w(0xc7),\ - w(0xc8), w(0xc9), w(0xca), w(0xcb), w(0xcc), w(0xcd), w(0xce), w(0xcf),\ - w(0xd0), w(0xd1), w(0xd2), w(0xd3), w(0xd4), w(0xd5), w(0xd6), w(0xd7),\ - w(0xd8), w(0xd9), w(0xda), w(0xdb), w(0xdc), w(0xdd), w(0xde), w(0xdf),\ - w(0xe0), w(0xe1), w(0xe2), w(0xe3), w(0xe4), w(0xe5), w(0xe6), w(0xe7),\ - w(0xe8), w(0xe9), w(0xea), w(0xeb), w(0xec), w(0xed), w(0xee), w(0xef),\ - w(0xf0), w(0xf1), w(0xf2), w(0xf3), w(0xf4), w(0xf5), w(0xf6), w(0xf7),\ - w(0xf8), w(0xf9), w(0xfa), w(0xfb), w(0xfc), w(0xfd), w(0xfe), w(0xff) } - -#define rc_data(w) {\ - w(0x01), w(0x02), w(0x04), w(0x08), w(0x10),w(0x20), w(0x40), w(0x80),\ - w(0x1b), w(0x36) } - -#define h0(x) (x) - -#define w0(p) bytes2word(p, 0, 0, 0) -#define w1(p) bytes2word(0, p, 0, 0) -#define w2(p) bytes2word(0, 0, p, 0) -#define w3(p) bytes2word(0, 0, 0, p) - -#define u0(p) bytes2word(f2(p), p, p, f3(p)) -#define u1(p) bytes2word(f3(p), f2(p), p, p) -#define u2(p) bytes2word(p, f3(p), f2(p), p) -#define u3(p) bytes2word(p, p, f3(p), f2(p)) - -#define v0(p) bytes2word(fe(p), f9(p), fd(p), fb(p)) -#define v1(p) bytes2word(fb(p), fe(p), f9(p), fd(p)) -#define v2(p) bytes2word(fd(p), fb(p), fe(p), f9(p)) -#define v3(p) bytes2word(f9(p), fd(p), fb(p), fe(p)) - -#endif - -#if defined(FIXED_TABLES) || !defined(FF_TABLES) - -#define f2(x) ((x<<1) ^ (((x>>7) & 1) * WPOLY)) -#define f4(x) ((x<<2) ^ (((x>>6) & 1) * WPOLY) ^ (((x>>6) & 2) * WPOLY)) -#define f8(x) ((x<<3) ^ (((x>>5) & 1) * WPOLY) ^ (((x>>5) & 2) * WPOLY) \ - ^ (((x>>5) & 4) * WPOLY)) -#define f3(x) (f2(x) ^ x) -#define f9(x) (f8(x) ^ x) -#define fb(x) (f8(x) ^ f2(x) ^ x) -#define fd(x) (f8(x) ^ f4(x) ^ x) -#define fe(x) (f8(x) ^ f4(x) ^ f2(x)) - -#else - -#define f2(x) ((x) ? pow[log[x] + 0x19] : 0) -#define f3(x) ((x) ? pow[log[x] + 0x01] : 0) -#define f9(x) ((x) ? pow[log[x] + 0xc7] : 0) -#define fb(x) ((x) ? pow[log[x] + 0x68] : 0) -#define fd(x) ((x) ? pow[log[x] + 0xee] : 0) -#define fe(x) ((x) ? pow[log[x] + 0xdf] : 0) -#define fi(x) ((x) ? pow[ 255 - log[x]] : 0) - -#endif - -#include "aestab.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined(FIXED_TABLES) - -/* implemented in case of wrong call for fixed tables */ - -AES_RETURN aes_init(void) -{ - return EXIT_SUCCESS; -} - -#else /* dynamic table generation */ - -#if !defined(FF_TABLES) - -/* Generate the tables for the dynamic table option - - It will generally be sensible to use tables to compute finite - field multiplies and inverses but where memory is scarse this - code might sometimes be better. But it only has effect during - initialisation so its pretty unimportant in overall terms. -*/ - -/* return 2 ^ (n - 1) where n is the bit number of the highest bit - set in x with x in the range 1 < x < 0x00000200. This form is - used so that locals within fi can be bytes rather than words -*/ - -static uint_8t hibit(const uint_32t x) -{ uint_8t r = (uint_8t)((x >> 1) | (x >> 2)); - - r |= (r >> 2); - r |= (r >> 4); - return (r + 1) >> 1; -} - -/* return the inverse of the finite field element x */ - -static uint_8t fi(const uint_8t x) -{ uint_8t p1 = x, p2 = BPOLY, n1 = hibit(x), n2 = 0x80, v1 = 1, v2 = 0; - - if(x < 2) return x; - - for(;;) - { - if(!n1) return v1; - - while(n2 >= n1) - { - n2 /= n1; p2 ^= p1 * n2; v2 ^= v1 * n2; n2 = hibit(p2); - } - - if(!n2) return v2; - - while(n1 >= n2) - { - n1 /= n2; p1 ^= p2 * n1; v1 ^= v2 * n1; n1 = hibit(p1); - } - } -} - -#endif - -/* The forward and inverse affine transformations used in the S-box */ - -#define fwd_affine(x) \ - (w = (uint_32t)x, w ^= (w<<1)^(w<<2)^(w<<3)^(w<<4), 0x63^(uint_8t)(w^(w>>8))) - -#define inv_affine(x) \ - (w = (uint_32t)x, w = (w<<1)^(w<<3)^(w<<6), 0x05^(uint_8t)(w^(w>>8))) - -static int init = 0; - -AES_RETURN aes_init(void) -{ uint_32t i, w; - -#if defined(FF_TABLES) - - uint_8t pow[512], log[256]; - - if(init) - return EXIT_SUCCESS; - /* log and power tables for GF(2^8) finite field with - WPOLY as modular polynomial - the simplest primitive - root is 0x03, used here to generate the tables - */ - - i = 0; w = 1; - do - { - pow[i] = (uint_8t)w; - pow[i + 255] = (uint_8t)w; - log[w] = (uint_8t)i++; - w ^= (w << 1) ^ (w & 0x80 ? WPOLY : 0); - } - while (w != 1); - -#else - if(init) - return EXIT_SUCCESS; -#endif - - for(i = 0, w = 1; i < RC_LENGTH; ++i) - { - t_set(r,c)[i] = bytes2word(w, 0, 0, 0); - w = f2(w); - } - - for(i = 0; i < 256; ++i) - { uint_8t b; - - b = fwd_affine(fi((uint_8t)i)); - w = bytes2word(f2(b), b, b, f3(b)); - -#if defined( SBX_SET ) - t_set(s,box)[i] = b; -#endif - -#if defined( FT1_SET ) /* tables for a normal encryption round */ - t_set(f,n)[i] = w; -#endif -#if defined( FT4_SET ) - t_set(f,n)[0][i] = w; - t_set(f,n)[1][i] = upr(w,1); - t_set(f,n)[2][i] = upr(w,2); - t_set(f,n)[3][i] = upr(w,3); -#endif - w = bytes2word(b, 0, 0, 0); - -#if defined( FL1_SET ) /* tables for last encryption round (may also */ - t_set(f,l)[i] = w; /* be used in the key schedule) */ -#endif -#if defined( FL4_SET ) - t_set(f,l)[0][i] = w; - t_set(f,l)[1][i] = upr(w,1); - t_set(f,l)[2][i] = upr(w,2); - t_set(f,l)[3][i] = upr(w,3); -#endif - -#if defined( LS1_SET ) /* table for key schedule if t_set(f,l) above is*/ - t_set(l,s)[i] = w; /* not of the required form */ -#endif -#if defined( LS4_SET ) - t_set(l,s)[0][i] = w; - t_set(l,s)[1][i] = upr(w,1); - t_set(l,s)[2][i] = upr(w,2); - t_set(l,s)[3][i] = upr(w,3); -#endif - - b = fi(inv_affine((uint_8t)i)); - w = bytes2word(fe(b), f9(b), fd(b), fb(b)); - -#if defined( IM1_SET ) /* tables for the inverse mix column operation */ - t_set(i,m)[b] = w; -#endif -#if defined( IM4_SET ) - t_set(i,m)[0][b] = w; - t_set(i,m)[1][b] = upr(w,1); - t_set(i,m)[2][b] = upr(w,2); - t_set(i,m)[3][b] = upr(w,3); -#endif - -#if defined( ISB_SET ) - t_set(i,box)[i] = b; -#endif -#if defined( IT1_SET ) /* tables for a normal decryption round */ - t_set(i,n)[i] = w; -#endif -#if defined( IT4_SET ) - t_set(i,n)[0][i] = w; - t_set(i,n)[1][i] = upr(w,1); - t_set(i,n)[2][i] = upr(w,2); - t_set(i,n)[3][i] = upr(w,3); -#endif - w = bytes2word(b, 0, 0, 0); -#if defined( IL1_SET ) /* tables for last decryption round */ - t_set(i,l)[i] = w; -#endif -#if defined( IL4_SET ) - t_set(i,l)[0][i] = w; - t_set(i,l)[1][i] = upr(w,1); - t_set(i,l)[2][i] = upr(w,2); - t_set(i,l)[3][i] = upr(w,3); -#endif - } - - init = 1; - return EXIT_SUCCESS; -} - -#endif - -#if defined(__cplusplus) -} -#endif diff --git a/src/utils/crypto/aestab.h b/src/utils/crypto/aestab.h deleted file mode 100644 index e52e0057d8a..00000000000 --- a/src/utils/crypto/aestab.h +++ /dev/null @@ -1,174 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1998-2007, Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 20/12/2007 - - This file contains the code for declaring the tables needed to implement - AES. The file aesopt.h is assumed to be included before this header file. - If there are no global variables, the definitions here can be used to put - the AES tables in a structure so that a pointer can then be added to the - AES context to pass them to the AES routines that need them. If this - facility is used, the calling program has to ensure that this pointer is - managed appropriately. In particular, the value of the t_dec(in,it) item - in the table structure must be set to zero in order to ensure that the - tables are initialised. In practice the three code sequences in aeskey.c - that control the calls to aes_init() and the aes_init() routine itself will - have to be changed for a specific implementation. If global variables are - available it will generally be preferable to use them with the precomputed - FIXED_TABLES option that uses static global tables. - - The following defines can be used to control the way the tables - are defined, initialised and used in embedded environments that - require special features for these purposes - - the 't_dec' construction is used to declare fixed table arrays - the 't_set' construction is used to set fixed table values - the 't_use' construction is used to access fixed table values - - 256 byte tables: - - t_xxx(s,box) => forward S box - t_xxx(i,box) => inverse S box - - 256 32-bit word OR 4 x 256 32-bit word tables: - - t_xxx(f,n) => forward normal round - t_xxx(f,l) => forward last round - t_xxx(i,n) => inverse normal round - t_xxx(i,l) => inverse last round - t_xxx(l,s) => key schedule table - t_xxx(i,m) => key schedule table - - Other variables and tables: - - t_xxx(r,c) => the rcon table -*/ - -#if !defined( _AESTAB_H ) -#define _AESTAB_H - -#define t_dec(m,n) t_##m##n -#define t_set(m,n) t_##m##n -#define t_use(m,n) t_##m##n - -#if defined(FIXED_TABLES) -# if !defined( __GNUC__ ) && (defined( __MSDOS__ ) || defined( __WIN16__ )) -/* make tables far data to avoid using too much DGROUP space (PG) */ -# define CONST const far -# else -# define CONST const -# endif -#else -# define CONST -#endif - -#if defined(__cplusplus) -# define EXTERN extern "C" -#elif defined(DO_TABLES) -# define EXTERN -#else -# define EXTERN extern -#endif - -#if defined(_MSC_VER) && defined(TABLE_ALIGN) -#define ALIGN __declspec(align(TABLE_ALIGN)) -#else -#define ALIGN -#endif - -#if defined( __WATCOMC__ ) && ( __WATCOMC__ >= 1100 ) -# define XP_DIR __cdecl -#else -# define XP_DIR -#endif - -#if defined(DO_TABLES) && defined(FIXED_TABLES) -#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] = b(e) -#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] = { b(e), b(f), b(g), b(h) } -EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH] = rc_data(w0); -#else -#define d_1(t,n,b,e) EXTERN ALIGN CONST XP_DIR t n[256] -#define d_4(t,n,b,e,f,g,h) EXTERN ALIGN CONST XP_DIR t n[4][256] -EXTERN ALIGN CONST uint_32t t_dec(r,c)[RC_LENGTH]; -#endif - -#if defined( SBX_SET ) - d_1(uint_8t, t_dec(s,box), sb_data, h0); -#endif -#if defined( ISB_SET ) - d_1(uint_8t, t_dec(i,box), isb_data, h0); -#endif - -#if defined( FT1_SET ) - d_1(uint_32t, t_dec(f,n), sb_data, u0); -#endif -#if defined( FT4_SET ) - d_4(uint_32t, t_dec(f,n), sb_data, u0, u1, u2, u3); -#endif - -#if defined( FL1_SET ) - d_1(uint_32t, t_dec(f,l), sb_data, w0); -#endif -#if defined( FL4_SET ) - d_4(uint_32t, t_dec(f,l), sb_data, w0, w1, w2, w3); -#endif - -#if defined( IT1_SET ) - d_1(uint_32t, t_dec(i,n), isb_data, v0); -#endif -#if defined( IT4_SET ) - d_4(uint_32t, t_dec(i,n), isb_data, v0, v1, v2, v3); -#endif - -#if defined( IL1_SET ) - d_1(uint_32t, t_dec(i,l), isb_data, w0); -#endif -#if defined( IL4_SET ) - d_4(uint_32t, t_dec(i,l), isb_data, w0, w1, w2, w3); -#endif - -#if defined( LS1_SET ) -#if defined( FL1_SET ) -#undef LS1_SET -#else - d_1(uint_32t, t_dec(l,s), sb_data, w0); -#endif -#endif - -#if defined( LS4_SET ) -#if defined( FL4_SET ) -#undef LS4_SET -#else - d_4(uint_32t, t_dec(l,s), sb_data, w0, w1, w2, w3); -#endif -#endif - -#if defined( IM1_SET ) - d_1(uint_32t, t_dec(i,m), mm_data, v0); -#endif -#if defined( IM4_SET ) - d_4(uint_32t, t_dec(i,m), mm_data, v0, v1, v2, v3); -#endif - -#endif diff --git a/src/utils/crypto/bf_ecb.c b/src/utils/crypto/bf_ecb.c deleted file mode 100644 index 8fd65d213be..00000000000 --- a/src/utils/crypto/bf_ecb.c +++ /dev/null @@ -1,113 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/bf/bf_ecb.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - -#include "blowfish.h" -#include "bf_locl.h" -#include "../common/endian.h" - -/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' - * (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, - * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) - */ - -char *BF_version="BlowFish part of SSLeay 0.8.2b 08-Jan-1998"; - -char *BF_options(void) - { -#ifdef BF_PTR - return("blowfish(ptr)"); -#elif defined(BF_PTR2) - return("blowfish(ptr2)"); -#else - return("blowfish(idx)"); -#endif - } - -void BF_ecb_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt) - { - BF_LONG l,d[2]; - - n2l(in,l); d[0]=l; - n2l(in,l); d[1]=l; - if (encrypt) - BF_encrypt(d,ks); - else - BF_decrypt(d,ks); - l=d[0]; l2n(l,out); - l=d[1]; l2n(l,out); - l=d[0]=d[1]=0; - } - -void BF_ecb_le_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt) -{ - BF_LONG d[2]; - - d[0] = LE32(((BF_LONG *)in)[0]); - d[1] = LE32(((BF_LONG *)in)[1]); - if (encrypt) - BF_encrypt(d,ks); - else - BF_decrypt(d,ks); - ((BF_LONG *)out)[0] = LE32(d[0]); - ((BF_LONG *)out)[1] = LE32(d[1]); - d[0]=d[1]=0; -} diff --git a/src/utils/crypto/bf_enc.c b/src/utils/crypto/bf_enc.c deleted file mode 100644 index 2323c648fcf..00000000000 --- a/src/utils/crypto/bf_enc.c +++ /dev/null @@ -1,235 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/bf/bf_enc.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - - - -#include "blowfish.h" -#include "bf_locl.h" - -/* Blowfish as implemented from 'Blowfish: Springer-Verlag paper' - * (From LECTURE NOTES IN COIMPUTER SCIENCE 809, FAST SOFTWARE ENCRYPTION, - * CAMBRIDGE SECURITY WORKSHOP, CAMBRIDGE, U.K., DECEMBER 9-11, 1993) - */ - -#if (BF_ROUNDS != 16) && (BF_ROUNDS != 20) -If you set BF_ROUNDS to some value other than 16 or 20, you will have -to modify the code. -#endif - -void BF_encrypt(BF_LONG *data, BF_KEY *key) - { - register BF_LONG l,r,*p,*s; - - p=key->P; - s= &(key->S[0]); - l=data[0]; - r=data[1]; - - l^=p[0]; - BF_ENC(r,l,s,p[ 1]); - BF_ENC(l,r,s,p[ 2]); - BF_ENC(r,l,s,p[ 3]); - BF_ENC(l,r,s,p[ 4]); - BF_ENC(r,l,s,p[ 5]); - BF_ENC(l,r,s,p[ 6]); - BF_ENC(r,l,s,p[ 7]); - BF_ENC(l,r,s,p[ 8]); - BF_ENC(r,l,s,p[ 9]); - BF_ENC(l,r,s,p[10]); - BF_ENC(r,l,s,p[11]); - BF_ENC(l,r,s,p[12]); - BF_ENC(r,l,s,p[13]); - BF_ENC(l,r,s,p[14]); - BF_ENC(r,l,s,p[15]); - BF_ENC(l,r,s,p[16]); -#if BF_ROUNDS == 20 - BF_ENC(r,l,s,p[17]); - BF_ENC(l,r,s,p[18]); - BF_ENC(r,l,s,p[19]); - BF_ENC(l,r,s,p[20]); -#endif - r^=p[BF_ROUNDS+1]; - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; - } - -#ifndef BF_DEFAULT_OPTIONS - -void BF_decrypt(BF_LONG *data, BF_KEY *key) - { - register BF_LONG l,r,*p,*s; - - p=key->P; - s= &(key->S[0]); - l=data[0]; - r=data[1]; - - l^=p[BF_ROUNDS+1]; -#if BF_ROUNDS == 20 - BF_ENC(r,l,s,p[20]); - BF_ENC(l,r,s,p[19]); - BF_ENC(r,l,s,p[18]); - BF_ENC(l,r,s,p[17]); -#endif - BF_ENC(r,l,s,p[16]); - BF_ENC(l,r,s,p[15]); - BF_ENC(r,l,s,p[14]); - BF_ENC(l,r,s,p[13]); - BF_ENC(r,l,s,p[12]); - BF_ENC(l,r,s,p[11]); - BF_ENC(r,l,s,p[10]); - BF_ENC(l,r,s,p[ 9]); - BF_ENC(r,l,s,p[ 8]); - BF_ENC(l,r,s,p[ 7]); - BF_ENC(r,l,s,p[ 6]); - BF_ENC(l,r,s,p[ 5]); - BF_ENC(r,l,s,p[ 4]); - BF_ENC(l,r,s,p[ 3]); - BF_ENC(r,l,s,p[ 2]); - BF_ENC(l,r,s,p[ 1]); - r^=p[0]; - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; - } - -void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, BF_KEY *ks, unsigned char *iv, int encrypt) - { - register BF_LONG tin0,tin1; - register BF_LONG tout0,tout1,xor0,xor1; - register long l=length; - BF_LONG tin[2]; - - if (encrypt) - { - n2l(iv,tout0); - n2l(iv,tout1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - BF_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - if (l != -8) - { - n2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - BF_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - l2n(tout0,iv); - l2n(tout1,iv); - } - else - { - n2l(iv,xor0); - n2l(iv,xor1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - BF_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2n(tout0,out); - l2n(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - BF_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2nn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - l2n(xor0,iv); - l2n(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } - -#endif diff --git a/src/utils/crypto/bf_locl.h b/src/utils/crypto/bf_locl.h deleted file mode 100644 index 36dc05048f3..00000000000 --- a/src/utils/crypto/bf_locl.h +++ /dev/null @@ -1,246 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/bf/bf_locl.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify bf_locl.org since bf_locl.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -/* Special defines which change the way the code is built depending on the - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find - even newer MIPS CPU's, but at the moment one size fits all for - optimization options. Older Sparc's work better with only UNROLL, but - there's no way to tell at compile time what it is you're running on */ - -#if defined( sun ) /* Newer Sparc's */ -# define BF_PTR -#elif defined( __ultrix ) /* Older MIPS */ -# define BF_PTR -#elif defined( __osf1__ ) /* Alpha */ - /* None */ -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* None */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ - /* Unknown */ -#elif defined( __sgi ) /* Newer MIPS */ -# define BF_PTR -#elif defined( i386 ) /* x86 boxes, should be gcc */ -# define BF_PTR2 -#elif defined( _MSC_VER ) /* x86 boxes, Visual C */ -# define BF_PTR2 -#endif /* Systems-specific speed defines */ - -#undef c2l -#define c2l(c,l) (l =((uint32_t)(*((c)++))) , \ - l|=((uint32_t)(*((c)++)))<< 8L, \ - l|=((uint32_t)(*((c)++)))<<16L, \ - l|=((uint32_t)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#undef c2ln -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((uint32_t)(*(--(c))))<<24L; \ - case 7: l2|=((uint32_t)(*(--(c))))<<16L; \ - case 6: l2|=((uint32_t)(*(--(c))))<< 8L; \ - case 5: l2|=((uint32_t)(*(--(c)))); \ - case 4: l1 =((uint32_t)(*(--(c))))<<24L; \ - case 3: l1|=((uint32_t)(*(--(c))))<<16L; \ - case 2: l1|=((uint32_t)(*(--(c))))<< 8L; \ - case 1: l1|=((uint32_t)(*(--(c)))); \ - } \ - } - -#undef l2c -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#undef l2cn -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -/* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((uint32_t)(*(--(c)))) ; \ - case 7: l2|=((uint32_t)(*(--(c))))<< 8; \ - case 6: l2|=((uint32_t)(*(--(c))))<<16; \ - case 5: l2|=((uint32_t)(*(--(c))))<<24; \ - case 4: l1 =((uint32_t)(*(--(c)))) ; \ - case 3: l1|=((uint32_t)(*(--(c))))<< 8; \ - case 2: l1|=((uint32_t)(*(--(c))))<<16; \ - case 1: l1|=((uint32_t)(*(--(c))))<<24; \ - } \ - } - -/* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ - } - -#undef n2l -#define n2l(c,l) (l =((uint32_t)(*((c)++)))<<24L, \ - l|=((uint32_t)(*((c)++)))<<16L, \ - l|=((uint32_t)(*((c)++)))<< 8L, \ - l|=((uint32_t)(*((c)++)))) - -#undef l2n -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -/* This is actually a big endian algorithm, the most significate byte - * is used to lookup array 0 */ - -/* use BF_PTR2 for intel boxes, - * BF_PTR for sparc and MIPS/SGI - * use nothing for Alpha and HP. - */ -#if !defined(BF_PTR) && !defined(BF_PTR2) -#define BF_PTR2 -#endif - -#define BF_M 0x3fc -#define BF_0 22L -#define BF_1 14L -#define BF_2 6L -#define BF_3 2L /* left shift */ - -#if defined(BF_PTR2) - -/* This is basically a special pentium verson */ -#define BF_ENC(LL,R,S,P) \ - { \ - BF_LONG t,u,v; \ - u=R>>BF_0; \ - v=R>>BF_1; \ - u&=BF_M; \ - v&=BF_M; \ - t= *(BF_LONG *)((unsigned char *)&(S[ 0])+u); \ - u=R>>BF_2; \ - t+= *(BF_LONG *)((unsigned char *)&(S[256])+v); \ - v=R<>BF_0)&BF_M))+ \ - *(BF_LONG *)((unsigned char *)&(S[256])+((R>>BF_1)&BF_M)))^ \ - *(BF_LONG *)((unsigned char *)&(S[512])+((R>>BF_2)&BF_M)))+ \ - *(BF_LONG *)((unsigned char *)&(S[768])+((R<>24L) ] + \ - S[0x0100+((int)(R>>16L)&0xff)])^ \ - S[0x0200+((int)(R>> 8L)&0xff)])+ \ - S[0x0300+((int)(R )&0xff)])&0xffffffffL; -#endif diff --git a/src/utils/crypto/bf_pi.h b/src/utils/crypto/bf_pi.h deleted file mode 100644 index 9a3933ed1bf..00000000000 --- a/src/utils/crypto/bf_pi.h +++ /dev/null @@ -1,327 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/bf/bf_pi.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -static BF_KEY bf_init= { - { - 0x243f6a88L, 0x85a308d3L, 0x13198a2eL, 0x03707344L, - 0xa4093822L, 0x299f31d0L, 0x082efa98L, 0xec4e6c89L, - 0x452821e6L, 0x38d01377L, 0xbe5466cfL, 0x34e90c6cL, - 0xc0ac29b7L, 0xc97c50ddL, 0x3f84d5b5L, 0xb5470917L, - 0x9216d5d9L, 0x8979fb1b - },{ - 0xd1310ba6L, 0x98dfb5acL, 0x2ffd72dbL, 0xd01adfb7L, - 0xb8e1afedL, 0x6a267e96L, 0xba7c9045L, 0xf12c7f99L, - 0x24a19947L, 0xb3916cf7L, 0x0801f2e2L, 0x858efc16L, - 0x636920d8L, 0x71574e69L, 0xa458fea3L, 0xf4933d7eL, - 0x0d95748fL, 0x728eb658L, 0x718bcd58L, 0x82154aeeL, - 0x7b54a41dL, 0xc25a59b5L, 0x9c30d539L, 0x2af26013L, - 0xc5d1b023L, 0x286085f0L, 0xca417918L, 0xb8db38efL, - 0x8e79dcb0L, 0x603a180eL, 0x6c9e0e8bL, 0xb01e8a3eL, - 0xd71577c1L, 0xbd314b27L, 0x78af2fdaL, 0x55605c60L, - 0xe65525f3L, 0xaa55ab94L, 0x57489862L, 0x63e81440L, - 0x55ca396aL, 0x2aab10b6L, 0xb4cc5c34L, 0x1141e8ceL, - 0xa15486afL, 0x7c72e993L, 0xb3ee1411L, 0x636fbc2aL, - 0x2ba9c55dL, 0x741831f6L, 0xce5c3e16L, 0x9b87931eL, - 0xafd6ba33L, 0x6c24cf5cL, 0x7a325381L, 0x28958677L, - 0x3b8f4898L, 0x6b4bb9afL, 0xc4bfe81bL, 0x66282193L, - 0x61d809ccL, 0xfb21a991L, 0x487cac60L, 0x5dec8032L, - 0xef845d5dL, 0xe98575b1L, 0xdc262302L, 0xeb651b88L, - 0x23893e81L, 0xd396acc5L, 0x0f6d6ff3L, 0x83f44239L, - 0x2e0b4482L, 0xa4842004L, 0x69c8f04aL, 0x9e1f9b5eL, - 0x21c66842L, 0xf6e96c9aL, 0x670c9c61L, 0xabd388f0L, - 0x6a51a0d2L, 0xd8542f68L, 0x960fa728L, 0xab5133a3L, - 0x6eef0b6cL, 0x137a3be4L, 0xba3bf050L, 0x7efb2a98L, - 0xa1f1651dL, 0x39af0176L, 0x66ca593eL, 0x82430e88L, - 0x8cee8619L, 0x456f9fb4L, 0x7d84a5c3L, 0x3b8b5ebeL, - 0xe06f75d8L, 0x85c12073L, 0x401a449fL, 0x56c16aa6L, - 0x4ed3aa62L, 0x363f7706L, 0x1bfedf72L, 0x429b023dL, - 0x37d0d724L, 0xd00a1248L, 0xdb0fead3L, 0x49f1c09bL, - 0x075372c9L, 0x80991b7bL, 0x25d479d8L, 0xf6e8def7L, - 0xe3fe501aL, 0xb6794c3bL, 0x976ce0bdL, 0x04c006baL, - 0xc1a94fb6L, 0x409f60c4L, 0x5e5c9ec2L, 0x196a2463L, - 0x68fb6fafL, 0x3e6c53b5L, 0x1339b2ebL, 0x3b52ec6fL, - 0x6dfc511fL, 0x9b30952cL, 0xcc814544L, 0xaf5ebd09L, - 0xbee3d004L, 0xde334afdL, 0x660f2807L, 0x192e4bb3L, - 0xc0cba857L, 0x45c8740fL, 0xd20b5f39L, 0xb9d3fbdbL, - 0x5579c0bdL, 0x1a60320aL, 0xd6a100c6L, 0x402c7279L, - 0x679f25feL, 0xfb1fa3ccL, 0x8ea5e9f8L, 0xdb3222f8L, - 0x3c7516dfL, 0xfd616b15L, 0x2f501ec8L, 0xad0552abL, - 0x323db5faL, 0xfd238760L, 0x53317b48L, 0x3e00df82L, - 0x9e5c57bbL, 0xca6f8ca0L, 0x1a87562eL, 0xdf1769dbL, - 0xd542a8f6L, 0x287effc3L, 0xac6732c6L, 0x8c4f5573L, - 0x695b27b0L, 0xbbca58c8L, 0xe1ffa35dL, 0xb8f011a0L, - 0x10fa3d98L, 0xfd2183b8L, 0x4afcb56cL, 0x2dd1d35bL, - 0x9a53e479L, 0xb6f84565L, 0xd28e49bcL, 0x4bfb9790L, - 0xe1ddf2daL, 0xa4cb7e33L, 0x62fb1341L, 0xcee4c6e8L, - 0xef20cadaL, 0x36774c01L, 0xd07e9efeL, 0x2bf11fb4L, - 0x95dbda4dL, 0xae909198L, 0xeaad8e71L, 0x6b93d5a0L, - 0xd08ed1d0L, 0xafc725e0L, 0x8e3c5b2fL, 0x8e7594b7L, - 0x8ff6e2fbL, 0xf2122b64L, 0x8888b812L, 0x900df01cL, - 0x4fad5ea0L, 0x688fc31cL, 0xd1cff191L, 0xb3a8c1adL, - 0x2f2f2218L, 0xbe0e1777L, 0xea752dfeL, 0x8b021fa1L, - 0xe5a0cc0fL, 0xb56f74e8L, 0x18acf3d6L, 0xce89e299L, - 0xb4a84fe0L, 0xfd13e0b7L, 0x7cc43b81L, 0xd2ada8d9L, - 0x165fa266L, 0x80957705L, 0x93cc7314L, 0x211a1477L, - 0xe6ad2065L, 0x77b5fa86L, 0xc75442f5L, 0xfb9d35cfL, - 0xebcdaf0cL, 0x7b3e89a0L, 0xd6411bd3L, 0xae1e7e49L, - 0x00250e2dL, 0x2071b35eL, 0x226800bbL, 0x57b8e0afL, - 0x2464369bL, 0xf009b91eL, 0x5563911dL, 0x59dfa6aaL, - 0x78c14389L, 0xd95a537fL, 0x207d5ba2L, 0x02e5b9c5L, - 0x83260376L, 0x6295cfa9L, 0x11c81968L, 0x4e734a41L, - 0xb3472dcaL, 0x7b14a94aL, 0x1b510052L, 0x9a532915L, - 0xd60f573fL, 0xbc9bc6e4L, 0x2b60a476L, 0x81e67400L, - 0x08ba6fb5L, 0x571be91fL, 0xf296ec6bL, 0x2a0dd915L, - 0xb6636521L, 0xe7b9f9b6L, 0xff34052eL, 0xc5855664L, - 0x53b02d5dL, 0xa99f8fa1L, 0x08ba4799L, 0x6e85076aL, - 0x4b7a70e9L, 0xb5b32944L, 0xdb75092eL, 0xc4192623L, - 0xad6ea6b0L, 0x49a7df7dL, 0x9cee60b8L, 0x8fedb266L, - 0xecaa8c71L, 0x699a17ffL, 0x5664526cL, 0xc2b19ee1L, - 0x193602a5L, 0x75094c29L, 0xa0591340L, 0xe4183a3eL, - 0x3f54989aL, 0x5b429d65L, 0x6b8fe4d6L, 0x99f73fd6L, - 0xa1d29c07L, 0xefe830f5L, 0x4d2d38e6L, 0xf0255dc1L, - 0x4cdd2086L, 0x8470eb26L, 0x6382e9c6L, 0x021ecc5eL, - 0x09686b3fL, 0x3ebaefc9L, 0x3c971814L, 0x6b6a70a1L, - 0x687f3584L, 0x52a0e286L, 0xb79c5305L, 0xaa500737L, - 0x3e07841cL, 0x7fdeae5cL, 0x8e7d44ecL, 0x5716f2b8L, - 0xb03ada37L, 0xf0500c0dL, 0xf01c1f04L, 0x0200b3ffL, - 0xae0cf51aL, 0x3cb574b2L, 0x25837a58L, 0xdc0921bdL, - 0xd19113f9L, 0x7ca92ff6L, 0x94324773L, 0x22f54701L, - 0x3ae5e581L, 0x37c2dadcL, 0xc8b57634L, 0x9af3dda7L, - 0xa9446146L, 0x0fd0030eL, 0xecc8c73eL, 0xa4751e41L, - 0xe238cd99L, 0x3bea0e2fL, 0x3280bba1L, 0x183eb331L, - 0x4e548b38L, 0x4f6db908L, 0x6f420d03L, 0xf60a04bfL, - 0x2cb81290L, 0x24977c79L, 0x5679b072L, 0xbcaf89afL, - 0xde9a771fL, 0xd9930810L, 0xb38bae12L, 0xdccf3f2eL, - 0x5512721fL, 0x2e6b7124L, 0x501adde6L, 0x9f84cd87L, - 0x7a584718L, 0x7408da17L, 0xbc9f9abcL, 0xe94b7d8cL, - 0xec7aec3aL, 0xdb851dfaL, 0x63094366L, 0xc464c3d2L, - 0xef1c1847L, 0x3215d908L, 0xdd433b37L, 0x24c2ba16L, - 0x12a14d43L, 0x2a65c451L, 0x50940002L, 0x133ae4ddL, - 0x71dff89eL, 0x10314e55L, 0x81ac77d6L, 0x5f11199bL, - 0x043556f1L, 0xd7a3c76bL, 0x3c11183bL, 0x5924a509L, - 0xf28fe6edL, 0x97f1fbfaL, 0x9ebabf2cL, 0x1e153c6eL, - 0x86e34570L, 0xeae96fb1L, 0x860e5e0aL, 0x5a3e2ab3L, - 0x771fe71cL, 0x4e3d06faL, 0x2965dcb9L, 0x99e71d0fL, - 0x803e89d6L, 0x5266c825L, 0x2e4cc978L, 0x9c10b36aL, - 0xc6150ebaL, 0x94e2ea78L, 0xa5fc3c53L, 0x1e0a2df4L, - 0xf2f74ea7L, 0x361d2b3dL, 0x1939260fL, 0x19c27960L, - 0x5223a708L, 0xf71312b6L, 0xebadfe6eL, 0xeac31f66L, - 0xe3bc4595L, 0xa67bc883L, 0xb17f37d1L, 0x018cff28L, - 0xc332ddefL, 0xbe6c5aa5L, 0x65582185L, 0x68ab9802L, - 0xeecea50fL, 0xdb2f953bL, 0x2aef7dadL, 0x5b6e2f84L, - 0x1521b628L, 0x29076170L, 0xecdd4775L, 0x619f1510L, - 0x13cca830L, 0xeb61bd96L, 0x0334fe1eL, 0xaa0363cfL, - 0xb5735c90L, 0x4c70a239L, 0xd59e9e0bL, 0xcbaade14L, - 0xeecc86bcL, 0x60622ca7L, 0x9cab5cabL, 0xb2f3846eL, - 0x648b1eafL, 0x19bdf0caL, 0xa02369b9L, 0x655abb50L, - 0x40685a32L, 0x3c2ab4b3L, 0x319ee9d5L, 0xc021b8f7L, - 0x9b540b19L, 0x875fa099L, 0x95f7997eL, 0x623d7da8L, - 0xf837889aL, 0x97e32d77L, 0x11ed935fL, 0x16681281L, - 0x0e358829L, 0xc7e61fd6L, 0x96dedfa1L, 0x7858ba99L, - 0x57f584a5L, 0x1b227263L, 0x9b83c3ffL, 0x1ac24696L, - 0xcdb30aebL, 0x532e3054L, 0x8fd948e4L, 0x6dbc3128L, - 0x58ebf2efL, 0x34c6ffeaL, 0xfe28ed61L, 0xee7c3c73L, - 0x5d4a14d9L, 0xe864b7e3L, 0x42105d14L, 0x203e13e0L, - 0x45eee2b6L, 0xa3aaabeaL, 0xdb6c4f15L, 0xfacb4fd0L, - 0xc742f442L, 0xef6abbb5L, 0x654f3b1dL, 0x41cd2105L, - 0xd81e799eL, 0x86854dc7L, 0xe44b476aL, 0x3d816250L, - 0xcf62a1f2L, 0x5b8d2646L, 0xfc8883a0L, 0xc1c7b6a3L, - 0x7f1524c3L, 0x69cb7492L, 0x47848a0bL, 0x5692b285L, - 0x095bbf00L, 0xad19489dL, 0x1462b174L, 0x23820e00L, - 0x58428d2aL, 0x0c55f5eaL, 0x1dadf43eL, 0x233f7061L, - 0x3372f092L, 0x8d937e41L, 0xd65fecf1L, 0x6c223bdbL, - 0x7cde3759L, 0xcbee7460L, 0x4085f2a7L, 0xce77326eL, - 0xa6078084L, 0x19f8509eL, 0xe8efd855L, 0x61d99735L, - 0xa969a7aaL, 0xc50c06c2L, 0x5a04abfcL, 0x800bcadcL, - 0x9e447a2eL, 0xc3453484L, 0xfdd56705L, 0x0e1e9ec9L, - 0xdb73dbd3L, 0x105588cdL, 0x675fda79L, 0xe3674340L, - 0xc5c43465L, 0x713e38d8L, 0x3d28f89eL, 0xf16dff20L, - 0x153e21e7L, 0x8fb03d4aL, 0xe6e39f2bL, 0xdb83adf7L, - 0xe93d5a68L, 0x948140f7L, 0xf64c261cL, 0x94692934L, - 0x411520f7L, 0x7602d4f7L, 0xbcf46b2eL, 0xd4a20068L, - 0xd4082471L, 0x3320f46aL, 0x43b7d4b7L, 0x500061afL, - 0x1e39f62eL, 0x97244546L, 0x14214f74L, 0xbf8b8840L, - 0x4d95fc1dL, 0x96b591afL, 0x70f4ddd3L, 0x66a02f45L, - 0xbfbc09ecL, 0x03bd9785L, 0x7fac6dd0L, 0x31cb8504L, - 0x96eb27b3L, 0x55fd3941L, 0xda2547e6L, 0xabca0a9aL, - 0x28507825L, 0x530429f4L, 0x0a2c86daL, 0xe9b66dfbL, - 0x68dc1462L, 0xd7486900L, 0x680ec0a4L, 0x27a18deeL, - 0x4f3ffea2L, 0xe887ad8cL, 0xb58ce006L, 0x7af4d6b6L, - 0xaace1e7cL, 0xd3375fecL, 0xce78a399L, 0x406b2a42L, - 0x20fe9e35L, 0xd9f385b9L, 0xee39d7abL, 0x3b124e8bL, - 0x1dc9faf7L, 0x4b6d1856L, 0x26a36631L, 0xeae397b2L, - 0x3a6efa74L, 0xdd5b4332L, 0x6841e7f7L, 0xca7820fbL, - 0xfb0af54eL, 0xd8feb397L, 0x454056acL, 0xba489527L, - 0x55533a3aL, 0x20838d87L, 0xfe6ba9b7L, 0xd096954bL, - 0x55a867bcL, 0xa1159a58L, 0xcca92963L, 0x99e1db33L, - 0xa62a4a56L, 0x3f3125f9L, 0x5ef47e1cL, 0x9029317cL, - 0xfdf8e802L, 0x04272f70L, 0x80bb155cL, 0x05282ce3L, - 0x95c11548L, 0xe4c66d22L, 0x48c1133fL, 0xc70f86dcL, - 0x07f9c9eeL, 0x41041f0fL, 0x404779a4L, 0x5d886e17L, - 0x325f51ebL, 0xd59bc0d1L, 0xf2bcc18fL, 0x41113564L, - 0x257b7834L, 0x602a9c60L, 0xdff8e8a3L, 0x1f636c1bL, - 0x0e12b4c2L, 0x02e1329eL, 0xaf664fd1L, 0xcad18115L, - 0x6b2395e0L, 0x333e92e1L, 0x3b240b62L, 0xeebeb922L, - 0x85b2a20eL, 0xe6ba0d99L, 0xde720c8cL, 0x2da2f728L, - 0xd0127845L, 0x95b794fdL, 0x647d0862L, 0xe7ccf5f0L, - 0x5449a36fL, 0x877d48faL, 0xc39dfd27L, 0xf33e8d1eL, - 0x0a476341L, 0x992eff74L, 0x3a6f6eabL, 0xf4f8fd37L, - 0xa812dc60L, 0xa1ebddf8L, 0x991be14cL, 0xdb6e6b0dL, - 0xc67b5510L, 0x6d672c37L, 0x2765d43bL, 0xdcd0e804L, - 0xf1290dc7L, 0xcc00ffa3L, 0xb5390f92L, 0x690fed0bL, - 0x667b9ffbL, 0xcedb7d9cL, 0xa091cf0bL, 0xd9155ea3L, - 0xbb132f88L, 0x515bad24L, 0x7b9479bfL, 0x763bd6ebL, - 0x37392eb3L, 0xcc115979L, 0x8026e297L, 0xf42e312dL, - 0x6842ada7L, 0xc66a2b3bL, 0x12754cccL, 0x782ef11cL, - 0x6a124237L, 0xb79251e7L, 0x06a1bbe6L, 0x4bfb6350L, - 0x1a6b1018L, 0x11caedfaL, 0x3d25bdd8L, 0xe2e1c3c9L, - 0x44421659L, 0x0a121386L, 0xd90cec6eL, 0xd5abea2aL, - 0x64af674eL, 0xda86a85fL, 0xbebfe988L, 0x64e4c3feL, - 0x9dbc8057L, 0xf0f7c086L, 0x60787bf8L, 0x6003604dL, - 0xd1fd8346L, 0xf6381fb0L, 0x7745ae04L, 0xd736fcccL, - 0x83426b33L, 0xf01eab71L, 0xb0804187L, 0x3c005e5fL, - 0x77a057beL, 0xbde8ae24L, 0x55464299L, 0xbf582e61L, - 0x4e58f48fL, 0xf2ddfda2L, 0xf474ef38L, 0x8789bdc2L, - 0x5366f9c3L, 0xc8b38e74L, 0xb475f255L, 0x46fcd9b9L, - 0x7aeb2661L, 0x8b1ddf84L, 0x846a0e79L, 0x915f95e2L, - 0x466e598eL, 0x20b45770L, 0x8cd55591L, 0xc902de4cL, - 0xb90bace1L, 0xbb8205d0L, 0x11a86248L, 0x7574a99eL, - 0xb77f19b6L, 0xe0a9dc09L, 0x662d09a1L, 0xc4324633L, - 0xe85a1f02L, 0x09f0be8cL, 0x4a99a025L, 0x1d6efe10L, - 0x1ab93d1dL, 0x0ba5a4dfL, 0xa186f20fL, 0x2868f169L, - 0xdcb7da83L, 0x573906feL, 0xa1e2ce9bL, 0x4fcd7f52L, - 0x50115e01L, 0xa70683faL, 0xa002b5c4L, 0x0de6d027L, - 0x9af88c27L, 0x773f8641L, 0xc3604c06L, 0x61a806b5L, - 0xf0177a28L, 0xc0f586e0L, 0x006058aaL, 0x30dc7d62L, - 0x11e69ed7L, 0x2338ea63L, 0x53c2dd94L, 0xc2c21634L, - 0xbbcbee56L, 0x90bcb6deL, 0xebfc7da1L, 0xce591d76L, - 0x6f05e409L, 0x4b7c0188L, 0x39720a3dL, 0x7c927c24L, - 0x86e3725fL, 0x724d9db9L, 0x1ac15bb4L, 0xd39eb8fcL, - 0xed545578L, 0x08fca5b5L, 0xd83d7cd3L, 0x4dad0fc4L, - 0x1e50ef5eL, 0xb161e6f8L, 0xa28514d9L, 0x6c51133cL, - 0x6fd5c7e7L, 0x56e14ec4L, 0x362abfceL, 0xddc6c837L, - 0xd79a3234L, 0x92638212L, 0x670efa8eL, 0x406000e0L, - 0x3a39ce37L, 0xd3faf5cfL, 0xabc27737L, 0x5ac52d1bL, - 0x5cb0679eL, 0x4fa33742L, 0xd3822740L, 0x99bc9bbeL, - 0xd5118e9dL, 0xbf0f7315L, 0xd62d1c7eL, 0xc700c47bL, - 0xb78c1b6bL, 0x21a19045L, 0xb26eb1beL, 0x6a366eb4L, - 0x5748ab2fL, 0xbc946e79L, 0xc6a376d2L, 0x6549c2c8L, - 0x530ff8eeL, 0x468dde7dL, 0xd5730a1dL, 0x4cd04dc6L, - 0x2939bbdbL, 0xa9ba4650L, 0xac9526e8L, 0xbe5ee304L, - 0xa1fad5f0L, 0x6a2d519aL, 0x63ef8ce2L, 0x9a86ee22L, - 0xc089c2b8L, 0x43242ef6L, 0xa51e03aaL, 0x9cf2d0a4L, - 0x83c061baL, 0x9be96a4dL, 0x8fe51550L, 0xba645bd6L, - 0x2826a2f9L, 0xa73a3ae1L, 0x4ba99586L, 0xef5562e9L, - 0xc72fefd3L, 0xf752f7daL, 0x3f046f69L, 0x77fa0a59L, - 0x80e4a915L, 0x87b08601L, 0x9b09e6adL, 0x3b3ee593L, - 0xe990fd5aL, 0x9e34d797L, 0x2cf0b7d9L, 0x022b8b51L, - 0x96d5ac3aL, 0x017da67dL, 0xd1cf3ed6L, 0x7c7d2d28L, - 0x1f9f25cfL, 0xadf2b89bL, 0x5ad6b472L, 0x5a88f54cL, - 0xe029ac71L, 0xe019a5e6L, 0x47b0acfdL, 0xed93fa9bL, - 0xe8d3c48dL, 0x283b57ccL, 0xf8d56629L, 0x79132e28L, - 0x785f0191L, 0xed756055L, 0xf7960e44L, 0xe3d35e8cL, - 0x15056dd4L, 0x88f46dbaL, 0x03a16125L, 0x0564f0bdL, - 0xc3eb9e15L, 0x3c9057a2L, 0x97271aecL, 0xa93a072aL, - 0x1b3f6d9bL, 0x1e6321f5L, 0xf59c66fbL, 0x26dcf319L, - 0x7533d928L, 0xb155fdf5L, 0x03563482L, 0x8aba3cbbL, - 0x28517711L, 0xc20ad9f8L, 0xabcc5167L, 0xccad925fL, - 0x4de81751L, 0x3830dc8eL, 0x379d5862L, 0x9320f991L, - 0xea7a90c2L, 0xfb3e7bceL, 0x5121ce64L, 0x774fbe32L, - 0xa8b6e37eL, 0xc3293d46L, 0x48de5369L, 0x6413e680L, - 0xa2ae0810L, 0xdd6db224L, 0x69852dfdL, 0x09072166L, - 0xb39a460aL, 0x6445c0ddL, 0x586cdecfL, 0x1c20c8aeL, - 0x5bbef7ddL, 0x1b588d40L, 0xccd2017fL, 0x6bb4e3bbL, - 0xdda26a7eL, 0x3a59ff45L, 0x3e350a44L, 0xbcb4cdd5L, - 0x72eacea8L, 0xfa6484bbL, 0x8d6612aeL, 0xbf3c6f47L, - 0xd29be463L, 0x542f5d9eL, 0xaec2771bL, 0xf64e6370L, - 0x740e0d8dL, 0xe75b1357L, 0xf8721671L, 0xaf537d5dL, - 0x4040cb08L, 0x4eb4e2ccL, 0x34d2466aL, 0x0115af84L, - 0xe1b00428L, 0x95983a1dL, 0x06b89fb4L, 0xce6ea048L, - 0x6f3f3b82L, 0x3520ab82L, 0x011a1d4bL, 0x277227f8L, - 0x611560b1L, 0xe7933fdcL, 0xbb3a792bL, 0x344525bdL, - 0xa08839e1L, 0x51ce794bL, 0x2f32c9b7L, 0xa01fbac9L, - 0xe01cc87eL, 0xbcc7d1f6L, 0xcf0111c3L, 0xa1e8aac7L, - 0x1a908749L, 0xd44fbd9aL, 0xd0dadecbL, 0xd50ada38L, - 0x0339c32aL, 0xc6913667L, 0x8df9317cL, 0xe0b12b4fL, - 0xf79e59b7L, 0x43f5bb3aL, 0xf2d519ffL, 0x27d9459cL, - 0xbf97222cL, 0x15e6fc2aL, 0x0f91fc71L, 0x9b941525L, - 0xfae59361L, 0xceb69cebL, 0xc2a86459L, 0x12baa8d1L, - 0xb6c1075eL, 0xe3056a0cL, 0x10d25065L, 0xcb03a442L, - 0xe0ec6e0eL, 0x1698db3bL, 0x4c98a0beL, 0x3278e964L, - 0x9f1f9532L, 0xe0d392dfL, 0xd3a0342bL, 0x8971f21eL, - 0x1b0a7441L, 0x4ba3348cL, 0xc5be7120L, 0xc37632d8L, - 0xdf359f8dL, 0x9b992f2eL, 0xe60b6f47L, 0x0fe3f11dL, - 0xe54cda54L, 0x1edad891L, 0xce6279cfL, 0xcd3e7e6fL, - 0x1618b166L, 0xfd2c1d05L, 0x848fd2c5L, 0xf6fb2299L, - 0xf523f357L, 0xa6327623L, 0x93a83531L, 0x56cccd02L, - 0xacf08162L, 0x5a75ebb5L, 0x6e163697L, 0x88d273ccL, - 0xde966292L, 0x81b949d0L, 0x4c50901bL, 0x71c65614L, - 0xe6c6c7bdL, 0x327a140aL, 0x45e1d006L, 0xc3f27b9aL, - 0xc9aa53fdL, 0x62a80f00L, 0xbb25bfe2L, 0x35bdd2f6L, - 0x71126905L, 0xb2040222L, 0xb6cbcf7cL, 0xcd769c2bL, - 0x53113ec0L, 0x1640e3d3L, 0x38abbd60L, 0x2547adf0L, - 0xba38209cL, 0xf746ce76L, 0x77afa1c5L, 0x20756060L, - 0x85cbfe4eL, 0x8ae88dd8L, 0x7aaaf9b0L, 0x4cf9aa7eL, - 0x1948c25cL, 0x02fb8a8cL, 0x01c36ae4L, 0xd6ebe1f9L, - 0x90d4f869L, 0xa65cdea0L, 0x3f09252dL, 0xc208e69fL, - 0xb74e6132L, 0xce77e25bL, 0x578fdfe3L, 0x3ac372e6L, - } - }; - diff --git a/src/utils/crypto/bf_skey.c b/src/utils/crypto/bf_skey.c deleted file mode 100644 index 5926293aab3..00000000000 --- a/src/utils/crypto/bf_skey.c +++ /dev/null @@ -1,118 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/bf/bf_skey.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include -#include - -#include "blowfish.h" -#include "bf_locl.h" -#include "bf_pi.h" - -void BF_set_key(BF_KEY *key, int len, unsigned char *data) - { - int i; - BF_LONG *p,ri,in[2]; - unsigned char *d,*end; - - - memcpy((char *)key,(char *)&bf_init,sizeof(BF_KEY)); - p=key->P; - - if (len > ((BF_ROUNDS+2)*4)) len=(BF_ROUNDS+2)*4; - - d=data; - end= &(data[len]); - for (i=0; i<(BF_ROUNDS+2); i++) - { - ri= *(d++); - if (d >= end) d=data; - - ri<<=8; - ri|= *(d++); - if (d >= end) d=data; - - ri<<=8; - ri|= *(d++); - if (d >= end) d=data; - - ri<<=8; - ri|= *(d++); - if (d >= end) d=data; - - p[i]^=ri; - } - - in[0]=0L; - in[1]=0L; - for (i=0; i<(BF_ROUNDS+2); i+=2) - { - BF_encrypt(in,key); - p[i ]=in[0]; - p[i+1]=in[1]; - } - - p=key->S; - for (i=0; i<4*256; i+=2) - { - BF_encrypt(in,key); - p[i ]=in[0]; - p[i+1]=in[1]; - } - } diff --git a/src/utils/crypto/blowfish.h b/src/utils/crypto/blowfish.h deleted file mode 100644 index e54bfefccdb..00000000000 --- a/src/utils/crypto/blowfish.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/bf/blowfish.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_BLOWFISH_H -#define HEADER_BLOWFISH_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define BF_ENCRYPT 1 -#define BF_DECRYPT 0 - -/* If you make this 'unsigned int' the pointer variants will work on - * the Alpha, otherwise they will not. Strangly using the '8 byte' - * BF_LONG and the default 'non-pointer' inner loop is the best configuration - * for the Alpha */ -#define BF_LONG uint32_t - -#define BF_ROUNDS 16 -#define BF_BLOCK 8 - -typedef struct bf_key_st - { - BF_LONG P[BF_ROUNDS+2]; - BF_LONG S[4*256]; - } BF_KEY; - -#ifndef NOPROTO - -void BF_set_key(BF_KEY *key, int len, unsigned char *data); -void BF_ecb_encrypt(unsigned char *in,unsigned char *out,BF_KEY *key, int enc); -void BF_ecb_le_encrypt(unsigned char *in, unsigned char *out, BF_KEY *ks, int encrypt); -void BF_encrypt(BF_LONG *data,BF_KEY *key); -void BF_decrypt(BF_LONG *data,BF_KEY *key); -void BF_cbc_encrypt(unsigned char *in, unsigned char *out, long length, - BF_KEY *ks, unsigned char *iv, int enc); -void BF_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, - BF_KEY *schedule, unsigned char *ivec, int *num, int enc); -void BF_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, - BF_KEY *schedule, unsigned char *ivec, int *num); -char *BF_options(void); - -#else - -void BF_set_key(); -void BF_ecb_encrypt(); -void BF_encrypt(); -void BF_decrypt(); -void BF_cbc_encrypt(); -void BF_cfb64_encrypt(); -void BF_ofb64_encrypt(); -char *BF_options(); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/crypto/c_ecb.c b/src/utils/crypto/c_ecb.c deleted file mode 100644 index 1beb7910777..00000000000 --- a/src/utils/crypto/c_ecb.c +++ /dev/null @@ -1,80 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/cast/cast_ecb.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include "cast.h" -#include "cast_lcl.h" - - -char *CAST_version="CAST part of SSLeay 0.8.2b 08-Jan-1998"; - -void CAST_ecb_encrypt(unsigned char *in, unsigned char *out, CAST_KEY *ks, int encrypt) - { - CAST_LONG l,d[2]; - - n2l(in,l); d[0]=l; - n2l(in,l); d[1]=l; - if (encrypt) - CAST_encrypt(d,ks); - else - CAST_decrypt(d,ks); - l=d[0]; l2n(l,out); - l=d[1]; l2n(l,out); - l=d[0]=d[1]=0; - } diff --git a/src/utils/crypto/c_enc.c b/src/utils/crypto/c_enc.c deleted file mode 100644 index 258bfa92cea..00000000000 --- a/src/utils/crypto/c_enc.c +++ /dev/null @@ -1,201 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/cast/c_enc.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include "cast.h" -#include "cast_lcl.h" - -void CAST_encrypt(CAST_LONG *data, CAST_KEY *key) - { - register CAST_LONG l,r,*k,t; - - k= &(key->data[0]); - l=data[0]; - r=data[1]; - - E_CAST( 0,k,l,r,+,^,-); - E_CAST( 1,k,r,l,^,-,+); - E_CAST( 2,k,l,r,-,+,^); - E_CAST( 3,k,r,l,+,^,-); - E_CAST( 4,k,l,r,^,-,+); - E_CAST( 5,k,r,l,-,+,^); - E_CAST( 6,k,l,r,+,^,-); - E_CAST( 7,k,r,l,^,-,+); - E_CAST( 8,k,l,r,-,+,^); - E_CAST( 9,k,r,l,+,^,-); - E_CAST(10,k,l,r,^,-,+); - E_CAST(11,k,r,l,-,+,^); - E_CAST(12,k,l,r,+,^,-); - E_CAST(13,k,r,l,^,-,+); - E_CAST(14,k,l,r,-,+,^); - E_CAST(15,k,r,l,+,^,-); - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; - } - -void CAST_decrypt(CAST_LONG *data, CAST_KEY *key) - { - register CAST_LONG l,r,*k,t; - - k= &(key->data[0]); - l=data[0]; - r=data[1]; - - E_CAST(15,k,l,r,+,^,-); - E_CAST(14,k,r,l,-,+,^); - E_CAST(13,k,l,r,^,-,+); - E_CAST(12,k,r,l,+,^,-); - E_CAST(11,k,l,r,-,+,^); - E_CAST(10,k,r,l,^,-,+); - E_CAST( 9,k,l,r,+,^,-); - E_CAST( 8,k,r,l,-,+,^); - E_CAST( 7,k,l,r,^,-,+); - E_CAST( 6,k,r,l,+,^,-); - E_CAST( 5,k,l,r,-,+,^); - E_CAST( 4,k,r,l,^,-,+); - E_CAST( 3,k,l,r,+,^,-); - E_CAST( 2,k,r,l,-,+,^); - E_CAST( 1,k,l,r,^,-,+); - E_CAST( 0,k,r,l,+,^,-); - - data[1]=l&0xffffffffL; - data[0]=r&0xffffffffL; - } - -void CAST_cbc_encrypt(unsigned char *in, unsigned char *out, long length, CAST_KEY *ks, unsigned char *iv, int encrypt) - { - register CAST_LONG tin0,tin1; - register CAST_LONG tout0,tout1,xor0,xor1; - register long l=length; - CAST_LONG tin[2]; - - if (encrypt) - { - n2l(iv,tout0); - n2l(iv,tout1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - CAST_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - if (l != -8) - { - n2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - tin[0]=tin0; - tin[1]=tin1; - CAST_encrypt(tin,ks); - tout0=tin[0]; - tout1=tin[1]; - l2n(tout0,out); - l2n(tout1,out); - } - l2n(tout0,iv); - l2n(tout1,iv); - } - else - { - n2l(iv,xor0); - n2l(iv,xor1); - iv-=8; - for (l-=8; l>=0; l-=8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - CAST_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2n(tout0,out); - l2n(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - n2l(in,tin0); - n2l(in,tin1); - tin[0]=tin0; - tin[1]=tin1; - CAST_decrypt(tin,ks); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2nn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - l2n(xor0,iv); - l2n(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } diff --git a/src/utils/crypto/c_skey.c b/src/utils/crypto/c_skey.c deleted file mode 100644 index 498a68b3539..00000000000 --- a/src/utils/crypto/c_skey.c +++ /dev/null @@ -1,164 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/cast/c_skey.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - - -#include "cast.h" -#include "cast_lcl.h" -#include "cast_s.h" - -#define CAST_exp(l,A,a,n) \ - A[n/4]=l; \ - a[n+3]=(l )&0xff; \ - a[n+2]=(l>> 8)&0xff; \ - a[n+1]=(l>>16)&0xff; \ - a[n+0]=(l>>24); - -#define S4 CAST_S_table4 -#define S5 CAST_S_table5 -#define S6 CAST_S_table6 -#define S7 CAST_S_table7 - -void CAST_set_key(CAST_KEY *key, int len, unsigned char *data) - { - CAST_LONG x[16]; - CAST_LONG z[16]; - CAST_LONG k[32]; - CAST_LONG X[4],Z[4]; - CAST_LONG l,*K; - int i; - - for (i=0; i<16; i++) x[i]=0; - if (len > 16) len=16; - for (i=0; idata[i*2]=k[i]; - key->data[i*2+1]=((k[i+16])+16)&0x1f; - } - } diff --git a/src/utils/crypto/cast.h b/src/utils/crypto/cast.h deleted file mode 100644 index b1008fb9d4b..00000000000 --- a/src/utils/crypto/cast.h +++ /dev/null @@ -1,113 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/cast/cast.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifndef HEADER_CAST_H -#define HEADER_CAST_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define CAST_ENCRYPT 1 -#define CAST_DECRYPT 0 - -#define CAST_LONG uint32_t - -#define CAST_BLOCK 8 -#define CAST_KEY_LENGTH 16 - -typedef struct cast_key_st - { - CAST_LONG data[32]; - } CAST_KEY; - -#ifndef NOPROTO - -void CAST_set_key(CAST_KEY *key, int len, unsigned char *data); -void CAST_ecb_encrypt(unsigned char *in,unsigned char *out,CAST_KEY *key, - int enc); -void CAST_encrypt(CAST_LONG *data,CAST_KEY *key); -void CAST_decrypt(CAST_LONG *data,CAST_KEY *key); -void CAST_cbc_encrypt(unsigned char *in, unsigned char *out, long length, - CAST_KEY *ks, unsigned char *iv, int enc); -void CAST_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, - CAST_KEY *schedule, unsigned char *ivec, int *num, int enc); -void CAST_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, - CAST_KEY *schedule, unsigned char *ivec, int *num); - -#else - -void CAST_set_key(); -void CAST_ecb_encrypt(); -void CAST_encrypt(); -void CAST_decrypt(); -void CAST_cbc_encrypt(); -void CAST_cfb64_encrypt(); -void CAST_ofb64_encrypt(); - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/crypto/cast_lcl.h b/src/utils/crypto/cast_lcl.h deleted file mode 100644 index e757c21efe1..00000000000 --- a/src/utils/crypto/cast_lcl.h +++ /dev/null @@ -1,225 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/rc2/rc2_locl.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#ifdef WIN32 -#include -#endif - -#undef c2l -#define c2l(c,l) (l =((uint32_t)(*((c)++))) , \ - l|=((uint32_t)(*((c)++)))<< 8L, \ - l|=((uint32_t)(*((c)++)))<<16L, \ - l|=((uint32_t)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#undef c2ln -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((uint32_t)(*(--(c))))<<24L; \ - case 7: l2|=((uint32_t)(*(--(c))))<<16L; \ - case 6: l2|=((uint32_t)(*(--(c))))<< 8L; \ - case 5: l2|=((uint32_t)(*(--(c)))); \ - case 4: l1 =((uint32_t)(*(--(c))))<<24L; \ - case 3: l1|=((uint32_t)(*(--(c))))<<16L; \ - case 2: l1|=((uint32_t)(*(--(c))))<< 8L; \ - case 1: l1|=((uint32_t)(*(--(c)))); \ - } \ - } - -#undef l2c -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#undef l2cn -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -/* NOTE - c is not incremented as per n2l */ -#define n2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((uint32_t)(*(--(c)))) ; \ - case 7: l2|=((uint32_t)(*(--(c))))<< 8; \ - case 6: l2|=((uint32_t)(*(--(c))))<<16; \ - case 5: l2|=((uint32_t)(*(--(c))))<<24; \ - case 4: l1 =((uint32_t)(*(--(c)))) ; \ - case 3: l1|=((uint32_t)(*(--(c))))<< 8; \ - case 2: l1|=((uint32_t)(*(--(c))))<<16; \ - case 1: l1|=((uint32_t)(*(--(c))))<<24; \ - } \ - } - -/* NOTE - c is not incremented as per l2n */ -#define l2nn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>> 8)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>>16)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2)>>24)&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1) )&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>> 8)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>>16)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1)>>24)&0xff); \ - } \ - } - -#undef n2l -#define n2l(c,l) (l =((uint32_t)(*((c)++)))<<24L, \ - l|=((uint32_t)(*((c)++)))<<16L, \ - l|=((uint32_t)(*((c)++)))<< 8L, \ - l|=((uint32_t)(*((c)++)))) - -#undef l2n -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -//#if defined(WIN32) -//#define ROTL(a,n) (_lrotl(a,n)) -//#else -#define ROTL(a,n) (((a)<<(n))|((a)>>(32-(n)))) -//#endif - -#define C_M 0x3fc -#define C_0 22L -#define C_1 14L -#define C_2 6L -#define C_3 2L /* left shift */ - -/* The rotate has an extra 16 added to it to help the x86 asm */ -#if defined(CAST_PTR) -#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ - { \ - int i; \ - t=key[n*2] OP1 R; \ - i=key[n*2+1]; \ - t=ROTL(t,i); \ - L^= ((( *(CAST_LONG *)((unsigned char *) \ - CAST_S_table0+((t>>C_2)&C_M)) OP2 \ - *(CAST_LONG *)((unsigned char *) \ - CAST_S_table1+((t<>C_0)&C_M))) OP1 \ - *(CAST_LONG *)((unsigned char *) \ - CAST_S_table3+((t>>C_1)&C_M))); \ - } -#elif defined(CAST_PTR2) -#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ - { \ - int i; \ - CAST_LONG u,v,w; \ - w=key[n*2] OP1 R; \ - i=key[n*2+1]; \ - w=ROTL(w,i); \ - u=w>>C_2; \ - v=w<>C_0; \ - t=t OP2 *(CAST_LONG *)((unsigned char *)CAST_S_table1+v); \ - v=w>>C_1; \ - u&=C_M; \ - v&=C_M; \ - t=t OP3 *(CAST_LONG *)((unsigned char *)CAST_S_table2+u); \ - t=t OP1 *(CAST_LONG *)((unsigned char *)CAST_S_table3+v); \ - L^=t; \ - } -#else -#define E_CAST(n,key,L,R,OP1,OP2,OP3) \ - { \ - CAST_LONG a,b,c,d; \ - t=key[n*2] OP1 R; \ - t=ROTL(t,(key[n*2+1])); \ - a=CAST_S_table0[(t>> 8)&0xff]; \ - b=CAST_S_table1[(t )&0xff]; \ - c=CAST_S_table2[(t>>24)&0xff]; \ - d=CAST_S_table3[(t>>16)&0xff]; \ - L^=(((a OP2 b) OP3 c) OP1 d); \ - } -#endif - -extern CAST_LONG CAST_S_table0[256]; -extern CAST_LONG CAST_S_table1[256]; -extern CAST_LONG CAST_S_table2[256]; -extern CAST_LONG CAST_S_table3[256]; -extern CAST_LONG CAST_S_table4[256]; -extern CAST_LONG CAST_S_table5[256]; -extern CAST_LONG CAST_S_table6[256]; -extern CAST_LONG CAST_S_table7[256]; diff --git a/src/utils/crypto/cast_s.h b/src/utils/crypto/cast_s.h deleted file mode 100644 index 5841ee13459..00000000000 --- a/src/utils/crypto/cast_s.h +++ /dev/null @@ -1,530 +0,0 @@ -/* Deprecated/legacy */ - -CAST_LONG CAST_S_table0[256]={ - 0x30fb40d4,0x9fa0ff0b,0x6beccd2f,0x3f258c7a, - 0x1e213f2f,0x9c004dd3,0x6003e540,0xcf9fc949, - 0xbfd4af27,0x88bbbdb5,0xe2034090,0x98d09675, - 0x6e63a0e0,0x15c361d2,0xc2e7661d,0x22d4ff8e, - 0x28683b6f,0xc07fd059,0xff2379c8,0x775f50e2, - 0x43c340d3,0xdf2f8656,0x887ca41a,0xa2d2bd2d, - 0xa1c9e0d6,0x346c4819,0x61b76d87,0x22540f2f, - 0x2abe32e1,0xaa54166b,0x22568e3a,0xa2d341d0, - 0x66db40c8,0xa784392f,0x004dff2f,0x2db9d2de, - 0x97943fac,0x4a97c1d8,0x527644b7,0xb5f437a7, - 0xb82cbaef,0xd751d159,0x6ff7f0ed,0x5a097a1f, - 0x827b68d0,0x90ecf52e,0x22b0c054,0xbc8e5935, - 0x4b6d2f7f,0x50bb64a2,0xd2664910,0xbee5812d, - 0xb7332290,0xe93b159f,0xb48ee411,0x4bff345d, - 0xfd45c240,0xad31973f,0xc4f6d02e,0x55fc8165, - 0xd5b1caad,0xa1ac2dae,0xa2d4b76d,0xc19b0c50, - 0x882240f2,0x0c6e4f38,0xa4e4bfd7,0x4f5ba272, - 0x564c1d2f,0xc59c5319,0xb949e354,0xb04669fe, - 0xb1b6ab8a,0xc71358dd,0x6385c545,0x110f935d, - 0x57538ad5,0x6a390493,0xe63d37e0,0x2a54f6b3, - 0x3a787d5f,0x6276a0b5,0x19a6fcdf,0x7a42206a, - 0x29f9d4d5,0xf61b1891,0xbb72275e,0xaa508167, - 0x38901091,0xc6b505eb,0x84c7cb8c,0x2ad75a0f, - 0x874a1427,0xa2d1936b,0x2ad286af,0xaa56d291, - 0xd7894360,0x425c750d,0x93b39e26,0x187184c9, - 0x6c00b32d,0x73e2bb14,0xa0bebc3c,0x54623779, - 0x64459eab,0x3f328b82,0x7718cf82,0x59a2cea6, - 0x04ee002e,0x89fe78e6,0x3fab0950,0x325ff6c2, - 0x81383f05,0x6963c5c8,0x76cb5ad6,0xd49974c9, - 0xca180dcf,0x380782d5,0xc7fa5cf6,0x8ac31511, - 0x35e79e13,0x47da91d0,0xf40f9086,0xa7e2419e, - 0x31366241,0x051ef495,0xaa573b04,0x4a805d8d, - 0x548300d0,0x00322a3c,0xbf64cddf,0xba57a68e, - 0x75c6372b,0x50afd341,0xa7c13275,0x915a0bf5, - 0x6b54bfab,0x2b0b1426,0xab4cc9d7,0x449ccd82, - 0xf7fbf265,0xab85c5f3,0x1b55db94,0xaad4e324, - 0xcfa4bd3f,0x2deaa3e2,0x9e204d02,0xc8bd25ac, - 0xeadf55b3,0xd5bd9e98,0xe31231b2,0x2ad5ad6c, - 0x954329de,0xadbe4528,0xd8710f69,0xaa51c90f, - 0xaa786bf6,0x22513f1e,0xaa51a79b,0x2ad344cc, - 0x7b5a41f0,0xd37cfbad,0x1b069505,0x41ece491, - 0xb4c332e6,0x032268d4,0xc9600acc,0xce387e6d, - 0xbf6bb16c,0x6a70fb78,0x0d03d9c9,0xd4df39de, - 0xe01063da,0x4736f464,0x5ad328d8,0xb347cc96, - 0x75bb0fc3,0x98511bfb,0x4ffbcc35,0xb58bcf6a, - 0xe11f0abc,0xbfc5fe4a,0xa70aec10,0xac39570a, - 0x3f04442f,0x6188b153,0xe0397a2e,0x5727cb79, - 0x9ceb418f,0x1cacd68d,0x2ad37c96,0x0175cb9d, - 0xc69dff09,0xc75b65f0,0xd9db40d8,0xec0e7779, - 0x4744ead4,0xb11c3274,0xdd24cb9e,0x7e1c54bd, - 0xf01144f9,0xd2240eb1,0x9675b3fd,0xa3ac3755, - 0xd47c27af,0x51c85f4d,0x56907596,0xa5bb15e6, - 0x580304f0,0xca042cf1,0x011a37ea,0x8dbfaadb, - 0x35ba3e4a,0x3526ffa0,0xc37b4d09,0xbc306ed9, - 0x98a52666,0x5648f725,0xff5e569d,0x0ced63d0, - 0x7c63b2cf,0x700b45e1,0xd5ea50f1,0x85a92872, - 0xaf1fbda7,0xd4234870,0xa7870bf3,0x2d3b4d79, - 0x42e04198,0x0cd0ede7,0x26470db8,0xf881814c, - 0x474d6ad7,0x7c0c5e5c,0xd1231959,0x381b7298, - 0xf5d2f4db,0xab838653,0x6e2f1e23,0x83719c9e, - 0xbd91e046,0x9a56456e,0xdc39200c,0x20c8c571, - 0x962bda1c,0xe1e696ff,0xb141ab08,0x7cca89b9, - 0x1a69e783,0x02cc4843,0xa2f7c579,0x429ef47d, - 0x427b169c,0x5ac9f049,0xdd8f0f00,0x5c8165bf, - }; -CAST_LONG CAST_S_table1[256]={ - 0x1f201094,0xef0ba75b,0x69e3cf7e,0x393f4380, - 0xfe61cf7a,0xeec5207a,0x55889c94,0x72fc0651, - 0xada7ef79,0x4e1d7235,0xd55a63ce,0xde0436ba, - 0x99c430ef,0x5f0c0794,0x18dcdb7d,0xa1d6eff3, - 0xa0b52f7b,0x59e83605,0xee15b094,0xe9ffd909, - 0xdc440086,0xef944459,0xba83ccb3,0xe0c3cdfb, - 0xd1da4181,0x3b092ab1,0xf997f1c1,0xa5e6cf7b, - 0x01420ddb,0xe4e7ef5b,0x25a1ff41,0xe180f806, - 0x1fc41080,0x179bee7a,0xd37ac6a9,0xfe5830a4, - 0x98de8b7f,0x77e83f4e,0x79929269,0x24fa9f7b, - 0xe113c85b,0xacc40083,0xd7503525,0xf7ea615f, - 0x62143154,0x0d554b63,0x5d681121,0xc866c359, - 0x3d63cf73,0xcee234c0,0xd4d87e87,0x5c672b21, - 0x071f6181,0x39f7627f,0x361e3084,0xe4eb573b, - 0x602f64a4,0xd63acd9c,0x1bbc4635,0x9e81032d, - 0x2701f50c,0x99847ab4,0xa0e3df79,0xba6cf38c, - 0x10843094,0x2537a95e,0xf46f6ffe,0xa1ff3b1f, - 0x208cfb6a,0x8f458c74,0xd9e0a227,0x4ec73a34, - 0xfc884f69,0x3e4de8df,0xef0e0088,0x3559648d, - 0x8a45388c,0x1d804366,0x721d9bfd,0xa58684bb, - 0xe8256333,0x844e8212,0x128d8098,0xfed33fb4, - 0xce280ae1,0x27e19ba5,0xd5a6c252,0xe49754bd, - 0xc5d655dd,0xeb667064,0x77840b4d,0xa1b6a801, - 0x84db26a9,0xe0b56714,0x21f043b7,0xe5d05860, - 0x54f03084,0x066ff472,0xa31aa153,0xdadc4755, - 0xb5625dbf,0x68561be6,0x83ca6b94,0x2d6ed23b, - 0xeccf01db,0xa6d3d0ba,0xb6803d5c,0xaf77a709, - 0x33b4a34c,0x397bc8d6,0x5ee22b95,0x5f0e5304, - 0x81ed6f61,0x20e74364,0xb45e1378,0xde18639b, - 0x881ca122,0xb96726d1,0x8049a7e8,0x22b7da7b, - 0x5e552d25,0x5272d237,0x79d2951c,0xc60d894c, - 0x488cb402,0x1ba4fe5b,0xa4b09f6b,0x1ca815cf, - 0xa20c3005,0x8871df63,0xb9de2fcb,0x0cc6c9e9, - 0x0beeff53,0xe3214517,0xb4542835,0x9f63293c, - 0xee41e729,0x6e1d2d7c,0x50045286,0x1e6685f3, - 0xf33401c6,0x30a22c95,0x31a70850,0x60930f13, - 0x73f98417,0xa1269859,0xec645c44,0x52c877a9, - 0xcdff33a6,0xa02b1741,0x7cbad9a2,0x2180036f, - 0x50d99c08,0xcb3f4861,0xc26bd765,0x64a3f6ab, - 0x80342676,0x25a75e7b,0xe4e6d1fc,0x20c710e6, - 0xcdf0b680,0x17844d3b,0x31eef84d,0x7e0824e4, - 0x2ccb49eb,0x846a3bae,0x8ff77888,0xee5d60f6, - 0x7af75673,0x2fdd5cdb,0xa11631c1,0x30f66f43, - 0xb3faec54,0x157fd7fa,0xef8579cc,0xd152de58, - 0xdb2ffd5e,0x8f32ce19,0x306af97a,0x02f03ef8, - 0x99319ad5,0xc242fa0f,0xa7e3ebb0,0xc68e4906, - 0xb8da230c,0x80823028,0xdcdef3c8,0xd35fb171, - 0x088a1bc8,0xbec0c560,0x61a3c9e8,0xbca8f54d, - 0xc72feffa,0x22822e99,0x82c570b4,0xd8d94e89, - 0x8b1c34bc,0x301e16e6,0x273be979,0xb0ffeaa6, - 0x61d9b8c6,0x00b24869,0xb7ffce3f,0x08dc283b, - 0x43daf65a,0xf7e19798,0x7619b72f,0x8f1c9ba4, - 0xdc8637a0,0x16a7d3b1,0x9fc393b7,0xa7136eeb, - 0xc6bcc63e,0x1a513742,0xef6828bc,0x520365d6, - 0x2d6a77ab,0x3527ed4b,0x821fd216,0x095c6e2e, - 0xdb92f2fb,0x5eea29cb,0x145892f5,0x91584f7f, - 0x5483697b,0x2667a8cc,0x85196048,0x8c4bacea, - 0x833860d4,0x0d23e0f9,0x6c387e8a,0x0ae6d249, - 0xb284600c,0xd835731d,0xdcb1c647,0xac4c56ea, - 0x3ebd81b3,0x230eabb0,0x6438bc87,0xf0b5b1fa, - 0x8f5ea2b3,0xfc184642,0x0a036b7a,0x4fb089bd, - 0x649da589,0xa345415e,0x5c038323,0x3e5d3bb9, - 0x43d79572,0x7e6dd07c,0x06dfdf1e,0x6c6cc4ef, - 0x7160a539,0x73bfbe70,0x83877605,0x4523ecf1, - }; -CAST_LONG CAST_S_table2[256]={ - 0x8defc240,0x25fa5d9f,0xeb903dbf,0xe810c907, - 0x47607fff,0x369fe44b,0x8c1fc644,0xaececa90, - 0xbeb1f9bf,0xeefbcaea,0xe8cf1950,0x51df07ae, - 0x920e8806,0xf0ad0548,0xe13c8d83,0x927010d5, - 0x11107d9f,0x07647db9,0xb2e3e4d4,0x3d4f285e, - 0xb9afa820,0xfade82e0,0xa067268b,0x8272792e, - 0x553fb2c0,0x489ae22b,0xd4ef9794,0x125e3fbc, - 0x21fffcee,0x825b1bfd,0x9255c5ed,0x1257a240, - 0x4e1a8302,0xbae07fff,0x528246e7,0x8e57140e, - 0x3373f7bf,0x8c9f8188,0xa6fc4ee8,0xc982b5a5, - 0xa8c01db7,0x579fc264,0x67094f31,0xf2bd3f5f, - 0x40fff7c1,0x1fb78dfc,0x8e6bd2c1,0x437be59b, - 0x99b03dbf,0xb5dbc64b,0x638dc0e6,0x55819d99, - 0xa197c81c,0x4a012d6e,0xc5884a28,0xccc36f71, - 0xb843c213,0x6c0743f1,0x8309893c,0x0feddd5f, - 0x2f7fe850,0xd7c07f7e,0x02507fbf,0x5afb9a04, - 0xa747d2d0,0x1651192e,0xaf70bf3e,0x58c31380, - 0x5f98302e,0x727cc3c4,0x0a0fb402,0x0f7fef82, - 0x8c96fdad,0x5d2c2aae,0x8ee99a49,0x50da88b8, - 0x8427f4a0,0x1eac5790,0x796fb449,0x8252dc15, - 0xefbd7d9b,0xa672597d,0xada840d8,0x45f54504, - 0xfa5d7403,0xe83ec305,0x4f91751a,0x925669c2, - 0x23efe941,0xa903f12e,0x60270df2,0x0276e4b6, - 0x94fd6574,0x927985b2,0x8276dbcb,0x02778176, - 0xf8af918d,0x4e48f79e,0x8f616ddf,0xe29d840e, - 0x842f7d83,0x340ce5c8,0x96bbb682,0x93b4b148, - 0xef303cab,0x984faf28,0x779faf9b,0x92dc560d, - 0x224d1e20,0x8437aa88,0x7d29dc96,0x2756d3dc, - 0x8b907cee,0xb51fd240,0xe7c07ce3,0xe566b4a1, - 0xc3e9615e,0x3cf8209d,0x6094d1e3,0xcd9ca341, - 0x5c76460e,0x00ea983b,0xd4d67881,0xfd47572c, - 0xf76cedd9,0xbda8229c,0x127dadaa,0x438a074e, - 0x1f97c090,0x081bdb8a,0x93a07ebe,0xb938ca15, - 0x97b03cff,0x3dc2c0f8,0x8d1ab2ec,0x64380e51, - 0x68cc7bfb,0xd90f2788,0x12490181,0x5de5ffd4, - 0xdd7ef86a,0x76a2e214,0xb9a40368,0x925d958f, - 0x4b39fffa,0xba39aee9,0xa4ffd30b,0xfaf7933b, - 0x6d498623,0x193cbcfa,0x27627545,0x825cf47a, - 0x61bd8ba0,0xd11e42d1,0xcead04f4,0x127ea392, - 0x10428db7,0x8272a972,0x9270c4a8,0x127de50b, - 0x285ba1c8,0x3c62f44f,0x35c0eaa5,0xe805d231, - 0x428929fb,0xb4fcdf82,0x4fb66a53,0x0e7dc15b, - 0x1f081fab,0x108618ae,0xfcfd086d,0xf9ff2889, - 0x694bcc11,0x236a5cae,0x12deca4d,0x2c3f8cc5, - 0xd2d02dfe,0xf8ef5896,0xe4cf52da,0x95155b67, - 0x494a488c,0xb9b6a80c,0x5c8f82bc,0x89d36b45, - 0x3a609437,0xec00c9a9,0x44715253,0x0a874b49, - 0xd773bc40,0x7c34671c,0x02717ef6,0x4feb5536, - 0xa2d02fff,0xd2bf60c4,0xd43f03c0,0x50b4ef6d, - 0x07478cd1,0x006e1888,0xa2e53f55,0xb9e6d4bc, - 0xa2048016,0x97573833,0xd7207d67,0xde0f8f3d, - 0x72f87b33,0xabcc4f33,0x7688c55d,0x7b00a6b0, - 0x947b0001,0x570075d2,0xf9bb88f8,0x8942019e, - 0x4264a5ff,0x856302e0,0x72dbd92b,0xee971b69, - 0x6ea22fde,0x5f08ae2b,0xaf7a616d,0xe5c98767, - 0xcf1febd2,0x61efc8c2,0xf1ac2571,0xcc8239c2, - 0x67214cb8,0xb1e583d1,0xb7dc3e62,0x7f10bdce, - 0xf90a5c38,0x0ff0443d,0x606e6dc6,0x60543a49, - 0x5727c148,0x2be98a1d,0x8ab41738,0x20e1be24, - 0xaf96da0f,0x68458425,0x99833be5,0x600d457d, - 0x282f9350,0x8334b362,0xd91d1120,0x2b6d8da0, - 0x642b1e31,0x9c305a00,0x52bce688,0x1b03588a, - 0xf7baefd5,0x4142ed9c,0xa4315c11,0x83323ec5, - 0xdfef4636,0xa133c501,0xe9d3531c,0xee353783, - }; -CAST_LONG CAST_S_table3[256]={ - 0x9db30420,0x1fb6e9de,0xa7be7bef,0xd273a298, - 0x4a4f7bdb,0x64ad8c57,0x85510443,0xfa020ed1, - 0x7e287aff,0xe60fb663,0x095f35a1,0x79ebf120, - 0xfd059d43,0x6497b7b1,0xf3641f63,0x241e4adf, - 0x28147f5f,0x4fa2b8cd,0xc9430040,0x0cc32220, - 0xfdd30b30,0xc0a5374f,0x1d2d00d9,0x24147b15, - 0xee4d111a,0x0fca5167,0x71ff904c,0x2d195ffe, - 0x1a05645f,0x0c13fefe,0x081b08ca,0x05170121, - 0x80530100,0xe83e5efe,0xac9af4f8,0x7fe72701, - 0xd2b8ee5f,0x06df4261,0xbb9e9b8a,0x7293ea25, - 0xce84ffdf,0xf5718801,0x3dd64b04,0xa26f263b, - 0x7ed48400,0x547eebe6,0x446d4ca0,0x6cf3d6f5, - 0x2649abdf,0xaea0c7f5,0x36338cc1,0x503f7e93, - 0xd3772061,0x11b638e1,0x72500e03,0xf80eb2bb, - 0xabe0502e,0xec8d77de,0x57971e81,0xe14f6746, - 0xc9335400,0x6920318f,0x081dbb99,0xffc304a5, - 0x4d351805,0x7f3d5ce3,0xa6c866c6,0x5d5bcca9, - 0xdaec6fea,0x9f926f91,0x9f46222f,0x3991467d, - 0xa5bf6d8e,0x1143c44f,0x43958302,0xd0214eeb, - 0x022083b8,0x3fb6180c,0x18f8931e,0x281658e6, - 0x26486e3e,0x8bd78a70,0x7477e4c1,0xb506e07c, - 0xf32d0a25,0x79098b02,0xe4eabb81,0x28123b23, - 0x69dead38,0x1574ca16,0xdf871b62,0x211c40b7, - 0xa51a9ef9,0x0014377b,0x041e8ac8,0x09114003, - 0xbd59e4d2,0xe3d156d5,0x4fe876d5,0x2f91a340, - 0x557be8de,0x00eae4a7,0x0ce5c2ec,0x4db4bba6, - 0xe756bdff,0xdd3369ac,0xec17b035,0x06572327, - 0x99afc8b0,0x56c8c391,0x6b65811c,0x5e146119, - 0x6e85cb75,0xbe07c002,0xc2325577,0x893ff4ec, - 0x5bbfc92d,0xd0ec3b25,0xb7801ab7,0x8d6d3b24, - 0x20c763ef,0xc366a5fc,0x9c382880,0x0ace3205, - 0xaac9548a,0xeca1d7c7,0x041afa32,0x1d16625a, - 0x6701902c,0x9b757a54,0x31d477f7,0x9126b031, - 0x36cc6fdb,0xc70b8b46,0xd9e66a48,0x56e55a79, - 0x026a4ceb,0x52437eff,0x2f8f76b4,0x0df980a5, - 0x8674cde3,0xedda04eb,0x17a9be04,0x2c18f4df, - 0xb7747f9d,0xab2af7b4,0xefc34d20,0x2e096b7c, - 0x1741a254,0xe5b6a035,0x213d42f6,0x2c1c7c26, - 0x61c2f50f,0x6552daf9,0xd2c231f8,0x25130f69, - 0xd8167fa2,0x0418f2c8,0x001a96a6,0x0d1526ab, - 0x63315c21,0x5e0a72ec,0x49bafefd,0x187908d9, - 0x8d0dbd86,0x311170a7,0x3e9b640c,0xcc3e10d7, - 0xd5cad3b6,0x0caec388,0xf73001e1,0x6c728aff, - 0x71eae2a1,0x1f9af36e,0xcfcbd12f,0xc1de8417, - 0xac07be6b,0xcb44a1d8,0x8b9b0f56,0x013988c3, - 0xb1c52fca,0xb4be31cd,0xd8782806,0x12a3a4e2, - 0x6f7de532,0x58fd7eb6,0xd01ee900,0x24adffc2, - 0xf4990fc5,0x9711aac5,0x001d7b95,0x82e5e7d2, - 0x109873f6,0x00613096,0xc32d9521,0xada121ff, - 0x29908415,0x7fbb977f,0xaf9eb3db,0x29c9ed2a, - 0x5ce2a465,0xa730f32c,0xd0aa3fe8,0x8a5cc091, - 0xd49e2ce7,0x0ce454a9,0xd60acd86,0x015f1919, - 0x77079103,0xdea03af6,0x78a8565e,0xdee356df, - 0x21f05cbe,0x8b75e387,0xb3c50651,0xb8a5c3ef, - 0xd8eeb6d2,0xe523be77,0xc2154529,0x2f69efdf, - 0xafe67afb,0xf470c4b2,0xf3e0eb5b,0xd6cc9876, - 0x39e4460c,0x1fda8538,0x1987832f,0xca007367, - 0xa99144f8,0x296b299e,0x492fc295,0x9266beab, - 0xb5676e69,0x9bd3ddda,0xdf7e052f,0xdb25701c, - 0x1b5e51ee,0xf65324e6,0x6afce36c,0x0316cc04, - 0x8644213e,0xb7dc59d0,0x7965291f,0xccd6fd43, - 0x41823979,0x932bcdf6,0xb657c34d,0x4edfd282, - 0x7ae5290c,0x3cb9536b,0x851e20fe,0x9833557e, - 0x13ecf0b0,0xd3ffb372,0x3f85c5c1,0x0aef7ed2, - }; -CAST_LONG CAST_S_table4[256]={ - 0x7ec90c04,0x2c6e74b9,0x9b0e66df,0xa6337911, - 0xb86a7fff,0x1dd358f5,0x44dd9d44,0x1731167f, - 0x08fbf1fa,0xe7f511cc,0xd2051b00,0x735aba00, - 0x2ab722d8,0x386381cb,0xacf6243a,0x69befd7a, - 0xe6a2e77f,0xf0c720cd,0xc4494816,0xccf5c180, - 0x38851640,0x15b0a848,0xe68b18cb,0x4caadeff, - 0x5f480a01,0x0412b2aa,0x259814fc,0x41d0efe2, - 0x4e40b48d,0x248eb6fb,0x8dba1cfe,0x41a99b02, - 0x1a550a04,0xba8f65cb,0x7251f4e7,0x95a51725, - 0xc106ecd7,0x97a5980a,0xc539b9aa,0x4d79fe6a, - 0xf2f3f763,0x68af8040,0xed0c9e56,0x11b4958b, - 0xe1eb5a88,0x8709e6b0,0xd7e07156,0x4e29fea7, - 0x6366e52d,0x02d1c000,0xc4ac8e05,0x9377f571, - 0x0c05372a,0x578535f2,0x2261be02,0xd642a0c9, - 0xdf13a280,0x74b55bd2,0x682199c0,0xd421e5ec, - 0x53fb3ce8,0xc8adedb3,0x28a87fc9,0x3d959981, - 0x5c1ff900,0xfe38d399,0x0c4eff0b,0x062407ea, - 0xaa2f4fb1,0x4fb96976,0x90c79505,0xb0a8a774, - 0xef55a1ff,0xe59ca2c2,0xa6b62d27,0xe66a4263, - 0xdf65001f,0x0ec50966,0xdfdd55bc,0x29de0655, - 0x911e739a,0x17af8975,0x32c7911c,0x89f89468, - 0x0d01e980,0x524755f4,0x03b63cc9,0x0cc844b2, - 0xbcf3f0aa,0x87ac36e9,0xe53a7426,0x01b3d82b, - 0x1a9e7449,0x64ee2d7e,0xcddbb1da,0x01c94910, - 0xb868bf80,0x0d26f3fd,0x9342ede7,0x04a5c284, - 0x636737b6,0x50f5b616,0xf24766e3,0x8eca36c1, - 0x136e05db,0xfef18391,0xfb887a37,0xd6e7f7d4, - 0xc7fb7dc9,0x3063fcdf,0xb6f589de,0xec2941da, - 0x26e46695,0xb7566419,0xf654efc5,0xd08d58b7, - 0x48925401,0xc1bacb7f,0xe5ff550f,0xb6083049, - 0x5bb5d0e8,0x87d72e5a,0xab6a6ee1,0x223a66ce, - 0xc62bf3cd,0x9e0885f9,0x68cb3e47,0x086c010f, - 0xa21de820,0xd18b69de,0xf3f65777,0xfa02c3f6, - 0x407edac3,0xcbb3d550,0x1793084d,0xb0d70eba, - 0x0ab378d5,0xd951fb0c,0xded7da56,0x4124bbe4, - 0x94ca0b56,0x0f5755d1,0xe0e1e56e,0x6184b5be, - 0x580a249f,0x94f74bc0,0xe327888e,0x9f7b5561, - 0xc3dc0280,0x05687715,0x646c6bd7,0x44904db3, - 0x66b4f0a3,0xc0f1648a,0x697ed5af,0x49e92ff6, - 0x309e374f,0x2cb6356a,0x85808573,0x4991f840, - 0x76f0ae02,0x083be84d,0x28421c9a,0x44489406, - 0x736e4cb8,0xc1092910,0x8bc95fc6,0x7d869cf4, - 0x134f616f,0x2e77118d,0xb31b2be1,0xaa90b472, - 0x3ca5d717,0x7d161bba,0x9cad9010,0xaf462ba2, - 0x9fe459d2,0x45d34559,0xd9f2da13,0xdbc65487, - 0xf3e4f94e,0x176d486f,0x097c13ea,0x631da5c7, - 0x445f7382,0x175683f4,0xcdc66a97,0x70be0288, - 0xb3cdcf72,0x6e5dd2f3,0x20936079,0x459b80a5, - 0xbe60e2db,0xa9c23101,0xeba5315c,0x224e42f2, - 0x1c5c1572,0xf6721b2c,0x1ad2fff3,0x8c25404e, - 0x324ed72f,0x4067b7fd,0x0523138e,0x5ca3bc78, - 0xdc0fd66e,0x75922283,0x784d6b17,0x58ebb16e, - 0x44094f85,0x3f481d87,0xfcfeae7b,0x77b5ff76, - 0x8c2302bf,0xaaf47556,0x5f46b02a,0x2b092801, - 0x3d38f5f7,0x0ca81f36,0x52af4a8a,0x66d5e7c0, - 0xdf3b0874,0x95055110,0x1b5ad7a8,0xf61ed5ad, - 0x6cf6e479,0x20758184,0xd0cefa65,0x88f7be58, - 0x4a046826,0x0ff6f8f3,0xa09c7f70,0x5346aba0, - 0x5ce96c28,0xe176eda3,0x6bac307f,0x376829d2, - 0x85360fa9,0x17e3fe2a,0x24b79767,0xf5a96b20, - 0xd6cd2595,0x68ff1ebf,0x7555442c,0xf19f06be, - 0xf9e0659a,0xeeb9491d,0x34010718,0xbb30cab8, - 0xe822fe15,0x88570983,0x750e6249,0xda627e55, - 0x5e76ffa8,0xb1534546,0x6d47de08,0xefe9e7d4, - }; -CAST_LONG CAST_S_table5[256]={ - 0xf6fa8f9d,0x2cac6ce1,0x4ca34867,0xe2337f7c, - 0x95db08e7,0x016843b4,0xeced5cbc,0x325553ac, - 0xbf9f0960,0xdfa1e2ed,0x83f0579d,0x63ed86b9, - 0x1ab6a6b8,0xde5ebe39,0xf38ff732,0x8989b138, - 0x33f14961,0xc01937bd,0xf506c6da,0xe4625e7e, - 0xa308ea99,0x4e23e33c,0x79cbd7cc,0x48a14367, - 0xa3149619,0xfec94bd5,0xa114174a,0xeaa01866, - 0xa084db2d,0x09a8486f,0xa888614a,0x2900af98, - 0x01665991,0xe1992863,0xc8f30c60,0x2e78ef3c, - 0xd0d51932,0xcf0fec14,0xf7ca07d2,0xd0a82072, - 0xfd41197e,0x9305a6b0,0xe86be3da,0x74bed3cd, - 0x372da53c,0x4c7f4448,0xdab5d440,0x6dba0ec3, - 0x083919a7,0x9fbaeed9,0x49dbcfb0,0x4e670c53, - 0x5c3d9c01,0x64bdb941,0x2c0e636a,0xba7dd9cd, - 0xea6f7388,0xe70bc762,0x35f29adb,0x5c4cdd8d, - 0xf0d48d8c,0xb88153e2,0x08a19866,0x1ae2eac8, - 0x284caf89,0xaa928223,0x9334be53,0x3b3a21bf, - 0x16434be3,0x9aea3906,0xefe8c36e,0xf890cdd9, - 0x80226dae,0xc340a4a3,0xdf7e9c09,0xa694a807, - 0x5b7c5ecc,0x221db3a6,0x9a69a02f,0x68818a54, - 0xceb2296f,0x53c0843a,0xfe893655,0x25bfe68a, - 0xb4628abc,0xcf222ebf,0x25ac6f48,0xa9a99387, - 0x53bddb65,0xe76ffbe7,0xe967fd78,0x0ba93563, - 0x8e342bc1,0xe8a11be9,0x4980740d,0xc8087dfc, - 0x8de4bf99,0xa11101a0,0x7fd37975,0xda5a26c0, - 0xe81f994f,0x9528cd89,0xfd339fed,0xb87834bf, - 0x5f04456d,0x22258698,0xc9c4c83b,0x2dc156be, - 0x4f628daa,0x57f55ec5,0xe2220abe,0xd2916ebf, - 0x4ec75b95,0x24f2c3c0,0x42d15d99,0xcd0d7fa0, - 0x7b6e27ff,0xa8dc8af0,0x7345c106,0xf41e232f, - 0x35162386,0xe6ea8926,0x3333b094,0x157ec6f2, - 0x372b74af,0x692573e4,0xe9a9d848,0xf3160289, - 0x3a62ef1d,0xa787e238,0xf3a5f676,0x74364853, - 0x20951063,0x4576698d,0xb6fad407,0x592af950, - 0x36f73523,0x4cfb6e87,0x7da4cec0,0x6c152daa, - 0xcb0396a8,0xc50dfe5d,0xfcd707ab,0x0921c42f, - 0x89dff0bb,0x5fe2be78,0x448f4f33,0x754613c9, - 0x2b05d08d,0x48b9d585,0xdc049441,0xc8098f9b, - 0x7dede786,0xc39a3373,0x42410005,0x6a091751, - 0x0ef3c8a6,0x890072d6,0x28207682,0xa9a9f7be, - 0xbf32679d,0xd45b5b75,0xb353fd00,0xcbb0e358, - 0x830f220a,0x1f8fb214,0xd372cf08,0xcc3c4a13, - 0x8cf63166,0x061c87be,0x88c98f88,0x6062e397, - 0x47cf8e7a,0xb6c85283,0x3cc2acfb,0x3fc06976, - 0x4e8f0252,0x64d8314d,0xda3870e3,0x1e665459, - 0xc10908f0,0x513021a5,0x6c5b68b7,0x822f8aa0, - 0x3007cd3e,0x74719eef,0xdc872681,0x073340d4, - 0x7e432fd9,0x0c5ec241,0x8809286c,0xf592d891, - 0x08a930f6,0x957ef305,0xb7fbffbd,0xc266e96f, - 0x6fe4ac98,0xb173ecc0,0xbc60b42a,0x953498da, - 0xfba1ae12,0x2d4bd736,0x0f25faab,0xa4f3fceb, - 0xe2969123,0x257f0c3d,0x9348af49,0x361400bc, - 0xe8816f4a,0x3814f200,0xa3f94043,0x9c7a54c2, - 0xbc704f57,0xda41e7f9,0xc25ad33a,0x54f4a084, - 0xb17f5505,0x59357cbe,0xedbd15c8,0x7f97c5ab, - 0xba5ac7b5,0xb6f6deaf,0x3a479c3a,0x5302da25, - 0x653d7e6a,0x54268d49,0x51a477ea,0x5017d55b, - 0xd7d25d88,0x44136c76,0x0404a8c8,0xb8e5a121, - 0xb81a928a,0x60ed5869,0x97c55b96,0xeaec991b, - 0x29935913,0x01fdb7f1,0x088e8dfa,0x9ab6f6f5, - 0x3b4cbf9f,0x4a5de3ab,0xe6051d35,0xa0e1d855, - 0xd36b4cf1,0xf544edeb,0xb0e93524,0xbebb8fbd, - 0xa2d762cf,0x49c92f54,0x38b5f331,0x7128a454, - 0x48392905,0xa65b1db8,0x851c97bd,0xd675cf2f, - }; -CAST_LONG CAST_S_table6[256]={ - 0x85e04019,0x332bf567,0x662dbfff,0xcfc65693, - 0x2a8d7f6f,0xab9bc912,0xde6008a1,0x2028da1f, - 0x0227bce7,0x4d642916,0x18fac300,0x50f18b82, - 0x2cb2cb11,0xb232e75c,0x4b3695f2,0xb28707de, - 0xa05fbcf6,0xcd4181e9,0xe150210c,0xe24ef1bd, - 0xb168c381,0xfde4e789,0x5c79b0d8,0x1e8bfd43, - 0x4d495001,0x38be4341,0x913cee1d,0x92a79c3f, - 0x089766be,0xbaeeadf4,0x1286becf,0xb6eacb19, - 0x2660c200,0x7565bde4,0x64241f7a,0x8248dca9, - 0xc3b3ad66,0x28136086,0x0bd8dfa8,0x356d1cf2, - 0x107789be,0xb3b2e9ce,0x0502aa8f,0x0bc0351e, - 0x166bf52a,0xeb12ff82,0xe3486911,0xd34d7516, - 0x4e7b3aff,0x5f43671b,0x9cf6e037,0x4981ac83, - 0x334266ce,0x8c9341b7,0xd0d854c0,0xcb3a6c88, - 0x47bc2829,0x4725ba37,0xa66ad22b,0x7ad61f1e, - 0x0c5cbafa,0x4437f107,0xb6e79962,0x42d2d816, - 0x0a961288,0xe1a5c06e,0x13749e67,0x72fc081a, - 0xb1d139f7,0xf9583745,0xcf19df58,0xbec3f756, - 0xc06eba30,0x07211b24,0x45c28829,0xc95e317f, - 0xbc8ec511,0x38bc46e9,0xc6e6fa14,0xbae8584a, - 0xad4ebc46,0x468f508b,0x7829435f,0xf124183b, - 0x821dba9f,0xaff60ff4,0xea2c4e6d,0x16e39264, - 0x92544a8b,0x009b4fc3,0xaba68ced,0x9ac96f78, - 0x06a5b79a,0xb2856e6e,0x1aec3ca9,0xbe838688, - 0x0e0804e9,0x55f1be56,0xe7e5363b,0xb3a1f25d, - 0xf7debb85,0x61fe033c,0x16746233,0x3c034c28, - 0xda6d0c74,0x79aac56c,0x3ce4e1ad,0x51f0c802, - 0x98f8f35a,0x1626a49f,0xeed82b29,0x1d382fe3, - 0x0c4fb99a,0xbb325778,0x3ec6d97b,0x6e77a6a9, - 0xcb658b5c,0xd45230c7,0x2bd1408b,0x60c03eb7, - 0xb9068d78,0xa33754f4,0xf430c87d,0xc8a71302, - 0xb96d8c32,0xebd4e7be,0xbe8b9d2d,0x7979fb06, - 0xe7225308,0x8b75cf77,0x11ef8da4,0xe083c858, - 0x8d6b786f,0x5a6317a6,0xfa5cf7a0,0x5dda0033, - 0xf28ebfb0,0xf5b9c310,0xa0eac280,0x08b9767a, - 0xa3d9d2b0,0x79d34217,0x021a718d,0x9ac6336a, - 0x2711fd60,0x438050e3,0x069908a8,0x3d7fedc4, - 0x826d2bef,0x4eeb8476,0x488dcf25,0x36c9d566, - 0x28e74e41,0xc2610aca,0x3d49a9cf,0xbae3b9df, - 0xb65f8de6,0x92aeaf64,0x3ac7d5e6,0x9ea80509, - 0xf22b017d,0xa4173f70,0xdd1e16c3,0x15e0d7f9, - 0x50b1b887,0x2b9f4fd5,0x625aba82,0x6a017962, - 0x2ec01b9c,0x15488aa9,0xd716e740,0x40055a2c, - 0x93d29a22,0xe32dbf9a,0x058745b9,0x3453dc1e, - 0xd699296e,0x496cff6f,0x1c9f4986,0xdfe2ed07, - 0xb87242d1,0x19de7eae,0x053e561a,0x15ad6f8c, - 0x66626c1c,0x7154c24c,0xea082b2a,0x93eb2939, - 0x17dcb0f0,0x58d4f2ae,0x9ea294fb,0x52cf564c, - 0x9883fe66,0x2ec40581,0x763953c3,0x01d6692e, - 0xd3a0c108,0xa1e7160e,0xe4f2dfa6,0x693ed285, - 0x74904698,0x4c2b0edd,0x4f757656,0x5d393378, - 0xa132234f,0x3d321c5d,0xc3f5e194,0x4b269301, - 0xc79f022f,0x3c997e7e,0x5e4f9504,0x3ffafbbd, - 0x76f7ad0e,0x296693f4,0x3d1fce6f,0xc61e45be, - 0xd3b5ab34,0xf72bf9b7,0x1b0434c0,0x4e72b567, - 0x5592a33d,0xb5229301,0xcfd2a87f,0x60aeb767, - 0x1814386b,0x30bcc33d,0x38a0c07d,0xfd1606f2, - 0xc363519b,0x589dd390,0x5479f8e6,0x1cb8d647, - 0x97fd61a9,0xea7759f4,0x2d57539d,0x569a58cf, - 0xe84e63ad,0x462e1b78,0x6580f87e,0xf3817914, - 0x91da55f4,0x40a230f3,0xd1988f35,0xb6e318d2, - 0x3ffa50bc,0x3d40f021,0xc3c0bdae,0x4958c24c, - 0x518f36b2,0x84b1d370,0x0fedce83,0x878ddada, - 0xf2a279c7,0x94e01be8,0x90716f4b,0x954b8aa3, - }; -CAST_LONG CAST_S_table7[256]={ - 0xe216300d,0xbbddfffc,0xa7ebdabd,0x35648095, - 0x7789f8b7,0xe6c1121b,0x0e241600,0x052ce8b5, - 0x11a9cfb0,0xe5952f11,0xece7990a,0x9386d174, - 0x2a42931c,0x76e38111,0xb12def3a,0x37ddddfc, - 0xde9adeb1,0x0a0cc32c,0xbe197029,0x84a00940, - 0xbb243a0f,0xb4d137cf,0xb44e79f0,0x049eedfd, - 0x0b15a15d,0x480d3168,0x8bbbde5a,0x669ded42, - 0xc7ece831,0x3f8f95e7,0x72df191b,0x7580330d, - 0x94074251,0x5c7dcdfa,0xabbe6d63,0xaa402164, - 0xb301d40a,0x02e7d1ca,0x53571dae,0x7a3182a2, - 0x12a8ddec,0xfdaa335d,0x176f43e8,0x71fb46d4, - 0x38129022,0xce949ad4,0xb84769ad,0x965bd862, - 0x82f3d055,0x66fb9767,0x15b80b4e,0x1d5b47a0, - 0x4cfde06f,0xc28ec4b8,0x57e8726e,0x647a78fc, - 0x99865d44,0x608bd593,0x6c200e03,0x39dc5ff6, - 0x5d0b00a3,0xae63aff2,0x7e8bd632,0x70108c0c, - 0xbbd35049,0x2998df04,0x980cf42a,0x9b6df491, - 0x9e7edd53,0x06918548,0x58cb7e07,0x3b74ef2e, - 0x522fffb1,0xd24708cc,0x1c7e27cd,0xa4eb215b, - 0x3cf1d2e2,0x19b47a38,0x424f7618,0x35856039, - 0x9d17dee7,0x27eb35e6,0xc9aff67b,0x36baf5b8, - 0x09c467cd,0xc18910b1,0xe11dbf7b,0x06cd1af8, - 0x7170c608,0x2d5e3354,0xd4de495a,0x64c6d006, - 0xbcc0c62c,0x3dd00db3,0x708f8f34,0x77d51b42, - 0x264f620f,0x24b8d2bf,0x15c1b79e,0x46a52564, - 0xf8d7e54e,0x3e378160,0x7895cda5,0x859c15a5, - 0xe6459788,0xc37bc75f,0xdb07ba0c,0x0676a3ab, - 0x7f229b1e,0x31842e7b,0x24259fd7,0xf8bef472, - 0x835ffcb8,0x6df4c1f2,0x96f5b195,0xfd0af0fc, - 0xb0fe134c,0xe2506d3d,0x4f9b12ea,0xf215f225, - 0xa223736f,0x9fb4c428,0x25d04979,0x34c713f8, - 0xc4618187,0xea7a6e98,0x7cd16efc,0x1436876c, - 0xf1544107,0xbedeee14,0x56e9af27,0xa04aa441, - 0x3cf7c899,0x92ecbae6,0xdd67016d,0x151682eb, - 0xa842eedf,0xfdba60b4,0xf1907b75,0x20e3030f, - 0x24d8c29e,0xe139673b,0xefa63fb8,0x71873054, - 0xb6f2cf3b,0x9f326442,0xcb15a4cc,0xb01a4504, - 0xf1e47d8d,0x844a1be5,0xbae7dfdc,0x42cbda70, - 0xcd7dae0a,0x57e85b7a,0xd53f5af6,0x20cf4d8c, - 0xcea4d428,0x79d130a4,0x3486ebfb,0x33d3cddc, - 0x77853b53,0x37effcb5,0xc5068778,0xe580b3e6, - 0x4e68b8f4,0xc5c8b37e,0x0d809ea2,0x398feb7c, - 0x132a4f94,0x43b7950e,0x2fee7d1c,0x223613bd, - 0xdd06caa2,0x37df932b,0xc4248289,0xacf3ebc3, - 0x5715f6b7,0xef3478dd,0xf267616f,0xc148cbe4, - 0x9052815e,0x5e410fab,0xb48a2465,0x2eda7fa4, - 0xe87b40e4,0xe98ea084,0x5889e9e1,0xefd390fc, - 0xdd07d35b,0xdb485694,0x38d7e5b2,0x57720101, - 0x730edebc,0x5b643113,0x94917e4f,0x503c2fba, - 0x646f1282,0x7523d24a,0xe0779695,0xf9c17a8f, - 0x7a5b2121,0xd187b896,0x29263a4d,0xba510cdf, - 0x81f47c9f,0xad1163ed,0xea7b5965,0x1a00726e, - 0x11403092,0x00da6d77,0x4a0cdd61,0xad1f4603, - 0x605bdfb0,0x9eedc364,0x22ebe6a8,0xcee7d28a, - 0xa0e736a0,0x5564a6b9,0x10853209,0xc7eb8f37, - 0x2de705ca,0x8951570f,0xdf09822b,0xbd691a6c, - 0xaa12e4f2,0x87451c0f,0xe0f6a27a,0x3ada4819, - 0x4cf1764f,0x0d771c2b,0x67cdb156,0x350d8384, - 0x5938fa0f,0x42399ef3,0x36997b07,0x0e84093d, - 0x4aa93e61,0x8360d87b,0x1fa98b0c,0x1149382c, - 0xe97625a5,0x0614d1b7,0x0e25244b,0x0c768347, - 0x589e8d82,0x0d2059d1,0xa466bb1e,0xf8da0a82, - 0x04f19130,0xba6e4ec0,0x99265164,0x1ee7230d, - 0x50b2ad80,0xeaee6801,0x8db2a283,0xea8bf59e, - }; diff --git a/src/utils/crypto/des.c b/src/utils/crypto/des.c deleted file mode 100644 index 897cbdd52d4..00000000000 --- a/src/utils/crypto/des.c +++ /dev/null @@ -1,4 +0,0 @@ -/* Deprecated/legacy */ - -#include "des.h" -#include "spr.h" diff --git a/src/utils/crypto/des.h b/src/utils/crypto/des.h deleted file mode 100644 index 625c3f9dcd8..00000000000 --- a/src/utils/crypto/des.h +++ /dev/null @@ -1,292 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/des.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify des.org since des.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -#ifndef HEADER_DES_H -#define HEADER_DES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -/* If this is set to 'unsigned int' on a DEC Alpha, this gives about a - * %20 speed up (longs are 8 bytes, int's are 4). */ -#ifndef DES_LONG -#define DES_LONG uint32_t -#endif - -typedef unsigned char des_cblock[8]; -typedef struct des_ks_struct - { - union { - des_cblock _; - /* make sure things are correct size on machines with - * 8 byte longs */ - DES_LONG pad[2]; - } ks; - } des_key_schedule[16]; - -#define DES_KEY_SZ (sizeof(des_cblock)) -#define DES_SCHEDULE_SZ (sizeof(des_key_schedule)) - -#define DES_ENCRYPT 1 -#define DES_DECRYPT 0 - -#define DES_CBC_MODE 0 -#define DES_PCBC_MODE 1 - -#define des_ecb2_encrypt(i,o,k1,k2,e) \ - des_ecb3_encrypt((i),(o),(k1),(k2),(k1),(e)) - -#define des_ede2_cbc_encrypt(i,o,l,k1,k2,iv,e) \ - des_ede3_cbc_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(e)) - -#define des_ede2_cfb64_encrypt(i,o,l,k1,k2,iv,n,e) \ - des_ede3_cfb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n),(e)) - -#define des_ede2_ofb64_encrypt(i,o,l,k1,k2,iv,n) \ - des_ede3_ofb64_encrypt((i),(o),(l),(k1),(k2),(k1),(iv),(n)) - -#define C_Block des_cblock -#define Key_schedule des_key_schedule -#ifdef KERBEROS -#define ENCRYPT DES_ENCRYPT -#define DECRYPT DES_DECRYPT -#endif -#define KEY_SZ DES_KEY_SZ -#define string_to_key des_string_to_key -#define read_pw_string des_read_pw_string -#define random_key des_random_key -#define pcbc_encrypt des_pcbc_encrypt -#define set_key des_set_key -#define key_sched des_key_sched -#define ecb_encrypt des_ecb_encrypt -#define cbc_encrypt des_cbc_encrypt -#define ncbc_encrypt des_ncbc_encrypt -#define xcbc_encrypt des_xcbc_encrypt -#define cbc_cksum des_cbc_cksum -#define quad_cksum des_quad_cksum - -/* For compatibility with the MIT lib - eay 20/05/92 */ -typedef des_key_schedule bit_64; -#define des_fixup_key_parity des_set_odd_parity -#define des_check_key_parity check_parity - -extern int des_check_key; /* defaults to false */ -extern int des_rw_mode; /* defaults to DES_PCBC_MODE */ - -/* The next line is used to disable full ANSI prototypes, if your - * compiler has problems with the prototypes, make sure this line always - * evaluates to true :-) */ -#if defined(MSDOS) || defined(__STDC__) -#undef NOPROTO -#endif -#ifndef NOPROTO -char *des_options(void); -void des_ecb3_encrypt(des_cblock *input,des_cblock *output, - des_key_schedule ks1,des_key_schedule ks2, - des_key_schedule ks3, int enc); -DES_LONG des_cbc_cksum(des_cblock *input,des_cblock *output, - long length,des_key_schedule schedule,des_cblock *ivec); -void des_cbc_encrypt(des_cblock *input,des_cblock *output,long length, - des_key_schedule schedule,des_cblock *ivec,int enc); -void des_ncbc_encrypt(des_cblock *input,des_cblock *output,long length, - des_key_schedule schedule,des_cblock *ivec,int enc); -void des_xcbc_encrypt(des_cblock *input,des_cblock *output,long length, - des_key_schedule schedule,des_cblock *ivec, - des_cblock *inw,des_cblock *outw,int enc); -void des_cfb_encrypt(unsigned char *in,unsigned char *out,int numbits, - long length,des_key_schedule schedule,des_cblock *ivec,int enc); -void des_ecb_encrypt(des_cblock *input,des_cblock *output, - des_key_schedule ks,int enc); -void des_encrypt(DES_LONG *data,des_key_schedule ks, int enc); -void des_encrypt2(DES_LONG *data,des_key_schedule ks, int enc); -void des_encrypt3(DES_LONG *data, des_key_schedule ks1, - des_key_schedule ks2, des_key_schedule ks3); -void des_decrypt3(DES_LONG *data, des_key_schedule ks1, - des_key_schedule ks2, des_key_schedule ks3); -void des_ede3_cbc_encrypt(des_cblock *input, des_cblock *output, - long length, des_key_schedule ks1, des_key_schedule ks2, - des_key_schedule ks3, des_cblock *ivec, int enc); -void des_ede3_cfb64_encrypt(unsigned char *in, unsigned char *out, - long length, des_key_schedule ks1, des_key_schedule ks2, - des_key_schedule ks3, des_cblock *ivec, int *num, int enc); -void des_ede3_ofb64_encrypt(unsigned char *in, unsigned char *out, - long length, des_key_schedule ks1, des_key_schedule ks2, - des_key_schedule ks3, des_cblock *ivec, int *num); - -void des_xwhite_in2out(des_cblock (*des_key), des_cblock (*in_white), - des_cblock (*out_white)); - -int des_enc_read(int fd,char *buf,int len,des_key_schedule sched, - des_cblock *iv); -int des_enc_write(int fd,char *buf,int len,des_key_schedule sched, - des_cblock *iv); -char *des_fcrypt(const char *buf,const char *salt, char *ret); -char *des_crypt(const char *buf,const char *salt); -void des_ofb_encrypt(unsigned char *in,unsigned char *out, - int numbits,long length,des_key_schedule schedule,des_cblock *ivec); -void des_pcbc_encrypt(des_cblock *input,des_cblock *output,long length, - des_key_schedule schedule,des_cblock *ivec,int enc); -DES_LONG des_quad_cksum(des_cblock *input,des_cblock *output, - long length,int out_count,des_cblock *seed); -void des_random_seed(des_cblock key); -void des_random_key(des_cblock ret); -int des_read_password(des_cblock *key,char *prompt,int verify); -int des_read_2passwords(des_cblock *key1,des_cblock *key2, - char *prompt,int verify); -int des_read_pw_string(char *buf,int length,char *prompt,int verify); -void des_set_odd_parity(des_cblock *key); -int des_is_weak_key(des_cblock *key); -int des_set_key(des_cblock *key,des_key_schedule schedule); -int des_key_sched(des_cblock *key,des_key_schedule schedule); -void des_string_to_key(char *str,des_cblock *key); -void des_string_to_2keys(char *str,des_cblock *key1,des_cblock *key2); -void des_cfb64_encrypt(unsigned char *in, unsigned char *out, long length, - des_key_schedule schedule, des_cblock *ivec, int *num, int enc); -void des_ofb64_encrypt(unsigned char *in, unsigned char *out, long length, - des_key_schedule schedule, des_cblock *ivec, int *num); -int des_read_pw(char *buf, char *buff, int size, char *prompt, int verify); - -/* Extra functions from Mark Murray */ -void des_cblock_print_file(des_cblock *cb, FILE *fp); -/* The following functions are not in the normal unix build or the - * SSLeay build. When using the SSLeay build, use RAND_seed() - * and RAND_bytes() instead. */ -int des_new_random_key(des_cblock *key); -void des_init_random_number_generator(des_cblock *key); -void des_set_random_generator_seed(des_cblock *key); -void des_set_sequence_number(des_cblock new_sequence_number); -void des_generate_random_block(des_cblock *block); - -#else - -char *des_options(); -void des_ecb3_encrypt(); -DES_LONG des_cbc_cksum(); -void des_cbc_encrypt(); -void des_ncbc_encrypt(); -void des_xcbc_encrypt(); -void des_cfb_encrypt(); -void des_ede3_cfb64_encrypt(); -void des_ede3_ofb64_encrypt(); -void des_ecb_encrypt(); -void des_encrypt(); -void des_encrypt2(); -void des_encrypt3(); -void des_decrypt3(); -void des_ede3_cbc_encrypt(); -int des_enc_read(); -int des_enc_write(); -char *des_fcrypt(); -#ifdef PERL5 -char *des_crypt(); -#else -char *crypt(); -#endif -void des_ofb_encrypt(); -void des_pcbc_encrypt(); -DES_LONG des_quad_cksum(); -void des_random_seed(); -void des_random_key(); -int des_read_password(); -int des_read_2passwords(); -int des_read_pw_string(); -void des_set_odd_parity(); -int des_is_weak_key(); -int des_set_key(); -int des_key_sched(); -void des_string_to_key(); -void des_string_to_2keys(); -void des_cfb64_encrypt(); -void des_ofb64_encrypt(); -int des_read_pw(); -void des_xwhite_in2out(); - -/* Extra functions from Mark Murray */ -void des_cblock_print_file(); -/* The following functions are not in the normal unix build or the - * SSLeay build. When using the SSLeay build, use RAND_seed() - * and RAND_bytes() instead. */ -#ifdef FreeBSD -int des_new_random_key(); -void des_init_random_number_generator(); -void des_set_random_generator_seed(); -void des_set_sequence_number(); -void des_generate_random_block(); -#endif - -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/src/utils/crypto/des_enc.c b/src/utils/crypto/des_enc.c deleted file mode 100644 index bb822afcd55..00000000000 --- a/src/utils/crypto/des_enc.c +++ /dev/null @@ -1,479 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/des_enc.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - -#include "des_locl.h" -#include "../common/endian.h" - -void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc) - { - register DES_LONG l,r,t,u; -#ifdef DES_PTR - register unsigned char *des_SP=(unsigned char *)des_SPtrans; -#endif -#ifndef DES_UNROLL - register int i; -#endif - register DES_LONG *s; - - r=LE32(data[0]); - l=LE32(data[1]); - - IP(r,l); - /* Things have been modified so that the initial rotate is - * done outside the loop. This required the - * des_SPtrans values in sp.h to be rotated 1 bit to the right. - * One perl script later and things have a 5% speed up on a sparc2. - * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> - * for pointing this out. */ - /* clear the top bits on machines with 8byte longs */ - /* shift left by 2 */ - r=ROTATE(r,29)&0xffffffffL; - l=ROTATE(l,29)&0xffffffffL; - - s=(DES_LONG *)ks; - /* I don't know if it is worth the effort of loop unrolling the - * inner loop */ - if (enc) - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ -#else - for (i=0; i<32; i+=8) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - D_ENCRYPT(l,r,i+4); /* 3 */ - D_ENCRYPT(r,l,i+6); /* 4 */ - } -#endif - } - else - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r,30); /* 16 */ - D_ENCRYPT(r,l,28); /* 15 */ - D_ENCRYPT(l,r,26); /* 14 */ - D_ENCRYPT(r,l,24); /* 13 */ - D_ENCRYPT(l,r,22); /* 12 */ - D_ENCRYPT(r,l,20); /* 11 */ - D_ENCRYPT(l,r,18); /* 10 */ - D_ENCRYPT(r,l,16); /* 9 */ - D_ENCRYPT(l,r,14); /* 8 */ - D_ENCRYPT(r,l,12); /* 7 */ - D_ENCRYPT(l,r,10); /* 6 */ - D_ENCRYPT(r,l, 8); /* 5 */ - D_ENCRYPT(l,r, 6); /* 4 */ - D_ENCRYPT(r,l, 4); /* 3 */ - D_ENCRYPT(l,r, 2); /* 2 */ - D_ENCRYPT(r,l, 0); /* 1 */ -#else - for (i=30; i>0; i-=8) - { - D_ENCRYPT(l,r,i-0); /* 16 */ - D_ENCRYPT(r,l,i-2); /* 15 */ - D_ENCRYPT(l,r,i-4); /* 14 */ - D_ENCRYPT(r,l,i-6); /* 13 */ - } -#endif - } - - /* rotate and clear the top bits on machines with 8byte longs */ - l=ROTATE(l,3)&0xffffffffL; - r=ROTATE(r,3)&0xffffffffL; - - FP(r,l); - data[0]=LE32(l); - data[1]=LE32(r); - l=r=t=u=0; - } - -void des_encrypt2(DES_LONG *data, des_key_schedule ks, int enc) - { - register DES_LONG l,r,t,u; -#ifdef DES_PTR - register unsigned char *des_SP=(unsigned char *)des_SPtrans; -#endif -#ifndef DES_UNROLL - register int i; -#endif - register DES_LONG *s; - - r=data[0]; - l=data[1]; - - /* Things have been modified so that the initial rotate is - * done outside the loop. This required the - * des_SPtrans values in sp.h to be rotated 1 bit to the right. - * One perl script later and things have a 5% speed up on a sparc2. - * Thanks to Richard Outerbridge <71755.204@CompuServe.COM> - * for pointing this out. */ - /* clear the top bits on machines with 8byte longs */ - r=ROTATE(r,29)&0xffffffffL; - l=ROTATE(l,29)&0xffffffffL; - - s=(DES_LONG *)ks; - /* I don't know if it is worth the effort of loop unrolling the - * inner loop */ - if (enc) - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r, 0); /* 1 */ - D_ENCRYPT(r,l, 2); /* 2 */ - D_ENCRYPT(l,r, 4); /* 3 */ - D_ENCRYPT(r,l, 6); /* 4 */ - D_ENCRYPT(l,r, 8); /* 5 */ - D_ENCRYPT(r,l,10); /* 6 */ - D_ENCRYPT(l,r,12); /* 7 */ - D_ENCRYPT(r,l,14); /* 8 */ - D_ENCRYPT(l,r,16); /* 9 */ - D_ENCRYPT(r,l,18); /* 10 */ - D_ENCRYPT(l,r,20); /* 11 */ - D_ENCRYPT(r,l,22); /* 12 */ - D_ENCRYPT(l,r,24); /* 13 */ - D_ENCRYPT(r,l,26); /* 14 */ - D_ENCRYPT(l,r,28); /* 15 */ - D_ENCRYPT(r,l,30); /* 16 */ -#else - for (i=0; i<32; i+=8) - { - D_ENCRYPT(l,r,i+0); /* 1 */ - D_ENCRYPT(r,l,i+2); /* 2 */ - D_ENCRYPT(l,r,i+4); /* 3 */ - D_ENCRYPT(r,l,i+6); /* 4 */ - } -#endif - } - else - { -#ifdef DES_UNROLL - D_ENCRYPT(l,r,30); /* 16 */ - D_ENCRYPT(r,l,28); /* 15 */ - D_ENCRYPT(l,r,26); /* 14 */ - D_ENCRYPT(r,l,24); /* 13 */ - D_ENCRYPT(l,r,22); /* 12 */ - D_ENCRYPT(r,l,20); /* 11 */ - D_ENCRYPT(l,r,18); /* 10 */ - D_ENCRYPT(r,l,16); /* 9 */ - D_ENCRYPT(l,r,14); /* 8 */ - D_ENCRYPT(r,l,12); /* 7 */ - D_ENCRYPT(l,r,10); /* 6 */ - D_ENCRYPT(r,l, 8); /* 5 */ - D_ENCRYPT(l,r, 6); /* 4 */ - D_ENCRYPT(r,l, 4); /* 3 */ - D_ENCRYPT(l,r, 2); /* 2 */ - D_ENCRYPT(r,l, 0); /* 1 */ -#else - for (i=30; i>0; i-=8) - { - D_ENCRYPT(l,r,i-0); /* 16 */ - D_ENCRYPT(r,l,i-2); /* 15 */ - D_ENCRYPT(l,r,i-4); /* 14 */ - D_ENCRYPT(r,l,i-6); /* 13 */ - } -#endif - } - /* rotate and clear the top bits on machines with 8byte longs */ - data[0]=ROTATE(l,3)&0xffffffffL; - data[1]=ROTATE(r,3)&0xffffffffL; - l=r=t=u=0; - } - -void des_encrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3) - { - register DES_LONG l,r; - - l=data[0]; - r=data[1]; - IP(l,r); - data[0]=l; - data[1]=r; - des_encrypt2((DES_LONG *)data,ks1,DES_ENCRYPT); - des_encrypt2((DES_LONG *)data,ks2,DES_DECRYPT); - des_encrypt2((DES_LONG *)data,ks3,DES_ENCRYPT); - l=data[0]; - r=data[1]; - FP(r,l); - data[0]=l; - data[1]=r; - } - -void des_decrypt3(DES_LONG *data, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3) - { - register DES_LONG l,r; - - l=data[0]; - r=data[1]; - IP(l,r); - data[0]=l; - data[1]=r; - des_encrypt2((DES_LONG *)data,ks3,DES_DECRYPT); - des_encrypt2((DES_LONG *)data,ks2,DES_ENCRYPT); - des_encrypt2((DES_LONG *)data,ks1,DES_DECRYPT); - l=data[0]; - r=data[1]; - FP(r,l); - data[0]=l; - data[1]=r; - } - -#ifndef DES_DEFAULT_OPTIONS - -void des_ncbc_encrypt(des_cblock (*input), des_cblock (*output), long length, des_key_schedule schedule, des_cblock (*ivec), int enc) - { - register DES_LONG tin0,tin1; - register DES_LONG tout0,tout1,xor0,xor1; - register unsigned char *in,*out; - register long l=length; - DES_LONG tin[2]; - unsigned char *iv; - - in=(unsigned char *)input; - out=(unsigned char *)output; - iv=(unsigned char *)ivec; - - if (enc) - { - c2l(iv,tout0); - c2l(iv,tout1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0; tin[0]=tin0; - tin1^=tout1; tin[1]=tin1; - des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); - tout0=tin[0]; l2c(tout0,out); - tout1=tin[1]; l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0; tin[0]=tin0; - tin1^=tout1; tin[1]=tin1; - des_encrypt((DES_LONG *)tin,schedule,DES_ENCRYPT); - tout0=tin[0]; l2c(tout0,out); - tout1=tin[1]; l2c(tout1,out); - } - iv=(unsigned char *)ivec; - l2c(tout0,iv); - l2c(tout1,iv); - } - else - { - c2l(iv,xor0); - c2l(iv,xor1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); tin[0]=tin0; - c2l(in,tin1); tin[1]=tin1; - des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2c(tout0,out); - l2c(tout1,out); - xor0=tin0; - xor1=tin1; - } - if (l != -8) - { - c2l(in,tin0); tin[0]=tin0; - c2l(in,tin1); tin[1]=tin1; - des_encrypt((DES_LONG *)tin,schedule,DES_DECRYPT); - tout0=tin[0]^xor0; - tout1=tin[1]^xor1; - l2cn(tout0,tout1,out,l+8); - xor0=tin0; - xor1=tin1; - } - - iv=(unsigned char *)ivec; - l2c(xor0,iv); - l2c(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } - -void des_ede3_cbc_encrypt(des_cblock (*input), des_cblock (*output), long length, des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3, des_cblock (*ivec), int enc) - { - register DES_LONG tin0,tin1; - register DES_LONG tout0,tout1,xor0,xor1; - register unsigned char *in,*out; - register long l=length; - DES_LONG tin[2]; - unsigned char *iv; - - in=(unsigned char *)input; - out=(unsigned char *)output; - iv=(unsigned char *)ivec; - - if (enc) - { - c2l(iv,tout0); - c2l(iv,tout1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - tin0^=tout0; - tin1^=tout1; - - tin[0]=tin0; - tin[1]=tin1; - des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - l2c(tout0,out); - l2c(tout1,out); - } - if (l != -8) - { - c2ln(in,tin0,tin1,l+8); - tin0^=tout0; - tin1^=tout1; - - tin[0]=tin0; - tin[1]=tin1; - des_encrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - l2c(tout0,out); - l2c(tout1,out); - } - iv=(unsigned char *)ivec; - l2c(tout0,iv); - l2c(tout1,iv); - } - else - { - register DES_LONG t0,t1; - - c2l(iv,xor0); - c2l(iv,xor1); - for (l-=8; l>=0; l-=8) - { - c2l(in,tin0); - c2l(in,tin1); - - t0=tin0; - t1=tin1; - - tin[0]=tin0; - tin[1]=tin1; - des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - tout0^=xor0; - tout1^=xor1; - l2c(tout0,out); - l2c(tout1,out); - xor0=t0; - xor1=t1; - } - if (l != -8) - { - c2l(in,tin0); - c2l(in,tin1); - - t0=tin0; - t1=tin1; - - tin[0]=tin0; - tin[1]=tin1; - des_decrypt3((DES_LONG *)tin,ks1,ks2,ks3); - tout0=tin[0]; - tout1=tin[1]; - - tout0^=xor0; - tout1^=xor1; - l2cn(tout0,tout1,out,l+8); - xor0=t0; - xor1=t1; - } - - iv=(unsigned char *)ivec; - l2c(xor0,iv); - l2c(xor1,iv); - } - tin0=tin1=tout0=tout1=xor0=xor1=0; - tin[0]=tin[1]=0; - } - -#endif /* DES_DEFAULT_OPTIONS */ diff --git a/src/utils/crypto/des_locl.h b/src/utils/crypto/des_locl.h deleted file mode 100644 index 116b41d958f..00000000000 --- a/src/utils/crypto/des_locl.h +++ /dev/null @@ -1,518 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/des_locl.org */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - * - * Always modify des_locl.org since des_locl.h is automatically generated from - * it during SSLeay configuration. - * - * WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING - */ - -#ifndef HEADER_DES_LOCL_H -#define HEADER_DES_LOCL_H - -#if defined(WIN32) || defined(WIN16) -#ifndef MSDOS -#define MSDOS -#endif -#endif - -#include -#include -#ifndef MSDOS -#include -#endif -#include "des.h" - -#ifndef DES_DEFAULT_OPTIONS -/* the following is tweaked from a config script, that is why it is a - * protected undef/define */ -#ifndef DES_PTR -#define DES_PTR -#endif - -/* This helps C compiler generate the correct code for multiple functional - * units. It reduces register dependancies at the expense of 2 more - * registers */ -#ifndef DES_RISC1 -#define DES_RISC1 -#endif - -#ifndef DES_RISC2 -#undef DES_RISC2 -#endif - -#if defined(DES_RISC1) && defined(DES_RISC2) -YOU SHOULD NOT HAVE BOTH DES_RISC1 AND DES_RISC2 DEFINED!!!!! -#endif - -/* Unroll the inner loop, this sometimes helps, sometimes hinders. - * Very mucy CPU dependant */ -#ifndef DES_UNROLL -#define DES_UNROLL -#endif - -/* These default values were supplied by - * Peter Gutman - * They are only used if nothing else has been defined */ -#if !defined(DES_PTR) && !defined(DES_RISC1) && !defined(DES_RISC2) && !defined(DES_UNROLL) -/* Special defines which change the way the code is built depending on the - CPU and OS. For SGI machines you can use _MIPS_SZLONG (32 or 64) to find - even newer MIPS CPU's, but at the moment one size fits all for - optimization options. Older Sparc's work better with only UNROLL, but - there's no way to tell at compile time what it is you're running on */ - -#if defined( sun ) /* Newer Sparc's */ - #define DES_PTR - #define DES_RISC1 - #define DES_UNROLL -#elif defined( __ultrix ) /* Older MIPS */ - #define DES_PTR - #define DES_RISC2 - #define DES_UNROLL -#elif defined( __osf1__ ) /* Alpha */ - #define DES_PTR - #define DES_RISC2 -#elif defined ( _AIX ) /* RS6000 */ - /* Unknown */ -#elif defined( __hpux ) /* HP-PA */ - /* Unknown */ -#elif defined( __aux ) /* 68K */ - /* Unknown */ -#elif defined( __dgux ) /* 88K (but P6 in latest boxes) */ - #define DES_UNROLL -#elif defined( __sgi ) /* Newer MIPS */ - #define DES_PTR - #define DES_RISC2 - #define DES_UNROLL -#elif defined( i386 ) /* x86 boxes, should be gcc */ - #define DES_PTR - #define DES_RISC1 - #define DES_UNROLL -#endif /* Systems-specific speed defines */ -#endif - -#endif /* DES_DEFAULT_OPTIONS */ - -#ifdef MSDOS /* Visual C++ 2.1 (Windows NT/95) */ -#include -#include -#include -#include -#ifndef RAND -#define RAND -#endif -#undef NOPROTO -#endif - -#if defined(__STDC__) || defined(VMS) || defined(M_XENIX) || defined(MSDOS) -#include -#endif - -#ifndef RAND -#define RAND -#endif - -#ifdef linux -#undef RAND -#endif - -#ifdef MSDOS -#define getpid() 2 -#define RAND -#undef NOPROTO -#endif - -#if defined(NOCONST) -#define const -#endif - -#ifdef __STDC__ -#undef NOPROTO -#endif - -#ifdef RAND -#define srandom(s) srand(s) -#define random rand -#endif - -#define ITERATIONS 16 -#define HALF_ITERATIONS 8 - -/* used in des_read and des_write */ -#define MAXWRITE (1024*16) -#define BSIZE (MAXWRITE+4) - -#define c2l(c,l) (l =((DES_LONG)(*((c)++))) , \ - l|=((DES_LONG)(*((c)++)))<< 8L, \ - l|=((DES_LONG)(*((c)++)))<<16L, \ - l|=((DES_LONG)(*((c)++)))<<24L) - -/* NOTE - c is not incremented as per c2l */ -#define c2ln(c,l1,l2,n) { \ - c+=n; \ - l1=l2=0; \ - switch (n) { \ - case 8: l2 =((DES_LONG)(*(--(c))))<<24L; \ - case 7: l2|=((DES_LONG)(*(--(c))))<<16L; \ - case 6: l2|=((DES_LONG)(*(--(c))))<< 8L; \ - case 5: l2|=((DES_LONG)(*(--(c)))); \ - case 4: l1 =((DES_LONG)(*(--(c))))<<24L; \ - case 3: l1|=((DES_LONG)(*(--(c))))<<16L; \ - case 2: l1|=((DES_LONG)(*(--(c))))<< 8L; \ - case 1: l1|=((DES_LONG)(*(--(c)))); \ - } \ - } - -#define l2c(l,c) (*((c)++)=(unsigned char)(((l) )&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>24L)&0xff)) - -/* replacements for htonl and ntohl since I have no idea what to do - * when faced with machines with 8 byte longs. */ -#define HDRSIZE 4 - -#define n2l(c,l) (l =((DES_LONG)(*((c)++)))<<24L, \ - l|=((DES_LONG)(*((c)++)))<<16L, \ - l|=((DES_LONG)(*((c)++)))<< 8L, \ - l|=((DES_LONG)(*((c)++)))) - -#define l2n(l,c) (*((c)++)=(unsigned char)(((l)>>24L)&0xff), \ - *((c)++)=(unsigned char)(((l)>>16L)&0xff), \ - *((c)++)=(unsigned char)(((l)>> 8L)&0xff), \ - *((c)++)=(unsigned char)(((l) )&0xff)) - -/* NOTE - c is not incremented as per l2c */ -#define l2cn(l1,l2,c,n) { \ - c+=n; \ - switch (n) { \ - case 8: *(--(c))=(unsigned char)(((l2)>>24L)&0xff); \ - case 7: *(--(c))=(unsigned char)(((l2)>>16L)&0xff); \ - case 6: *(--(c))=(unsigned char)(((l2)>> 8L)&0xff); \ - case 5: *(--(c))=(unsigned char)(((l2) )&0xff); \ - case 4: *(--(c))=(unsigned char)(((l1)>>24L)&0xff); \ - case 3: *(--(c))=(unsigned char)(((l1)>>16L)&0xff); \ - case 2: *(--(c))=(unsigned char)(((l1)>> 8L)&0xff); \ - case 1: *(--(c))=(unsigned char)(((l1) )&0xff); \ - } \ - } - -//#if defined(WIN32) -//#define ROTATE(a,n) (_lrotr(a,n)) -//#else -#define ROTATE(a,n) (((a)>>(n))+((a)<<(32-(n)))) -//#endif - -/* Don't worry about the LOAD_DATA() stuff, that is used by - * fcrypt() to add it's little bit to the front */ - -#ifdef DES_FCRYPT - -#define LOAD_DATA_tmp(R,S,u,t,E0,E1) \ - { DES_LONG tmp; LOAD_DATA(R,S,u,t,E0,E1,tmp); } - -#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ - t=R^(R>>16L); \ - u=t&E0; t&=E1; \ - tmp=(u<<16); u^=R^s[S ]; u^=tmp; \ - tmp=(t<<16); t^=R^s[S+1]; t^=tmp -#else -#define LOAD_DATA_tmp(a,b,c,d,e,f) LOAD_DATA(a,b,c,d,e,f,g) -#define LOAD_DATA(R,S,u,t,E0,E1,tmp) \ - u=R^s[S ]; \ - t=R^s[S+1] -#endif - -/* The changes to this macro may help or hinder, depending on the - * compiler and the achitecture. gcc2 always seems to do well :-). - * Inspired by Dana How - * DO NOT use the alternative version on machines with 8 byte longs. - * It does not seem to work on the Alpha, even when DES_LONG is 4 - * bytes, probably an issue of accessing non-word aligned objects :-( */ -#ifdef DES_PTR - -/* It recently occured to me that 0^0^0^0^0^0^0 == 0, so there - * is no reason to not xor all the sub items together. This potentially - * saves a register since things can be xored directly into L */ - -#if defined(DES_RISC1) || defined(DES_RISC2) -#ifdef DES_RISC1 -#define D_ENCRYPT(LL,R,S) { \ - unsigned int u1,u2,u3; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u2=(int)u>>8L; \ - u1=(int)u&0xfc; \ - u2&=0xfc; \ - t=ROTATE(t,4); \ - u>>=16L; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ - u3=(int)(u>>8L); \ - u1=(int)u&0xfc; \ - u3&=0xfc; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+u1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+u3); \ - u2=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u2&=0xfc; \ - t>>=16L; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ - u3=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u3&=0xfc; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+u1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+u3); } -#endif -#ifdef DES_RISC2 -#define D_ENCRYPT(LL,R,S) { \ - unsigned int u1,u2,s1,s2; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u2=(int)u>>8L; \ - u1=(int)u&0xfc; \ - u2&=0xfc; \ - t=ROTATE(t,4); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP +u1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x200+u2); \ - s1=(int)(u>>16L); \ - s2=(int)(u>>24L); \ - s1&=0xfc; \ - s2&=0xfc; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x400+s1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x600+s2); \ - u2=(int)t>>8L; \ - u1=(int)t&0xfc; \ - u2&=0xfc; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x100+u1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x300+u2); \ - s1=(int)(t>>16L); \ - s2=(int)(t>>24L); \ - s1&=0xfc; \ - s2&=0xfc; \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x500+s1); \ - LL^= *(DES_LONG *)((unsigned char *)des_SP+0x700+s2); } -#endif -#else -#define D_ENCRYPT(LL,R,S) { \ - LOAD_DATA_tmp(R,S,u,t,E0,E1); \ - t=ROTATE(t,4); \ - LL^= \ - *(DES_LONG *)((unsigned char *)des_SP +((u )&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x200+((u>> 8L)&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x400+((u>>16L)&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x600+((u>>24L)&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x100+((t )&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x300+((t>> 8L)&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x500+((t>>16L)&0xfc))^ \ - *(DES_LONG *)((unsigned char *)des_SP+0x700+((t>>24L)&0xfc)); } -#endif - -#else /* original version */ - -#if defined(DES_RISC1) || defined(DES_RISC2) -#ifdef DES_RISC1 -#define D_ENCRYPT(LL,R,S) {\ - unsigned int u1,u2,u3; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u>>=2L; \ - t=ROTATE(t,6); \ - u2=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u2&=0x3f; \ - u>>=16L; \ - LL^=des_SPtrans[0][u1]; \ - LL^=des_SPtrans[2][u2]; \ - u3=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u3&=0x3f; \ - LL^=des_SPtrans[4][u1]; \ - LL^=des_SPtrans[6][u3]; \ - u2=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u2&=0x3f; \ - t>>=16L; \ - LL^=des_SPtrans[1][u1]; \ - LL^=des_SPtrans[3][u2]; \ - u3=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u3&=0x3f; \ - LL^=des_SPtrans[5][u1]; \ - LL^=des_SPtrans[7][u3]; } -#endif -#ifdef DES_RISC2 -#define D_ENCRYPT(LL,R,S) {\ - unsigned int u1,u2,s1,s2; \ - LOAD_DATA(R,S,u,t,E0,E1,u1); \ - u>>=2L; \ - t=ROTATE(t,6); \ - u2=(int)u>>8L; \ - u1=(int)u&0x3f; \ - u2&=0x3f; \ - LL^=des_SPtrans[0][u1]; \ - LL^=des_SPtrans[2][u2]; \ - s1=(int)u>>16L; \ - s2=(int)u>>24L; \ - s1&=0x3f; \ - s2&=0x3f; \ - LL^=des_SPtrans[4][s1]; \ - LL^=des_SPtrans[6][s2]; \ - u2=(int)t>>8L; \ - u1=(int)t&0x3f; \ - u2&=0x3f; \ - LL^=des_SPtrans[1][u1]; \ - LL^=des_SPtrans[3][u2]; \ - s1=(int)t>>16; \ - s2=(int)t>>24L; \ - s1&=0x3f; \ - s2&=0x3f; \ - LL^=des_SPtrans[5][s1]; \ - LL^=des_SPtrans[7][s2]; } -#endif - -#else - -#define D_ENCRYPT(LL,R,S) {\ - LOAD_DATA_tmp(R,S,u,t,E0,E1); \ - t=ROTATE(t,4); \ - LL^=\ - des_SPtrans[0][(u>> 2L)&0x3f]^ \ - des_SPtrans[2][(u>>10L)&0x3f]^ \ - des_SPtrans[4][(u>>18L)&0x3f]^ \ - des_SPtrans[6][(u>>26L)&0x3f]^ \ - des_SPtrans[1][(t>> 2L)&0x3f]^ \ - des_SPtrans[3][(t>>10L)&0x3f]^ \ - des_SPtrans[5][(t>>18L)&0x3f]^ \ - des_SPtrans[7][(t>>26L)&0x3f]; } -#endif -#endif - - /* IP and FP - * The problem is more of a geometric problem that random bit fiddling. - 0 1 2 3 4 5 6 7 62 54 46 38 30 22 14 6 - 8 9 10 11 12 13 14 15 60 52 44 36 28 20 12 4 - 16 17 18 19 20 21 22 23 58 50 42 34 26 18 10 2 - 24 25 26 27 28 29 30 31 to 56 48 40 32 24 16 8 0 - - 32 33 34 35 36 37 38 39 63 55 47 39 31 23 15 7 - 40 41 42 43 44 45 46 47 61 53 45 37 29 21 13 5 - 48 49 50 51 52 53 54 55 59 51 43 35 27 19 11 3 - 56 57 58 59 60 61 62 63 57 49 41 33 25 17 9 1 - - The output has been subject to swaps of the form - 0 1 -> 3 1 but the odd and even bits have been put into - 2 3 2 0 - different words. The main trick is to remember that - t=((l>>size)^r)&(mask); - r^=t; - l^=(t<>(n))^(b))&(m)),\ - (b)^=(t),\ - (a)^=((t)<<(n))) - -#define IP(l,r) \ - { \ - register DES_LONG tt; \ - PERM_OP(r,l,tt, 4,0x0f0f0f0fL); \ - PERM_OP(l,r,tt,16,0x0000ffffL); \ - PERM_OP(r,l,tt, 2,0x33333333L); \ - PERM_OP(l,r,tt, 8,0x00ff00ffL); \ - PERM_OP(r,l,tt, 1,0x55555555L); \ - } - -#define FP(l,r) \ - { \ - register DES_LONG tt; \ - PERM_OP(l,r,tt, 1,0x55555555L); \ - PERM_OP(r,l,tt, 8,0x00ff00ffL); \ - PERM_OP(l,r,tt, 2,0x33333333L); \ - PERM_OP(r,l,tt,16,0x0000ffffL); \ - PERM_OP(l,r,tt, 4,0x0f0f0f0fL); \ - } - -extern const DES_LONG des_SPtrans[8][64]; - -#ifndef NOPROTO -void fcrypt_body(DES_LONG *out,des_key_schedule ks, - DES_LONG Eswap0, DES_LONG Eswap1); -#else -void fcrypt_body(); -#endif - -#endif diff --git a/src/utils/crypto/ecb3_enc.c b/src/utils/crypto/ecb3_enc.c deleted file mode 100644 index ff4661f6485..00000000000 --- a/src/utils/crypto/ecb3_enc.c +++ /dev/null @@ -1,84 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/ecb3_enc.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -#include "des_locl.h" - - -void des_ecb3_encrypt(des_cblock (*input), des_cblock (*output), des_key_schedule ks1, des_key_schedule ks2, des_key_schedule ks3, int enc) - { - register DES_LONG l0,l1; - register unsigned char *in,*out; - DES_LONG ll[2]; - - in=(unsigned char *)input; - out=(unsigned char *)output; - c2l(in,l0); - c2l(in,l1); - ll[0]=l0; - ll[1]=l1; - if (enc) - des_encrypt3(ll,ks1,ks2,ks3); - else - des_decrypt3(ll,ks1,ks2,ks3); - l0=ll[0]; - l1=ll[1]; - l2c(l0,out); - l2c(l1,out); - } diff --git a/src/utils/crypto/podd.h b/src/utils/crypto/podd.h deleted file mode 100644 index d4083b42877..00000000000 --- a/src/utils/crypto/podd.h +++ /dev/null @@ -1,77 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/podd.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -static const unsigned char odd_parity[256]={ - 1, 1, 2, 2, 4, 4, 7, 7, 8, 8, 11, 11, 13, 13, 14, 14, - 16, 16, 19, 19, 21, 21, 22, 22, 25, 25, 26, 26, 28, 28, 31, 31, - 32, 32, 35, 35, 37, 37, 38, 38, 41, 41, 42, 42, 44, 44, 47, 47, - 49, 49, 50, 50, 52, 52, 55, 55, 56, 56, 59, 59, 61, 61, 62, 62, - 64, 64, 67, 67, 69, 69, 70, 70, 73, 73, 74, 74, 76, 76, 79, 79, - 81, 81, 82, 82, 84, 84, 87, 87, 88, 88, 91, 91, 93, 93, 94, 94, - 97, 97, 98, 98,100,100,103,103,104,104,107,107,109,109,110,110, -112,112,115,115,117,117,118,118,121,121,122,122,124,124,127,127, -128,128,131,131,133,133,134,134,137,137,138,138,140,140,143,143, -145,145,146,146,148,148,151,151,152,152,155,155,157,157,158,158, -161,161,162,162,164,164,167,167,168,168,171,171,173,173,174,174, -176,176,179,179,181,181,182,182,185,185,186,186,188,188,191,191, -193,193,194,194,196,196,199,199,200,200,203,203,205,205,206,206, -208,208,211,211,213,213,214,214,217,217,218,218,220,220,223,223, -224,224,227,227,229,229,230,230,233,233,234,234,236,236,239,239, -241,241,242,242,244,244,247,247,248,248,251,251,253,253,254,254}; diff --git a/src/utils/crypto/rmd160.c b/src/utils/crypto/rmd160.c deleted file mode 100644 index 85c0bf444ba..00000000000 --- a/src/utils/crypto/rmd160.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Copyright (c) 2001 Markus Friedl. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ -/* - * Preneel, Bosselaers, Dobbertin, "The Cryptographic Hash Function RIPEMD-160", - * RSA Laboratories, CryptoBytes, Volume 3, Number 2, Autumn 1997, - * ftp://ftp.rsasecurity.com/pub/cryptobytes/crypto3n2.pdf - */ - -/* Adapted by TrueCrypt Foundation */ - -#include "rmd160.h" -#include "../common/endian.h" -#include - -#define PUT_64BIT_LE(cp, value) do { \ - (cp)[7] = (unsigned char)((value) >> 56); \ - (cp)[6] = (unsigned char)((value) >> 48); \ - (cp)[5] = (unsigned char)((value) >> 40); \ - (cp)[4] = (unsigned char)((value) >> 32); \ - (cp)[3] = (unsigned char)((value) >> 24); \ - (cp)[2] = (unsigned char)((value) >> 16); \ - (cp)[1] = (unsigned char)((value) >> 8); \ - (cp)[0] = (unsigned char)(value); } while (0) - -#define PUT_32BIT_LE(cp, value) do { \ - (cp)[3] = (unsigned char)((value) >> 24); \ - (cp)[2] = (unsigned char)((value) >> 16); \ - (cp)[1] = (unsigned char)((value) >> 8); \ - (cp)[0] = (unsigned char)(value); } while (0) - -#define H0 0x67452301U -#define H1 0xEFCDAB89U -#define H2 0x98BADCFEU -#define H3 0x10325476U -#define H4 0xC3D2E1F0U - -#define K0 0x00000000U -#define K1 0x5A827999U -#define K2 0x6ED9EBA1U -#define K3 0x8F1BBCDCU -#define K4 0xA953FD4EU - -#define KK0 0x50A28BE6U -#define KK1 0x5C4DD124U -#define KK2 0x6D703EF3U -#define KK3 0x7A6D76E9U -#define KK4 0x00000000U - -/* rotate x left n bits. */ - -#if defined (_MSC_VER) && !defined (_DEBUG) -#include -# pragma intrinsic (_lrotl) -# define ROL(n, x) (_lrotl (x, n)) -#else -# define ROL(n, x) (((x) << (n)) | ((x) >> (32-(n)))) -#endif - -#define F0(x, y, z) ((x) ^ (y) ^ (z)) -#define F1(x, y, z) (((x) & (y)) | ((~x) & (z))) -#define F2(x, y, z) (((x) | (~y)) ^ (z)) -#define F3(x, y, z) (((x) & (z)) | ((y) & (~z))) -#define F4(x, y, z) ((x) ^ ((y) | (~z))) - -#define R(a, b, c, d, e, Fj, Kj, sj, rj) \ - do { \ - a = ROL(sj, a + Fj(b,c,d) + X(rj) + Kj) + e; \ - c = ROL(10, c); \ - } while(0) - -#define X(i) x[i] - -static u_char PADDING[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -void -RMD160Init(RMD160_CTX *ctx) -{ - ctx->count = 0; - ctx->state[0] = H0; - ctx->state[1] = H1; - ctx->state[2] = H2; - ctx->state[3] = H3; - ctx->state[4] = H4; - - PADDING[0] = 0x80; -} - -void -RMD160Update(RMD160_CTX *ctx, const u_char *input, u_int32_t len) -{ - u_int32_t have, off, need; - u_char buf[64] = { 0 }; - - have = (uint32_t)((ctx->count/8) % 64); - need = 64 - have; - ctx->count += 8 * len; - off = 0; - - if (len >= need) { - if (have) { - memcpy(ctx->buffer + have, input, (size_t) need); - RMD160Transform(ctx->state, ctx->buffer); - off = need; - have = 0; - } - /* now the buffer is empty */ - while (off + 64 <= len) { - if ((len - off) < 64) { - memset(buf, 0x00, 64); - memcpy(buf, input + off, len - off); - RMD160Transform(ctx->state, buf); - } else - RMD160Transform(ctx->state, input + off); - off += 64; - } - } - if (off < len) - memcpy(ctx->buffer + have, input+off, (size_t) (len-off)); -} - -void RMD160Final(u_char digest[20], RMD160_CTX *ctx) -{ - int i; - u_char size[8]; - u_int32_t padlen; - - PUT_64BIT_LE(size, ctx->count); - /* - * pad to 64 byte blocks, at least one byte from PADDING plus 8 bytes - * for the size - */ - padlen = (uint32_t)(64 - ((ctx->count/8) % 64)); - if (padlen < 1 + 8) - padlen += 64; - RMD160Update(ctx, PADDING, padlen - 8); /* padlen - 8 <= 64 */ - RMD160Update(ctx, size, 8); - - if (digest != 0) - for (i = 0; i < 5; i++) - PUT_32BIT_LE(digest + i*4, ctx->state[i]); - - memset(ctx, 0, sizeof (*ctx)); -} - -void -RMD160Transform(u_int32_t state[5], const u_char block[64]) -{ - u_int32_t a, b, c, d, e, aa, bb, cc, dd, ee, t, x[16]; - -#if BYTE_ORDER == LITTLE_ENDIAN - memcpy(x, block, 64); -#else - int i; - - for (i = 0; i < 16; i++) - x[i] = (u_int32_t)( - (u_int32_t)(block[i*4 + 0]) | - (u_int32_t)(block[i*4 + 1]) << 8 | - (u_int32_t)(block[i*4 + 2]) << 16 | - (u_int32_t)(block[i*4 + 3]) << 24); -#endif - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - /* Round 1 */ - R(a, b, c, d, e, F0, K0, 11, 0); - R(e, a, b, c, d, F0, K0, 14, 1); - R(d, e, a, b, c, F0, K0, 15, 2); - R(c, d, e, a, b, F0, K0, 12, 3); - R(b, c, d, e, a, F0, K0, 5, 4); - R(a, b, c, d, e, F0, K0, 8, 5); - R(e, a, b, c, d, F0, K0, 7, 6); - R(d, e, a, b, c, F0, K0, 9, 7); - R(c, d, e, a, b, F0, K0, 11, 8); - R(b, c, d, e, a, F0, K0, 13, 9); - R(a, b, c, d, e, F0, K0, 14, 10); - R(e, a, b, c, d, F0, K0, 15, 11); - R(d, e, a, b, c, F0, K0, 6, 12); - R(c, d, e, a, b, F0, K0, 7, 13); - R(b, c, d, e, a, F0, K0, 9, 14); - R(a, b, c, d, e, F0, K0, 8, 15); /* #15 */ - /* Round 2 */ - R(e, a, b, c, d, F1, K1, 7, 7); - R(d, e, a, b, c, F1, K1, 6, 4); - R(c, d, e, a, b, F1, K1, 8, 13); - R(b, c, d, e, a, F1, K1, 13, 1); - R(a, b, c, d, e, F1, K1, 11, 10); - R(e, a, b, c, d, F1, K1, 9, 6); - R(d, e, a, b, c, F1, K1, 7, 15); - R(c, d, e, a, b, F1, K1, 15, 3); - R(b, c, d, e, a, F1, K1, 7, 12); - R(a, b, c, d, e, F1, K1, 12, 0); - R(e, a, b, c, d, F1, K1, 15, 9); - R(d, e, a, b, c, F1, K1, 9, 5); - R(c, d, e, a, b, F1, K1, 11, 2); - R(b, c, d, e, a, F1, K1, 7, 14); - R(a, b, c, d, e, F1, K1, 13, 11); - R(e, a, b, c, d, F1, K1, 12, 8); /* #31 */ - /* Round 3 */ - R(d, e, a, b, c, F2, K2, 11, 3); - R(c, d, e, a, b, F2, K2, 13, 10); - R(b, c, d, e, a, F2, K2, 6, 14); - R(a, b, c, d, e, F2, K2, 7, 4); - R(e, a, b, c, d, F2, K2, 14, 9); - R(d, e, a, b, c, F2, K2, 9, 15); - R(c, d, e, a, b, F2, K2, 13, 8); - R(b, c, d, e, a, F2, K2, 15, 1); - R(a, b, c, d, e, F2, K2, 14, 2); - R(e, a, b, c, d, F2, K2, 8, 7); - R(d, e, a, b, c, F2, K2, 13, 0); - R(c, d, e, a, b, F2, K2, 6, 6); - R(b, c, d, e, a, F2, K2, 5, 13); - R(a, b, c, d, e, F2, K2, 12, 11); - R(e, a, b, c, d, F2, K2, 7, 5); - R(d, e, a, b, c, F2, K2, 5, 12); /* #47 */ - /* Round 4 */ - R(c, d, e, a, b, F3, K3, 11, 1); - R(b, c, d, e, a, F3, K3, 12, 9); - R(a, b, c, d, e, F3, K3, 14, 11); - R(e, a, b, c, d, F3, K3, 15, 10); - R(d, e, a, b, c, F3, K3, 14, 0); - R(c, d, e, a, b, F3, K3, 15, 8); - R(b, c, d, e, a, F3, K3, 9, 12); - R(a, b, c, d, e, F3, K3, 8, 4); - R(e, a, b, c, d, F3, K3, 9, 13); - R(d, e, a, b, c, F3, K3, 14, 3); - R(c, d, e, a, b, F3, K3, 5, 7); - R(b, c, d, e, a, F3, K3, 6, 15); - R(a, b, c, d, e, F3, K3, 8, 14); - R(e, a, b, c, d, F3, K3, 6, 5); - R(d, e, a, b, c, F3, K3, 5, 6); - R(c, d, e, a, b, F3, K3, 12, 2); /* #63 */ - /* Round 5 */ - R(b, c, d, e, a, F4, K4, 9, 4); - R(a, b, c, d, e, F4, K4, 15, 0); - R(e, a, b, c, d, F4, K4, 5, 5); - R(d, e, a, b, c, F4, K4, 11, 9); - R(c, d, e, a, b, F4, K4, 6, 7); - R(b, c, d, e, a, F4, K4, 8, 12); - R(a, b, c, d, e, F4, K4, 13, 2); - R(e, a, b, c, d, F4, K4, 12, 10); - R(d, e, a, b, c, F4, K4, 5, 14); - R(c, d, e, a, b, F4, K4, 12, 1); - R(b, c, d, e, a, F4, K4, 13, 3); - R(a, b, c, d, e, F4, K4, 14, 8); - R(e, a, b, c, d, F4, K4, 11, 11); - R(d, e, a, b, c, F4, K4, 8, 6); - R(c, d, e, a, b, F4, K4, 5, 15); - R(b, c, d, e, a, F4, K4, 6, 13); /* #79 */ - - aa = a ; bb = b; cc = c; dd = d; ee = e; - - a = state[0]; - b = state[1]; - c = state[2]; - d = state[3]; - e = state[4]; - - /* Parallel round 1 */ - R(a, b, c, d, e, F4, KK0, 8, 5); - R(e, a, b, c, d, F4, KK0, 9, 14); - R(d, e, a, b, c, F4, KK0, 9, 7); - R(c, d, e, a, b, F4, KK0, 11, 0); - R(b, c, d, e, a, F4, KK0, 13, 9); - R(a, b, c, d, e, F4, KK0, 15, 2); - R(e, a, b, c, d, F4, KK0, 15, 11); - R(d, e, a, b, c, F4, KK0, 5, 4); - R(c, d, e, a, b, F4, KK0, 7, 13); - R(b, c, d, e, a, F4, KK0, 7, 6); - R(a, b, c, d, e, F4, KK0, 8, 15); - R(e, a, b, c, d, F4, KK0, 11, 8); - R(d, e, a, b, c, F4, KK0, 14, 1); - R(c, d, e, a, b, F4, KK0, 14, 10); - R(b, c, d, e, a, F4, KK0, 12, 3); - R(a, b, c, d, e, F4, KK0, 6, 12); /* #15 */ - /* Parallel round 2 */ - R(e, a, b, c, d, F3, KK1, 9, 6); - R(d, e, a, b, c, F3, KK1, 13, 11); - R(c, d, e, a, b, F3, KK1, 15, 3); - R(b, c, d, e, a, F3, KK1, 7, 7); - R(a, b, c, d, e, F3, KK1, 12, 0); - R(e, a, b, c, d, F3, KK1, 8, 13); - R(d, e, a, b, c, F3, KK1, 9, 5); - R(c, d, e, a, b, F3, KK1, 11, 10); - R(b, c, d, e, a, F3, KK1, 7, 14); - R(a, b, c, d, e, F3, KK1, 7, 15); - R(e, a, b, c, d, F3, KK1, 12, 8); - R(d, e, a, b, c, F3, KK1, 7, 12); - R(c, d, e, a, b, F3, KK1, 6, 4); - R(b, c, d, e, a, F3, KK1, 15, 9); - R(a, b, c, d, e, F3, KK1, 13, 1); - R(e, a, b, c, d, F3, KK1, 11, 2); /* #31 */ - /* Parallel round 3 */ - R(d, e, a, b, c, F2, KK2, 9, 15); - R(c, d, e, a, b, F2, KK2, 7, 5); - R(b, c, d, e, a, F2, KK2, 15, 1); - R(a, b, c, d, e, F2, KK2, 11, 3); - R(e, a, b, c, d, F2, KK2, 8, 7); - R(d, e, a, b, c, F2, KK2, 6, 14); - R(c, d, e, a, b, F2, KK2, 6, 6); - R(b, c, d, e, a, F2, KK2, 14, 9); - R(a, b, c, d, e, F2, KK2, 12, 11); - R(e, a, b, c, d, F2, KK2, 13, 8); - R(d, e, a, b, c, F2, KK2, 5, 12); - R(c, d, e, a, b, F2, KK2, 14, 2); - R(b, c, d, e, a, F2, KK2, 13, 10); - R(a, b, c, d, e, F2, KK2, 13, 0); - R(e, a, b, c, d, F2, KK2, 7, 4); - R(d, e, a, b, c, F2, KK2, 5, 13); /* #47 */ - /* Parallel round 4 */ - R(c, d, e, a, b, F1, KK3, 15, 8); - R(b, c, d, e, a, F1, KK3, 5, 6); - R(a, b, c, d, e, F1, KK3, 8, 4); - R(e, a, b, c, d, F1, KK3, 11, 1); - R(d, e, a, b, c, F1, KK3, 14, 3); - R(c, d, e, a, b, F1, KK3, 14, 11); - R(b, c, d, e, a, F1, KK3, 6, 15); - R(a, b, c, d, e, F1, KK3, 14, 0); - R(e, a, b, c, d, F1, KK3, 6, 5); - R(d, e, a, b, c, F1, KK3, 9, 12); - R(c, d, e, a, b, F1, KK3, 12, 2); - R(b, c, d, e, a, F1, KK3, 9, 13); - R(a, b, c, d, e, F1, KK3, 12, 9); - R(e, a, b, c, d, F1, KK3, 5, 7); - R(d, e, a, b, c, F1, KK3, 15, 10); - R(c, d, e, a, b, F1, KK3, 8, 14); /* #63 */ - /* Parallel round 5 */ - R(b, c, d, e, a, F0, KK4, 8, 12); - R(a, b, c, d, e, F0, KK4, 5, 15); - R(e, a, b, c, d, F0, KK4, 12, 10); - R(d, e, a, b, c, F0, KK4, 9, 4); - R(c, d, e, a, b, F0, KK4, 12, 1); - R(b, c, d, e, a, F0, KK4, 5, 5); - R(a, b, c, d, e, F0, KK4, 14, 8); - R(e, a, b, c, d, F0, KK4, 6, 7); - R(d, e, a, b, c, F0, KK4, 8, 6); - R(c, d, e, a, b, F0, KK4, 13, 2); - R(b, c, d, e, a, F0, KK4, 6, 13); - R(a, b, c, d, e, F0, KK4, 5, 14); - R(e, a, b, c, d, F0, KK4, 15, 0); - R(d, e, a, b, c, F0, KK4, 13, 3); - R(c, d, e, a, b, F0, KK4, 11, 9); - R(b, c, d, e, a, F0, KK4, 11, 11); /* #79 */ - - t = state[1] + cc + d; - state[1] = state[2] + dd + e; - state[2] = state[3] + ee + a; - state[3] = state[4] + aa + b; - state[4] = state[0] + bb + c; - state[0] = t; -} diff --git a/src/utils/crypto/rmd160.h b/src/utils/crypto/rmd160.h deleted file mode 100644 index 4e7cb310842..00000000000 --- a/src/utils/crypto/rmd160.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2001 Markus Friedl. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* Adapted by TrueCrypt Foundation */ - -#ifndef _RMD160_H -#define _RMD160_H - -#include - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#ifndef u_int32_t -#define u_int32_t uint32_t -#define u_int64_t uint64_t -#define u_char uint8_t -#endif - -/* RMD160 context. */ -typedef struct RMD160Context { - u_int32_t state[5]; /* state */ - u_int64_t count; /* number of bits, modulo 2^64 */ - u_char buffer[64]; /* input buffer */ -} RMD160_CTX; - -void RMD160Init(RMD160_CTX *); -void RMD160Transform(u_int32_t [5], const u_char [64]); -void RMD160Update(RMD160_CTX *, const u_char *, u_int32_t); -void RMD160Final(u_char [20], RMD160_CTX *); - -#if defined(__cplusplus) -} -#endif - -#endif /* _RMD160_H */ diff --git a/src/utils/crypto/serpent.c b/src/utils/crypto/serpent.c deleted file mode 100644 index f088a619469..00000000000 --- a/src/utils/crypto/serpent.c +++ /dev/null @@ -1,567 +0,0 @@ -// serpent.cpp - written and placed in the public domain by Wei Dai - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - - -#include "serpent.h" -#include "../common/endian.h" - -#include - -#if defined(_WIN32) && !defined(_DEBUG) -#include -#define rotlFixed _rotl -#define rotrFixed _rotr -#else -#define rotlFixed(x,n) (((x) << (n)) | ((x) >> (32 - (n)))) -#define rotrFixed(x,n) (((x) >> (n)) | ((x) << (32 - (n)))) -#endif - -// linear transformation -#define LT(i,a,b,c,d,e) {\ - a = rotlFixed(a, 13); \ - c = rotlFixed(c, 3); \ - d = rotlFixed(d ^ c ^ (a << 3), 7); \ - b = rotlFixed(b ^ a ^ c, 1); \ - a = rotlFixed(a ^ b ^ d, 5); \ - c = rotlFixed(c ^ d ^ (b << 7), 22);} - -// inverse linear transformation -#define ILT(i,a,b,c,d,e) {\ - c = rotrFixed(c, 22); \ - a = rotrFixed(a, 5); \ - c ^= d ^ (b << 7); \ - a ^= b ^ d; \ - b = rotrFixed(b, 1); \ - d = rotrFixed(d, 7) ^ c ^ (a << 3); \ - b ^= a ^ c; \ - c = rotrFixed(c, 3); \ - a = rotrFixed(a, 13);} - -// order of output from S-box functions -#define beforeS0(f) f(0,a,b,c,d,e) -#define afterS0(f) f(1,b,e,c,a,d) -#define afterS1(f) f(2,c,b,a,e,d) -#define afterS2(f) f(3,a,e,b,d,c) -#define afterS3(f) f(4,e,b,d,c,a) -#define afterS4(f) f(5,b,a,e,c,d) -#define afterS5(f) f(6,a,c,b,e,d) -#define afterS6(f) f(7,a,c,d,b,e) -#define afterS7(f) f(8,d,e,b,a,c) - -// order of output from inverse S-box functions -#define beforeI7(f) f(8,a,b,c,d,e) -#define afterI7(f) f(7,d,a,b,e,c) -#define afterI6(f) f(6,a,b,c,e,d) -#define afterI5(f) f(5,b,d,e,c,a) -#define afterI4(f) f(4,b,c,e,a,d) -#define afterI3(f) f(3,a,b,e,c,d) -#define afterI2(f) f(2,b,d,e,c,a) -#define afterI1(f) f(1,a,b,c,e,d) -#define afterI0(f) f(0,a,d,b,e,c) - -// The instruction sequences for the S-box functions -// come from Dag Arne Osvik's paper "Speeding up Serpent". - -#define S0(i, r0, r1, r2, r3, r4) \ - { \ - r3 ^= r0; \ - r4 = r1; \ - r1 &= r3; \ - r4 ^= r2; \ - r1 ^= r0; \ - r0 |= r3; \ - r0 ^= r4; \ - r4 ^= r3; \ - r3 ^= r2; \ - r2 |= r1; \ - r2 ^= r4; \ - r4 = ~r4; \ - r4 |= r1; \ - r1 ^= r3; \ - r1 ^= r4; \ - r3 |= r0; \ - r1 ^= r3; \ - r4 ^= r3; \ - } - -#define I0(i, r0, r1, r2, r3, r4) \ - { \ - r2 = ~r2; \ - r4 = r1; \ - r1 |= r0; \ - r4 = ~r4; \ - r1 ^= r2; \ - r2 |= r4; \ - r1 ^= r3; \ - r0 ^= r4; \ - r2 ^= r0; \ - r0 &= r3; \ - r4 ^= r0; \ - r0 |= r1; \ - r0 ^= r2; \ - r3 ^= r4; \ - r2 ^= r1; \ - r3 ^= r0; \ - r3 ^= r1; \ - r2 &= r3; \ - r4 ^= r2; \ - } - -#define S1(i, r0, r1, r2, r3, r4) \ - { \ - r0 = ~r0; \ - r2 = ~r2; \ - r4 = r0; \ - r0 &= r1; \ - r2 ^= r0; \ - r0 |= r3; \ - r3 ^= r2; \ - r1 ^= r0; \ - r0 ^= r4; \ - r4 |= r1; \ - r1 ^= r3; \ - r2 |= r0; \ - r2 &= r4; \ - r0 ^= r1; \ - r1 &= r2; \ - r1 ^= r0; \ - r0 &= r2; \ - r0 ^= r4; \ - } - -#define I1(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r1; \ - r1 ^= r3; \ - r3 &= r1; \ - r4 ^= r2; \ - r3 ^= r0; \ - r0 |= r1; \ - r2 ^= r3; \ - r0 ^= r4; \ - r0 |= r2; \ - r1 ^= r3; \ - r0 ^= r1; \ - r1 |= r3; \ - r1 ^= r0; \ - r4 = ~r4; \ - r4 ^= r1; \ - r1 |= r0; \ - r1 ^= r0; \ - r1 |= r4; \ - r3 ^= r1; \ - } - -#define S2(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r0; \ - r0 &= r2; \ - r0 ^= r3; \ - r2 ^= r1; \ - r2 ^= r0; \ - r3 |= r4; \ - r3 ^= r1; \ - r4 ^= r2; \ - r1 = r3; \ - r3 |= r4; \ - r3 ^= r0; \ - r0 &= r1; \ - r4 ^= r0; \ - r1 ^= r3; \ - r1 ^= r4; \ - r4 = ~r4; \ - } - -#define I2(i, r0, r1, r2, r3, r4) \ - { \ - r2 ^= r3; \ - r3 ^= r0; \ - r4 = r3; \ - r3 &= r2; \ - r3 ^= r1; \ - r1 |= r2; \ - r1 ^= r4; \ - r4 &= r3; \ - r2 ^= r3; \ - r4 &= r0; \ - r4 ^= r2; \ - r2 &= r1; \ - r2 |= r0; \ - r3 = ~r3; \ - r2 ^= r3; \ - r0 ^= r3; \ - r0 &= r1; \ - r3 ^= r4; \ - r3 ^= r0; \ - } - -#define S3(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r0; \ - r0 |= r3; \ - r3 ^= r1; \ - r1 &= r4; \ - r4 ^= r2; \ - r2 ^= r3; \ - r3 &= r0; \ - r4 |= r1; \ - r3 ^= r4; \ - r0 ^= r1; \ - r4 &= r0; \ - r1 ^= r3; \ - r4 ^= r2; \ - r1 |= r0; \ - r1 ^= r2; \ - r0 ^= r3; \ - r2 = r1; \ - r1 |= r3; \ - r1 ^= r0; \ - } - -#define I3(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r2; \ - r2 ^= r1; \ - r1 &= r2; \ - r1 ^= r0; \ - r0 &= r4; \ - r4 ^= r3; \ - r3 |= r1; \ - r3 ^= r2; \ - r0 ^= r4; \ - r2 ^= r0; \ - r0 |= r3; \ - r0 ^= r1; \ - r4 ^= r2; \ - r2 &= r3; \ - r1 |= r3; \ - r1 ^= r2; \ - r4 ^= r0; \ - r2 ^= r4; \ - } - -#define S4(i, r0, r1, r2, r3, r4) \ - { \ - r1 ^= r3; \ - r3 = ~r3; \ - r2 ^= r3; \ - r3 ^= r0; \ - r4 = r1; \ - r1 &= r3; \ - r1 ^= r2; \ - r4 ^= r3; \ - r0 ^= r4; \ - r2 &= r4; \ - r2 ^= r0; \ - r0 &= r1; \ - r3 ^= r0; \ - r4 |= r1; \ - r4 ^= r0; \ - r0 |= r3; \ - r0 ^= r2; \ - r2 &= r3; \ - r0 = ~r0; \ - r4 ^= r2; \ - } - -#define I4(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r2; \ - r2 &= r3; \ - r2 ^= r1; \ - r1 |= r3; \ - r1 &= r0; \ - r4 ^= r2; \ - r4 ^= r1; \ - r1 &= r2; \ - r0 = ~r0; \ - r3 ^= r4; \ - r1 ^= r3; \ - r3 &= r0; \ - r3 ^= r2; \ - r0 ^= r1; \ - r2 &= r0; \ - r3 ^= r0; \ - r2 ^= r4; \ - r2 |= r3; \ - r3 ^= r0; \ - r2 ^= r1; \ - } - -#define S5(i, r0, r1, r2, r3, r4) \ - { \ - r0 ^= r1; \ - r1 ^= r3; \ - r3 = ~r3; \ - r4 = r1; \ - r1 &= r0; \ - r2 ^= r3; \ - r1 ^= r2; \ - r2 |= r4; \ - r4 ^= r3; \ - r3 &= r1; \ - r3 ^= r0; \ - r4 ^= r1; \ - r4 ^= r2; \ - r2 ^= r0; \ - r0 &= r3; \ - r2 = ~r2; \ - r0 ^= r4; \ - r4 |= r3; \ - r2 ^= r4; \ - } - -#define I5(i, r0, r1, r2, r3, r4) \ - { \ - r1 = ~r1; \ - r4 = r3; \ - r2 ^= r1; \ - r3 |= r0; \ - r3 ^= r2; \ - r2 |= r1; \ - r2 &= r0; \ - r4 ^= r3; \ - r2 ^= r4; \ - r4 |= r0; \ - r4 ^= r1; \ - r1 &= r2; \ - r1 ^= r3; \ - r4 ^= r2; \ - r3 &= r4; \ - r4 ^= r1; \ - r3 ^= r0; \ - r3 ^= r4; \ - r4 = ~r4; \ - } - -#define S6(i, r0, r1, r2, r3, r4) \ - { \ - r2 = ~r2; \ - r4 = r3; \ - r3 &= r0; \ - r0 ^= r4; \ - r3 ^= r2; \ - r2 |= r4; \ - r1 ^= r3; \ - r2 ^= r0; \ - r0 |= r1; \ - r2 ^= r1; \ - r4 ^= r0; \ - r0 |= r3; \ - r0 ^= r2; \ - r4 ^= r3; \ - r4 ^= r0; \ - r3 = ~r3; \ - r2 &= r4; \ - r2 ^= r3; \ - } - -#define I6(i, r0, r1, r2, r3, r4) \ - { \ - r0 ^= r2; \ - r4 = r2; \ - r2 &= r0; \ - r4 ^= r3; \ - r2 = ~r2; \ - r3 ^= r1; \ - r2 ^= r3; \ - r4 |= r0; \ - r0 ^= r2; \ - r3 ^= r4; \ - r4 ^= r1; \ - r1 &= r3; \ - r1 ^= r0; \ - r0 ^= r3; \ - r0 |= r2; \ - r3 ^= r1; \ - r4 ^= r0; \ - } - -#define S7(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r2; \ - r2 &= r1; \ - r2 ^= r3; \ - r3 &= r1; \ - r4 ^= r2; \ - r2 ^= r1; \ - r1 ^= r0; \ - r0 |= r4; \ - r0 ^= r2; \ - r3 ^= r1; \ - r2 ^= r3; \ - r3 &= r0; \ - r3 ^= r4; \ - r4 ^= r2; \ - r2 &= r0; \ - r4 = ~r4; \ - r2 ^= r4; \ - r4 &= r0; \ - r1 ^= r3; \ - r4 ^= r1; \ - } - -#define I7(i, r0, r1, r2, r3, r4) \ - { \ - r4 = r2; \ - r2 ^= r0; \ - r0 &= r3; \ - r2 = ~r2; \ - r4 |= r3; \ - r3 ^= r1; \ - r1 |= r0; \ - r0 ^= r2; \ - r2 &= r4; \ - r1 ^= r2; \ - r2 ^= r0; \ - r0 |= r2; \ - r3 &= r4; \ - r0 ^= r3; \ - r4 ^= r1; \ - r3 ^= r4; \ - r4 |= r0; \ - r3 ^= r2; \ - r4 ^= r2; \ - } - -// key xor -#define KX(r, a, b, c, d, e) {\ - a ^= k[4 * r + 0]; \ - b ^= k[4 * r + 1]; \ - c ^= k[4 * r + 2]; \ - d ^= k[4 * r + 3];} - - -void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks) -{ - uint32_t a,b,c,d,e; - uint32_t *k = (uint32_t *)ks; - uint32_t t; - int i; - - for (i = 0; i < keylen / (int)sizeof(int32_t); i++) - k[i] = LE32(((uint32_t*)userKey)[i]); - - if (keylen < 32) - k[keylen/4] |= (uint32_t)1 << ((keylen%4)*8); - - k += 8; - t = k[-1]; - for (i = 0; i < 132; ++i) - k[i] = t = rotlFixed(k[i-8] ^ k[i-5] ^ k[i-3] ^ t ^ 0x9e3779b9 ^ i, 11); - k -= 20; - -#define LK(r, a, b, c, d, e) {\ - a = k[(8-r)*4 + 0]; \ - b = k[(8-r)*4 + 1]; \ - c = k[(8-r)*4 + 2]; \ - d = k[(8-r)*4 + 3];} - -#define SK(r, a, b, c, d, e) {\ - k[(8-r)*4 + 4] = a; \ - k[(8-r)*4 + 5] = b; \ - k[(8-r)*4 + 6] = c; \ - k[(8-r)*4 + 7] = d;} \ - - for (i=0; i<4; i++) - { - afterS2(LK); afterS2(S3); afterS3(SK); - afterS1(LK); afterS1(S2); afterS2(SK); - afterS0(LK); afterS0(S1); afterS1(SK); - beforeS0(LK); beforeS0(S0); afterS0(SK); - k += 8*4; - afterS6(LK); afterS6(S7); afterS7(SK); - afterS5(LK); afterS5(S6); afterS6(SK); - afterS4(LK); afterS4(S5); afterS5(SK); - afterS3(LK); afterS3(S4); afterS4(SK); - } - afterS2(LK); afterS2(S3); afterS3(SK); -} - -void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) -{ - uint32_t a, b, c, d, e; - unsigned int i=1; - const uint32_t *k = (uint32_t *)ks + 8; - uint32_t *in = (uint32_t *) inBlock; - uint32_t *out = (uint32_t *) outBlock; - - a = LE32(in[0]); - b = LE32(in[1]); - c = LE32(in[2]); - d = LE32(in[3]); - - do - { - beforeS0(KX); beforeS0(S0); afterS0(LT); - afterS0(KX); afterS0(S1); afterS1(LT); - afterS1(KX); afterS1(S2); afterS2(LT); - afterS2(KX); afterS2(S3); afterS3(LT); - afterS3(KX); afterS3(S4); afterS4(LT); - afterS4(KX); afterS4(S5); afterS5(LT); - afterS5(KX); afterS5(S6); afterS6(LT); - afterS6(KX); afterS6(S7); - - if (i == 4) - break; - - ++i; - c = b; - b = e; - e = d; - d = a; - a = e; - k += 32; - beforeS0(LT); - } - while (1); - - afterS7(KX); - - out[0] = LE32(d); - out[1] = LE32(e); - out[2] = LE32(b); - out[3] = LE32(a); -} - -void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks) -{ - uint32_t a, b, c, d, e; - const uint32_t *k = (uint32_t *)ks + 104; - unsigned int i=4; - uint32_t *in = (uint32_t *) inBlock; - uint32_t *out = (uint32_t *) outBlock; - - a = LE32(in[0]); - b = LE32(in[1]); - c = LE32(in[2]); - d = LE32(in[3]); - - beforeI7(KX); - goto start; - - do - { - c = b; - b = d; - d = e; - k -= 32; - beforeI7(ILT); -start: - beforeI7(I7); afterI7(KX); - afterI7(ILT); afterI7(I6); afterI6(KX); - afterI6(ILT); afterI6(I5); afterI5(KX); - afterI5(ILT); afterI5(I4); afterI4(KX); - afterI4(ILT); afterI4(I3); afterI3(KX); - afterI3(ILT); afterI3(I2); afterI2(KX); - afterI2(ILT); afterI2(I1); afterI1(KX); - afterI1(ILT); afterI1(I0); afterI0(KX); - } - while (--i != 0); - - out[0] = LE32(a); - out[1] = LE32(d); - out[2] = LE32(b); - out[3] = LE32(e); -} diff --git a/src/utils/crypto/serpent.h b/src/utils/crypto/serpent.h deleted file mode 100644 index 484e949f400..00000000000 --- a/src/utils/crypto/serpent.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef HEADER_Crypto_Serpent -#define HEADER_Crypto_Serpent - -#include - -#ifdef __cplusplus -extern "C" -{ -#endif - -void serpent_set_key(const uint8_t userKey[], int keylen, uint8_t *ks); -void serpent_encrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks); -void serpent_decrypt(const uint8_t *inBlock, uint8_t *outBlock, uint8_t *ks); - -#ifdef __cplusplus -} -#endif - -#endif // HEADER_Crypto_Serpent diff --git a/src/utils/crypto/set_key.c b/src/utils/crypto/set_key.c deleted file mode 100644 index fe0026dc1d9..00000000000 --- a/src/utils/crypto/set_key.c +++ /dev/null @@ -1,233 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/set_key.c */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -/* set_key.c v 1.4 eay 24/9/91 - * 1.4 Speed up by 400% :-) - * 1.3 added register declarations. - * 1.2 unrolled make_key_sched a bit more - * 1.1 added norm_expand_bits - * 1.0 First working version - */ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - -#include "des_locl.h" -#include "podd.h" -#include "sk.h" - -int des_check_key=1; - -void des_set_odd_parity(des_cblock (*key)) - { - int i; - - for (i=0; i<(int)DES_KEY_SZ; i++) - (*key)[i]=odd_parity[(*key)[i]]; - } - -/* Weak and semi week keys as take from - * %A D.W. Davies - * %A W.L. Price - * %T Security for Computer Networks - * %I John Wiley & Sons - * %D 1984 - * Many thanks to smb@ulysses.att.com (Steven Bellovin) for the reference - * (and actual cblock values). - */ -#define NUM_WEAK_KEY 18 -static des_cblock weak_keys[NUM_WEAK_KEY]={ - /* weak keys */ - {0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01}, - {0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE,0xFE}, - {0x1F,0x1F,0x1F,0x1F,0x0E,0x0E,0x0E,0x0E}, - {0xE0,0xE0,0xE0,0xE0,0xF1,0xF1,0xF1,0xF1}, - {0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F,0x1F}, - {0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0,0xE0}, - /* semi-weak keys */ - {0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE}, - {0xFE,0x01,0xFE,0x01,0xFE,0x01,0xFE,0x01}, - {0x1F,0xE0,0x1F,0xE0,0x0E,0xF1,0x0E,0xF1}, - {0xE0,0x1F,0xE0,0x1F,0xF1,0x0E,0xF1,0x0E}, - {0x01,0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1}, - {0xE0,0x01,0xE0,0x01,0xF1,0x01,0xF1,0x01}, - {0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E,0xFE}, - {0xFE,0x1F,0xFE,0x1F,0xFE,0x0E,0xFE,0x0E}, - {0x01,0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E}, - {0x1F,0x01,0x1F,0x01,0x0E,0x01,0x0E,0x01}, - {0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1,0xFE}, - {0xFE,0xE0,0xFE,0xE0,0xFE,0xF1,0xFE,0xF1}}; - -int des_is_weak_key(des_cblock (*key)) -{ - int i; - - for (i=0; i>(n))^(b))&(m)),\ - * (b)^=(t),\ - * (a)=((a)^((t)<<(n)))) - */ - -#define HPERM_OP(a,t,n,m) ((t)=((((a)<<(16-(n)))^(a))&(m)),\ - (a)=(a)^(t)^(t>>(16-(n)))) - -/* return 0 if key parity is odd (correct), - * return -1 if key parity error, - * return -2 if illegal weak key. - */ -int des_set_key(des_cblock (*key), des_key_schedule schedule) - { - static int shifts2[16]={0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0}; - register DES_LONG c,d,t,s,t2; - register unsigned char *in; - register DES_LONG *k; - register int i; - - k=(DES_LONG *)schedule; - in=(unsigned char *)key; - - c2l(in,c); - c2l(in,d); - - /* do PC1 in 60 simple operations */ -/* PERM_OP(d,c,t,4,0x0f0f0f0fL); - HPERM_OP(c,t,-2, 0xcccc0000L); - HPERM_OP(c,t,-1, 0xaaaa0000L); - HPERM_OP(c,t, 8, 0x00ff0000L); - HPERM_OP(c,t,-1, 0xaaaa0000L); - HPERM_OP(d,t,-8, 0xff000000L); - HPERM_OP(d,t, 8, 0x00ff0000L); - HPERM_OP(d,t, 2, 0x33330000L); - d=((d&0x00aa00aaL)<<7L)|((d&0x55005500L)>>7L)|(d&0xaa55aa55L); - d=(d>>8)|((c&0xf0000000L)>>4); - c&=0x0fffffffL; */ - - /* I now do it in 47 simple operations :-) - * Thanks to John Fletcher (john_fletcher@lccmail.ocf.llnl.gov) - * for the inspiration. :-) */ - PERM_OP (d,c,t,4,0x0f0f0f0fL); - HPERM_OP(c,t,-2,0xcccc0000L); - HPERM_OP(d,t,-2,0xcccc0000L); - PERM_OP (d,c,t,1,0x55555555L); - PERM_OP (c,d,t,8,0x00ff00ffL); - PERM_OP (d,c,t,1,0x55555555L); - d= (((d&0x000000ffL)<<16L)| (d&0x0000ff00L) | - ((d&0x00ff0000L)>>16L)|((c&0xf0000000L)>>4L)); - c&=0x0fffffffL; - - for (i=0; i>2L)|(c<<26L)); d=((d>>2L)|(d<<26L)); } - else - { c=((c>>1L)|(c<<27L)); d=((d>>1L)|(d<<27L)); } - c&=0x0fffffffL; - d&=0x0fffffffL; - /* could be a few less shifts but I am to lazy at this - * point in time to investigate */ - s= des_skb[0][ (c )&0x3f ]| - des_skb[1][((c>> 6)&0x03)|((c>> 7L)&0x3c)]| - des_skb[2][((c>>13)&0x0f)|((c>>14L)&0x30)]| - des_skb[3][((c>>20)&0x01)|((c>>21L)&0x06) | - ((c>>22L)&0x38)]; - t= des_skb[4][ (d )&0x3f ]| - des_skb[5][((d>> 7L)&0x03)|((d>> 8L)&0x3c)]| - des_skb[6][ (d>>15L)&0x3f ]| - des_skb[7][((d>>21L)&0x0f)|((d>>22L)&0x30)]; - - /* table contained 0213 4657 */ - t2=((t<<16L)|(s&0x0000ffffL))&0xffffffffL; - *(k++)=ROTATE(t2,30)&0xffffffffL; - - t2=((s>>16L)|(t&0xffff0000L)); - *(k++)=ROTATE(t2,26)&0xffffffffL; - } - - if (des_check_key) - { - //if (!check_parity(key)) - // return(-1); - - if (des_is_weak_key(key)) - return(-2); - } - - return(0); - } - -int des_key_sched(des_cblock (*key), des_key_schedule schedule) - { - return(des_set_key(key,schedule)); - } diff --git a/src/utils/crypto/set_key.h b/src/utils/crypto/set_key.h deleted file mode 100644 index a3f1c689c42..00000000000 --- a/src/utils/crypto/set_key.h +++ /dev/null @@ -1,6 +0,0 @@ -/* Deprecated/legacy */ - -void des_set_odd_parity ( des_cblock (*key )); -int des_is_weak_key ( des_cblock (*key )); -int des_set_key ( des_cblock (*key ), des_key_schedule schedule ); -int des_key_sched ( des_cblock (*key ), des_key_schedule schedule ); diff --git a/src/utils/crypto/sha1.c b/src/utils/crypto/sha1.c deleted file mode 100644 index 370479ec82b..00000000000 --- a/src/utils/crypto/sha1.c +++ /dev/null @@ -1,280 +0,0 @@ -/* Deprecated/legacy */ - -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 18/06/2004 - - This is a byte oriented version of SHA1 that operates on arrays of bytes - stored in memory. -*/ - -#include /* for memcpy() etc. */ -#include /* for _lrotl with VC++ */ - -#include "sha1.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* - To obtain the highest speed on processors with 32-bit words, this code - needs to determine the order in which bytes are packed into such words. - The following block of code is an attempt to capture the most obvious - ways in which various environemnts specify their endian definitions. - It may well fail, in which case the definitions will need to be set by - editing at the points marked **** EDIT HERE IF NECESSARY **** below. -*/ - -/* PLATFORM SPECIFIC INCLUDES */ - -/* Original byte order detection removed */ -#include "../common/endian.h" - -#define BRG_LITTLE_ENDIAN 1234 /* byte 0 is least significant (i386) */ -#define BRG_BIG_ENDIAN 4321 /* byte 0 is most significant (mc68k) */ - -#if BYTE_ORDER == LITTLE_ENDIAN -# define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN -#endif - -#if BYTE_ORDER == BIG_ENDIAN -# define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN -#endif - -#ifdef _MSC_VER -#pragma intrinsic(memcpy) -#endif - -#if 1 && defined(_MSC_VER) && !defined(_DEBUG) -#define rotl32 _rotl -#define rotr32 _rotr -#else -#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) -#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) -#endif - -#if !defined(bswap_32) -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) -#endif - -#if (PLATFORM_BYTE_ORDER == BRG_LITTLE_ENDIAN) -#define SWAP_BYTES -#else -#undef SWAP_BYTES -#endif - -#if defined(SWAP_BYTES) -#define bsw_32(p,n) \ - { int _i = (n); while(_i--) ((sha1_32t*)p)[_i] = bswap_32(((sha1_32t*)p)[_i]); } -#else -#define bsw_32(p,n) -#endif - -#define SHA1_MASK (SHA1_BLOCK_SIZE - 1) - -#if 0 - -#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define parity(x,y,z) ((x) ^ (y) ^ (z)) -#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#else /* Discovered by Rich Schroeppel and Colin Plumb */ - -#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define parity(x,y,z) ((x) ^ (y) ^ (z)) -#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) - -#endif - -/* Compile 64 bytes of hash data into SHA1 context. Note */ -/* that this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is in such an order that low */ -/* address bytes in the ORIGINAL byte stream will go in */ -/* this buffer to the high end of 32-bit words on BOTH big */ -/* and little endian systems */ - -#ifdef ARRAY -#define q(v,n) v[n] -#else -#define q(v,n) v##n -#endif - -#define one_cycle(v,a,b,c,d,e,f,k,h) \ - q(v,e) += rotr32(q(v,a),27) + \ - f(q(v,b),q(v,c),q(v,d)) + k + h; \ - q(v,b) = rotr32(q(v,b), 2) - -#define five_cycle(v,f,k,i) \ - one_cycle(v, 0,1,2,3,4, f,k,hf(i )); \ - one_cycle(v, 4,0,1,2,3, f,k,hf(i+1)); \ - one_cycle(v, 3,4,0,1,2, f,k,hf(i+2)); \ - one_cycle(v, 2,3,4,0,1, f,k,hf(i+3)); \ - one_cycle(v, 1,2,3,4,0, f,k,hf(i+4)) - -void sha1_compile(sha1_ctx ctx[1]) -{ sha1_32t *w = ctx->wbuf; - -#ifdef ARRAY - sha1_32t v[5]; - memcpy(v, ctx->hash, 5 * sizeof(sha1_32t)); -#else - sha1_32t v0, v1, v2, v3, v4; - v0 = ctx->hash[0]; v1 = ctx->hash[1]; - v2 = ctx->hash[2]; v3 = ctx->hash[3]; - v4 = ctx->hash[4]; -#endif - -#define hf(i) w[i] - - five_cycle(v, ch, 0x5a827999, 0); - five_cycle(v, ch, 0x5a827999, 5); - five_cycle(v, ch, 0x5a827999, 10); - one_cycle(v,0,1,2,3,4, ch, 0x5a827999, hf(15)); \ - -#undef hf -#define hf(i) (w[(i) & 15] = rotl32( \ - w[((i) + 13) & 15] ^ w[((i) + 8) & 15] \ - ^ w[((i) + 2) & 15] ^ w[(i) & 15], 1)) - - one_cycle(v,4,0,1,2,3, ch, 0x5a827999, hf(16)); - one_cycle(v,3,4,0,1,2, ch, 0x5a827999, hf(17)); - one_cycle(v,2,3,4,0,1, ch, 0x5a827999, hf(18)); - one_cycle(v,1,2,3,4,0, ch, 0x5a827999, hf(19)); - - five_cycle(v, parity, 0x6ed9eba1, 20); - five_cycle(v, parity, 0x6ed9eba1, 25); - five_cycle(v, parity, 0x6ed9eba1, 30); - five_cycle(v, parity, 0x6ed9eba1, 35); - - five_cycle(v, maj, 0x8f1bbcdc, 40); - five_cycle(v, maj, 0x8f1bbcdc, 45); - five_cycle(v, maj, 0x8f1bbcdc, 50); - five_cycle(v, maj, 0x8f1bbcdc, 55); - - five_cycle(v, parity, 0xca62c1d6, 60); - five_cycle(v, parity, 0xca62c1d6, 65); - five_cycle(v, parity, 0xca62c1d6, 70); - five_cycle(v, parity, 0xca62c1d6, 75); - -#ifdef ARRAY - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; -#else - ctx->hash[0] += v0; ctx->hash[1] += v1; - ctx->hash[2] += v2; ctx->hash[3] += v3; - ctx->hash[4] += v4; -#endif -} - -void sha1_begin(sha1_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - ctx->hash[0] = 0x67452301; - ctx->hash[1] = 0xefcdab89; - ctx->hash[2] = 0x98badcfe; - ctx->hash[3] = 0x10325476; - ctx->hash[4] = 0xc3d2e1f0; -} - -/* SHA1 hash data in an array of bytes into hash buffer and */ -/* call the hash_compile function as required. */ - -void sha1_hash(const unsigned char data[], uint32_t len, sha1_ctx ctx[1]) -{ sha1_32t pos = (sha1_32t)(ctx->count[0] & SHA1_MASK), - space = SHA1_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks if possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA1_BLOCK_SIZE; pos = 0; - bsw_32(ctx->wbuf, SHA1_BLOCK_SIZE >> 2); - sha1_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); -} - -/* SHA1 final padding and digest calculation */ - -void sha1_end(unsigned char hval[], sha1_ctx ctx[1]) -{ sha1_32t i = (sha1_32t)(ctx->count[0] & SHA1_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_32(ctx->wbuf, (i + 3) >> 2); - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); - ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); - - /* we need 9 or more empty positions, one for the padding byte */ - /* (above) and eight for the length count. If there is not */ - /* enough space, pad and empty the buffer */ - if(i > SHA1_BLOCK_SIZE - 9) - { - if(i < 60) ctx->wbuf[15] = 0; - sha1_compile(ctx); - i = 0; - } - else /* compute a word index for the empty buffer positions */ - i = (i >> 2) + 1; - - while(i < 14) /* and zero pad all but last two positions */ - ctx->wbuf[i++] = 0; - - /* the following 32-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 32-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); - ctx->wbuf[15] = ctx->count[0] << 3; - sha1_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* misaligned for 32-bit words */ - for(i = 0; i < SHA1_DIGEST_SIZE; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); -} - -void sha1(unsigned char hval[], const unsigned char data[], uint32_t len) -{ sha1_ctx cx[1]; - - sha1_begin(cx); sha1_hash(data, len, cx); sha1_end(hval, cx); -} - -#if defined(__cplusplus) -} -#endif diff --git a/src/utils/crypto/sha1.h b/src/utils/crypto/sha1.h deleted file mode 100644 index d622f9839ca..00000000000 --- a/src/utils/crypto/sha1.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 26/08/2003 -*/ - -#ifndef _SHA1_H -#define _SHA1_H - -#include -#include - -#define SHA1_BLOCK_SIZE 64 -#define SHA1_DIGEST_SIZE 20 - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* define an unsigned 32-bit type */ - -#if defined(_MSC_VER) - typedef uint32_t sha1_32t; -#elif defined(ULONG_MAX) && ULONG_MAX == 0xfffffffful - typedef uint32_t sha1_32t; -#elif defined(UINT_MAX) && UINT_MAX == 0xffffffff - typedef uint32_t sha1_32t; -#else -# error Please define sha1_32t as an unsigned 32 bit type in sha1.h -#endif - -/* type to hold the SHA256 context */ - -typedef struct -{ sha1_32t count[2]; - sha1_32t hash[5]; - sha1_32t wbuf[16]; -} sha1_ctx; - -/* Note that these prototypes are the same for both bit and */ -/* byte oriented implementations. However the length fields */ -/* are in bytes or bits as appropriate for the version used */ -/* and bit sequences are input as arrays of bytes in which */ -/* bit sequences run from the most to the least significant */ -/* end of each byte */ - -void sha1_compile(sha1_ctx ctx[1]); - -void sha1_begin(sha1_ctx ctx[1]); -void sha1_hash(const uint8_t data[], uint32_t len, sha1_ctx ctx[1]); -void sha1_end(uint8_t hval[], sha1_ctx ctx[1]); -void sha1(uint8_t hval[], const uint8_t data[], uint32_t len); - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/src/utils/crypto/sha2.c b/src/utils/crypto/sha2.c deleted file mode 100644 index cc528d941d1..00000000000 --- a/src/utils/crypto/sha2.c +++ /dev/null @@ -1,770 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 01/08/2005 - - This is a byte oriented version of SHA2 that operates on arrays of bytes - stored in memory. This code implements sha256, sha384 and sha512 but the - latter two functions rely on efficient 64-bit integer operations that - may not be very efficient on 32-bit machines - - The sha256 functions use a type 'sha256_ctx' to hold details of the - current hash state and uses the following three calls: - - void sha256_begin(sha256_ctx ctx[1]) - void sha256_hash(const unsigned char data[], - unsigned long len, sha256_ctx ctx[1]) - void sha_end1(unsigned char hval[], sha256_ctx ctx[1]) - - The first subroutine initialises a hash computation by setting up the - context in the sha256_ctx context. The second subroutine hashes 8-bit - bytes from array data[] into the hash state withinh sha256_ctx context, - the number of bytes to be hashed being given by the the unsigned long - integer len. The third subroutine completes the hash calculation and - places the resulting digest value in the array of 8-bit bytes hval[]. - - The sha384 and sha512 functions are similar and use the interfaces: - - void sha384_begin(sha384_ctx ctx[1]); - void sha384_hash(const unsigned char data[], - unsigned long len, sha384_ctx ctx[1]); - void sha384_end(unsigned char hval[], sha384_ctx ctx[1]); - - void sha512_begin(sha512_ctx ctx[1]); - void sha512_hash(const unsigned char data[], - unsigned long len, sha512_ctx ctx[1]); - void sha512_end(unsigned char hval[], sha512_ctx ctx[1]); - - In addition there is a function sha2 that can be used to call all these - functions using a call with a hash length parameter as follows: - - int sha2_begin(unsigned long len, sha2_ctx ctx[1]); - void sha2_hash(const unsigned char data[], - unsigned long len, sha2_ctx ctx[1]); - void sha2_end(unsigned char hval[], sha2_ctx ctx[1]); - - My thanks to Erik Andersen for testing this code - on big-endian systems and for his assistance with corrections -*/ - -#include "../common/endian.h" -#define PLATFORM_BYTE_ORDER BYTE_ORDER -#define IS_LITTLE_ENDIAN LITTLE_ENDIAN - -#if 0 -#define UNROLL_SHA2 /* for SHA2 loop unroll */ -#endif - -#include /* for memcpy() etc. */ - -#include "sha2.h" - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#if defined( _MSC_VER ) && ( _MSC_VER > 800 ) -#pragma intrinsic(memcpy) -#endif - -#if 0 && defined(_MSC_VER) -#define rotl32 _lrotl -#define rotr32 _lrotr -#else -#define rotl32(x,n) (((x) << n) | ((x) >> (32 - n))) -#define rotr32(x,n) (((x) >> n) | ((x) << (32 - n))) -#endif - -#if !defined(bswap_32) -#define bswap_32(x) ((rotr32((x), 24) & 0x00ff00ff) | (rotr32((x), 8) & 0xff00ff00)) -#endif - -#if (PLATFORM_BYTE_ORDER == IS_LITTLE_ENDIAN) -#define SWAP_BYTES -#else -#undef SWAP_BYTES -#endif - -#if 0 - -#define ch(x,y,z) (((x) & (y)) ^ (~(x) & (z))) -#define maj(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z))) - -#else /* Thanks to Rich Schroeppel and Colin Plumb for the following */ - -#define ch(x,y,z) ((z) ^ ((x) & ((y) ^ (z)))) -#define maj(x,y,z) (((x) & (y)) | ((z) & ((x) ^ (y)))) - -#endif - -/* round transforms for SHA256 and SHA512 compression functions */ - -#define vf(n,i) v[(n - i) & 7] - -#define hf(i) (p[i & 15] += \ - g_1(p[(i + 14) & 15]) + p[(i + 9) & 15] + g_0(p[(i + 1) & 15])) - -#define v_cycle(i,j) \ - vf(7,i) += (j ? hf(i) : p[i]) + k_0[i+j] \ - + s_1(vf(4,i)) + ch(vf(4,i),vf(5,i),vf(6,i)); \ - vf(3,i) += vf(7,i); \ - vf(7,i) += s_0(vf(0,i))+ maj(vf(0,i),vf(1,i),vf(2,i)) - -#if defined(SHA_224) || defined(SHA_256) - -#define SHA256_MASK (SHA256_BLOCK_SIZE - 1) - -#if defined(SWAP_BYTES) -#define bsw_32(p,n) \ - { int _i = (n); while(_i--) ((uint_32t*)p)[_i] = bswap_32(((uint_32t*)p)[_i]); } -#else -#define bsw_32(p,n) -#endif - -#define s_0(x) (rotr32((x), 2) ^ rotr32((x), 13) ^ rotr32((x), 22)) -#define s_1(x) (rotr32((x), 6) ^ rotr32((x), 11) ^ rotr32((x), 25)) -#define g_0(x) (rotr32((x), 7) ^ rotr32((x), 18) ^ ((x) >> 3)) -#define g_1(x) (rotr32((x), 17) ^ rotr32((x), 19) ^ ((x) >> 10)) -#define k_0 k256 - -/* rotated SHA256 round definition. Rather than swapping variables as in */ -/* FIPS-180, different variables are 'rotated' on each round, returning */ -/* to their starting positions every eight rounds */ - -#define q(n) v##n - -#define one_cycle(a,b,c,d,e,f,g,h,k,w) \ - q(h) += s_1(q(e)) + ch(q(e), q(f), q(g)) + k + w; \ - q(d) += q(h); q(h) += s_0(q(a)) + maj(q(a), q(b), q(c)) - -/* SHA256 mixing data */ - -const uint_32t k256[64] = -{ 0x428a2f98ul, 0x71374491ul, 0xb5c0fbcful, 0xe9b5dba5ul, - 0x3956c25bul, 0x59f111f1ul, 0x923f82a4ul, 0xab1c5ed5ul, - 0xd807aa98ul, 0x12835b01ul, 0x243185beul, 0x550c7dc3ul, - 0x72be5d74ul, 0x80deb1feul, 0x9bdc06a7ul, 0xc19bf174ul, - 0xe49b69c1ul, 0xefbe4786ul, 0x0fc19dc6ul, 0x240ca1ccul, - 0x2de92c6ful, 0x4a7484aaul, 0x5cb0a9dcul, 0x76f988daul, - 0x983e5152ul, 0xa831c66dul, 0xb00327c8ul, 0xbf597fc7ul, - 0xc6e00bf3ul, 0xd5a79147ul, 0x06ca6351ul, 0x14292967ul, - 0x27b70a85ul, 0x2e1b2138ul, 0x4d2c6dfcul, 0x53380d13ul, - 0x650a7354ul, 0x766a0abbul, 0x81c2c92eul, 0x92722c85ul, - 0xa2bfe8a1ul, 0xa81a664bul, 0xc24b8b70ul, 0xc76c51a3ul, - 0xd192e819ul, 0xd6990624ul, 0xf40e3585ul, 0x106aa070ul, - 0x19a4c116ul, 0x1e376c08ul, 0x2748774cul, 0x34b0bcb5ul, - 0x391c0cb3ul, 0x4ed8aa4aul, 0x5b9cca4ful, 0x682e6ff3ul, - 0x748f82eeul, 0x78a5636ful, 0x84c87814ul, 0x8cc70208ul, - 0x90befffaul, 0xa4506cebul, 0xbef9a3f7ul, 0xc67178f2ul, -}; - -/* Compile 64 bytes of hash data into SHA256 digest value */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is such that low address bytes */ -/* in the ORIGINAL byte stream will go into the high end of */ -/* words on BOTH big and little endian systems */ - -VOID_RETURN sha256_compile(sha256_ctx ctx[1]) -{ -#if !defined(UNROLL_SHA2) - - uint_32t j, *p = ctx->wbuf, v[8]; - - memcpy(v, ctx->hash, 8 * sizeof(uint_32t)); - - for(j = 0; j < 64; j += 16) - { - v_cycle( 0, j); v_cycle( 1, j); - v_cycle( 2, j); v_cycle( 3, j); - v_cycle( 4, j); v_cycle( 5, j); - v_cycle( 6, j); v_cycle( 7, j); - v_cycle( 8, j); v_cycle( 9, j); - v_cycle(10, j); v_cycle(11, j); - v_cycle(12, j); v_cycle(13, j); - v_cycle(14, j); v_cycle(15, j); - } - - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; - ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; - -#else - - uint_32t *p = ctx->wbuf,v0,v1,v2,v3,v4,v5,v6,v7; - - v0 = ctx->hash[0]; v1 = ctx->hash[1]; - v2 = ctx->hash[2]; v3 = ctx->hash[3]; - v4 = ctx->hash[4]; v5 = ctx->hash[5]; - v6 = ctx->hash[6]; v7 = ctx->hash[7]; - - one_cycle(0,1,2,3,4,5,6,7,k256[ 0],p[ 0]); - one_cycle(7,0,1,2,3,4,5,6,k256[ 1],p[ 1]); - one_cycle(6,7,0,1,2,3,4,5,k256[ 2],p[ 2]); - one_cycle(5,6,7,0,1,2,3,4,k256[ 3],p[ 3]); - one_cycle(4,5,6,7,0,1,2,3,k256[ 4],p[ 4]); - one_cycle(3,4,5,6,7,0,1,2,k256[ 5],p[ 5]); - one_cycle(2,3,4,5,6,7,0,1,k256[ 6],p[ 6]); - one_cycle(1,2,3,4,5,6,7,0,k256[ 7],p[ 7]); - one_cycle(0,1,2,3,4,5,6,7,k256[ 8],p[ 8]); - one_cycle(7,0,1,2,3,4,5,6,k256[ 9],p[ 9]); - one_cycle(6,7,0,1,2,3,4,5,k256[10],p[10]); - one_cycle(5,6,7,0,1,2,3,4,k256[11],p[11]); - one_cycle(4,5,6,7,0,1,2,3,k256[12],p[12]); - one_cycle(3,4,5,6,7,0,1,2,k256[13],p[13]); - one_cycle(2,3,4,5,6,7,0,1,k256[14],p[14]); - one_cycle(1,2,3,4,5,6,7,0,k256[15],p[15]); - - one_cycle(0,1,2,3,4,5,6,7,k256[16],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[17],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[18],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[19],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[20],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[21],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[22],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[23],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[24],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[25],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[26],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[27],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[28],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[29],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[30],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[31],hf(15)); - - one_cycle(0,1,2,3,4,5,6,7,k256[32],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[33],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[34],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[35],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[36],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[37],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[38],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[39],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[40],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[41],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[42],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[43],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[44],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[45],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[46],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[47],hf(15)); - - one_cycle(0,1,2,3,4,5,6,7,k256[48],hf( 0)); - one_cycle(7,0,1,2,3,4,5,6,k256[49],hf( 1)); - one_cycle(6,7,0,1,2,3,4,5,k256[50],hf( 2)); - one_cycle(5,6,7,0,1,2,3,4,k256[51],hf( 3)); - one_cycle(4,5,6,7,0,1,2,3,k256[52],hf( 4)); - one_cycle(3,4,5,6,7,0,1,2,k256[53],hf( 5)); - one_cycle(2,3,4,5,6,7,0,1,k256[54],hf( 6)); - one_cycle(1,2,3,4,5,6,7,0,k256[55],hf( 7)); - one_cycle(0,1,2,3,4,5,6,7,k256[56],hf( 8)); - one_cycle(7,0,1,2,3,4,5,6,k256[57],hf( 9)); - one_cycle(6,7,0,1,2,3,4,5,k256[58],hf(10)); - one_cycle(5,6,7,0,1,2,3,4,k256[59],hf(11)); - one_cycle(4,5,6,7,0,1,2,3,k256[60],hf(12)); - one_cycle(3,4,5,6,7,0,1,2,k256[61],hf(13)); - one_cycle(2,3,4,5,6,7,0,1,k256[62],hf(14)); - one_cycle(1,2,3,4,5,6,7,0,k256[63],hf(15)); - - ctx->hash[0] += v0; ctx->hash[1] += v1; - ctx->hash[2] += v2; ctx->hash[3] += v3; - ctx->hash[4] += v4; ctx->hash[5] += v5; - ctx->hash[6] += v6; ctx->hash[7] += v7; -#endif -} - -/* SHA256 hash data in an array of bytes into hash buffer */ -/* and call the hash_compile function as required. */ - -VOID_RETURN sha256_hash(const unsigned char data[], unsigned long len, sha256_ctx ctx[1]) -{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA256_MASK), - space = SHA256_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks while possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA256_BLOCK_SIZE; pos = 0; - bsw_32(ctx->wbuf, SHA256_BLOCK_SIZE >> 2) - sha256_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); -} - -/* SHA256 Final padding and digest calculation */ - -static void sha_end1(unsigned char hval[], sha256_ctx ctx[1], const unsigned int hlen) -{ uint_32t i = (uint_32t)(ctx->count[0] & SHA256_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_32(ctx->wbuf, (i + 3) >> 2) - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 2] &= 0xffffff80 << 8 * (~i & 3); - ctx->wbuf[i >> 2] |= 0x00000080 << 8 * (~i & 3); - - /* we need 9 or more empty positions, one for the padding byte */ - /* (above) and eight for the length count. If there is not */ - /* enough space pad and empty the buffer */ - if(i > SHA256_BLOCK_SIZE - 9) - { - if(i < 60) ctx->wbuf[15] = 0; - sha256_compile(ctx); - i = 0; - } - else /* compute a word index for the empty buffer positions */ - i = (i >> 2) + 1; - - while(i < 14) /* and zero pad all but last two positions */ - ctx->wbuf[i++] = 0; - - /* the following 32-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 32-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 29); - ctx->wbuf[15] = ctx->count[0] << 3; - sha256_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* mislaigned for 32-bit words */ - for(i = 0; i < hlen; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 2] >> (8 * (~i & 3))); -} - -#endif - -#if defined(SHA_224) - -const uint_32t i224[8] = -{ - 0xc1059ed8ul, 0x367cd507ul, 0x3070dd17ul, 0xf70e5939ul, - 0xffc00b31ul, 0x68581511ul, 0x64f98fa7ul, 0xbefa4fa4ul -}; - -VOID_RETURN sha224_begin(sha224_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i224, 8 * sizeof(uint_32t)); -} - -VOID_RETURN sha224_end(unsigned char hval[], sha224_ctx ctx[1]) -{ - sha_end1(hval, ctx, SHA224_DIGEST_SIZE); -} - -VOID_RETURN sha224(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha224_ctx cx[1]; - - sha224_begin(cx); - sha224_hash(data, len, cx); - sha_end1(hval, cx, SHA224_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_256) - -const uint_32t i256[8] = -{ - 0x6a09e667ul, 0xbb67ae85ul, 0x3c6ef372ul, 0xa54ff53aul, - 0x510e527ful, 0x9b05688cul, 0x1f83d9abul, 0x5be0cd19ul -}; - -VOID_RETURN sha256_begin(sha256_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i256, 8 * sizeof(uint_32t)); -} - -VOID_RETURN sha256_end(unsigned char hval[], sha256_ctx ctx[1]) -{ - sha_end1(hval, ctx, SHA256_DIGEST_SIZE); -} - -VOID_RETURN sha256(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha256_ctx cx[1]; - - sha256_begin(cx); - sha256_hash(data, len, cx); - sha_end1(hval, cx, SHA256_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_384) || defined(SHA_512) - -#define SHA512_MASK (SHA512_BLOCK_SIZE - 1) - -#define rotr64(x,n) (((x) >> n) | ((x) << (64 - n))) - -#if !defined(bswap_64) -#define bswap_64(x) (((uint_64t)(bswap_32((uint_32t)(x)))) << 32 | bswap_32((uint_32t)((x) >> 32))) -#endif - -#if defined(SWAP_BYTES) -#define bsw_64(p,n) \ - { int _i = (n); while(_i--) ((uint_64t*)p)[_i] = bswap_64(((uint_64t*)p)[_i]); } -#else -#define bsw_64(p,n) -#endif - -/* SHA512 mixing function definitions */ - -#ifdef s_0 -# undef s_0 -# undef s_1 -# undef g_0 -# undef g_1 -# undef k_0 -#endif - -#define s_0(x) (rotr64((x), 28) ^ rotr64((x), 34) ^ rotr64((x), 39)) -#define s_1(x) (rotr64((x), 14) ^ rotr64((x), 18) ^ rotr64((x), 41)) -#define g_0(x) (rotr64((x), 1) ^ rotr64((x), 8) ^ ((x) >> 7)) -#define g_1(x) (rotr64((x), 19) ^ rotr64((x), 61) ^ ((x) >> 6)) -#define k_0 k512 - -/* SHA384/SHA512 mixing data */ - -const uint_64t k512[80] = -{ - li_64(428a2f98d728ae22), li_64(7137449123ef65cd), - li_64(b5c0fbcfec4d3b2f), li_64(e9b5dba58189dbbc), - li_64(3956c25bf348b538), li_64(59f111f1b605d019), - li_64(923f82a4af194f9b), li_64(ab1c5ed5da6d8118), - li_64(d807aa98a3030242), li_64(12835b0145706fbe), - li_64(243185be4ee4b28c), li_64(550c7dc3d5ffb4e2), - li_64(72be5d74f27b896f), li_64(80deb1fe3b1696b1), - li_64(9bdc06a725c71235), li_64(c19bf174cf692694), - li_64(e49b69c19ef14ad2), li_64(efbe4786384f25e3), - li_64(0fc19dc68b8cd5b5), li_64(240ca1cc77ac9c65), - li_64(2de92c6f592b0275), li_64(4a7484aa6ea6e483), - li_64(5cb0a9dcbd41fbd4), li_64(76f988da831153b5), - li_64(983e5152ee66dfab), li_64(a831c66d2db43210), - li_64(b00327c898fb213f), li_64(bf597fc7beef0ee4), - li_64(c6e00bf33da88fc2), li_64(d5a79147930aa725), - li_64(06ca6351e003826f), li_64(142929670a0e6e70), - li_64(27b70a8546d22ffc), li_64(2e1b21385c26c926), - li_64(4d2c6dfc5ac42aed), li_64(53380d139d95b3df), - li_64(650a73548baf63de), li_64(766a0abb3c77b2a8), - li_64(81c2c92e47edaee6), li_64(92722c851482353b), - li_64(a2bfe8a14cf10364), li_64(a81a664bbc423001), - li_64(c24b8b70d0f89791), li_64(c76c51a30654be30), - li_64(d192e819d6ef5218), li_64(d69906245565a910), - li_64(f40e35855771202a), li_64(106aa07032bbd1b8), - li_64(19a4c116b8d2d0c8), li_64(1e376c085141ab53), - li_64(2748774cdf8eeb99), li_64(34b0bcb5e19b48a8), - li_64(391c0cb3c5c95a63), li_64(4ed8aa4ae3418acb), - li_64(5b9cca4f7763e373), li_64(682e6ff3d6b2b8a3), - li_64(748f82ee5defb2fc), li_64(78a5636f43172f60), - li_64(84c87814a1f0ab72), li_64(8cc702081a6439ec), - li_64(90befffa23631e28), li_64(a4506cebde82bde9), - li_64(bef9a3f7b2c67915), li_64(c67178f2e372532b), - li_64(ca273eceea26619c), li_64(d186b8c721c0c207), - li_64(eada7dd6cde0eb1e), li_64(f57d4f7fee6ed178), - li_64(06f067aa72176fba), li_64(0a637dc5a2c898a6), - li_64(113f9804bef90dae), li_64(1b710b35131c471b), - li_64(28db77f523047d84), li_64(32caab7b40c72493), - li_64(3c9ebe0a15c9bebc), li_64(431d67c49c100d4c), - li_64(4cc5d4becb3e42b6), li_64(597f299cfc657e2a), - li_64(5fcb6fab3ad6faec), li_64(6c44198c4a475817) -}; - -/* Compile 128 bytes of hash data into SHA384/512 digest */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is such that low address bytes */ -/* in the ORIGINAL byte stream will go into the high end of */ -/* words on BOTH big and little endian systems */ - -VOID_RETURN sha512_compile(sha512_ctx ctx[1]) -{ uint_64t v[8], *p = ctx->wbuf; - uint_32t j; - - memcpy(v, ctx->hash, 8 * sizeof(uint_64t)); - - for(j = 0; j < 80; j += 16) - { - v_cycle( 0, j); v_cycle( 1, j); - v_cycle( 2, j); v_cycle( 3, j); - v_cycle( 4, j); v_cycle( 5, j); - v_cycle( 6, j); v_cycle( 7, j); - v_cycle( 8, j); v_cycle( 9, j); - v_cycle(10, j); v_cycle(11, j); - v_cycle(12, j); v_cycle(13, j); - v_cycle(14, j); v_cycle(15, j); - } - - ctx->hash[0] += v[0]; ctx->hash[1] += v[1]; - ctx->hash[2] += v[2]; ctx->hash[3] += v[3]; - ctx->hash[4] += v[4]; ctx->hash[5] += v[5]; - ctx->hash[6] += v[6]; ctx->hash[7] += v[7]; -} - -/* Compile 128 bytes of hash data into SHA256 digest value */ -/* NOTE: this routine assumes that the byte order in the */ -/* ctx->wbuf[] at this point is in such an order that low */ -/* address bytes in the ORIGINAL byte stream placed in this */ -/* buffer will now go to the high end of words on BOTH big */ -/* and little endian systems */ - -VOID_RETURN sha512_hash(const unsigned char data[], unsigned long len, sha512_ctx ctx[1]) -{ uint_32t pos = (uint_32t)(ctx->count[0] & SHA512_MASK), - space = SHA512_BLOCK_SIZE - pos; - const unsigned char *sp = data; - - if((ctx->count[0] += len) < len) - ++(ctx->count[1]); - - while(len >= space) /* tranfer whole blocks while possible */ - { - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, space); - sp += space; len -= space; space = SHA512_BLOCK_SIZE; pos = 0; - bsw_64(ctx->wbuf, SHA512_BLOCK_SIZE >> 3); - sha512_compile(ctx); - } - - memcpy(((unsigned char*)ctx->wbuf) + pos, sp, len); -} - -/* SHA384/512 Final padding and digest calculation */ - -static void sha_end2(unsigned char hval[], sha512_ctx ctx[1], const unsigned int hlen) -{ uint_32t i = (uint_32t)(ctx->count[0] & SHA512_MASK); - - /* put bytes in the buffer in an order in which references to */ - /* 32-bit words will put bytes with lower addresses into the */ - /* top of 32 bit words on BOTH big and little endian machines */ - bsw_64(ctx->wbuf, (i + 7) >> 3); - - /* we now need to mask valid bytes and add the padding which is */ - /* a single 1 bit and as many zero bits as necessary. Note that */ - /* we can always add the first padding byte here because the */ - /* buffer always has at least one empty slot */ - ctx->wbuf[i >> 3] &= li_64(ffffffffffffff00) << 8 * (~i & 7); - ctx->wbuf[i >> 3] |= li_64(0000000000000080) << 8 * (~i & 7); - - /* we need 17 or more empty byte positions, one for the padding */ - /* byte (above) and sixteen for the length count. If there is */ - /* not enough space pad and empty the buffer */ - if(i > SHA512_BLOCK_SIZE - 17) - { - if(i < 120) ctx->wbuf[15] = 0; - sha512_compile(ctx); - i = 0; - } - else - i = (i >> 3) + 1; - - while(i < 14) - ctx->wbuf[i++] = 0; - - /* the following 64-bit length fields are assembled in the */ - /* wrong byte order on little endian machines but this is */ - /* corrected later since they are only ever used as 64-bit */ - /* word values. */ - ctx->wbuf[14] = (ctx->count[1] << 3) | (ctx->count[0] >> 61); - ctx->wbuf[15] = ctx->count[0] << 3; - sha512_compile(ctx); - - /* extract the hash value as bytes in case the hash buffer is */ - /* misaligned for 32-bit words */ - for(i = 0; i < hlen; ++i) - hval[i] = (unsigned char)(ctx->hash[i >> 3] >> (8 * (~i & 7))); -} - -#endif - -#if defined(SHA_384) - -/* SHA384 initialisation data */ - -const uint_64t i384[80] = -{ - li_64(cbbb9d5dc1059ed8), li_64(629a292a367cd507), - li_64(9159015a3070dd17), li_64(152fecd8f70e5939), - li_64(67332667ffc00b31), li_64(8eb44a8768581511), - li_64(db0c2e0d64f98fa7), li_64(47b5481dbefa4fa4) -}; - -VOID_RETURN sha384_begin(sha384_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i384, 8 * sizeof(uint_64t)); -} - -VOID_RETURN sha384_end(unsigned char hval[], sha384_ctx ctx[1]) -{ - sha_end2(hval, ctx, SHA384_DIGEST_SIZE); -} - -VOID_RETURN sha384(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha384_ctx cx[1]; - - sha384_begin(cx); - sha384_hash(data, len, cx); - sha_end2(hval, cx, SHA384_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_512) - -/* SHA512 initialisation data */ - -const uint_64t i512[80] = -{ - li_64(6a09e667f3bcc908), li_64(bb67ae8584caa73b), - li_64(3c6ef372fe94f82b), li_64(a54ff53a5f1d36f1), - li_64(510e527fade682d1), li_64(9b05688c2b3e6c1f), - li_64(1f83d9abfb41bd6b), li_64(5be0cd19137e2179) -}; - -VOID_RETURN sha512_begin(sha512_ctx ctx[1]) -{ - ctx->count[0] = ctx->count[1] = 0; - memcpy(ctx->hash, i512, 8 * sizeof(uint_64t)); -} - -VOID_RETURN sha512_end(unsigned char hval[], sha512_ctx ctx[1]) -{ - sha_end2(hval, ctx, SHA512_DIGEST_SIZE); -} - -VOID_RETURN sha512(unsigned char hval[], const unsigned char data[], unsigned long len) -{ sha512_ctx cx[1]; - - sha512_begin(cx); - sha512_hash(data, len, cx); - sha_end2(hval, cx, SHA512_DIGEST_SIZE); -} - -#endif - -#if defined(SHA_2) - -#define CTX_224(x) ((x)->uu->ctx256) -#define CTX_256(x) ((x)->uu->ctx256) -#define CTX_384(x) ((x)->uu->ctx512) -#define CTX_512(x) ((x)->uu->ctx512) - -/* SHA2 initialisation */ - -INT_RETURN sha2_begin(unsigned long len, sha2_ctx ctx[1]) -{ - switch(len) - { -#if defined(SHA_224) - case 224: - case 28: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; - memcpy(CTX_256(ctx)->hash, i224, 32); - ctx->sha2_len = 28; return EXIT_SUCCESS; -#endif -#if defined(SHA_256) - case 256: - case 32: CTX_256(ctx)->count[0] = CTX_256(ctx)->count[1] = 0; - memcpy(CTX_256(ctx)->hash, i256, 32); - ctx->sha2_len = 32; return EXIT_SUCCESS; -#endif -#if defined(SHA_384) - case 384: - case 48: CTX_384(ctx)->count[0] = CTX_384(ctx)->count[1] = 0; - memcpy(CTX_384(ctx)->hash, i384, 64); - ctx->sha2_len = 48; return EXIT_SUCCESS; -#endif -#if defined(SHA_512) - case 512: - case 64: CTX_512(ctx)->count[0] = CTX_512(ctx)->count[1] = 0; - memcpy(CTX_512(ctx)->hash, i512, 64); - ctx->sha2_len = 64; return EXIT_SUCCESS; -#endif - default: return EXIT_FAILURE; - } -} - -VOID_RETURN sha2_hash(const unsigned char data[], unsigned long len, sha2_ctx ctx[1]) -{ - switch(ctx->sha2_len) - { -#if defined(SHA_224) - case 28: sha224_hash(data, len, CTX_224(ctx)); return; -#endif -#if defined(SHA_256) - case 32: sha256_hash(data, len, CTX_256(ctx)); return; -#endif -#if defined(SHA_384) - case 48: sha384_hash(data, len, CTX_384(ctx)); return; -#endif -#if defined(SHA_512) - case 64: sha512_hash(data, len, CTX_512(ctx)); return; -#endif - } -} - -VOID_RETURN sha2_end(unsigned char hval[], sha2_ctx ctx[1]) -{ - switch(ctx->sha2_len) - { -#if defined(SHA_224) - case 28: sha_end1(hval, CTX_224(ctx), SHA224_DIGEST_SIZE); return; -#endif -#if defined(SHA_256) - case 32: sha_end1(hval, CTX_256(ctx), SHA256_DIGEST_SIZE); return; -#endif -#if defined(SHA_384) - case 48: sha_end2(hval, CTX_384(ctx), SHA384_DIGEST_SIZE); return; -#endif -#if defined(SHA_512) - case 64: sha_end2(hval, CTX_512(ctx), SHA512_DIGEST_SIZE); return; -#endif - } -} - -INT_RETURN sha2(unsigned char hval[], unsigned long size, - const unsigned char data[], unsigned long len) -{ sha2_ctx cx[1]; - - if(sha2_begin(size, cx) == EXIT_SUCCESS) - { - sha2_hash(data, len, cx); sha2_end(hval, cx); return EXIT_SUCCESS; - } - else - return EXIT_FAILURE; -} - -#endif - -#if defined(__cplusplus) -} -#endif diff --git a/src/utils/crypto/sha2.h b/src/utils/crypto/sha2.h deleted file mode 100644 index 791288caf3a..00000000000 --- a/src/utils/crypto/sha2.h +++ /dev/null @@ -1,165 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 2002, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - Issue Date: 01/08/2005 -*/ - -#ifndef _SHA2_H -#define _SHA2_H - -#include -#include -#include -#include -#include <86box/86box.h> - -#define uint_64t uint64_t - -#define uint_32t uint32_t -#define uint_8t uint8_t - -#include "../common/endian.h" - -#define SHA_64BIT - -/* define the hash functions that you need */ -#define SHA_2 /* for dynamic hash length */ -#define SHA_224 -#define SHA_256 -#ifdef SHA_64BIT -# define SHA_384 -# define SHA_512 -# define NEED_UINT_64T -#endif - -#ifndef EXIT_SUCCESS -#define EXIT_SUCCESS 0 -#define EXIT_FAILURE 1 -#endif - -#define li_64(h) 0x##h##ull - -#define VOID_RETURN void -#define INT_RETURN int - -#if defined(__cplusplus) -extern "C" -{ -#endif - -/* Note that the following function prototypes are the same */ -/* for both the bit and byte oriented implementations. But */ -/* the length fields are in bytes or bits as is appropriate */ -/* for the version used. Bit sequences are arrays of bytes */ -/* in which bit sequence indexes increase from the most to */ -/* the least significant end of each byte */ - -#define SHA224_DIGEST_SIZE 28 -#define SHA224_BLOCK_SIZE 64 -#define SHA256_DIGEST_SIZE 32 -#define SHA256_BLOCK_SIZE 64 - -/* type to hold the SHA256 (and SHA224) context */ - -typedef struct -{ uint_32t count[2]; - uint_32t hash[8]; - uint_32t wbuf[16]; -} sha256_ctx; - -typedef sha256_ctx sha224_ctx; - -VOID_RETURN sha256_compile(sha256_ctx ctx[1]); - -VOID_RETURN sha224_begin(sha224_ctx ctx[1]); -#define sha224_hash sha256_hash -VOID_RETURN sha224_end(uint8_t hval[], sha224_ctx ctx[1]); -VOID_RETURN sha224(uint8_t hval[], const uint8_t data[], unsigned long len); - -VOID_RETURN sha256_begin(sha256_ctx ctx[1]); -VOID_RETURN sha256_hash(const uint8_t data[], unsigned long len, sha256_ctx ctx[1]); -VOID_RETURN sha256_end(uint8_t hval[], sha256_ctx ctx[1]); -VOID_RETURN sha256(uint8_t hval[], const uint8_t data[], unsigned long len); - -#ifndef SHA_64BIT - -typedef struct -{ union - { sha256_ctx ctx256[1]; - } uu[1]; - uint_32t sha2_len; -} sha2_ctx; - -#define SHA2_MAX_DIGEST_SIZE SHA256_DIGEST_SIZE - -#else - -#define SHA384_DIGEST_SIZE 48 -#define SHA384_BLOCK_SIZE 128 -#define SHA512_DIGEST_SIZE 64 -#define SHA512_BLOCK_SIZE 128 -#define SHA2_MAX_DIGEST_SIZE SHA512_DIGEST_SIZE - -/* type to hold the SHA384 (and SHA512) context */ - -typedef struct -{ uint_64t count[2]; - uint_64t hash[8]; - uint_64t wbuf[16]; -} sha512_ctx; - -typedef sha512_ctx sha384_ctx; - -typedef struct -{ union - { sha256_ctx ctx256[1]; - sha512_ctx ctx512[1]; - } uu[1]; - uint_32t sha2_len; -} sha2_ctx; - -VOID_RETURN sha512_compile(sha512_ctx ctx[1]); - -VOID_RETURN sha384_begin(sha384_ctx ctx[1]); -#define sha384_hash sha512_hash -VOID_RETURN sha384_end(uint8_t hval[], sha384_ctx ctx[1]); -VOID_RETURN sha384(uint8_t hval[], const uint8_t data[], unsigned long len); - -VOID_RETURN sha512_begin(sha512_ctx ctx[1]); -VOID_RETURN sha512_hash(const uint8_t data[], unsigned long len, sha512_ctx ctx[1]); -VOID_RETURN sha512_end(uint8_t hval[], sha512_ctx ctx[1]); -VOID_RETURN sha512(uint8_t hval[], const uint8_t data[], unsigned long len); - -INT_RETURN sha2_begin(unsigned long size, sha2_ctx ctx[1]); -VOID_RETURN sha2_hash(const uint8_t data[], unsigned long len, sha2_ctx ctx[1]); -VOID_RETURN sha2_end(uint8_t hval[], sha2_ctx ctx[1]); -INT_RETURN sha2(uint8_t hval[], unsigned long size, const uint8_t data[], unsigned long len); - -#endif - -#if defined(__cplusplus) -} -#endif - -#endif diff --git a/src/utils/crypto/sk.h b/src/utils/crypto/sk.h deleted file mode 100644 index ea55bc6ff76..00000000000 --- a/src/utils/crypto/sk.h +++ /dev/null @@ -1,206 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/sk.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -static const DES_LONG des_skb[8][64]={ -{ -/* for C bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ -0x00000000L,0x00000010L,0x20000000L,0x20000010L, -0x00010000L,0x00010010L,0x20010000L,0x20010010L, -0x00000800L,0x00000810L,0x20000800L,0x20000810L, -0x00010800L,0x00010810L,0x20010800L,0x20010810L, -0x00000020L,0x00000030L,0x20000020L,0x20000030L, -0x00010020L,0x00010030L,0x20010020L,0x20010030L, -0x00000820L,0x00000830L,0x20000820L,0x20000830L, -0x00010820L,0x00010830L,0x20010820L,0x20010830L, -0x00080000L,0x00080010L,0x20080000L,0x20080010L, -0x00090000L,0x00090010L,0x20090000L,0x20090010L, -0x00080800L,0x00080810L,0x20080800L,0x20080810L, -0x00090800L,0x00090810L,0x20090800L,0x20090810L, -0x00080020L,0x00080030L,0x20080020L,0x20080030L, -0x00090020L,0x00090030L,0x20090020L,0x20090030L, -0x00080820L,0x00080830L,0x20080820L,0x20080830L, -0x00090820L,0x00090830L,0x20090820L,0x20090830L, -},{ -/* for C bits (numbered as per FIPS 46) 7 8 10 11 12 13 */ -0x00000000L,0x02000000L,0x00002000L,0x02002000L, -0x00200000L,0x02200000L,0x00202000L,0x02202000L, -0x00000004L,0x02000004L,0x00002004L,0x02002004L, -0x00200004L,0x02200004L,0x00202004L,0x02202004L, -0x00000400L,0x02000400L,0x00002400L,0x02002400L, -0x00200400L,0x02200400L,0x00202400L,0x02202400L, -0x00000404L,0x02000404L,0x00002404L,0x02002404L, -0x00200404L,0x02200404L,0x00202404L,0x02202404L, -0x10000000L,0x12000000L,0x10002000L,0x12002000L, -0x10200000L,0x12200000L,0x10202000L,0x12202000L, -0x10000004L,0x12000004L,0x10002004L,0x12002004L, -0x10200004L,0x12200004L,0x10202004L,0x12202004L, -0x10000400L,0x12000400L,0x10002400L,0x12002400L, -0x10200400L,0x12200400L,0x10202400L,0x12202400L, -0x10000404L,0x12000404L,0x10002404L,0x12002404L, -0x10200404L,0x12200404L,0x10202404L,0x12202404L, -},{ -/* for C bits (numbered as per FIPS 46) 14 15 16 17 19 20 */ -0x00000000L,0x00000001L,0x00040000L,0x00040001L, -0x01000000L,0x01000001L,0x01040000L,0x01040001L, -0x00000002L,0x00000003L,0x00040002L,0x00040003L, -0x01000002L,0x01000003L,0x01040002L,0x01040003L, -0x00000200L,0x00000201L,0x00040200L,0x00040201L, -0x01000200L,0x01000201L,0x01040200L,0x01040201L, -0x00000202L,0x00000203L,0x00040202L,0x00040203L, -0x01000202L,0x01000203L,0x01040202L,0x01040203L, -0x08000000L,0x08000001L,0x08040000L,0x08040001L, -0x09000000L,0x09000001L,0x09040000L,0x09040001L, -0x08000002L,0x08000003L,0x08040002L,0x08040003L, -0x09000002L,0x09000003L,0x09040002L,0x09040003L, -0x08000200L,0x08000201L,0x08040200L,0x08040201L, -0x09000200L,0x09000201L,0x09040200L,0x09040201L, -0x08000202L,0x08000203L,0x08040202L,0x08040203L, -0x09000202L,0x09000203L,0x09040202L,0x09040203L, -},{ -/* for C bits (numbered as per FIPS 46) 21 23 24 26 27 28 */ -0x00000000L,0x00100000L,0x00000100L,0x00100100L, -0x00000008L,0x00100008L,0x00000108L,0x00100108L, -0x00001000L,0x00101000L,0x00001100L,0x00101100L, -0x00001008L,0x00101008L,0x00001108L,0x00101108L, -0x04000000L,0x04100000L,0x04000100L,0x04100100L, -0x04000008L,0x04100008L,0x04000108L,0x04100108L, -0x04001000L,0x04101000L,0x04001100L,0x04101100L, -0x04001008L,0x04101008L,0x04001108L,0x04101108L, -0x00020000L,0x00120000L,0x00020100L,0x00120100L, -0x00020008L,0x00120008L,0x00020108L,0x00120108L, -0x00021000L,0x00121000L,0x00021100L,0x00121100L, -0x00021008L,0x00121008L,0x00021108L,0x00121108L, -0x04020000L,0x04120000L,0x04020100L,0x04120100L, -0x04020008L,0x04120008L,0x04020108L,0x04120108L, -0x04021000L,0x04121000L,0x04021100L,0x04121100L, -0x04021008L,0x04121008L,0x04021108L,0x04121108L, -},{ -/* for D bits (numbered as per FIPS 46) 1 2 3 4 5 6 */ -0x00000000L,0x10000000L,0x00010000L,0x10010000L, -0x00000004L,0x10000004L,0x00010004L,0x10010004L, -0x20000000L,0x30000000L,0x20010000L,0x30010000L, -0x20000004L,0x30000004L,0x20010004L,0x30010004L, -0x00100000L,0x10100000L,0x00110000L,0x10110000L, -0x00100004L,0x10100004L,0x00110004L,0x10110004L, -0x20100000L,0x30100000L,0x20110000L,0x30110000L, -0x20100004L,0x30100004L,0x20110004L,0x30110004L, -0x00001000L,0x10001000L,0x00011000L,0x10011000L, -0x00001004L,0x10001004L,0x00011004L,0x10011004L, -0x20001000L,0x30001000L,0x20011000L,0x30011000L, -0x20001004L,0x30001004L,0x20011004L,0x30011004L, -0x00101000L,0x10101000L,0x00111000L,0x10111000L, -0x00101004L,0x10101004L,0x00111004L,0x10111004L, -0x20101000L,0x30101000L,0x20111000L,0x30111000L, -0x20101004L,0x30101004L,0x20111004L,0x30111004L, -},{ -/* for D bits (numbered as per FIPS 46) 8 9 11 12 13 14 */ -0x00000000L,0x08000000L,0x00000008L,0x08000008L, -0x00000400L,0x08000400L,0x00000408L,0x08000408L, -0x00020000L,0x08020000L,0x00020008L,0x08020008L, -0x00020400L,0x08020400L,0x00020408L,0x08020408L, -0x00000001L,0x08000001L,0x00000009L,0x08000009L, -0x00000401L,0x08000401L,0x00000409L,0x08000409L, -0x00020001L,0x08020001L,0x00020009L,0x08020009L, -0x00020401L,0x08020401L,0x00020409L,0x08020409L, -0x02000000L,0x0A000000L,0x02000008L,0x0A000008L, -0x02000400L,0x0A000400L,0x02000408L,0x0A000408L, -0x02020000L,0x0A020000L,0x02020008L,0x0A020008L, -0x02020400L,0x0A020400L,0x02020408L,0x0A020408L, -0x02000001L,0x0A000001L,0x02000009L,0x0A000009L, -0x02000401L,0x0A000401L,0x02000409L,0x0A000409L, -0x02020001L,0x0A020001L,0x02020009L,0x0A020009L, -0x02020401L,0x0A020401L,0x02020409L,0x0A020409L, -},{ -/* for D bits (numbered as per FIPS 46) 16 17 18 19 20 21 */ -0x00000000L,0x00000100L,0x00080000L,0x00080100L, -0x01000000L,0x01000100L,0x01080000L,0x01080100L, -0x00000010L,0x00000110L,0x00080010L,0x00080110L, -0x01000010L,0x01000110L,0x01080010L,0x01080110L, -0x00200000L,0x00200100L,0x00280000L,0x00280100L, -0x01200000L,0x01200100L,0x01280000L,0x01280100L, -0x00200010L,0x00200110L,0x00280010L,0x00280110L, -0x01200010L,0x01200110L,0x01280010L,0x01280110L, -0x00000200L,0x00000300L,0x00080200L,0x00080300L, -0x01000200L,0x01000300L,0x01080200L,0x01080300L, -0x00000210L,0x00000310L,0x00080210L,0x00080310L, -0x01000210L,0x01000310L,0x01080210L,0x01080310L, -0x00200200L,0x00200300L,0x00280200L,0x00280300L, -0x01200200L,0x01200300L,0x01280200L,0x01280300L, -0x00200210L,0x00200310L,0x00280210L,0x00280310L, -0x01200210L,0x01200310L,0x01280210L,0x01280310L, -},{ -/* for D bits (numbered as per FIPS 46) 22 23 24 25 27 28 */ -0x00000000L,0x04000000L,0x00040000L,0x04040000L, -0x00000002L,0x04000002L,0x00040002L,0x04040002L, -0x00002000L,0x04002000L,0x00042000L,0x04042000L, -0x00002002L,0x04002002L,0x00042002L,0x04042002L, -0x00000020L,0x04000020L,0x00040020L,0x04040020L, -0x00000022L,0x04000022L,0x00040022L,0x04040022L, -0x00002020L,0x04002020L,0x00042020L,0x04042020L, -0x00002022L,0x04002022L,0x00042022L,0x04042022L, -0x00000800L,0x04000800L,0x00040800L,0x04040800L, -0x00000802L,0x04000802L,0x00040802L,0x04040802L, -0x00002800L,0x04002800L,0x00042800L,0x04042800L, -0x00002802L,0x04002802L,0x00042802L,0x04042802L, -0x00000820L,0x04000820L,0x00040820L,0x04040820L, -0x00000822L,0x04000822L,0x00040822L,0x04040822L, -0x00002820L,0x04002820L,0x00042820L,0x04042820L, -0x00002822L,0x04002822L,0x00042822L,0x04042822L, -}}; diff --git a/src/utils/crypto/spr.h b/src/utils/crypto/spr.h deleted file mode 100644 index ef72408c4da..00000000000 --- a/src/utils/crypto/spr.h +++ /dev/null @@ -1,206 +0,0 @@ -/* Deprecated/legacy */ - -/* crypto/des/spr.h */ -/* Copyright (C) 1995-1997 Eric Young (eay@cryptsoft.com) - * All rights reserved. - * - * This package is an SSL implementation written - * by Eric Young (eay@cryptsoft.com). - * The implementation was written so as to conform with Netscapes SSL. - * - * This library is free for commercial and non-commercial use as long as - * the following conditions are aheared to. The following conditions - * apply to all code found in this distribution, be it the RC4, RSA, - * lhash, DES, etc., code; not just the SSL code. The SSL documentation - * included with this distribution is covered by the same copyright terms - * except that the holder is Tim Hudson (tjh@cryptsoft.com). - * - * Copyright remains Eric Young's, and as such any Copyright notices in - * the code are not to be removed. - * If this package is used in a product, Eric Young should be given attribution - * as the author of the parts of the library used. - * This can be in the form of a textual message at program startup or - * in documentation (online or textual) provided with the package. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * "This product includes cryptographic software written by - * Eric Young (eay@cryptsoft.com)" - * The word 'cryptographic' can be left out if the rouines from the library - * being used are not cryptographic related :-). - * 4. If you include any Windows specific code (or a derivative thereof) from - * the apps directory (application code) you must include an acknowledgement: - * "This product includes software written by Tim Hudson (tjh@cryptsoft.com)" - * - * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * The licence and distribution terms for any publically available version or - * derivative of this code cannot be changed. i.e. this code cannot simply be - * copied and put under another distribution licence - * [including the GNU Public Licence.] - */ - -const DES_LONG des_SPtrans[8][64]={ -{ -/* nibble 0 */ -0x02080800L, 0x00080000L, 0x02000002L, 0x02080802L, -0x02000000L, 0x00080802L, 0x00080002L, 0x02000002L, -0x00080802L, 0x02080800L, 0x02080000L, 0x00000802L, -0x02000802L, 0x02000000L, 0x00000000L, 0x00080002L, -0x00080000L, 0x00000002L, 0x02000800L, 0x00080800L, -0x02080802L, 0x02080000L, 0x00000802L, 0x02000800L, -0x00000002L, 0x00000800L, 0x00080800L, 0x02080002L, -0x00000800L, 0x02000802L, 0x02080002L, 0x00000000L, -0x00000000L, 0x02080802L, 0x02000800L, 0x00080002L, -0x02080800L, 0x00080000L, 0x00000802L, 0x02000800L, -0x02080002L, 0x00000800L, 0x00080800L, 0x02000002L, -0x00080802L, 0x00000002L, 0x02000002L, 0x02080000L, -0x02080802L, 0x00080800L, 0x02080000L, 0x02000802L, -0x02000000L, 0x00000802L, 0x00080002L, 0x00000000L, -0x00080000L, 0x02000000L, 0x02000802L, 0x02080800L, -0x00000002L, 0x02080002L, 0x00000800L, 0x00080802L, -},{ -/* nibble 1 */ -0x40108010L, 0x00000000L, 0x00108000L, 0x40100000L, -0x40000010L, 0x00008010L, 0x40008000L, 0x00108000L, -0x00008000L, 0x40100010L, 0x00000010L, 0x40008000L, -0x00100010L, 0x40108000L, 0x40100000L, 0x00000010L, -0x00100000L, 0x40008010L, 0x40100010L, 0x00008000L, -0x00108010L, 0x40000000L, 0x00000000L, 0x00100010L, -0x40008010L, 0x00108010L, 0x40108000L, 0x40000010L, -0x40000000L, 0x00100000L, 0x00008010L, 0x40108010L, -0x00100010L, 0x40108000L, 0x40008000L, 0x00108010L, -0x40108010L, 0x00100010L, 0x40000010L, 0x00000000L, -0x40000000L, 0x00008010L, 0x00100000L, 0x40100010L, -0x00008000L, 0x40000000L, 0x00108010L, 0x40008010L, -0x40108000L, 0x00008000L, 0x00000000L, 0x40000010L, -0x00000010L, 0x40108010L, 0x00108000L, 0x40100000L, -0x40100010L, 0x00100000L, 0x00008010L, 0x40008000L, -0x40008010L, 0x00000010L, 0x40100000L, 0x00108000L, -},{ -/* nibble 2 */ -0x04000001L, 0x04040100L, 0x00000100L, 0x04000101L, -0x00040001L, 0x04000000L, 0x04000101L, 0x00040100L, -0x04000100L, 0x00040000L, 0x04040000L, 0x00000001L, -0x04040101L, 0x00000101L, 0x00000001L, 0x04040001L, -0x00000000L, 0x00040001L, 0x04040100L, 0x00000100L, -0x00000101L, 0x04040101L, 0x00040000L, 0x04000001L, -0x04040001L, 0x04000100L, 0x00040101L, 0x04040000L, -0x00040100L, 0x00000000L, 0x04000000L, 0x00040101L, -0x04040100L, 0x00000100L, 0x00000001L, 0x00040000L, -0x00000101L, 0x00040001L, 0x04040000L, 0x04000101L, -0x00000000L, 0x04040100L, 0x00040100L, 0x04040001L, -0x00040001L, 0x04000000L, 0x04040101L, 0x00000001L, -0x00040101L, 0x04000001L, 0x04000000L, 0x04040101L, -0x00040000L, 0x04000100L, 0x04000101L, 0x00040100L, -0x04000100L, 0x00000000L, 0x04040001L, 0x00000101L, -0x04000001L, 0x00040101L, 0x00000100L, 0x04040000L, -},{ -/* nibble 3 */ -0x00401008L, 0x10001000L, 0x00000008L, 0x10401008L, -0x00000000L, 0x10400000L, 0x10001008L, 0x00400008L, -0x10401000L, 0x10000008L, 0x10000000L, 0x00001008L, -0x10000008L, 0x00401008L, 0x00400000L, 0x10000000L, -0x10400008L, 0x00401000L, 0x00001000L, 0x00000008L, -0x00401000L, 0x10001008L, 0x10400000L, 0x00001000L, -0x00001008L, 0x00000000L, 0x00400008L, 0x10401000L, -0x10001000L, 0x10400008L, 0x10401008L, 0x00400000L, -0x10400008L, 0x00001008L, 0x00400000L, 0x10000008L, -0x00401000L, 0x10001000L, 0x00000008L, 0x10400000L, -0x10001008L, 0x00000000L, 0x00001000L, 0x00400008L, -0x00000000L, 0x10400008L, 0x10401000L, 0x00001000L, -0x10000000L, 0x10401008L, 0x00401008L, 0x00400000L, -0x10401008L, 0x00000008L, 0x10001000L, 0x00401008L, -0x00400008L, 0x00401000L, 0x10400000L, 0x10001008L, -0x00001008L, 0x10000000L, 0x10000008L, 0x10401000L, -},{ -/* nibble 4 */ -0x08000000L, 0x00010000L, 0x00000400L, 0x08010420L, -0x08010020L, 0x08000400L, 0x00010420L, 0x08010000L, -0x00010000L, 0x00000020L, 0x08000020L, 0x00010400L, -0x08000420L, 0x08010020L, 0x08010400L, 0x00000000L, -0x00010400L, 0x08000000L, 0x00010020L, 0x00000420L, -0x08000400L, 0x00010420L, 0x00000000L, 0x08000020L, -0x00000020L, 0x08000420L, 0x08010420L, 0x00010020L, -0x08010000L, 0x00000400L, 0x00000420L, 0x08010400L, -0x08010400L, 0x08000420L, 0x00010020L, 0x08010000L, -0x00010000L, 0x00000020L, 0x08000020L, 0x08000400L, -0x08000000L, 0x00010400L, 0x08010420L, 0x00000000L, -0x00010420L, 0x08000000L, 0x00000400L, 0x00010020L, -0x08000420L, 0x00000400L, 0x00000000L, 0x08010420L, -0x08010020L, 0x08010400L, 0x00000420L, 0x00010000L, -0x00010400L, 0x08010020L, 0x08000400L, 0x00000420L, -0x00000020L, 0x00010420L, 0x08010000L, 0x08000020L, -},{ -/* nibble 5 */ -0x80000040L, 0x00200040L, 0x00000000L, 0x80202000L, -0x00200040L, 0x00002000L, 0x80002040L, 0x00200000L, -0x00002040L, 0x80202040L, 0x00202000L, 0x80000000L, -0x80002000L, 0x80000040L, 0x80200000L, 0x00202040L, -0x00200000L, 0x80002040L, 0x80200040L, 0x00000000L, -0x00002000L, 0x00000040L, 0x80202000L, 0x80200040L, -0x80202040L, 0x80200000L, 0x80000000L, 0x00002040L, -0x00000040L, 0x00202000L, 0x00202040L, 0x80002000L, -0x00002040L, 0x80000000L, 0x80002000L, 0x00202040L, -0x80202000L, 0x00200040L, 0x00000000L, 0x80002000L, -0x80000000L, 0x00002000L, 0x80200040L, 0x00200000L, -0x00200040L, 0x80202040L, 0x00202000L, 0x00000040L, -0x80202040L, 0x00202000L, 0x00200000L, 0x80002040L, -0x80000040L, 0x80200000L, 0x00202040L, 0x00000000L, -0x00002000L, 0x80000040L, 0x80002040L, 0x80202000L, -0x80200000L, 0x00002040L, 0x00000040L, 0x80200040L, -},{ -/* nibble 6 */ -0x00004000L, 0x00000200L, 0x01000200L, 0x01000004L, -0x01004204L, 0x00004004L, 0x00004200L, 0x00000000L, -0x01000000L, 0x01000204L, 0x00000204L, 0x01004000L, -0x00000004L, 0x01004200L, 0x01004000L, 0x00000204L, -0x01000204L, 0x00004000L, 0x00004004L, 0x01004204L, -0x00000000L, 0x01000200L, 0x01000004L, 0x00004200L, -0x01004004L, 0x00004204L, 0x01004200L, 0x00000004L, -0x00004204L, 0x01004004L, 0x00000200L, 0x01000000L, -0x00004204L, 0x01004000L, 0x01004004L, 0x00000204L, -0x00004000L, 0x00000200L, 0x01000000L, 0x01004004L, -0x01000204L, 0x00004204L, 0x00004200L, 0x00000000L, -0x00000200L, 0x01000004L, 0x00000004L, 0x01000200L, -0x00000000L, 0x01000204L, 0x01000200L, 0x00004200L, -0x00000204L, 0x00004000L, 0x01004204L, 0x01000000L, -0x01004200L, 0x00000004L, 0x00004004L, 0x01004204L, -0x01000004L, 0x01004200L, 0x01004000L, 0x00004004L, -},{ -/* nibble 7 */ -0x20800080L, 0x20820000L, 0x00020080L, 0x00000000L, -0x20020000L, 0x00800080L, 0x20800000L, 0x20820080L, -0x00000080L, 0x20000000L, 0x00820000L, 0x00020080L, -0x00820080L, 0x20020080L, 0x20000080L, 0x20800000L, -0x00020000L, 0x00820080L, 0x00800080L, 0x20020000L, -0x20820080L, 0x20000080L, 0x00000000L, 0x00820000L, -0x20000000L, 0x00800000L, 0x20020080L, 0x20800080L, -0x00800000L, 0x00020000L, 0x20820000L, 0x00000080L, -0x00800000L, 0x00020000L, 0x20000080L, 0x20820080L, -0x00020080L, 0x20000000L, 0x00000000L, 0x00820000L, -0x20800080L, 0x20020080L, 0x20020000L, 0x00800080L, -0x20820000L, 0x00000080L, 0x00800080L, 0x20020000L, -0x20820080L, 0x00800000L, 0x20800000L, 0x20000080L, -0x00820000L, 0x00020080L, 0x20020080L, 0x20800000L, -0x00000080L, 0x20820000L, 0x00820080L, 0x00000000L, -0x20000000L, 0x20800080L, 0x00020000L, 0x00820080L, -}}; diff --git a/src/utils/crypto/twofish.c b/src/utils/crypto/twofish.c deleted file mode 100644 index 62abfd7a311..00000000000 --- a/src/utils/crypto/twofish.c +++ /dev/null @@ -1,470 +0,0 @@ -/* - --------------------------------------------------------------------------- - Copyright (c) 1999, Dr Brian Gladman, Worcester, UK. All rights reserved. - - LICENSE TERMS - - The free distribution and use of this software is allowed (with or without - changes) provided that: - - 1. source code distributions include the above copyright notice, this - list of conditions and the following disclaimer; - - 2. binary distributions include the above copyright notice, this list - of conditions and the following disclaimer in their documentation; - - 3. the name of the copyright holder is not used to endorse products - built using this software without specific written permission. - - DISCLAIMER - - This software is provided 'as is' with no explicit or implied warranties - in respect of its properties, including, but not limited to, correctness - and/or fitness for purpose. - --------------------------------------------------------------------------- - - My thanks to Doug Whiting and Niels Ferguson for comments that led - to improvements in this implementation. - - Issue Date: 14th January 1999 -*/ - -/* Adapted for TrueCrypt by the TrueCrypt Foundation */ - - -#include "twofish.h" -#include "../common/endian.h" - -#define Q_TABLES -#define M_TABLE - -# define MK_TABLE -# define ONE_STEP - -/* finite field arithmetic for GF(2**8) with the modular */ -/* polynomial x^8 + x^6 + x^5 + x^3 + 1 (0x169) */ - -#define G_M 0x0169 - -static u1byte tab_5b[4] = { 0, G_M >> 2, G_M >> 1, (G_M >> 1) ^ (G_M >> 2) }; -static u1byte tab_ef[4] = { 0, (G_M >> 1) ^ (G_M >> 2), G_M >> 1, G_M >> 2 }; - -#define ffm_01(x) (x) -#define ffm_5b(x) ((x) ^ ((x) >> 2) ^ tab_5b[(x) & 3]) -#define ffm_ef(x) ((x) ^ ((x) >> 1) ^ ((x) >> 2) ^ tab_ef[(x) & 3]) - -static u1byte ror4[16] = { 0, 8, 1, 9, 2, 10, 3, 11, 4, 12, 5, 13, 6, 14, 7, 15 }; -static u1byte ashx[16] = { 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 5, 14, 7 }; - -static u1byte qt0[2][16] = -{ { 8, 1, 7, 13, 6, 15, 3, 2, 0, 11, 5, 9, 14, 12, 10, 4 }, - { 2, 8, 11, 13, 15, 7, 6, 14, 3, 1, 9, 4, 0, 10, 12, 5 } -}; - -static u1byte qt1[2][16] = -{ { 14, 12, 11, 8, 1, 2, 3, 5, 15, 4, 10, 6, 7, 0, 9, 13 }, - { 1, 14, 2, 11, 4, 12, 3, 7, 6, 13, 10, 5, 15, 9, 0, 8 } -}; - -static u1byte qt2[2][16] = -{ { 11, 10, 5, 14, 6, 13, 9, 0, 12, 8, 15, 3, 2, 4, 7, 1 }, - { 4, 12, 7, 5, 1, 6, 9, 10, 0, 14, 13, 8, 2, 11, 3, 15 } -}; - -static u1byte qt3[2][16] = -{ { 13, 7, 15, 4, 1, 2, 6, 14, 9, 11, 3, 0, 8, 5, 12, 10 }, - { 11, 9, 5, 1, 12, 3, 13, 14, 6, 4, 7, 15, 2, 0, 8, 10 } -}; - -static u1byte qp(const u4byte n, const u1byte x) -{ u1byte a0, a1, a2, a3, a4, b0, b1, b2, b3, b4; - - a0 = x >> 4; b0 = x & 15; - a1 = a0 ^ b0; b1 = ror4[b0] ^ ashx[a0]; - a2 = qt0[n][a1]; b2 = qt1[n][b1]; - a3 = a2 ^ b2; b3 = ror4[b2] ^ ashx[a2]; - a4 = qt2[n][a3]; b4 = qt3[n][b3]; - return (b4 << 4) | a4; -}; - -#ifdef Q_TABLES - -static u4byte qt_gen = 0; -static u1byte q_tab[2][256]; - -#define q(n,x) q_tab[n][x] - -static void gen_qtab(void) -{ u4byte i; - - for(i = 0; i < 256; ++i) - { - q(0,i) = qp(0, (u1byte)i); - q(1,i) = qp(1, (u1byte)i); - } -}; - -#else - -#define q(n,x) qp(n, x) - -#endif - -#ifdef M_TABLE - -static u4byte mt_gen = 0; -static u4byte m_tab[4][256]; - -static void gen_mtab(void) -{ u4byte i, f01, f5b, fef; - - for(i = 0; i < 256; ++i) - { - f01 = q(1,i); f5b = ffm_5b(f01); fef = ffm_ef(f01); - m_tab[0][i] = f01 + (f5b << 8) + (fef << 16) + (fef << 24); - m_tab[2][i] = f5b + (fef << 8) + (f01 << 16) + (fef << 24); - - f01 = q(0,i); f5b = ffm_5b(f01); fef = ffm_ef(f01); - m_tab[1][i] = fef + (fef << 8) + (f5b << 16) + (f01 << 24); - m_tab[3][i] = f5b + (f01 << 8) + (fef << 16) + (f5b << 24); - } -}; - -#define mds(n,x) m_tab[n][x] - -#else - -#define fm_00 ffm_01 -#define fm_10 ffm_5b -#define fm_20 ffm_ef -#define fm_30 ffm_ef -#define q_0(x) q(1,x) - -#define fm_01 ffm_ef -#define fm_11 ffm_ef -#define fm_21 ffm_5b -#define fm_31 ffm_01 -#define q_1(x) q(0,x) - -#define fm_02 ffm_5b -#define fm_12 ffm_ef -#define fm_22 ffm_01 -#define fm_32 ffm_ef -#define q_2(x) q(1,x) - -#define fm_03 ffm_5b -#define fm_13 ffm_01 -#define fm_23 ffm_ef -#define fm_33 ffm_5b -#define q_3(x) q(0,x) - -#define f_0(n,x) ((u4byte)fm_0##n(x)) -#define f_1(n,x) ((u4byte)fm_1##n(x) << 8) -#define f_2(n,x) ((u4byte)fm_2##n(x) << 16) -#define f_3(n,x) ((u4byte)fm_3##n(x) << 24) - -#define mds(n,x) f_0(n,q_##n(x)) ^ f_1(n,q_##n(x)) ^ f_2(n,q_##n(x)) ^ f_3(n,q_##n(x)) - -#endif - -static u4byte h_fun(TwofishInstance *instance, const u4byte x, const u4byte key[]) -{ u4byte b0, b1, b2, b3; - -#ifndef M_TABLE - u4byte m5b_b0, m5b_b1, m5b_b2, m5b_b3; - u4byte mef_b0, mef_b1, mef_b2, mef_b3; -#endif - - b0 = extract_byte(x, 0); b1 = extract_byte(x, 1); b2 = extract_byte(x, 2); b3 = extract_byte(x, 3); - - switch(instance->k_len) - { - case 4: b0 = q(1, (u1byte) b0) ^ extract_byte(key[3],0); - b1 = q(0, (u1byte) b1) ^ extract_byte(key[3],1); - b2 = q(0, (u1byte) b2) ^ extract_byte(key[3],2); - b3 = q(1, (u1byte) b3) ^ extract_byte(key[3],3); - case 3: b0 = q(1, (u1byte) b0) ^ extract_byte(key[2],0); - b1 = q(1, (u1byte) b1) ^ extract_byte(key[2],1); - b2 = q(0, (u1byte) b2) ^ extract_byte(key[2],2); - b3 = q(0, (u1byte) b3) ^ extract_byte(key[2],3); - case 2: b0 = q(0, (u1byte) (q(0, (u1byte) b0) ^ extract_byte(key[1],0))) ^ extract_byte(key[0],0); - b1 = q(0, (u1byte) (q(1, (u1byte) b1) ^ extract_byte(key[1],1))) ^ extract_byte(key[0],1); - b2 = q(1, (u1byte) (q(0, (u1byte) b2) ^ extract_byte(key[1],2))) ^ extract_byte(key[0],2); - b3 = q(1, (u1byte) (q(1, (u1byte) b3) ^ extract_byte(key[1],3))) ^ extract_byte(key[0],3); - } -#ifdef M_TABLE - - return mds(0, b0) ^ mds(1, b1) ^ mds(2, b2) ^ mds(3, b3); - -#else - - b0 = q(1, (u1byte) b0); b1 = q(0, (u1byte) b1); b2 = q(1, (u1byte) b2); b3 = q(0, (u1byte) b3); - m5b_b0 = ffm_5b(b0); m5b_b1 = ffm_5b(b1); m5b_b2 = ffm_5b(b2); m5b_b3 = ffm_5b(b3); - mef_b0 = ffm_ef(b0); mef_b1 = ffm_ef(b1); mef_b2 = ffm_ef(b2); mef_b3 = ffm_ef(b3); - b0 ^= mef_b1 ^ m5b_b2 ^ m5b_b3; b3 ^= m5b_b0 ^ mef_b1 ^ mef_b2; - b2 ^= mef_b0 ^ m5b_b1 ^ mef_b3; b1 ^= mef_b0 ^ mef_b2 ^ m5b_b3; - - return b0 | (b3 << 8) | (b2 << 16) | (b1 << 24); - -#endif -}; - -#ifdef MK_TABLE - -#ifdef ONE_STEP -//u4byte mk_tab[4][256]; -#else -static u1byte sb[4][256]; -#endif - -#define q20(x) q(0,q(0,x) ^ extract_byte(key[1],0)) ^ extract_byte(key[0],0) -#define q21(x) q(0,q(1,x) ^ extract_byte(key[1],1)) ^ extract_byte(key[0],1) -#define q22(x) q(1,q(0,x) ^ extract_byte(key[1],2)) ^ extract_byte(key[0],2) -#define q23(x) q(1,q(1,x) ^ extract_byte(key[1],3)) ^ extract_byte(key[0],3) - -#define q30(x) q(0,q(0,q(1, x) ^ extract_byte(key[2],0)) ^ extract_byte(key[1],0)) ^ extract_byte(key[0],0) -#define q31(x) q(0,q(1,q(1, x) ^ extract_byte(key[2],1)) ^ extract_byte(key[1],1)) ^ extract_byte(key[0],1) -#define q32(x) q(1,q(0,q(0, x) ^ extract_byte(key[2],2)) ^ extract_byte(key[1],2)) ^ extract_byte(key[0],2) -#define q33(x) q(1,q(1,q(0, x) ^ extract_byte(key[2],3)) ^ extract_byte(key[1],3)) ^ extract_byte(key[0],3) - -#define q40(x) q(0,q(0,q(1, q(1, x) ^ extract_byte(key[3],0)) ^ extract_byte(key[2],0)) ^ extract_byte(key[1],0)) ^ extract_byte(key[0],0) -#define q41(x) q(0,q(1,q(1, q(0, x) ^ extract_byte(key[3],1)) ^ extract_byte(key[2],1)) ^ extract_byte(key[1],1)) ^ extract_byte(key[0],1) -#define q42(x) q(1,q(0,q(0, q(0, x) ^ extract_byte(key[3],2)) ^ extract_byte(key[2],2)) ^ extract_byte(key[1],2)) ^ extract_byte(key[0],2) -#define q43(x) q(1,q(1,q(0, q(1, x) ^ extract_byte(key[3],3)) ^ extract_byte(key[2],3)) ^ extract_byte(key[1],3)) ^ extract_byte(key[0],3) - -static void gen_mk_tab(TwofishInstance *instance, u4byte key[]) -{ u4byte i; - u1byte by; - - u4byte *mk_tab = instance->mk_tab; - - switch(instance->k_len) - { - case 2: for(i = 0; i < 256; ++i) - { - by = (u1byte)i; -#ifdef ONE_STEP - mk_tab[0 + 4*i] = mds(0, q20(by)); mk_tab[1 + 4*i] = mds(1, q21(by)); - mk_tab[2 + 4*i] = mds(2, q22(by)); mk_tab[3 + 4*i] = mds(3, q23(by)); -#else - sb[0][i] = q20(by); sb[1][i] = q21(by); - sb[2][i] = q22(by); sb[3][i] = q23(by); -#endif - } - break; - - case 3: for(i = 0; i < 256; ++i) - { - by = (u1byte)i; -#ifdef ONE_STEP - mk_tab[0 + 4*i] = mds(0, q30(by)); mk_tab[1 + 4*i] = mds(1, q31(by)); - mk_tab[2 + 4*i] = mds(2, q32(by)); mk_tab[3 + 4*i] = mds(3, q33(by)); -#else - sb[0][i] = q30(by); sb[1][i] = q31(by); - sb[2][i] = q32(by); sb[3][i] = q33(by); -#endif - } - break; - - case 4: for(i = 0; i < 256; ++i) - { - by = (u1byte)i; -#ifdef ONE_STEP - mk_tab[0 + 4*i] = mds(0, q40(by)); mk_tab[1 + 4*i] = mds(1, q41(by)); - mk_tab[2 + 4*i] = mds(2, q42(by)); mk_tab[3 + 4*i] = mds(3, q43(by)); -#else - sb[0][i] = q40(by); sb[1][i] = q41(by); - sb[2][i] = q42(by); sb[3][i] = q43(by); -#endif - } - } -}; - -# ifdef ONE_STEP -# define g0_fun(x) ( mk_tab[0 + 4*extract_byte(x,0)] ^ mk_tab[1 + 4*extract_byte(x,1)] \ - ^ mk_tab[2 + 4*extract_byte(x,2)] ^ mk_tab[3 + 4*extract_byte(x,3)] ) -# define g1_fun(x) ( mk_tab[0 + 4*extract_byte(x,3)] ^ mk_tab[1 + 4*extract_byte(x,0)] \ - ^ mk_tab[2 + 4*extract_byte(x,1)] ^ mk_tab[3 + 4*extract_byte(x,2)] ) - - -# else -# define g0_fun(x) ( mds(0, sb[0][extract_byte(x,0)]) ^ mds(1, sb[1][extract_byte(x,1)]) \ - ^ mds(2, sb[2][extract_byte(x,2)]) ^ mds(3, sb[3][extract_byte(x,3)]) ) -# define g1_fun(x) ( mds(0, sb[0][extract_byte(x,3)]) ^ mds(1, sb[1][extract_byte(x,0)]) \ - ^ mds(2, sb[2][extract_byte(x,1)]) ^ mds(3, sb[3][extract_byte(x,2)]) ) -# endif - -#else - -#define g0_fun(x) h_fun(instance, x, instance->s_key) -#define g1_fun(x) h_fun(instance, rotl(x,8), instance->s_key) - -#endif - -/* The (12,8) Reed Soloman code has the generator polynomial - - g(x) = x^4 + (a + 1/a) * x^3 + a * x^2 + (a + 1/a) * x + 1 - -where the coefficients are in the finite field GF(2^8) with a -modular polynomial a^8 + a^6 + a^3 + a^2 + 1. To generate the -remainder we have to start with a 12th order polynomial with our -eight input bytes as the coefficients of the 4th to 11th terms. -That is: - - m[7] * x^11 + m[6] * x^10 ... + m[0] * x^4 + 0 * x^3 +... + 0 - -We then multiply the generator polynomial by m[7] * x^7 and subtract -it - xor in GF(2^8) - from the above to eliminate the x^7 term (the -artihmetic on the coefficients is done in GF(2^8). We then multiply -the generator polynomial by x^6 * coeff(x^10) and use this to remove -the x^10 term. We carry on in this way until the x^4 term is removed -so that we are left with: - - r[3] * x^3 + r[2] * x^2 + r[1] 8 x^1 + r[0] - -which give the resulting 4 bytes of the remainder. This is equivalent -to the matrix multiplication in the Twofish description but much faster -to implement. - -*/ - -#define G_MOD 0x0000014d - -static u4byte mds_rem(u4byte p0, u4byte p1) -{ u4byte i, t, u; - - for(i = 0; i < 8; ++i) - { - t = p1 >> 24; // get most significant coefficient - - p1 = (p1 << 8) | (p0 >> 24); p0 <<= 8; // shift others up - - // multiply t by a (the primitive element - i.e. left shift) - - u = (t << 1); - - if(t & 0x80) // subtract modular polynomial on overflow - - u ^= G_MOD; - - p1 ^= t ^ (u << 16); // remove t * (a * x^2 + 1) - - u ^= (t >> 1); // form u = a * t + t / a = t * (a + 1 / a); - - if(t & 0x01) // add the modular polynomial on underflow - - u ^= G_MOD >> 1; - - p1 ^= (u << 24) | (u << 8); // remove t * (a + 1/a) * (x^3 + x) - } - - return p1; -}; - -/* initialise the key schedule from the user supplied key */ - -u4byte *twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len) -{ u4byte i, a, b, me_key[4], mo_key[4]; - u4byte *l_key, *s_key; - - l_key = instance->l_key; - s_key = instance->s_key; - -#ifdef Q_TABLES - if(!qt_gen) - { - gen_qtab(); qt_gen = 1; - } -#endif - -#ifdef M_TABLE - if(!mt_gen) - { - gen_mtab(); mt_gen = 1; - } -#endif - - instance->k_len = key_len / 64; /* 2, 3 or 4 */ - - for(i = 0; i < instance->k_len; ++i) - { - a = LE32(in_key[i + i]); me_key[i] = a; - b = LE32(in_key[i + i + 1]); mo_key[i] = b; - s_key[instance->k_len - i - 1] = mds_rem(a, b); - } - - for(i = 0; i < 40; i += 2) - { - a = 0x01010101 * i; b = a + 0x01010101; - a = h_fun(instance, a, me_key); - b = rotl(h_fun(instance, b, mo_key), 8); - l_key[i] = a + b; - l_key[i + 1] = rotl(a + 2 * b, 9); - } - -#ifdef MK_TABLE - gen_mk_tab(instance, s_key); -#endif - - return l_key; -}; - -/* encrypt a block of text */ - -#define f_rnd(i) \ - t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); \ - blk[2] = rotr(blk[2] ^ (t0 + t1 + l_key[4 * (i) + 8]), 1); \ - blk[3] = rotl(blk[3], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]); \ - t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); \ - blk[0] = rotr(blk[0] ^ (t0 + t1 + l_key[4 * (i) + 10]), 1); \ - blk[1] = rotl(blk[1], 1) ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]) - -void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]) -{ u4byte t0, t1, blk[4]; - - u4byte *l_key = instance->l_key; - u4byte *mk_tab = instance->mk_tab; - - blk[0] = LE32(in_blk[0]) ^ l_key[0]; - blk[1] = LE32(in_blk[1]) ^ l_key[1]; - blk[2] = LE32(in_blk[2]) ^ l_key[2]; - blk[3] = LE32(in_blk[3]) ^ l_key[3]; - - f_rnd(0); f_rnd(1); f_rnd(2); f_rnd(3); - f_rnd(4); f_rnd(5); f_rnd(6); f_rnd(7); - - out_blk[0] = LE32(blk[2] ^ l_key[4]); - out_blk[1] = LE32(blk[3] ^ l_key[5]); - out_blk[2] = LE32(blk[0] ^ l_key[6]); - out_blk[3] = LE32(blk[1] ^ l_key[7]); -}; - -/* decrypt a block of text */ - -#define i_rnd(i) \ - t1 = g1_fun(blk[1]); t0 = g0_fun(blk[0]); \ - blk[2] = rotl(blk[2], 1) ^ (t0 + t1 + l_key[4 * (i) + 10]); \ - blk[3] = rotr(blk[3] ^ (t0 + 2 * t1 + l_key[4 * (i) + 11]), 1); \ - t1 = g1_fun(blk[3]); t0 = g0_fun(blk[2]); \ - blk[0] = rotl(blk[0], 1) ^ (t0 + t1 + l_key[4 * (i) + 8]); \ - blk[1] = rotr(blk[1] ^ (t0 + 2 * t1 + l_key[4 * (i) + 9]), 1) - -void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]) -{ u4byte t0, t1, blk[4]; - - u4byte *l_key = instance->l_key; - u4byte *mk_tab = instance->mk_tab; - - blk[0] = LE32(in_blk[0]) ^ l_key[4]; - blk[1] = LE32(in_blk[1]) ^ l_key[5]; - blk[2] = LE32(in_blk[2]) ^ l_key[6]; - blk[3] = LE32(in_blk[3]) ^ l_key[7]; - - i_rnd(7); i_rnd(6); i_rnd(5); i_rnd(4); - i_rnd(3); i_rnd(2); i_rnd(1); i_rnd(0); - - out_blk[0] = LE32(blk[2] ^ l_key[0]); - out_blk[1] = LE32(blk[3] ^ l_key[1]); - out_blk[2] = LE32(blk[0] ^ l_key[2]); - out_blk[3] = LE32(blk[1] ^ l_key[3]); -}; diff --git a/src/utils/crypto/twofish.h b/src/utils/crypto/twofish.h deleted file mode 100644 index 59725de5d3b..00000000000 --- a/src/utils/crypto/twofish.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef TWOFISH_H -#define TWOFISH_H - -#include - - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#ifndef u4byte -#define u4byte uint32_t -#endif -#ifndef u1byte -#define u1byte uint8_t -#endif - -#ifndef extract_byte -#define extract_byte(x,n) ((u1byte)((x) >> (8 * n))) -#endif - -#ifndef rotl - -#ifdef _WIN32 -#include -// #pragma intrinsic(_lrotr,_lrotl) -#define rotr(x,n) _lrotr(x,n) -#define rotl(x,n) _lrotl(x,n) -#else -#define rotr(x,n) (((x)>>(n))|((x)<<(32-(n)))) -#define rotl(x,n) (((x)<<(n))|((x)>>(32-(n)))) -#endif - -#endif -typedef struct -{ - u4byte l_key[40]; - u4byte s_key[4]; - u4byte mk_tab[4 * 256]; - u4byte k_len; -} TwofishInstance; - -#define TWOFISH_KS sizeof(TwofishInstance) - -u4byte * twofish_set_key(TwofishInstance *instance, const u4byte in_key[], const u4byte key_len); -void twofish_encrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[]); -void twofish_decrypt(TwofishInstance *instance, const u4byte in_blk[4], u4byte out_blk[4]); - -#if defined(__cplusplus) -} -#endif - -#endif // TWOFISH_H diff --git a/src/utils/crypto/whirlpool.c b/src/utils/crypto/whirlpool.c deleted file mode 100644 index baaedb5d02d..00000000000 --- a/src/utils/crypto/whirlpool.c +++ /dev/null @@ -1,1058 +0,0 @@ -/** - * The Whirlpool hashing function. - * - *

- * References - * - *

- * The Whirlpool algorithm was developed by - * Paulo S. L. M. Barreto and - * Vincent Rijmen. - * - * See - * P.S.L.M. Barreto, V. Rijmen, - * ``The Whirlpool hashing function,'' - * NESSIE submission, 2000 (tweaked version, 2001), - * - * - * @author Paulo S.L.M. Barreto - * @author Vincent Rijmen. - * Minor modifications by TrueCrypt Foundation. - * - * @version 3.0 (2003.03.12) - * - * ============================================================================= - * - * Differences from version 2.1: - * - * - Suboptimal diffusion matrix replaced by cir(1, 1, 4, 1, 8, 5, 2, 9). - * - * ============================================================================= - * - * Differences from version 2.0: - * - * - Generation of ISO/IEC 10118-3 test vectors. - * - Bug fix: nonzero carry was ignored when tallying the data length - * (this bug apparently only manifested itself when feeding data - * in pieces rather than in a single chunk at once). - * - Support for MS Visual C++ 64-bit integer arithmetic. - * - * Differences from version 1.0: - * - * - Original S-box replaced by the tweaked, hardware-efficient version. - * - * ============================================================================= - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR - * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE - * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, - * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ - /* The code contained in this file (Whirlpool.c) is in the public domain. */ - -#include -#include -#include -#include - -#include "whirlpool.h" - -/* #define TRACE_INTERMEDIATE_VALUES */ - -/* - * The number of rounds of the internal dedicated block cipher. - */ -#define R 10 - -/* - * Though Whirlpool is endianness-neutral, the encryption tables are listed - * in BIG-ENDIAN format, which is adopted throughout this implementation - * (but little-endian notation would be equally suitable if consistently - * employed). - */ - -static const u64 C0[256] = { - LL(0x18186018c07830d8), LL(0x23238c2305af4626), LL(0xc6c63fc67ef991b8), LL(0xe8e887e8136fcdfb), - LL(0x878726874ca113cb), LL(0xb8b8dab8a9626d11), LL(0x0101040108050209), LL(0x4f4f214f426e9e0d), - LL(0x3636d836adee6c9b), LL(0xa6a6a2a6590451ff), LL(0xd2d26fd2debdb90c), LL(0xf5f5f3f5fb06f70e), - LL(0x7979f979ef80f296), LL(0x6f6fa16f5fcede30), LL(0x91917e91fcef3f6d), LL(0x52525552aa07a4f8), - LL(0x60609d6027fdc047), LL(0xbcbccabc89766535), LL(0x9b9b569baccd2b37), LL(0x8e8e028e048c018a), - LL(0xa3a3b6a371155bd2), LL(0x0c0c300c603c186c), LL(0x7b7bf17bff8af684), LL(0x3535d435b5e16a80), - LL(0x1d1d741de8693af5), LL(0xe0e0a7e05347ddb3), LL(0xd7d77bd7f6acb321), LL(0xc2c22fc25eed999c), - LL(0x2e2eb82e6d965c43), LL(0x4b4b314b627a9629), LL(0xfefedffea321e15d), LL(0x575741578216aed5), - LL(0x15155415a8412abd), LL(0x7777c1779fb6eee8), LL(0x3737dc37a5eb6e92), LL(0xe5e5b3e57b56d79e), - LL(0x9f9f469f8cd92313), LL(0xf0f0e7f0d317fd23), LL(0x4a4a354a6a7f9420), LL(0xdada4fda9e95a944), - LL(0x58587d58fa25b0a2), LL(0xc9c903c906ca8fcf), LL(0x2929a429558d527c), LL(0x0a0a280a5022145a), - LL(0xb1b1feb1e14f7f50), LL(0xa0a0baa0691a5dc9), LL(0x6b6bb16b7fdad614), LL(0x85852e855cab17d9), - LL(0xbdbdcebd8173673c), LL(0x5d5d695dd234ba8f), LL(0x1010401080502090), LL(0xf4f4f7f4f303f507), - LL(0xcbcb0bcb16c08bdd), LL(0x3e3ef83eedc67cd3), LL(0x0505140528110a2d), LL(0x676781671fe6ce78), - LL(0xe4e4b7e47353d597), LL(0x27279c2725bb4e02), LL(0x4141194132588273), LL(0x8b8b168b2c9d0ba7), - LL(0xa7a7a6a7510153f6), LL(0x7d7de97dcf94fab2), LL(0x95956e95dcfb3749), LL(0xd8d847d88e9fad56), - LL(0xfbfbcbfb8b30eb70), LL(0xeeee9fee2371c1cd), LL(0x7c7ced7cc791f8bb), LL(0x6666856617e3cc71), - LL(0xdddd53dda68ea77b), LL(0x17175c17b84b2eaf), LL(0x4747014702468e45), LL(0x9e9e429e84dc211a), - LL(0xcaca0fca1ec589d4), LL(0x2d2db42d75995a58), LL(0xbfbfc6bf9179632e), LL(0x07071c07381b0e3f), - LL(0xadad8ead012347ac), LL(0x5a5a755aea2fb4b0), LL(0x838336836cb51bef), LL(0x3333cc3385ff66b6), - LL(0x636391633ff2c65c), LL(0x02020802100a0412), LL(0xaaaa92aa39384993), LL(0x7171d971afa8e2de), - LL(0xc8c807c80ecf8dc6), LL(0x19196419c87d32d1), LL(0x494939497270923b), LL(0xd9d943d9869aaf5f), - LL(0xf2f2eff2c31df931), LL(0xe3e3abe34b48dba8), LL(0x5b5b715be22ab6b9), LL(0x88881a8834920dbc), - LL(0x9a9a529aa4c8293e), LL(0x262698262dbe4c0b), LL(0x3232c8328dfa64bf), LL(0xb0b0fab0e94a7d59), - LL(0xe9e983e91b6acff2), LL(0x0f0f3c0f78331e77), LL(0xd5d573d5e6a6b733), LL(0x80803a8074ba1df4), - LL(0xbebec2be997c6127), LL(0xcdcd13cd26de87eb), LL(0x3434d034bde46889), LL(0x48483d487a759032), - LL(0xffffdbffab24e354), LL(0x7a7af57af78ff48d), LL(0x90907a90f4ea3d64), LL(0x5f5f615fc23ebe9d), - LL(0x202080201da0403d), LL(0x6868bd6867d5d00f), LL(0x1a1a681ad07234ca), LL(0xaeae82ae192c41b7), - LL(0xb4b4eab4c95e757d), LL(0x54544d549a19a8ce), LL(0x93937693ece53b7f), LL(0x222288220daa442f), - LL(0x64648d6407e9c863), LL(0xf1f1e3f1db12ff2a), LL(0x7373d173bfa2e6cc), LL(0x12124812905a2482), - LL(0x40401d403a5d807a), LL(0x0808200840281048), LL(0xc3c32bc356e89b95), LL(0xecec97ec337bc5df), - LL(0xdbdb4bdb9690ab4d), LL(0xa1a1bea1611f5fc0), LL(0x8d8d0e8d1c830791), LL(0x3d3df43df5c97ac8), - LL(0x97976697ccf1335b), LL(0x0000000000000000), LL(0xcfcf1bcf36d483f9), LL(0x2b2bac2b4587566e), - LL(0x7676c57697b3ece1), LL(0x8282328264b019e6), LL(0xd6d67fd6fea9b128), LL(0x1b1b6c1bd87736c3), - LL(0xb5b5eeb5c15b7774), LL(0xafaf86af112943be), LL(0x6a6ab56a77dfd41d), LL(0x50505d50ba0da0ea), - LL(0x45450945124c8a57), LL(0xf3f3ebf3cb18fb38), LL(0x3030c0309df060ad), LL(0xefef9bef2b74c3c4), - LL(0x3f3ffc3fe5c37eda), LL(0x55554955921caac7), LL(0xa2a2b2a2791059db), LL(0xeaea8fea0365c9e9), - LL(0x656589650fecca6a), LL(0xbabad2bab9686903), LL(0x2f2fbc2f65935e4a), LL(0xc0c027c04ee79d8e), - LL(0xdede5fdebe81a160), LL(0x1c1c701ce06c38fc), LL(0xfdfdd3fdbb2ee746), LL(0x4d4d294d52649a1f), - LL(0x92927292e4e03976), LL(0x7575c9758fbceafa), LL(0x06061806301e0c36), LL(0x8a8a128a249809ae), - LL(0xb2b2f2b2f940794b), LL(0xe6e6bfe66359d185), LL(0x0e0e380e70361c7e), LL(0x1f1f7c1ff8633ee7), - LL(0x6262956237f7c455), LL(0xd4d477d4eea3b53a), LL(0xa8a89aa829324d81), LL(0x96966296c4f43152), - LL(0xf9f9c3f99b3aef62), LL(0xc5c533c566f697a3), LL(0x2525942535b14a10), LL(0x59597959f220b2ab), - LL(0x84842a8454ae15d0), LL(0x7272d572b7a7e4c5), LL(0x3939e439d5dd72ec), LL(0x4c4c2d4c5a619816), - LL(0x5e5e655eca3bbc94), LL(0x7878fd78e785f09f), LL(0x3838e038ddd870e5), LL(0x8c8c0a8c14860598), - LL(0xd1d163d1c6b2bf17), LL(0xa5a5aea5410b57e4), LL(0xe2e2afe2434dd9a1), LL(0x616199612ff8c24e), - LL(0xb3b3f6b3f1457b42), LL(0x2121842115a54234), LL(0x9c9c4a9c94d62508), LL(0x1e1e781ef0663cee), - LL(0x4343114322528661), LL(0xc7c73bc776fc93b1), LL(0xfcfcd7fcb32be54f), LL(0x0404100420140824), - LL(0x51515951b208a2e3), LL(0x99995e99bcc72f25), LL(0x6d6da96d4fc4da22), LL(0x0d0d340d68391a65), - LL(0xfafacffa8335e979), LL(0xdfdf5bdfb684a369), LL(0x7e7ee57ed79bfca9), LL(0x242490243db44819), - LL(0x3b3bec3bc5d776fe), LL(0xabab96ab313d4b9a), LL(0xcece1fce3ed181f0), LL(0x1111441188552299), - LL(0x8f8f068f0c890383), LL(0x4e4e254e4a6b9c04), LL(0xb7b7e6b7d1517366), LL(0xebeb8beb0b60cbe0), - LL(0x3c3cf03cfdcc78c1), LL(0x81813e817cbf1ffd), LL(0x94946a94d4fe3540), LL(0xf7f7fbf7eb0cf31c), - LL(0xb9b9deb9a1676f18), LL(0x13134c13985f268b), LL(0x2c2cb02c7d9c5851), LL(0xd3d36bd3d6b8bb05), - LL(0xe7e7bbe76b5cd38c), LL(0x6e6ea56e57cbdc39), LL(0xc4c437c46ef395aa), LL(0x03030c03180f061b), - LL(0x565645568a13acdc), LL(0x44440d441a49885e), LL(0x7f7fe17fdf9efea0), LL(0xa9a99ea921374f88), - LL(0x2a2aa82a4d825467), LL(0xbbbbd6bbb16d6b0a), LL(0xc1c123c146e29f87), LL(0x53535153a202a6f1), - LL(0xdcdc57dcae8ba572), LL(0x0b0b2c0b58271653), LL(0x9d9d4e9d9cd32701), LL(0x6c6cad6c47c1d82b), - LL(0x3131c43195f562a4), LL(0x7474cd7487b9e8f3), LL(0xf6f6fff6e309f115), LL(0x464605460a438c4c), - LL(0xacac8aac092645a5), LL(0x89891e893c970fb5), LL(0x14145014a04428b4), LL(0xe1e1a3e15b42dfba), - LL(0x16165816b04e2ca6), LL(0x3a3ae83acdd274f7), LL(0x6969b9696fd0d206), LL(0x09092409482d1241), - LL(0x7070dd70a7ade0d7), LL(0xb6b6e2b6d954716f), LL(0xd0d067d0ceb7bd1e), LL(0xeded93ed3b7ec7d6), - LL(0xcccc17cc2edb85e2), LL(0x424215422a578468), LL(0x98985a98b4c22d2c), LL(0xa4a4aaa4490e55ed), - LL(0x2828a0285d885075), LL(0x5c5c6d5cda31b886), LL(0xf8f8c7f8933fed6b), LL(0x8686228644a411c2), -}; - -static const u64 C1[256] = { - LL(0xd818186018c07830), LL(0x2623238c2305af46), LL(0xb8c6c63fc67ef991), LL(0xfbe8e887e8136fcd), - LL(0xcb878726874ca113), LL(0x11b8b8dab8a9626d), LL(0x0901010401080502), LL(0x0d4f4f214f426e9e), - LL(0x9b3636d836adee6c), LL(0xffa6a6a2a6590451), LL(0x0cd2d26fd2debdb9), LL(0x0ef5f5f3f5fb06f7), - LL(0x967979f979ef80f2), LL(0x306f6fa16f5fcede), LL(0x6d91917e91fcef3f), LL(0xf852525552aa07a4), - LL(0x4760609d6027fdc0), LL(0x35bcbccabc897665), LL(0x379b9b569baccd2b), LL(0x8a8e8e028e048c01), - LL(0xd2a3a3b6a371155b), LL(0x6c0c0c300c603c18), LL(0x847b7bf17bff8af6), LL(0x803535d435b5e16a), - LL(0xf51d1d741de8693a), LL(0xb3e0e0a7e05347dd), LL(0x21d7d77bd7f6acb3), LL(0x9cc2c22fc25eed99), - LL(0x432e2eb82e6d965c), LL(0x294b4b314b627a96), LL(0x5dfefedffea321e1), LL(0xd5575741578216ae), - LL(0xbd15155415a8412a), LL(0xe87777c1779fb6ee), LL(0x923737dc37a5eb6e), LL(0x9ee5e5b3e57b56d7), - LL(0x139f9f469f8cd923), LL(0x23f0f0e7f0d317fd), LL(0x204a4a354a6a7f94), LL(0x44dada4fda9e95a9), - LL(0xa258587d58fa25b0), LL(0xcfc9c903c906ca8f), LL(0x7c2929a429558d52), LL(0x5a0a0a280a502214), - LL(0x50b1b1feb1e14f7f), LL(0xc9a0a0baa0691a5d), LL(0x146b6bb16b7fdad6), LL(0xd985852e855cab17), - LL(0x3cbdbdcebd817367), LL(0x8f5d5d695dd234ba), LL(0x9010104010805020), LL(0x07f4f4f7f4f303f5), - LL(0xddcbcb0bcb16c08b), LL(0xd33e3ef83eedc67c), LL(0x2d0505140528110a), LL(0x78676781671fe6ce), - LL(0x97e4e4b7e47353d5), LL(0x0227279c2725bb4e), LL(0x7341411941325882), LL(0xa78b8b168b2c9d0b), - LL(0xf6a7a7a6a7510153), LL(0xb27d7de97dcf94fa), LL(0x4995956e95dcfb37), LL(0x56d8d847d88e9fad), - LL(0x70fbfbcbfb8b30eb), LL(0xcdeeee9fee2371c1), LL(0xbb7c7ced7cc791f8), LL(0x716666856617e3cc), - LL(0x7bdddd53dda68ea7), LL(0xaf17175c17b84b2e), LL(0x454747014702468e), LL(0x1a9e9e429e84dc21), - LL(0xd4caca0fca1ec589), LL(0x582d2db42d75995a), LL(0x2ebfbfc6bf917963), LL(0x3f07071c07381b0e), - LL(0xacadad8ead012347), LL(0xb05a5a755aea2fb4), LL(0xef838336836cb51b), LL(0xb63333cc3385ff66), - LL(0x5c636391633ff2c6), LL(0x1202020802100a04), LL(0x93aaaa92aa393849), LL(0xde7171d971afa8e2), - LL(0xc6c8c807c80ecf8d), LL(0xd119196419c87d32), LL(0x3b49493949727092), LL(0x5fd9d943d9869aaf), - LL(0x31f2f2eff2c31df9), LL(0xa8e3e3abe34b48db), LL(0xb95b5b715be22ab6), LL(0xbc88881a8834920d), - LL(0x3e9a9a529aa4c829), LL(0x0b262698262dbe4c), LL(0xbf3232c8328dfa64), LL(0x59b0b0fab0e94a7d), - LL(0xf2e9e983e91b6acf), LL(0x770f0f3c0f78331e), LL(0x33d5d573d5e6a6b7), LL(0xf480803a8074ba1d), - LL(0x27bebec2be997c61), LL(0xebcdcd13cd26de87), LL(0x893434d034bde468), LL(0x3248483d487a7590), - LL(0x54ffffdbffab24e3), LL(0x8d7a7af57af78ff4), LL(0x6490907a90f4ea3d), LL(0x9d5f5f615fc23ebe), - LL(0x3d202080201da040), LL(0x0f6868bd6867d5d0), LL(0xca1a1a681ad07234), LL(0xb7aeae82ae192c41), - LL(0x7db4b4eab4c95e75), LL(0xce54544d549a19a8), LL(0x7f93937693ece53b), LL(0x2f222288220daa44), - LL(0x6364648d6407e9c8), LL(0x2af1f1e3f1db12ff), LL(0xcc7373d173bfa2e6), LL(0x8212124812905a24), - LL(0x7a40401d403a5d80), LL(0x4808082008402810), LL(0x95c3c32bc356e89b), LL(0xdfecec97ec337bc5), - LL(0x4ddbdb4bdb9690ab), LL(0xc0a1a1bea1611f5f), LL(0x918d8d0e8d1c8307), LL(0xc83d3df43df5c97a), - LL(0x5b97976697ccf133), LL(0x0000000000000000), LL(0xf9cfcf1bcf36d483), LL(0x6e2b2bac2b458756), - LL(0xe17676c57697b3ec), LL(0xe68282328264b019), LL(0x28d6d67fd6fea9b1), LL(0xc31b1b6c1bd87736), - LL(0x74b5b5eeb5c15b77), LL(0xbeafaf86af112943), LL(0x1d6a6ab56a77dfd4), LL(0xea50505d50ba0da0), - LL(0x5745450945124c8a), LL(0x38f3f3ebf3cb18fb), LL(0xad3030c0309df060), LL(0xc4efef9bef2b74c3), - LL(0xda3f3ffc3fe5c37e), LL(0xc755554955921caa), LL(0xdba2a2b2a2791059), LL(0xe9eaea8fea0365c9), - LL(0x6a656589650fecca), LL(0x03babad2bab96869), LL(0x4a2f2fbc2f65935e), LL(0x8ec0c027c04ee79d), - LL(0x60dede5fdebe81a1), LL(0xfc1c1c701ce06c38), LL(0x46fdfdd3fdbb2ee7), LL(0x1f4d4d294d52649a), - LL(0x7692927292e4e039), LL(0xfa7575c9758fbcea), LL(0x3606061806301e0c), LL(0xae8a8a128a249809), - LL(0x4bb2b2f2b2f94079), LL(0x85e6e6bfe66359d1), LL(0x7e0e0e380e70361c), LL(0xe71f1f7c1ff8633e), - LL(0x556262956237f7c4), LL(0x3ad4d477d4eea3b5), LL(0x81a8a89aa829324d), LL(0x5296966296c4f431), - LL(0x62f9f9c3f99b3aef), LL(0xa3c5c533c566f697), LL(0x102525942535b14a), LL(0xab59597959f220b2), - LL(0xd084842a8454ae15), LL(0xc57272d572b7a7e4), LL(0xec3939e439d5dd72), LL(0x164c4c2d4c5a6198), - LL(0x945e5e655eca3bbc), LL(0x9f7878fd78e785f0), LL(0xe53838e038ddd870), LL(0x988c8c0a8c148605), - LL(0x17d1d163d1c6b2bf), LL(0xe4a5a5aea5410b57), LL(0xa1e2e2afe2434dd9), LL(0x4e616199612ff8c2), - LL(0x42b3b3f6b3f1457b), LL(0x342121842115a542), LL(0x089c9c4a9c94d625), LL(0xee1e1e781ef0663c), - LL(0x6143431143225286), LL(0xb1c7c73bc776fc93), LL(0x4ffcfcd7fcb32be5), LL(0x2404041004201408), - LL(0xe351515951b208a2), LL(0x2599995e99bcc72f), LL(0x226d6da96d4fc4da), LL(0x650d0d340d68391a), - LL(0x79fafacffa8335e9), LL(0x69dfdf5bdfb684a3), LL(0xa97e7ee57ed79bfc), LL(0x19242490243db448), - LL(0xfe3b3bec3bc5d776), LL(0x9aabab96ab313d4b), LL(0xf0cece1fce3ed181), LL(0x9911114411885522), - LL(0x838f8f068f0c8903), LL(0x044e4e254e4a6b9c), LL(0x66b7b7e6b7d15173), LL(0xe0ebeb8beb0b60cb), - LL(0xc13c3cf03cfdcc78), LL(0xfd81813e817cbf1f), LL(0x4094946a94d4fe35), LL(0x1cf7f7fbf7eb0cf3), - LL(0x18b9b9deb9a1676f), LL(0x8b13134c13985f26), LL(0x512c2cb02c7d9c58), LL(0x05d3d36bd3d6b8bb), - LL(0x8ce7e7bbe76b5cd3), LL(0x396e6ea56e57cbdc), LL(0xaac4c437c46ef395), LL(0x1b03030c03180f06), - LL(0xdc565645568a13ac), LL(0x5e44440d441a4988), LL(0xa07f7fe17fdf9efe), LL(0x88a9a99ea921374f), - LL(0x672a2aa82a4d8254), LL(0x0abbbbd6bbb16d6b), LL(0x87c1c123c146e29f), LL(0xf153535153a202a6), - LL(0x72dcdc57dcae8ba5), LL(0x530b0b2c0b582716), LL(0x019d9d4e9d9cd327), LL(0x2b6c6cad6c47c1d8), - LL(0xa43131c43195f562), LL(0xf37474cd7487b9e8), LL(0x15f6f6fff6e309f1), LL(0x4c464605460a438c), - LL(0xa5acac8aac092645), LL(0xb589891e893c970f), LL(0xb414145014a04428), LL(0xbae1e1a3e15b42df), - LL(0xa616165816b04e2c), LL(0xf73a3ae83acdd274), LL(0x066969b9696fd0d2), LL(0x4109092409482d12), - LL(0xd77070dd70a7ade0), LL(0x6fb6b6e2b6d95471), LL(0x1ed0d067d0ceb7bd), LL(0xd6eded93ed3b7ec7), - LL(0xe2cccc17cc2edb85), LL(0x68424215422a5784), LL(0x2c98985a98b4c22d), LL(0xeda4a4aaa4490e55), - LL(0x752828a0285d8850), LL(0x865c5c6d5cda31b8), LL(0x6bf8f8c7f8933fed), LL(0xc28686228644a411), -}; - -static const u64 C2[256] = { - LL(0x30d818186018c078), LL(0x462623238c2305af), LL(0x91b8c6c63fc67ef9), LL(0xcdfbe8e887e8136f), - LL(0x13cb878726874ca1), LL(0x6d11b8b8dab8a962), LL(0x0209010104010805), LL(0x9e0d4f4f214f426e), - LL(0x6c9b3636d836adee), LL(0x51ffa6a6a2a65904), LL(0xb90cd2d26fd2debd), LL(0xf70ef5f5f3f5fb06), - LL(0xf2967979f979ef80), LL(0xde306f6fa16f5fce), LL(0x3f6d91917e91fcef), LL(0xa4f852525552aa07), - LL(0xc04760609d6027fd), LL(0x6535bcbccabc8976), LL(0x2b379b9b569baccd), LL(0x018a8e8e028e048c), - LL(0x5bd2a3a3b6a37115), LL(0x186c0c0c300c603c), LL(0xf6847b7bf17bff8a), LL(0x6a803535d435b5e1), - LL(0x3af51d1d741de869), LL(0xddb3e0e0a7e05347), LL(0xb321d7d77bd7f6ac), LL(0x999cc2c22fc25eed), - LL(0x5c432e2eb82e6d96), LL(0x96294b4b314b627a), LL(0xe15dfefedffea321), LL(0xaed5575741578216), - LL(0x2abd15155415a841), LL(0xeee87777c1779fb6), LL(0x6e923737dc37a5eb), LL(0xd79ee5e5b3e57b56), - LL(0x23139f9f469f8cd9), LL(0xfd23f0f0e7f0d317), LL(0x94204a4a354a6a7f), LL(0xa944dada4fda9e95), - LL(0xb0a258587d58fa25), LL(0x8fcfc9c903c906ca), LL(0x527c2929a429558d), LL(0x145a0a0a280a5022), - LL(0x7f50b1b1feb1e14f), LL(0x5dc9a0a0baa0691a), LL(0xd6146b6bb16b7fda), LL(0x17d985852e855cab), - LL(0x673cbdbdcebd8173), LL(0xba8f5d5d695dd234), LL(0x2090101040108050), LL(0xf507f4f4f7f4f303), - LL(0x8bddcbcb0bcb16c0), LL(0x7cd33e3ef83eedc6), LL(0x0a2d050514052811), LL(0xce78676781671fe6), - LL(0xd597e4e4b7e47353), LL(0x4e0227279c2725bb), LL(0x8273414119413258), LL(0x0ba78b8b168b2c9d), - LL(0x53f6a7a7a6a75101), LL(0xfab27d7de97dcf94), LL(0x374995956e95dcfb), LL(0xad56d8d847d88e9f), - LL(0xeb70fbfbcbfb8b30), LL(0xc1cdeeee9fee2371), LL(0xf8bb7c7ced7cc791), LL(0xcc716666856617e3), - LL(0xa77bdddd53dda68e), LL(0x2eaf17175c17b84b), LL(0x8e45474701470246), LL(0x211a9e9e429e84dc), - LL(0x89d4caca0fca1ec5), LL(0x5a582d2db42d7599), LL(0x632ebfbfc6bf9179), LL(0x0e3f07071c07381b), - LL(0x47acadad8ead0123), LL(0xb4b05a5a755aea2f), LL(0x1bef838336836cb5), LL(0x66b63333cc3385ff), - LL(0xc65c636391633ff2), LL(0x041202020802100a), LL(0x4993aaaa92aa3938), LL(0xe2de7171d971afa8), - LL(0x8dc6c8c807c80ecf), LL(0x32d119196419c87d), LL(0x923b494939497270), LL(0xaf5fd9d943d9869a), - LL(0xf931f2f2eff2c31d), LL(0xdba8e3e3abe34b48), LL(0xb6b95b5b715be22a), LL(0x0dbc88881a883492), - LL(0x293e9a9a529aa4c8), LL(0x4c0b262698262dbe), LL(0x64bf3232c8328dfa), LL(0x7d59b0b0fab0e94a), - LL(0xcff2e9e983e91b6a), LL(0x1e770f0f3c0f7833), LL(0xb733d5d573d5e6a6), LL(0x1df480803a8074ba), - LL(0x6127bebec2be997c), LL(0x87ebcdcd13cd26de), LL(0x68893434d034bde4), LL(0x903248483d487a75), - LL(0xe354ffffdbffab24), LL(0xf48d7a7af57af78f), LL(0x3d6490907a90f4ea), LL(0xbe9d5f5f615fc23e), - LL(0x403d202080201da0), LL(0xd00f6868bd6867d5), LL(0x34ca1a1a681ad072), LL(0x41b7aeae82ae192c), - LL(0x757db4b4eab4c95e), LL(0xa8ce54544d549a19), LL(0x3b7f93937693ece5), LL(0x442f222288220daa), - LL(0xc86364648d6407e9), LL(0xff2af1f1e3f1db12), LL(0xe6cc7373d173bfa2), LL(0x248212124812905a), - LL(0x807a40401d403a5d), LL(0x1048080820084028), LL(0x9b95c3c32bc356e8), LL(0xc5dfecec97ec337b), - LL(0xab4ddbdb4bdb9690), LL(0x5fc0a1a1bea1611f), LL(0x07918d8d0e8d1c83), LL(0x7ac83d3df43df5c9), - LL(0x335b97976697ccf1), LL(0x0000000000000000), LL(0x83f9cfcf1bcf36d4), LL(0x566e2b2bac2b4587), - LL(0xece17676c57697b3), LL(0x19e68282328264b0), LL(0xb128d6d67fd6fea9), LL(0x36c31b1b6c1bd877), - LL(0x7774b5b5eeb5c15b), LL(0x43beafaf86af1129), LL(0xd41d6a6ab56a77df), LL(0xa0ea50505d50ba0d), - LL(0x8a5745450945124c), LL(0xfb38f3f3ebf3cb18), LL(0x60ad3030c0309df0), LL(0xc3c4efef9bef2b74), - LL(0x7eda3f3ffc3fe5c3), LL(0xaac755554955921c), LL(0x59dba2a2b2a27910), LL(0xc9e9eaea8fea0365), - LL(0xca6a656589650fec), LL(0x6903babad2bab968), LL(0x5e4a2f2fbc2f6593), LL(0x9d8ec0c027c04ee7), - LL(0xa160dede5fdebe81), LL(0x38fc1c1c701ce06c), LL(0xe746fdfdd3fdbb2e), LL(0x9a1f4d4d294d5264), - LL(0x397692927292e4e0), LL(0xeafa7575c9758fbc), LL(0x0c3606061806301e), LL(0x09ae8a8a128a2498), - LL(0x794bb2b2f2b2f940), LL(0xd185e6e6bfe66359), LL(0x1c7e0e0e380e7036), LL(0x3ee71f1f7c1ff863), - LL(0xc4556262956237f7), LL(0xb53ad4d477d4eea3), LL(0x4d81a8a89aa82932), LL(0x315296966296c4f4), - LL(0xef62f9f9c3f99b3a), LL(0x97a3c5c533c566f6), LL(0x4a102525942535b1), LL(0xb2ab59597959f220), - LL(0x15d084842a8454ae), LL(0xe4c57272d572b7a7), LL(0x72ec3939e439d5dd), LL(0x98164c4c2d4c5a61), - LL(0xbc945e5e655eca3b), LL(0xf09f7878fd78e785), LL(0x70e53838e038ddd8), LL(0x05988c8c0a8c1486), - LL(0xbf17d1d163d1c6b2), LL(0x57e4a5a5aea5410b), LL(0xd9a1e2e2afe2434d), LL(0xc24e616199612ff8), - LL(0x7b42b3b3f6b3f145), LL(0x42342121842115a5), LL(0x25089c9c4a9c94d6), LL(0x3cee1e1e781ef066), - LL(0x8661434311432252), LL(0x93b1c7c73bc776fc), LL(0xe54ffcfcd7fcb32b), LL(0x0824040410042014), - LL(0xa2e351515951b208), LL(0x2f2599995e99bcc7), LL(0xda226d6da96d4fc4), LL(0x1a650d0d340d6839), - LL(0xe979fafacffa8335), LL(0xa369dfdf5bdfb684), LL(0xfca97e7ee57ed79b), LL(0x4819242490243db4), - LL(0x76fe3b3bec3bc5d7), LL(0x4b9aabab96ab313d), LL(0x81f0cece1fce3ed1), LL(0x2299111144118855), - LL(0x03838f8f068f0c89), LL(0x9c044e4e254e4a6b), LL(0x7366b7b7e6b7d151), LL(0xcbe0ebeb8beb0b60), - LL(0x78c13c3cf03cfdcc), LL(0x1ffd81813e817cbf), LL(0x354094946a94d4fe), LL(0xf31cf7f7fbf7eb0c), - LL(0x6f18b9b9deb9a167), LL(0x268b13134c13985f), LL(0x58512c2cb02c7d9c), LL(0xbb05d3d36bd3d6b8), - LL(0xd38ce7e7bbe76b5c), LL(0xdc396e6ea56e57cb), LL(0x95aac4c437c46ef3), LL(0x061b03030c03180f), - LL(0xacdc565645568a13), LL(0x885e44440d441a49), LL(0xfea07f7fe17fdf9e), LL(0x4f88a9a99ea92137), - LL(0x54672a2aa82a4d82), LL(0x6b0abbbbd6bbb16d), LL(0x9f87c1c123c146e2), LL(0xa6f153535153a202), - LL(0xa572dcdc57dcae8b), LL(0x16530b0b2c0b5827), LL(0x27019d9d4e9d9cd3), LL(0xd82b6c6cad6c47c1), - LL(0x62a43131c43195f5), LL(0xe8f37474cd7487b9), LL(0xf115f6f6fff6e309), LL(0x8c4c464605460a43), - LL(0x45a5acac8aac0926), LL(0x0fb589891e893c97), LL(0x28b414145014a044), LL(0xdfbae1e1a3e15b42), - LL(0x2ca616165816b04e), LL(0x74f73a3ae83acdd2), LL(0xd2066969b9696fd0), LL(0x124109092409482d), - LL(0xe0d77070dd70a7ad), LL(0x716fb6b6e2b6d954), LL(0xbd1ed0d067d0ceb7), LL(0xc7d6eded93ed3b7e), - LL(0x85e2cccc17cc2edb), LL(0x8468424215422a57), LL(0x2d2c98985a98b4c2), LL(0x55eda4a4aaa4490e), - LL(0x50752828a0285d88), LL(0xb8865c5c6d5cda31), LL(0xed6bf8f8c7f8933f), LL(0x11c28686228644a4), -}; - -static const u64 C3[256] = { - LL(0x7830d818186018c0), LL(0xaf462623238c2305), LL(0xf991b8c6c63fc67e), LL(0x6fcdfbe8e887e813), - LL(0xa113cb878726874c), LL(0x626d11b8b8dab8a9), LL(0x0502090101040108), LL(0x6e9e0d4f4f214f42), - LL(0xee6c9b3636d836ad), LL(0x0451ffa6a6a2a659), LL(0xbdb90cd2d26fd2de), LL(0x06f70ef5f5f3f5fb), - LL(0x80f2967979f979ef), LL(0xcede306f6fa16f5f), LL(0xef3f6d91917e91fc), LL(0x07a4f852525552aa), - LL(0xfdc04760609d6027), LL(0x766535bcbccabc89), LL(0xcd2b379b9b569bac), LL(0x8c018a8e8e028e04), - LL(0x155bd2a3a3b6a371), LL(0x3c186c0c0c300c60), LL(0x8af6847b7bf17bff), LL(0xe16a803535d435b5), - LL(0x693af51d1d741de8), LL(0x47ddb3e0e0a7e053), LL(0xacb321d7d77bd7f6), LL(0xed999cc2c22fc25e), - LL(0x965c432e2eb82e6d), LL(0x7a96294b4b314b62), LL(0x21e15dfefedffea3), LL(0x16aed55757415782), - LL(0x412abd15155415a8), LL(0xb6eee87777c1779f), LL(0xeb6e923737dc37a5), LL(0x56d79ee5e5b3e57b), - LL(0xd923139f9f469f8c), LL(0x17fd23f0f0e7f0d3), LL(0x7f94204a4a354a6a), LL(0x95a944dada4fda9e), - LL(0x25b0a258587d58fa), LL(0xca8fcfc9c903c906), LL(0x8d527c2929a42955), LL(0x22145a0a0a280a50), - LL(0x4f7f50b1b1feb1e1), LL(0x1a5dc9a0a0baa069), LL(0xdad6146b6bb16b7f), LL(0xab17d985852e855c), - LL(0x73673cbdbdcebd81), LL(0x34ba8f5d5d695dd2), LL(0x5020901010401080), LL(0x03f507f4f4f7f4f3), - LL(0xc08bddcbcb0bcb16), LL(0xc67cd33e3ef83eed), LL(0x110a2d0505140528), LL(0xe6ce78676781671f), - LL(0x53d597e4e4b7e473), LL(0xbb4e0227279c2725), LL(0x5882734141194132), LL(0x9d0ba78b8b168b2c), - LL(0x0153f6a7a7a6a751), LL(0x94fab27d7de97dcf), LL(0xfb374995956e95dc), LL(0x9fad56d8d847d88e), - LL(0x30eb70fbfbcbfb8b), LL(0x71c1cdeeee9fee23), LL(0x91f8bb7c7ced7cc7), LL(0xe3cc716666856617), - LL(0x8ea77bdddd53dda6), LL(0x4b2eaf17175c17b8), LL(0x468e454747014702), LL(0xdc211a9e9e429e84), - LL(0xc589d4caca0fca1e), LL(0x995a582d2db42d75), LL(0x79632ebfbfc6bf91), LL(0x1b0e3f07071c0738), - LL(0x2347acadad8ead01), LL(0x2fb4b05a5a755aea), LL(0xb51bef838336836c), LL(0xff66b63333cc3385), - LL(0xf2c65c636391633f), LL(0x0a04120202080210), LL(0x384993aaaa92aa39), LL(0xa8e2de7171d971af), - LL(0xcf8dc6c8c807c80e), LL(0x7d32d119196419c8), LL(0x70923b4949394972), LL(0x9aaf5fd9d943d986), - LL(0x1df931f2f2eff2c3), LL(0x48dba8e3e3abe34b), LL(0x2ab6b95b5b715be2), LL(0x920dbc88881a8834), - LL(0xc8293e9a9a529aa4), LL(0xbe4c0b262698262d), LL(0xfa64bf3232c8328d), LL(0x4a7d59b0b0fab0e9), - LL(0x6acff2e9e983e91b), LL(0x331e770f0f3c0f78), LL(0xa6b733d5d573d5e6), LL(0xba1df480803a8074), - LL(0x7c6127bebec2be99), LL(0xde87ebcdcd13cd26), LL(0xe468893434d034bd), LL(0x75903248483d487a), - LL(0x24e354ffffdbffab), LL(0x8ff48d7a7af57af7), LL(0xea3d6490907a90f4), LL(0x3ebe9d5f5f615fc2), - LL(0xa0403d202080201d), LL(0xd5d00f6868bd6867), LL(0x7234ca1a1a681ad0), LL(0x2c41b7aeae82ae19), - LL(0x5e757db4b4eab4c9), LL(0x19a8ce54544d549a), LL(0xe53b7f93937693ec), LL(0xaa442f222288220d), - LL(0xe9c86364648d6407), LL(0x12ff2af1f1e3f1db), LL(0xa2e6cc7373d173bf), LL(0x5a24821212481290), - LL(0x5d807a40401d403a), LL(0x2810480808200840), LL(0xe89b95c3c32bc356), LL(0x7bc5dfecec97ec33), - LL(0x90ab4ddbdb4bdb96), LL(0x1f5fc0a1a1bea161), LL(0x8307918d8d0e8d1c), LL(0xc97ac83d3df43df5), - LL(0xf1335b97976697cc), LL(0x0000000000000000), LL(0xd483f9cfcf1bcf36), LL(0x87566e2b2bac2b45), - LL(0xb3ece17676c57697), LL(0xb019e68282328264), LL(0xa9b128d6d67fd6fe), LL(0x7736c31b1b6c1bd8), - LL(0x5b7774b5b5eeb5c1), LL(0x2943beafaf86af11), LL(0xdfd41d6a6ab56a77), LL(0x0da0ea50505d50ba), - LL(0x4c8a574545094512), LL(0x18fb38f3f3ebf3cb), LL(0xf060ad3030c0309d), LL(0x74c3c4efef9bef2b), - LL(0xc37eda3f3ffc3fe5), LL(0x1caac75555495592), LL(0x1059dba2a2b2a279), LL(0x65c9e9eaea8fea03), - LL(0xecca6a656589650f), LL(0x686903babad2bab9), LL(0x935e4a2f2fbc2f65), LL(0xe79d8ec0c027c04e), - LL(0x81a160dede5fdebe), LL(0x6c38fc1c1c701ce0), LL(0x2ee746fdfdd3fdbb), LL(0x649a1f4d4d294d52), - LL(0xe0397692927292e4), LL(0xbceafa7575c9758f), LL(0x1e0c360606180630), LL(0x9809ae8a8a128a24), - LL(0x40794bb2b2f2b2f9), LL(0x59d185e6e6bfe663), LL(0x361c7e0e0e380e70), LL(0x633ee71f1f7c1ff8), - LL(0xf7c4556262956237), LL(0xa3b53ad4d477d4ee), LL(0x324d81a8a89aa829), LL(0xf4315296966296c4), - LL(0x3aef62f9f9c3f99b), LL(0xf697a3c5c533c566), LL(0xb14a102525942535), LL(0x20b2ab59597959f2), - LL(0xae15d084842a8454), LL(0xa7e4c57272d572b7), LL(0xdd72ec3939e439d5), LL(0x6198164c4c2d4c5a), - LL(0x3bbc945e5e655eca), LL(0x85f09f7878fd78e7), LL(0xd870e53838e038dd), LL(0x8605988c8c0a8c14), - LL(0xb2bf17d1d163d1c6), LL(0x0b57e4a5a5aea541), LL(0x4dd9a1e2e2afe243), LL(0xf8c24e616199612f), - LL(0x457b42b3b3f6b3f1), LL(0xa542342121842115), LL(0xd625089c9c4a9c94), LL(0x663cee1e1e781ef0), - LL(0x5286614343114322), LL(0xfc93b1c7c73bc776), LL(0x2be54ffcfcd7fcb3), LL(0x1408240404100420), - LL(0x08a2e351515951b2), LL(0xc72f2599995e99bc), LL(0xc4da226d6da96d4f), LL(0x391a650d0d340d68), - LL(0x35e979fafacffa83), LL(0x84a369dfdf5bdfb6), LL(0x9bfca97e7ee57ed7), LL(0xb44819242490243d), - LL(0xd776fe3b3bec3bc5), LL(0x3d4b9aabab96ab31), LL(0xd181f0cece1fce3e), LL(0x5522991111441188), - LL(0x8903838f8f068f0c), LL(0x6b9c044e4e254e4a), LL(0x517366b7b7e6b7d1), LL(0x60cbe0ebeb8beb0b), - LL(0xcc78c13c3cf03cfd), LL(0xbf1ffd81813e817c), LL(0xfe354094946a94d4), LL(0x0cf31cf7f7fbf7eb), - LL(0x676f18b9b9deb9a1), LL(0x5f268b13134c1398), LL(0x9c58512c2cb02c7d), LL(0xb8bb05d3d36bd3d6), - LL(0x5cd38ce7e7bbe76b), LL(0xcbdc396e6ea56e57), LL(0xf395aac4c437c46e), LL(0x0f061b03030c0318), - LL(0x13acdc565645568a), LL(0x49885e44440d441a), LL(0x9efea07f7fe17fdf), LL(0x374f88a9a99ea921), - LL(0x8254672a2aa82a4d), LL(0x6d6b0abbbbd6bbb1), LL(0xe29f87c1c123c146), LL(0x02a6f153535153a2), - LL(0x8ba572dcdc57dcae), LL(0x2716530b0b2c0b58), LL(0xd327019d9d4e9d9c), LL(0xc1d82b6c6cad6c47), - LL(0xf562a43131c43195), LL(0xb9e8f37474cd7487), LL(0x09f115f6f6fff6e3), LL(0x438c4c464605460a), - LL(0x2645a5acac8aac09), LL(0x970fb589891e893c), LL(0x4428b414145014a0), LL(0x42dfbae1e1a3e15b), - LL(0x4e2ca616165816b0), LL(0xd274f73a3ae83acd), LL(0xd0d2066969b9696f), LL(0x2d12410909240948), - LL(0xade0d77070dd70a7), LL(0x54716fb6b6e2b6d9), LL(0xb7bd1ed0d067d0ce), LL(0x7ec7d6eded93ed3b), - LL(0xdb85e2cccc17cc2e), LL(0x578468424215422a), LL(0xc22d2c98985a98b4), LL(0x0e55eda4a4aaa449), - LL(0x8850752828a0285d), LL(0x31b8865c5c6d5cda), LL(0x3fed6bf8f8c7f893), LL(0xa411c28686228644), -}; - -static const u64 C4[256] = { - LL(0xc07830d818186018), LL(0x05af462623238c23), LL(0x7ef991b8c6c63fc6), LL(0x136fcdfbe8e887e8), - LL(0x4ca113cb87872687), LL(0xa9626d11b8b8dab8), LL(0x0805020901010401), LL(0x426e9e0d4f4f214f), - LL(0xadee6c9b3636d836), LL(0x590451ffa6a6a2a6), LL(0xdebdb90cd2d26fd2), LL(0xfb06f70ef5f5f3f5), - LL(0xef80f2967979f979), LL(0x5fcede306f6fa16f), LL(0xfcef3f6d91917e91), LL(0xaa07a4f852525552), - LL(0x27fdc04760609d60), LL(0x89766535bcbccabc), LL(0xaccd2b379b9b569b), LL(0x048c018a8e8e028e), - LL(0x71155bd2a3a3b6a3), LL(0x603c186c0c0c300c), LL(0xff8af6847b7bf17b), LL(0xb5e16a803535d435), - LL(0xe8693af51d1d741d), LL(0x5347ddb3e0e0a7e0), LL(0xf6acb321d7d77bd7), LL(0x5eed999cc2c22fc2), - LL(0x6d965c432e2eb82e), LL(0x627a96294b4b314b), LL(0xa321e15dfefedffe), LL(0x8216aed557574157), - LL(0xa8412abd15155415), LL(0x9fb6eee87777c177), LL(0xa5eb6e923737dc37), LL(0x7b56d79ee5e5b3e5), - LL(0x8cd923139f9f469f), LL(0xd317fd23f0f0e7f0), LL(0x6a7f94204a4a354a), LL(0x9e95a944dada4fda), - LL(0xfa25b0a258587d58), LL(0x06ca8fcfc9c903c9), LL(0x558d527c2929a429), LL(0x5022145a0a0a280a), - LL(0xe14f7f50b1b1feb1), LL(0x691a5dc9a0a0baa0), LL(0x7fdad6146b6bb16b), LL(0x5cab17d985852e85), - LL(0x8173673cbdbdcebd), LL(0xd234ba8f5d5d695d), LL(0x8050209010104010), LL(0xf303f507f4f4f7f4), - LL(0x16c08bddcbcb0bcb), LL(0xedc67cd33e3ef83e), LL(0x28110a2d05051405), LL(0x1fe6ce7867678167), - LL(0x7353d597e4e4b7e4), LL(0x25bb4e0227279c27), LL(0x3258827341411941), LL(0x2c9d0ba78b8b168b), - LL(0x510153f6a7a7a6a7), LL(0xcf94fab27d7de97d), LL(0xdcfb374995956e95), LL(0x8e9fad56d8d847d8), - LL(0x8b30eb70fbfbcbfb), LL(0x2371c1cdeeee9fee), LL(0xc791f8bb7c7ced7c), LL(0x17e3cc7166668566), - LL(0xa68ea77bdddd53dd), LL(0xb84b2eaf17175c17), LL(0x02468e4547470147), LL(0x84dc211a9e9e429e), - LL(0x1ec589d4caca0fca), LL(0x75995a582d2db42d), LL(0x9179632ebfbfc6bf), LL(0x381b0e3f07071c07), - LL(0x012347acadad8ead), LL(0xea2fb4b05a5a755a), LL(0x6cb51bef83833683), LL(0x85ff66b63333cc33), - LL(0x3ff2c65c63639163), LL(0x100a041202020802), LL(0x39384993aaaa92aa), LL(0xafa8e2de7171d971), - LL(0x0ecf8dc6c8c807c8), LL(0xc87d32d119196419), LL(0x7270923b49493949), LL(0x869aaf5fd9d943d9), - LL(0xc31df931f2f2eff2), LL(0x4b48dba8e3e3abe3), LL(0xe22ab6b95b5b715b), LL(0x34920dbc88881a88), - LL(0xa4c8293e9a9a529a), LL(0x2dbe4c0b26269826), LL(0x8dfa64bf3232c832), LL(0xe94a7d59b0b0fab0), - LL(0x1b6acff2e9e983e9), LL(0x78331e770f0f3c0f), LL(0xe6a6b733d5d573d5), LL(0x74ba1df480803a80), - LL(0x997c6127bebec2be), LL(0x26de87ebcdcd13cd), LL(0xbde468893434d034), LL(0x7a75903248483d48), - LL(0xab24e354ffffdbff), LL(0xf78ff48d7a7af57a), LL(0xf4ea3d6490907a90), LL(0xc23ebe9d5f5f615f), - LL(0x1da0403d20208020), LL(0x67d5d00f6868bd68), LL(0xd07234ca1a1a681a), LL(0x192c41b7aeae82ae), - LL(0xc95e757db4b4eab4), LL(0x9a19a8ce54544d54), LL(0xece53b7f93937693), LL(0x0daa442f22228822), - LL(0x07e9c86364648d64), LL(0xdb12ff2af1f1e3f1), LL(0xbfa2e6cc7373d173), LL(0x905a248212124812), - LL(0x3a5d807a40401d40), LL(0x4028104808082008), LL(0x56e89b95c3c32bc3), LL(0x337bc5dfecec97ec), - LL(0x9690ab4ddbdb4bdb), LL(0x611f5fc0a1a1bea1), LL(0x1c8307918d8d0e8d), LL(0xf5c97ac83d3df43d), - LL(0xccf1335b97976697), LL(0x0000000000000000), LL(0x36d483f9cfcf1bcf), LL(0x4587566e2b2bac2b), - LL(0x97b3ece17676c576), LL(0x64b019e682823282), LL(0xfea9b128d6d67fd6), LL(0xd87736c31b1b6c1b), - LL(0xc15b7774b5b5eeb5), LL(0x112943beafaf86af), LL(0x77dfd41d6a6ab56a), LL(0xba0da0ea50505d50), - LL(0x124c8a5745450945), LL(0xcb18fb38f3f3ebf3), LL(0x9df060ad3030c030), LL(0x2b74c3c4efef9bef), - LL(0xe5c37eda3f3ffc3f), LL(0x921caac755554955), LL(0x791059dba2a2b2a2), LL(0x0365c9e9eaea8fea), - LL(0x0fecca6a65658965), LL(0xb9686903babad2ba), LL(0x65935e4a2f2fbc2f), LL(0x4ee79d8ec0c027c0), - LL(0xbe81a160dede5fde), LL(0xe06c38fc1c1c701c), LL(0xbb2ee746fdfdd3fd), LL(0x52649a1f4d4d294d), - LL(0xe4e0397692927292), LL(0x8fbceafa7575c975), LL(0x301e0c3606061806), LL(0x249809ae8a8a128a), - LL(0xf940794bb2b2f2b2), LL(0x6359d185e6e6bfe6), LL(0x70361c7e0e0e380e), LL(0xf8633ee71f1f7c1f), - LL(0x37f7c45562629562), LL(0xeea3b53ad4d477d4), LL(0x29324d81a8a89aa8), LL(0xc4f4315296966296), - LL(0x9b3aef62f9f9c3f9), LL(0x66f697a3c5c533c5), LL(0x35b14a1025259425), LL(0xf220b2ab59597959), - LL(0x54ae15d084842a84), LL(0xb7a7e4c57272d572), LL(0xd5dd72ec3939e439), LL(0x5a6198164c4c2d4c), - LL(0xca3bbc945e5e655e), LL(0xe785f09f7878fd78), LL(0xddd870e53838e038), LL(0x148605988c8c0a8c), - LL(0xc6b2bf17d1d163d1), LL(0x410b57e4a5a5aea5), LL(0x434dd9a1e2e2afe2), LL(0x2ff8c24e61619961), - LL(0xf1457b42b3b3f6b3), LL(0x15a5423421218421), LL(0x94d625089c9c4a9c), LL(0xf0663cee1e1e781e), - LL(0x2252866143431143), LL(0x76fc93b1c7c73bc7), LL(0xb32be54ffcfcd7fc), LL(0x2014082404041004), - LL(0xb208a2e351515951), LL(0xbcc72f2599995e99), LL(0x4fc4da226d6da96d), LL(0x68391a650d0d340d), - LL(0x8335e979fafacffa), LL(0xb684a369dfdf5bdf), LL(0xd79bfca97e7ee57e), LL(0x3db4481924249024), - LL(0xc5d776fe3b3bec3b), LL(0x313d4b9aabab96ab), LL(0x3ed181f0cece1fce), LL(0x8855229911114411), - LL(0x0c8903838f8f068f), LL(0x4a6b9c044e4e254e), LL(0xd1517366b7b7e6b7), LL(0x0b60cbe0ebeb8beb), - LL(0xfdcc78c13c3cf03c), LL(0x7cbf1ffd81813e81), LL(0xd4fe354094946a94), LL(0xeb0cf31cf7f7fbf7), - LL(0xa1676f18b9b9deb9), LL(0x985f268b13134c13), LL(0x7d9c58512c2cb02c), LL(0xd6b8bb05d3d36bd3), - LL(0x6b5cd38ce7e7bbe7), LL(0x57cbdc396e6ea56e), LL(0x6ef395aac4c437c4), LL(0x180f061b03030c03), - LL(0x8a13acdc56564556), LL(0x1a49885e44440d44), LL(0xdf9efea07f7fe17f), LL(0x21374f88a9a99ea9), - LL(0x4d8254672a2aa82a), LL(0xb16d6b0abbbbd6bb), LL(0x46e29f87c1c123c1), LL(0xa202a6f153535153), - LL(0xae8ba572dcdc57dc), LL(0x582716530b0b2c0b), LL(0x9cd327019d9d4e9d), LL(0x47c1d82b6c6cad6c), - LL(0x95f562a43131c431), LL(0x87b9e8f37474cd74), LL(0xe309f115f6f6fff6), LL(0x0a438c4c46460546), - LL(0x092645a5acac8aac), LL(0x3c970fb589891e89), LL(0xa04428b414145014), LL(0x5b42dfbae1e1a3e1), - LL(0xb04e2ca616165816), LL(0xcdd274f73a3ae83a), LL(0x6fd0d2066969b969), LL(0x482d124109092409), - LL(0xa7ade0d77070dd70), LL(0xd954716fb6b6e2b6), LL(0xceb7bd1ed0d067d0), LL(0x3b7ec7d6eded93ed), - LL(0x2edb85e2cccc17cc), LL(0x2a57846842421542), LL(0xb4c22d2c98985a98), LL(0x490e55eda4a4aaa4), - LL(0x5d8850752828a028), LL(0xda31b8865c5c6d5c), LL(0x933fed6bf8f8c7f8), LL(0x44a411c286862286), -}; - -static const u64 C5[256] = { - LL(0x18c07830d8181860), LL(0x2305af462623238c), LL(0xc67ef991b8c6c63f), LL(0xe8136fcdfbe8e887), - LL(0x874ca113cb878726), LL(0xb8a9626d11b8b8da), LL(0x0108050209010104), LL(0x4f426e9e0d4f4f21), - LL(0x36adee6c9b3636d8), LL(0xa6590451ffa6a6a2), LL(0xd2debdb90cd2d26f), LL(0xf5fb06f70ef5f5f3), - LL(0x79ef80f2967979f9), LL(0x6f5fcede306f6fa1), LL(0x91fcef3f6d91917e), LL(0x52aa07a4f8525255), - LL(0x6027fdc04760609d), LL(0xbc89766535bcbcca), LL(0x9baccd2b379b9b56), LL(0x8e048c018a8e8e02), - LL(0xa371155bd2a3a3b6), LL(0x0c603c186c0c0c30), LL(0x7bff8af6847b7bf1), LL(0x35b5e16a803535d4), - LL(0x1de8693af51d1d74), LL(0xe05347ddb3e0e0a7), LL(0xd7f6acb321d7d77b), LL(0xc25eed999cc2c22f), - LL(0x2e6d965c432e2eb8), LL(0x4b627a96294b4b31), LL(0xfea321e15dfefedf), LL(0x578216aed5575741), - LL(0x15a8412abd151554), LL(0x779fb6eee87777c1), LL(0x37a5eb6e923737dc), LL(0xe57b56d79ee5e5b3), - LL(0x9f8cd923139f9f46), LL(0xf0d317fd23f0f0e7), LL(0x4a6a7f94204a4a35), LL(0xda9e95a944dada4f), - LL(0x58fa25b0a258587d), LL(0xc906ca8fcfc9c903), LL(0x29558d527c2929a4), LL(0x0a5022145a0a0a28), - LL(0xb1e14f7f50b1b1fe), LL(0xa0691a5dc9a0a0ba), LL(0x6b7fdad6146b6bb1), LL(0x855cab17d985852e), - LL(0xbd8173673cbdbdce), LL(0x5dd234ba8f5d5d69), LL(0x1080502090101040), LL(0xf4f303f507f4f4f7), - LL(0xcb16c08bddcbcb0b), LL(0x3eedc67cd33e3ef8), LL(0x0528110a2d050514), LL(0x671fe6ce78676781), - LL(0xe47353d597e4e4b7), LL(0x2725bb4e0227279c), LL(0x4132588273414119), LL(0x8b2c9d0ba78b8b16), - LL(0xa7510153f6a7a7a6), LL(0x7dcf94fab27d7de9), LL(0x95dcfb374995956e), LL(0xd88e9fad56d8d847), - LL(0xfb8b30eb70fbfbcb), LL(0xee2371c1cdeeee9f), LL(0x7cc791f8bb7c7ced), LL(0x6617e3cc71666685), - LL(0xdda68ea77bdddd53), LL(0x17b84b2eaf17175c), LL(0x4702468e45474701), LL(0x9e84dc211a9e9e42), - LL(0xca1ec589d4caca0f), LL(0x2d75995a582d2db4), LL(0xbf9179632ebfbfc6), LL(0x07381b0e3f07071c), - LL(0xad012347acadad8e), LL(0x5aea2fb4b05a5a75), LL(0x836cb51bef838336), LL(0x3385ff66b63333cc), - LL(0x633ff2c65c636391), LL(0x02100a0412020208), LL(0xaa39384993aaaa92), LL(0x71afa8e2de7171d9), - LL(0xc80ecf8dc6c8c807), LL(0x19c87d32d1191964), LL(0x497270923b494939), LL(0xd9869aaf5fd9d943), - LL(0xf2c31df931f2f2ef), LL(0xe34b48dba8e3e3ab), LL(0x5be22ab6b95b5b71), LL(0x8834920dbc88881a), - LL(0x9aa4c8293e9a9a52), LL(0x262dbe4c0b262698), LL(0x328dfa64bf3232c8), LL(0xb0e94a7d59b0b0fa), - LL(0xe91b6acff2e9e983), LL(0x0f78331e770f0f3c), LL(0xd5e6a6b733d5d573), LL(0x8074ba1df480803a), - LL(0xbe997c6127bebec2), LL(0xcd26de87ebcdcd13), LL(0x34bde468893434d0), LL(0x487a75903248483d), - LL(0xffab24e354ffffdb), LL(0x7af78ff48d7a7af5), LL(0x90f4ea3d6490907a), LL(0x5fc23ebe9d5f5f61), - LL(0x201da0403d202080), LL(0x6867d5d00f6868bd), LL(0x1ad07234ca1a1a68), LL(0xae192c41b7aeae82), - LL(0xb4c95e757db4b4ea), LL(0x549a19a8ce54544d), LL(0x93ece53b7f939376), LL(0x220daa442f222288), - LL(0x6407e9c86364648d), LL(0xf1db12ff2af1f1e3), LL(0x73bfa2e6cc7373d1), LL(0x12905a2482121248), - LL(0x403a5d807a40401d), LL(0x0840281048080820), LL(0xc356e89b95c3c32b), LL(0xec337bc5dfecec97), - LL(0xdb9690ab4ddbdb4b), LL(0xa1611f5fc0a1a1be), LL(0x8d1c8307918d8d0e), LL(0x3df5c97ac83d3df4), - LL(0x97ccf1335b979766), LL(0x0000000000000000), LL(0xcf36d483f9cfcf1b), LL(0x2b4587566e2b2bac), - LL(0x7697b3ece17676c5), LL(0x8264b019e6828232), LL(0xd6fea9b128d6d67f), LL(0x1bd87736c31b1b6c), - LL(0xb5c15b7774b5b5ee), LL(0xaf112943beafaf86), LL(0x6a77dfd41d6a6ab5), LL(0x50ba0da0ea50505d), - LL(0x45124c8a57454509), LL(0xf3cb18fb38f3f3eb), LL(0x309df060ad3030c0), LL(0xef2b74c3c4efef9b), - LL(0x3fe5c37eda3f3ffc), LL(0x55921caac7555549), LL(0xa2791059dba2a2b2), LL(0xea0365c9e9eaea8f), - LL(0x650fecca6a656589), LL(0xbab9686903babad2), LL(0x2f65935e4a2f2fbc), LL(0xc04ee79d8ec0c027), - LL(0xdebe81a160dede5f), LL(0x1ce06c38fc1c1c70), LL(0xfdbb2ee746fdfdd3), LL(0x4d52649a1f4d4d29), - LL(0x92e4e03976929272), LL(0x758fbceafa7575c9), LL(0x06301e0c36060618), LL(0x8a249809ae8a8a12), - LL(0xb2f940794bb2b2f2), LL(0xe66359d185e6e6bf), LL(0x0e70361c7e0e0e38), LL(0x1ff8633ee71f1f7c), - LL(0x6237f7c455626295), LL(0xd4eea3b53ad4d477), LL(0xa829324d81a8a89a), LL(0x96c4f43152969662), - LL(0xf99b3aef62f9f9c3), LL(0xc566f697a3c5c533), LL(0x2535b14a10252594), LL(0x59f220b2ab595979), - LL(0x8454ae15d084842a), LL(0x72b7a7e4c57272d5), LL(0x39d5dd72ec3939e4), LL(0x4c5a6198164c4c2d), - LL(0x5eca3bbc945e5e65), LL(0x78e785f09f7878fd), LL(0x38ddd870e53838e0), LL(0x8c148605988c8c0a), - LL(0xd1c6b2bf17d1d163), LL(0xa5410b57e4a5a5ae), LL(0xe2434dd9a1e2e2af), LL(0x612ff8c24e616199), - LL(0xb3f1457b42b3b3f6), LL(0x2115a54234212184), LL(0x9c94d625089c9c4a), LL(0x1ef0663cee1e1e78), - LL(0x4322528661434311), LL(0xc776fc93b1c7c73b), LL(0xfcb32be54ffcfcd7), LL(0x0420140824040410), - LL(0x51b208a2e3515159), LL(0x99bcc72f2599995e), LL(0x6d4fc4da226d6da9), LL(0x0d68391a650d0d34), - LL(0xfa8335e979fafacf), LL(0xdfb684a369dfdf5b), LL(0x7ed79bfca97e7ee5), LL(0x243db44819242490), - LL(0x3bc5d776fe3b3bec), LL(0xab313d4b9aabab96), LL(0xce3ed181f0cece1f), LL(0x1188552299111144), - LL(0x8f0c8903838f8f06), LL(0x4e4a6b9c044e4e25), LL(0xb7d1517366b7b7e6), LL(0xeb0b60cbe0ebeb8b), - LL(0x3cfdcc78c13c3cf0), LL(0x817cbf1ffd81813e), LL(0x94d4fe354094946a), LL(0xf7eb0cf31cf7f7fb), - LL(0xb9a1676f18b9b9de), LL(0x13985f268b13134c), LL(0x2c7d9c58512c2cb0), LL(0xd3d6b8bb05d3d36b), - LL(0xe76b5cd38ce7e7bb), LL(0x6e57cbdc396e6ea5), LL(0xc46ef395aac4c437), LL(0x03180f061b03030c), - LL(0x568a13acdc565645), LL(0x441a49885e44440d), LL(0x7fdf9efea07f7fe1), LL(0xa921374f88a9a99e), - LL(0x2a4d8254672a2aa8), LL(0xbbb16d6b0abbbbd6), LL(0xc146e29f87c1c123), LL(0x53a202a6f1535351), - LL(0xdcae8ba572dcdc57), LL(0x0b582716530b0b2c), LL(0x9d9cd327019d9d4e), LL(0x6c47c1d82b6c6cad), - LL(0x3195f562a43131c4), LL(0x7487b9e8f37474cd), LL(0xf6e309f115f6f6ff), LL(0x460a438c4c464605), - LL(0xac092645a5acac8a), LL(0x893c970fb589891e), LL(0x14a04428b4141450), LL(0xe15b42dfbae1e1a3), - LL(0x16b04e2ca6161658), LL(0x3acdd274f73a3ae8), LL(0x696fd0d2066969b9), LL(0x09482d1241090924), - LL(0x70a7ade0d77070dd), LL(0xb6d954716fb6b6e2), LL(0xd0ceb7bd1ed0d067), LL(0xed3b7ec7d6eded93), - LL(0xcc2edb85e2cccc17), LL(0x422a578468424215), LL(0x98b4c22d2c98985a), LL(0xa4490e55eda4a4aa), - LL(0x285d8850752828a0), LL(0x5cda31b8865c5c6d), LL(0xf8933fed6bf8f8c7), LL(0x8644a411c2868622), -}; - -static const u64 C6[256] = { - LL(0x6018c07830d81818), LL(0x8c2305af46262323), LL(0x3fc67ef991b8c6c6), LL(0x87e8136fcdfbe8e8), - LL(0x26874ca113cb8787), LL(0xdab8a9626d11b8b8), LL(0x0401080502090101), LL(0x214f426e9e0d4f4f), - LL(0xd836adee6c9b3636), LL(0xa2a6590451ffa6a6), LL(0x6fd2debdb90cd2d2), LL(0xf3f5fb06f70ef5f5), - LL(0xf979ef80f2967979), LL(0xa16f5fcede306f6f), LL(0x7e91fcef3f6d9191), LL(0x5552aa07a4f85252), - LL(0x9d6027fdc0476060), LL(0xcabc89766535bcbc), LL(0x569baccd2b379b9b), LL(0x028e048c018a8e8e), - LL(0xb6a371155bd2a3a3), LL(0x300c603c186c0c0c), LL(0xf17bff8af6847b7b), LL(0xd435b5e16a803535), - LL(0x741de8693af51d1d), LL(0xa7e05347ddb3e0e0), LL(0x7bd7f6acb321d7d7), LL(0x2fc25eed999cc2c2), - LL(0xb82e6d965c432e2e), LL(0x314b627a96294b4b), LL(0xdffea321e15dfefe), LL(0x41578216aed55757), - LL(0x5415a8412abd1515), LL(0xc1779fb6eee87777), LL(0xdc37a5eb6e923737), LL(0xb3e57b56d79ee5e5), - LL(0x469f8cd923139f9f), LL(0xe7f0d317fd23f0f0), LL(0x354a6a7f94204a4a), LL(0x4fda9e95a944dada), - LL(0x7d58fa25b0a25858), LL(0x03c906ca8fcfc9c9), LL(0xa429558d527c2929), LL(0x280a5022145a0a0a), - LL(0xfeb1e14f7f50b1b1), LL(0xbaa0691a5dc9a0a0), LL(0xb16b7fdad6146b6b), LL(0x2e855cab17d98585), - LL(0xcebd8173673cbdbd), LL(0x695dd234ba8f5d5d), LL(0x4010805020901010), LL(0xf7f4f303f507f4f4), - LL(0x0bcb16c08bddcbcb), LL(0xf83eedc67cd33e3e), LL(0x140528110a2d0505), LL(0x81671fe6ce786767), - LL(0xb7e47353d597e4e4), LL(0x9c2725bb4e022727), LL(0x1941325882734141), LL(0x168b2c9d0ba78b8b), - LL(0xa6a7510153f6a7a7), LL(0xe97dcf94fab27d7d), LL(0x6e95dcfb37499595), LL(0x47d88e9fad56d8d8), - LL(0xcbfb8b30eb70fbfb), LL(0x9fee2371c1cdeeee), LL(0xed7cc791f8bb7c7c), LL(0x856617e3cc716666), - LL(0x53dda68ea77bdddd), LL(0x5c17b84b2eaf1717), LL(0x014702468e454747), LL(0x429e84dc211a9e9e), - LL(0x0fca1ec589d4caca), LL(0xb42d75995a582d2d), LL(0xc6bf9179632ebfbf), LL(0x1c07381b0e3f0707), - LL(0x8ead012347acadad), LL(0x755aea2fb4b05a5a), LL(0x36836cb51bef8383), LL(0xcc3385ff66b63333), - LL(0x91633ff2c65c6363), LL(0x0802100a04120202), LL(0x92aa39384993aaaa), LL(0xd971afa8e2de7171), - LL(0x07c80ecf8dc6c8c8), LL(0x6419c87d32d11919), LL(0x39497270923b4949), LL(0x43d9869aaf5fd9d9), - LL(0xeff2c31df931f2f2), LL(0xabe34b48dba8e3e3), LL(0x715be22ab6b95b5b), LL(0x1a8834920dbc8888), - LL(0x529aa4c8293e9a9a), LL(0x98262dbe4c0b2626), LL(0xc8328dfa64bf3232), LL(0xfab0e94a7d59b0b0), - LL(0x83e91b6acff2e9e9), LL(0x3c0f78331e770f0f), LL(0x73d5e6a6b733d5d5), LL(0x3a8074ba1df48080), - LL(0xc2be997c6127bebe), LL(0x13cd26de87ebcdcd), LL(0xd034bde468893434), LL(0x3d487a7590324848), - LL(0xdbffab24e354ffff), LL(0xf57af78ff48d7a7a), LL(0x7a90f4ea3d649090), LL(0x615fc23ebe9d5f5f), - LL(0x80201da0403d2020), LL(0xbd6867d5d00f6868), LL(0x681ad07234ca1a1a), LL(0x82ae192c41b7aeae), - LL(0xeab4c95e757db4b4), LL(0x4d549a19a8ce5454), LL(0x7693ece53b7f9393), LL(0x88220daa442f2222), - LL(0x8d6407e9c8636464), LL(0xe3f1db12ff2af1f1), LL(0xd173bfa2e6cc7373), LL(0x4812905a24821212), - LL(0x1d403a5d807a4040), LL(0x2008402810480808), LL(0x2bc356e89b95c3c3), LL(0x97ec337bc5dfecec), - LL(0x4bdb9690ab4ddbdb), LL(0xbea1611f5fc0a1a1), LL(0x0e8d1c8307918d8d), LL(0xf43df5c97ac83d3d), - LL(0x6697ccf1335b9797), LL(0x0000000000000000), LL(0x1bcf36d483f9cfcf), LL(0xac2b4587566e2b2b), - LL(0xc57697b3ece17676), LL(0x328264b019e68282), LL(0x7fd6fea9b128d6d6), LL(0x6c1bd87736c31b1b), - LL(0xeeb5c15b7774b5b5), LL(0x86af112943beafaf), LL(0xb56a77dfd41d6a6a), LL(0x5d50ba0da0ea5050), - LL(0x0945124c8a574545), LL(0xebf3cb18fb38f3f3), LL(0xc0309df060ad3030), LL(0x9bef2b74c3c4efef), - LL(0xfc3fe5c37eda3f3f), LL(0x4955921caac75555), LL(0xb2a2791059dba2a2), LL(0x8fea0365c9e9eaea), - LL(0x89650fecca6a6565), LL(0xd2bab9686903baba), LL(0xbc2f65935e4a2f2f), LL(0x27c04ee79d8ec0c0), - LL(0x5fdebe81a160dede), LL(0x701ce06c38fc1c1c), LL(0xd3fdbb2ee746fdfd), LL(0x294d52649a1f4d4d), - LL(0x7292e4e039769292), LL(0xc9758fbceafa7575), LL(0x1806301e0c360606), LL(0x128a249809ae8a8a), - LL(0xf2b2f940794bb2b2), LL(0xbfe66359d185e6e6), LL(0x380e70361c7e0e0e), LL(0x7c1ff8633ee71f1f), - LL(0x956237f7c4556262), LL(0x77d4eea3b53ad4d4), LL(0x9aa829324d81a8a8), LL(0x6296c4f431529696), - LL(0xc3f99b3aef62f9f9), LL(0x33c566f697a3c5c5), LL(0x942535b14a102525), LL(0x7959f220b2ab5959), - LL(0x2a8454ae15d08484), LL(0xd572b7a7e4c57272), LL(0xe439d5dd72ec3939), LL(0x2d4c5a6198164c4c), - LL(0x655eca3bbc945e5e), LL(0xfd78e785f09f7878), LL(0xe038ddd870e53838), LL(0x0a8c148605988c8c), - LL(0x63d1c6b2bf17d1d1), LL(0xaea5410b57e4a5a5), LL(0xafe2434dd9a1e2e2), LL(0x99612ff8c24e6161), - LL(0xf6b3f1457b42b3b3), LL(0x842115a542342121), LL(0x4a9c94d625089c9c), LL(0x781ef0663cee1e1e), - LL(0x1143225286614343), LL(0x3bc776fc93b1c7c7), LL(0xd7fcb32be54ffcfc), LL(0x1004201408240404), - LL(0x5951b208a2e35151), LL(0x5e99bcc72f259999), LL(0xa96d4fc4da226d6d), LL(0x340d68391a650d0d), - LL(0xcffa8335e979fafa), LL(0x5bdfb684a369dfdf), LL(0xe57ed79bfca97e7e), LL(0x90243db448192424), - LL(0xec3bc5d776fe3b3b), LL(0x96ab313d4b9aabab), LL(0x1fce3ed181f0cece), LL(0x4411885522991111), - LL(0x068f0c8903838f8f), LL(0x254e4a6b9c044e4e), LL(0xe6b7d1517366b7b7), LL(0x8beb0b60cbe0ebeb), - LL(0xf03cfdcc78c13c3c), LL(0x3e817cbf1ffd8181), LL(0x6a94d4fe35409494), LL(0xfbf7eb0cf31cf7f7), - LL(0xdeb9a1676f18b9b9), LL(0x4c13985f268b1313), LL(0xb02c7d9c58512c2c), LL(0x6bd3d6b8bb05d3d3), - LL(0xbbe76b5cd38ce7e7), LL(0xa56e57cbdc396e6e), LL(0x37c46ef395aac4c4), LL(0x0c03180f061b0303), - LL(0x45568a13acdc5656), LL(0x0d441a49885e4444), LL(0xe17fdf9efea07f7f), LL(0x9ea921374f88a9a9), - LL(0xa82a4d8254672a2a), LL(0xd6bbb16d6b0abbbb), LL(0x23c146e29f87c1c1), LL(0x5153a202a6f15353), - LL(0x57dcae8ba572dcdc), LL(0x2c0b582716530b0b), LL(0x4e9d9cd327019d9d), LL(0xad6c47c1d82b6c6c), - LL(0xc43195f562a43131), LL(0xcd7487b9e8f37474), LL(0xfff6e309f115f6f6), LL(0x05460a438c4c4646), - LL(0x8aac092645a5acac), LL(0x1e893c970fb58989), LL(0x5014a04428b41414), LL(0xa3e15b42dfbae1e1), - LL(0x5816b04e2ca61616), LL(0xe83acdd274f73a3a), LL(0xb9696fd0d2066969), LL(0x2409482d12410909), - LL(0xdd70a7ade0d77070), LL(0xe2b6d954716fb6b6), LL(0x67d0ceb7bd1ed0d0), LL(0x93ed3b7ec7d6eded), - LL(0x17cc2edb85e2cccc), LL(0x15422a5784684242), LL(0x5a98b4c22d2c9898), LL(0xaaa4490e55eda4a4), - LL(0xa0285d8850752828), LL(0x6d5cda31b8865c5c), LL(0xc7f8933fed6bf8f8), LL(0x228644a411c28686), -}; - -static const u64 C7[256] = { - LL(0x186018c07830d818), LL(0x238c2305af462623), LL(0xc63fc67ef991b8c6), LL(0xe887e8136fcdfbe8), - LL(0x8726874ca113cb87), LL(0xb8dab8a9626d11b8), LL(0x0104010805020901), LL(0x4f214f426e9e0d4f), - LL(0x36d836adee6c9b36), LL(0xa6a2a6590451ffa6), LL(0xd26fd2debdb90cd2), LL(0xf5f3f5fb06f70ef5), - LL(0x79f979ef80f29679), LL(0x6fa16f5fcede306f), LL(0x917e91fcef3f6d91), LL(0x525552aa07a4f852), - LL(0x609d6027fdc04760), LL(0xbccabc89766535bc), LL(0x9b569baccd2b379b), LL(0x8e028e048c018a8e), - LL(0xa3b6a371155bd2a3), LL(0x0c300c603c186c0c), LL(0x7bf17bff8af6847b), LL(0x35d435b5e16a8035), - LL(0x1d741de8693af51d), LL(0xe0a7e05347ddb3e0), LL(0xd77bd7f6acb321d7), LL(0xc22fc25eed999cc2), - LL(0x2eb82e6d965c432e), LL(0x4b314b627a96294b), LL(0xfedffea321e15dfe), LL(0x5741578216aed557), - LL(0x155415a8412abd15), LL(0x77c1779fb6eee877), LL(0x37dc37a5eb6e9237), LL(0xe5b3e57b56d79ee5), - LL(0x9f469f8cd923139f), LL(0xf0e7f0d317fd23f0), LL(0x4a354a6a7f94204a), LL(0xda4fda9e95a944da), - LL(0x587d58fa25b0a258), LL(0xc903c906ca8fcfc9), LL(0x29a429558d527c29), LL(0x0a280a5022145a0a), - LL(0xb1feb1e14f7f50b1), LL(0xa0baa0691a5dc9a0), LL(0x6bb16b7fdad6146b), LL(0x852e855cab17d985), - LL(0xbdcebd8173673cbd), LL(0x5d695dd234ba8f5d), LL(0x1040108050209010), LL(0xf4f7f4f303f507f4), - LL(0xcb0bcb16c08bddcb), LL(0x3ef83eedc67cd33e), LL(0x05140528110a2d05), LL(0x6781671fe6ce7867), - LL(0xe4b7e47353d597e4), LL(0x279c2725bb4e0227), LL(0x4119413258827341), LL(0x8b168b2c9d0ba78b), - LL(0xa7a6a7510153f6a7), LL(0x7de97dcf94fab27d), LL(0x956e95dcfb374995), LL(0xd847d88e9fad56d8), - LL(0xfbcbfb8b30eb70fb), LL(0xee9fee2371c1cdee), LL(0x7ced7cc791f8bb7c), LL(0x66856617e3cc7166), - LL(0xdd53dda68ea77bdd), LL(0x175c17b84b2eaf17), LL(0x47014702468e4547), LL(0x9e429e84dc211a9e), - LL(0xca0fca1ec589d4ca), LL(0x2db42d75995a582d), LL(0xbfc6bf9179632ebf), LL(0x071c07381b0e3f07), - LL(0xad8ead012347acad), LL(0x5a755aea2fb4b05a), LL(0x8336836cb51bef83), LL(0x33cc3385ff66b633), - LL(0x6391633ff2c65c63), LL(0x020802100a041202), LL(0xaa92aa39384993aa), LL(0x71d971afa8e2de71), - LL(0xc807c80ecf8dc6c8), LL(0x196419c87d32d119), LL(0x4939497270923b49), LL(0xd943d9869aaf5fd9), - LL(0xf2eff2c31df931f2), LL(0xe3abe34b48dba8e3), LL(0x5b715be22ab6b95b), LL(0x881a8834920dbc88), - LL(0x9a529aa4c8293e9a), LL(0x2698262dbe4c0b26), LL(0x32c8328dfa64bf32), LL(0xb0fab0e94a7d59b0), - LL(0xe983e91b6acff2e9), LL(0x0f3c0f78331e770f), LL(0xd573d5e6a6b733d5), LL(0x803a8074ba1df480), - LL(0xbec2be997c6127be), LL(0xcd13cd26de87ebcd), LL(0x34d034bde4688934), LL(0x483d487a75903248), - LL(0xffdbffab24e354ff), LL(0x7af57af78ff48d7a), LL(0x907a90f4ea3d6490), LL(0x5f615fc23ebe9d5f), - LL(0x2080201da0403d20), LL(0x68bd6867d5d00f68), LL(0x1a681ad07234ca1a), LL(0xae82ae192c41b7ae), - LL(0xb4eab4c95e757db4), LL(0x544d549a19a8ce54), LL(0x937693ece53b7f93), LL(0x2288220daa442f22), - LL(0x648d6407e9c86364), LL(0xf1e3f1db12ff2af1), LL(0x73d173bfa2e6cc73), LL(0x124812905a248212), - LL(0x401d403a5d807a40), LL(0x0820084028104808), LL(0xc32bc356e89b95c3), LL(0xec97ec337bc5dfec), - LL(0xdb4bdb9690ab4ddb), LL(0xa1bea1611f5fc0a1), LL(0x8d0e8d1c8307918d), LL(0x3df43df5c97ac83d), - LL(0x976697ccf1335b97), LL(0x0000000000000000), LL(0xcf1bcf36d483f9cf), LL(0x2bac2b4587566e2b), - LL(0x76c57697b3ece176), LL(0x82328264b019e682), LL(0xd67fd6fea9b128d6), LL(0x1b6c1bd87736c31b), - LL(0xb5eeb5c15b7774b5), LL(0xaf86af112943beaf), LL(0x6ab56a77dfd41d6a), LL(0x505d50ba0da0ea50), - LL(0x450945124c8a5745), LL(0xf3ebf3cb18fb38f3), LL(0x30c0309df060ad30), LL(0xef9bef2b74c3c4ef), - LL(0x3ffc3fe5c37eda3f), LL(0x554955921caac755), LL(0xa2b2a2791059dba2), LL(0xea8fea0365c9e9ea), - LL(0x6589650fecca6a65), LL(0xbad2bab9686903ba), LL(0x2fbc2f65935e4a2f), LL(0xc027c04ee79d8ec0), - LL(0xde5fdebe81a160de), LL(0x1c701ce06c38fc1c), LL(0xfdd3fdbb2ee746fd), LL(0x4d294d52649a1f4d), - LL(0x927292e4e0397692), LL(0x75c9758fbceafa75), LL(0x061806301e0c3606), LL(0x8a128a249809ae8a), - LL(0xb2f2b2f940794bb2), LL(0xe6bfe66359d185e6), LL(0x0e380e70361c7e0e), LL(0x1f7c1ff8633ee71f), - LL(0x62956237f7c45562), LL(0xd477d4eea3b53ad4), LL(0xa89aa829324d81a8), LL(0x966296c4f4315296), - LL(0xf9c3f99b3aef62f9), LL(0xc533c566f697a3c5), LL(0x25942535b14a1025), LL(0x597959f220b2ab59), - LL(0x842a8454ae15d084), LL(0x72d572b7a7e4c572), LL(0x39e439d5dd72ec39), LL(0x4c2d4c5a6198164c), - LL(0x5e655eca3bbc945e), LL(0x78fd78e785f09f78), LL(0x38e038ddd870e538), LL(0x8c0a8c148605988c), - LL(0xd163d1c6b2bf17d1), LL(0xa5aea5410b57e4a5), LL(0xe2afe2434dd9a1e2), LL(0x6199612ff8c24e61), - LL(0xb3f6b3f1457b42b3), LL(0x21842115a5423421), LL(0x9c4a9c94d625089c), LL(0x1e781ef0663cee1e), - LL(0x4311432252866143), LL(0xc73bc776fc93b1c7), LL(0xfcd7fcb32be54ffc), LL(0x0410042014082404), - LL(0x515951b208a2e351), LL(0x995e99bcc72f2599), LL(0x6da96d4fc4da226d), LL(0x0d340d68391a650d), - LL(0xfacffa8335e979fa), LL(0xdf5bdfb684a369df), LL(0x7ee57ed79bfca97e), LL(0x2490243db4481924), - LL(0x3bec3bc5d776fe3b), LL(0xab96ab313d4b9aab), LL(0xce1fce3ed181f0ce), LL(0x1144118855229911), - LL(0x8f068f0c8903838f), LL(0x4e254e4a6b9c044e), LL(0xb7e6b7d1517366b7), LL(0xeb8beb0b60cbe0eb), - LL(0x3cf03cfdcc78c13c), LL(0x813e817cbf1ffd81), LL(0x946a94d4fe354094), LL(0xf7fbf7eb0cf31cf7), - LL(0xb9deb9a1676f18b9), LL(0x134c13985f268b13), LL(0x2cb02c7d9c58512c), LL(0xd36bd3d6b8bb05d3), - LL(0xe7bbe76b5cd38ce7), LL(0x6ea56e57cbdc396e), LL(0xc437c46ef395aac4), LL(0x030c03180f061b03), - LL(0x5645568a13acdc56), LL(0x440d441a49885e44), LL(0x7fe17fdf9efea07f), LL(0xa99ea921374f88a9), - LL(0x2aa82a4d8254672a), LL(0xbbd6bbb16d6b0abb), LL(0xc123c146e29f87c1), LL(0x535153a202a6f153), - LL(0xdc57dcae8ba572dc), LL(0x0b2c0b582716530b), LL(0x9d4e9d9cd327019d), LL(0x6cad6c47c1d82b6c), - LL(0x31c43195f562a431), LL(0x74cd7487b9e8f374), LL(0xf6fff6e309f115f6), LL(0x4605460a438c4c46), - LL(0xac8aac092645a5ac), LL(0x891e893c970fb589), LL(0x145014a04428b414), LL(0xe1a3e15b42dfbae1), - LL(0x165816b04e2ca616), LL(0x3ae83acdd274f73a), LL(0x69b9696fd0d20669), LL(0x092409482d124109), - LL(0x70dd70a7ade0d770), LL(0xb6e2b6d954716fb6), LL(0xd067d0ceb7bd1ed0), LL(0xed93ed3b7ec7d6ed), - LL(0xcc17cc2edb85e2cc), LL(0x4215422a57846842), LL(0x985a98b4c22d2c98), LL(0xa4aaa4490e55eda4), - LL(0x28a0285d88507528), LL(0x5c6d5cda31b8865c), LL(0xf8c7f8933fed6bf8), LL(0x86228644a411c286), -}; - -static const u64 rc[R + 1] = { - LL(0x0000000000000000), - LL(0x1823c6e887b8014f), - LL(0x36a6d2f5796f9152), - LL(0x60bc9b8ea30c7b35), - LL(0x1de0d7c22e4bfe57), - LL(0x157737e59ff04ada), - LL(0x58c9290ab1a06b85), - LL(0xbd5d10f4cb3e0567), - LL(0xe427418ba77d95d8), - LL(0xfbee7c66dd17479e), - LL(0xca2dbf07ad5a8333), -}; - -/** - * The core Whirlpool transform. - */ -static void processBuffer(struct NESSIEstruct * const structpointer) { - int i, r; - u64 K[8]; /* the round key */ - u64 block[8]; /* mu(buffer) */ - u64 state[8]; /* the cipher state */ - u64 L[8]; - u8 *buffer = structpointer->buffer; - /* - * map the buffer to a block: - */ - for (i = 0; i < 8; i++, buffer += 8) { - block[i] = - (((u64)buffer[0] ) << 56) ^ - (((u64)buffer[1] & 0xffL) << 48) ^ - (((u64)buffer[2] & 0xffL) << 40) ^ - (((u64)buffer[3] & 0xffL) << 32) ^ - (((u64)buffer[4] & 0xffL) << 24) ^ - (((u64)buffer[5] & 0xffL) << 16) ^ - (((u64)buffer[6] & 0xffL) << 8) ^ - (((u64)buffer[7] & 0xffL) ); - } - /* - * compute and apply K^0 to the cipher state: - */ - state[0] = block[0] ^ (K[0] = structpointer->hash[0]); - state[1] = block[1] ^ (K[1] = structpointer->hash[1]); - state[2] = block[2] ^ (K[2] = structpointer->hash[2]); - state[3] = block[3] ^ (K[3] = structpointer->hash[3]); - state[4] = block[4] ^ (K[4] = structpointer->hash[4]); - state[5] = block[5] ^ (K[5] = structpointer->hash[5]); - state[6] = block[6] ^ (K[6] = structpointer->hash[6]); - state[7] = block[7] ^ (K[7] = structpointer->hash[7]); - /* - * iterate over all rounds: - */ - for (r = 1; r <= R; r++) { - /* - * compute K^r from K^{r-1}: - */ - L[0] = - C0[(int)(K[0] >> 56) ] ^ - C1[(int)(K[7] >> 48) & 0xff] ^ - C2[(int)(K[6] >> 40) & 0xff] ^ - C3[(int)(K[5] >> 32) & 0xff] ^ - C4[(int)(K[4] >> 24) & 0xff] ^ - C5[(int)(K[3] >> 16) & 0xff] ^ - C6[(int)(K[2] >> 8) & 0xff] ^ - C7[(int)(K[1] ) & 0xff] ^ - rc[r]; - L[1] = - C0[(int)(K[1] >> 56) ] ^ - C1[(int)(K[0] >> 48) & 0xff] ^ - C2[(int)(K[7] >> 40) & 0xff] ^ - C3[(int)(K[6] >> 32) & 0xff] ^ - C4[(int)(K[5] >> 24) & 0xff] ^ - C5[(int)(K[4] >> 16) & 0xff] ^ - C6[(int)(K[3] >> 8) & 0xff] ^ - C7[(int)(K[2] ) & 0xff]; - L[2] = - C0[(int)(K[2] >> 56) ] ^ - C1[(int)(K[1] >> 48) & 0xff] ^ - C2[(int)(K[0] >> 40) & 0xff] ^ - C3[(int)(K[7] >> 32) & 0xff] ^ - C4[(int)(K[6] >> 24) & 0xff] ^ - C5[(int)(K[5] >> 16) & 0xff] ^ - C6[(int)(K[4] >> 8) & 0xff] ^ - C7[(int)(K[3] ) & 0xff]; - L[3] = - C0[(int)(K[3] >> 56) ] ^ - C1[(int)(K[2] >> 48) & 0xff] ^ - C2[(int)(K[1] >> 40) & 0xff] ^ - C3[(int)(K[0] >> 32) & 0xff] ^ - C4[(int)(K[7] >> 24) & 0xff] ^ - C5[(int)(K[6] >> 16) & 0xff] ^ - C6[(int)(K[5] >> 8) & 0xff] ^ - C7[(int)(K[4] ) & 0xff]; - L[4] = - C0[(int)(K[4] >> 56) ] ^ - C1[(int)(K[3] >> 48) & 0xff] ^ - C2[(int)(K[2] >> 40) & 0xff] ^ - C3[(int)(K[1] >> 32) & 0xff] ^ - C4[(int)(K[0] >> 24) & 0xff] ^ - C5[(int)(K[7] >> 16) & 0xff] ^ - C6[(int)(K[6] >> 8) & 0xff] ^ - C7[(int)(K[5] ) & 0xff]; - L[5] = - C0[(int)(K[5] >> 56) ] ^ - C1[(int)(K[4] >> 48) & 0xff] ^ - C2[(int)(K[3] >> 40) & 0xff] ^ - C3[(int)(K[2] >> 32) & 0xff] ^ - C4[(int)(K[1] >> 24) & 0xff] ^ - C5[(int)(K[0] >> 16) & 0xff] ^ - C6[(int)(K[7] >> 8) & 0xff] ^ - C7[(int)(K[6] ) & 0xff]; - L[6] = - C0[(int)(K[6] >> 56) ] ^ - C1[(int)(K[5] >> 48) & 0xff] ^ - C2[(int)(K[4] >> 40) & 0xff] ^ - C3[(int)(K[3] >> 32) & 0xff] ^ - C4[(int)(K[2] >> 24) & 0xff] ^ - C5[(int)(K[1] >> 16) & 0xff] ^ - C6[(int)(K[0] >> 8) & 0xff] ^ - C7[(int)(K[7] ) & 0xff]; - L[7] = - C0[(int)(K[7] >> 56) ] ^ - C1[(int)(K[6] >> 48) & 0xff] ^ - C2[(int)(K[5] >> 40) & 0xff] ^ - C3[(int)(K[4] >> 32) & 0xff] ^ - C4[(int)(K[3] >> 24) & 0xff] ^ - C5[(int)(K[2] >> 16) & 0xff] ^ - C6[(int)(K[1] >> 8) & 0xff] ^ - C7[(int)(K[0] ) & 0xff]; - K[0] = L[0]; - K[1] = L[1]; - K[2] = L[2]; - K[3] = L[3]; - K[4] = L[4]; - K[5] = L[5]; - K[6] = L[6]; - K[7] = L[7]; - /* - * apply the r-th round transformation: - */ - L[0] = - C0[(int)(state[0] >> 56) ] ^ - C1[(int)(state[7] >> 48) & 0xff] ^ - C2[(int)(state[6] >> 40) & 0xff] ^ - C3[(int)(state[5] >> 32) & 0xff] ^ - C4[(int)(state[4] >> 24) & 0xff] ^ - C5[(int)(state[3] >> 16) & 0xff] ^ - C6[(int)(state[2] >> 8) & 0xff] ^ - C7[(int)(state[1] ) & 0xff] ^ - K[0]; - L[1] = - C0[(int)(state[1] >> 56) ] ^ - C1[(int)(state[0] >> 48) & 0xff] ^ - C2[(int)(state[7] >> 40) & 0xff] ^ - C3[(int)(state[6] >> 32) & 0xff] ^ - C4[(int)(state[5] >> 24) & 0xff] ^ - C5[(int)(state[4] >> 16) & 0xff] ^ - C6[(int)(state[3] >> 8) & 0xff] ^ - C7[(int)(state[2] ) & 0xff] ^ - K[1]; - L[2] = - C0[(int)(state[2] >> 56) ] ^ - C1[(int)(state[1] >> 48) & 0xff] ^ - C2[(int)(state[0] >> 40) & 0xff] ^ - C3[(int)(state[7] >> 32) & 0xff] ^ - C4[(int)(state[6] >> 24) & 0xff] ^ - C5[(int)(state[5] >> 16) & 0xff] ^ - C6[(int)(state[4] >> 8) & 0xff] ^ - C7[(int)(state[3] ) & 0xff] ^ - K[2]; - L[3] = - C0[(int)(state[3] >> 56) ] ^ - C1[(int)(state[2] >> 48) & 0xff] ^ - C2[(int)(state[1] >> 40) & 0xff] ^ - C3[(int)(state[0] >> 32) & 0xff] ^ - C4[(int)(state[7] >> 24) & 0xff] ^ - C5[(int)(state[6] >> 16) & 0xff] ^ - C6[(int)(state[5] >> 8) & 0xff] ^ - C7[(int)(state[4] ) & 0xff] ^ - K[3]; - L[4] = - C0[(int)(state[4] >> 56) ] ^ - C1[(int)(state[3] >> 48) & 0xff] ^ - C2[(int)(state[2] >> 40) & 0xff] ^ - C3[(int)(state[1] >> 32) & 0xff] ^ - C4[(int)(state[0] >> 24) & 0xff] ^ - C5[(int)(state[7] >> 16) & 0xff] ^ - C6[(int)(state[6] >> 8) & 0xff] ^ - C7[(int)(state[5] ) & 0xff] ^ - K[4]; - L[5] = - C0[(int)(state[5] >> 56) ] ^ - C1[(int)(state[4] >> 48) & 0xff] ^ - C2[(int)(state[3] >> 40) & 0xff] ^ - C3[(int)(state[2] >> 32) & 0xff] ^ - C4[(int)(state[1] >> 24) & 0xff] ^ - C5[(int)(state[0] >> 16) & 0xff] ^ - C6[(int)(state[7] >> 8) & 0xff] ^ - C7[(int)(state[6] ) & 0xff] ^ - K[5]; - L[6] = - C0[(int)(state[6] >> 56) ] ^ - C1[(int)(state[5] >> 48) & 0xff] ^ - C2[(int)(state[4] >> 40) & 0xff] ^ - C3[(int)(state[3] >> 32) & 0xff] ^ - C4[(int)(state[2] >> 24) & 0xff] ^ - C5[(int)(state[1] >> 16) & 0xff] ^ - C6[(int)(state[0] >> 8) & 0xff] ^ - C7[(int)(state[7] ) & 0xff] ^ - K[6]; - L[7] = - C0[(int)(state[7] >> 56) ] ^ - C1[(int)(state[6] >> 48) & 0xff] ^ - C2[(int)(state[5] >> 40) & 0xff] ^ - C3[(int)(state[4] >> 32) & 0xff] ^ - C4[(int)(state[3] >> 24) & 0xff] ^ - C5[(int)(state[2] >> 16) & 0xff] ^ - C6[(int)(state[1] >> 8) & 0xff] ^ - C7[(int)(state[0] ) & 0xff] ^ - K[7]; - state[0] = L[0]; - state[1] = L[1]; - state[2] = L[2]; - state[3] = L[3]; - state[4] = L[4]; - state[5] = L[5]; - state[6] = L[6]; - state[7] = L[7]; - } - /* - * apply the Miyaguchi-Preneel compression function: - */ - structpointer->hash[0] ^= state[0] ^ block[0]; - structpointer->hash[1] ^= state[1] ^ block[1]; - structpointer->hash[2] ^= state[2] ^ block[2]; - structpointer->hash[3] ^= state[3] ^ block[3]; - structpointer->hash[4] ^= state[4] ^ block[4]; - structpointer->hash[5] ^= state[5] ^ block[5]; - structpointer->hash[6] ^= state[6] ^ block[6]; - structpointer->hash[7] ^= state[7] ^ block[7]; -} - -/** - * Initialize the hashing state. - */ -void WHIRLPOOL_init(struct NESSIEstruct * const structpointer) { - int i; - - memset(structpointer->bitLength, 0, 32); - structpointer->bufferBits = structpointer->bufferPos = 0; - structpointer->buffer[0] = 0; /* it's only necessary to cleanup buffer[bufferPos] */ - for (i = 0; i < 8; i++) { - structpointer->hash[i] = 0L; /* initial value */ - } -} - -/** - * Delivers input data to the hashing algorithm. - * - * @param source plaintext data to hash. - * @param sourceBits how many bits of plaintext to process. - * - * This method maintains the invariant: bufferBits < DIGESTBITS - */ -void WHIRLPOOL_add(const unsigned char * const source, - uint32_t sourceBits, - struct NESSIEstruct * const structpointer) { - /* - sourcePos - | - +-------+-------+------- - ||||||||||||||||||||| source - +-------+-------+------- - +-------+-------+-------+-------+-------+------- - |||||||||||||||||||||| buffer - +-------+-------+-------+-------+-------+------- - | - bufferPos - */ - int sourcePos = 0; /* index of leftmost source u8 containing data (1 to 8 bits). */ - int sourceGap = (8 - ((int)sourceBits & 7)) & 7; /* space on source[sourcePos]. */ - int bufferRem = structpointer->bufferBits & 7; /* occupied bits on buffer[bufferPos]. */ - int i; - u32 b, carry; - u8 *buffer = structpointer->buffer; - u8 *bitLength = structpointer->bitLength; - int bufferBits = structpointer->bufferBits; - int bufferPos = structpointer->bufferPos; - - /* - * tally the length of the added data: - */ - u64 value = sourceBits; - for (i = 31, carry = 0; i >= 0 && (carry != 0 || value != LL(0)); i--) { - carry += bitLength[i] + ((u32)value & 0xff); - bitLength[i] = (u8)carry; - carry >>= 8; - value >>= 8; - } - /* - * process data in chunks of 8 bits (a more efficient approach would be to take whole-word chunks): - */ - while (sourceBits > 8) { - /* N.B. at least source[sourcePos] and source[sourcePos+1] contain data. */ - /* - * take a byte from the source: - */ - b = ((source[sourcePos] << sourceGap) & 0xff) | - ((source[sourcePos + 1] & 0xff) >> (8 - sourceGap)); - /* - * process this byte: - */ - buffer[bufferPos++] |= (u8)(b >> bufferRem); - bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ - if (bufferBits == DIGESTBITS) { - /* - * process data block: - */ - processBuffer(structpointer); - /* - * reset buffer: - */ - bufferBits = bufferPos = 0; - } - buffer[bufferPos] = (u8) (b << (8 - bufferRem)); - bufferBits += bufferRem; - /* - * proceed to remaining data: - */ - sourceBits -= 8; - sourcePos++; - } - /* now 0 <= sourceBits <= 8; - * furthermore, all data (if any is left) is in source[sourcePos]. - */ - if (sourceBits > 0) { - b = (source[sourcePos] << sourceGap) & 0xff; /* bits are left-justified on b. */ - /* - * process the remaining bits: - */ - buffer[bufferPos] |= b >> bufferRem; - } else { - b = 0; - } - if (bufferRem + sourceBits < 8) { - /* - * all remaining data fits on buffer[bufferPos], - * and there still remains some space. - */ - bufferBits += sourceBits; - } else { - /* - * buffer[bufferPos] is full: - */ - bufferPos++; - bufferBits += 8 - bufferRem; /* bufferBits = 8*bufferPos; */ - sourceBits -= 8 - bufferRem; - /* now 0 <= sourceBits < 8; - * furthermore, all data (if any is left) is in source[sourcePos]. - */ - if (bufferBits == DIGESTBITS) { - /* - * process data block: - */ - processBuffer(structpointer); - /* - * reset buffer: - */ - bufferBits = bufferPos = 0; - } - buffer[bufferPos] = (u8) (b << (8 - bufferRem)); - bufferBits += (int)sourceBits; - } - structpointer->bufferBits = bufferBits; - structpointer->bufferPos = bufferPos; -} - -/** - * Get the hash value from the hashing state. - * - * This method uses the invariant: bufferBits < DIGESTBITS - */ -void WHIRLPOOL_finalize(struct NESSIEstruct * const structpointer, - unsigned char * const result) { - int i; - u8 *buffer = structpointer->buffer; - u8 *bitLength = structpointer->bitLength; - int bufferBits = structpointer->bufferBits; - int bufferPos = structpointer->bufferPos; - u8 *digest = result; - - /* - * append a '1'-bit: - */ - buffer[bufferPos] |= 0x80U >> (bufferBits & 7); - bufferPos++; /* all remaining bits on the current u8 are set to zero. */ - /* - * pad with zero bits to complete (N*WBLOCKBITS - LENGTHBITS) bits: - */ - if (bufferPos > WBLOCKBYTES - LENGTHBYTES) { - if (bufferPos < WBLOCKBYTES) { - memset(&buffer[bufferPos], 0, WBLOCKBYTES - bufferPos); - } - /* - * process data block: - */ - processBuffer(structpointer); - /* - * reset buffer: - */ - bufferPos = 0; - } - if (bufferPos < WBLOCKBYTES - LENGTHBYTES) { - memset(&buffer[bufferPos], 0, (WBLOCKBYTES - LENGTHBYTES) - bufferPos); - } - bufferPos = WBLOCKBYTES - LENGTHBYTES; - /* - * append bit length of hashed data: - */ - memcpy(&buffer[WBLOCKBYTES - LENGTHBYTES], bitLength, LENGTHBYTES); - /* - * process data block: - */ - processBuffer(structpointer); - /* - * return the completed message digest: - */ - for (i = 0; i < DIGESTBYTES/8; i++) { - digest[0] = (u8)(structpointer->hash[i] >> 56); - digest[1] = (u8)(structpointer->hash[i] >> 48); - digest[2] = (u8)(structpointer->hash[i] >> 40); - digest[3] = (u8)(structpointer->hash[i] >> 32); - digest[4] = (u8)(structpointer->hash[i] >> 24); - digest[5] = (u8)(structpointer->hash[i] >> 16); - digest[6] = (u8)(structpointer->hash[i] >> 8); - digest[7] = (u8)(structpointer->hash[i] ); - digest += 8; - } - structpointer->bufferBits = bufferBits; - structpointer->bufferPos = bufferPos; -} diff --git a/src/utils/crypto/whirlpool.h b/src/utils/crypto/whirlpool.h deleted file mode 100644 index 3a88006de87..00000000000 --- a/src/utils/crypto/whirlpool.h +++ /dev/null @@ -1,150 +0,0 @@ -#ifndef WHIRLPOOL_H -#define WHIRLPOOL_H 1 - -#if defined(__cplusplus) -extern "C" -{ -#endif - -#ifndef PORTABLE_C__ -#define PORTABLE_C__ - -#include -#include - -/* Definition of minimum-width integer types - * - * u8 -> unsigned integer type, at least 8 bits, equivalent to unsigned char - * u16 -> unsigned integer type, at least 16 bits - * u32 -> unsigned integer type, at least 32 bits - * - * s8, s16, s32 -> signed counterparts of u8, u16, u32 - * - * Always use macro's T8(), T16() or T32() to obtain exact-width results, - * i.e., to specify the size of the result of each expression. - */ - -typedef int8_t s8; -typedef uint8_t u8; - -#if UINT_MAX >= 4294967295UL - -typedef int16_t s16; -typedef int32_t s32; -typedef uint16_t u16; -typedef uint32_t u32; - -#define ONE32 0xffffffffU - -#else - -typedef int16_t s16; -typedef int32_t s32; -typedef uint16_t u16; -typedef uint32_t u32; - -#define ONE32 0xffffffffUL - -#endif - -#define ONE8 0xffU -#define ONE16 0xffffU - -#define T8(x) ((x) & ONE8) -#define T16(x) ((x) & ONE16) -#define T32(x) ((x) & ONE32) - -#ifdef _MSC_VER -typedef uint64_t u64; -typedef int64_t s64; -#define LL(v) (v##i64) -#define ONE64 LL(0xffffffffffffffff) -#else /* !_MSC_VER */ -typedef uint64_t u64; -typedef int64_t s64; -#define LL(v) (v##ULL) -#define ONE64 LL(0xffffffffffffffff) -#endif /* ?_MSC_VER */ -#define T64(x) ((x) & ONE64) -#define ROTR64(v, n) (((v) >> (n)) | T64((v) << (64 - (n)))) -/* - * Note: the test is used to detect native 64-bit architectures; - * if the unsigned long is strictly greater than 32-bit, it is - * assumed to be at least 64-bit. This will not work correctly - * on (old) 36-bit architectures (PDP-11 for instance). - * - * On non-64-bit architectures, "long long" is used. - */ - -/* - * U8TO32_BIG(c) returns the 32-bit value stored in big-endian convention - * in the unsigned char array pointed to by c. - */ -#define U8TO32_BIG(c) (((u32)T8(*(c)) << 24) | ((u32)T8(*((c) + 1)) << 16) | ((u32)T8(*((c) + 2)) << 8) | ((u32)T8(*((c) + 3)))) - -/* - * U8TO32_LITTLE(c) returns the 32-bit value stored in little-endian convention - * in the unsigned char array pointed to by c. - */ -#define U8TO32_LITTLE(c) (((u32)T8(*(c))) | ((u32)T8(*((c) + 1)) << 8) | (u32)T8(*((c) + 2)) << 16) | ((u32)T8(*((c) + 3)) << 24)) - -/* - * U8TO32_BIG(c, v) stores the 32-bit-value v in big-endian convention - * into the unsigned char array pointed to by c. - */ -#define U32TO8_BIG(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x >> 24); d[1] = T8(x >> 16); d[2] = T8(x >> 8); d[3] = T8(x); } while (0) - -/* - * U8TO32_LITTLE(c, v) stores the 32-bit-value v in little-endian convention - * into the unsigned char array pointed to by c. - */ -#define U32TO8_LITTLE(c, v) do { u32 x = (v); u8 *d = (c); d[0] = T8(x); d[1] = T8(x >> 8); d[2] = T8(x >> 16); d[3] = T8(x >> 24); } while (0) - -/* - * ROTL32(v, n) returns the value of the 32-bit unsigned value v after - * a rotation of n bits to the left. It might be replaced by the appropriate - * architecture-specific macro. - * - * It evaluates v and n twice. - * - * The compiler might emit a warning if n is the constant 0. The result - * is undefined if n is greater than 31. - */ -#define ROTL32(v, n) (T32((v) << (n)) | ((v) >> (32 - (n)))) - -/* - * Whirlpool-specific definitions. - */ - -#define DIGESTBYTES 64 -#define DIGESTBITS (8*DIGESTBYTES) /* 512 */ - -#define WBLOCKBYTES 64 -#define WBLOCKBITS (8*WBLOCKBYTES) /* 512 */ - -#define LENGTHBYTES 32 -#define LENGTHBITS (8*LENGTHBYTES) /* 256 */ - -typedef struct NESSIEstruct { - u8 bitLength[LENGTHBYTES]; /* global number of hashed bits (256-bit counter) */ - u8 buffer[WBLOCKBYTES]; /* buffer of data to hash */ - int bufferBits; /* current number of bits on the buffer */ - int bufferPos; /* current (possibly incomplete) byte slot on the buffer */ - u64 hash[DIGESTBYTES/8]; /* the hashing state */ -} NESSIEstruct; - -#endif /* PORTABLE_C__ */ - -// ------------- - -typedef NESSIEstruct WHIRLPOOL_CTX; - -void WHIRLPOOL_add(const uint8_t * const source, uint32_t sourceBits, struct NESSIEstruct * const structpointer); -void WHIRLPOOL_finalize(struct NESSIEstruct * const structpointer, uint8_t * const result); -void WHIRLPOOL_init(struct NESSIEstruct * const structpointer); - -#if defined(__cplusplus) -} -#endif - -#endif /* WHIRLPOOL_H */ diff --git a/src/utils/decode.c b/src/utils/decode.c deleted file mode 100644 index a717ab8b6d5..00000000000 --- a/src/utils/decode.c +++ /dev/null @@ -1,465 +0,0 @@ -#include "mds.h" -#include "edc.h" - - -#include "common/crypto.h" -#include "common/endian.h" -#include "common/pkcs5.h" -#include "common/crc.h" - -#include - -#define byte uint8_t -#define uint64 uint64_t - -typedef union { - struct { - uint32_t LowPart; - uint32_t HighPart; - }; - uint64_t Value; -} UINT64_STRUCT; - -void unshuffle1(u8 *data) -{ - u32 val = getEDC(data, 0x40) ^ 0x567372ff; - for(int i = 0; i < 0x40; i += 4) - { - val = (val * 0x35e85a6d) + 0x1548dce9; - u32 ud = getU32(data + i); - setU32(data + i, ud ^ val ^ 0xec564717); - - if (data[i] == 0) - data[i] = 0x5f; - if (data[i+1] == 0) - data[i+1] = 0x5f; - if (data[i+2] == 0) - data[i+2] = 0x5f; - if (data[i+3] == 0) - data[i+3] = 0x5f; - } -} - -void DecryptBlock(u8 *buf, - uint64_t len, - u32 secSz, - u64 secN, - u8 flags, - PCRYPTO_INFO cryptoInfo) -{ - const int blockSize = CipherGetBlockSize( EAGetFirstCipher(cryptoInfo->ea) ); - - u64 blk = 0x200; - if (blockSize <= secSz) - blk = secSz; - - const u64 asz = blk - (blk % blockSize); - if ((flags & 4) == 0) - { - const u32 c = len / blk; - for (int i = 0; i < c; i++) - { - DecryptBuffer(buf + i * blk, asz, asz, secN + i, flags, cryptoInfo); - } - } - else - { - u32 adsz = len - (len % blockSize); - u64 pos = 0; - int i = 0; - while(adsz > 0) - { - u32 bsz = asz; - if (adsz <= asz) - bsz = adsz; - - DecryptBuffer(buf + pos, bsz, adsz, secN + i, flags, cryptoInfo); - - pos += bsz; - adsz -= bsz; - i++; - } - } -} - - - -// From volumes.c + modifies - -#define HEADER_OFFSET_CRC 64 -#define HEADER_OFFSET_MAGIC 68 -#define HEADER_OFFSET_DATA 80 -#define HEADER_DATA_SIZE 0x100 -#define HEADER_OFFSET_DATASZ 74 - - -uint16 GetHeaderField16 (byte *header, size_t offset) -{ - /* modify BE->LE */ - return LE16 (*(uint16 *) (header + offset)); -} - - -uint32 GetHeaderField32 (byte *header, size_t offset) -{ - /* modify BE->LE */ - return LE32 (*(uint32 *) (header + offset)); -} - - -UINT64_STRUCT GetHeaderField64 (byte *header, size_t offset) -{ - /* modify BE->LE */ - UINT64_STRUCT uint64Struct; - - uint64Struct.Value = LE64 (*(uint64 *) (header + offset)); - return uint64Struct; -} - - -int ReadHeader (int bBoot, char *encryptedHeader, Password *password, PCRYPTO_INFO *retInfo, CRYPTO_INFO *retHeaderCryptoInfo) -{ - char header[HEADER_SIZE]; - KEY_INFO keyInfo; - PCRYPTO_INFO cryptoInfo; - char dk[MASTER_KEYDATA_SIZE]; - int pkcs5_prf; - int status; - int primaryKeyOffset; - - - if (retHeaderCryptoInfo != NULL) - { - cryptoInfo = retHeaderCryptoInfo; - } - else - { - cryptoInfo = *retInfo = crypto_open (); - if (cryptoInfo == NULL) - return ERR_OUTOFMEMORY; - } - - crypto_loadkey (&keyInfo, (char *) password->Text, (int) password->Length); - - // PKCS5 is used to derive the primary header key(s) and secondary header key(s) (XTS mode) from the password - memcpy (keyInfo.salt, encryptedHeader + HEADER_SALT_OFFSET, PKCS5_SALT_SIZE); - - memset(dk, 0, sizeof(dk)); - - // Use this legacy incorrect(for XTS) size, because Daemon Tools use it in this way - // seems DTools manual upgrade their pre-TrueCrypt5.0 sources - int keysize = EAGetLargestKey() + LEGACY_VOL_IV_SIZE; - - // Test only rp160/sha1/whirlpool only - for (pkcs5_prf = FIRST_PRF_ID; pkcs5_prf <= WHIRLPOOL; pkcs5_prf++) - { - int lrw64InitDone = 0; // Deprecated/legacy - int lrw128InitDone = 0; // Deprecated/legacy - - keyInfo.noIterations = get_pkcs5_iteration_count (pkcs5_prf, bBoot); - - switch (pkcs5_prf) - { - case RIPEMD160: - derive_key_ripemd160 ((char *) keyInfo.userKey, keyInfo.keyLength, (char *) keyInfo.salt, - PKCS5_SALT_SIZE, keyInfo.noIterations, dk, keysize); - break; - - case SHA1: - // Deprecated/legacy - derive_key_sha1 ((char *) keyInfo.userKey, keyInfo.keyLength, (char *) keyInfo.salt, - PKCS5_SALT_SIZE, keyInfo.noIterations, dk, keysize); - break; - - case WHIRLPOOL: - derive_key_whirlpool ((char *) keyInfo.userKey, keyInfo.keyLength, (char *) keyInfo.salt, - PKCS5_SALT_SIZE, keyInfo.noIterations, dk, keysize); - break; - - default: - // Unknown/wrong ID - fatal("ReadHeader(): Unknown/wrong ID\n"); - } - - // Test all available modes of operation - for (cryptoInfo->mode = FIRST_MODE_OF_OPERATION_ID; - cryptoInfo->mode <= LAST_MODE_OF_OPERATION; - cryptoInfo->mode++) - { - switch (cryptoInfo->mode) - { - case LRW: - case CBC: - case INNER_CBC: - case OUTER_CBC: - - // For LRW (deprecated/legacy), copy the tweak key - // For CBC (deprecated/legacy), copy the IV/whitening seed - memcpy (cryptoInfo->k2, dk, LEGACY_VOL_IV_SIZE); - primaryKeyOffset = LEGACY_VOL_IV_SIZE; - break; - - default: - primaryKeyOffset = 0; - } - - // Test all available encryption algorithms - for (cryptoInfo->ea = EAGetFirst (); - cryptoInfo->ea != 0; - cryptoInfo->ea = EAGetNext (cryptoInfo->ea)) - { - int blockSize; - - if (!EAIsModeSupported (cryptoInfo->ea, cryptoInfo->mode)) - continue; // This encryption algorithm has never been available with this mode of operation - - blockSize = CipherGetBlockSize (EAGetFirstCipher (cryptoInfo->ea)); - - status = EAInit (cryptoInfo->ea, (unsigned char *) (dk + primaryKeyOffset), cryptoInfo->ks); - if (status == ERR_CIPHER_INIT_FAILURE) - goto err; - - // Init objects related to the mode of operation - - if (cryptoInfo->mode == XTS) - { - // Copy the secondary key (if cascade, multiple concatenated) - memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea)); - - // Secondary key schedule - if (!EAInitMode (cryptoInfo)) - { - status = ERR_MODE_INIT_FAILED; - goto err; - } - } - else if (cryptoInfo->mode == LRW - && ((blockSize == 8 && !lrw64InitDone) || (blockSize == 16 && !lrw128InitDone))) - { - // Deprecated/legacy - - if (!EAInitMode (cryptoInfo)) - { - status = ERR_MODE_INIT_FAILED; - goto err; - } - - if (blockSize == 8) - lrw64InitDone = 1; - else if (blockSize == 16) - lrw128InitDone = 1; - } - - // Copy the header for decryption - memcpy (header, encryptedHeader, HEADER_SIZE); - - // Try to decrypt header - DecryptBlock((unsigned char *) (header + HEADER_ENCRYPTED_DATA_OFFSET), HEADER_ENCRYPTED_DATA_SIZE, HEADER_SIZE, 0, 4, cryptoInfo); - - // Magic 'TRUE' - if (GetHeaderField32 ((unsigned char *) header, HEADER_OFFSET_MAGIC) != 0x54525545) - continue; - - uint32_t crc = GetHeaderField32 ((unsigned char *) header, HEADER_OFFSET_CRC); - if (crc != GetCrc32 ((unsigned char *) ((unsigned char *) (header + HEADER_OFFSET_DATA)), HEADER_DATA_SIZE) ) - continue; - - if ( GetHeaderField16((unsigned char *) header, HEADER_OFFSET_DATASZ) > 0x100 ) - continue; - - - memcpy(dk, header + HEADER_OFFSET_DATA, HEADER_DATA_SIZE); - - memcpy(encryptedHeader, header, 0x200); - - switch (cryptoInfo->mode) - { - case LRW: - case CBC: - case INNER_CBC: - case OUTER_CBC: - - // For LRW (deprecated/legacy), copy the tweak key - // For CBC (deprecated/legacy), copy the IV/whitening seed - memcpy (cryptoInfo->k2, dk, LEGACY_VOL_IV_SIZE); - primaryKeyOffset = LEGACY_VOL_IV_SIZE; - break; - - default: - primaryKeyOffset = 0; - } - - if (EAInit (cryptoInfo->ea, (unsigned char *) (dk + primaryKeyOffset), cryptoInfo->ks) != 0 ) - { - status = ERR_MODE_INIT_FAILED; - goto err; - } - - if (cryptoInfo->mode == XTS) - memcpy (cryptoInfo->k2, dk + EAGetKeySize (cryptoInfo->ea), EAGetKeySize (cryptoInfo->ea)); - - if (!EAInitMode (cryptoInfo)) - { - status = ERR_MODE_INIT_FAILED; - goto err; - } - - // Clear out the temporary key buffers -// ret: - memset (dk, 0x00, sizeof(dk)); - memset (&keyInfo, 0x00, sizeof (keyInfo)); - - return 0; - } - } - } - status = ERR_PASSWORD_WRONG; - -err: - if (cryptoInfo != retHeaderCryptoInfo) - { - crypto_close(cryptoInfo); - *retInfo = NULL; - } - - memset (&keyInfo, 0x00, sizeof (keyInfo)); - memset (dk, 0x00, sizeof(dk)); - return status; -} - - - -int decode1(u8 *data, const char *pass, PCRYPTO_INFO *ci) -{ - u32 passlen = 0; - u8 unsh[0x101]; - memset(unsh, 0, 0x101); - if (!pass) - { - memcpy(unsh, data, 0x40); - unshuffle1(unsh); - passlen = 0x40; - } - else - { - passlen = strlen(pass); - if (passlen > 0x40) - passlen = 0x40; - memcpy(unsh, pass, passlen); - } - - Password pwd; - pwd.Length = passlen; - memcpy(pwd.Text, unsh, passlen); - - return ReadHeader(0, (char *) data, &pwd, ci, NULL); -} - - - -void decryptMode2(Decoder *ctx, u8 *buffer, u32 length, u64 blockIndex) -{ - u8 *p = buffer; - u8 i[8]; - u8 t[16]; - u64 b; - - *(u64 *)i = BE64(blockIndex); - - for (b = 0; b < length >> 4; b++) - { - Gf128MulBy64Tab (i, t, &ctx->gf_ctx); - Xor128 ((u64 *)p, (u64 *)t); - - aes_decrypt (p, p, &ctx->decr); - - Xor128 ((u64 *)p, (u64 *)t); - - p += 16; - - if (i[7] != 0xff) - i[7]++; - else - *(u64 *)i = BE64 ( BE64(*(u64 *)i) + 1 ); - } -} - - -void MdxDecryptBufferCBC (Decoder *ctx, u32 *data, unsigned int len, u32 *iv, u32 *whitening) -{ - u32 bufIV[4]; - u64 i; - u32 ct[4]; - - // IV - bufIV[0] = iv[0]; - bufIV[1] = iv[1]; - bufIV[2] = iv[2]; - bufIV[3] = iv[3]; - - // Decrypt each block - for (i = 0; i < len/16; i++) - { - // Dewhitening - if (whitening) - { - data[0] ^= whitening[0]; - data[1] ^= whitening[1]; - data[2] ^= whitening[0]; - data[3] ^= whitening[1]; - - //CBC - ct[0] = data[0]; - ct[1] = data[1]; - ct[2] = data[2]; - ct[3] = data[3]; - } - - aes_decrypt((u8 *)data, (u8 *)data, &ctx->decr); - - // CBC - data[0] ^= bufIV[0]; - data[1] ^= bufIV[1]; - data[2] ^= bufIV[2]; - data[3] ^= bufIV[3]; - - if (whitening) - { - bufIV[0] = ct[0]; - bufIV[1] = ct[1]; - bufIV[2] = ct[2]; - bufIV[3] = ct[3]; - } - - data += 4; - } -} - -void decryptMdxData(Decoder *ctx, u8 *buffer, u32 length, u64 blockSize, u64 blockIndex) -{ - if (ctx->mode == 1) - { - if (ctx->ctr) - { - u32 sectorIV[4]; - u32 secWhitening[4]; - InitSectorIVAndWhitening (blockIndex, 16, sectorIV, (u64 *)(ctx->dg + 16), secWhitening); - MdxDecryptBufferCBC (ctx, (u32 *)buffer, length, sectorIV, secWhitening); - } - else - { - MdxDecryptBufferCBC (ctx, (u32 *)buffer, length, (u32 *)ctx->dg, (u32 *)(ctx->dg + 8)); - } - } - else if (ctx->mode == 2) - { - if (ctx->ctr) - decryptMode2(ctx, buffer, length, 1 + (blockSize / 16) * blockIndex); - else - decryptMode2(ctx, buffer, length, 1); - } - else - { - MdxDecryptBufferCBC (ctx, (u32 *)buffer, length, (u32 *)ctx->dg, NULL); - } -} diff --git a/src/utils/edc.c b/src/utils/edc.c deleted file mode 100644 index c21ef9e22cb..00000000000 --- a/src/utils/edc.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "defines.h" - -u32 EDC_crctable[256] = { - 0x0, 0x90910101, 0x91210201, 0x1B00300, -0x92410401, 0x2D00500, 0x3600600, 0x93F10701, -0x94810801, 0x4100900, 0x5A00A00, 0x95310B01, -0x6C00C00, 0x96510D01, 0x97E10E01, 0x7700F00, -0x99011001, 0x9901100, 0x8201200, 0x98B11301, -0xB401400, 0x9BD11501, 0x9A611601, 0xAF01700, -0xD801800, 0x9D111901, 0x9CA11A01, 0xC301B00, -0x9FC11C01, 0xF501D00, 0xEE01E00, 0x9E711F01, -0x82012001, 0x12902100, 0x13202200, 0x83B12301, -0x10402400, 0x80D12501, 0x81612601, 0x11F02700, -0x16802800, 0x86112901, 0x87A12A01, 0x17302B00, -0x84C12C01, 0x14502D00, 0x15E02E00, 0x85712F01, -0x1B003000, 0x8B913101, 0x8A213201, 0x1AB03300, -0x89413401, 0x19D03500, 0x18603600, 0x88F13701, -0x8F813801, 0x1F103900, 0x1EA03A00, 0x8E313B01, -0x1DC03C00, 0x8D513D01, 0x8CE13E01, 0x1C703F00, -0xB4014001, 0x24904100, 0x25204200, 0xB5B14301, -0x26404400, 0xB6D14501, 0xB7614601, 0x27F04700, -0x20804800, 0xB0114901, 0xB1A14A01, 0x21304B00, -0xB2C14C01, 0x22504D00, 0x23E04E00, 0xB3714F01, -0x2D005000, 0xBD915101, 0xBC215201, 0x2CB05300, -0xBF415401, 0x2FD05500, 0x2E605600, 0xBEF15701, -0xB9815801, 0x29105900, 0x28A05A00, 0xB8315B01, -0x2BC05C00, 0xBB515D01, 0xBAE15E01, 0x2A705F00, -0x36006000, 0xA6916101, 0xA7216201, 0x37B06300, -0xA4416401, 0x34D06500, 0x35606600, 0xA5F16701, -0xA2816801, 0x32106900, 0x33A06A00, 0xA3316B01, -0x30C06C00, 0xA0516D01, 0xA1E16E01, 0x31706F00, -0xAF017001, 0x3F907100, 0x3E207200, 0xAEB17301, -0x3D407400, 0xADD17501, 0xAC617601, 0x3CF07700, -0x3B807800, 0xAB117901, 0xAAA17A01, 0x3A307B00, -0xA9C17C01, 0x39507D00, 0x38E07E00, 0xA8717F01, -0xD8018001, 0x48908100, 0x49208200, 0xD9B18301, -0x4A408400, 0xDAD18501, 0xDB618601, 0x4BF08700, -0x4C808800, 0xDC118901, 0xDDA18A01, 0x4D308B00, -0xDEC18C01, 0x4E508D00, 0x4FE08E00, 0xDF718F01, -0x41009000, 0xD1919101, 0xD0219201, 0x40B09300, -0xD3419401, 0x43D09500, 0x42609600, 0xD2F19701, -0xD5819801, 0x45109900, 0x44A09A00, 0xD4319B01, -0x47C09C00, 0xD7519D01, 0xD6E19E01, 0x46709F00, -0x5A00A000, 0xCA91A101, 0xCB21A201, 0x5BB0A300, -0xC841A401, 0x58D0A500, 0x5960A600, 0xC9F1A701, -0xCE81A801, 0x5E10A900, 0x5FA0AA00, 0xCF31AB01, -0x5CC0AC00, 0xCC51AD01, 0xCDE1AE01, 0x5D70AF00, -0xC301B001, 0x5390B100, 0x5220B200, 0xC2B1B301, -0x5140B400, 0xC1D1B501, 0xC061B601, 0x50F0B700, -0x5780B800, 0xC711B901, 0xC6A1BA01, 0x5630BB00, -0xC5C1BC01, 0x5550BD00, 0x54E0BE00, 0xC471BF01, -0x6C00C000, 0xFC91C101, 0xFD21C201, 0x6DB0C300, -0xFE41C401, 0x6ED0C500, 0x6F60C600, 0xFFF1C701, -0xF881C801, 0x6810C900, 0x69A0CA00, 0xF931CB01, -0x6AC0CC00, 0xFA51CD01, 0xFBE1CE01, 0x6B70CF00, -0xF501D001, 0x6590D100, 0x6420D200, 0xF4B1D301, -0x6740D400, 0xF7D1D501, 0xF661D601, 0x66F0D700, -0x6180D800, 0xF111D901, 0xF0A1DA01, 0x6030DB00, -0xF3C1DC01, 0x6350DD00, 0x62E0DE00, 0xF271DF01, -0xEE01E001, 0x7E90E100, 0x7F20E200, 0xEFB1E301, -0x7C40E400, 0xECD1E501, 0xED61E601, 0x7DF0E700, -0x7A80E800, 0xEA11E901, 0xEBA1EA01, 0x7B30EB00, -0xE8C1EC01, 0x7850ED00, 0x79E0EE00, 0xE971EF01, -0x7700F000, 0xE791F101, 0xE621F201, 0x76B0F300, -0xE541F401, 0x75D0F500, 0x7460F600, 0xE4F1F701, -0xE381F801, 0x7310F900, 0x72A0FA00, 0xE231FB01, -0x71C0FC00, 0xE151FD01, 0xE0E1FE01, 0x7070FF00 }; - - -u32 getEDC(void *data, u32 num) -{ - u8 *d = (u8 *)data; - u32 result = 0; - for(u32 i = 0; i < num; i++) { - result = EDC_crctable[ (result ^ d[i]) & 0xff ] ^ (result >> 8); - } - return result; -} diff --git a/src/utils/edc.h b/src/utils/edc.h deleted file mode 100644 index dd6639bc80a..00000000000 --- a/src/utils/edc.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef EDC_H -#define EDC_H - -#include "defines.h" - -u32 getEDC(void *data, u32 num); - -#endif diff --git a/src/utils/mds.h b/src/utils/mds.h index 0eba0bfe905..eb1a0beb77f 100644 --- a/src/utils/mds.h +++ b/src/utils/mds.h @@ -1,13 +1,90 @@ #ifndef MDS_H #define MDS_H -#include -#include #include +#include #include #include "defines.h" -#include "common/crypto.h" +// #include "common/crypto.h" + +#if defined( AES_VAR ) || defined( AES_256 ) +#define KS_LENGTH 60 +#elif defined( AES_192 ) +#define KS_LENGTH 52 +#else +#define KS_LENGTH 44 +#endif + +#define AES_RETURN int +#define TC_LARGEST_COMPILER_UINT uint64_t + +#define u16 uint16_t + +typedef union +{ + uint32_t l; + uint8_t b[4]; +} aes_inf; + +typedef struct +{ + uint32_t ks[KS_LENGTH]; + aes_inf inf; +} aes_encrypt_ctx; + +typedef struct +{ + uint32_t ks[KS_LENGTH]; + aes_inf inf; +} aes_decrypt_ctx; + +#ifndef u4byte +#define u4byte uint32_t +#endif + +typedef struct +{ + u4byte l_key[40]; + u4byte s_key[4]; +#if !defined (TC_MINIMIZE_CODE_SIZE) || defined (TC_WINDOWS_BOOT_TWOFISH) + u4byte mk_tab[4 * 256]; +#endif + u4byte k_len; +} TwofishInstance; + +#define AES_KS (sizeof(aes_encrypt_ctx) + sizeof(aes_decrypt_ctx)) +#define SERPENT_KS (140 * 4) +#define TWOFISH_KS sizeof(TwofishInstance) +#define MAX_EXPANDED_KEY (AES_KS + SERPENT_KS + TWOFISH_KS) +#define MASTER_KEYDATA_SIZE 256 +#define PKCS5_SALT_SIZE 64 +/* Encryption block length */ +#define CBLK_LEN 16 +#define CBLK_LEN8 8 + +typedef struct +{ + /* Union not used to support faster mounting */ + uint32_t gf_t128[CBLK_LEN * 2 / 2][16][CBLK_LEN / 4]; + uint32_t gf_t64[CBLK_LEN8 * 2][16][CBLK_LEN8 / 4]; +} GfCtx; + +typedef struct CRYPTO_INFO_t +{ + int ea; + int mode; + uint8_t ks[MAX_EXPANDED_KEY]; + uint8_t ks2[MAX_EXPANDED_KEY]; + + GfCtx gf_ctx; + + uint8_t master_keydata[MASTER_KEYDATA_SIZE]; + uint8_t k2[MASTER_KEYDATA_SIZE]; + uint8_t salt[PKCS5_SALT_SIZE]; + int noIterations; + int pkcs5; +} CRYPTO_INFO, *PCRYPTO_INFO; typedef struct Decoder_t { @@ -21,6 +98,8 @@ typedef struct Decoder_t int ctr; } Decoder; + + enum TRACK_TYPE { TRK_T_MAINTENANCE = 0, @@ -139,11 +218,29 @@ typedef struct __attribute__((packed)) // decode.c -void DecryptBlock(u8 *buf, uint64_t len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); +#if 0 +void DecryptBlock(u8 *buf, TC_LARGEST_COMPILER_UINT len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); int decode1(u8 *data, const char *pass, PCRYPTO_INFO *ci); void decryptMdxData(Decoder *ctx, u8 *buffer, u32 length, u64 blockSize, u64 blockIndex); +#else +#ifdef _WIN32 +# define MDSXDLLAPI __stdcall +#else +# define MDSXDLLAPI +#endif + +extern void(MDSXDLLAPI *DecryptBlock)(u8 *buf, TC_LARGEST_COMPILER_UINT len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); +extern int(MDSXDLLAPI *decode1)(u8 *data, const char *pass, PCRYPTO_INFO *ci); +extern void(MDSXDLLAPI *decryptMdxData)(Decoder *ctx, u8 *buffer, u32 length, u64 blockSize, u64 blockIndex); +extern int(MDSXDLLAPI *Gf128Tab64Init)(uint8_t *a, GfCtx *ctx); +extern AES_RETURN(MDSXDLLAPI *aes_encrypt_key)(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]); +extern AES_RETURN(MDSXDLLAPI *aes_decrypt_key)(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]); + +extern void mdsx_close(void); +extern int mdsx_init(void); +#endif // utils.c diff --git a/src/utils/mdsx_dll.c b/src/utils/mdsx_dll.c new file mode 100644 index 00000000000..87beff441ca --- /dev/null +++ b/src/utils/mdsx_dll.c @@ -0,0 +1,90 @@ +/* + * 86Box A hypervisor and IBM PC system emulator that specializes in + * running old operating systems and software designed for IBM + * PC systems and compatibles from 1981 through fairly recent + * system designs based on the PCI bus. + * + * This file is part of the 86Box distribution. + * + * Implementation of a generic PostScript printer and a + * generic PCL 5e printer. + * + * Authors: David Hrdlička, + * Cacodemon345 + * + * Copyright 2019 David Hrdlička. + * Copyright 2024 Cacodemon345. + */ +#include +#include +#include +#include +#include +#include +#include +#include <86box/86box.h> +#include <86box/device.h> +#include <86box/timer.h> +#include <86box/device.h> +#include <86box/lpt.h> +#include <86box/pit.h> +#include <86box/path.h> +#include <86box/plat.h> +#include <86box/plat_dynld.h> +#include <86box/ui.h> +#include <86box/prt_devs.h> +#include "cpu.h" +#include "defines.h" +#include "mds.h" + +#ifdef _WIN32 +# define PATH_MDSX_DLL "mdsx.dll" +#elif defined __APPLE__ +# define PATH_MDSX_DLL "mdsx.dylib" +#else +# define PATH_MDSX_DLL "mdsx.so" +#endif + +void(MDSXDLLAPI *DecryptBlock)(u8 *buf, TC_LARGEST_COMPILER_UINT len, u32 secSz, u64 secN, u8 flags, PCRYPTO_INFO cryptoInfo); +int(MDSXDLLAPI *decode1)(u8 *data, const char *pass, PCRYPTO_INFO *ci); +void(MDSXDLLAPI *decryptMdxData)(Decoder *ctx, u8 *buffer, u32 length, u64 blockSize, u64 blockIndex); +int(MDSXDLLAPI *Gf128Tab64Init)(uint8_t *a, GfCtx *ctx); +AES_RETURN(MDSXDLLAPI *aes_encrypt_key)(const unsigned char *key, int key_len, aes_encrypt_ctx cx[1]); +AES_RETURN(MDSXDLLAPI *aes_decrypt_key)(const unsigned char *key, int key_len, aes_decrypt_ctx cx[1]); + +static dllimp_t mdsx_imports[] = { + // clang-format off + { "DecryptBlock", &DecryptBlock }, + { "decode1", &decode1 }, + { "decryptMdxData", &decryptMdxData }, + { "Gf128Tab64Init", &Gf128Tab64Init }, + { "aes_encrypt_key", &aes_encrypt_key }, + { "aes_decrypt_key", &aes_decrypt_key }, + { NULL, NULL } + // clang-format on +}; + +static void *mdsx_handle = NULL; + +void +mdsx_close(void) +{ + if (mdsx_handle != NULL) { + dynld_close(mdsx_handle); + mdsx_handle = NULL; + } +} + +int +mdsx_init(void) +{ + /* Try loading the DLL. */ + mdsx_handle = dynld_module(PATH_MDSX_DLL, mdsx_imports); + + if (mdsx_handle == NULL) { + warning("Unable to load %s\n", PATH_MDSX_DLL); + return 0; + } + + return 1; +} diff --git a/src/utils/utils.c b/src/utils/utils.c deleted file mode 100644 index e2bc6647320..00000000000 --- a/src/utils/utils.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "mds.h" - -u32 freadU32(FILE *f) -{ - u8 val[4] = {0, 0, 0, 0}; - fread(val, 4, 1, f); - return getU32(val); -} - -u64 freadU64(FILE *f) -{ - u8 val[8] = {0, 0, 0, 0, 0, 0, 0, 0}; - fread(val, 8, 1, f); - return getU64(val); -} - -void printHex(void *data, int num) -{ - u8 *m = (u8 *)data; - while(num > 0) - { - printf("%02x", *m); - m++; - num--; - } - printf("\n"); -} From 045cb18340dfad9a1f034b0d9b8cdc565c178861 Mon Sep 17 00:00:00 2001 From: BlueRain-debug Date: Sun, 18 Jan 2026 13:52:51 +0000 Subject: [PATCH 318/320] Translated using Weblate (Chinese (Simplified Han script)) Currently translated at 100.0% (1004 of 1004 strings) Translation: 86Box/86Box Translate-URL: https://weblate.86box.net/projects/86box/86box/zh_Hans/ --- src/qt/languages/zh-CN.po | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/qt/languages/zh-CN.po b/src/qt/languages/zh-CN.po index 855bb72e86c..a960d8b2d35 100644 --- a/src/qt/languages/zh-CN.po +++ b/src/qt/languages/zh-CN.po @@ -1,8 +1,15 @@ msgid "" msgstr "" +"PO-Revision-Date: 2026-01-18 19:18+0000\n" +"Last-Translator: BlueRain-debug \n" +"Language-Team: Chinese (Simplified Han script) \n" +"Language: zh-CN\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=1; plural=0;\n" +"X-Generator: Weblate 5.12.2\n" "X-Language: zh_CN\n" "X-Source-Language: en_US\n" @@ -3016,4 +3023,4 @@ msgid "Fast forward" msgstr "快进" msgid "To change the system directory, stop all running machines." -msgstr "" +msgstr "请在变更系统目录前关闭所有正在运行的虚拟机。" From cf369525de256397120cd1b8e1a5fbfef6886b03 Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 19 Jan 2026 18:00:07 +0100 Subject: [PATCH 319/320] MDS v2/MDSX: Fix loading such images and remove excess logging. --- src/cdrom/cdrom_image.c | 178 ++++++++++++++++++++++++++-------------- 1 file changed, 118 insertions(+), 60 deletions(-) diff --git a/src/cdrom/cdrom_image.c b/src/cdrom/cdrom_image.c index 252eca52612..fdde472515d 100644 --- a/src/cdrom/cdrom_image.c +++ b/src/cdrom/cdrom_image.c @@ -19,7 +19,6 @@ #define __STDC_FORMAT_MACROS #include #include -#define ENABLE_IMAGE_LOG 1 #ifdef ENABLE_IMAGE_LOG #include #endif @@ -44,6 +43,12 @@ #include +#ifdef ENABLE_IMAGE_LOG +#define LOG_VAR(a) size_t a = +#else +#define LOG_VAR(a) +#endif + #define NO_CHIPHER_IDS_ENUM #include "../utils/mds.h" @@ -214,7 +219,13 @@ typedef struct uint64_t start_offs; uint32_t files_num; uint32_t footer_offs; - uint8_t pad1[24]; + union { + uint8_t pad1[24]; + struct { + uint64_t start_sect_v2; + uint8_t pad2[16]; + }; + }; } mds_trk_block_t; /* 80 bytes */ /* @@ -1986,7 +1997,7 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) return 0; } - pclog("mds_decrypt_track_data(): Decrypting MDS...\n"); + image_log(img->log, "mds_decrypt_track_data(): Decrypting MDS...\n"); /* If we are here, them we have already determined in image_load_mds() that the version is 2.x. @@ -1995,18 +2006,18 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) uint64_t offset = 0ULL; fread(&offset, 1, 4, *fp); - pclog("mds_decrypt_track_data(): Offset is %016" PRIX64 "\n", offset); + image_log(img->log, "mds_decrypt_track_data(): Offset is %016" PRIX64 "\n", offset); if (offset == 0xffffffff) { - pclog("mds_decrypt_track_data(): File is MDX\n"); + image_log(img->log, "mds_decrypt_track_data(): File is MDX\n"); is_mdx = 1; fread(&mdx_offset, 1, 8, *fp); fread(&mdx_size_1, 1, 8, *fp); - pclog("mds_decrypt_track_data(): MDX footer is %" PRIi64 " bytes at offset %016" PRIX64 "\n", mdx_size_1, mdx_offset); + image_log(img->log, "mds_decrypt_track_data(): MDX footer is %" PRIi64 " bytes at offset %016" PRIX64 "\n", mdx_size_1, mdx_offset); offset = mdx_offset + (mdx_size_1 - 0x40); - pclog("mds_decrypt_track_data(): MDX offset is %016" PRIX64 "\n", offset); + image_log(img->log, "mds_decrypt_track_data(): MDX offset is %016" PRIX64 "\n", offset); } fseek(*fp, offset, SEEK_SET); @@ -2014,19 +2025,19 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) uint8_t data1[0x200]; fread(data1, 0x200, 1, *fp); - pclog("mds_decrypt_track_data(): Read the first data buffer\n"); + image_log(img->log, "mds_decrypt_track_data(): Read the first data buffer\n"); PCRYPTO_INFO ci; decode1(data1, NULL, &ci); - printf("data1: %02X %02X %02X %02X\n", data1[0], data1[1], data1[2], data1[3]); + image_log(img->log, "data1: %02X %02X %02X %02X\n", data1[0], data1[1], data1[2], data1[3]); FILE *d1f = fopen("data1.tmp", "wb"); fwrite(data1, 1, 0x200, d1f); fclose(d1f); - pclog("mds_decrypt_track_data(): Decoded the first data buffer\n"); + image_log(img->log, "mds_decrypt_track_data(): Decoded the first data buffer\n"); /* Compressed size at 0x150? */ uint32_t decSize = getU32(data1 + 0x154); /* Decompressed size? */ - pclog("mds_decrypt_track_data(): Decompressed size is %i bytes\n", decSize); + image_log(img->log, "mds_decrypt_track_data(): Decompressed size is %i bytes\n", decSize); uint64_t data2Offset = 0x30; /* For MDS v2. */ uint64_t data2Size = offset - 0x30; /* For MDS v2. */ @@ -2035,16 +2046,16 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) data2Offset = mdx_offset; data2Size = mdx_size_1 - 0x40; } - pclog("mds_decrypt_track_data(): Second data buffer is %" PRIi64 " bytes at offset %016" PRIX64 "\n", data2Size, data2Offset); + image_log(img->log, "mds_decrypt_track_data(): Second data buffer is %" PRIi64 " bytes at offset %016" PRIX64 "\n", data2Size, data2Offset); fseek(*fp, data2Offset, SEEK_SET); u8 *data2 = (u8 *)malloc(data2Size); fread(data2, 1, data2Size, *fp); - pclog("mds_decrypt_track_data(): Read the second data buffer\n"); + image_log(img->log, "mds_decrypt_track_data(): Read the second data buffer\n"); DecryptBlock(data2, data2Size, 0, 0, 4, ci); - pclog("mds_decrypt_track_data(): Decoded the second data buffer\n"); + image_log(img->log, "mds_decrypt_track_data(): Decoded the second data buffer\n"); u8 *mdxHeader = (u8 *)malloc(decSize + 0x12); @@ -2078,25 +2089,29 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) u32 keyBlockOff = getU32(mdxHeader + offsetof(MDX_Header, encryption_block_offset)); if (keyBlockOff) { - pclog("Encryption detected\n"); + image_log(img->log, "Encryption detected\n"); const char *password = NULL; - pclog("Trying without password\n"); + image_log(img->log, "Trying without password\n"); PCRYPTO_INFO ci2; +#ifdef ENABLE_IMAGE_LOG if (decode1(mdxHeader + keyBlockOff, password, &ci2) == 0) { if (password) - pclog("Password \"%s\": OK\n", password); + image_log(img->log, "Password \"%s\": OK\n", password); else - pclog("It's encrypted with NULL password. OK!\n"); + image_log(img->log, "It's encrypted with NULL password. OK!\n"); } else { if (password) - pclog("Password \"%s\": WRONG\n", password); + image_log(img->log, "Password \"%s\": WRONG\n", password); else - pclog("Please specify password. Seems it's necessery.\n"); + image_log(img->log, "Please specify password. Seems it's necessery.\n"); - pclog("But we save header_not_decrypted.out with encrypted key block\n"); + image_log(img->log, "But we save header_not_decrypted.out with encrypted key block\n"); +#else + if (decode1(mdxHeader + keyBlockOff, password, &ci2) != 0) { +#endif #if 0 FILE *b = fopen("header_not_decrypted.out", "wb"); @@ -2127,15 +2142,15 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) aes_encrypt_key(keyblock + 0x70, encryptInfo.bsize, &encryptInfo.encr); aes_decrypt_key(keyblock + 0x70, encryptInfo.bsize, &encryptInfo.decr); } else - pclog("No encryption detected\n"); + image_log(img->log, "No encryption detected\n"); fclose(*fp); *fp = NULL; /* Dump mdxHeader */ - pclog("\nDumping header into header.out... "); - plat_tempfile(temp_file, "mds_v2", ".tmp"); + image_log(img->log, "\nDumping header into %s... ", nvr_path(temp_file)); + *fp = plat_fopen64(nvr_path(temp_file), "wb"); fwrite(mdxHeader, 1, decSize + 0x12, *fp); fclose(*fp); @@ -2145,7 +2160,7 @@ mds_decrypt_track_data(cd_image_t *img, const char *mdsfile, FILE **fp) *fp = plat_fopen64(nvr_path(temp_file), "rb"); - pclog("Done\n"); + image_log(img->log, "Done\n"); return isDVD + 1; } @@ -2213,9 +2228,9 @@ image_load_mds(cd_image_t *img, const char *mdsfile) int mdsx = mdsx_init(); if (!mdsx) { #ifdef ENABLE_IMAGE_LOG - log_warning(img->log, " [MDS ] Error initializing dynamic library\n"); + log_warning(img->log, " [MDS ] Error initializing dynamic library %s\n", mdsfile); #else - warning("Error initializing dynamic library\n", mdsfile); + warning("Error initializing dynamic library %s\n", mdsfile); #endif if (fp != NULL) fclose(fp); @@ -2239,8 +2254,15 @@ image_load_mds(cd_image_t *img, const char *mdsfile) if (fp != NULL) fclose(fp); return 0; - } else + } else { img->is_dvd = ret - 1; + version = 2; + + fseek(fp, 0, SEEK_SET); + if (fread(&mds_hdr, 1, sizeof(mds_hdr_t), fp) != sizeof(mds_hdr_t)) + return 0; + } + image_log(img->log, "ret = %i\n", ret); } else img->is_dvd = (mds_hdr.medium_type >= 0x10); @@ -2288,17 +2310,23 @@ image_load_mds(cd_image_t *img, const char *mdsfile) if (mds_hdr.dpm_blocks_offs != 0x00) { fseek(fp, mds_hdr.dpm_blocks_offs, SEEK_SET); - if (fread(&mds_dpm_blocks_num, 1, sizeof(uint32_t), fp) != sizeof(uint32_t)) + if (LOG_VAR(dbnret) fread(&mds_dpm_blocks_num, 1, sizeof(uint32_t), fp) != sizeof(uint32_t)) { + image_log(img->log, "dbnret = %i (expected: %i)\n", (int) dbnret, (int) sizeof(uint32_t)); return 0; + } if (mds_dpm_blocks_num > 0) for (int b = 0; b < mds_dpm_blocks_num; b++) { fseek(fp, mds_hdr.dpm_blocks_offs + 4 + (b * 4), SEEK_SET); - if (fread(&mds_dpm_block_offs, 1, sizeof(uint32_t), fp) != sizeof(uint32_t)) + if (LOG_VAR(dboret) fread(&mds_dpm_block_offs, 1, sizeof(uint32_t), fp) != sizeof(uint32_t)) { + image_log(img->log, "dboret = %i (expected: %i)\n", (int) dboret, (int) sizeof(uint32_t)); return 0; + } fseek(fp, mds_dpm_block_offs, SEEK_SET); - if (fread(&mds_dpm_block, 1, sizeof(mds_dpm_block_t), fp) != sizeof(mds_dpm_block_t)) + if (LOG_VAR(dbret) fread(&mds_dpm_block, 1, sizeof(mds_dpm_block_t), fp) != sizeof(mds_dpm_block_t)) { + image_log(img->log, "dbret = %i (expected: %i)\n", (int) dbret, (int) sizeof(mds_dpm_block_t)); return 0; + } /* We currently only support the bad sectors block and not (yet) actual DPM. */ if (mds_dpm_block.type == 0x00000002) { @@ -2307,8 +2335,10 @@ image_load_mds(cd_image_t *img, const char *mdsfile) img->bad_sectors = (uint32_t *) malloc(img->bad_sectors_num * sizeof(uint32_t)); fseek(fp, mds_dpm_block_offs + sizeof(mds_dpm_block_t), SEEK_SET); int read_size = img->bad_sectors_num * sizeof(uint32_t); - if (fread(img->bad_sectors, 1, read_size, fp) != read_size) + if (LOG_VAR(dbtret) fread(img->bad_sectors, 1, read_size, fp) != read_size) { + image_log(img->log, "dbtret = %i (expected: %i)\n", (int) dbtret, (int) read_size); return 0; + } break; } } @@ -2317,21 +2347,32 @@ image_load_mds(cd_image_t *img, const char *mdsfile) for (int s = 0; s < mds_hdr.sess_num; s++) { if (version == 2) { fseek(fp, mds_hdr.sess_blocks_offs + (s * sizeof(mds_v2_sess_block_t)), SEEK_SET); - if (fread(&mds_v2_sess_block, 1, sizeof(mds_v2_sess_block_t), fp) != sizeof(mds_v2_sess_block_t)) + if (LOG_VAR(hret) fread(&mds_v2_sess_block, 1, sizeof(mds_v2_sess_block_t), fp) != sizeof(mds_v2_sess_block_t)) { + image_log(img->log, "hret = %i (expected: %i)\n", (int) hret, (int) sizeof(mds_v2_sess_block_t)); return 0; + } memcpy(&mds_sess_block, &mds_v2_sess_block, sizeof(mds_sess_block_t)); mds_sess_block.sess_start = (int32_t) mds_v2_sess_block.sess_start; mds_sess_block.sess_end = (int32_t) mds_v2_sess_block.sess_end; } else { fseek(fp, mds_hdr.sess_blocks_offs + (s * sizeof(mds_sess_block_t)), SEEK_SET); - if (fread(&mds_sess_block, 1, sizeof(mds_sess_block_t), fp) != sizeof(mds_sess_block_t)) + if (LOG_VAR(hret2) fread(&mds_sess_block, 1, sizeof(mds_sess_block_t), fp) != sizeof(mds_sess_block_t)) { + image_log(img->log, "hret2 = %i (expected: %i)\n", (int) hret2, (int) sizeof(mds_sess_block_t)); return 0; + } } for (int t = 0; t < mds_sess_block.all_blocks_num; t++) { fseek(fp, mds_sess_block.trk_blocks_offs + (t * sizeof(mds_trk_block_t)), SEEK_SET); - if (fread(&mds_trk_block, 1, sizeof(mds_trk_block_t), fp) != sizeof(mds_trk_block_t)) + if (LOG_VAR(tbret) fread(&mds_trk_block, 1, sizeof(mds_trk_block_t), fp) != sizeof(mds_trk_block_t)) { + image_log(img->log, "tbret = %i (expected: %i)\n", (int) tbret, (int) sizeof(mds_trk_block)); return 0; + } + + if (version == 2) { + image_log(img->log, "Start sector V2: %016" PRIX64 "\n", mds_trk_block.start_sect_v2); + mds_trk_block.start_sect = (uint32_t) mds_trk_block.start_sect_v2; + } if (last_t != -1) { /* @@ -2358,8 +2399,10 @@ image_load_mds(cd_image_t *img, const char *mdsfile) mds_trk_ex_block.trk_sectors = mds_trk_block.ex_offs; } else if (mds_trk_block.ex_offs != 0ULL) { fseek(fp, mds_trk_block.ex_offs, SEEK_SET); - if (fread(&mds_trk_ex_block, 1, sizeof(mds_trk_ex_block), fp) != sizeof(mds_trk_ex_block)) + if (LOG_VAR(tret) fread(&mds_trk_ex_block, 1, sizeof(mds_trk_ex_block), fp) != sizeof(mds_trk_ex_block)) { + image_log(img->log, "tret = %i (expected: %i)\n", (int) tret, (int) sizeof(mds_trk_ex_block)); return 0; + } } uint32_t astart = mds_trk_block.start_sect - mds_trk_ex_block.pregap; @@ -2367,46 +2410,61 @@ image_load_mds(cd_image_t *img, const char *mdsfile) uint32_t aend2 = aend + mds_trk_ex_block.trk_sectors; uint32_t astart2 = mds_trk_block.start_sect + mds_trk_ex_block.trk_sectors; + ct->skip = 0; + if (mds_trk_block.footer_offs != 0ULL) for (uint32_t ff = 0; ff < mds_trk_block.files_num; ff++) { if (version == 2) { fseek(fp, mds_trk_block.footer_offs + (ff * sizeof(mds_v2_footer_t)), SEEK_SET); - if (fread(&mds_v2_footer, 1, sizeof(mds_v2_footer_t), fp) != sizeof(mds_v2_footer_t)) + if (LOG_VAR(fret) fread(&mds_v2_footer, 1, sizeof(mds_v2_footer_t), fp) != sizeof(mds_v2_footer_t)) { + image_log(img->log, "fret = %i (expected: %i)\n", (int) fret, (int) sizeof(mds_v2_footer_t)); return 0; + } memcpy(&mds_footer, &mds_v2_footer, sizeof(mds_footer)); mds_footer.fn_is_wide = 1; } else { fseek(fp, mds_trk_block.footer_offs + (ff * sizeof(mds_footer_t)), SEEK_SET); - if (fread(&mds_footer, 1, sizeof(mds_footer_t), fp) != sizeof(mds_footer_t)) + if (LOG_VAR(fret2) fread(&mds_footer, 1, sizeof(mds_footer_t), fp) != sizeof(mds_footer_t)) { + image_log(img->log, "fret2 = %i (expected: %i)\n", (int) fret2, (int) sizeof(mds_footer_t)); return 0; + } } uint16_t wfn[2048] = { 0 }; char fn[2048] = { 0 }; - fseek(fp, mds_footer.fn_offs, SEEK_SET); - if (mds_footer.fn_is_wide) { - for (int i = 0; i < 256; i++) { - if (fread(&(wfn[i]), 1, 2, fp) != 2) + + if (mds_footer.fn_offs == 0x00000000) { + /* This is in MDX files - the file name string is empty. */ + strcpy(fn, mdsfile); + ct->skip = 0x40; + } else { + fseek(fp, mds_footer.fn_offs, SEEK_SET); + if (mds_footer.fn_is_wide) { + for (int i = 0; i < 256; i++) { + if (LOG_VAR(fnret) fread(&(wfn[i]), 1, 2, fp) != 2) { + image_log(img->log, "fnret = %i (expected: %i)\n", (int) fnret, (int) 2); + return 0; + } + if (wfn[i] == 0x0000) + break; + } + (void) utf16_to_utf8(wfn, 2048, (uint8_t *) fn, 2048); + } else for (int i = 0; i < 512; i++) { + if (LOG_VAR(fnret2) fread(&fn[i], 1, 1, fp) != 1) { + image_log(img->log, "fnret2 = %i (expected: %i)\n", (int) fnret2, (int) 1); return 0; - if (wfn[i] == 0x0000) + } + if (fn[i] == 0x00) break; } - (void) utf16_to_utf8(wfn, 2048, (uint8_t *) fn, 2048); - } else for (int i = 0; i < 512; i++) { - if (fread(&fn[i], 1, 1, fp) != 1) - return 0; - if (fn[i] == 0x00) - break; - } - if (strlen(fn) == 0) - /* This is in MDX files - the file name string is empty. */ - strcpy(fn, mdsfile); - else if (!stricmp(fn, "*.mdf")) { - strcpy(fn, mdsfile); - fn[strlen(mdsfile) - 3] = 'm'; - fn[strlen(mdsfile) - 2] = 'd'; - fn[strlen(mdsfile) - 1] = 'f'; + if (!stricmp(fn, "*.mdf")) { + strcpy(fn, mdsfile); + fn[strlen(mdsfile) - 3] = 'm'; + fn[strlen(mdsfile) - 2] = 'd'; + fn[strlen(mdsfile) - 1] = 'f'; + } } + image_log(img->log, "fn = \"%s\"\n", fn); char filename[2048] = { 0 }; if (!path_abs(fn)) @@ -2452,7 +2510,7 @@ image_load_mds(cd_image_t *img, const char *mdsfile) success = 1; if (((ct->sector_size == 2336) || (ct->sector_size == 2332)) && (ct->mode == 2) && (ct->form == 1)) - ct->skip = 8; + ct->skip += 8; ci = &(ct->idx[0]); if (ct->point < 0xa0) { @@ -2469,7 +2527,7 @@ image_load_mds(cd_image_t *img, const char *mdsfile) ci->start = aend + 150; ci->length = mds_trk_ex_block.trk_sectors; ci->type = INDEX_NORMAL; - ci->file_start = mds_trk_block.start_offs / ct->sector_size; + ci->file_start = (mds_trk_block.start_offs - (ct->skip & 0x40)) / ct->sector_size; ci->file_length = ci->length; ci->file = tf; } else { From f925685ba88133f179024082dfc953e4c2ab298b Mon Sep 17 00:00:00 2001 From: OBattler Date: Mon, 19 Jan 2026 20:45:47 +0100 Subject: [PATCH 320/320] Some fixes related to the recently Intel Monsoon machine. --- src/chipset/vl82c480.c | 25 ++++++++++++------------- src/machine/machine_table.c | 2 +- src/nvr_at.c | 3 +++ 3 files changed, 16 insertions(+), 14 deletions(-) diff --git a/src/chipset/vl82c480.c b/src/chipset/vl82c480.c index 8015137e089..2ab17eadd0e 100644 --- a/src/chipset/vl82c480.c +++ b/src/chipset/vl82c480.c @@ -28,8 +28,6 @@ #include <86box/port_92.h> #include <86box/chipset.h> -#define machine_at_prolineamt_init NULL /* checks for a removed machine */ - typedef struct vl82c480_t { uint8_t idx; uint8_t regs[256]; @@ -133,7 +131,7 @@ vl82c480_write(uint16_t addr, uint8_t val, void *priv) case 0x02: case 0x03: dev->regs[dev->idx] = val; if ((machines[machine].init == machine_at_martin_init) || - (machines[machine].init == machine_at_prolineamt_init)) + (machines[machine].init == machine_at_monsoon_init)) vl82c480_recalc_banks(dev); break; case 0x04: @@ -220,9 +218,10 @@ vl82c480_init(const device_t *info) vl82c480_t *dev = (vl82c480_t *) calloc(1, sizeof(vl82c480_t)); uint32_t sizes[8] = { 0, 0, 1024, 2048, 4096, 8192, 16384, 32768 }; uint32_t ms = mem_size; - uint8_t min_i = (machines[machine].init == machine_at_prolineamt_init) ? 1 : 0; - uint8_t min_j = (machines[machine].init == machine_at_prolineamt_init) ? 4 : 2; - uint8_t max_j = (machines[machine].init == machine_at_prolineamt_init) ? 8 : 7; + uint8_t min_i = (machines[machine].init == machine_at_monsoon_init) ? 1 : 0; + uint8_t max_i = (machines[machine].init == machine_at_monsoon_init) ? 2 : 4; + uint8_t min_j = (machines[machine].init == machine_at_monsoon_init) ? 2 : 2; + uint8_t max_j = (machines[machine].init == machine_at_monsoon_init) ? 7 : 7; dev->regs[0x00] = info->local; dev->regs[0x01] = 0xff; @@ -233,15 +232,15 @@ vl82c480_init(const device_t *info) dev->regs[0x07] = 0x21; dev->regs[0x08] = 0x38; - if (machines[machine].init == machine_at_prolineamt_init) { - dev->banks[0] = 4096; - - /* Bank 0 is ignored if 64 MB is installed. */ - if (ms != 65536) - ms -= 4096; + if (machines[machine].init == machine_at_monsoon_init) { + if (ms >= 16384) { + dev->banks[0] = 0; + min_i = 0; + } else + dev->banks[0] = 4096; } - if (ms > 0) for (uint8_t i = min_i; i < 4; i++) { + if (ms > 0) for (uint8_t i = min_i; i < max_i; i++) { for (uint8_t j = min_j; j < max_j; j++) { if (ms >= sizes[j]) dev->banks[i] = sizes[j]; diff --git a/src/machine/machine_table.c b/src/machine/machine_table.c index d08742f9c64..2cd3db8a55d 100644 --- a/src/machine/machine_table.c +++ b/src/machine/machine_table.c @@ -8482,7 +8482,7 @@ const machine_t machines[] = { .default_jumpered_ecp_dma = -1, .kbc_device = NULL, .kbc_params = 0x00000000, - .kbc_p1 = 0x000004f0, + .kbc_p1 = 0x00000ce0, .gpio = 0xffffffff, .gpio_acpi = 0xffffffff, .device = NULL, diff --git a/src/nvr_at.c b/src/nvr_at.c index ce720add9ca..07588fb01b7 100644 --- a/src/nvr_at.c +++ b/src/nvr_at.c @@ -1191,6 +1191,9 @@ nvr_at_init(const device_t *info) if (info->local & 0x20) local->def = 0x00; + if (machines[machine].init == machine_at_monsoon_init) + local->def = 0xff; + if (info->local & 0x40) local->flags |= FLAG_MULTI_BANK;