00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <iostream>
00019 #include <openssl/err.h>
00020
00021 #include "BignumExceptions.h"
00022
00023 using namespace CODEX_Exceptions;
00024
00025 void
00026 BignumException::report() const
00027 {
00028 cerr << "At line " << m_line << " of file " << m_fname << endl;
00029 cerr << "BIGNUM exception: ";
00030 derivedMsg();
00031 cerr << endl;
00032 }
00033
00034 void
00035 BignumNullException::derivedMsg() const
00036 {
00037 cerr << "NULL ptr found where non-NULL value expected";
00038 }
00039
00040 BignumMathException::BignumMathException( const string& fname, int line ) :
00041 BignumException( fname, line ),
00042 m_error( ERR_get_error() )
00043 {
00044 }
00045
00046 void
00047 BignumModException::derivedMsg() const
00048 {
00049 cerr << "error in BN_mod";
00050 }
00051
00052 void
00053 BignumMulException::derivedMsg() const
00054 {
00055 cerr << "error in BN_mul";
00056 }
00057
00058 void
00059 BignumModMulException::derivedMsg() const
00060 {
00061 cerr << "error in BN_mod_mul";
00062 }
00063
00064 void
00065 BignumModExpException::derivedMsg() const
00066 {
00067 cerr << "error in BN_mod_exp";
00068 }
00069
00070 void
00071 BignumModInverseException::derivedMsg() const
00072 {
00073 cerr << "error in BN_mod_inverse";
00074 }
00075
00076 void
00077 BignumAddException::derivedMsg() const
00078 {
00079 cerr << "error in BN_add";
00080 }
00081
00082 void
00083 BignumSubException::derivedMsg() const
00084 {
00085 cerr << "error in BN_sub";
00086 }
00087
00088 void
00089 BignumRshiftException::derivedMsg() const
00090 {
00091 cerr << "error in BN_rshift";
00092 }
00093
00094 void
00095 BignumLshiftException::derivedMsg() const
00096 {
00097 cerr << "error in BN_lshift";
00098 }
00099
00100 void
00101 BignumRandRangeException::derivedMsg() const
00102 {
00103 cerr << "error in BN_rand_range";
00104 }
00105
00106 void
00107 BignumGCDException::derivedMsg() const
00108 {
00109 cerr << "error in BN_gcd";
00110 }
00111
00112 void
00113 BignumGeneratePrimeException::derivedMsg() const
00114 {
00115 cerr << "error in BN_generate_prime";
00116 }
00117
00118 void
00119 BignumContextException::derivedMsg() const
00120 {
00121 cerr << "unable to allocate a new BN_CTX";
00122 }
00123
00124 void
00125 BignumBin2BNException::derivedMsg() const
00126 {
00127 cerr << "error in BN_bin2bn";
00128 }
00129
00130 void
00131 BignumSetWordException::derivedMsg() const
00132 {
00133 cerr << "error in BN_set_word";
00134 }