/*
- * Copyright 2017 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2017-2021 The OpenSSL Project Authors. All Rights Reserved.
* Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
*/
#include <openssl/e_os2.h>
-#include "internal/aria.h"
+#include "crypto/aria.h"
#include <assert.h>
#include <string.h>
(Y) = (TMP2) ^ rotr32((TMP) ^ (TMP2), 16); \
} while(0)
-void aria_encrypt(const unsigned char *in, unsigned char *out,
- const ARIA_KEY *key)
+void ossl_aria_encrypt(const unsigned char *in, unsigned char *out,
+ const ARIA_KEY *key)
{
register uint32_t reg0, reg1, reg2, reg3;
int Nr;
PUT_U32_BE(out, 3, reg3);
}
-int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
- ARIA_KEY *key)
+int ossl_aria_set_encrypt_key(const unsigned char *userKey, const int bits,
+ ARIA_KEY *key)
{
register uint32_t reg0, reg1, reg2, reg3;
uint32_t w0[4], w1[4], w2[4], w3[4];
return 0;
}
-int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
- ARIA_KEY *key)
+int ossl_aria_set_decrypt_key(const unsigned char *userKey, const int bits,
+ ARIA_KEY *key)
{
ARIA_u128 *rk_head;
ARIA_u128 *rk_tail;
register uint32_t reg0, reg1, reg2, reg3;
uint32_t s0, s1, s2, s3;
- const int r = aria_set_encrypt_key(userKey, bits, key);
+ const int r = ossl_aria_set_encrypt_key(userKey, bits, key);
if (r != 0) {
return r;
{
unsigned int i;
for (i = 0; i < ARIA_BLOCK_SIZE; i += 4) {
- o[i ] = sb3[x->c[i ] ^ y->c[i ]];
+ o[i ] = sb3[x->c[i ] ^ y->c[i ]];
o[i + 1] = sb4[x->c[i + 1] ^ y->c[i + 1]];
o[i + 2] = sb1[x->c[i + 2] ^ y->c[i + 2]];
o[i + 3] = sb2[x->c[i + 3] ^ y->c[i + 3]];
* Encrypt a single block
* in and out can overlap
*/
-void aria_encrypt(const unsigned char *in, unsigned char *out,
- const ARIA_KEY *key)
+void ossl_aria_encrypt(const unsigned char *in, unsigned char *out,
+ const ARIA_KEY *key)
{
assert(in != NULL && out != NULL && key != NULL);
do_encrypt(out, in, key->rounds, key->rd_key);
* We short circuit execution of the last two
* or four rotations based on the key size.
*/
-int aria_set_encrypt_key(const unsigned char *userKey, const int bits,
- ARIA_KEY *key)
+int ossl_aria_set_encrypt_key(const unsigned char *userKey, const int bits,
+ ARIA_KEY *key)
{
const ARIA_u128 *ck1, *ck2, *ck3;
ARIA_u128 kr, w0, w1, w2, w3;
/*
* Expand the cipher key into the decryption key schedule.
*/
-int aria_set_decrypt_key(const unsigned char *userKey, const int bits,
- ARIA_KEY *key)
+int ossl_aria_set_decrypt_key(const unsigned char *userKey, const int bits,
+ ARIA_KEY *key)
{
ARIA_KEY ek;
- const int r = aria_set_encrypt_key(userKey, bits, &ek);
+ const int r = ossl_aria_set_encrypt_key(userKey, bits, &ek);
unsigned int i, rounds = ek.rounds;
if (r == 0) {