Appendix C: DBMS_CRYPTO Performance Test Results

 

Tests performed on WinXP running on Dell laptop with a Pentium M processor 1600MHz and 1GB of RAM. The tests were done to show relative performance times and the database and operating system were not optimized for the tests. The following represents timings for 20 bytes of data encrypted 1,000,000 times with various algorithms, block modifiers, and padding schemes. The SQL to generate the timings is displayed at first to allow you to understand how the numbers were calculated. The output of the SQL script files is then turned off to abbreviate this listing.

Clock times and CPU times are bolded.

sec_mgr@KNOX10g> SET linesize 70 sec_mgr@KNOX10g> SET pagesize 9999 sec_mgr@KNOX10g> SET feedback off sec_mgr@KNOX10g> SET verify off sec_mgr@KNOX10g> SET timing off sec_mgr@KNOX10g> SET sqlprompt 'sql> ' sql> COL "CPU Start Value" new_val cpu_start sql> COL name format a25 sql>  sql> -- Define a variable to hold size of for loop sql> VAR loop_size number; sql> -- Set loop size to one million sql> BEGIN   2    :loop_size := 1000000;   3  END;   4  / sql> /*****  PL/SQL function in loop  *******/ sql> @pl_loop.sql sql> --- Create sample PL/SQL function sql> CREATE OR REPLACE FUNCTION do_nothing   2    RETURN RAW   3  AS   4  BEGIN   5    RETURN NULL;   6  END;   7  / sql>  sql> -- Test time to loop calling a PL/SQL function sql> @cpu_start sql> SELECT b.VALUE "CPU Start Value"   2    FROM v$statname a, v$mystat b   3   WHERE a.statistic# = b.statistic#   4   AND a.NAME = 'CPU used by this session'; CPU Start Value ---------------               5 sql> DECLARE   2    l_data  RAW (40);   3    l_start_time  NUMBER;   4    l_end_time    NUMBER;   5  BEGIN   6    l_start_time := DBMS_UTILITY.get_time;   7    FOR i IN 1 .. :loop_size   8    LOOP   9      l_data := do_nothing;  10    END LOOP;  11    l_end_time := DBMS_UTILITY.get_time;  12    DBMS_OUTPUT.put_line (     'PL/SQL Loop Time: '  13                             || (l_end_time - l_start_time) / 100  14                             || ' seconds');  15  END;  16  / PL/SQL Loop Time: 1.53 seconds sql> @cpu_stop sql> SELECT b.VALUE "CPU End Value",   2           (b.VALUE - &cpu_start) / 100   3                        "hsecs of CPU Units used"   4    FROM v$statname a, v$mystat b   5   WHERE a.statistic# = b.statistic#   6   AND a.NAME = 'CPU used by this session'; CPU End Value hsecs of CPU Units used ------------- -----------------------           146                    1.41 sql> /****************  eor  ****************/ sql>  sql> /***********  AES encryption  **********/ sql> @aes sql> @cpu_start sql> SELECT b.VALUE "CPU Start Value"   2    FROM v$statname a, v$mystat b   3   WHERE a.statistic# = b.statistic#   4   AND a.NAME = 'CPU used by this session'; CPU Start Value ---------------             147 sql> DECLARE   2    l_algo         PLS_INTEGER   3            :=   dbms_crypto.encrypt_aes   4             + dbms_crypto.chain_cbc   5             + dbms_crypto.pad_pkcs5;   6    l_key          RAW (16)   7            := UTL_RAW.cast_to_raw ('0123456789012345');   8    l_data         RAW (20)   9        := UTL_RAW.cast_to_raw ('01234567890123456789');  10    l_enc_data  RAW (40);  11    l_start_time  NUMBER;  12    l_end_time    NUMBER;  13  BEGIN  14    l_start_time := DBMS_UTILITY.get_time;  15    FOR i IN 1 .. :loop_size  16    LOOP  17         l_enc_data :=  18         dbms_crypto.encrypt (l_data, l_algo, l_key);  19    END LOOP;  20    l_end_time := DBMS_UTILITY.get_time;  21    DBMS_OUTPUT.put_line (     'AES Encryption Time: '  22                          || (l_end_time - l_start_time) / 100  23                          || ' seconds');  24  END;  25  / AES Encryption Time: 17.82 seconds sql> @cpu_stop sql> SELECT b.VALUE "CPU End Value",   2           (b.VALUE - &cpu_start) / 100   3                     "hsecs of CPU Units used"   4    FROM v$statname a, v$mystat b   5   WHERE a.statistic# = b.statistic#   6   AND a.NAME = 'CPU used by this session'; CPU End Value hsecs of CPU Units used ------------- -----------------------          1790                   16.43 sql> /****************  eor  ****************/ sql>  sql> /*******  AES decryption process  ******/ sql> @aes_d sql> @cpu_start sql> SELECT b.VALUE "CPU Start Value"   2    FROM v$statname a, v$mystat b   3   WHERE a.statistic# = b.statistic#   4   AND a.NAME = 'CPU used by this session'; CPU Start Value ---------------            1790 sql> DECLARE   2    l_algo        PLS_INTEGER   3      :=   dbms_crypto.encrypt_aes   4           + dbms_crypto.chain_cbc   5             + dbms_crypto.pad_pkcs5;   6    l_key                RAW (16)   7                      := UTL_RAW.cast_to_raw ('0123456789012345');   8    l_data               RAW (20)   9                  := UTL_RAW.cast_to_raw ('01234567890123456789');  10    l_enc_data  RAW (40);  11    l_dec_data  RAW (40);  12    l_start_time  NUMBER;  13    l_end_time    NUMBER;  14  BEGIN  15    -- Encrypt data  16          SELECT dbms_crypto.encrypt (l_data, l_algo, l_key)  17            INTO l_enc_data  18            FROM DUAL;  19    l_start_time := DBMS_UTILITY.get_time;  20    FOR i IN 1 .. :loop_size  21    LOOP  22        l_dec_data := dbms_crypto.decrypt (l_enc_data, l_algo, l_key);  23    END LOOP;  24    l_end_time := DBMS_UTILITY.get_time;  25    DBMS_OUTPUT.put_line (     'AES Decryption Time: '  26                         || (l_end_time - l_start_time) / 100  27                          || ' seconds');  28  END;  29  / AES Decryption Time: 18.68 seconds sql> @cpu_stop sql> SELECT b.VALUE "CPU End Value",   2             (b.VALUE - &cpu_start) / 100   3                        "hsecs of CPU Units used"   4    FROM v$statname a, v$mystat b   5   WHERE a.statistic# = b.statistic#   6         AND a.NAME = 'CPU used by this session'; CPU End Value hsecs of CPU Units used ------------- -----------------------          3503                   17.13 sql>  sql> /****************  eor  ****************/ sql>  sql> ---- Change algorithm being executed ---- sql> SET echo off sql> /****************  DES  ****************/ sql> @des CPU Start Value ---------------            3504 DES Encryption Time: 18.4 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------          5200                   16.96 sql> /****************  eor  ****************/ sql>  sql> /*********  Triple DES, 2 key  *********/ sql> @des32 CPU Start Value ---------------            5200 Triple DES, 2 Key Encryption Time: 21.72 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------          7186                   19.86 sql> /****************  eor  ****************/ sql>  sql> /*********  Triple DES, 3 key  *********/ sql> @des3 CPU Start Value ---------------            7186 Triple DES, 3 keys Encryption Time: 22.3 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------          9237                   20.51 sql> /****************  eor  ****************/ sql>  sql> /*******  AES with 192-bit key  ********/ sql> @aes192 CPU Start Value ---------------            9238 AES 192-bit key Encryption Time: 18.06 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         10902                   16.64 sql> /****************  eor  ****************/ sql>  sql> /*******  AES with 256-bit key  ********/ sql> @aes256 CPU Start Value ---------------           10903 AES 256-bit key Encryption Time: 18.9 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         12624                   17.21 sql> /****************  eor  ****************/ sql>  sql> /****************  RC4  ****************/ sql> ---- RC4 ---- sql> @rc4_p CPU Start Value ---------------           12624 RC4 Encryption Time: 22.89 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         14733                   21.09 sql> /****************  eor  ****************/ sql>  sql> ---- Block Chaining Modifiers ----------- sql> SET echo on sql> /*******  AES with CFB modifier  *******/ sql> @aes_cfb sql> @cpu_start sql> SELECT b.VALUE "CPU Start Value"   2    FROM v$statname a, v$mystat b   3   WHERE a.statistic# = b.statistic#   4   AND a.NAME = 'CPU used by this session'; CPU Start Value ---------------           14733 sql> DECLARE   2    l_algo      PLS_INTEGER   3    :=   dbms_crypto.encrypt_aes   4       + dbms_crypto.chain_cfb   5       + dbms_crypto.pad_none;   6    l_key           RAW (16)   7               := UTL_RAW.cast_to_raw ('0123456789012345');   8    l_data          RAW (20)   9           := UTL_RAW.cast_to_raw ('01234567890123456789');  10    l_enc_data      RAW (40);  11    l_start_time    NUMBER;  12    l_end_time      NUMBER;  13  BEGIN  14    l_start_time := DBMS_UTILITY.get_time;  15    16    FOR i IN 1 .. :loop_size  17    LOOP  18    l_enc_data :=  19       dbms_crypto.encrypt (l_data, l_algo, l_key);  20    END LOOP;  21    22    l_end_time := DBMS_UTILITY.get_time;  23    DBMS_OUTPUT.put_line ('AES with CFB modifier Encryption Time: '  24                    || (l_end_time - l_start_time) / 100  25                    || ' seconds');  26  END;  27  / AES with CFB modifier Encryption Time: 17.54 seconds sql> @cpu_stop sql> SELECT b.VALUE "CPU End Value",   2          (b.VALUE - &cpu_start) / 100   3                 "hsecs of CPU Units used"   4    FROM v$statname a, v$mystat b   5   WHERE a.statistic# = b.statistic#   6   AND a.NAME = 'CPU used by this session'; CPU End Value hsecs of CPU Units used ------------- -----------------------         16342                   16.09 sql> /****************  eor  ****************/ sql> SET echo off sql> /*******  AES with ECB modifier  *******/ sql> @aes_ecb CPU Start Value ---------------           16342 AES with ECB modifier Encryption Time: 17.25 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         17933                   15.91 sql> /****************  eor  ****************/ sql>  sql> /*******  AES with OFB modifier  *******/ sql> @aes_ofb.sql CPU Start Value ---------------           17933 AES with OFB modifier Encryption Time: 17.62 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         19544                   16.11 sql> /****************  eor  ****************/ sql>  sql> ---------------- Padding ---------------- sql> SET echo on sql> /*****  padding with BINARY ZEROS ******/ sql> ---- padding with binary zeros ---- sql> @pad0.sql sql> @cpu_start sql> SELECT b.VALUE "CPU Start Value"   2    FROM v$statname a, v$mystat b   3   WHERE a.statistic# = b.statistic#   4   AND a.NAME = 'CPU used by this session'; CPU Start Value ---------------           19545 sql> DECLARE   2    l_algo           PLS_INTEGER   3    :=   dbms_crypto.encrypt_aes   4       + dbms_crypto.chain_cbc   5       + dbms_crypto.pad_zero;   6    l_key           RAW (16)   7               := UTL_RAW.cast_to_raw ('0123456789012345');   8    l_data          RAW (20)   9           := UTL_RAW.cast_to_raw ('01234567890123456789');  10    l_enc_data    RAW (40);  11    l_start_time  NUMBER;  12    l_end_time    NUMBER;  13  BEGIN  14    l_start_time := DBMS_UTILITY.get_time;  15    16    FOR i IN 1 .. :loop_size  17    LOOP  18    l_enc_data :=  19      dbms_crypto.encrypt (l_data, l_algo, l_key);  20    END LOOP;  21    22    l_end_time := DBMS_UTILITY.get_time;  23    DBMS_OUTPUT.put_line ('AES Encrypt: Pad Zeros');  24    DBMS_OUTPUT.put_line ('Time: '  25                    || (l_end_time - l_start_time) / 100  26                    || ' seconds');  27  END;  28  / AES Encrypt: Pad Zeros Time: 17.68 seconds sql> @cpu_stop sql> SELECT b.VALUE "CPU End Value",   2        (b.VALUE - &cpu_start) / 100   3                    "hsecs of CPU Units used"   4    FROM v$statname a, v$mystat b   5   WHERE a.statistic# = b.statistic#   6   AND a.NAME = 'CPU used by this session'; CPU End Value hsecs of CPU Units used ------------- -----------------------         21174                   16.29 sql> /****************  eor  ****************/ sql> SET echo off sql> /*****  padding with ORACLE PAD ********/ sql> ---- padding with oracle       ---- sql> @padorcl.sql CPU Start Value ---------------           21174 AES Encrypt: Pad ORCL Time: 17.89 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         22818                   16.44 sql> /****************  eor  ****************/ sql>  sql> /************  NO PADDING **************/ sql> @padnone.sql CPU Start Value ---------------           22819 AES Encrypt: Pad None Time: 16.83 seconds CPU End Value hsecs of CPU Units used ------------- -----------------------         24371                   15.52 sql> /****************  eor  ****************/

 


Effective Oracle Database 10g Security by Design
Effective Oracle Database 10g Security by Design
ISBN: 0072231300
EAN: 2147483647
Year: 2003
Pages: 111

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net