3

What does the ++= operator even do in C? It wouldn't compile in Derek Fawcus' "css_unscramble.c" program, so I was wondering how to replace it, from a purely academic standpoint. Thanks for reviewing my question, Stack Exchange community!

void CSSdescramble(unsigned char *sec,unsigned char *key) {
  unsigned int t1,t2,t3,t4,t5,t6;
  unsigned char *end=sec+0x800;
  t1=key[0]^sec[0x54]|0x100;
  t2=key[1]^sec[0x55];
  t3=(*((unsigned int *)(key+2)))^(*((unsigned int *)(sec+0x56)));
  t4=t3&7;
  t3=t3*2+8-t4;
  sec+=0x80;
  t5=0;
  while(sec!=end) {
    t4=CSSt2[t2]^CSSt3[t1];
    t2=t1>>1;
    t1=((t1&1)<<8)^t4;
    t4=CSSt5[t4];
    t6=(((((((t3>>3)^t3)>>1)^t3)>>8)^t3)>>5)&0xff;
    t3=(t3<<8)|t6;
    t6=CSSt4[t6];
    t5+=t6+t4;
    *sec++=CSSt1[*sec]^(t5&0xff);
    t5>>=8;
  }
}
ELI BRADLEY
  • 55
  • 1
  • 9

1 Answers1

13

There is no ++= operator - what you see in on the left side of the *sec++=... assignment is a sequence of three operators glued together by poor formatting:

  • * dereferences the pointer
  • ++ increments it
  • = assigns the result of the right-hand side to the location pointed to by the pointer before it has been incremented.
Sergey Kalinichenko
  • 714,442
  • 84
  • 1,110
  • 1,523