On Wed, 2017-10-11 at 13:36 +0200, Lukas Slebodnik wrote: > On (11/10/17 12:42), Carsten Grzemba wrote: > > > > ><signaturebeforequotedtext></signaturebeforequotedtext> > > >On 11.10.17 10:54, William Brown <wibrown@xxxxxxxxxx> wrote: > > >> > > >> On Tue, 2017-10-10 at 16:28 +0200, Carsten Grzemba wrote: > > >> > <signaturebeforequotedtext></signaturebeforequotedtext> > > >> > On 10.10.17 16:10, William Brown <wibrown@xxxxxxxxxx> wrote: > > >> > > > > >> > > On Fri, 2017-10-06 at 10:21 +0200, Carsten Grzemba wrote: > > >> > > > Currently the code src/libsds/external/csiphash/csiphash.c do not work on Sparc. > > >> > > > The casting void* or char* to unit64_t* throws Bus-Error. > > >> > > > > > >> > > > The solution would be to copy the content of the void and char pointer so that the variabeles are suitably aligned. > > >> > > > To prevent have to use malloc: do we know the max of src_sz? > > >> > > > > > >> > > > > >> > > > > >> > > What line is this? I assume you are refering to: > > >> > > > > >> > > https://pagure.io/389-ds-base/blob/master/f/src/libsds/external/csiphash/csiphash.c#_82 > > >> > > > > >> > yes! > > >> > > > >> > > > > >> > > (https://pagure.io/389-ds-base/blob/master/f/src/libsds/external/csiphash/csiphash.c#_82) > > >> > > > > >> > > No, we can't know the max of src_sz, in theory it could be uint64_t max. > > >> > > So this may not be an option. > > >> > > > > >> > So is malloc for uint64 alignment of the src variable the only option? > > >> > > > >> > > > > >> > > > > >> > > > > >> > > Are you trying this on a 32bit platform perhaps? What's the arch of the > > >> > > machine with the issue? > > >> > > > > >> > 64bit, Fujitsu M4000 > > >> > $ isainfo -v > > >> > 64-bit sparcv9 applications > > >> > fmaf vis2 vis popc > > >> > > >> I feel like there is something I'm missing here in the problem. What is > > >> sizeof(void *) on this platform? I'm assuming 4 or 16 rather than 8 > > >> bytes? Is this correct? > > >> > > >no it is 8. > > > > > >The following programm works on x86 but dumps on Sparc: > > > > > > > > > > > >#include <stdio.h> > > >#include <sys/types.h> > > > > > >int func(const void *str, size_t sz, const char key[16]){ > > > uint64_t *ip = (uint64_t*) str; > > > printf ("str: %lx:%lx\n", ip, *ip); > > >} > > > > > >int main() > > >{ > > > char str[25] = "ABCDEFGH12345678"; > > > char key[16]; > > > > > But following code should work. Please correct me if I am wrong. I didn't test. > char *str = strdup("ABCDEFGH12345678"); > char *key = malloc(16); > > yes, function sds_siphash13 is not ideal because it rely on properly alligned > input data. > We are free to change the signature of the function, it's just that I used this from another open source component (thus why it's slightly different style wise) What would you suggest here Lukas? -- Sincerely, William Brown Software Engineer Red Hat, Australia/Brisbane
Attachment:
signature.asc
Description: This is a digitally signed message part
_______________________________________________ 389-devel mailing list -- 389-devel@xxxxxxxxxxxxxxxxxxxxxxx To unsubscribe send an email to 389-devel-leave@xxxxxxxxxxxxxxxxxxxxxxx