[sr-dev] [kamailio/kamailio] lib/srutils: fix gcc warning GH#612 (#626)

Mikko Lehto notifications at github.com
Tue May 17 14:38:07 CEST 2016


This little test program shows same output before and after patch.

`
#include <stdio.h>
#include "sha256.h"
#include "shautils.h"
#define BUFSIZE 1024

    int main(void) {

        uint8_t buffer[BUFSIZE];
        uint8_t src[2];

        src[0]='a';
        src[1]=0x0a;

        compute_sha256((char *)buffer, (uint8_t *)&src, sizeof(src));
        buffer[SHA256_DIGEST_STRING_LENGTH -1] = '\0';
        printf("%s\n", buffer);

        compute_sha512((char *)buffer, (uint8_t *)&src, sizeof(src));
        buffer[SHA512_DIGEST_STRING_LENGTH -1] = '\0';
        printf("%s\n", buffer);

        return 0;

    }

`
Output is also same when compared to /sbin/sha256 and /sbin/sha512 (FreeBSD 10).

`
% gcc -Wall shatest.c ../../md5.o sha256.o shautils.o

% ./a.out 
87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7
162b0b32f02482d5aca0a7c93dd03ceac3acd7e410a5f18f3fb990fc958ae0df6f32233b91831eaf99ca581a8c4ddf9c8ba315ac482db6d4ea01cc7884a635be
% echo a|sha256 ; echo a|sha512                                                                                                                 
87428fc522803d31065e7bce3cf03fe475096631e5e07bbd7a0fde60c4cf25c7
162b0b32f02482d5aca0a7c93dd03ceac3acd7e410a5f18f3fb990fc958ae0df6f32233b91831eaf99ca581a8c4ddf9c8ba315ac482db6d4ea01cc7884a635be
%
`


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/pull/626#issuecomment-219704725
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-dev/attachments/20160517/0efd3050/attachment.html>


More information about the sr-dev mailing list