Skip to content
This repository has been archived by the owner on Apr 14, 2024. It is now read-only.

Commit

Permalink
[powervu] Add emm unmask mode 4
Browse files Browse the repository at this point in the history
  • Loading branch information
nautilus7 authored Mar 27, 2024
1 parent af73dde commit 51b1f79
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 1 deletion.
2 changes: 1 addition & 1 deletion module-emulator-osemu.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifdef WITH_EMU

// Version info
#define EMU_VERSION 800
#define EMU_VERSION 801

#define EMU_MAX_CHAR_KEYNAME 12
#define EMU_KEY_FILENAME "SoftCam.Key"
Expand Down
62 changes: 62 additions & 0 deletions module-emulator-powervu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2304,6 +2304,31 @@ static void create_data_unmask_emm_mode_03(uint8_t *emmBody, uint8_t *data)
}
}

static void create_data_unmask_emm_mode_04(uint8_t *emmBody, uint8_t *data)
{
int i;
uint8_t padding[] =
{
0x56, 0xC7, 0x05, 0x66, 0xC7, 0x4E, 0xC1, 0xA0,
0x9E, 0xD1, 0xFE, 0x92, 0xE8, 0xCD, 0x5F, 0xAF,
0xCF, 0xE5, 0xE9, 0x9E, 0x7A, 0x38, 0xAC, 0x68
};

memcpy(data + 0x28, padding, 0x18);

for (i = 0; i < 5; i++)
{
data[0 + i * 8] = emmBody[0x06 + i * 0x1B];
data[1 + i * 8] = emmBody[0x19 + i * 0x1B];
data[2 + i * 8] = emmBody[0x16 + i * 0x1B];
data[3 + i * 8] = emmBody[0x0A + i * 0x1B];
data[4 + i * 8] = emmBody[0x13 + i * 0x1B];
data[5 + i * 8] = emmBody[0x05 + i * 0x1B];
data[6 + i * 8] = emmBody[0x14 + i * 0x1B];
data[7 + i * 8] = emmBody[0x18 + i * 0x1B];
}
}

static uint8_t get_mode_unmask_emm(uint8_t *extraData)
{
uint16_t data = ((uint16_t)extraData[0] << 8) + extraData[1];
Expand Down Expand Up @@ -2442,6 +2467,43 @@ static void unmask_emm(uint8_t *emm)
emm[0x13 + 0x0C + i * 0x1B] ^= mask[0x0F];
}
}
else if (modeUnmask == 0x04)
{
for (i = 0; i < 5; i++)
{
emm[0x13 + 0x05 + i * 0x1B] -= emm[0x13 + 0x04 + i * 0x1B];
emm[0x13 + 0x06 + i * 0x1B] -= emm[0x13 + 0x0B + i * 0x1B];
emm[0x13 + 0x0A + i * 0x1B] -= emm[0x13 + 0x17 + i * 0x1B];
emm[0x13 + 0x13 + i * 0x1B] -= emm[0x13 + 0x1A + i * 0x1B];
emm[0x13 + 0x14 + i * 0x1B] -= emm[0x13 + 0x0E + i * 0x1B];
emm[0x13 + 0x16 + i * 0x1B] -= emm[0x13 + 0x15 + i * 0x1B];
emm[0x13 + 0x18 + i * 0x1B] -= emm[0x13 + 0x08 + i * 0x1B];
emm[0x13 + 0x19 + i * 0x1B] -= emm[0x13 + 0x12 + i * 0x1B];
}

create_data_unmask_emm_mode_04(emm + 0x13, data);
create_hash_mode_04(data, mask);

for (i = 0; i < 5; i++)
{
emm[0x13 + 0x0B + i * 0x1B] ^= mask[0x00];
emm[0x13 + 0x12 + i * 0x1B] ^= mask[0x01];
emm[0x13 + 0x15 + i * 0x1B] ^= mask[0x02];
emm[0x13 + 0x17 + i * 0x1B] ^= mask[0x03];
emm[0x13 + 0x1A + i * 0x1B] ^= mask[0x04];
emm[0x13 + 0x04 + i * 0x1B] ^= mask[0x05];
emm[0x13 + 0x0E + i * 0x1B] ^= mask[0x06];
emm[0x13 + 0x08 + i * 0x1B] ^= mask[0x07];
emm[0x13 + 0x09 + i * 0x1B] ^= mask[0x08];
emm[0x13 + 0x0C + i * 0x1B] ^= mask[0x09];
emm[0x13 + 0x03 + i * 0x1B] ^= mask[0x0A];
emm[0x13 + 0x0F + i * 0x1B] ^= mask[0x0B];
emm[0x13 + 0x10 + i * 0x1B] ^= mask[0x0C];
emm[0x13 + 0x07 + i * 0x1B] ^= mask[0x0D];
emm[0x13 + 0x0D + i * 0x1B] ^= mask[0x0E];
emm[0x13 + 0x11 + i * 0x1B] ^= mask[0x0F];
}
}
else
{
cs_log("A new unknown emm mode [%d] is in use.", modeUnmask);
Expand Down

3 comments on commit 51b1f79

@WXbet
Copy link
Contributor

@WXbet WXbet commented on 51b1f79 Mar 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, what‘s does the new functionality bring us?

@EnoSat
Copy link
Contributor

@EnoSat EnoSat commented on 51b1f79 Mar 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PowerVu now applies nano01 to ECM, so the channels are decreasing :(

@bracarino
Copy link

@bracarino bracarino commented on 51b1f79 Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @nautilus7
How are you? Thank you for updating powervu. Would it be possible to update to support nano01 on ECM?

Please sign in to comment.