Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 68ace624 authored by Anton Saraev's avatar Anton Saraev Committed by Greg Kroah-Hartman
Browse files

staging: crypto: skein: rename camelcase functions



camelCase is not accepted in the Linux Kernel. To prepare skein
driver for mainline inclusion, we rename all functions to
non-camelCase equivalents.

Signed-off-by: default avatarAnton Saraev <antonysaraev@gmail.com>
Reviewed-by: default avatarJake Edge <jake@lwn.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 6559e221
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
skein/threefish TODO

 - rename camelcase vars
 - rename camelcase functions
 - rename files
 - move macros into appropriate header files
 - add / pass test vectors
+33 −33
Original line number Diff line number Diff line
@@ -87,58 +87,58 @@ struct skein1024_ctx { /* 1024-bit Skein hash context structure */
};

/* Skein APIs for (incremental) "straight hashing" */
int  Skein_256_Init(struct skein_256_ctx *ctx, size_t hashBitLen);
int  Skein_512_Init(struct skein_512_ctx *ctx, size_t hashBitLen);
int  Skein1024_Init(struct skein1024_ctx *ctx, size_t hashBitLen);
int skein_256_init(struct skein_256_ctx *ctx, size_t hashBitLen);
int skein_512_init(struct skein_512_ctx *ctx, size_t hashBitLen);
int skein_1024_init(struct skein1024_ctx *ctx, size_t hashBitLen);

