Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
6c69e6f4
Unverified
Commit
6c69e6f4
authored
6 years ago
by
Koen Zandberg
Committed by
GitHub
6 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #10347 from mtausig/fixstyle
crypto: Fix code style
parents
64afc748
068e263c
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
sys/include/crypto/aes.h
+4
-4
4 additions, 4 deletions
sys/include/crypto/aes.h
sys/include/crypto/chacha.h
+2
-3
2 additions, 3 deletions
sys/include/crypto/chacha.h
sys/include/crypto/ciphers.h
+14
-14
14 additions, 14 deletions
sys/include/crypto/ciphers.h
with
20 additions
and
21 deletions
sys/include/crypto/aes.h
+
4
−
4
View file @
6c69e6f4
...
...
@@ -41,11 +41,11 @@ typedef uint8_t u8;
/* This controls loop-unrolling in aes_core.c */
#undef FULL_UNROLL
# define GETU32(pt) (((u32)(pt)[0] << 24) ^ ((u32)(pt)[1] << 16) ^ \
((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
((u32)(pt)[2] << 8) ^ ((u32)(pt)[3]))
# define PUTU32(ct, st) { (ct)[0] = (u8)((st) >> 24); \
(ct)[1] = (u8)((st) >> 16); \
(ct)[2] = (u8)((st) >> 8); \
(ct)[3] = (u8)(st); }
(ct)[1] = (u8)((st) >> 16); \
(ct)[2] = (u8)((st) >> 8); \
(ct)[3] = (u8)(st); }
#define AES_MAXNR 14
#define AES_BLOCK_SIZE 16
...
...
This diff is collapsed.
Click to expand it.
sys/include/crypto/chacha.h
+
2
−
3
View file @
6c69e6f4
...
...
@@ -45,10 +45,9 @@ extern "C" {
* @brief A ChaCha cipher stream context.
* @details Initialize with chacha_init().
*/
typedef
struct
{
typedef
struct
{
uint32_t
state
[
16
];
/**< The current state of the stream. */
uint8_t
rounds
;
/**< Number of iterations. */
uint8_t
rounds
;
/**< Number of iterations. */
}
chacha_ctx
;
/**
...
...
This diff is collapsed.
Click to expand it.
sys/include/crypto/ciphers.h
+
14
−
14
View file @
6c69e6f4
...
...
@@ -53,7 +53,7 @@ extern "C" {
#elif defined(CRYPTO_AES)
#define CIPHER_MAX_CONTEXT_SIZE CIPHERS_MAX_KEY_SIZE
#else
/
/ 0 is not a possibility because 0-sized arrays are not allowed in ISO C
/
*
0 is not a possibility because 0-sized arrays are not allowed in ISO C
*/
#define CIPHER_MAX_CONTEXT_SIZE 1
#endif
...
...
@@ -87,15 +87,15 @@ typedef struct cipher_interface_st {
uint8_t
max_key_size
;
/** the init function */
int
(
*
init
)(
cipher_context_t
*
ctx
,
const
uint8_t
*
key
,
uint8_t
key_size
);
int
(
*
init
)(
cipher_context_t
*
ctx
,
const
uint8_t
*
key
,
uint8_t
key_size
);
/** the encrypt function */
int
(
*
encrypt
)(
const
cipher_context_t
*
ctx
,
const
uint8_t
*
plain_block
,
uint8_t
*
cipher_block
);
int
(
*
encrypt
)(
const
cipher_context_t
*
ctx
,
const
uint8_t
*
plain_block
,
uint8_t
*
cipher_block
);
/** the decrypt function */
int
(
*
decrypt
)(
const
cipher_context_t
*
ctx
,
const
uint8_t
*
cipher_block
,
uint8_t
*
plain_block
);
int
(
*
decrypt
)(
const
cipher_context_t
*
ctx
,
const
uint8_t
*
cipher_block
,
uint8_t
*
plain_block
);
}
cipher_interface_t
;
...
...
@@ -109,10 +109,10 @@ extern const cipher_id_t CIPHER_AES_128;
* contains the cipher interface and the context
*/
typedef
struct
{
const
cipher_interface_t
*
interface
;
/**< BlockCipher-Interface for the
Cipher-Algorithms */
cipher_context_t
context
;
/**< The encryption context (buffer)
for the algorithm */
const
cipher_interface_t
*
interface
;
/**< BlockCipher-Interface for the
Cipher-Algorithms */
cipher_context_t
context
;
/**< The encryption context (buffer)
for the algorithm */
}
cipher_t
;
...
...
@@ -128,7 +128,7 @@ typedef struct {
* The command may be unsuccessful if the key size is not valid.
* CIPHER_ERR_BAD_CONTEXT_SIZE if CIPHER_MAX_CONTEXT_SIZE has not been defined (which means that the cipher has not been included in the build)
*/
int
cipher_init
(
cipher_t
*
cipher
,
cipher_id_t
cipher_id
,
const
uint8_t
*
key
,
int
cipher_init
(
cipher_t
*
cipher
,
cipher_id_t
cipher_id
,
const
uint8_t
*
key
,
uint8_t
key_size
);
...
...
@@ -141,7 +141,7 @@ int cipher_init(cipher_t* cipher, cipher_id_t cipher_id, const uint8_t* key,
* @param output pointer to allocated memory for encrypted data. It has to
* be of size BLOCK_SIZE
*/
int
cipher_encrypt
(
const
cipher_t
*
cipher
,
const
uint8_t
*
input
,
uint8_t
*
output
);
int
cipher_encrypt
(
const
cipher_t
*
cipher
,
const
uint8_t
*
input
,
uint8_t
*
output
);
/**
...
...
@@ -153,7 +153,7 @@ int cipher_encrypt(const cipher_t* cipher, const uint8_t* input, uint8_t* output
* @param output pointer to allocated memory for decrypted data. It has to
* be of size BLOCK_SIZE
*/
int
cipher_decrypt
(
const
cipher_t
*
cipher
,
const
uint8_t
*
input
,
uint8_t
*
output
);
int
cipher_decrypt
(
const
cipher_t
*
cipher
,
const
uint8_t
*
input
,
uint8_t
*
output
);
/**
...
...
@@ -162,7 +162,7 @@ int cipher_decrypt(const cipher_t* cipher, const uint8_t* input, uint8_t* output
*
* @param cipher Already initialized cipher struct
*/
int
cipher_get_block_size
(
const
cipher_t
*
cipher
);
int
cipher_get_block_size
(
const
cipher_t
*
cipher
);
#ifdef __cplusplus
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment