- int ret = RSA_public_encrypt(len, inbuf, outbuf, rsa,
- RSA_PKCS1_PADDING);
+ int ret, flen = len; /* RSA_public_encrypt expects a signed int */
+
+ if (flen < 0)
+ return -E_ENCRYPT;
+ ret = RSA_public_encrypt(flen, inbuf, outbuf, rsa, RSA_PKCS1_PADDING);