mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-01 19:54:40 +02:00
remove c++ comments, switch to c
This commit is contained in:
@@ -25,12 +25,14 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
//AES_CBC_encrypt (const unsigned char *in,
|
/*
|
||||||
// unsigned char *out,
|
AES_CBC_encrypt (const unsigned char *in,
|
||||||
// unsigned char ivec[16],
|
unsigned char *out,
|
||||||
// unsigned long length,
|
unsigned char ivec[16],
|
||||||
// const unsigned char *KS,
|
unsigned long length,
|
||||||
// int nr)
|
const unsigned char *KS,
|
||||||
|
int nr)
|
||||||
|
*/
|
||||||
.globl AES_CBC_encrypt
|
.globl AES_CBC_encrypt
|
||||||
AES_CBC_encrypt:
|
AES_CBC_encrypt:
|
||||||
# parameter 1: %rdi
|
# parameter 1: %rdi
|
||||||
@@ -82,12 +84,14 @@ ret
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//AES_CBC_decrypt (const unsigned char *in,
|
/*
|
||||||
// unsigned char *out,
|
AES_CBC_decrypt (const unsigned char *in,
|
||||||
// unsigned char ivec[16],
|
unsigned char *out,
|
||||||
// unsigned long length,
|
unsigned char ivec[16],
|
||||||
// const unsigned char *KS,
|
unsigned long length,
|
||||||
// int nr)
|
const unsigned char *KS,
|
||||||
|
int nr)
|
||||||
|
*/
|
||||||
.globl AES_CBC_decrypt
|
.globl AES_CBC_decrypt
|
||||||
AES_CBC_decrypt:
|
AES_CBC_decrypt:
|
||||||
# parameter 1: %rdi
|
# 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
|
.align 16,0x90
|
||||||
.globl AES_128_Key_Expansion
|
.globl AES_128_Key_Expansion
|
||||||
AES_128_Key_Expansion:
|
AES_128_Key_Expansion:
|
||||||
@@ -319,8 +325,10 @@ pxor %xmm2, %xmm1
|
|||||||
ret
|
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
|
.globl AES_192_Key_Expansion
|
||||||
AES_192_Key_Expansion:
|
AES_192_Key_Expansion:
|
||||||
# parameter 1: %rdi
|
# parameter 1: %rdi
|
||||||
@@ -403,8 +411,10 @@ pxor %xmm2, %xmm3
|
|||||||
ret
|
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
|
.globl AES_256_Key_Expansion
|
||||||
AES_256_Key_Expansion:
|
AES_256_Key_Expansion:
|
||||||
# parameter 1: %rdi
|
# parameter 1: %rdi
|
||||||
|
@@ -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,
|
static INLINE int blake2b_param_set_digest_length( blake2b_param *P,
|
||||||
const byte digest_length )
|
const byte digest_length )
|
||||||
{
|
{
|
||||||
@@ -322,20 +322,20 @@ int blake2b_update( blake2b_state *S, const byte *in, word64 inlen )
|
|||||||
|
|
||||||
if( inlen > fill )
|
if( inlen > fill )
|
||||||
{
|
{
|
||||||
XMEMCPY( S->buf + left, in, fill ); // Fill buffer
|
XMEMCPY( S->buf + left, in, fill ); /* Fill buffer */
|
||||||
S->buflen += fill;
|
S->buflen += fill;
|
||||||
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );
|
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 );
|
XMEMCPY( S->buf, S->buf + BLAKE2B_BLOCKBYTES, BLAKE2B_BLOCKBYTES );
|
||||||
// Shift buffer left
|
/* Shift buffer left */
|
||||||
S->buflen -= BLAKE2B_BLOCKBYTES;
|
S->buflen -= BLAKE2B_BLOCKBYTES;
|
||||||
in += fill;
|
in += fill;
|
||||||
inlen -= fill;
|
inlen -= fill;
|
||||||
}
|
}
|
||||||
else // inlen <= fill
|
else /* inlen <= fill */
|
||||||
{
|
{
|
||||||
XMEMCPY( S->buf + left, in, inlen );
|
XMEMCPY( S->buf + left, in, inlen );
|
||||||
S->buflen += inlen; // Be lazy, do not compress
|
S->buflen += inlen; /* Be lazy, do not compress */
|
||||||
in += inlen;
|
in += inlen;
|
||||||
inlen -= inlen;
|
inlen -= inlen;
|
||||||
}
|
}
|
||||||
|
@@ -90,7 +90,7 @@ static int Hash_df(RNG* rng, byte* out, word32 outSz, byte type, byte* inA, word
|
|||||||
byte ctr;
|
byte ctr;
|
||||||
int i;
|
int i;
|
||||||
int len;
|
int len;
|
||||||
word32 bits = (outSz * 8); // reverse byte order
|
word32 bits = (outSz * 8); /* reverse byte order */
|
||||||
|
|
||||||
#ifdef LITTLE_ENDIAN_ORDER
|
#ifdef LITTLE_ENDIAN_ORDER
|
||||||
bits = ByteReverseWord32(bits);
|
bits = ByteReverseWord32(bits);
|
||||||
|
@@ -71,17 +71,17 @@
|
|||||||
#pragma pack(push, 1)
|
#pragma pack(push, 1)
|
||||||
typedef struct __blake2s_param
|
typedef struct __blake2s_param
|
||||||
{
|
{
|
||||||
byte digest_length; // 1
|
byte digest_length; /* 1 */
|
||||||
byte key_length; // 2
|
byte key_length; /* 2 */
|
||||||
byte fanout; // 3
|
byte fanout; /* 3 */
|
||||||
byte depth; // 4
|
byte depth; /* 4 */
|
||||||
word32 leaf_length; // 8
|
word32 leaf_length; /* 8 */
|
||||||
byte node_offset[6];// 14
|
byte node_offset[6];/* 14 */
|
||||||
byte node_depth; // 15
|
byte node_depth; /* 15 */
|
||||||
byte inner_length; // 16
|
byte inner_length; /* 16 */
|
||||||
// byte reserved[0];
|
/* byte reserved[0]; */
|
||||||
byte salt[BLAKE2B_SALTBYTES]; // 24
|
byte salt[BLAKE2B_SALTBYTES]; /* 24 */
|
||||||
byte personal[BLAKE2S_PERSONALBYTES]; // 32
|
byte personal[BLAKE2S_PERSONALBYTES]; /* 32 */
|
||||||
} blake2s_param;
|
} blake2s_param;
|
||||||
|
|
||||||
ALIGN( 64 ) typedef struct __blake2s_state
|
ALIGN( 64 ) typedef struct __blake2s_state
|
||||||
@@ -96,17 +96,17 @@
|
|||||||
|
|
||||||
typedef struct __blake2b_param
|
typedef struct __blake2b_param
|
||||||
{
|
{
|
||||||
byte digest_length; // 1
|
byte digest_length; /* 1 */
|
||||||
byte key_length; // 2
|
byte key_length; /* 2 */
|
||||||
byte fanout; // 3
|
byte fanout; /* 3 */
|
||||||
byte depth; // 4
|
byte depth; /* 4 */
|
||||||
word32 leaf_length; // 8
|
word32 leaf_length; /* 8 */
|
||||||
word64 node_offset; // 16
|
word64 node_offset; /* 16 */
|
||||||
byte node_depth; // 17
|
byte node_depth; /* 17 */
|
||||||
byte inner_length; // 18
|
byte inner_length; /* 18 */
|
||||||
byte reserved[14]; // 32
|
byte reserved[14]; /* 32 */
|
||||||
byte salt[BLAKE2B_SALTBYTES]; // 48
|
byte salt[BLAKE2B_SALTBYTES]; /* 48 */
|
||||||
byte personal[BLAKE2B_PERSONALBYTES]; // 64
|
byte personal[BLAKE2B_PERSONALBYTES]; /* 64 */
|
||||||
} blake2b_param;
|
} blake2b_param;
|
||||||
|
|
||||||
ALIGN( 64 ) typedef struct __blake2b_state
|
ALIGN( 64 ) typedef struct __blake2b_state
|
||||||
@@ -136,7 +136,7 @@
|
|||||||
} blake2bp_state;
|
} blake2bp_state;
|
||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
|
|
||||||
// Streaming API
|
/* Streaming API */
|
||||||
int blake2s_init( blake2s_state *S, const byte outlen );
|
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_key( blake2s_state *S, const byte outlen, const void *key, const byte keylen );
|
||||||
int blake2s_init_param( blake2s_state *S, const blake2s_param *P );
|
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_update( blake2bp_state *S, const byte *in, word64 inlen );
|
||||||
int blake2bp_final( blake2bp_state *S, byte *out, byte outlen );
|
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 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 );
|
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 );
|
return blake2b( out, in, key, outlen, inlen, keylen );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* CTaoCrypt API */
|
||||||
|
|
||||||
#if defined(__cplusplus)
|
#if defined(__cplusplus)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user