1e71b7053SJung-uk Kim /*
2b077aed3SPierre Pronchery * Copyright 2002-2020 The OpenSSL Project Authors. All Rights Reserved.
35c87c606SMark Murray *
4b077aed3SPierre Pronchery * Licensed under the Apache License 2.0 (the "License"). You may not use
5e71b7053SJung-uk Kim * this file except in compliance with the License. You can obtain a copy
6e71b7053SJung-uk Kim * in the file LICENSE in the source distribution or at
7e71b7053SJung-uk Kim * https://www.openssl.org/source/license.html
85c87c606SMark Murray */
95c87c606SMark Murray
10b077aed3SPierre Pronchery /*
11b077aed3SPierre Pronchery * AES_encrypt is deprecated - but we need to use it to implement these other
12b077aed3SPierre Pronchery * deprecated APIs.
13b077aed3SPierre Pronchery */
14b077aed3SPierre Pronchery #include "internal/deprecated.h"
15b077aed3SPierre Pronchery
165c87c606SMark Murray #include <openssl/aes.h>
171f13597dSJung-uk Kim #include <openssl/modes.h>
185c87c606SMark Murray
196f9291ceSJung-uk Kim /*
206f9291ceSJung-uk Kim * The input and output encrypted as though 128bit cfb mode is being used.
216f9291ceSJung-uk Kim * The extra state information to record how much of the 128bit block we have
226f9291ceSJung-uk Kim * used is contained in *num;
235c87c606SMark Murray */
245c87c606SMark Murray
AES_cfb128_encrypt(const unsigned char * in,unsigned char * out,size_t length,const AES_KEY * key,unsigned char * ivec,int * num,const int enc)255c87c606SMark Murray void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
261f13597dSJung-uk Kim size_t length, const AES_KEY *key,
276f9291ceSJung-uk Kim unsigned char *ivec, int *num, const int enc)
286f9291ceSJung-uk Kim {
295c87c606SMark Murray
306f9291ceSJung-uk Kim CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc,
316f9291ceSJung-uk Kim (block128_f) AES_encrypt);
326be8ae07SJacques Vidrine }
336be8ae07SJacques Vidrine
346be8ae07SJacques Vidrine /* N.B. This expects the input to be packed, MS bit first */
AES_cfb1_encrypt(const unsigned char * in,unsigned char * out,size_t length,const AES_KEY * key,unsigned char * ivec,int * num,const int enc)356be8ae07SJacques Vidrine void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
361f13597dSJung-uk Kim size_t length, const AES_KEY *key,
376be8ae07SJacques Vidrine unsigned char *ivec, int *num, const int enc)
386be8ae07SJacques Vidrine {
396f9291ceSJung-uk Kim CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
406f9291ceSJung-uk Kim (block128_f) AES_encrypt);
416be8ae07SJacques Vidrine }
426be8ae07SJacques Vidrine
AES_cfb8_encrypt(const unsigned char * in,unsigned char * out,size_t length,const AES_KEY * key,unsigned char * ivec,int * num,const int enc)436be8ae07SJacques Vidrine void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
441f13597dSJung-uk Kim size_t length, const AES_KEY *key,
456be8ae07SJacques Vidrine unsigned char *ivec, int *num, const int enc)
466be8ae07SJacques Vidrine {
476f9291ceSJung-uk Kim CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc,
486f9291ceSJung-uk Kim (block128_f) AES_encrypt);
496be8ae07SJacques Vidrine }
50