Changeset 176

Show
Ignore:
Timestamp:
03/08/10 11:37:04 (6 months ago)
Author:
korthaus
Message:

added better error handling, renamed source files (h, cpp)->(hxx, cxx) for convenience

Location:
trunk
Files:
1 modified
20 moved

Legend:

Unmodified
Added
Removed
  • trunk/src/Main.cxx

    r160 r176  
    3737 
    3838/** 
    39 * @file main.cpp 
     39* @file Main.cxx 
    4040* 
    4141* @brief TPM Manager Main Application File 
     
    4444 
    4545#include <QApplication> 
    46 #include "tpmmanager.h" 
     46#include "TPMManager.hxx" 
    4747#include <string.h> 
    4848/// Main application loop 
  • trunk/src/NewPasswordDialog.cxx

    r102 r176  
    2222 
    2323/** 
    24 * @file NewPasswordDialog.cpp 
     24* @file NewPasswordDialog.cxx 
    2525* 
    2626* @brief New Password Dialog Class Implementation File 
     
    2828**/ 
    2929 
    30 #include "NewPasswordDialog.h" 
     30#include "NewPasswordDialog.hxx" 
    3131 
    3232NewPasswordDialog::NewPasswordDialog( QWidget * parent, Qt::WFlags f)  
  • trunk/src/NewPasswordDialog.hxx

    r102 r176  
    2828 
    2929/** 
    30 * @file NewPasswordDialog.h 
     30* @file NewPasswordDialog.hxx 
    3131* 
    3232* @brief New Password Dialog Class Header File 
  • trunk/src/PasswordDialog.cxx

    r102 r176  
    2222 
    2323/** 
    24 * @file PasswordDialog.cpp 
     24* @file PasswordDialog.cxx 
    2525* 
    2626* @brief Password Dialog Class Implementation File 
     
    2828**/ 
    2929 
    30 #include "PasswordDialog.h" 
     30#include "PasswordDialog.hxx" 
    3131#include <iostream> 
    3232 
  • trunk/src/PasswordDialog.hxx

    r102 r176  
    2828 
    2929/** 
    30 * @file PasswordDialog.h 
     30* @file PasswordDialog.hxx 
    3131* 
    3232* @brief Password Dialog Class Header File 
  • trunk/src/PublicKeyView.cxx

    r102 r176  
    2222 
    2323/** 
    24 * @file PublicKeyView.cpp 
     24* @file PublicKeyView.cxx 
    2525* 
    2626* @brief Public Key Dialog Class Implementation File 
     
    2828**/ 
    2929 
    30 #include "PublicKeyView.h" 
     30#include "PublicKeyView.hxx" 
    3131#include <QLabel> 
    3232#include <QString> 
  • trunk/src/PublicKeyView.hxx

    r102 r176  
    2525// 
    2626#include <QDialog> 
    27 #include "ui_publickeyview.h" 
    28 #include <microtss/PublicKey.h> 
     27#include "ui_PublicKeyView.h" 
     28#include <microtss/PublicKey.hxx> 
    2929 
    3030/** 
    31 * @file PublicKeyView.h 
     31* @file PublicKeyView.hxx 
    3232* 
    3333* @brief Public Key Dialog Class Header File 
  • trunk/src/SetSRKView.cxx

    r173 r176  
    2828**/ 
    2929 
    30 #include "SetSRKView.h" 
     30#include "SetSRKView.hxx" 
    3131#include <iostream> 
    3232#include <QString> 
  • trunk/src/SetSRKView.hxx

    r102 r176  
    2525// 
    2626#include <QDialog> 
    27 #include "ui_setsrkdialog.h" 
     27#include "ui_SetSRKDialog.h" 
    2828#include <QRadioButton> 
    2929 
    3030/** 
    31 * @file SetSRKView.h 
     31* @file SetSRKView.hxx 
    3232* 
    3333* @brief SRK Password Choose Dialog Class Header File 
  • trunk/src/TPMManager.cxx

    r175 r176  
    2222 
    2323/** 
    24 * @file tpmmanager.cpp 
     24* @file TPMManager.cxx 
    2525* 
    2626* @brief TPM Manager Controller Class Implementation File 
     
    2828**/ 
    2929 
    30 #include <microtss/TSS.h> 
    31 #include <SetSRKView.h> 
    3230#include <iostream> 
    3331#include <sstream> 
     
    5250#include <QUrl> 
    5351//  
    54 #include <microtss/PublicKey.h> 
    55 #include <PublicKeyView.h> 
    56 #include <PasswordDialog.h> 
    57 #include <NewPasswordDialog.h> 
    58  
    59 #include "tpmmanager.h" 
     52#include <microtss/TSS.hxx> 
     53#include <microtss/PublicKey.hxx> 
     54#include <SetSRKView.hxx> 
     55#include <PublicKeyView.hxx> 
     56#include <PasswordDialog.hxx> 
     57#include <NewPasswordDialog.hxx> 
     58 
     59#include "TPMManager.hxx" 
    6060 
    6161#define VERSION "0.8.1" 
     
    113113        QMessageBox::critical( this, "No TSS Found", "A TCG Software Stack (TSS) could not be found. When using TrouSerS, make sure the TrouSerS daemon (tcsd) is running.\nTPM Manager will quit." ); 
    114114        exit(1); 
     115    } catch ( ... ) { 
     116        QMessageBox::critical( this, "Unknown Error", "An unknown error occured during initialization." ); 
    115117    } 
    116118         
     
    467469         
    468470        } catch ( IsDeactivatedError &e ) { 
    469             QMessageBox::critical( this, "Error: Taking Ownership" , "Sorry. Could not Take Ownership in deactivated mode due to TSS bug. " ); 
     471            QMessageBox::critical( this, "Taking Ownership Failed" , "Sorry. Could not Take Ownership in deactivated mode due to TSS bug. " ); 
    470472        } catch ( UnknownError &e ) { 
    471             QMessageBox::critical( this, "Error: Taking Ownership" , QString( "Could not Take Ownership for the following reason: " ).append( QString::fromStdString( e.what() ) ) ); 
     473            QMessageBox::critical( this, "Taking Ownership Failed" , QString( "Could not Take Ownership for the following reason: " ).append( QString::fromStdString( e.what() ) ) ); 
     474        } catch ( ... ) { 
     475            QMessageBox::critical( this, "Unknown Error", "An unknown error occured during Taking Ownership." ); 
    472476        } 
    473  
    474  
    475477         
    476478        /* finally re-enable to Take button (may get disabled by initOwnership() again afterwards) */ 
     
    504506                QMessageBox::information( this, "Changing TPM Owner Password" , "TPM owner password successfully changed." ); 
    505507 
    506         } catch( TPMError &e ) 
    507         { 
     508        } catch( TPMError &e ) { 
    508509                string err = "Error while changing owner password.\n" + string( e.what() ); 
    509510                QMessageBox::critical( this, "TPM Error", QString::fromStdString( err )); 
    510         } 
     511        } catch ( ... ) { 
     512            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to change TPM Owner password." ); 
     513        } 
     514 
    511515        // update GUI 
    512516        initOwnership(); 
     
    557561                string err = "Unknown error while changing SRK password: \n" + string( e.what() ); 
    558562                QMessageBox::critical( this, "TPM Error", QString::fromStdString( err )); 
    559         }        
     563        } catch ( ... ) { 
     564            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to change SRK password." ); 
     565        } 
    560566        // update GUI 
    561567        initOwnership(); 
     
    583589                string err = "Error while clearing ownership. \n" + string( e.what() ); 
    584590                QMessageBox::critical( this, "Error: Clear Ownership", QString::fromStdString( err ) ); 
    585         } 
     591        } catch ( ... ) { 
     592            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to clear TPM Ownership." ); 
     593        } 
    586594        // update GUI 
    587595        initStatus(); 
     
    632640                string err = "Error while deactivating TPM. \n" + string( e.what() ); 
    633641                QMessageBox::critical( this, "Error: Deactivate TPM", QString::fromStdString( err ) ); 
    634         } 
    635          
     642        } catch ( ... ) { 
     643            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to deactivate TPM." ); 
     644        } 
    636645         
    637646        // refresh TPM status view & options 
     
    762771                        QMessageBox::information( this, "Disabling the TPM", "TPM successfully disabled." ); 
    763772                } catch ( TPMError &e ) { 
    764                 string err = "Authentication failure. \n" + string( e.what() ); 
    765                 QMessageBox::critical( this, "Error when disabling the TPM" , QString::fromStdString( err ) ); 
    766                 } 
     773                    string err = "Authentication failure. \n" + string( e.what() ); 
     774                    QMessageBox::critical( this, "Error when disabling the TPM" , QString::fromStdString( err ) ); 
     775                } catch ( ... ) { 
     776                    QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to disable TPM." ); 
     777                } 
    767778        } 
    768779        else 
     
    782793                        string err = "Authentication failure. \n" + string( e.what() ); 
    783794                        QMessageBox::critical( this, "Error when enabling the TPM", QString::fromStdString( err ) ); 
    784                 } 
     795                } catch ( ... ) { 
     796                    QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to enable TPM." ); 
     797                } 
    785798        } 
    786799        // refresh TPM status view & options 
     
    818831                string err = "Authentication failure. \n" + string( e.what() ); 
    819832                QMessageBox::critical( this, "Error when trying to get Endorsement Key" , QString::fromStdString( err ) ); 
    820         } 
     833        } catch ( ... ) { 
     834            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to retrieve TPM Endorsement Key." ); 
     835        } 
    821836} 
    822837 
     
    848863        } catch ( TPMError &e ) { 
    849864                string err = "Authentication failure. \n" + string( e.what() ); 
    850                 QMessageBox::critical( this, "Error when trying to save Endorsement Key", QString::fromStdString( err ) ); 
    851         } 
     865                QMessageBox::critical( this, "Error when trying to store TPM Endorsement Key", QString::fromStdString( err ) ); 
     866        } catch ( ... ) { 
     867            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to store TPM Endorsement Key." ); 
     868        } 
    852869 
    853870} 
     
    859876        PasswordDialog passDlg( this ); 
    860877        passDlg.setPrompt( "Enter Owner Password" ); 
    861         passDlg.setDescription( "Enter owner password to restrict viewing public endorsement key information without owner authorization. " ); 
     878        passDlg.setDescription( "Enter owner password to restrict viewing public TPM Endorsement Key information without owner authorization. " ); 
    862879 
    863880        if ( passDlg.exec() == QDialog::Rejected ) 
     
    873890                string err =  "Error: Restrict Endorsement Key. \n" + string( e.what() ); 
    874891                QMessageBox::critical( this, "Error at restrict Endorsement Key", QString::fromStdString( err ) ); 
    875         } 
     892        } catch ( ... ) { 
     893            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to restrict access to TPM Endorsement Key." ); 
     894        } 
    876895 
    877896        initIdentity(); 
     
    898917                string err = "Error while disabling Maintenance Archive. \n" + string( e.what() ); 
    899918                QMessageBox::critical( this,  "Error: Disable Maintenance Archive" , QString::fromStdString( err ) ); 
    900         } 
     919        } catch ( ... ) { 
     920            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to disable TPM Maintenance archive." ); 
     921        } 
    901922} 
    902923 
  • trunk/src/TPMManager.hxx

    r151 r176  
    2727#include <QResource> 
    2828#include <QTimer> 
    29 #include "ui_tpmmanagerbase.h" 
     29#include "ui_TPMManagerBase.h" 
    3030 
    31 #include <microtss/TPM.h> 
    32 #include <microtss/TSS.h> 
     31#include <microtss/TPM.hxx> 
     32#include <microtss/TSS.hxx> 
    3333 
    3434/** 
    35 * @file tpmmanager.h 
     35* @file TPMManager.hxx 
    3636* 
    3737* @brief TPM Manager Controller Class Header File 
  • trunk/src/microtss/PublicKey.cxx

    r117 r176  
    2222 
    2323/** 
    24 * @file PublicKey.cpp 
     24* @file PublicKey.cxx 
    2525* 
    2626* @brief Public Key Class Implementation File 
     
    2929 
    3030 
    31 #include "PublicKey.h" 
     31#include "PublicKey.hxx" 
    3232#include <iomanip> 
    3333#include <sstream> 
  • trunk/src/microtss/PublicKey.hxx

    r102 r176  
    2929 
    3030/** 
    31 * @file PublicKey.h 
     31* @file PublicKey.hxx 
    3232* 
    3333* @brief Public Key Class Header File 
  • trunk/src/microtss/TPM.cxx

    r151 r176  
    2222 
    2323/** 
    24 * @file TPM.cpp 
     24* @file TPM.cxx 
    2525* 
    2626* @brief TPM Encapsulation Class Implementation File 
     
    2828**/ 
    2929 
    30 #include "TPM.h" 
     30#include "TPM.hxx" 
    3131#include <iostream> 
    3232#include <sstream> 
  • trunk/src/microtss/TPM.hxx

    r151 r176  
    3333#include <tss/tpm_error.h> 
    3434 
    35 #include <microtss/PublicKey.h> 
     35#include <microtss/PublicKey.hxx> 
    3636 
    3737#define TSS_ERROR_LAYER(x)      (x & 0x3000) 
     
    3939 
    4040/** 
    41 * @file TPM.h 
     41* @file TPM.hxx 
    4242* 
    4343* @brief TPM Encapsulation Class Header File 
  • trunk/src/microtss/TSS.cxx

    r102 r176  
    2222 
    2323/** 
    24 * @file TSS.cpp 
     24* @file TSS.cxx 
    2525* 
    2626* @brief TCG Software Stack Class Implementation File 
     
    2828**/  
    2929 
    30 #include "TSS.h" 
     30#include "TSS.hxx" 
    3131#include <sys/stat.h> 
    3232#include <iostream> 
  • trunk/src/microtss/TSS.hxx

    r102 r176  
    3333 
    3434/** 
    35 * @file TSS.h 
     35* @file TSS.hxx 
    3636* 
    3737* @brief TCG Software Stack Class Header File 
  • trunk/tpmmanager.pro

    r102 r176  
    88FORMS = ui/NewPasswordDialog.ui \ 
    99 ui/PasswordDialog.ui \ 
    10  ui/publickeyview.ui \ 
    11  ui/setsrkdialog.ui \ 
    12  ui/tpmmanagerbase.ui 
    13 HEADERS = src/NewPasswordDialog.h \ 
    14  src/PublicKeyView.h \ 
    15  src/SetSRKView.h \ 
    16  src/microtss/PublicKey.h \ 
    17  src/microtss/TPM.h \ 
    18  src/microtss/TSS.h \ 
    19  src/tpmmanager.h \ 
    20  src/PasswordDialog.h 
     10 ui/PublicKeyView.ui \ 
     11 ui/SetSRKDialog.ui \ 
     12 ui/TPMManagerBase.ui 
     13HEADERS = src/NewPasswordDialog.hxx \ 
     14 src/PublicKeyView.hxx \ 
     15 src/SetSRKView.hxx \ 
     16 src/microtss/PublicKey.hxx \ 
     17 src/microtss/TPM.hxx \ 
     18 src/microtss/TSS.hxx \ 
     19 src/TPMManager.hxx \ 
     20 src/PasswordDialog.hxx 
    2121INCLUDEPATH += . microtss src 
    2222LIBS += -ltspi 
     
    2424OBJECTS_DIR = build 
    2525QT = core gui 
    26 SOURCES = src/NewPasswordDialog.cpp \ 
    27  src/PublicKeyView.cpp \ 
    28  src/SetSRKView.cpp \ 
    29  src/main.cpp \ 
    30  src/microtss/PublicKey.cpp \ 
    31  src/microtss/TPM.cpp \ 
    32  src/microtss/TSS.cpp \ 
    33  src/tpmmanager.cpp \ 
    34  src/PasswordDialog.cpp 
     26SOURCES = src/NewPasswordDialog.cxx \ 
     27 src/PublicKeyView.cxx \ 
     28 src/SetSRKView.cxx \ 
     29 src/Main.cxx \ 
     30 src/microtss/PublicKey.cxx \ 
     31 src/microtss/TPM.cxx \ 
     32 src/microtss/TSS.cxx \ 
     33 src/TPMManager.cxx \ 
     34 src/PasswordDialog.cxx 
    3535RESOURCES += ui/resources.qrc 
    3636TEMPLATE = app