AES-CBC OpenSSL assembly is used underneath. The glue layer(ossl_aes.c) is based on CHACHA20 implementation. Contrary to the SHA and CHACHA20, AES OpenSSL assembly logic does not have a fallback implementation in case CPU doesn't support required instructions. Because of that CPU caps are checked during initialization and AES support is advertised only if available. The feature is available on all architectures that ossl supports: i386, amd64, arm64. The biggest advantage of this patch over existing solutions (aesni(4) and armv8crypto(4)) is that it supports SHA, allowing for ETA operations. Sponsored by: Stormshield Obtained from: Semihalf Reviewed by: jhb (previous version) Differential revision: https://reviews.freebsd.org/D32099
32 lines
933 B
C
32 lines
933 B
C
/*
|
|
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
*
|
|
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
* this file except in compliance with the License. You can obtain a copy
|
|
* in the file LICENSE in the source distribution or at
|
|
* https://www.openssl.org/source/license.html
|
|
*/
|
|
|
|
#ifndef __OSSL_AARCH64__
|
|
#define __OSSL_AARCH64__
|
|
|
|
#include <crypto/openssl/ossl.h>
|
|
#include <crypto/openssl/ossl_cipher.h>
|
|
#include <crypto/openssl/aarch64/arm_arch.h>
|
|
|
|
/* aesv8-armx.S */
|
|
ossl_cipher_encrypt_t aes_v8_cbc_encrypt;
|
|
/* vpaes-armv8.S */
|
|
ossl_cipher_encrypt_t vpaes_cbc_encrypt;
|
|
|
|
static void
|
|
AES_CBC_ENCRYPT(const unsigned char *in, unsigned char *out,
|
|
size_t length, const void *key, unsigned char *iv, int encrypt)
|
|
{
|
|
if (OPENSSL_armcap_P & ARMV8_AES)
|
|
aes_v8_cbc_encrypt(in, out, length, key, iv, encrypt);
|
|
else
|
|
vpaes_cbc_encrypt(in, out, length, key, iv, encrypt);
|
|
}
|
|
#endif
|