Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
Tiny AES C
Commits
8526d395
Unverified
Commit
8526d395
authored
Dec 06, 2017
by
kokke
Committed by
GitHub
Dec 06, 2017
Browse files
Update aes.h
parent
e51538a3
Changes
1
Show whitespace changes
Inline
Side-by-side
aes.h
View file @
8526d395
...
...
@@ -48,18 +48,18 @@ struct AES_ctx {
#endif
};
void
AES_init_ctx
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
key
);
void
AES_init_ctx
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
key
);
#if defined(CBC) && (CBC == 1)
void
AES_init_ctx_iv
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
key
,
const
uint8_t
*
iv
);
void
AES_ctx_set_iv
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
iv
);
void
AES_init_ctx_iv
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
key
,
const
uint8_t
*
iv
);
void
AES_ctx_set_iv
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
iv
);
#endif
#if defined(ECB) && (ECB == 1)
// buffer size is exactly AES_BLOCKLEN bytes;
// you need only AES_init_ctx as Iv is not used in ECB
// NB: ECB s considered insecure
void
AES_ECB_encrypt
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
buf
);
void
AES_ECB_decrypt
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
buf
);
void
AES_ECB_encrypt
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
buf
);
void
AES_ECB_decrypt
(
struct
AES_ctx
*
ctx
,
const
uint8_t
*
buf
);
#endif // #if defined(ECB) && (ECB == !)
...
...
@@ -69,8 +69,8 @@ void AES_ECB_decrypt(struct AES_ctx *ctx, const uint8_t* buf);
// We suggest https://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7 if you need one
// you need to set iv in ctx via AES_init_ctx_iv or AES_ctx_set_iv
// NB: no IV should ever be reused with the same key
void
AES_CBC_encrypt_buffer
(
struct
AES_ctx
*
ctx
,
uint8_t
*
buf
,
uint32_t
length
);
void
AES_CBC_decrypt_buffer
(
struct
AES_ctx
*
ctx
,
uint8_t
*
buf
,
uint32_t
length
);
void
AES_CBC_encrypt_buffer
(
struct
AES_ctx
*
ctx
,
uint8_t
*
buf
,
uint32_t
length
);
void
AES_CBC_decrypt_buffer
(
struct
AES_ctx
*
ctx
,
uint8_t
*
buf
,
uint32_t
length
);
#endif // #if defined(CBC) && (CBC == 1)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment