• Menu
  • Product
  • Email
  • PDF
  • Order now
  • C Implementation of Cryptographic Algorithms

    • SLAA547C July   2013  – July 2021 MSP430FR5739

       

  • CONTENTS
  • SEARCH
  • C Implementation of Cryptographic Algorithms
  1. 1Software Benchmarks
    1. 1.1 AES Benchmarks
    2. 1.2 DES Benchmarks
    3. 1.3 SHA-2 Benchmarks
  2. 2Using Library Functions
    1. 2.1 AES 128
      1. 2.1.1 Encrypting With AES 128
      2. 2.1.2 Decrypting With AES 128
    2. 2.2 DES
      1. 2.2.1 Setting the Key Schedule for DES
      2. 2.2.2 Encrypting and Decryption With DES
      3. 2.2.3 Encryption and Decryption With DES CBC Mode
    3. 2.3 3DES
      1. 2.3.1 Encrypting and Decrypting With Triple DES
    4. 2.4 SHA-2
      1. 2.4.1 Hashing With SHA-256
      2. 2.4.2 Hashing With SHA-224
  3. 3Overview of Library Functions
    1. 3.1 AES 128
      1.      aes_enc_dec
      2.      aes_encrypt
    2. 3.2 DES and 3DES
      1.      Des_Key
      2.      Des_Enc
      3.      Des_Dec
      4.      DES_ENC_CBC
      5.      DES_DEC_CBC
      6.      TripleDES_ENC
      7.      TripleDES_DEC
      8.      TripleDES_ENC_CBC
      9.      TripleDES_DEC_CBC
    3. 3.3 SHA-256 and SHA-224
      1.      SHA_256
  4. 4Cryptographic Standard Definitions
    1. 4.1 AES
      1. 4.1.1 Basic Concept of Algorithm
      2. 4.1.2 Structure of Key and Input Data
      3. 4.1.3 Substitute Bytes (Subbytes Operation)
      4. 4.1.4 Shift Rows (Shiftrows Operation)
      5. 4.1.5 Mix Columns (Mixcolumns Operation)
      6. 4.1.6 Add Round Key (Addroundkey Operation)
      7. 4.1.7 Key Expansion (Keyexpansion Operation)
    2. 4.2 DES and 3DES
      1. 4.2.1 DES Algorithm Structure
      2. 4.2.2 The Function Block
      3. 4.2.3 Key Schedule
      4. 4.2.4 Triple DES
      5. 4.2.5 Cipher Block Chaining (CBC) Mode
    3. 4.3 SHA-256 and SHA-224
      1. 4.3.1 Message Padding and Parsing
      2. 4.3.2 SHA-256 Algorithm
      3. 4.3.3 Equations Found in SHA-256 Algorithm
      4. 4.3.4 SHA-224
  5. 5References
    1.     Revision History
  6. IMPORTANT NOTICE
search No matches found.
  • Full reading width
    • Full reading width
    • Comfortable reading width
    • Expanded reading width
  • Card for each section
  • Card with all content

 

APPLICATION NOTE

C Implementation of Cryptographic Algorithms

1 Software Benchmarks

All code was tested and benchmarked on the MSP430™ platform using IAR Embedded Workbench® IDE as the compiler tool. The optimization columns in the benchmark tables indicate the type of optimization used in IAR. Table 1-1 describes the settings used.

Table 1-1 Optimization Settings in IAR for Benchmark Testing
Optimized for Optimization Level Aggressive Unrolling Aggressive In-Lining
Size High => Size No No
Speed High => Speed Yes Yes

1.1 AES Benchmarks

Table 1-2 Benchmarks for AES Library Functions Encrypting One 16 Byte Block
AES (ENC/DES Function)OptimizationAES (ENC Only Function)Optimization
SpeedSizeSpeedSize
Memory (KB)RAM (B)3434Memory (KB)RAM (B)3434
Const0.550.55Const0.290.29
Code10.83Code0.670.51
Clock Cycles (kilo-cycles)7.912.3Clock Cycles (kilo-cycles)7.311.3

1.2 DES Benchmarks

Table 1-3 DES Code Size Benchmarks
DES Code SizeOptimization
SpeedSize
RAM (B)288288
Const (KB)2.32.3
Code (KB)3.32.17
Table 1-4 Performance of Several DES Modes
DES Clock Cycle Count (kilo-cycles)Optimization
SpeedSize
DES (FULL) (One Data Block)4142.6
3DES (FULL) (One Data Block)135.6143.1
DES Key Scheduler (EN0 or DE1 modes)34.736
DES Key Scheduler (ENDE mode)6972
DES Encode/Decode (One Data Block)2.73.8
DES CBC Encode/Decode (2-block chain)5.57.7
3DES CBC Encode/Decode (2-block chain)139149.7

1.3 SHA-2 Benchmarks

Table 1-5 Benchmarks for SHA-256 Library Function
SHA-256 (Data < 448 bits) (1)Optimization
SpeedSize
Memory (KB)RAM0.3280.328
Const0.2640.328
Code3.721.87
Clock Cycles (kilo cycles)34.1 (67)44.3 (86.7)
(1) Values in () indicate a hashing of 448 bits < Data< 960 bits or 2 blocks of data.

 

Texas Instruments

© Copyright 1995-2025 Texas Instruments Incorporated. All rights reserved.
Submit documentation feedback | IMPORTANT NOTICE | Trademarks | Privacy policy | Cookie policy | Terms of use | Terms of sale