nrfxlib API 0.1.0
Loading...
Searching...
No Matches
ocrypto_aes_ctr.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2016 - 2024 Nordic Semiconductor ASA
3 * Copyright (c) since 2013 Oberon microsystems AG
4 *
5 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
6 */
7
8
28#ifndef OCRYPTO_AES_CTR_H
29#define OCRYPTO_AES_CTR_H
30
31#include <stddef.h>
32#include <stdint.h>
33
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
39
41typedef struct {
42 uint32_t xkey[60];
43 uint8_t counter[16];
44 uint8_t cipher[16];
45 uint32_t position; // Current position in cipher.
46 uint8_t key_size; // Key size (16, 24, or 32 bytes).
47} ocrypto_aes_ctr_ctx;
71void ocrypto_aes_ctr_init(ocrypto_aes_ctr_ctx *ctx, const uint8_t *key, size_t size, const uint8_t iv[16]);
72
89void ocrypto_aes_ctr_update(ocrypto_aes_ctr_ctx *ctx, uint8_t* ct, const uint8_t* pt, size_t pt_len);
105 uint8_t* ct, const uint8_t* pt, size_t pt_len, const uint8_t *key, size_t size, const uint8_t iv[16]);
106
120 uint8_t* pt, const uint8_t* ct, size_t ct_len, const uint8_t *key, size_t size, const uint8_t iv[16]);
121
122
123#ifdef __cplusplus
124}
125#endif
126
127#endif
128
void ocrypto_aes_ctr_decrypt(uint8_t *pt, const uint8_t *ct, size_t ct_len, const uint8_t *key, size_t size, const uint8_t iv[16])
void ocrypto_aes_ctr_init(ocrypto_aes_ctr_ctx *ctx, const uint8_t *key, size_t size, const uint8_t iv[16])
void ocrypto_aes_ctr_encrypt(uint8_t *ct, const uint8_t *pt, size_t pt_len, const uint8_t *key, size_t size, const uint8_t iv[16])
void ocrypto_aes_ctr_update(ocrypto_aes_ctr_ctx *ctx, uint8_t *ct, const uint8_t *pt, size_t pt_len)