ct += nblocks;
    nbytes -= nblocks;
#endif
  }

    while (nbytes != 0) {
        if (pad_len == CCAES_BLOCK_SIZE) {
            ccaes_arm_encrypt(pad, pad, (const ccaes_arm_encrypt_ctx*) ecb_key);
            pad_len = 0;
        }

        *ct++ = *pt++ ^ pad[pad_len++];
        nbytes--;
    }
    CCMODE_OFB_KEY_PAD_LEN(key) = pad_len;

}

const struct ccmode_ofb ccaes_arm_ofb_crypt_mode = {
    .size = ccn_sizeof_size(sizeof(ccofb_ctx)) + 2 * sizeof(ccaes_arm_encrypt_ctx),
    .block_size = 1,
    .init = ccmode_ofb_init,
    .ofb = ccaes_ofb_crypt_vng,
    .custom = (&ccaes_arm_ecb_encrypt_mode), \
};


#endif

#endif /* __NO_ASM__ */
示例#2
0
                                    void *out)
{
    printf("%s\n", __func__);

    AES128_ECB_encrypt((struct _pdcmode_aes128_ctx *)ctx, nblocks, in, out);
}

static void pdcmode_aes_ecb_decrypt(const ccecb_ctx *ctx,
                                    unsigned long nblocks,
                                    const void *in,
                                    void *out)
{
    printf("%s\n", __func__);

    AES128_ECB_decrypt((struct _pdcmode_aes128_ctx *)ctx, nblocks, in, out);
}

const struct ccmode_ecb pdcaes_ecb_encrypt = {
    .size = ccn_sizeof_size(sizeof(struct _pdcmode_aes128_ctx)),
    .block_size = CCAES_BLOCK_SIZE,
    .init = pdcmode_aes_ecb_init,
    .ecb = pdcmode_aes_ecb_encrypt
};

const struct ccmode_ecb pdcaes_ecb_decrypt = {
    .size = ccn_sizeof_size(sizeof(struct _pdcmode_aes128_ctx)),
    .block_size = CCAES_BLOCK_SIZE,
    .init = pdcmode_aes_ecb_init,
    .ecb = pdcmode_aes_ecb_decrypt
};