Closed mskalski closed 3 years ago
Hi! Thanks, I'll look at it tonight.
I think we have to limit the possible number of iterations.
And it would be nice to know the signature length beforehand. I think it is possible. At least for OpenSSL...
And it would be nice to know the signature length beforehand. I think it is possible. At least for OpenSSL...
Yes it is possible for RSA (size of RSA key), of course it is possible for Elliptic curve, (but you need to know key type and curve), but unnecessary.
I think buffer of size 1024 bytes is far enough for all types of signatures and usually causes only one call to C_Sign().
If it is a buggy module, maybe you can
Add workaround for buggy implementation of PKCS#11 library when it does not update signature_length parameter whein it returns CKR_BUFFER_TOO_SMALL. It handles also (hypotetical) reducing by PKCS#11 library returned signature length.
Additionally speeds up signature using larger buffer (of 1024 bytes) at beginning which should result for most of cases calling C_Sign() only once.