Re: bare bones file encrypter/decrypter using 128 bit Serpent algorithm



Nick Keighley wrote, On 25/01/08 10:07:
On 24 Jan, 10:22, makobu <makobu.mwambir...@xxxxxxxxx> wrote:

I pointed out a number of areas where it was
simply wrong.
The compiler didn't give out any warnings,

you didn't ask it to

In any case, if not producing any warnings is sufficient to prove a program is bug free then here is my implementation in standard C of the "Do whatever you want" program. Run it and it will do whatever you want, and it must be correct because it compiles without warning.

int main(void) {return 0;}

and the program does what
its supposed to.

wow. perhaps your testing is poor. You fail to check return
values of calloc(), you allow buffer overflow on input, you
misuse strncpy(), you don't seed rand(). You use rand()
for cryptography!?

I'm sure there were a few other things I pointed out. Such as a buffer overflow even if the user followed the instructions.

I hope you don't write software for anything important.

Doesn't mater if he does, for anything important there would be at least a little QA and any attempt by anyone competent would reject SW like the OPs.

So there might better ways to code the areas, but
they waren't wrong. Not according to gcc anyway.

See above. Compilers are not required to issue diagnostics for all coding errors, and in fact they cannot because the compiler does not know what you intend only what you tell it.
--
Flash Gordon
.



Relevant Pages

  • Re: Is it standard and practical to use long long types?
    ... > right option for putting the compiler in conforming mode. ... > compiler is invoked with the extensions disabled, ... Bogus/idiotic warnings when all warnings are enabled. ... GCC does not fully support C99, yet ansi invokes it's C99 spirit. ...
    (comp.lang.c)
  • Re: Is it standard and practical to use long long types?
    ... > right option for putting the compiler in conforming mode. ... > compiler is invoked with the extensions disabled, ... Bogus/idiotic warnings when all warnings are enabled. ... GCC does not fully support C99, yet ansi invokes it's C99 spirit. ...
    (comp.lang.cpp)
  • Re: Tcl 8.5 HP/UX Compiler warnings
    ... results and "the optional HP ANSI C compiler", ... stat64 struct pointers are being ... The elementary types of the structure ... other warnings I cited are similarly harmless. ...
    (comp.lang.tcl)
  • Re: Is it standard and practical to use long long types?
    ... right option for putting the compiler in conforming mode. ... Bogus/idiotic warnings when all warnings are enabled. ... For reference, this what I get from gcc, when invoked in conforming mode ...
    (comp.lang.cpp)
  • Re: Is it standard and practical to use long long types?
    ... right option for putting the compiler in conforming mode. ... Bogus/idiotic warnings when all warnings are enabled. ... For reference, this what I get from gcc, when invoked in conforming mode ...
    (comp.lang.c)