void bcal_cbc_encMsg(const void *iv, void *msg, uint16_t msg_blocks, bcal_cbc_ctx_t *ctx){ bcal_cbc_loadIV(iv, ctx); while(msg_blocks--){ bcal_cbc_encNext(msg, ctx); msg = (uint8_t*)msg + ctx->blocksize_B; } }
// prepare an encrypted to use for encrypting multiple blocks lateron. // key and iv are assumed to be both 192bit thus 24 uint8_t's aes_context aes192_cbc_enc_start(const uint8_t* key, const void* iv){ bcal_cbc_ctx_t* ctx = (bcal_cbc_ctx_t*)malloc(sizeof(bcal_cbc_ctx_t)); uint8_t r = bcal_cbc_init(&aes192_desc, key, 192, ctx); if (r) { free(ctx); return NULL; } bcal_cbc_loadIV(iv, ctx); return (aes_context)ctx; }