diff --git a/ctaocrypt/src/aes_asm.s b/ctaocrypt/src/aes_asm.s index 458db1ae8..829b2fe14 100755 --- a/ctaocrypt/src/aes_asm.s +++ b/ctaocrypt/src/aes_asm.s @@ -25,12 +25,14 @@ */ -//AES_CBC_encrypt (const unsigned char *in, -// unsigned char *out, -// unsigned char ivec[16], -// unsigned long length, -// const unsigned char *KS, -// int nr) +/* +AES_CBC_encrypt (const unsigned char *in, + unsigned char *out, + unsigned char ivec[16], + unsigned long length, + const unsigned char *KS, + int nr) +*/ .globl AES_CBC_encrypt AES_CBC_encrypt: # parameter 1: %rdi @@ -82,12 +84,14 @@ ret -//AES_CBC_decrypt (const unsigned char *in, -// unsigned char *out, -// unsigned char ivec[16], -// unsigned long length, -// const unsigned char *KS, -// int nr) +/* +AES_CBC_decrypt (const unsigned char *in, + unsigned char *out, + unsigned char ivec[16], + unsigned long length, + const unsigned char *KS, + int nr) +*/ .globl AES_CBC_decrypt AES_CBC_decrypt: # parameter 1: %rdi @@ -260,8 +264,10 @@ ret -//void AES_128_Key_Expansion(const unsigned char* userkey, -// unsigned char* key_schedule); +/* +void AES_128_Key_Expansion(const unsigned char* userkey, + unsigned char* key_schedule); +*/ .align 16,0x90 .globl AES_128_Key_Expansion AES_128_Key_Expansion: @@ -319,8 +325,10 @@ pxor %xmm2, %xmm1 ret -//void AES_192_Key_Expansion (const unsigned char *userkey, -// unsigned char *key) +/* +void AES_192_Key_Expansion (const unsigned char *userkey, + unsigned char *key) +*/ .globl AES_192_Key_Expansion AES_192_Key_Expansion: # parameter 1: %rdi @@ -403,8 +411,10 @@ pxor %xmm2, %xmm3 ret -//void AES_256_Key_Expansion (const unsigned char *userkey, -// unsigned char *key) +/* +void AES_256_Key_Expansion (const unsigned char *userkey, + unsigned char *key) +*/ .globl AES_256_Key_Expansion AES_256_Key_Expansion: # parameter 1: %rdi diff --git a/ctaocrypt/src/blake2b.c b/ctaocrypt/src/blake2b.c index b8f871c76..1896d3430 100644 --- a/ctaocrypt/src/blake2b.c +++ b/ctaocrypt/src/blake2b.c @@ -104,7 +104,7 @@ static INLINE int blake2b_increment_counter( blake2b_state *S, const word64 -// Parameter-related functions +/* Parameter-related functions */ static INLINE int blake2b_param_set_digest_length( blake2b_param *P, const byte digest_length ) { @@ -322,20 +322,20 @@ int blake2b_update( blake2b_state *S, const byte *in, word64 inlen ) if( inlen > fill ) { - XMEMCPY( S->buf + left, in, fill ); // Fill buffer + XMEMCPY( S->buf + left, in, fill ); /* Fill buffer */ S->buflen += fill; blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES ); - blake2b_compress( S, S->buf ); // Compress + blake2b_compress( S, S->buf ); /* Compress */ XMEMCPY( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES ); - // Shift buffer left + /* Shift buffer left */ S->buflen -= BLAKE2B_BLOCKBYTES; in += fill; inlen -= fill; } - else // inlen <= fill + else /* inlen <= fill */ { XMEMCPY( S->buf + left, in, inlen ); - S->buflen += inlen; // Be lazy, do not compress + S->buflen += inlen; /* Be lazy, do not compress */ in += inlen; inlen -= inlen; } diff --git a/ctaocrypt/src/random.c b/ctaocrypt/src/random.c index 0828b56b1..931ea753e 100644 --- a/ctaocrypt/src/random.c +++ b/ctaocrypt/src/random.c @@ -90,7 +90,7 @@ static int Hash_df(RNG* rng, byte* out, word32 outSz, byte type, byte* inA, word byte ctr; int i; int len; - word32 bits = (outSz * 8); // reverse byte order + word32 bits = (outSz * 8); /* reverse byte order */ #ifdef LITTLE_ENDIAN_ORDER bits = ByteReverseWord32(bits); diff --git a/cyassl/ctaocrypt/blake2.h b/cyassl/ctaocrypt/blake2.h index bd03e6b33..a5983bb3a 100644 --- a/cyassl/ctaocrypt/blake2.h +++ b/cyassl/ctaocrypt/blake2.h @@ -71,17 +71,17 @@ #pragma pack(push, 1) typedef struct __blake2s_param { - byte digest_length; // 1 - byte key_length; // 2 - byte fanout; // 3 - byte depth; // 4 - word32 leaf_length; // 8 - byte node_offset[6];// 14 - byte node_depth; // 15 - byte inner_length; // 16 - // byte reserved[0]; - byte salt[BLAKE2B_SALTBYTES]; // 24 - byte personal[BLAKE2S_PERSONALBYTES]; // 32 + byte digest_length; /* 1 */ + byte key_length; /* 2 */ + byte fanout; /* 3 */ + byte depth; /* 4 */ + word32 leaf_length; /* 8 */ + byte node_offset[6];/* 14 */ + byte node_depth; /* 15 */ + byte inner_length; /* 16 */ + /* byte reserved[0]; */ + byte salt[BLAKE2B_SALTBYTES]; /* 24 */ + byte personal[BLAKE2S_PERSONALBYTES]; /* 32 */ } blake2s_param; ALIGN( 64 ) typedef struct __blake2s_state @@ -96,17 +96,17 @@ typedef struct __blake2b_param { - byte digest_length; // 1 - byte key_length; // 2 - byte fanout; // 3 - byte depth; // 4 - word32 leaf_length; // 8 - word64 node_offset; // 16 - byte node_depth; // 17 - byte inner_length; // 18 - byte reserved[14]; // 32 - byte salt[BLAKE2B_SALTBYTES]; // 48 - byte personal[BLAKE2B_PERSONALBYTES]; // 64 + byte digest_length; /* 1 */ + byte key_length; /* 2 */ + byte fanout; /* 3 */ + byte depth; /* 4 */ + word32 leaf_length; /* 8 */ + word64 node_offset; /* 16 */ + byte node_depth; /* 17 */ + byte inner_length; /* 18 */ + byte reserved[14]; /* 32 */ + byte salt[BLAKE2B_SALTBYTES]; /* 48 */ + byte personal[BLAKE2B_PERSONALBYTES]; /* 64 */ } blake2b_param; ALIGN( 64 ) typedef struct __blake2b_state @@ -136,7 +136,7 @@ } blake2bp_state; #pragma pack(pop) - // Streaming API + /* Streaming API */ int blake2s_init( blake2s_state *S, const byte outlen ); int blake2s_init_key( blake2s_state *S, const byte outlen, const void *key, const byte keylen ); int blake2s_init_param( blake2s_state *S, const blake2s_param *P ); @@ -159,7 +159,7 @@ int blake2bp_update( blake2bp_state *S, const byte *in, word64 inlen ); int blake2bp_final( blake2bp_state *S, byte *out, byte outlen ); - // Simple API + /* Simple API */ int blake2s( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen ); int blake2b( byte *out, const void *in, const void *key, const byte outlen, const word64 inlen, byte keylen ); @@ -171,6 +171,9 @@ return blake2b( out, in, key, outlen, inlen, keylen ); } + +/* CTaoCrypt API */ + #if defined(__cplusplus) } #endif