Use an enum for the return value from a construction function
[openssl.git] / ssl / statem / statem.c
index ad227d2a9fd16aa6b822283853598df79384d02d..b885214f3c23c0a6ae3ca61736d6734d26037737 100644 (file)
@@ -806,11 +806,11 @@ static SUB_STATE_RETURN write_state_machine(SSL_CONNECTION *s)
     WORK_STATE(*pre_work) (SSL_CONNECTION *s, WORK_STATE wst);
     WORK_STATE(*post_work) (SSL_CONNECTION *s, WORK_STATE wst);
     int (*get_construct_message_f) (SSL_CONNECTION *s,
-                                    int (**confunc) (SSL_CONNECTION *s,
-                                                     WPACKET *pkt),
+                                    CON_FUNC_RETURN (**confunc) (SSL_CONNECTION *s,
+                                                                 WPACKET *pkt),
                                     int *mt);
     void (*cb) (const SSL *ssl, int type, int val) = NULL;
-    int (*confunc) (SSL_CONNECTION *s, WPACKET *pkt);
+    CON_FUNC_RETURN (*confunc) (SSL_CONNECTION *s, WPACKET *pkt);
     int mt;
     WPACKET pkt;
     SSL *ssl = SSL_CONNECTION_GET_SSL(s);
@@ -889,14 +889,14 @@ static SUB_STATE_RETURN write_state_machine(SSL_CONNECTION *s)
                 return SUB_STATE_ERROR;
             }
             if (confunc != NULL) {
-                int tmpret;
+                CON_FUNC_RETURN tmpret;
 
                 tmpret = confunc(s, &pkt);
-                if (tmpret <= 0) {
+                if (tmpret == CON_FUNC_ERROR) {
                     WPACKET_cleanup(&pkt);
                     check_fatal(s);
                     return SUB_STATE_ERROR;
-                } else if (tmpret == 2) {
+                } else if (tmpret == CON_FUNC_DONT_SEND) {
                     /*
                      * The construction function decided not to construct the
                      * message after all and continue. Skip sending.