I need some help, I need to pass a rijndael round key into a function as a parameter. The round key is a 3D array which looks like this:
unsigned char rk[11][4][4]; Now I need to input this into a function and make some binary operations to it (so the parameter should be editable). How do I do it the right way? The way I did it was to put it inside a struct and pass the struct to the function. But it is ugly. So now my code looks like this:
typedef struct{ unsigned char rk[11][4][4]; }roundKey; void addKey(roundKey* rk, ....) { some_unsigned_char ^= rk->rk[foo][bar][i]; } It is ugly and I would like to do it the right way. How should I do it?
typedef struct { ... } roundKey;trick isn't needed in C++. Plain oldstruct roundKey { ... };does the deed for you.