Blame crypto/camellia/cmll_misc.c
|
Packit Service |
084de1 |
/*
|
|
Packit Service |
084de1 |
* Copyright 2006-2016 The OpenSSL Project Authors. All Rights Reserved.
|
|
Packit Service |
084de1 |
*
|
|
Packit Service |
084de1 |
* Licensed under the OpenSSL license (the "License"). You may not use
|
|
Packit Service |
084de1 |
* this file except in compliance with the License. You can obtain a copy
|
|
Packit Service |
084de1 |
* in the file LICENSE in the source distribution or at
|
|
Packit Service |
084de1 |
* https://www.openssl.org/source/license.html
|
|
Packit Service |
084de1 |
*/
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
#include <openssl/opensslv.h>
|
|
Packit Service |
084de1 |
#include <openssl/camellia.h>
|
|
Packit Service |
084de1 |
#include "cmll_local.h"
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
int Camellia_set_key(const unsigned char *userKey, const int bits,
|
|
Packit Service |
084de1 |
CAMELLIA_KEY *key)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
if (!userKey || !key)
|
|
Packit Service |
084de1 |
return -1;
|
|
Packit Service |
084de1 |
if (bits != 128 && bits != 192 && bits != 256)
|
|
Packit Service |
084de1 |
return -2;
|
|
Packit Service |
084de1 |
key->grand_rounds = Camellia_Ekeygen(bits, userKey, key->u.rd_key);
|
|
Packit Service |
084de1 |
return 0;
|
|
Packit Service |
084de1 |
}
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
void Camellia_encrypt(const unsigned char *in, unsigned char *out,
|
|
Packit Service |
084de1 |
const CAMELLIA_KEY *key)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
Camellia_EncryptBlock_Rounds(key->grand_rounds, in, key->u.rd_key, out);
|
|
Packit Service |
084de1 |
}
|
|
Packit Service |
084de1 |
|
|
Packit Service |
084de1 |
void Camellia_decrypt(const unsigned char *in, unsigned char *out,
|
|
Packit Service |
084de1 |
const CAMELLIA_KEY *key)
|
|
Packit Service |
084de1 |
{
|
|
Packit Service |
084de1 |
Camellia_DecryptBlock_Rounds(key->grand_rounds, in, key->u.rd_key, out);
|
|
Packit Service |
084de1 |
}
|