Fix SRP error codes (from HEAD).
authorDr. Stephen Henson <steve@openssl.org>
Wed, 16 Mar 2011 16:55:12 +0000 (16:55 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Wed, 16 Mar 2011 16:55:12 +0000 (16:55 +0000)
apps/speed.c
ssl/s3_clnt.c
ssl/s3_srvr.c
ssl/ssl.h
ssl/ssl_err.c

index 65f85fe..24f18b8 100644 (file)
@@ -2608,7 +2608,11 @@ static int do_multi(int multi)
        fds=malloc(multi*sizeof *fds);
        for(n=0 ; n < multi ; ++n)
                {
-               pipe(fd);
+               if (pipe(fd) == -1)
+                       {
+                       fprintf(stderr, "pipe failure\n");
+                       exit(1);
+                       }
                fflush(stdout);
                fflush(stderr);
                if(fork())
@@ -2620,7 +2624,11 @@ static int do_multi(int multi)
                        {
                        close(fd[0]);
                        close(1);
-                       dup(fd[1]);
+                       if (dup(fd[1]) == -1)
+                               {
+                               fprintf(stderr, "dup failed\n");
+                               exit(1);
+                               }
                        close(fd[1]);
                        mr=1;
                        usertime=0;
index d959474..121ffb2 100644 (file)
@@ -282,7 +282,7 @@ int ssl3_connect(SSL *s)
                                {
                                if (!SRP_have_to_put_srp_username(s))
                                        {
-                                       SSLerr(SSL_F_SSL3_GET_SERVER_HELLO,SSL_R_MISSING_SRP_USERNAME);
+                                       SSLerr(SSL_F_SSL3_CONNECT,SSL_R_MISSING_SRP_USERNAME);
                                        ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_USER_CANCELLED);
                                        goto end;
                                        }
@@ -377,7 +377,7 @@ int ssl3_connect(SSL *s)
                                {
                                if ((ret = SRP_Calc_A_param(s))<=0)
                                        {
-                                       SSLerr(SSL_F_SSL3_GET_SERVER_DONE,SSL_R_SRP_A_CALC);
+                                       SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SRP_A_CALC);
                                        ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR);
                                        goto end;
                                        }
@@ -2685,7 +2685,7 @@ int ssl3_send_client_key_exchange(SSL *s)
 
                        if ((s->session->master_key_length = SRP_generate_client_master_secret(s,s->session->master_key))<0)
                                {
-                               SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+                               SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
                                goto err;
                                }
                        }
index 758f090..a0d09e0 100644 (file)
@@ -364,7 +364,7 @@ int ssl3_accept(SSL *s)
                                        break;
                                        }
                                ret = -1;
-                               SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT);
+                               SSLerr(SSL_F_SSL3_ACCEPT,SSL_R_CLIENTHELLO_TLSEXT);
                                goto end;
                                }
 #endif
@@ -2683,12 +2683,12 @@ int ssl3_get_client_key_exchange(SSL *s)
                        if (param_len > n)
                                {
                                al=SSL_AD_DECODE_ERROR;
-                               SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_A_LENGTH);
+                               SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,SSL_R_BAD_SRP_A_LENGTH);
                                goto f_err;
                                }
                        if (!(s->srp_ctx.A=BN_bin2bn(p,i,NULL)))
                                {
-                               SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB);
+                               SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_BN_LIB);
                                goto err;
                                }
                        if (s->session->srp_username != NULL)
@@ -2703,7 +2703,7 @@ int ssl3_get_client_key_exchange(SSL *s)
 
                        if ((s->session->master_key_length = SRP_generate_server_master_secret(s,s->session->master_key))<0)
                                {
-                               SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
+                               SSLerr(SSL_F_SSL3_GET_CLIENT_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR);
                                goto err;
                                }
 
index fc4cb38..5c71a79 100644 (file)
--- a/ssl/ssl.h
+++ b/ssl/ssl.h
@@ -2093,7 +2093,7 @@ void ERR_load_SSL_strings(void);
 #define SSL_F_SSL_SET_TRUST                             228
 #define SSL_F_SSL_SET_WFD                               196
 #define SSL_F_SSL_SHUTDOWN                              224
-#define SSL_F_SSL_SRP_CTX_INIT                          293
+#define SSL_F_SSL_SRP_CTX_INIT                          304
 #define SSL_F_SSL_UNDEFINED_CONST_FUNCTION              243
 #define SSL_F_SSL_UNDEFINED_FUNCTION                    197
 #define SSL_F_SSL_UNDEFINED_VOID_FUNCTION               244
@@ -2152,11 +2152,11 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_BAD_RSA_MODULUS_LENGTH                    121
 #define SSL_R_BAD_RSA_SIGNATURE                                 122
 #define SSL_R_BAD_SIGNATURE                             123
-#define SSL_R_BAD_SRP_A_LENGTH                          2096
-#define SSL_R_BAD_SRP_B_LENGTH                          2097
-#define SSL_R_BAD_SRP_G_LENGTH                          2098
-#define SSL_R_BAD_SRP_N_LENGTH                          2099
-#define SSL_R_BAD_SRP_S_LENGTH                          2100
+#define SSL_R_BAD_SRP_A_LENGTH                          346
+#define SSL_R_BAD_SRP_B_LENGTH                          347
+#define SSL_R_BAD_SRP_G_LENGTH                          348
+#define SSL_R_BAD_SRP_N_LENGTH                          349
+#define SSL_R_BAD_SRP_S_LENGTH                          350
 #define SSL_R_BAD_SSL_FILETYPE                          124
 #define SSL_R_BAD_SSL_SESSION_ID_LENGTH                         125
 #define SSL_R_BAD_STATE                                         126
