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
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
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
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
[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.
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;
6 matches
Mail list logo