issue with sc_decompress() call when run on Big Endian OS

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

issue with sc_decompress() call when run on Big Endian OS

Puneet Khunteta
Hello,

I observed that when i use a sc_decompress() call on a Big Endian OS ( Linux with Arm Processor), i got a error code return -1400.
Where as it works perfectly for the window ( Little Endian) OS.
I have used the same certificate file to de-compress on both devices.

 nRet = sc_decompress(outbuff, (size_t *)&nOutBuffLen, Inbuff, nInBuffLen, COMPRESSION_AUTO);

nRet = -1400 ( for Big Endian)
nRet = 0        ( for little Endian)

A quick help will be appreciate.

Regards

_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc-project.org/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: issue with sc_decompress() call when run on Big Endian OS

Ludovic Rousseau
2012/9/18 Puneet Khunteta <[hidden email]>:
> Hello,

Hi,

> I observed that when i use a sc_decompress() call on a Big Endian OS ( Linux
> with Arm Processor), i got a error code return -1400.
> Where as it works perfectly for the window ( Little Endian) OS.
> I have used the same certificate file to de-compress on both devices.
>
>  nRet = sc_decompress(outbuff, (size_t *)&nOutBuffLen, Inbuff, nInBuffLen,
> COMPRESSION_AUTO);

I don't know what the type of nOutBuffLen is but it is very dangerous
to cast pointers.
If nOutBuffLen has not the same size as size_t your code is bogus.

Bye

--
 Dr. Ludovic Rousseau
_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc-project.org/mailman/listinfo/opensc-devel
Reply | Threaded
Open this post in threaded view
|

Re: issue with sc_decompress() call when run on Big Endian OS

Douglas E. Engert
In reply to this post by Puneet Khunteta

On 9/18/2012 10:53 AM, Puneet Khunteta wrote:
> Hello,
>
> I observed that when i use a sc_decompress() call on a Big Endian OS ( Linux with Arm Processor), i got a error code return -1400.
> Where as it works perfectly for the window ( Little Endian) OS.
> I have used the same certificate file to de-compress on both devices.
>
>   nRet = sc_decompress(outbuff, (size_t *)&nOutBuffLen, Inbuff, nInBuffLen, COMPRESSION_AUTO);

Why do you need  (size_t *) above?
What is nOutBuffLen?

>
> nRet = -1400 ( for Big Endian)
> nRet = 0        ( for little Endian)
>
> A quick help will be appreciate.

Can you use COMPRESSION_GZIP or COMPRESSION_ZLIB to test if this
is a problem with GZIP , ZLIB or with the detect_method routine?

Do you want to use the sc_decompress_alloc?

The only place I see sc_decompress used in OpenSC is used in in card-piv.c
and that uses gzip. It works on Solaris sparc, a big endian machine.

>
> Regards
>
>
> _______________________________________________
> opensc-devel mailing list
> [hidden email]
> http://www.opensc-project.org/mailman/listinfo/opensc-devel
>

--

  Douglas E. Engert  <[hidden email]>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444


_______________________________________________
opensc-devel mailing list
[hidden email]
http://www.opensc-project.org/mailman/listinfo/opensc-devel