1 /*
2 * Copyright 2004-2021 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright (c) 2004, EdelKey Project. All Rights Reserved.
4 *
5 * Licensed under the Apache License 2.0 (the "License"). You may not use
6 * this file except in compliance with the License. You can obtain a copy
7 * in the file LICENSE in the source distribution or at
8 * https://www.openssl.org/source/license.html
9 *
10 * Originally written by Christophe Renou and Peter Sylvester,
11 * for the EdelKey project.
12 */
13
14 /*
15 * We need to use the SRP deprecated APIs in order to implement the SSL SRP
16 * APIs - which are themselves deprecated.
17 */
18 #define OPENSSL_SUPPRESS_DEPRECATED
19
20 #include <openssl/crypto.h>
21 #include <openssl/rand.h>
22 #include <openssl/err.h>
23 #include "ssl_local.h"
24
25 #ifndef OPENSSL_NO_SRP
26 # include <openssl/srp.h>
27
28 /*
29 * The public API SSL_CTX_SRP_CTX_free() is deprecated so we use
30 * ssl_ctx_srp_ctx_free_intern() internally.
31 */
ssl_ctx_srp_ctx_free_intern(SSL_CTX * ctx)32 int ssl_ctx_srp_ctx_free_intern(SSL_CTX *ctx)
33 {
34 if (ctx == NULL)
35 return 0;
36 OPENSSL_free(ctx->srp_ctx.login);
37 OPENSSL_free(ctx->srp_ctx.info);
38 BN_free(ctx->srp_ctx.N);
39 BN_free(ctx->srp_ctx.g);
40 BN_free(ctx->srp_ctx.s);
41 BN_free(ctx->srp_ctx.B);
42 BN_free(ctx->srp_ctx.A);
43 BN_free(ctx->srp_ctx.a);
44 BN_free(ctx->srp_ctx.b);
45 BN_free(ctx->srp_ctx.v);
46 memset(&ctx->srp_ctx, 0, sizeof(ctx->srp_ctx));
47 ctx->srp_ctx.strength = SRP_MINIMAL_N;
48 return 1;
49 }
50
SSL_CTX_SRP_CTX_free(SSL_CTX * ctx)51 int SSL_CTX_SRP_CTX_free(SSL_CTX *ctx)
52 {
53 return ssl_ctx_srp_ctx_free_intern(ctx);
54 }
55
56 /*
57 * The public API SSL_SRP_CTX_free() is deprecated so we use
58 * ssl_srp_ctx_free_intern() internally.
59 */
ssl_srp_ctx_free_intern(SSL_CONNECTION * s)60 int ssl_srp_ctx_free_intern(SSL_CONNECTION *s)
61 {
62 if (s == NULL)
63 return 0;
64 OPENSSL_free(s->srp_ctx.login);
65 OPENSSL_free(s->srp_ctx.info);
66 BN_free(s->srp_ctx.N);
67 BN_free(s->srp_ctx.g);
68 BN_free(s->srp_ctx.s);
69 BN_free(s->srp_ctx.B);
70 BN_free(s->srp_ctx.A);
71 BN_free(s->srp_ctx.a);
72 BN_free(s->srp_ctx.b);
73 BN_free(s->srp_ctx.v);
74 memset(&s->srp_ctx, 0, sizeof(s->srp_ctx));
75 s->srp_ctx.strength = SRP_MINIMAL_N;
76 return 1;
77 }
78
SSL_SRP_CTX_free(SSL * s)79 int SSL_SRP_CTX_free(SSL *s)
80 {
81 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
82
83 /* the call works with NULL sc */
84 return ssl_srp_ctx_free_intern(sc);
85 }
86
87 /*
88 * The public API SSL_SRP_CTX_init() is deprecated so we use
89 * ssl_srp_ctx_init_intern() internally.
90 */
ssl_srp_ctx_init_intern(SSL_CONNECTION * s)91 int ssl_srp_ctx_init_intern(SSL_CONNECTION *s)
92 {
93 SSL_CTX *ctx;
94
95 if (s == NULL || (ctx = SSL_CONNECTION_GET_CTX(s)) == NULL)
96 return 0;
97
98 memset(&s->srp_ctx, 0, sizeof(s->srp_ctx));
99
100 s->srp_ctx.SRP_cb_arg = ctx->srp_ctx.SRP_cb_arg;
101 /* set client Hello login callback */
102 s->srp_ctx.TLS_ext_srp_username_callback =
103 ctx->srp_ctx.TLS_ext_srp_username_callback;
104 /* set SRP N/g param callback for verification */
105 s->srp_ctx.SRP_verify_param_callback =
106 ctx->srp_ctx.SRP_verify_param_callback;
107 /* set SRP client passwd callback */
108 s->srp_ctx.SRP_give_srp_client_pwd_callback =
109 ctx->srp_ctx.SRP_give_srp_client_pwd_callback;
110
111 s->srp_ctx.strength = ctx->srp_ctx.strength;
112
113 if (((ctx->srp_ctx.N != NULL) &&
114 ((s->srp_ctx.N = BN_dup(ctx->srp_ctx.N)) == NULL)) ||
115 ((ctx->srp_ctx.g != NULL) &&
116 ((s->srp_ctx.g = BN_dup(ctx->srp_ctx.g)) == NULL)) ||
117 ((ctx->srp_ctx.s != NULL) &&
118 ((s->srp_ctx.s = BN_dup(ctx->srp_ctx.s)) == NULL)) ||
119 ((ctx->srp_ctx.B != NULL) &&
120 ((s->srp_ctx.B = BN_dup(ctx->srp_ctx.B)) == NULL)) ||
121 ((ctx->srp_ctx.A != NULL) &&
122 ((s->srp_ctx.A = BN_dup(ctx->srp_ctx.A)) == NULL)) ||
123 ((ctx->srp_ctx.a != NULL) &&
124 ((s->srp_ctx.a = BN_dup(ctx->srp_ctx.a)) == NULL)) ||
125 ((ctx->srp_ctx.v != NULL) &&
126 ((s->srp_ctx.v = BN_dup(ctx->srp_ctx.v)) == NULL)) ||
127 ((ctx->srp_ctx.b != NULL) &&
128 ((s->srp_ctx.b = BN_dup(ctx->srp_ctx.b)) == NULL))) {
129 ERR_raise(ERR_LIB_SSL, ERR_R_BN_LIB);
130 goto err;
131 }
132 if ((ctx->srp_ctx.login != NULL) &&
133 ((s->srp_ctx.login = OPENSSL_strdup(ctx->srp_ctx.login)) == NULL)) {
134 ERR_raise(ERR_LIB_SSL, ERR_R_INTERNAL_ERROR);
135 goto err;
136 }
137 if ((ctx->srp_ctx.info != NULL) &&
138 ((s->srp_ctx.info = OPENSSL_strdup(ctx->srp_ctx.info)) == NULL)) {
139 ERR_raise(ERR_LIB_SSL, ERR_R_INTERNAL_ERROR);
140 goto err;
141 }
142 s->srp_ctx.srp_Mask = ctx->srp_ctx.srp_Mask;
143
144 return 1;
145 err:
146 OPENSSL_free(s->srp_ctx.login);
147 OPENSSL_free(s->srp_ctx.info);
148 BN_free(s->srp_ctx.N);
149 BN_free(s->srp_ctx.g);
150 BN_free(s->srp_ctx.s);
151 BN_free(s->srp_ctx.B);
152 BN_free(s->srp_ctx.A);
153 BN_free(s->srp_ctx.a);
154 BN_free(s->srp_ctx.b);
155 BN_free(s->srp_ctx.v);
156 memset(&s->srp_ctx, 0, sizeof(s->srp_ctx));
157 return 0;
158 }
159
SSL_SRP_CTX_init(SSL * s)160 int SSL_SRP_CTX_init(SSL *s)
161 {
162 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
163
164 /* the call works with NULL sc */
165 return ssl_srp_ctx_init_intern(sc);
166 }
167
168 /*
169 * The public API SSL_CTX_SRP_CTX_init() is deprecated so we use
170 * ssl_ctx_srp_ctx_init_intern() internally.
171 */
ssl_ctx_srp_ctx_init_intern(SSL_CTX * ctx)172 int ssl_ctx_srp_ctx_init_intern(SSL_CTX *ctx)
173 {
174 if (ctx == NULL)
175 return 0;
176
177 memset(&ctx->srp_ctx, 0, sizeof(ctx->srp_ctx));
178 ctx->srp_ctx.strength = SRP_MINIMAL_N;
179
180 return 1;
181 }
182
SSL_CTX_SRP_CTX_init(SSL_CTX * ctx)183 int SSL_CTX_SRP_CTX_init(SSL_CTX *ctx)
184 {
185 return ssl_ctx_srp_ctx_init_intern(ctx);
186 }
187
188 /* server side */
189 /*
190 * The public API SSL_srp_server_param_with_username() is deprecated so we use
191 * ssl_srp_server_param_with_username_intern() internally.
192 */
ssl_srp_server_param_with_username_intern(SSL_CONNECTION * s,int * ad)193 int ssl_srp_server_param_with_username_intern(SSL_CONNECTION *s, int *ad)
194 {
195 unsigned char b[SSL_MAX_MASTER_KEY_LENGTH];
196 int al;
197 SSL_CTX *sctx = SSL_CONNECTION_GET_CTX(s);
198
199 *ad = SSL_AD_UNKNOWN_PSK_IDENTITY;
200 if ((s->srp_ctx.TLS_ext_srp_username_callback != NULL) &&
201 ((al =
202 s->srp_ctx.TLS_ext_srp_username_callback(SSL_CONNECTION_GET_USER_SSL(s),
203 ad,
204 s->srp_ctx.SRP_cb_arg)) !=
205 SSL_ERROR_NONE))
206 return al;
207
208 *ad = SSL_AD_INTERNAL_ERROR;
209 if ((s->srp_ctx.N == NULL) ||
210 (s->srp_ctx.g == NULL) ||
211 (s->srp_ctx.s == NULL) || (s->srp_ctx.v == NULL))
212 return SSL3_AL_FATAL;
213
214 if (RAND_priv_bytes_ex(SSL_CONNECTION_GET_CTX(s)->libctx, b, sizeof(b),
215 0) <= 0)
216 return SSL3_AL_FATAL;
217 s->srp_ctx.b = BN_bin2bn(b, sizeof(b), NULL);
218 OPENSSL_cleanse(b, sizeof(b));
219
220 /* Calculate: B = (kv + g^b) % N */
221
222 return ((s->srp_ctx.B =
223 SRP_Calc_B_ex(s->srp_ctx.b, s->srp_ctx.N, s->srp_ctx.g,
224 s->srp_ctx.v, sctx->libctx, sctx->propq)) !=
225 NULL) ? SSL_ERROR_NONE : SSL3_AL_FATAL;
226 }
227
SSL_srp_server_param_with_username(SSL * s,int * ad)228 int SSL_srp_server_param_with_username(SSL *s, int *ad)
229 {
230 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
231
232 if (sc == NULL)
233 return SSL3_AL_FATAL;
234
235 return ssl_srp_server_param_with_username_intern(sc, ad);
236 }
237
238 /*
239 * If the server just has the raw password, make up a verifier entry on the
240 * fly
241 */
SSL_set_srp_server_param_pw(SSL * s,const char * user,const char * pass,const char * grp)242 int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass,
243 const char *grp)
244 {
245 SRP_gN *GN;
246 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
247
248 if (sc == NULL)
249 return -1;
250
251 GN = SRP_get_default_gN(grp);
252 if (GN == NULL)
253 return -1;
254 sc->srp_ctx.N = BN_dup(GN->N);
255 sc->srp_ctx.g = BN_dup(GN->g);
256 BN_clear_free(sc->srp_ctx.v);
257 sc->srp_ctx.v = NULL;
258 BN_clear_free(sc->srp_ctx.s);
259 sc->srp_ctx.s = NULL;
260 if (!SRP_create_verifier_BN_ex(user, pass, &sc->srp_ctx.s, &sc->srp_ctx.v,
261 sc->srp_ctx.N, sc->srp_ctx.g, s->ctx->libctx,
262 s->ctx->propq))
263 return -1;
264
265 return 1;
266 }
267
SSL_set_srp_server_param(SSL * s,const BIGNUM * N,const BIGNUM * g,BIGNUM * sa,BIGNUM * v,char * info)268 int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
269 BIGNUM *sa, BIGNUM *v, char *info)
270 {
271 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
272
273 if (sc == NULL)
274 return -1;
275
276 if (N != NULL) {
277 if (sc->srp_ctx.N != NULL) {
278 if (!BN_copy(sc->srp_ctx.N, N)) {
279 BN_free(sc->srp_ctx.N);
280 sc->srp_ctx.N = NULL;
281 }
282 } else
283 sc->srp_ctx.N = BN_dup(N);
284 }
285 if (g != NULL) {
286 if (sc->srp_ctx.g != NULL) {
287 if (!BN_copy(sc->srp_ctx.g, g)) {
288 BN_free(sc->srp_ctx.g);
289 sc->srp_ctx.g = NULL;
290 }
291 } else
292 sc->srp_ctx.g = BN_dup(g);
293 }
294 if (sa != NULL) {
295 if (sc->srp_ctx.s != NULL) {
296 if (!BN_copy(sc->srp_ctx.s, sa)) {
297 BN_free(sc->srp_ctx.s);
298 sc->srp_ctx.s = NULL;
299 }
300 } else
301 sc->srp_ctx.s = BN_dup(sa);
302 }
303 if (v != NULL) {
304 if (sc->srp_ctx.v != NULL) {
305 if (!BN_copy(sc->srp_ctx.v, v)) {
306 BN_free(sc->srp_ctx.v);
307 sc->srp_ctx.v = NULL;
308 }
309 } else
310 sc->srp_ctx.v = BN_dup(v);
311 }
312 if (info != NULL) {
313 if (sc->srp_ctx.info)
314 OPENSSL_free(sc->srp_ctx.info);
315 if ((sc->srp_ctx.info = OPENSSL_strdup(info)) == NULL)
316 return -1;
317 }
318
319 if (!(sc->srp_ctx.N) ||
320 !(sc->srp_ctx.g) || !(sc->srp_ctx.s) || !(sc->srp_ctx.v))
321 return -1;
322
323 return 1;
324 }
325
srp_generate_server_master_secret(SSL_CONNECTION * s)326 int srp_generate_server_master_secret(SSL_CONNECTION *s)
327 {
328 BIGNUM *K = NULL, *u = NULL;
329 int ret = 0, tmp_len = 0;
330 unsigned char *tmp = NULL;
331 SSL_CTX *sctx = SSL_CONNECTION_GET_CTX(s);
332
333 if (!SRP_Verify_A_mod_N(s->srp_ctx.A, s->srp_ctx.N))
334 goto err;
335 if ((u = SRP_Calc_u_ex(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N,
336 sctx->libctx, sctx->propq)) == NULL)
337 goto err;
338 if ((K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b,
339 s->srp_ctx.N)) == NULL)
340 goto err;
341
342 tmp_len = BN_num_bytes(K);
343 if ((tmp = OPENSSL_malloc(tmp_len)) == NULL) {
344 SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_CRYPTO_LIB);
345 goto err;
346 }
347 BN_bn2bin(K, tmp);
348 /* Calls SSLfatal() as required */
349 ret = ssl_generate_master_secret(s, tmp, tmp_len, 1);
350 err:
351 BN_clear_free(K);
352 BN_clear_free(u);
353 return ret;
354 }
355
356 /* client side */
srp_generate_client_master_secret(SSL_CONNECTION * s)357 int srp_generate_client_master_secret(SSL_CONNECTION *s)
358 {
359 BIGNUM *x = NULL, *u = NULL, *K = NULL;
360 int ret = 0, tmp_len = 0;
361 char *passwd = NULL;
362 unsigned char *tmp = NULL;
363 SSL_CTX *sctx = SSL_CONNECTION_GET_CTX(s);
364
365 /*
366 * Checks if b % n == 0
367 */
368 if (SRP_Verify_B_mod_N(s->srp_ctx.B, s->srp_ctx.N) == 0
369 || (u = SRP_Calc_u_ex(s->srp_ctx.A, s->srp_ctx.B, s->srp_ctx.N,
370 sctx->libctx, sctx->propq))
371 == NULL
372 || s->srp_ctx.SRP_give_srp_client_pwd_callback == NULL) {
373 SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
374 goto err;
375 }
376 if ((passwd = s->srp_ctx.SRP_give_srp_client_pwd_callback(SSL_CONNECTION_GET_USER_SSL(s),
377 s->srp_ctx.SRP_cb_arg))
378 == NULL) {
379 SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_R_CALLBACK_FAILED);
380 goto err;
381 }
382 if ((x = SRP_Calc_x_ex(s->srp_ctx.s, s->srp_ctx.login, passwd,
383 sctx->libctx, sctx->propq)) == NULL
384 || (K = SRP_Calc_client_key_ex(s->srp_ctx.N, s->srp_ctx.B,
385 s->srp_ctx.g, x,
386 s->srp_ctx.a, u,
387 sctx->libctx,
388 sctx->propq)) == NULL) {
389 SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_INTERNAL_ERROR);
390 goto err;
391 }
392
393 tmp_len = BN_num_bytes(K);
394 if ((tmp = OPENSSL_malloc(tmp_len)) == NULL) {
395 SSLfatal(s, SSL_AD_INTERNAL_ERROR, ERR_R_CRYPTO_LIB);
396 goto err;
397 }
398 BN_bn2bin(K, tmp);
399 /* Calls SSLfatal() as required */
400 ret = ssl_generate_master_secret(s, tmp, tmp_len, 1);
401 err:
402 BN_clear_free(K);
403 BN_clear_free(x);
404 if (passwd != NULL)
405 OPENSSL_clear_free(passwd, strlen(passwd));
406 BN_clear_free(u);
407 return ret;
408 }
409
srp_verify_server_param(SSL_CONNECTION * s)410 int srp_verify_server_param(SSL_CONNECTION *s)
411 {
412 SRP_CTX *srp = &s->srp_ctx;
413 /*
414 * Sanity check parameters: we can quickly check B % N == 0 by checking B
415 * != 0 since B < N
416 */
417 if (BN_ucmp(srp->g, srp->N) >= 0 || BN_ucmp(srp->B, srp->N) >= 0
418 || BN_is_zero(srp->B)) {
419 SSLfatal(s, SSL_AD_ILLEGAL_PARAMETER, SSL_R_BAD_DATA);
420 return 0;
421 }
422
423 if (BN_num_bits(srp->N) < srp->strength) {
424 SSLfatal(s, SSL_AD_INSUFFICIENT_SECURITY, SSL_R_INSUFFICIENT_SECURITY);
425 return 0;
426 }
427
428 if (srp->SRP_verify_param_callback) {
429 if (srp->SRP_verify_param_callback(SSL_CONNECTION_GET_USER_SSL(s),
430 srp->SRP_cb_arg) <= 0) {
431 SSLfatal(s, SSL_AD_INSUFFICIENT_SECURITY, SSL_R_CALLBACK_FAILED);
432 return 0;
433 }
434 } else if (!SRP_check_known_gN_param(srp->g, srp->N)) {
435 SSLfatal(s, SSL_AD_INSUFFICIENT_SECURITY,
436 SSL_R_INSUFFICIENT_SECURITY);
437 return 0;
438 }
439
440 return 1;
441 }
442
443 /*
444 * The public API SRP_Calc_A_param() is deprecated so we use
445 * ssl_srp_calc_a_param_intern() internally.
446 */
ssl_srp_calc_a_param_intern(SSL_CONNECTION * s)447 int ssl_srp_calc_a_param_intern(SSL_CONNECTION *s)
448 {
449 unsigned char rnd[SSL_MAX_MASTER_KEY_LENGTH];
450
451 if (RAND_priv_bytes_ex(SSL_CONNECTION_GET_CTX(s)->libctx,
452 rnd, sizeof(rnd), 0) <= 0)
453 return 0;
454 s->srp_ctx.a = BN_bin2bn(rnd, sizeof(rnd), s->srp_ctx.a);
455 OPENSSL_cleanse(rnd, sizeof(rnd));
456
457 if (!(s->srp_ctx.A = SRP_Calc_A(s->srp_ctx.a, s->srp_ctx.N, s->srp_ctx.g)))
458 return 0;
459
460 return 1;
461 }
462
SRP_Calc_A_param(SSL * s)463 int SRP_Calc_A_param(SSL *s)
464 {
465 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
466
467 if (sc == NULL)
468 return 0;
469
470 return ssl_srp_calc_a_param_intern(sc);
471 }
472
SSL_get_srp_g(SSL * s)473 BIGNUM *SSL_get_srp_g(SSL *s)
474 {
475 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
476
477 if (sc == NULL)
478 return NULL;
479
480 if (sc->srp_ctx.g != NULL)
481 return sc->srp_ctx.g;
482 return s->ctx->srp_ctx.g;
483 }
484
SSL_get_srp_N(SSL * s)485 BIGNUM *SSL_get_srp_N(SSL *s)
486 {
487 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
488
489 if (sc == NULL)
490 return NULL;
491
492 if (sc->srp_ctx.N != NULL)
493 return sc->srp_ctx.N;
494 return s->ctx->srp_ctx.N;
495 }
496
SSL_get_srp_username(SSL * s)497 char *SSL_get_srp_username(SSL *s)
498 {
499 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
500
501 if (sc == NULL)
502 return NULL;
503
504 if (sc->srp_ctx.login != NULL)
505 return sc->srp_ctx.login;
506 return s->ctx->srp_ctx.login;
507 }
508
SSL_get_srp_userinfo(SSL * s)509 char *SSL_get_srp_userinfo(SSL *s)
510 {
511 SSL_CONNECTION *sc = SSL_CONNECTION_FROM_SSL(s);
512
513 if (sc == NULL)
514 return NULL;
515
516 if (sc->srp_ctx.info != NULL)
517 return sc->srp_ctx.info;
518 return s->ctx->srp_ctx.info;
519 }
520
521 # define tls1_ctx_ctrl ssl3_ctx_ctrl
522 # define tls1_ctx_callback_ctrl ssl3_ctx_callback_ctrl
523
SSL_CTX_set_srp_username(SSL_CTX * ctx,char * name)524 int SSL_CTX_set_srp_username(SSL_CTX *ctx, char *name)
525 {
526 return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_USERNAME, 0, name);
527 }
528
SSL_CTX_set_srp_password(SSL_CTX * ctx,char * password)529 int SSL_CTX_set_srp_password(SSL_CTX *ctx, char *password)
530 {
531 return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD, 0, password);
532 }
533
SSL_CTX_set_srp_strength(SSL_CTX * ctx,int strength)534 int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength)
535 {
536 return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH, strength,
537 NULL);
538 }
539
SSL_CTX_set_srp_verify_param_callback(SSL_CTX * ctx,int (* cb)(SSL *,void *))540 int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx,
541 int (*cb) (SSL *, void *))
542 {
543 return tls1_ctx_callback_ctrl(ctx, SSL_CTRL_SET_SRP_VERIFY_PARAM_CB,
544 (void (*)(void))cb);
545 }
546
SSL_CTX_set_srp_cb_arg(SSL_CTX * ctx,void * arg)547 int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg)
548 {
549 return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_SRP_ARG, 0, arg);
550 }
551
SSL_CTX_set_srp_username_callback(SSL_CTX * ctx,int (* cb)(SSL *,int *,void *))552 int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
553 int (*cb) (SSL *, int *, void *))
554 {
555 return tls1_ctx_callback_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB,
556 (void (*)(void))cb);
557 }
558
SSL_CTX_set_srp_client_pwd_callback(SSL_CTX * ctx,char * (* cb)(SSL *,void *))559 int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx,
560 char *(*cb) (SSL *, void *))
561 {
562 return tls1_ctx_callback_ctrl(ctx, SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB,
563 (void (*)(void))cb);
564 }
565
566 #endif
567