Re: [PATCH v5 1/2] lib/mpi: Add mpi sgl helpers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/08/2015 06:02 AM, Herbert Xu wrote:
> On Thu, Oct 01, 2015 at 10:10:38PM -0700, Tadeusz Struk wrote:
>>
>> +/**
>> + * mpi_write_to_sgl() - Funnction exports MPI to an sgl (msb first)
>> + *
>> + * This function works in the same way as the mpi_read_buffer, but it
>> + * takes an sgl instead of u8 * buf.
>> + *
>> + * @a:		a multi precision integer
>> + * @sgl:	scatterlist to write to. Needs to be at least
>> + *		mpi_get_size(a) long.
>> + * @nbytes:	receives the actual length of the data written.
>> + * @sign:	if not NULL, it will be set to the sign of a.
>> + *
>> + * Return:	0 on success or error code in case of error
>> + */
>> +int mpi_write_to_sgl(MPI a, struct scatterlist *sgl, unsigned *nbytes,
>> +		     int *sign)
> 
> Where is the maximum length of sgl? You should not assume that the
> entire SG list is for you to use.  So the length that you are allowed
> to use should be passed in explicitly.  You can just put it into
> nbytes.

The sgl has to be big enough to take the whole integer.
What would be the point to export only part of a number?
--
To unsubscribe from this list: send the line "unsubscribe linux-crypto" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux