On Thu, 12 Jul 2012, Samuel Pitoiset wrote:
+/**
+ * Write the public key into big-endian form.
+ *
+ * @param dh a Diffie-Hellmann context
+ * @param pub_key public key
+ * @param pub_key_len length of the public key
+ * @return zero on success, negative value otherwise
+ */
+int ff_dh_write_public_key(FF_DH *dh, uint8_t *pub_key, int pub_key_len);
The purpose of this function is to transform a key from little-endian to
big-endian? If yes, then the name is poor, else the description is poor.
This function converts the value of the public key into big-endian
form and write it in the parameter pub_key.
I think Diego's point is that whether it is written in big-endian form or
not feels like wrong level of abstraction to explain the function. "Write
the public function into the given buffer" says the same without being
overly specific. Then it's taken for granted that the function takes care
of writing it into whatever form the format specifies it should be written
into, whether it is big-endian or anything else.
Also, I take it that pub_key and pub_key_len are the buffers into where
the key is written. The current descriptions of the parameters don't
really explain that at all. Currently it says:
@param dh a Diffie-Hellmann context
@param pub_key public key
@param pub_key_len length of the public key
Does that mean that I should already have the public key in pub_key, and
dh is just any context?
Wouldn't this be more descriptive?
@param dh the Diffie-Hellmann context, containing the public key to write
@param buf the buffer where the public key is written
@param len the length of the buffer
Then it is much clearer what their roles actually are with respect to this
function.
// Martin
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel