• R/O
  • SSH
  • HTTPS

globalbase: Commit


Commit MetaInfo

Revision5926 (tree)
Time2018-08-17 18:04:08
Authorjoshua

Log Message

RSA error

Change Summary

Incremental Difference

--- modules/tinyState/trunk/src/classes/ts/c++/co_tsRSA_PEM_privateKey.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/co_tsRSA_PEM_privateKey.cpp (revision 5926)
@@ -62,6 +62,10 @@
6262
6363 TS_THREAD(ACT_START)
6464 {
65+ if ( rsa->private_key == 0 ) {
66+ error_char = "NO PRIVATE KEY";
67+ return rDO|FIN_ERROR;
68+ }
6569 if ( PEM_write_RSAPrivateKey(fd,rsa->key,
6670 0,0,0,0,0) < 0 ) {
6771 error_char = ERR_error_string(
--- modules/tinyState/trunk/src/classes/ts/c++/co_tsRSA_PEM_publicKey.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/co_tsRSA_PEM_publicKey.cpp (revision 5926)
@@ -63,6 +63,10 @@
6363
6464 TS_THREAD(ACT_START)
6565 {
66+ if ( rsa->public_key == 0 ) {
67+ error_char = "NO PUBLIC KEY";
68+ return rDO|FIN_ERROR;
69+ }
6670 if ( PEM_write_RSAPublicKey(fd,rsa->key) < 0 ) {
6771 error_char = ERR_error_string(
6872 ERR_get_error(),0);
--- modules/tinyState/trunk/src/classes/ts/c++/co_tsRSA_generate.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/co_tsRSA_generate.cpp (revision 5926)
@@ -89,6 +89,7 @@
8989
9090 TS_STATE(FIN_START)
9191 {
92+ rsa->private_key = rsa->public_key = 1;
9293 parent->eventHandler(
9394 NEW stdEvent(TSE_RETURN,
9495 ifThis,
--- modules/tinyState/trunk/src/classes/ts/c++/co_tsRSAfileBase.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/co_tsRSAfileBase.cpp (revision 5926)
@@ -36,7 +36,7 @@
3636
3737 tsPipeIO * pipe;
3838
39- char * error_char;
39+ const char * error_char;
4040 stdString * error_stdString;
4141 FILE * fd;
4242 };
--- modules/tinyState/trunk/src/classes/ts/c++/co_tsRSAread_PEM_privateKey.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/co_tsRSAread_PEM_privateKey.cpp (revision 5926)
@@ -75,5 +75,6 @@
7575 ERR_get_error(),0);
7676 return rDO|FIN_ERROR;
7777 }
78+ rsa->private_key = rsa->public_key = 1;
7879 return rDO|ACT_FINISH;
7980 }
--- modules/tinyState/trunk/src/classes/ts/c++/co_tsRSAread_PEM_publicKey.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/co_tsRSAread_PEM_publicKey.cpp (revision 5926)
@@ -75,5 +75,6 @@
7575 ERR_get_error(),0);
7676 return rDO|FIN_ERROR;
7777 }
78+ rsa->public_key = 1;
7879 return rDO|ACT_FINISH;
7980 }
--- modules/tinyState/trunk/src/classes/ts/c++/stdRSA.cpp (revision 5925)
+++ modules/tinyState/trunk/src/classes/ts/c++/stdRSA.cpp (revision 5926)
@@ -132,6 +132,16 @@
132132 int padding,
133133 int * olen)
134134 {
135+ if ( public_key == 0 ) {
136+ caller->eventHandler(
137+ NEW stdEvent(TSE_RETURN,
138+ caller,
139+ 0,
140+ -1,
141+ 0,
142+ NEW stdString("NO PUBLIC KEY")));
143+ return;
144+ }
135145 NEW co_tsRSAexecution(
136146 caller,
137147 this,
@@ -152,6 +162,16 @@
152162 int padding,
153163 int * olen)
154164 {
165+ if ( private_key == 0 ) {
166+ caller->eventHandler(
167+ NEW stdEvent(TSE_RETURN,
168+ caller,
169+ 0,
170+ -1,
171+ 0,
172+ NEW stdString("NO PRIVATE KEY")));
173+ return;
174+ }
155175 NEW co_tsRSAexecution(
156176 caller,
157177 this,
@@ -172,6 +192,16 @@
172192 int padding,
173193 int * olen)
174194 {
195+ if ( private_key == 0 ) {
196+ caller->eventHandler(
197+ NEW stdEvent(TSE_RETURN,
198+ caller,
199+ 0,
200+ -1,
201+ 0,
202+ NEW stdString("NO PRIVATE KEY")));
203+ return;
204+ }
175205 NEW co_tsRSAexecution(
176206 caller,
177207 this,
@@ -192,6 +222,16 @@
192222 int padding,
193223 int * olen)
194224 {
225+ if ( public_key == 0 ) {
226+ caller->eventHandler(
227+ NEW stdEvent(TSE_RETURN,
228+ caller,
229+ 0,
230+ -1,
231+ 0,
232+ NEW stdString("NO PUBLIC KEY")));
233+ return;
234+ }
195235 NEW co_tsRSAexecution(
196236 caller,
197237 this,
--- modules/tinyState/trunk/src/h/ts/c++/stdRSA.h (revision 5925)
+++ modules/tinyState/trunk/src/h/ts/c++/stdRSA.h (revision 5926)
@@ -69,6 +69,8 @@
6969
7070 stdMutex * lock;
7171 RSA * key;
72+ unsigned public_key:1;
73+ unsigned private_key:1;
7274 protected:
7375 };
7476
Show on old repository browser