"Fossies" - the Fresh Open Source Software Archive

Member "nss-3.55/nss/lib/freebl/aes-armv8.h" (24 Jul 2020, 6253 Bytes) of package /linux/misc/nss-3.55.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "aes-armv8.h" see the Fossies "Dox" file reference documentation.

    1 /* This Source Code Form is subject to the terms of the Mozilla Public
    2  * License, v. 2.0. If a copy of the MPL was not distributed with this
    3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    4 
    5 SECStatus arm_aes_encrypt_ecb_128(AESContext *cx, unsigned char *output,
    6                                   unsigned int *outputLen,
    7                                   unsigned int maxOutputLen,
    8                                   const unsigned char *input,
    9                                   unsigned int inputLen,
   10                                   unsigned int blocksize);
   11 SECStatus arm_aes_decrypt_ecb_128(AESContext *cx, unsigned char *output,
   12                                   unsigned int *outputLen,
   13                                   unsigned int maxOutputLen,
   14                                   const unsigned char *input,
   15                                   unsigned int inputLen,
   16                                   unsigned int blocksize);
   17 SECStatus arm_aes_encrypt_cbc_128(AESContext *cx, unsigned char *output,
   18                                   unsigned int *outputLen,
   19                                   unsigned int maxOutputLen,
   20                                   const unsigned char *input,
   21                                   unsigned int inputLen,
   22                                   unsigned int blocksize);
   23 SECStatus arm_aes_decrypt_cbc_128(AESContext *cx, unsigned char *output,
   24                                   unsigned int *outputLen,
   25                                   unsigned int maxOutputLen,
   26                                   const unsigned char *input,
   27                                   unsigned int inputLen,
   28                                   unsigned int blocksize);
   29 SECStatus arm_aes_encrypt_ecb_192(AESContext *cx, unsigned char *output,
   30                                   unsigned int *outputLen,
   31                                   unsigned int maxOutputLen,
   32                                   const unsigned char *input,
   33                                   unsigned int inputLen,
   34                                   unsigned int blocksize);
   35 SECStatus arm_aes_decrypt_ecb_192(AESContext *cx, unsigned char *output,
   36                                   unsigned int *outputLen,
   37                                   unsigned int maxOutputLen,
   38                                   const unsigned char *input,
   39                                   unsigned int inputLen,
   40                                   unsigned int blocksize);
   41 SECStatus arm_aes_encrypt_cbc_192(AESContext *cx, unsigned char *output,
   42                                   unsigned int *outputLen,
   43                                   unsigned int maxOutputLen,
   44                                   const unsigned char *input,
   45                                   unsigned int inputLen,
   46                                   unsigned int blocksize);
   47 SECStatus arm_aes_decrypt_cbc_192(AESContext *cx, unsigned char *output,
   48                                   unsigned int *outputLen,
   49                                   unsigned int maxOutputLen,
   50                                   const unsigned char *input,
   51                                   unsigned int inputLen,
   52                                   unsigned int blocksize);
   53 SECStatus arm_aes_encrypt_ecb_256(AESContext *cx, unsigned char *output,
   54                                   unsigned int *outputLen,
   55                                   unsigned int maxOutputLen,
   56                                   const unsigned char *input,
   57                                   unsigned int inputLen,
   58                                   unsigned int blocksize);
   59 SECStatus arm_aes_decrypt_ecb_256(AESContext *cx, unsigned char *output,
   60                                   unsigned int *outputLen,
   61                                   unsigned int maxOutputLen,
   62                                   const unsigned char *input,
   63                                   unsigned int inputLen,
   64                                   unsigned int blocksize);
   65 SECStatus arm_aes_encrypt_cbc_256(AESContext *cx, unsigned char *output,
   66                                   unsigned int *outputLen,
   67                                   unsigned int maxOutputLen,
   68                                   const unsigned char *input,
   69                                   unsigned int inputLen,
   70                                   unsigned int blocksize);
   71 SECStatus arm_aes_decrypt_cbc_256(AESContext *cx, unsigned char *output,
   72                                   unsigned int *outputLen,
   73                                   unsigned int maxOutputLen,
   74                                   const unsigned char *input,
   75                                   unsigned int inputLen,
   76                                   unsigned int blocksize);
   77 
   78 #define native_aes_ecb_worker(encrypt, keysize)                          \
   79     ((encrypt)                                                           \
   80          ? ((keysize) == 16 ? arm_aes_encrypt_ecb_128                    \
   81                             : (keysize) == 24 ? arm_aes_encrypt_ecb_192  \
   82                                               : arm_aes_encrypt_ecb_256) \
   83          : ((keysize) == 16 ? arm_aes_decrypt_ecb_128                    \
   84                             : (keysize) == 24 ? arm_aes_decrypt_ecb_192  \
   85                                               : arm_aes_decrypt_ecb_256))
   86 
   87 #define native_aes_cbc_worker(encrypt, keysize)                          \
   88     ((encrypt)                                                           \
   89          ? ((keysize) == 16 ? arm_aes_encrypt_cbc_128                    \
   90                             : (keysize) == 24 ? arm_aes_encrypt_cbc_192  \
   91                                               : arm_aes_encrypt_cbc_256) \
   92          : ((keysize) == 16 ? arm_aes_decrypt_cbc_128                    \
   93                             : (keysize) == 24 ? arm_aes_decrypt_cbc_192  \
   94                                               : arm_aes_decrypt_cbc_256))
   95 
   96 #define native_aes_init(encrypt, keysize)           \
   97     do {                                            \
   98         if (encrypt) {                              \
   99             rijndael_key_expansion(cx, key, Nk);    \
  100         } else {                                    \
  101             rijndael_invkey_expansion(cx, key, Nk); \
  102         }                                           \
  103     } while (0)