SVN revision  3391 card-rutoken.c does not compile on Solaris 10.
It uses u_int16_t which is not defined in Solaris.

(unit16_t and int16_t are defined).

But there should be no need to use any of these,
as the code is trying to take 2 u8 variables and
convert to size_t.  See below for a suggestion.


I also question the need for the
#ifdef BIG_ENDIAN_RUTOKEN
...
#else
...
#endif
as BIG_ENDIAN_RUTOKEN  is defined at line 29. The code
could be much cleaner if it and the 8 sections of "#else"
code where deleted.


pkcs15-prkey-rutoken.c also has problems with u_int32_t,
unsigned int might be a beter choice.



Index: card-rutoken.c
===================================================================
--- card-rutoken.c      (revision 3391)
+++ card-rutoken.c      (working copy)
@@ -342,11 +342,11 @@
  static void rutoken_process_fcp(sc_card_t *card, u8 *pIn, sc_file_t *file)
  {
  #ifdef BIG_ENDIAN_RUTOKEN
-       file->size = pIn[3] + ((u_int16_t)pIn[2])*256;
-       file->id = pIn[7] + ((u_int16_t)pIn[6])*256;
+       file->size = pIn[3] + (pIn[2] << 8);
+       file->id = pIn[7] + (pIn[6] << 8);
  #else
-       file->size = pIn[2] + ((u_int16_t)pIn[3])*256;
-       file->id = pIn[6] + ((u_int16_t)pIn[7])*256;
+       file->size = pIn[2] + (pIn[3] << 8);
+       file->id = pIn[6] + (pIn[7] << 8);
  #endif

        if (pIn[4] == FDESCR_DF)





-- 

  Douglas E. Engert  <[EMAIL PROTECTED]>
  Argonne National Laboratory
  9700 South Cass Avenue
  Argonne, Illinois  60439
  (630) 252-5444
_______________________________________________
opensc-devel mailing list
opensc-devel@lists.opensc-project.org
http://www.opensc-project.org/mailman/listinfo/opensc-devel

Reply via email to