diff options
author | tedu <> | 2014-04-16 17:59:17 +0000 |
---|---|---|
committer | tedu <> | 2014-04-16 17:59:17 +0000 |
commit | 8cf170bf672c7d86b3903a219e445ba6138e7e95 (patch) | |
tree | fa8aa2c33679a60946ff76922a99938af26dde80 /src/lib/libssl/src/ssl/ssltest.c | |
parent | 2a02c4f91789a07715ed68ed2af2782ad52c815a (diff) | |
download | openbsd-8cf170bf672c7d86b3903a219e445ba6138e7e95.tar.gz openbsd-8cf170bf672c7d86b3903a219e445ba6138e7e95.tar.bz2 openbsd-8cf170bf672c7d86b3903a219e445ba6138e7e95.zip |
disentangle SRP code from TLS
Diffstat (limited to 'src/lib/libssl/src/ssl/ssltest.c')
-rw-r--r-- | src/lib/libssl/src/ssl/ssltest.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/src/lib/libssl/src/ssl/ssltest.c b/src/lib/libssl/src/ssl/ssltest.c index 771c50a3e1..1d43f5a0e8 100644 --- a/src/lib/libssl/src/ssl/ssltest.c +++ b/src/lib/libssl/src/ssl/ssltest.c | |||
@@ -182,9 +182,6 @@ | |||
182 | #ifndef OPENSSL_NO_DH | 182 | #ifndef OPENSSL_NO_DH |
183 | #include <openssl/dh.h> | 183 | #include <openssl/dh.h> |
184 | #endif | 184 | #endif |
185 | #ifndef OPENSSL_NO_SRP | ||
186 | #include <openssl/srp.h> | ||
187 | #endif | ||
188 | #include <openssl/bn.h> | 185 | #include <openssl/bn.h> |
189 | 186 | ||
190 | #define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared properly | 187 | #define _XOPEN_SOURCE_EXTENDED 1 /* Or gethostname won't be declared properly |
@@ -234,46 +231,6 @@ static unsigned int psk_server_callback(SSL *ssl, const char *identity, | |||
234 | unsigned char *psk, unsigned int max_psk_len); | 231 | unsigned char *psk, unsigned int max_psk_len); |
235 | #endif | 232 | #endif |
236 | 233 | ||
237 | #ifndef OPENSSL_NO_SRP | ||
238 | /* SRP client */ | ||
239 | /* This is a context that we pass to all callbacks */ | ||
240 | typedef struct srp_client_arg_st { | ||
241 | char *srppassin; | ||
242 | char *srplogin; | ||
243 | } SRP_CLIENT_ARG; | ||
244 | |||
245 | #define PWD_STRLEN 1024 | ||
246 | |||
247 | static char * | ||
248 | ssl_give_srp_client_pwd_cb(SSL *s, void *arg) | ||
249 | { | ||
250 | SRP_CLIENT_ARG *srp_client_arg = (SRP_CLIENT_ARG *)arg; | ||
251 | return BUF_strdup((char *)srp_client_arg->srppassin); | ||
252 | } | ||
253 | |||
254 | /* SRP server */ | ||
255 | /* This is a context that we pass to SRP server callbacks */ | ||
256 | typedef struct srp_server_arg_st { | ||
257 | char *expected_user; | ||
258 | char *pass; | ||
259 | } SRP_SERVER_ARG; | ||
260 | |||
261 | static int | ||
262 | ssl_srp_server_param_cb(SSL *s, int *ad, void *arg) | ||
263 | { | ||
264 | SRP_SERVER_ARG *p = (SRP_SERVER_ARG *) arg; | ||
265 | |||
266 | if (strcmp(p->expected_user, SSL_get_srp_username(s)) != 0) { | ||
267 | fprintf(stderr, "User %s doesn't exist\n", SSL_get_srp_username(s)); | ||
268 | return SSL3_AL_FATAL; | ||
269 | } | ||
270 | if (SSL_set_srp_server_param_pw(s, p->expected_user, p->pass, "1024") < 0) { | ||
271 | *ad = SSL_AD_INTERNAL_ERROR; | ||
272 | return SSL3_AL_FATAL; | ||
273 | } | ||
274 | return SSL_ERROR_NONE; | ||
275 | } | ||
276 | #endif | ||
277 | 234 | ||
278 | static BIO *bio_err = NULL; | 235 | static BIO *bio_err = NULL; |
279 | static BIO *bio_stdout = NULL; | 236 | static BIO *bio_stdout = NULL; |
@@ -320,10 +277,6 @@ sv_usage(void) | |||
320 | #ifndef OPENSSL_NO_PSK | 277 | #ifndef OPENSSL_NO_PSK |
321 | fprintf(stderr, " -psk arg - PSK in hex (without 0x)\n"); | 278 | fprintf(stderr, " -psk arg - PSK in hex (without 0x)\n"); |
322 | #endif | 279 | #endif |
323 | #ifndef OPENSSL_NO_SRP | ||
324 | fprintf(stderr, " -srpuser user - SRP username to use\n"); | ||
325 | fprintf(stderr, " -srppass arg - password for 'user'\n"); | ||
326 | #endif | ||
327 | fprintf(stderr, " -ssl3 - use SSLv3\n"); | 280 | fprintf(stderr, " -ssl3 - use SSLv3\n"); |
328 | fprintf(stderr, " -tls1 - use TLSv1\n"); | 281 | fprintf(stderr, " -tls1 - use TLSv1\n"); |
329 | fprintf(stderr, " -CApath arg - PEM format directory of CA's\n"); | 282 | fprintf(stderr, " -CApath arg - PEM format directory of CA's\n"); |
@@ -499,12 +452,6 @@ main(int argc, char *argv[]) | |||
499 | #ifndef OPENSSL_NO_ECDH | 452 | #ifndef OPENSSL_NO_ECDH |
500 | EC_KEY *ecdh = NULL; | 453 | EC_KEY *ecdh = NULL; |
501 | #endif | 454 | #endif |
502 | #ifndef OPENSSL_NO_SRP | ||
503 | /* client */ | ||
504 | SRP_CLIENT_ARG srp_client_arg = {NULL, NULL}; | ||
505 | /* server */ | ||
506 | SRP_SERVER_ARG srp_server_arg = {NULL, NULL}; | ||
507 | #endif | ||
508 | int no_dhe = 0; | 455 | int no_dhe = 0; |
509 | int no_ecdhe = 0; | 456 | int no_ecdhe = 0; |
510 | int no_psk = 0; | 457 | int no_psk = 0; |
@@ -594,19 +541,6 @@ main(int argc, char *argv[]) | |||
594 | no_psk = 1; | 541 | no_psk = 1; |
595 | #endif | 542 | #endif |
596 | } | 543 | } |
597 | #ifndef OPENSSL_NO_SRP | ||
598 | else if (strcmp(*argv, "-srpuser") == 0) { | ||
599 | if (--argc < 1) | ||
600 | goto bad; | ||
601 | srp_server_arg.expected_user = srp_client_arg.srplogin= *(++argv); | ||
602 | tls1 = 1; | ||
603 | } else if (strcmp(*argv, "-srppass") == 0) { | ||
604 | if (--argc < 1) | ||
605 | goto bad; | ||
606 | srp_server_arg.pass = srp_client_arg.srppassin= *(++argv); | ||
607 | tls1 = 1; | ||
608 | } | ||
609 | #endif | ||
610 | else if (strcmp(*argv, "-ssl2") == 0) | 544 | else if (strcmp(*argv, "-ssl2") == 0) |
611 | ssl2 = 1; | 545 | ssl2 = 1; |
612 | else if (strcmp(*argv, "-tls1") == 0) | 546 | else if (strcmp(*argv, "-tls1") == 0) |
@@ -914,23 +848,6 @@ bad: | |||
914 | } | 848 | } |
915 | #endif | 849 | #endif |
916 | } | 850 | } |
917 | #ifndef OPENSSL_NO_SRP | ||
918 | if (srp_client_arg.srplogin) { | ||
919 | if (!SSL_CTX_set_srp_username(c_ctx, srp_client_arg.srplogin)) { | ||
920 | BIO_printf(bio_err, "Unable to set SRP username\n"); | ||
921 | goto end; | ||
922 | } | ||
923 | SSL_CTX_set_srp_cb_arg(c_ctx, &srp_client_arg); | ||
924 | SSL_CTX_set_srp_client_pwd_callback(c_ctx, ssl_give_srp_client_pwd_cb); | ||
925 | /*SSL_CTX_set_srp_strength(c_ctx, srp_client_arg.strength);*/ | ||
926 | } | ||
927 | |||
928 | if (srp_server_arg.expected_user != NULL) { | ||
929 | SSL_CTX_set_verify(s_ctx, SSL_VERIFY_NONE, verify_callback); | ||
930 | SSL_CTX_set_srp_cb_arg(s_ctx, &srp_server_arg); | ||
931 | SSL_CTX_set_srp_username_callback(s_ctx, ssl_srp_server_param_cb); | ||
932 | } | ||
933 | #endif | ||
934 | 851 | ||
935 | c_ssl = SSL_new(c_ctx); | 852 | c_ssl = SSL_new(c_ctx); |
936 | s_ssl = SSL_new(s_ctx); | 853 | s_ssl = SSL_new(s_ctx); |