nrfxlib API 0.1.0
Loading...
Searching...
No Matches
ocrypto_aes_cbc_pkcs.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
20#ifndef OCRYPTO_AES_CBC_PKCS_H
21#define OCRYPTO_AES_CBC_PKCS_H
22
23#include <stddef.h>
24#include <stdint.h>
25
26
27#ifdef __cplusplus
28extern "C" {
29#endif
30
31
33typedef struct {
34 uint32_t xkey[60];
35 uint8_t iv[16];
36 uint8_t buffer[16];
37 uint8_t length;
38 uint8_t key_size;
39 uint8_t decrypt;
40 uint8_t iv_set;
41} ocrypto_aes_cbc_pkcs_ctx;
68 ocrypto_aes_cbc_pkcs_ctx *ctx,
69 const uint8_t *key, size_t size,
70 const uint8_t iv[16],
71 int decrypt);
72
87size_t ocrypto_aes_cbc_pkcs_output_size(ocrypto_aes_cbc_pkcs_ctx *ctx, size_t pt_len);
88
112 ocrypto_aes_cbc_pkcs_ctx *ctx,
113 uint8_t *out,
114 const uint8_t *in, size_t in_len);
115
122void ocrypto_aes_cbc_pkcs_final_enc(ocrypto_aes_cbc_pkcs_ctx *ctx, uint8_t ct[16]);
123
138int ocrypto_aes_cbc_pkcs_final_dec(ocrypto_aes_cbc_pkcs_ctx *ctx, uint8_t *pt, size_t *pt_len);
155 uint8_t* ct,
156 const uint8_t* pt, size_t pt_len,
157 const uint8_t *key, size_t size,
158 const uint8_t iv[16]);
159
178 uint8_t *pt, size_t *pt_len,
179 const uint8_t *ct, size_t ct_len,
180 const uint8_t *key, size_t size,
181 const uint8_t iv[16]);
182
183
184#ifdef __cplusplus
185}
186#endif
187
188#endif
189
int ocrypto_aes_cbc_pkcs_final_dec(ocrypto_aes_cbc_pkcs_ctx *ctx, uint8_t *pt, size_t *pt_len)
size_t ocrypto_aes_cbc_pkcs_output_size(ocrypto_aes_cbc_pkcs_ctx *ctx, size_t pt_len)
void ocrypto_aes_cbc_pkcs_init(ocrypto_aes_cbc_pkcs_ctx *ctx, const uint8_t *key, size_t size, const uint8_t iv[16], int decrypt)
int ocrypto_aes_cbc_pkcs_decrypt(uint8_t *pt, size_t *pt_len, const uint8_t *ct, size_t ct_len, const uint8_t *key, size_t size, const uint8_t iv[16])
void ocrypto_aes_cbc_pkcs_final_enc(ocrypto_aes_cbc_pkcs_ctx *ctx, uint8_t ct[16])
void ocrypto_aes_cbc_pkcs_update(ocrypto_aes_cbc_pkcs_ctx *ctx, uint8_t *out, const uint8_t *in, size_t in_len)
void ocrypto_aes_cbc_pkcs_encrypt(uint8_t *ct, const uint8_t *pt, size_t pt_len, const uint8_t *key, size_t size, const uint8_t iv[16])