diff options
author | kokke <spam@rowdy.dk> | 2021-01-06 02:35:05 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-06 02:35:05 +0100 |
commit | c3b7532b6deb507c40c0c53cc3c8b49a50766d9b (patch) | |
tree | c4d7196d5d175c41bf104bc13fd868bbaa85faf0 /aes.c | |
parent | Update README.md (diff) | |
parent | use size_t for buffer size and its indexes (diff) | |
download | tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.tar tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.tar.gz tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.tar.bz2 tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.tar.lz tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.tar.xz tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.tar.zst tiny-AES-c-c3b7532b6deb507c40c0c53cc3c8b49a50766d9b.zip |
Diffstat (limited to 'aes.c')
-rw-r--r-- | aes.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -498,9 +498,9 @@ static void XorWithIv(uint8_t* buf, const uint8_t* Iv) } } -void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint8_t* buf, uint32_t length) +void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint8_t* buf, size_t length) { - uintptr_t i; + size_t i; uint8_t *Iv = ctx->Iv; for (i = 0; i < length; i += AES_BLOCKLEN) { @@ -513,9 +513,9 @@ void AES_CBC_encrypt_buffer(struct AES_ctx *ctx, uint8_t* buf, uint32_t length) memcpy(ctx->Iv, Iv, AES_BLOCKLEN); } -void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length) +void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, size_t length) { - uintptr_t i; + size_t i; uint8_t storeNextIv[AES_BLOCKLEN]; for (i = 0; i < length; i += AES_BLOCKLEN) { @@ -535,11 +535,11 @@ void AES_CBC_decrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length) #if defined(CTR) && (CTR == 1) /* Symmetrical operation: same function for encrypting as for decrypting. Note any IV/nonce should never be reused with the same key */ -void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, uint32_t length) +void AES_CTR_xcrypt_buffer(struct AES_ctx* ctx, uint8_t* buf, size_t length) { uint8_t buffer[AES_BLOCKLEN]; - unsigned i; + size_t i; int bi; for (i = 0, bi = AES_BLOCKLEN; i < length; ++i, ++bi) { |