int  Skein_256_Update(struct skein_256_ctx *ctx, const u8 *msg,
int skein_256_update(struct skein_256_ctx *ctx, const u8 *msg,
		     size_t msgByteCnt);
int  Skein_512_Update(struct skein_512_ctx *ctx, const u8 *msg,
int skein_512_update(struct skein_512_ctx *ctx, const u8 *msg,
		     size_t msgByteCnt);
int  Skein1024_Update(struct skein1024_ctx *ctx, const u8 *msg,
int skein_1024_update(struct skein1024_ctx *ctx, const u8 *msg,
		      size_t msgByteCnt);

int  Skein_256_Final(struct skein_256_ctx *ctx, u8 *hashVal);
int  Skein_512_Final(struct skein_512_ctx *ctx, u8 *hashVal);
int  Skein1024_Final(struct skein1024_ctx *ctx, u8 *hashVal);
int skein_256_final(struct skein_256_ctx *ctx, u8 *hashVal);
int skein_512_final(struct skein_512_ctx *ctx, u8 *hashVal);
int skein_1024_final(struct skein1024_ctx *ctx, u8 *hashVal);

/*
**   Skein APIs for "extended" initialization: MAC keys, tree hashing.
**   After an InitExt() call, just use Update/Final calls as with Init().
**   After an init_ext() call, just use update/final calls as with init().
**
**   Notes: Same parameters as _Init() calls, plus treeInfo/key/keyBytes.
**   Notes: Same parameters as _init() calls, plus treeInfo/key/keyBytes.
**          When keyBytes == 0 and treeInfo == SKEIN_SEQUENTIAL,
**              the results of InitExt() are identical to calling Init().
**          The function Init() may be called once to "precompute" the IV for
**              the results of init_ext() are identical to calling init().
**          The function init() may be called once to "precompute" the IV for
**              a given hashBitLen value, then by saving a copy of the context
**              the IV computation may be avoided in later calls.
**          Similarly, the function InitExt() may be called once per MAC key
**          Similarly, the function init_ext() may be called once per MAC key
**              to precompute the MAC IV, then a copy of the context saved and
**              reused for each new MAC computation.
**/
int  Skein_256_InitExt(struct skein_256_ctx *ctx, size_t hashBitLen,
int skein_256_init_ext(struct skein_256_ctx *ctx, size_t hashBitLen,
		       u64 treeInfo, const u8 *key, size_t keyBytes);
int  Skein_512_InitExt(struct skein_512_ctx *ctx, size_t hashBitLen,
int skein_512_init_ext(struct skein_512_ctx *ctx, size_t hashBitLen,
		       u64 treeInfo, const u8 *key, size_t keyBytes);
int  Skein1024_InitExt(struct skein1024_ctx *ctx, size_t hashBitLen,
int skein_1024_init_ext(struct skein1024_ctx *ctx, size_t hashBitLen,
			u64 treeInfo, const u8 *key, size_t keyBytes);

/*
**   Skein APIs for MAC and tree hash:
**      Final_Pad:  pad, do final block, but no OUTPUT type
**      Output:     do just the output stage
**      final_pad:  pad, do final block, but no OUTPUT type
**      output:     do just the output stage
*/
int  Skein_256_Final_Pad(struct skein_256_ctx *ctx, u8 *hashVal);
int  Skein_512_Final_Pad(struct skein_512_ctx *ctx, u8 *hashVal);
int  Skein1024_Final_Pad(struct skein1024_ctx *ctx, u8 *hashVal);
int skein_256_final_pad(struct skein_256_ctx *ctx, u8 *hashVal);
int skein_512_final_pad(struct skein_512_ctx *ctx, u8 *hashVal);
int skein_1024_final_pad(struct skein1024_ctx *ctx, u8 *hashVal);

#ifndef SKEIN_TREE_HASH
#define SKEIN_TREE_HASH (1)
#endif
#if  SKEIN_TREE_HASH
int  Skein_256_Output(struct skein_256_ctx *ctx, u8 *hashVal);
int  Skein_512_Output(struct skein_512_ctx *ctx, u8 *hashVal);
int  Skein1024_Output(struct skein1024_ctx *ctx, u8 *hashVal);
int skein_256_output(struct skein_256_ctx *ctx, u8 *hashVal);
int skein_512_output(struct skein_512_ctx *ctx, u8 *hashVal);
int skein_1024_output(struct skein1024_ctx *ctx, u8 *hashVal);
#endif

/*****************************************************************
+19 −19
Original line number Diff line number Diff line
@@ -50,31 +50,31 @@ OTHER DEALINGS IN THE SOFTWARE.
 * struct skein_ctx ctx;             // a Skein hash or MAC context
 *
 * // prepare context, here for a Skein with a state size of 512 bits.
 * skeinCtxPrepare(&ctx, Skein512);
 * skein_ctx_prepare(&ctx, Skein512);
 *
 * // Initialize the context to set the requested hash length in bits
 * // here request a output hash size of 31 bits (Skein supports variable
 * // output sizes even very strange sizes)
 * skeinInit(&ctx, 31);
 * skein_init(&ctx, 31);
 *
 * // Now update Skein with any number of message bits. A function that
 * // takes a number of bytes is also available.
 * skeinUpdateBits(&ctx, message, msgLength);
 * skein_update_bits(&ctx, message, msgLength);
 *
 * // Now get the result of the Skein hash. The output buffer must be
 * // large enough to hold the request number of output bits. The application
 * // may now extract the bits.
 * skeinFinal(&ctx, result);
 * skein_final(&ctx, result);
 * ...
 * @endcode
 *
 * An application may use @c skeinReset to reset a Skein context and use
 * An application may use @c skein_reset to reset a Skein context and use
 * it for creation of another hash with the same Skein state size and output
 * bit length. In this case the API implementation restores some internal
 * internal state data and saves a full Skein initialization round.
 *
 * To create a MAC the application just uses @c skeinMacInit instead of
 * @c skeinInit. All other functions calls remain the same.
 * To create a MAC the application just uses @c skein_mac_init instead of
 * @c skein_init. All other functions calls remain the same.
 *
 */

@@ -123,7 +123,7 @@ struct skein_ctx {
 * @return
 *     SKEIN_SUCESS of SKEIN_FAIL
 */
int skeinCtxPrepare(struct skein_ctx *ctx, enum skein_size size);
int skein_ctx_prepare(struct skein_ctx *ctx, enum skein_size size);

/**
 * Initialize a Skein context.
@@ -137,9 +137,9 @@ int skeinCtxPrepare(struct skein_ctx *ctx, enum skein_size size);
 *     Number of MAC hash bits to compute
 * @return
 *     SKEIN_SUCESS of SKEIN_FAIL
 * @see skeinReset
 * @see skein_reset
 */
int skeinInit(struct skein_ctx *ctx, size_t hashBitLen);
int skein_init(struct skein_ctx *ctx, size_t hashBitLen);

/**
 * Resets a Skein context for further use.
@@ -151,7 +151,7 @@ int skeinInit(struct skein_ctx *ctx, size_t hashBitLen);
 * @param ctx
 *     Pointer to a pre-initialized Skein MAC context
 */
void skeinReset(struct skein_ctx *ctx);
void skein_reset(struct skein_ctx *ctx);

/**
 * Initializes a Skein context for MAC usage.
@@ -173,7 +173,7 @@ void skeinReset(struct skein_ctx *ctx);
 * @return
 *     SKEIN_SUCESS of SKEIN_FAIL
 */
int skeinMacInit(struct skein_ctx *ctx, const u8 *key, size_t keyLen,
int skein_mac_init(struct skein_ctx *ctx, const u8 *key, size_t keyLen,
		   size_t hashBitLen);

/**
@@ -188,7 +188,7 @@ int skeinMacInit(struct skein_ctx *ctx, const u8 *key, size_t keyLen,
 * @return
 *     Success or error code.
 */
int skeinUpdate(struct skein_ctx *ctx, const u8 *msg,
int skein_update(struct skein_ctx *ctx, const u8 *msg,
		 size_t msgByteCnt);

/**
@@ -204,7 +204,7 @@ int skeinUpdate(struct skein_ctx *ctx, const u8 *msg,
 * @param msgBitCnt
 *     Length of the message in @b bits.
 */
int skeinUpdateBits(struct skein_ctx *ctx, const u8 *msg,
int skein_update_bits(struct skein_ctx *ctx, const u8 *msg,
		      size_t msgBitCnt);

/**
@@ -220,9 +220,9 @@ int skeinUpdateBits(struct skein_ctx *ctx, const u8 *msg,
 *     enough to store @c hashBitLen bits.
 * @return
 *     Success or error code.
 * @see skeinReset
 * @see skein_reset
 */
int skeinFinal(struct skein_ctx *ctx, u8 *hash);
int skein_final(struct skein_ctx *ctx, u8 *hash);

/**
 * @}
+6 −6
Original line number Diff line number Diff line
@@ -12,11 +12,11 @@

#include <skein.h> /* get the Skein API definitions   */

void Skein_256_Process_Block(struct skein_256_ctx *ctx, const u8 *blkPtr,
void skein_256_process_block(struct skein_256_ctx *ctx, const u8 *blkPtr,
			     size_t blkCnt, size_t byteCntAdd);
void Skein_512_Process_Block(struct skein_512_ctx *ctx, const u8 *blkPtr,
void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blkPtr,
			     size_t blkCnt, size_t byteCntAdd);
void Skein1024_Process_Block(struct skein1024_ctx *ctx, const u8 *blkPtr,
void skein_1024_process_block(struct skein1024_ctx *ctx, const u8 *blkPtr,
			      size_t blkCnt, size_t byteCntAdd);

#endif
+25 −19
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@
    struct threefish_key keyCtx;

    // Initialize the context
    threefishSetKey(&keyCtx, Threefish512, key, tweak);
    threefish_set_key(&keyCtx, Threefish512, key, tweak);

    // Encrypt
    threefishEncryptBlockBytes(&keyCtx, input, cipher);
    threefish_encrypt_block_bytes(&keyCtx, input, cipher);
@endcode
 */

@@ -72,7 +72,7 @@ struct threefish_key {
 * @param tweak
 *     Pointer to the two tweak words (word has 64 bits).
 */
void threefishSetKey(struct threefish_key *keyCtx,
void threefish_set_key(struct threefish_key *keyCtx,
		       enum threefish_size stateSize,
		       u64 *keyData, u64 *tweak);

@@ -91,7 +91,8 @@ void threefishSetKey(struct threefish_key *keyCtx,
 * @param out
 *     Pointer to cipher buffer.
 */
void threefishEncryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out);
void threefish_encrypt_block_bytes(struct threefish_key *keyCtx, u8 *in,
				   u8 *out);

/**
 * Encrypt Threefisch block (words).
@@ -110,7 +111,7 @@ void threefishEncryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out);
 * @param out
 *     Pointer to cipher buffer.
 */
void threefishEncryptBlockWords(struct threefish_key *keyCtx, u64 *in,
void threefish_encrypt_block_words(struct threefish_key *keyCtx, u64 *in,
				   u64 *out);

/**
@@ -128,7 +129,8 @@ void threefishEncryptBlockWords(struct threefish_key *keyCtx, u64 *in,
 * @param out
 *     Pointer to plaintext buffer.
 */
void threefishDecryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out);
void threefish_decrypt_block_bytes(struct threefish_key *keyCtx, u8 *in,
				   u8 *out);

/**
 * Decrypt Threefisch block (words).
@@ -147,16 +149,20 @@ void threefishDecryptBlockBytes(struct threefish_key *keyCtx, u8 *in, u8 *out);
 * @param out
 *     Pointer to plaintext buffer.
 */
void threefishDecryptBlockWords(struct threefish_key *keyCtx, u64 *in,
void threefish_decrypt_block_words(struct threefish_key *keyCtx, u64 *in,
				   u64 *out);

void threefishEncrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishEncrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishEncrypt1024(struct threefish_key *keyCtx, u64 *input,
void threefish_encrypt_256(struct threefish_key *keyCtx, u64 *input,
			   u64 *output);
void threefishDecrypt256(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishDecrypt512(struct threefish_key *keyCtx, u64 *input, u64 *output);
void threefishDecrypt1024(struct threefish_key *keyCtx, u64 *input,
void threefish_encrypt_512(struct threefish_key *keyCtx, u64 *input,
			   u64 *output);
void threefish_encrypt_1024(struct threefish_key *keyCtx, u64 *input,
			    u64 *output);
void threefish_decrypt_256(struct threefish_key *keyCtx, u64 *input,
			   u64 *output);
void threefish_decrypt_512(struct threefish_key *keyCtx, u64 *input,
			   u64 *output);
void threefish_decrypt_1024(struct threefish_key *keyCtx, u64 *input,
			    u64 *output);
/**
 * @}
Loading