Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/freebsd-src
Path: blob/main/sys/crypto/openssl/ossl_ppc.h
39483 views
1
/*
2
* Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
3
*
4
* Licensed under the OpenSSL license (the "License"). You may not use
5
* this file except in compliance with the License. You can obtain a copy
6
* in the file LICENSE in the source distribution or at
7
* https://www.openssl.org/source/license.html
8
*/
9
10
#ifndef __OSSL_PPC__
11
#define __OSSL_PPC__
12
13
#include <crypto/openssl/ossl.h>
14
#include <crypto/openssl/ossl_cipher.h>
15
16
extern unsigned int OPENSSL_ppccap_P;
17
18
/*
19
* Flags' usage can appear ambiguous, because they are set rather
20
* to reflect OpenSSL performance preferences than actual processor
21
* capabilities.
22
*/
23
# define PPC_FPU64 (1<<0)
24
# define PPC_ALTIVEC (1<<1)
25
# define PPC_CRYPTO207 (1<<2)
26
# define PPC_FPU (1<<3)
27
# define PPC_MADD300 (1<<4)
28
# define PPC_MFTB (1<<5)
29
# define PPC_MFSPR268 (1<<6)
30
31
/* aesp8-ppc.S */
32
ossl_cipher_encrypt_t aes_p8_cbc_encrypt;
33
/* vpaes-ppc.S */
34
ossl_cipher_encrypt_t vpaes_cbc_encrypt;
35
36
static void
37
AES_CBC_ENCRYPT(const unsigned char *in, unsigned char *out,
38
size_t length, const void *key, unsigned char *iv, int encrypt)
39
{
40
if (OPENSSL_ppccap_P & PPC_CRYPTO207)
41
aes_p8_cbc_encrypt(in, out, length, key, iv, encrypt);
42
else
43
vpaes_cbc_encrypt(in, out, length, key, iv, encrypt);
44
}
45
#endif
46
47