|
Packit |
c4476c |
/*
|
|
Packit |
c4476c |
* Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit |
c4476c |
*
|
|
Packit |
c4476c |
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
Packit |
c4476c |
* this file except in compliance with the License. You can obtain a copy
|
|
Packit |
c4476c |
* in the file LICENSE in the source distribution or at
|
|
Packit |
c4476c |
* https://www.openssl.org/source/license.html
|
|
Packit |
c4476c |
*/
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
#include <openssl/aes.h>
|
|
Packit |
c4476c |
#include <openssl/modes.h>
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/*
|
|
Packit |
c4476c |
* The input and output encrypted as though 128bit cfb mode is being used.
|
|
Packit |
c4476c |
* The extra state information to record how much of the 128bit block we have
|
|
Packit |
c4476c |
* used is contained in *num;
|
|
Packit |
c4476c |
*/
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
void AES_cfb128_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const AES_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num, const int enc)
|
|
Packit |
c4476c |
{
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
CRYPTO_cfb128_encrypt(in, out, length, key, ivec, num, enc,
|
|
Packit |
c4476c |
(block128_f) AES_encrypt);
|
|
Packit |
c4476c |
}
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
/* N.B. This expects the input to be packed, MS bit first */
|
|
Packit |
c4476c |
void AES_cfb1_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const AES_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num, const int enc)
|
|
Packit |
c4476c |
{
|
|
Packit |
c4476c |
CRYPTO_cfb128_1_encrypt(in, out, length, key, ivec, num, enc,
|
|
Packit |
c4476c |
(block128_f) AES_encrypt);
|
|
Packit |
c4476c |
}
|
|
Packit |
c4476c |
|
|
Packit |
c4476c |
void AES_cfb8_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit |
c4476c |
size_t length, const AES_KEY *key,
|
|
Packit |
c4476c |
unsigned char *ivec, int *num, const int enc)
|
|
Packit |
c4476c |
{
|
|
Packit |
c4476c |
CRYPTO_cfb128_8_encrypt(in, out, length, key, ivec, num, enc,
|
|
Packit |
c4476c |
(block128_f) AES_encrypt);
|
|
Packit |
c4476c |
}
|