@@ -2173,7 +2173,6 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_CIPHER_CODE_WRONG_LENGTH                  137
 #define SSL_R_CIPHER_OR_HASH_UNAVAILABLE                138
 #define SSL_R_CIPHER_TABLE_SRC_ERROR                    139
-#define SSL_R_CLIENTHELLO_SRP_TLS_EXT                   2101
 #define SSL_R_CLIENTHELLO_TLSEXT                        226
 #define SSL_R_COMPRESSED_LENGTH_TOO_LONG                140
 #define SSL_R_COMPRESSION_DISABLED                      343
@@ -2210,7 +2209,7 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_INVALID_COMMAND                           280
 #define SSL_R_INVALID_COMPRESSION_ALGORITHM             341
 #define SSL_R_INVALID_PURPOSE                           278
-#define SSL_R_INVALID_SRP_USERNAME                      2107
+#define SSL_R_INVALID_SRP_USERNAME                      351
 #define SSL_R_INVALID_STATUS_RESPONSE                   328
 #define SSL_R_INVALID_TICKET_KEYS_LENGTH                325
 #define SSL_R_INVALID_TRUST                             279
@@ -2240,8 +2239,8 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_MISSING_RSA_CERTIFICATE                   168
 #define SSL_R_MISSING_RSA_ENCRYPTING_CERT               169
 #define SSL_R_MISSING_RSA_SIGNING_CERT                  170
-#define SSL_R_MISSING_SRP_PARAM                                 2103
-#define SSL_R_MISSING_SRP_USERNAME                      2104
+#define SSL_R_MISSING_SRP_PARAM                                 352
+#define SSL_R_MISSING_SRP_USERNAME                      353
 #define SSL_R_MISSING_TMP_DH_KEY                        171
 #define SSL_R_MISSING_TMP_ECDH_KEY                      311
 #define SSL_R_MISSING_TMP_RSA_KEY                       172
@@ -2314,7 +2313,7 @@ void ERR_load_SSL_strings(void);
 #define SSL_R_SESSION_ID_CONTEXT_UNINITIALIZED          277
 #define SSL_R_SHORT_READ                                219
 #define SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE     220
-#define SSL_R_SRP_A_CALC                                2105
+#define SSL_R_SRP_A_CALC                                354
 #define SSL_R_SSL23_DOING_SESSION_ID_REUSE              221
 #define SSL_R_SSL2_CONNECTION_ID_TOO_LONG               299
 #define SSL_R_SSL3_EXT_INVALID_ECPOINTFORMAT            321
index f7238b0..781fde1 100644 (file)
@@ -1,6 +1,6 @@
 /* ssl/ssl_err.c */
 /* ====================================================================
- * Copyright (c) 1999-2009 The OpenSSL Project.  All rights reserved.
+ * Copyright (c) 1999-2010 The OpenSSL Project.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -250,7 +250,7 @@ static ERR_STRING_DATA SSL_str_functs[]=
 {ERR_FUNC(SSL_F_SSL_SET_TRUST),        "SSL_set_trust"},
 {ERR_FUNC(SSL_F_SSL_SET_WFD),  "SSL_set_wfd"},
 {ERR_FUNC(SSL_F_SSL_SHUTDOWN), "SSL_shutdown"},
-{ERR_FUNC(SSL_F_SSL_SRP_CTX_INIT),     "SSL_SRP_CTX_INIT"},
+{ERR_FUNC(SSL_F_SSL_SRP_CTX_INIT),     "SSL_SRP_CTX_init"},
 {ERR_FUNC(SSL_F_SSL_UNDEFINED_CONST_FUNCTION), "SSL_UNDEFINED_CONST_FUNCTION"},
 {ERR_FUNC(SSL_F_SSL_UNDEFINED_FUNCTION),       "SSL_UNDEFINED_FUNCTION"},
 {ERR_FUNC(SSL_F_SSL_UNDEFINED_VOID_FUNCTION),  "SSL_UNDEFINED_VOID_FUNCTION"},
@@ -333,7 +333,6 @@ static ERR_STRING_DATA SSL_str_reasons[]=
 {ERR_REASON(SSL_R_CIPHER_CODE_WRONG_LENGTH),"cipher code wrong length"},
 {ERR_REASON(SSL_R_CIPHER_OR_HASH_UNAVAILABLE),"cipher or hash unavailable"},
 {ERR_REASON(SSL_R_CIPHER_TABLE_SRC_ERROR),"cipher table src error"},
-{ERR_REASON(SSL_R_CLIENTHELLO_SRP_TLS_EXT),"error with the SRP username"},
 {ERR_REASON(SSL_R_CLIENTHELLO_TLSEXT)    ,"clienthello tlsext"},
 {ERR_REASON(SSL_R_COMPRESSED_LENGTH_TOO_LONG),"compressed length too long"},
 {ERR_REASON(SSL_R_COMPRESSION_DISABLED)  ,"compression disabled"},