|
@@ -194,11 +194,11 @@
|
|
|
/* ======================================================================== */
|
|
|
|
|
|
/*
|
|
|
- * Key schedule: initialize the key context structure with the provided
|
|
|
- * secret key. The secret key is an array of 1 to 32 bytes.
|
|
|
+ * Initialize Sosemanuk's state by providing a key. The key is an array of
|
|
|
+ * 1 to 32 bytes.
|
|
|
* @param ss The Sosemanuk state
|
|
|
* @param key Key
|
|
|
- * @param keylen Length of key
|
|
|
+ * @param keylen Length of key in bytes
|
|
|
* @return CRYPT_OK on success
|
|
|
*/
|
|
|
int sosemanuk_setup(sosemanuk_state *ss, unsigned char *key, unsigned long keylen)
|
|
@@ -331,12 +331,14 @@ int sosemanuk_setup(sosemanuk_state *ss, unsigned char *key, unsigned long keyle
|
|
|
|
|
|
|
|
|
/*
|
|
|
- * Cipher initialization: the cipher internal state is initialized, using
|
|
|
- * the provided key context and IV. The IV length is up to 16 bytes. If
|
|
|
- * "ivlen" is 0 (no IV), then the "iv" parameter can be NULL.
|
|
|
+ * Initialization continues by setting the IV. The IV length is up to 16 bytes.
|
|
|
+ * If "ivlen" is 0 (no IV), then the "iv" parameter can be NULL. If multiple
|
|
|
+ * encryptions/decryptions are to be performed with the same key and
|
|
|
+ * sosemanuk_done() has not been called, only sosemanuk_setiv() need be called
|
|
|
+ * to set the state.
|
|
|
* @param ss The Sosemanuk state
|
|
|
* @param iv Initialization vector
|
|
|
- * @param ivlen Length of iv
|
|
|
+ * @param ivlen Length of iv in bytes
|
|
|
* @return CRYPT_OK on success
|
|
|
*/
|
|
|
int sosemanuk_setiv(sosemanuk_state *ss, unsigned char *iv, unsigned long ivlen)
|
|
@@ -744,7 +746,7 @@ static LTC_INLINE void _xorbuf(const unsigned char *in1, const unsigned char *in
|
|
|
* @param ss The Sosemanuk state
|
|
|
* @param in Data in
|
|
|
* @param out Data out
|
|
|
- * @param datalen Length of data
|
|
|
+ * @param datalen Length of data in bytes
|
|
|
* @return CRYPT_OK on success
|
|
|
*/
|
|
|
int sosemanuk_crypt(sosemanuk_state *ss,
|
|
@@ -787,7 +789,7 @@ int sosemanuk_crypt(sosemanuk_state *ss,
|
|
|
* pseudo-random bytes as output from the stream cipher.
|
|
|
* @param ss The Sosemanuk state
|
|
|
* @param out Data out
|
|
|
- * @param outlen Length of output
|
|
|
+ * @param outlen Length of output in bytes
|
|
|
* @return CRYPT_OK on success
|
|
|
*/
|
|
|
int sosemanuk_keystream(sosemanuk_state *ss, unsigned char *out, unsigned long outlen)
|
|
@@ -801,7 +803,7 @@ int sosemanuk_keystream(sosemanuk_state *ss, unsigned char *out, unsigned long o
|
|
|
|
|
|
/*
|
|
|
* Terminate and clear Sosemanuk key context
|
|
|
- * @param kc The Sosemanuk key context
|
|
|
+ * @param ss The Sosemanuk state
|
|
|
* @return CRYPT_OK on success
|
|
|
*/
|
|
|
int sosemanuk_done(sosemanuk_state *ss)
|