Remove broken DSA private key workarounds.
[openssl.git] / crypto / dsa / dsa_ameth.c
1 /*
2  * Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL project
3  * 2006.
4  */
5 /* ====================================================================
6  * Copyright (c) 2006 The OpenSSL Project.  All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  *
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in
17  *    the documentation and/or other materials provided with the
18  *    distribution.
19  *
20  * 3. All advertising materials mentioning features or use of this
21  *    software must display the following acknowledgment:
22  *    "This product includes software developed by the OpenSSL Project
23  *    for use in the OpenSSL Toolkit. (http://www.OpenSSL.org/)"
24  *
25  * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
26  *    endorse or promote products derived from this software without
27  *    prior written permission. For written permission, please contact
28  *    licensing@OpenSSL.org.
29  *
30  * 5. Products derived from this software may not be called "OpenSSL"
31  *    nor may "OpenSSL" appear in their names without prior written
32  *    permission of the OpenSSL Project.
33  *
34  * 6. Redistributions of any form whatsoever must retain the following
35  *    acknowledgment:
36  *    "This product includes software developed by the OpenSSL Project
37  *    for use in the OpenSSL Toolkit (http://www.OpenSSL.org/)"
38  *
39  * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
40  * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
41  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
42  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
45  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
46  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
47  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
48  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
49  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
50  * OF THE POSSIBILITY OF SUCH DAMAGE.
51  * ====================================================================
52  *
53  * This product includes cryptographic software written by Eric Young
54  * (eay@cryptsoft.com).  This product includes software written by Tim
55  * Hudson (tjh@cryptsoft.com).
56  *
57  */
58
59 #include <stdio.h>
60 #include "internal/cryptlib.h"
61 #include <openssl/x509.h>
62 #include <openssl/asn1.h>
63 #include <openssl/dsa.h>
64 #include <openssl/bn.h>
65 #ifndef OPENSSL_NO_CMS
66 # include <openssl/cms.h>
67 #endif
68 #include "internal/asn1_int.h"
69 #include "internal/evp_int.h"
70
71 static int dsa_pub_decode(EVP_PKEY *pkey, X509_PUBKEY *pubkey)
72 {
73     const unsigned char *p, *pm;
74     int pklen, pmlen;
75     int ptype;
76     void *pval;
77     ASN1_STRING *pstr;
78     X509_ALGOR *palg;
79     ASN1_INTEGER *public_key = NULL;
80
81     DSA *dsa = NULL;
82
83     if (!X509_PUBKEY_get0_param(NULL, &p, &pklen, &palg, pubkey))
84         return 0;
85     X509_ALGOR_get0(NULL, &ptype, &pval, palg);
86
87     if (ptype == V_ASN1_SEQUENCE) {
88         pstr = pval;
89         pm = pstr->data;
90         pmlen = pstr->length;
91
92         if ((dsa = d2i_DSAparams(NULL, &pm, pmlen)) == NULL) {
93             DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
94             goto err;
95         }
96
97     } else if ((ptype == V_ASN1_NULL) || (ptype == V_ASN1_UNDEF)) {
98         if ((dsa = DSA_new()) == NULL) {
99             DSAerr(DSA_F_DSA_PUB_DECODE, ERR_R_MALLOC_FAILURE);
100             goto err;
101         }
102     } else {
103         DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_PARAMETER_ENCODING_ERROR);
104         goto err;
105     }
106
107     if ((public_key = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL) {
108         DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_DECODE_ERROR);
109         goto err;
110     }
111
112     if ((dsa->pub_key = ASN1_INTEGER_to_BN(public_key, NULL)) == NULL) {
113         DSAerr(DSA_F_DSA_PUB_DECODE, DSA_R_BN_DECODE_ERROR);
114         goto err;
115     }
116
117     ASN1_INTEGER_free(public_key);
118     EVP_PKEY_assign_DSA(pkey, dsa);
119     return 1;
120
121  err:
122     ASN1_INTEGER_free(public_key);
123     DSA_free(dsa);
124     return 0;
125
126 }
127
128 static int dsa_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
129 {
130     DSA *dsa;
131     int ptype;
132     unsigned char *penc = NULL;
133     int penclen;
134     ASN1_STRING *str = NULL;
135     ASN1_INTEGER *pubint = NULL;
136
137     dsa = pkey->pkey.dsa;
138     if (pkey->save_parameters && dsa->p && dsa->q && dsa->g) {
139         str = ASN1_STRING_new();
140         if (str == NULL) {
141             DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
142             goto err;
143         }
144         str->length = i2d_DSAparams(dsa, &str->data);
145         if (str->length <= 0) {
146             DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
147             goto err;
148         }
149         ptype = V_ASN1_SEQUENCE;
150     } else
151         ptype = V_ASN1_UNDEF;
152
153     pubint = BN_to_ASN1_INTEGER(dsa->pub_key, NULL);
154
155     if (pubint == NULL) {
156         DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
157         goto err;
158     }
159
160     penclen = i2d_ASN1_INTEGER(pubint, &penc);
161     ASN1_INTEGER_free(pubint);
162
163     if (penclen <= 0) {
164         DSAerr(DSA_F_DSA_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
165         goto err;
166     }
167
168     if (X509_PUBKEY_set0_param(pk, OBJ_nid2obj(EVP_PKEY_DSA),
169                                ptype, str, penc, penclen))
170         return 1;
171
172  err:
173     OPENSSL_free(penc);
174     ASN1_STRING_free(str);
175
176     return 0;
177 }
178
179 /*
180  * In PKCS#8 DSA: you just get a private key integer and parameters in the
181  * AlgorithmIdentifier the pubkey must be recalculated.
182  */
183
184 static int dsa_priv_decode(EVP_PKEY *pkey, PKCS8_PRIV_KEY_INFO *p8)
185 {
186     const unsigned char *p, *q, *pm;
187     int pklen, pmlen;
188     int ptype;
189     void *pval;
190     ASN1_STRING *pstr;
191     X509_ALGOR *palg;
192     ASN1_INTEGER *privkey = NULL;
193     BN_CTX *ctx = NULL;
194
195     DSA *dsa = NULL;
196
197     int ret = 0;
198
199     if (!PKCS8_pkey_get0(NULL, &p, &pklen, &palg, p8))
200         return 0;
201     X509_ALGOR_get0(NULL, &ptype, &pval, palg);
202
203     q = p;
204
205     if ((privkey = d2i_ASN1_INTEGER(NULL, &p, pklen)) == NULL)
206         goto decerr;
207     if (privkey->type == V_ASN1_NEG_INTEGER) {
208         p8->broken = PKCS8_NEG_PRIVKEY;
209         ASN1_STRING_clear_free(privkey);
210         if ((privkey = d2i_ASN1_UINTEGER(NULL, &q, pklen)) == NULL)
211             goto decerr;
212     }
213     if (ptype != V_ASN1_SEQUENCE)
214         goto decerr;
215
216     pstr = pval;
217     pm = pstr->data;
218     pmlen = pstr->length;
219     if ((dsa = d2i_DSAparams(NULL, &pm, pmlen)) == NULL)
220         goto decerr;
221     /* We have parameters now set private key */
222     if ((dsa->priv_key = BN_secure_new()) == NULL
223         || !ASN1_INTEGER_to_BN(privkey, dsa->priv_key)) {
224         DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR);
225         goto dsaerr;
226     }
227     /* Calculate public key */
228     if ((dsa->pub_key = BN_new()) == NULL) {
229         DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
230         goto dsaerr;
231     }
232     if ((ctx = BN_CTX_new()) == NULL) {
233         DSAerr(DSA_F_DSA_PRIV_DECODE, ERR_R_MALLOC_FAILURE);
234         goto dsaerr;
235     }
236
237     if (!BN_mod_exp(dsa->pub_key, dsa->g, dsa->priv_key, dsa->p, ctx)) {
238         DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_BN_ERROR);
239         goto dsaerr;
240     }
241
242     EVP_PKEY_assign_DSA(pkey, dsa);
243
244     ret = 1;
245     goto done;
246
247  decerr:
248     DSAerr(DSA_F_DSA_PRIV_DECODE, DSA_R_DECODE_ERROR);
249  dsaerr:
250     DSA_free(dsa);
251  done:
252     BN_CTX_free(ctx);
253     ASN1_STRING_clear_free(privkey);
254     return ret;
255 }
256
257 static int dsa_priv_encode(PKCS8_PRIV_KEY_INFO *p8, const EVP_PKEY *pkey)
258 {
259     ASN1_STRING *params = NULL;
260     ASN1_INTEGER *prkey = NULL;
261     unsigned char *dp = NULL;
262     int dplen;
263
264     if (!pkey->pkey.dsa || !pkey->pkey.dsa->priv_key) {
265         DSAerr(DSA_F_DSA_PRIV_ENCODE, DSA_R_MISSING_PARAMETERS);
266         goto err;
267     }
268
269     params = ASN1_STRING_new();
270
271     if (params == NULL) {
272         DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
273         goto err;
274     }
275
276     params->length = i2d_DSAparams(pkey->pkey.dsa, &params->data);
277     if (params->length <= 0) {
278         DSAerr(DSA_F_DSA_PRIV_ENCODE, ERR_R_MALLOC_FAILURE);
279         goto err;
280     }
281     params->type = V_ASN1_SEQUENCE;
282
283     /* Get private key into integer */
284     prkey = BN_to_ASN1_INTEGER(pkey->pkey.dsa->priv_key, NULL);
285
286     if (!prkey) {
287         DSAerr(DSA_F_DSA_PRIV_ENCODE, DSA_R_BN_ERROR);
288         goto err;
289     }
290
291     dplen = i2d_ASN1_INTEGER(prkey, &dp);
292
293     ASN1_STRING_clear_free(prkey);
294     prkey = NULL;
295
296     if (!PKCS8_pkey_set0(p8, OBJ_nid2obj(NID_dsa), 0,
297                          V_ASN1_SEQUENCE, params, dp, dplen))
298         goto err;
299
300     return 1;
301
302  err:
303     OPENSSL_free(dp);
304     ASN1_STRING_free(params);
305     ASN1_STRING_clear_free(prkey);
306     return 0;
307 }
308
309 static int int_dsa_size(const EVP_PKEY *pkey)
310 {
311     return (DSA_size(pkey->pkey.dsa));
312 }
313
314 static int dsa_bits(const EVP_PKEY *pkey)
315 {
316     return BN_num_bits(pkey->pkey.dsa->p);
317 }
318
319 static int dsa_security_bits(const EVP_PKEY *pkey)
320 {
321     return DSA_security_bits(pkey->pkey.dsa);
322 }
323
324 static int dsa_missing_parameters(const EVP_PKEY *pkey)
325 {
326     DSA *dsa;
327     dsa = pkey->pkey.dsa;
328     if ((dsa->p == NULL) || (dsa->q == NULL) || (dsa->g == NULL))
329         return 1;
330     return 0;
331 }
332
333 static int dsa_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
334 {
335     BIGNUM *a;
336
337     if (to->pkey.dsa == NULL) {
338         to->pkey.dsa = DSA_new();
339         if (to->pkey.dsa == NULL)
340             return 0;
341     }
342
343     if ((a = BN_dup(from->pkey.dsa->p)) == NULL)
344         return 0;
345     BN_free(to->pkey.dsa->p);
346     to->pkey.dsa->p = a;
347
348     if ((a = BN_dup(from->pkey.dsa->q)) == NULL)
349         return 0;
350     BN_free(to->pkey.dsa->q);
351     to->pkey.dsa->q = a;
352
353     if ((a = BN_dup(from->pkey.dsa->g)) == NULL)
354         return 0;
355     BN_free(to->pkey.dsa->g);
356     to->pkey.dsa->g = a;
357     return 1;
358 }
359
360 static int dsa_cmp_parameters(const EVP_PKEY *a, const EVP_PKEY *b)
361 {
362     if (BN_cmp(a->pkey.dsa->p, b->pkey.dsa->p) ||
363         BN_cmp(a->pkey.dsa->q, b->pkey.dsa->q) ||
364         BN_cmp(a->pkey.dsa->g, b->pkey.dsa->g))
365         return 0;
366     else
367         return 1;
368 }
369
370 static int dsa_pub_cmp(const EVP_PKEY *a, const EVP_PKEY *b)
371 {
372     if (BN_cmp(b->pkey.dsa->pub_key, a->pkey.dsa->pub_key) != 0)
373         return 0;
374     else
375         return 1;
376 }
377
378 static void int_dsa_free(EVP_PKEY *pkey)
379 {
380     DSA_free(pkey->pkey.dsa);
381 }
382
383 static void update_buflen(const BIGNUM *b, size_t *pbuflen)
384 {
385     size_t i;
386     if (!b)
387         return;
388     if (*pbuflen < (i = (size_t)BN_num_bytes(b)))
389         *pbuflen = i;
390 }
391
392 static int do_dsa_print(BIO *bp, const DSA *x, int off, int ptype)
393 {
394     unsigned char *m = NULL;
395     int ret = 0;
396     size_t buf_len = 0;
397     const char *ktype = NULL;
398
399     const BIGNUM *priv_key, *pub_key;
400
401     if (ptype == 2)
402         priv_key = x->priv_key;
403     else
404         priv_key = NULL;
405
406     if (ptype > 0)
407         pub_key = x->pub_key;
408     else
409         pub_key = NULL;
410
411     if (ptype == 2)
412         ktype = "Private-Key";
413     else if (ptype == 1)
414         ktype = "Public-Key";
415     else
416         ktype = "DSA-Parameters";
417
418     update_buflen(x->p, &buf_len);
419     update_buflen(x->q, &buf_len);
420     update_buflen(x->g, &buf_len);
421     update_buflen(priv_key, &buf_len);
422     update_buflen(pub_key, &buf_len);
423
424     m = OPENSSL_malloc(buf_len + 10);
425     if (m == NULL) {
426         DSAerr(DSA_F_DO_DSA_PRINT, ERR_R_MALLOC_FAILURE);
427         goto err;
428     }
429
430     if (priv_key) {
431         if (!BIO_indent(bp, off, 128))
432             goto err;
433         if (BIO_printf(bp, "%s: (%d bit)\n", ktype, BN_num_bits(x->p))
434             <= 0)
435             goto err;
436     }
437
438     if (!ASN1_bn_print(bp, "priv:", priv_key, m, off))
439         goto err;
440     if (!ASN1_bn_print(bp, "pub: ", pub_key, m, off))
441         goto err;
442     if (!ASN1_bn_print(bp, "P:   ", x->p, m, off))
443         goto err;
444     if (!ASN1_bn_print(bp, "Q:   ", x->q, m, off))
445         goto err;
446     if (!ASN1_bn_print(bp, "G:   ", x->g, m, off))
447         goto err;
448     ret = 1;
449  err:
450     OPENSSL_free(m);
451     return (ret);
452 }
453
454 static int dsa_param_decode(EVP_PKEY *pkey,
455                             const unsigned char **pder, int derlen)
456 {
457     DSA *dsa;
458
459     if ((dsa = d2i_DSAparams(NULL, pder, derlen)) == NULL) {
460         DSAerr(DSA_F_DSA_PARAM_DECODE, ERR_R_DSA_LIB);
461         return 0;
462     }
463     EVP_PKEY_assign_DSA(pkey, dsa);
464     return 1;
465 }
466
467 static int dsa_param_encode(const EVP_PKEY *pkey, unsigned char **pder)
468 {
469     return i2d_DSAparams(pkey->pkey.dsa, pder);
470 }
471
472 static int dsa_param_print(BIO *bp, const EVP_PKEY *pkey, int indent,
473                            ASN1_PCTX *ctx)
474 {
475     return do_dsa_print(bp, pkey->pkey.dsa, indent, 0);
476 }
477
478 static int dsa_pub_print(BIO *bp, const EVP_PKEY *pkey, int indent,
479                          ASN1_PCTX *ctx)
480 {
481     return do_dsa_print(bp, pkey->pkey.dsa, indent, 1);
482 }
483
484 static int dsa_priv_print(BIO *bp, const EVP_PKEY *pkey, int indent,
485                           ASN1_PCTX *ctx)
486 {
487     return do_dsa_print(bp, pkey->pkey.dsa, indent, 2);
488 }
489
490 static int old_dsa_priv_decode(EVP_PKEY *pkey,
491                                const unsigned char **pder, int derlen)
492 {
493     DSA *dsa;
494
495     if ((dsa = d2i_DSAPrivateKey(NULL, pder, derlen)) == NULL) {
496         DSAerr(DSA_F_OLD_DSA_PRIV_DECODE, ERR_R_DSA_LIB);
497         return 0;
498     }
499     EVP_PKEY_assign_DSA(pkey, dsa);
500     return 1;
501 }
502
503 static int old_dsa_priv_encode(const EVP_PKEY *pkey, unsigned char **pder)
504 {
505     return i2d_DSAPrivateKey(pkey->pkey.dsa, pder);
506 }
507
508 static int dsa_sig_print(BIO *bp, const X509_ALGOR *sigalg,
509                          const ASN1_STRING *sig, int indent, ASN1_PCTX *pctx)
510 {
511     DSA_SIG *dsa_sig;
512     const unsigned char *p;
513     if (!sig) {
514         if (BIO_puts(bp, "\n") <= 0)
515             return 0;
516         else
517             return 1;
518     }
519     p = sig->data;
520     dsa_sig = d2i_DSA_SIG(NULL, &p, sig->length);
521     if (dsa_sig) {
522         int rv = 0;
523         size_t buf_len = 0;
524         unsigned char *m = NULL;
525         update_buflen(dsa_sig->r, &buf_len);
526         update_buflen(dsa_sig->s, &buf_len);
527         m = OPENSSL_malloc(buf_len + 10);
528         if (m == NULL) {
529             DSAerr(DSA_F_DSA_SIG_PRINT, ERR_R_MALLOC_FAILURE);
530             goto err;
531         }
532
533         if (BIO_write(bp, "\n", 1) != 1)
534             goto err;
535
536         if (!ASN1_bn_print(bp, "r:   ", dsa_sig->r, m, indent))
537             goto err;
538         if (!ASN1_bn_print(bp, "s:   ", dsa_sig->s, m, indent))
539             goto err;
540         rv = 1;
541  err:
542         OPENSSL_free(m);
543         DSA_SIG_free(dsa_sig);
544         return rv;
545     }
546     return X509_signature_dump(bp, sig, indent);
547 }
548
549 static int dsa_pkey_ctrl(EVP_PKEY *pkey, int op, long arg1, void *arg2)
550 {
551     switch (op) {
552     case ASN1_PKEY_CTRL_PKCS7_SIGN:
553         if (arg1 == 0) {
554             int snid, hnid;
555             X509_ALGOR *alg1, *alg2;
556             PKCS7_SIGNER_INFO_get0_algs(arg2, NULL, &alg1, &alg2);
557             if (alg1 == NULL || alg1->algorithm == NULL)
558                 return -1;
559             hnid = OBJ_obj2nid(alg1->algorithm);
560             if (hnid == NID_undef)
561                 return -1;
562             if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
563                 return -1;
564             X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
565         }
566         return 1;
567 #ifndef OPENSSL_NO_CMS
568     case ASN1_PKEY_CTRL_CMS_SIGN:
569         if (arg1 == 0) {
570             int snid, hnid;
571             X509_ALGOR *alg1, *alg2;
572             CMS_SignerInfo_get0_algs(arg2, NULL, NULL, &alg1, &alg2);
573             if (alg1 == NULL || alg1->algorithm == NULL)
574                 return -1;
575             hnid = OBJ_obj2nid(alg1->algorithm);
576             if (hnid == NID_undef)
577                 return -1;
578             if (!OBJ_find_sigid_by_algs(&snid, hnid, EVP_PKEY_id(pkey)))
579                 return -1;
580             X509_ALGOR_set0(alg2, OBJ_nid2obj(snid), V_ASN1_UNDEF, 0);
581         }
582         return 1;
583
584     case ASN1_PKEY_CTRL_CMS_RI_TYPE:
585         *(int *)arg2 = CMS_RECIPINFO_NONE;
586         return 1;
587 #endif
588
589     case ASN1_PKEY_CTRL_DEFAULT_MD_NID:
590         *(int *)arg2 = NID_sha256;
591         return 2;
592
593     default:
594         return -2;
595
596     }
597
598 }
599
600 /* NB these are sorted in pkey_id order, lowest first */
601
602 const EVP_PKEY_ASN1_METHOD dsa_asn1_meths[] = {
603
604     {
605      EVP_PKEY_DSA2,
606      EVP_PKEY_DSA,
607      ASN1_PKEY_ALIAS},
608
609     {
610      EVP_PKEY_DSA1,
611      EVP_PKEY_DSA,
612      ASN1_PKEY_ALIAS},
613
614     {
615      EVP_PKEY_DSA4,
616      EVP_PKEY_DSA,
617      ASN1_PKEY_ALIAS},
618
619     {
620      EVP_PKEY_DSA3,
621      EVP_PKEY_DSA,
622      ASN1_PKEY_ALIAS},
623
624     {
625      EVP_PKEY_DSA,
626      EVP_PKEY_DSA,
627      0,
628
629      "DSA",
630      "OpenSSL DSA method",
631
632      dsa_pub_decode,
633      dsa_pub_encode,
634      dsa_pub_cmp,
635      dsa_pub_print,
636
637      dsa_priv_decode,
638      dsa_priv_encode,
639      dsa_priv_print,
640
641      int_dsa_size,
642      dsa_bits,
643      dsa_security_bits,
644
645      dsa_param_decode,
646      dsa_param_encode,
647      dsa_missing_parameters,
648      dsa_copy_parameters,
649      dsa_cmp_parameters,
650      dsa_param_print,
651      dsa_sig_print,
652
653      int_dsa_free,
654      dsa_pkey_ctrl,
655      old_dsa_priv_decode,
656      old_dsa_priv_encode}
657 };