PR: 1794
[openssl.git] / ssl / tls_srp.c
1 /* ssl/tls_srp.c */
2 /* Written by Christophe Renou (christophe.renou@edelweb.fr) with 
3  * the precious help of Peter Sylvester (peter.sylvester@edelweb.fr) 
4  * for the EdelKey project and contributed to the OpenSSL project 2004.
5  */
6 /* ====================================================================
7  * Copyright (c) 2004 The OpenSSL Project.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer. 
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  *    notice, this list of conditions and the following disclaimer in
18  *    the documentation and/or other materials provided with the
19  *    distribution.
20  *
21  * 3. All advertising materials mentioning features or use of this
22  *    software must display the following acknowledgment:
23  *    "This product includes software developed by the OpenSSL Project
24  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
25  *
26  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
27  *    endorse or promote products derived from this software without
28  *    prior written permission. For written permission, please contact
29  *    licensing@OpenSSL.org.
30  *
31  * 5. Products derived from this software may not be called "OpenSSL"
32  *    nor may "OpenSSL" appear in their names without prior written
33  *    permission of the OpenSSL Project.
34  *
35  * 6. Redistributions of any form whatsoever must retain the following
36  *    acknowledgment:
37  *    "This product includes software developed by the OpenSSL Project
38  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
39  *
40  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
41  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
44  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51  * OF THE POSSIBILITY OF SUCH DAMAGE.
52  * ====================================================================
53  *
54  * This product includes cryptographic software written by Eric Young
55  * (eay@cryptsoft.com).  This product includes software written by Tim
56  * Hudson (tjh@cryptsoft.com).
57  *
58  */
59
60 #include <openssl/crypto.h>
61 #include <openssl/rand.h>
62 #include <openssl/srp.h>
63 #include <openssl/err.h>
64 #include "ssl_locl.h"
65
66 #ifndef OPENSSL_NO_SRP
67
68 int SSL_CTX_SRP_CTX_free(struct ssl_ctx_st *ctx)
69         {
70         if (ctx == NULL)
71                 return 0;
72         OPENSSL_free(ctx->srp_ctx.login);
73         BN_free(ctx->srp_ctx.N);
74         BN_free(ctx->srp_ctx.g);
75         BN_free(ctx->srp_ctx.s);
76         BN_free(ctx->srp_ctx.B);
77         BN_free(ctx->srp_ctx.A);
78         BN_free(ctx->srp_ctx.a);
79         BN_free(ctx->srp_ctx.b);
80         BN_free(ctx->srp_ctx.v);
81         ctx->srp_ctx.TLS_ext_srp_username_callback = NULL;
82         ctx->srp_ctx.SRP_cb_arg = NULL;
83         ctx->srp_ctx.SRP_verify_param_callback = NULL;
84         ctx->srp_ctx.SRP_give_srp_client_pwd_callback = NULL;
85         ctx->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback = NULL;
86         ctx->srp_ctx.N = NULL;
87         ctx->srp_ctx.g = NULL;
88         ctx->srp_ctx.s = NULL;
89         ctx->srp_ctx.B = NULL;
90         ctx->srp_ctx.A = NULL;
91         ctx->srp_ctx.a = NULL;
92         ctx->srp_ctx.b = NULL;
93         ctx->srp_ctx.v = NULL;
94         ctx->srp_ctx.login = NULL;
95         ctx->srp_ctx.info = NULL;
96         ctx->srp_ctx.strength = SRP_MINIMAL_N;
97         ctx->srp_ctx.srp_Mask = 0;
98         return (1);
99         }
100
101 int SSL_SRP_CTX_free(struct ssl_st *s)
102         {
103         if (s == NULL)
104                 return 0;
105         OPENSSL_free(s->srp_ctx.login);
106         BN_free(s->srp_ctx.N);
107         BN_free(s->srp_ctx.g);
108         BN_free(s->srp_ctx.s);
109         BN_free(s->srp_ctx.B);
110         BN_free(s->srp_ctx.A);
111         BN_free(s->srp_ctx.a);
112         BN_free(s->srp_ctx.b);
113         BN_free(s->srp_ctx.v);
114         s->srp_ctx.TLS_ext_srp_username_callback = NULL;
115         s->srp_ctx.SRP_cb_arg = NULL;
116         s->srp_ctx.SRP_verify_param_callback = NULL;
117         s->srp_ctx.SRP_give_srp_client_pwd_callback = NULL;
118         s->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback = NULL;
119         s->srp_ctx.N = NULL;
120         s->srp_ctx.g = NULL;
121         s->srp_ctx.s = NULL;
122         s->srp_ctx.B = NULL;
123         s->srp_ctx.A = NULL;
124         s->srp_ctx.a = NULL;
125         s->srp_ctx.b = NULL;
126         s->srp_ctx.v = NULL;
127         s->srp_ctx.login = NULL;
128         s->srp_ctx.info = NULL;
129         s->srp_ctx.strength = SRP_MINIMAL_N;
130         s->srp_ctx.srp_Mask = 0;
131         return (1);
132         }
133
134 int SSL_SRP_CTX_init(struct ssl_st *s)
135         {
136         SSL_CTX *ctx;
137
138         if ((s == NULL) || ((ctx = s->ctx) == NULL))
139                 return 0;
140         s->srp_ctx.SRP_cb_arg = ctx->srp_ctx.SRP_cb_arg;
141         /* set client Hello login callback */
142         s->srp_ctx.TLS_ext_srp_username_callback = ctx->srp_ctx.TLS_ext_srp_username_callback;
143         /* set SRP N/g param callback for verification */
144         s->srp_ctx.SRP_verify_param_callback = ctx->srp_ctx.SRP_verify_param_callback;
145         /* set SRP client passwd callback */
146         s->srp_ctx.SRP_give_srp_client_pwd_callback = ctx->srp_ctx.SRP_give_srp_client_pwd_callback;
147         s->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback = ctx->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback;
148
149         s->srp_ctx.N = NULL;
150         s->srp_ctx.g = NULL;
151         s->srp_ctx.s = NULL;
152         s->srp_ctx.B = NULL;
153         s->srp_ctx.A = NULL;
154         s->srp_ctx.a = NULL;
155         s->srp_ctx.b = NULL;
156         s->srp_ctx.v = NULL;
157         s->srp_ctx.login = NULL;
158         s->srp_ctx.info = ctx->srp_ctx.info;
159         s->srp_ctx.strength = ctx->srp_ctx.strength;
160
161         if (((ctx->srp_ctx.N != NULL) &&
162                  ((s->srp_ctx.N = BN_dup(ctx->srp_ctx.N)) == NULL)) ||
163                 ((ctx->srp_ctx.g != NULL) &&
164                  ((s->srp_ctx.g = BN_dup(ctx->srp_ctx.g)) == NULL)) ||
165                 ((ctx->srp_ctx.s != NULL) &&
166                  ((s->srp_ctx.s = BN_dup(ctx->srp_ctx.s)) == NULL)) ||
167                 ((ctx->srp_ctx.B != NULL) &&
168                  ((s->srp_ctx.B = BN_dup(ctx->srp_ctx.B)) == NULL)) ||
169                 ((ctx->srp_ctx.A != NULL) &&
170                  ((s->srp_ctx.A = BN_dup(ctx->srp_ctx.A)) == NULL)) ||
171                 ((ctx->srp_ctx.a != NULL) &&
172                  ((s->srp_ctx.a = BN_dup(ctx->srp_ctx.a)) == NULL)) ||
173                 ((ctx->srp_ctx.v != NULL) &&
174                  ((s->srp_ctx.v = BN_dup(ctx->srp_ctx.v)) == NULL)) ||
175                 ((ctx->srp_ctx.b != NULL) &&
176                  ((s->srp_ctx.b = BN_dup(ctx->srp_ctx.b)) == NULL)))
177                 {
178                 SSLerr(SSL_F_SSL_SRP_CTX_INIT,ERR_R_BN_LIB);
179                 goto err;
180                 }
181         if ((ctx->srp_ctx.login != NULL) && 
182                 ((s->srp_ctx.login = BUF_strdup(ctx->srp_ctx.login)) == NULL))
183                 {
184                 SSLerr(SSL_F_SSL_SRP_CTX_INIT,ERR_R_INTERNAL_ERROR);
185                 goto err;
186                 }
187         s->srp_ctx.srp_Mask = ctx->srp_ctx.srp_Mask;
188
189         return (1);
190 err:
191         OPENSSL_free(s->srp_ctx.login);
192         BN_free(s->srp_ctx.N);
193         BN_free(s->srp_ctx.g);
194         BN_free(s->srp_ctx.s);
195         BN_free(s->srp_ctx.B);
196         BN_free(s->srp_ctx.A);
197         BN_free(s->srp_ctx.a);
198         BN_free(s->srp_ctx.b);
199         BN_free(s->srp_ctx.v);
200         return (0);
201         }
202
203 int SSL_CTX_SRP_CTX_init(struct ssl_ctx_st *ctx)
204         {
205         if (ctx == NULL)
206                 return 0;
207
208         ctx->srp_ctx.SRP_cb_arg = NULL;
209         /* set client Hello login callback */
210         ctx->srp_ctx.TLS_ext_srp_username_callback = NULL;
211         /* set SRP N/g param callback for verification */
212         ctx->srp_ctx.SRP_verify_param_callback = NULL;
213         /* set SRP client passwd callback */
214         ctx->srp_ctx.SRP_give_srp_client_pwd_callback = NULL;
215         ctx->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback = NULL;
216
217         ctx->srp_ctx.N = NULL;
218         ctx->srp_ctx.g = NULL;
219         ctx->srp_ctx.s = NULL;
220         ctx->srp_ctx.B = NULL;
221         ctx->srp_ctx.A = NULL;
222         ctx->srp_ctx.a = NULL;
223         ctx->srp_ctx.b = NULL;
224         ctx->srp_ctx.v = NULL;
225         ctx->srp_ctx.login = NULL;
226         ctx->srp_ctx.srp_Mask = 0;
227         ctx->srp_ctx.info = NULL;
228         ctx->srp_ctx.strength = SRP_MINIMAL_N;
229
230         return (1);
231         }
232
233 /* server side */
234 int SSL_srp_server_param_with_username(SSL *s, int *ad)
235         {
236         unsigned char b[SSL_MAX_MASTER_KEY_LENGTH];
237         int al;
238
239         *ad = SSL_AD_UNKNOWN_PSK_IDENTITY;
240         if ((s->srp_ctx.TLS_ext_srp_username_callback !=NULL) &&
241                 ((al = s->srp_ctx.TLS_ext_srp_username_callback(s, ad, s->srp_ctx.SRP_cb_arg))!=SSL_ERROR_NONE))
242                         return al;
243
244         *ad = SSL_AD_INTERNAL_ERROR;
245         if ((s->srp_ctx.N == NULL) ||
246                 (s->srp_ctx.g == NULL) ||
247                 (s->srp_ctx.s == NULL) ||
248                 (s->srp_ctx.v == NULL))
249                 return SSL3_AL_FATAL;
250
251         if (RAND_bytes(b, sizeof(b)) <= 0)
252                 return SSL3_AL_FATAL;
253         s->srp_ctx.b = BN_bin2bn(b,sizeof(b),NULL);
254         OPENSSL_cleanse(b,sizeof(b));
255
256         /* Calculate:  B = (kv + g^b) % N  */
257
258         return ((s->srp_ctx.B = SRP_Calc_B(s->srp_ctx.b, s->srp_ctx.N, s->srp_ctx.g, s->srp_ctx.v)) != NULL)?
259                         SSL_ERROR_NONE:SSL3_AL_FATAL;
260         }
261
262 /* If the server just has the raw password, make up a verifier entry on the fly */
263 int SSL_set_srp_server_param_pw(SSL *s, const char *user, const char *pass, const char *grp)
264         {
265         SRP_gN *GN = SRP_get_default_gN(grp);
266         if(GN == NULL) return -1;
267         s->srp_ctx.N = BN_dup(GN->N);
268         s->srp_ctx.g = BN_dup(GN->g);
269         if(s->srp_ctx.v != NULL)
270                 {
271                 BN_clear_free(s->srp_ctx.v);
272                 s->srp_ctx.v = NULL;
273                 }
274         if(s->srp_ctx.s != NULL)
275                 {
276                 BN_clear_free(s->srp_ctx.s);
277                 s->srp_ctx.s = NULL;
278                 }
279         if(!SRP_create_verifier_BN(user, pass, &s->srp_ctx.s, &s->srp_ctx.v, GN->N, GN->g)) return -1;
280
281         return 1;
282         }
283
284 int SSL_set_srp_server_param(SSL *s, const BIGNUM *N, const BIGNUM *g,
285                              BIGNUM *sa, BIGNUM *v, char *info)
286         {
287         if (N!= NULL)
288                 {
289                 if (s->srp_ctx.N != NULL)
290                         {
291                         if (!BN_copy(s->srp_ctx.N,N))
292                                 {
293                                 BN_free(s->srp_ctx.N);
294                                 s->srp_ctx.N = NULL;
295                                 }
296                         }
297                 else
298                         s->srp_ctx.N = BN_dup(N);
299                 }
300         if (g!= NULL)
301                 {
302                 if (s->srp_ctx.g != NULL)
303                         {
304                         if (!BN_copy(s->srp_ctx.g,g))
305                                 {
306                                 BN_free(s->srp_ctx.g);
307                                 s->srp_ctx.g = NULL;
308                                 }
309                         }
310                 else
311                         s->srp_ctx.g = BN_dup(g);
312                 }
313         if (sa!= NULL)
314                 {
315                 if (s->srp_ctx.s != NULL)
316                         {
317                         if (!BN_copy(s->srp_ctx.s,sa))
318                                 {
319                                 BN_free(s->srp_ctx.s);
320                                 s->srp_ctx.s = NULL;
321                                 }
322                         }
323                 else
324                         s->srp_ctx.s = BN_dup(sa);
325                 }
326         if (v!= NULL)
327                 {
328                 if (s->srp_ctx.v != NULL)
329                         {
330                         if (!BN_copy(s->srp_ctx.v,v))
331                                 {
332                                 BN_free(s->srp_ctx.v);
333                                 s->srp_ctx.v = NULL;
334                                 }
335                         }
336                 else
337                         s->srp_ctx.v = BN_dup(v);
338                 }
339         s->srp_ctx.info = info;
340
341         if (!(s->srp_ctx.N) ||
342                 !(s->srp_ctx.g) ||
343                 !(s->srp_ctx.s) ||
344                 !(s->srp_ctx.v))
345                 return -1;
346
347         return 1;
348         }
349
350 int SRP_generate_server_master_secret(SSL *s,unsigned char *master_key)
351         {
352         BIGNUM *K = NULL, *u = NULL;
353         int ret = -1, tmp_len;
354         unsigned char *tmp = NULL;
355
356         if (!SRP_Verify_A_mod_N(s->srp_ctx.A,s->srp_ctx.N))
357                 goto err;
358         if (!(u = SRP_Calc_u(s->srp_ctx.A,s->srp_ctx.B,s->srp_ctx.N)))
359                 goto err;
360         if (!(K = SRP_Calc_server_key(s->srp_ctx.A, s->srp_ctx.v, u, s->srp_ctx.b, s->srp_ctx.N)))
361                 goto err;
362
363         tmp_len = BN_num_bytes(K);
364         if ((tmp = OPENSSL_malloc(tmp_len)) == NULL)
365                 goto err;
366         BN_bn2bin(K, tmp);
367         ret = s->method->ssl3_enc->generate_master_secret(s,master_key,tmp,tmp_len);
368 err:
369         if (tmp)
370                 {
371                 OPENSSL_cleanse(tmp,tmp_len) ;
372                 OPENSSL_free(tmp);
373                 }
374         BN_clear_free(K);
375         BN_clear_free(u);
376         return ret;
377         }
378
379 /* client side */
380 int SRP_generate_client_master_secret(SSL *s,unsigned char *master_key)
381         {
382         BIGNUM *x = NULL, *u = NULL, *K = NULL;
383         int ret = -1, tmp_len;
384         char *passwd = NULL;
385         unsigned char *tmp = NULL;
386
387         /* Checks if b % n == 0
388          */
389         if (SRP_Verify_B_mod_N(s->srp_ctx.B,s->srp_ctx.N)==0) goto err;
390         if (!(u = SRP_Calc_u(s->srp_ctx.A,s->srp_ctx.B,s->srp_ctx.N))) goto err;
391         if (s->srp_ctx.SRP_give_srp_client_pwd_callback == NULL) goto err;
392         if (!(passwd = s->srp_ctx.SRP_give_srp_client_pwd_callback(s, s->srp_ctx.SRP_cb_arg))) goto err;
393         if (!(x = SRP_Calc_x(s->srp_ctx.s,s->srp_ctx.login,passwd))) goto err;
394         if (!(K = SRP_Calc_client_key(s->srp_ctx.N, s->srp_ctx.B, s->srp_ctx.g, x, s->srp_ctx.a, u))) goto err;
395
396         tmp_len = BN_num_bytes(K);
397         if ((tmp = OPENSSL_malloc(tmp_len)) == NULL) goto err;
398         BN_bn2bin(K, tmp);
399         ret = s->method->ssl3_enc->generate_master_secret(s,master_key,tmp,tmp_len);
400 err:
401         if (tmp)
402                 {
403                 OPENSSL_cleanse(tmp,tmp_len) ;
404                 OPENSSL_free(tmp);
405                 }
406         BN_clear_free(K);
407         BN_clear_free(x);
408         if (passwd)
409                 {
410                 OPENSSL_cleanse(passwd,strlen(passwd)) ;
411                 OPENSSL_free(passwd);
412                 }
413         BN_clear_free(u);
414         return ret;
415         }
416
417 int SRP_Calc_A_param(SSL *s)
418         {
419         unsigned char rnd[SSL_MAX_MASTER_KEY_LENGTH];
420
421         if (BN_num_bits(s->srp_ctx.N) < s->srp_ctx.strength)
422                 return 0;
423
424         if (s->srp_ctx.SRP_verify_param_callback ==NULL && 
425                 !SRP_check_known_gN_param(s->srp_ctx.g,s->srp_ctx.N))
426                 return 0;
427
428         if (RAND_bytes(rnd, sizeof(rnd)) <= 0)
429                 return 0;
430         s->srp_ctx.a = BN_bin2bn(rnd,sizeof(rnd), s->srp_ctx.a);
431         OPENSSL_cleanse(rnd,sizeof(rnd));
432
433         if (!(s->srp_ctx.A = SRP_Calc_A(s->srp_ctx.a,s->srp_ctx.N,s->srp_ctx.g)))
434                 return 0;
435
436         /* We can have a callback to verify SRP param!! */
437         if (s->srp_ctx.SRP_verify_param_callback !=NULL) 
438                 return s->srp_ctx.SRP_verify_param_callback(s,s->srp_ctx.SRP_cb_arg);
439
440         return 1;
441         }
442
443 int SRP_have_to_put_srp_username(SSL *s)
444         {
445         if (s->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback == NULL)
446                 return 0;
447         if ((s->srp_ctx.login = s->srp_ctx.SRP_TLS_ext_missing_srp_client_username_callback(s,s->srp_ctx.SRP_cb_arg)) == NULL)
448                 return 0;
449         s->srp_ctx.srp_Mask|=SSL_kSRP;
450         return 1;
451         }
452
453 BIGNUM *SSL_get_srp_g(SSL *s)
454         {
455         if (s->srp_ctx.g != NULL)
456                 return s->srp_ctx.g;
457         return s->ctx->srp_ctx.g;
458         }
459
460 BIGNUM *SSL_get_srp_N(SSL *s)
461         {
462         if (s->srp_ctx.N != NULL)
463                 return s->srp_ctx.N;
464         return s->ctx->srp_ctx.N;
465         }
466
467 char *SSL_get_srp_username(SSL *s)
468         {
469         if (s->srp_ctx.login != NULL)
470                 return s->srp_ctx.login;
471         return s->ctx->srp_ctx.login;
472         }
473
474 char *SSL_get_srp_userinfo(SSL *s)
475         {
476         if (s->srp_ctx.info != NULL)
477                 return s->srp_ctx.info;
478         return s->ctx->srp_ctx.info;
479         }
480
481 #define tls1_ctx_ctrl ssl3_ctx_ctrl
482 #define tls1_ctx_callback_ctrl ssl3_ctx_callback_ctrl
483
484 int SSL_CTX_set_srp_username(SSL_CTX *ctx,char *name)
485         {
486         return tls1_ctx_ctrl(ctx,SSL_CTRL_SET_TLS_EXT_SRP_USERNAME,0,name);
487         }
488
489 int SSL_CTX_set_srp_password(SSL_CTX *ctx,char *password)
490         {
491         return tls1_ctx_ctrl(ctx,SSL_CTRL_SET_TLS_EXT_SRP_PASSWORD,0,password);
492         }
493
494 int SSL_CTX_set_srp_strength(SSL_CTX *ctx, int strength)
495         {
496         return tls1_ctx_ctrl(ctx, SSL_CTRL_SET_TLS_EXT_SRP_STRENGTH, strength,
497                              NULL);
498         }
499
500 int SSL_CTX_set_srp_verify_param_callback(SSL_CTX *ctx, int (*cb)(SSL *,void *))
501         {
502         return tls1_ctx_callback_ctrl(ctx,SSL_CTRL_SET_SRP_VERIFY_PARAM_CB,
503                                       (void (*)(void))cb);
504         }
505
506 int SSL_CTX_set_srp_cb_arg(SSL_CTX *ctx, void *arg)
507         {
508         return tls1_ctx_ctrl(ctx,SSL_CTRL_SET_SRP_ARG,0,arg);
509         }
510
511 int SSL_CTX_set_srp_username_callback(SSL_CTX *ctx,
512                                       int (*cb)(SSL *,int *,void *))
513         {
514         return tls1_ctx_callback_ctrl(ctx,SSL_CTRL_SET_TLS_EXT_SRP_USERNAME_CB,
515                                       (void (*)(void))cb);
516         }
517
518 int SSL_CTX_set_srp_client_pwd_callback(SSL_CTX *ctx, char *(*cb)(SSL *,void *))
519         {
520         return tls1_ctx_callback_ctrl(ctx,SSL_CTRL_SET_SRP_GIVE_CLIENT_PWD_CB,
521                                       (void (*)(void))cb);
522         }
523
524 int SSL_CTX_set_srp_missing_srp_username_callback(SSL_CTX *ctx,
525                                                   char *(*cb)(SSL *,void *))
526         {
527         return tls1_ctx_callback_ctrl(ctx,
528                             SSL_CTRL_SET_TLS_EXT_SRP_MISSING_CLIENT_USERNAME_CB,
529                                       (void (*)(void))cb);
530         }
531 #endif