2010/11/22 Andre Zepezauer <andre.zepeza...@student.uni-halle.de>: > Hello, > >> 2010/11/20 Andre Zepezauer <andre.zepeza...@student.uni-halle.de>: >> > I would like to commit a change to pkcs11-spy, that changes the output >> > related to enquiries on attribute values (C_GetAttributeValue). The >> > reason for that change is that PKCS#11 defines a precise algorithm for >> > these enquiries. That algorithm depends for example on pointer >> > (NULL_PTR) and size of input-buffer. >> > >> > The new output is more detailed and less verbose. And it makes tracing >> > of applications a little bit more easy. See attached file sample.txt. >> > >> > The patch uses the following format string with variable sized hex-dump >> > of pointers: sprintf(buf, "0x%0*lx / %ld", 2 * ptr_sz, ptr, buf_len); >> > >> > It works well on Linux (32 and 64 bit). But does this kind of format >> > string would work on other platforms too? Other objections about that >> > patch? >> >> In buf_spec() function why do you declare ptr_sz as static? >> I agree buf need to be static since the pointer to the buffer is >> returned by ptr_sz should not be static. > > Agreed. > >> Why do you cast size in a (CK_LONG) if the value is in fact a CK_ULONG? >> Why not use %lu and no cast: >> sprintf(buf, "0x%0*lx / %lu", 2 * ptr_sz, value, size); >> > > The cast is required by PKCS#11 specs: > "If the specified attribute [...] for the object cannot be revealed > because the object is sensitive or unextractable, then the ulValueLen > field in that triple is modified to hold the value -1 (i.e., when it is > cast to a CK_LONG, it holds -1)."
OK. >> No other objection. >> >> I don't know if the field width is supported on Windows. Nothing in >> printf(3) says this is a glibc extension so I may work on other >> systems. > > A grep over the OpenSC source code gave only one result where variable > field width is used within a format string. This is in cardmod. > Therefore I would prefer to avoid it. New patch without variable field > width is attached. OK for me. Commit as you want. Bye -- Dr. Ludovic Rousseau _______________________________________________ opensc-devel mailing list opensc-devel@lists.opensc-project.org http://www.opensc-project.org/mailman/listinfo/opensc-devel