Changeset 177

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

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

Location:
changes/tpmmanager-micro
Files:
2 modified
14 moved

Legend:

Unmodified
Added
Removed
  • changes/tpmmanager-micro/SConscript

    r166 r177  
    2727 
    2828# optional: set the C++ file suffix; TPM Manager still has .cpp 
    29 local['CXXFILESUFFIX'] = '.cpp' 
     29local['CXXFILESUFFIX'] = '.cxx' 
    3030local['CXXFLAGS'] = '' 
    3131 
     
    3939rccs = [ local.Qrc( "ui/resources.qrc", QT4_QRCFLAGS = "-name resources" ) ] 
    4040# add Qt4 user interface files (.ui) 
    41 uis = [ local.Uic4(ui) for ui in [ "ui/tpmmanagerbase.ui", "ui/setsrkdialog.ui", "ui/publickeyview.ui", "ui/PasswordDialog.ui", "ui/NewPasswordDialog.ui" ] ] 
     41uis = [ local.Uic4(ui) for ui in [ "ui/TPMManagerBase.ui", "ui/SetSRKDialog.ui", "ui/PublicKeyView.ui", "ui/PasswordDialog.ui", "ui/NewPasswordDialog.ui" ] ] 
    4242 
    4343# last but not least, add all of our source files 
    4444# we only need to add our own source files, not the one created from .ui files 
    45 sources = [ "src/main.cpp", "src/tpmmanager.cpp", "src/SetSRKView.cpp", "src/PublicKeyView.cpp", "src/PasswordDialog.cpp", "src/NewPasswordDialog.cpp" ] 
     45sources = [ "src/Main.cxx", "src/TPMManager.cxx", "src/SetSRKView.cxx", "src/PublicKeyView.cxx", "src/PasswordDialog.cxx", "src/NewPasswordDialog.cxx" ] 
    4646 
    4747# finally, start the build process 
  • changes/tpmmanager-micro/src/Main.cxx

    r161 r177  
    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/// Main application loop 
    4848int main(int argc, char ** argv) 
  • changes/tpmmanager-micro/src/NewPasswordDialog.cxx

    r102 r177  
    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)  
  • changes/tpmmanager-micro/src/NewPasswordDialog.hxx

    r131 r177  
    2828 
    2929/** 
    30 * @file NewPasswordDialog.h 
     30* @file NewPasswordDialog.hxx 
    3131* 
    3232* @brief New Password Dialog Class Header File 
  • changes/tpmmanager-micro/src/PasswordDialog.cxx

    r102 r177  
    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 
  • changes/tpmmanager-micro/src/PasswordDialog.hxx

    r131 r177  
    2828 
    2929/** 
    30 * @file PasswordDialog.h 
     30* @file PasswordDialog.hxx 
    3131* 
    3232* @brief Password Dialog Class Header File 
  • changes/tpmmanager-micro/src/PublicKeyView.cxx

    r171 r177  
    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> 
  • changes/tpmmanager-micro/src/PublicKeyView.hxx

    r171 r177  
    2525 
    2626#include <QDialog> 
    27 #include "ui/ui_publickeyview.h" 
     27#include "ui/ui_PublicKeyView.h" 
    2828 
    2929#include <tss/microtss/EndorsementKey.hxx> 
     
    3232 
    3333/** 
    34 * @file PublicKeyView.h 
     34* @file PublicKeyView.hxx 
    3535* 
    3636* @brief Public Key Dialog Class Header File 
  • changes/tpmmanager-micro/src/SetSRKView.cxx

    r172 r177  
    2222 
    2323/** 
    24 * @file SetSRKView.cpp 
     24* @file SetSRKView.cxx 
    2525* 
    2626* @brief SRK Password Choose Dialog Class Implementation File 
     
    2828**/ 
    2929 
    30 #include "SetSRKView.h" 
     30#include "SetSRKView.hxx" 
    3131#include <iostream> 
    3232#include <QString> 
  • changes/tpmmanager-micro/src/SetSRKView.hxx

    r131 r177  
    2525// 
    2626#include <QDialog> 
    27 #include "ui/ui_setsrkdialog.h" 
     27#include "ui/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 
  • changes/tpmmanager-micro/src/TPMManager.cxx

    r175 r177  
    2222 
    2323/** 
    24 * @file tpmmanager.cpp 
     24* @file TPMManager.cxx 
    2525* 
    2626* @brief TPM Manager Controller Class Implementation File 
     
    5454#include <utils/ByteVector.hxx> 
    5555#include <tss/tcs/TestingSecretProvider.hxx> 
    56 #include "PublicKeyView.h" 
    57 #include "PasswordDialog.h" 
    58 #include "NewPasswordDialog.h" 
    59 #include "SetSRKView.h" 
    60 #include "tpmmanager.h" 
     56#include "PublicKeyView.hxx" 
     57#include "PasswordDialog.hxx" 
     58#include "NewPasswordDialog.hxx" 
     59#include "SetSRKView.hxx" 
     60#include "TPMManager.hxx" 
    6161 
    6262#define VERSION "0.9.1" 
     
    104104    } catch ( tcs::TPM_Error &e ) { 
    105105        QMessageBox::critical( this, "Miscellaneous TPM Error", QString::fromStdString( string("An unknown TPM Error occured: ").append( e.what() ) ) ); 
     106    } catch ( ... ) { 
     107        QMessageBox::critical( this, "Unknown Error", "An unknown error occured during initialization." ); 
    106108    } 
    107109         
     
    499501                std::string msg = "Take Ownership failed (" + string( e.what() ) + ")"; 
    500502                QMessageBox::critical( this, "Taking Ownership Failed", QString::fromStdString( msg ) ); 
    501         } 
     503        } catch ( ... ) { 
     504            QMessageBox::critical( this, "Unknown Error", "An unknown error occured during Taking Ownership." ); 
     505        } 
    502506         
    503507        /* finally re-enable to Take button (may get disabled by initOwnership() again afterwards) */ 
     
    537541                string err = "Authentication failure while changing owner password: \n" + string( e.what() ); 
    538542                QMessageBox::critical( this, "TPM Error", QString::fromStdString( err )); 
    539         }        
     543        } catch ( ... ) { 
     544            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to change TPM Owner password." ); 
     545        } 
    540546        // update GUI 
    541547        initOwnership(); 
     
    586592                string err = "Authentication failure while changing SRK password: \n" + string( e.what() ); 
    587593                QMessageBox::critical( this, "TPM Error", QString::fromStdString( err )); 
    588         }        
     594        } catch ( ... ) { 
     595            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to change SRK password." ); 
     596        } 
    589597        // update GUI 
    590598        initOwnership(); 
     
    619627                string err = "Authentication failure while clearing TPM: \n" + string( e.what() ); 
    620628                QMessageBox::critical( this, "Error: TPM Clear", QString::fromStdString( err )); 
    621         }        
     629        } catch ( ... ) { 
     630            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to clear TPM Ownership." ); 
     631        } 
    622632        // update GUI 
    623633        initStatus(); 
     
    644654                std::string msg = "TPM Selftest failed (" + string( e.what() ) + ")"; 
    645655                QMessageBox::critical( this, "TPM Selftest", QString::fromStdString( msg ) ); 
    646         } 
     656        } catch ( ... ) { 
     657            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when performing the TPM selftest." ); 
     658        } 
    647659        // refresh TPM status view 
    648660        initStatusGroup(); 
     
    675687                string err = "No TPM Operator installed (" + string( e.what() ) + ")"; 
    676688                QMessageBox::critical( this, "Error: Deactivate TPM", QString::fromStdString( err ) ); 
    677         } 
     689        } catch ( ... ) { 
     690            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to deactivate TPM." ); 
     691        } 
    678692         
    679693         
     
    812826                        string err = "Authentication failure while disabling TPM: \n" + string( e.what() ); 
    813827                        QMessageBox::critical( this, "TPM Error", QString::fromStdString( err )); 
    814                 }        
     828                } catch ( ... ) { 
     829                    QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to disable TPM." ); 
     830                } 
    815831        } 
    816832        else 
     
    833849                        string err = "Authentication failure while enabling TPM: \n" + string( e.what() ); 
    834850                        QMessageBox::critical( this, "TPM Error", QString::fromStdString( err )); 
    835                 } 
     851                } catch ( ... ) { 
     852                    QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to enable TPM." ); 
     853                } 
    836854        } 
    837855        // refresh TPM status view & options 
     
    873891                string err = "Authentication failed while trying to get Endorsement Key: \n" + string( e.what() ); 
    874892                QMessageBox::critical( this, "Error: Show Endorsement Key", QString::fromStdString( err )); 
    875         } 
     893        } catch ( ... ) { 
     894            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to retrieve TPM Endorsement Key." ); 
     895        } 
    876896} 
    877897 
     
    905925                fs.close(); 
    906926        } catch ( tcs::TPM_FAIL_Error &e ) { 
    907                 string err = "Error when trying to save Endorsement Key. \n" + string( e.what() ); 
    908                 QMessageBox::critical( this, "Error: Save Endorsement Key", QString::fromStdString( err ) ); 
     927                string err = "Error when trying to store Endorsement Key. \n" + string( e.what() ); 
     928                QMessageBox::critical( this, "Error: Store Endorsement Key", QString::fromStdString( err ) ); 
    909929        } catch ( tcs::TPM_AUTHFAIL_Error &e ) { 
    910                 string err = "Authentication failed while trying to save Endorsement Key. \n" + string( e.what() ); 
    911                 QMessageBox::critical( this, "Error: Save Endorsement Key", QString::fromStdString( err ) ); 
     930                string err = "Authentication failed while trying to store Endorsement Key. \n" + string( e.what() ); 
     931                QMessageBox::critical( this, "Error: Store Endorsement Key", QString::fromStdString( err ) ); 
    912932        } catch ( tcs::TPM_DEFEND_LOCK_RUNNING_Error &e ) { 
    913                 string err = "Authentication failed while trying to save Endorsement Key: \n" + string( e.what() ); 
    914                 QMessageBox::critical( this, "Error: Save Endorsement Key", QString::fromStdString( err )); 
    915         } 
     933                string err = "Authentication failed while trying to store Endorsement Key: \n" + string( e.what() ); 
     934                QMessageBox::critical( this, "Error: Store Endorsement Key", QString::fromStdString( err )); 
     935        } catch ( ... ) { 
     936            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to store TPM Endorsement Key." ); 
     937        } 
    916938 
    917939} 
     
    945967                string err = "Authentication failed while trying to restrict Endorsement Key: \n" + string( e.what() ); 
    946968                QMessageBox::critical( this, "Error: Restrict Endorsement Key", QString::fromStdString( err )); 
    947         } 
     969        } catch ( ... ) { 
     970            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to restrict access to TPM Endorsement Key." ); 
     971        } 
    948972 
    949973        initIdentity(); 
     
    9791003                string err = "Authentication failed while trying to disable Maintenance feature: \n" + string( e.what() ); 
    9801004                QMessageBox::critical( this, "Error: Disable Maintenance", QString::fromStdString( err )); 
    981         } 
     1005        } catch ( ... ) { 
     1006            QMessageBox::critical( this, "Unknown Error", "An unknown error occured when trying to disable TPM Maintenance archive." ); 
     1007        } 
    9821008} 
    9831009 
  • changes/tpmmanager-micro/src/TPMManager.hxx

    r171 r177  
    2727#include <QResource> 
    2828#include <QTimer> 
    29 #include "ui/ui_tpmmanagerbase.h" 
     29#include "ui/ui_TPMManagerBase.h" 
    3030 
    3131#include <tss/microtss/TPM.hxx> 
     
    3737 
    3838/** 
    39 * @file tpmmanager.h 
     39* @file TPMManager.hxx 
    4040* 
    4141* @brief TPM Manager Controller Class Header File 
  • changes/tpmmanager-micro/tpmmanager.pro

    r102 r177  
    88FORMS = ui/NewPasswordDialog.ui \ 
    99 ui/PasswordDialog.ui \ 
    10  ui/publickeyview.ui \ 
    11  ui/setsrkdialog.ui \ 
    12  ui/tpmmanagerbase.ui 
     10 ui/PublicKeyView.ui \ 
     11 ui/SetSRKDialog.ui \ 
     12 ui/TPMManagerBase.ui 
    1313HEADERS = 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 
    21 INCLUDEPATH += . microtss src 
     14 src/PublicKeyView.hxx \ 
     15 src/SetSRKView.hxx \ 
     16 src/TPMManager.hxx \ 
     17 src/PasswordDialog.hxx \ 
     18 src/NewPasswordDialog.hxx 
     19INCLUDEPATH += . src 
    2220LIBS += -ltspi 
    2321MOC_DIR = build 
    2422OBJECTS_DIR = build 
    2523QT = 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 
     24SOURCES = src/NewPasswordDialog.cxx \ 
     25 src/PublicKeyView.cxx \ 
     26 src/SetSRKView.cxx \ 
     27 src/Main.cxx \ 
     28 src/TPMManager.cxx \ 
     29 src/PasswordDialog.cxx 
    3530RESOURCES += ui/resources.qrc 
    3631TEMPLATE = app