Re: segmentation fault with libcrypto.so (but not libcrypto.a)

2009-11-03 Thread N N
Since people didn't like the previous code, try the following version with safer memory handling. It still segfaults when using the shared library and doesn't when using the static one. Replacing the line above with the commented out line works in both cases (since we're no longer relying on SHA1

Re: segmentation fault with libcrypto.so (but not libcrypto.a)

2009-11-03 Thread Gabor Gombas
On Tue, Nov 03, 2009 at 12:29:46PM -0500, N N wrote: > #include > #include > > int main(int argc, char** argv) { > unsigned char foo[10] = "boo"; > unsigned char* res = malloc(20); > unsigned char* res2 = res; > res = SHA1(foo, 3, 0); > //res = SHA1(foo, 3, res); > > int i; > for

Re: segmentation fault with libcrypto.so (but not libcrypto.a)

2009-11-03 Thread Michael Banck
Hi, On Tue, Nov 03, 2009 at 12:29:46PM -0500, N N wrote: > Since people didn't like the previous code, try the following version with > safer memory handling. Debian-devel is not a bug-reporting or programming-discussion list. Please post elsewhere. thanks, Michael -- To UNSUBSCRIBE, emai

Re: segmentation fault with libcrypto.so (but not libcrypto.a)

2009-11-03 Thread Goswin von Brederlow
N N writes: > Apologies if this is the wrong list.  If so, please direct me to the > appropriate one. > > Consider the following C code: > > include > #include > > int main(int argc, char** argv) { >   unsigned char foo[10] = "boo"; >   printf("%s\n", SHA1(foo, 3, 0)); > } > > in file test-hmac

Re: segmentation fault with libcrypto.so (but not libcrypto.a)

2009-11-02 Thread Peter Samuelson
[N N] > #include > #include > > int main(int argc, char** argv) { > unsigned char foo[10] = "boo"; > printf("%s\n", SHA1(foo, 3, 0)); > } Don't use printf("%s") on binary data that is not null-terminated. What you probably want is to convert each byte to 2 hex digits and print it that way.

segmentation fault with libcrypto.so (but not libcrypto.a)

2009-11-02 Thread N N
Apologies if this is the wrong list. If so, please direct me to the appropriate one. Consider the following C code: include #include int main(int argc, char** argv) { unsigned char foo[10] = "boo"; printf("%s\n", SHA1(foo, 3, 0)); } in file test-hmac.c. gcc -static test-hmac.c -lcrypto;