mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-08-14 01:53:41 +08:00
quantum init
This commit is contained in:
@@ -1,12 +1,4 @@
|
||||
/*
|
||||
* Copyright 2002-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
|
||||
*/
|
||||
|
||||
/* crypto/aes/aes_core.c */
|
||||
/**
|
||||
* rijndael-alg-fst.c
|
||||
*
|
||||
@@ -36,10 +28,14 @@
|
||||
/* Note: rewritten a little bit to provide error control and an OpenSSL-
|
||||
compatible API */
|
||||
|
||||
#ifndef AES_DEBUG
|
||||
# ifndef NDEBUG
|
||||
# define NDEBUG
|
||||
# endif
|
||||
#endif
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/aes.h>
|
||||
#include "aes_locl.h"
|
||||
|
||||
@@ -629,8 +625,8 @@ static const u32 rcon[] = {
|
||||
/**
|
||||
* Expand the cipher key into the encryption key schedule.
|
||||
*/
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, int bits,
|
||||
AES_KEY *key)
|
||||
int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
{
|
||||
|
||||
u32 *rk;
|
||||
@@ -644,9 +640,9 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
|
||||
|
||||
rk = key->rd_key;
|
||||
|
||||
if (bits == 128)
|
||||
if (bits==128)
|
||||
key->rounds = 10;
|
||||
else if (bits == 192)
|
||||
else if (bits==192)
|
||||
key->rounds = 12;
|
||||
else
|
||||
key->rounds = 14;
|
||||
@@ -731,8 +727,8 @@ int AES_set_encrypt_key(const unsigned char *userKey, int bits,
|
||||
/**
|
||||
* Expand the cipher key into the decryption key schedule.
|
||||
*/
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
{
|
||||
|
||||
u32 *rk;
|
||||
@@ -740,7 +736,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
u32 temp;
|
||||
|
||||
/* first, start with an encryption schedule */
|
||||
status = AES_set_encrypt_key(userKey, bits, key);
|
||||
status = private_AES_set_encrypt_key(userKey, bits, key);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
@@ -1208,11 +1204,11 @@ static const u32 rcon[] = {
|
||||
/**
|
||||
* Expand the cipher key into the encryption key schedule.
|
||||
*/
|
||||
int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
int private_AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
{
|
||||
u32 *rk;
|
||||
int i = 0;
|
||||
int i = 0;
|
||||
u32 temp;
|
||||
|
||||
if (!userKey || !key)
|
||||
@@ -1222,9 +1218,9 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
|
||||
rk = key->rd_key;
|
||||
|
||||
if (bits == 128)
|
||||
if (bits==128)
|
||||
key->rounds = 10;
|
||||
else if (bits == 192)
|
||||
else if (bits==192)
|
||||
key->rounds = 12;
|
||||
else
|
||||
key->rounds = 14;
|
||||
@@ -1309,8 +1305,8 @@ int AES_set_encrypt_key(const unsigned char *userKey, const int bits,
|
||||
/**
|
||||
* Expand the cipher key into the decryption key schedule.
|
||||
*/
|
||||
int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
int private_AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
AES_KEY *key)
|
||||
{
|
||||
|
||||
u32 *rk;
|
||||
@@ -1318,7 +1314,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
u32 temp;
|
||||
|
||||
/* first, start with an encryption schedule */
|
||||
status = AES_set_encrypt_key(userKey, bits, key);
|
||||
status = private_AES_set_encrypt_key(userKey, bits, key);
|
||||
if (status < 0)
|
||||
return status;
|
||||
|
||||
@@ -1355,7 +1351,7 @@ int AES_set_decrypt_key(const unsigned char *userKey, const int bits,
|
||||
rk[j] = tpe ^ ROTATE(tpd,16) ^
|
||||
ROTATE(tp9,24) ^ ROTATE(tpb,8);
|
||||
#else
|
||||
rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^
|
||||
rk[j] = tpe ^ (tpd >> 16) ^ (tpd << 16) ^
|
||||
(tp9 >> 8) ^ (tp9 << 24) ^
|
||||
(tpb >> 24) ^ (tpb << 8);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user