OpenIDC / mod_auth_openidc

OpenID Certified™ OpenID Connect Relying Party implementation for Apache HTTP Server 2.x
Apache License 2.0
990 stars 327 forks source link

error when decrypting JWTs on big endian architectures (mips,powerpc,sparc) #18

Closed zandbelt closed 10 years ago

zandbelt commented 10 years ago

test code 'test_jwt_decryption' fails on big endian architectures (mips, powerpc, sparc):

| `/usr/bin/apxs2 -q CC`  -DLINUX -D_REENTRANT -D_GNU_SOURCE -D_LARGEFILE64_SOURCE -I/usr/include/apr-1.0   -Isrc -o test/test test/*.c src/jose/apr_jwt.c src/jose/apr_jwk.c src/jose/apr_jws.c src/jose/apr_jwe.c -lapr-1 -laprutil-1 -lldap -llber  -lssl -lcrypto  -ljansson 
| test/test
| Failed:  # test_jwt_decryption: error in apr_jwe_decrypt_jwt: result "0" != expected "1"
| make[1]: *** [test] Error 1 
latinovic commented 10 years ago

Hi, adding following linein apr_jwe.c for BE solves this issue for me.

else 
memcpy(p, &al, sizeof(uint64_t));
latinovic commented 10 years ago

I will create pull request with needed changes.

zandbelt commented 10 years ago

closed in 5353424f4d9ef1b48c9d16d3ae2d9bc4166a11d7