Move algorithm specific ppccap code from crypto/ppccap.c
[openssl.git] / crypto / chacha / chacha_ppccap.c
1 /*
2  * Copyright 2009-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 #include <openssl/opensslconf.h>
11 #include <openssl/crypto.h>
12 #include "../ppc_arch.h"
13
14 #ifdef OPENSSL_NO_CHACHA
15 NON_EMPTY_TRANSLATION_UNIT
16 #else
17 void ChaCha20_ctr32_int(unsigned char *out, const unsigned char *inp,
18                         size_t len, const unsigned int key[8],
19                         const unsigned int counter[4]);
20 void ChaCha20_ctr32_vmx(unsigned char *out, const unsigned char *inp,
21                         size_t len, const unsigned int key[8],
22                         const unsigned int counter[4]);
23 void ChaCha20_ctr32(unsigned char *out, const unsigned char *inp,
24                     size_t len, const unsigned int key[8],
25                     const unsigned int counter[4])
26 {
27     OPENSSL_ppccap_P & PPC_ALTIVEC
28         ? ChaCha20_ctr32_vmx(out, inp, len, key, counter)
29         : ChaCha20_ctr32_int(out, inp, len, key, counter);
30 }
31 #endif