Re: aes decrypt encrypt



Sebastian G. wrote:
Mike Amling wrote:

Kristian Gjøsteen wrote:
e704112@xxxxxxxxx <e704112@xxxxxxxxx> wrote:
i don' t get back my plaintext, just some weird character.
What if you specify a 16-byte key?

That's an error, but probably not causing the symptom. My understanding is that a standard C compiler must initialize the 8 unspecified bytes of the key array to binary zero bytes.


You should doubt your understanding and rather read the spec. The C compiler is not required to initialize any variable.

From C99:
"If there are fewer initializers in a brace-enclosed list than there are elements or members of an aggregate, or fewer characters in a string literal used to initialize an array of known size than there are elements in the array, the remainder of the aggregate shall be initialized implicitly the same as objects that have static storage duration."

which in the OP's code means the key bytes at subscripts [8..16] become binary zero.

--Mike Amling
.



Relevant Pages

  • Re: compiler bugs
    ... In a language like C, the behavior of programs that reference ... Not if the unoptimizing compiler initializes all variables to some ... portion of the array in your algorithhm. ... that one actually does not need to initialize all variables (unlike ...
    (comp.compilers)
  • Re: compiler bugs
    ... While I hate disagreeing with you Anton, ... Not if the unoptimizing compiler initializes all variables to some ... portion of the array in your algorithhm. ... being able to not actually initialize the array for the unused ...
    (comp.compilers)
  • Re: Variably sized instances of a class
    ... The array size will be known at each instantiation but not ... The compiler must know at compile-time ... it to *MyClass and initialize it. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Is this legal?
    ... >> class grid{ ... >> If it is not legal how can I have an array as a data member of an object? ... > teh compiler won't accept it. ... > declaration - you can't initialize it there because there has been no ...
    (alt.comp.lang.learn.c-cpp)
  • Re: aes decrypt encrypt
    ... My understanding is that a standard C compiler must initialize the 8 unspecified bytes of the key array to binary zero bytes. ...
    (sci.crypt)