nuttx-update/include/crypto/rijndael.h
Alin Jerpelea 11183f68ab include/crypto/rijndael: migrate to SPDX identifier
Most tools used for compliance and SBOM generation use SPDX identifiers
This change brings us a step closer to an easy SBOM generation.

define NuttX local NuttX-PublicDomain identifier

 “Public Domain” is a concept distinct from copyright licensing;
it generally means that the work no longer has any copyright protection
or ownership, and therefore requires no license permission in order to
use, copy, modify, distribute, perform, display, etc.
In the United States – and many jurisdictions – copyright protections
attach automatically to creative works upon creation if they satisfy
certain minimum criteria.
“Public Domain” would thus represent a significant change to the legal
status of the work.
The rules around “Public Domain” often vary or are unspecified
jurisdiction to jurisdiction. Adding to the confusion, some
jurisdictions may not even recognize the concept of “Public Domain”
(or similar). As such, a license may nevertheless be required or implied
in these cases. Even in the U.S., there is no clear,
officially-sanctioned procedure for affirmatively placing
copyright-eligible works into the “Public Domain” aside from natural
statutory expiration of copyright. The bottom-line is, there are few if
any objective, brightline rules for proactively placing
copyright-eligible works into the Public Domain that we can broadly
rely on.

Signed-off-by: Alin Jerpelea <alin.jerpelea@sony.com>
2024-12-17 08:37:13 +08:00

67 lines
2.8 KiB
C

/****************************************************************************
* include/crypto/rijndael.h
*
* SPDX-License-Identifier: NuttX-PublicDomain
*
* SPDX-FileContributor: Vincent Rijmen <vincent.rijmen@esat.kuleuven.ac.be>
* SPDX-FileContributor: Antoon Bosselaers <antoon.bosselaers@esat.kuleuven.ac.be>
* SPDX-FileContributor: Paulo Barreto <paulo.barreto@terra.com.br>
*
* This code is hereby placed in the public domain.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS ''AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
* OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
* EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
****************************************************************************/
#ifndef __INCLUDE_CRYPTO_RIJNDAEL_H
#define __INCLUDE_CRYPTO_RIJNDAEL_H
/****************************************************************************
* Included Files
****************************************************************************/
#include <sys/types.h>
#define AES_MAXKEYBITS (256)
#define AES_MAXKEYBYTES (AES_MAXKEYBITS / 8)
/* for 256-bit keys, fewer for less */
#define AES_MAXROUNDS 14
/* The structure for key information */
typedef struct
{
int enc_only; /* context contains only encrypt schedule */
int nr; /* key-length-dependent number of rounds */
uint32_t ek[4 * (AES_MAXROUNDS + 1)]; /* encrypt key schedule */
uint32_t dk[4 * (AES_MAXROUNDS + 1)]; /* decrypt key schedule */
} rijndael_ctx;
int rijndael_set_key(FAR rijndael_ctx *, FAR const u_char *, int);
int rijndael_set_key_enc_only(FAR rijndael_ctx *, FAR const u_char *, int);
void rijndael_decrypt(FAR rijndael_ctx *, FAR const u_char *, FAR u_char *);
void rijndael_encrypt(FAR rijndael_ctx *, FAR const u_char *, FAR u_char *);
int rijndael_keysetupenc(unsigned int [],
const unsigned char [],
int);
int rijndael_keysetupdec(unsigned int [],
const unsigned char [],
int);
void rijndael_encrypt1(const unsigned int [],
int,
const unsigned char [],
unsigned char []);
#endif /* __INCLUDE_CRYPTO_RIJNDAEL_H */