blob: 9c61faf8e1388495907962f29ae66f8ecfd525fd [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*-
Lev Walkin523de9e2006-08-18 01:34:18 +00002 * Copyright (c) 2004, 2005, 2006 Lev Walkin <vlm@lionet.info>.
3 * All rights reserved.
Lev Walkinf15320b2004-06-03 03:38:44 +00004 * Redistribution and modifications are permitted subject to BSD license.
5 */
6/*
Lev Walkin41635d32006-03-18 05:06:57 +00007 * Read the NativeInteger.h for the explanation wrt. differences between
Lev Walkinf15320b2004-06-03 03:38:44 +00008 * INTEGER and NativeInteger.
9 * Basically, both are decoders and encoders of ASN.1 INTEGER type, but this
10 * implementation deals with the standard (machine-specific) representation
11 * of them instead of using the platform-independent buffer.
12 */
Lev Walkina9cc46e2004-09-22 16:06:28 +000013#include <asn_internal.h>
Lev Walkinf15320b2004-06-03 03:38:44 +000014#include <NativeInteger.h>
Lev Walkinf15320b2004-06-03 03:38:44 +000015
16/*
17 * NativeInteger basic type description.
18 */
Wim Lewis18c2ec92014-07-29 11:30:10 -070019static const ber_tlv_tag_t asn_DEF_NativeInteger_tags[] = {
Lev Walkinf15320b2004-06-03 03:38:44 +000020 (ASN_TAG_CLASS_UNIVERSAL | (2 << 2))
21};
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +080022asn_TYPE_operation_t asn_OP_NativeInteger = {
Lev Walkina9cc46e2004-09-22 16:06:28 +000023 NativeInteger_free,
24 NativeInteger_print,
Lev Walkincd2f48e2017-08-10 02:14:59 -070025 NativeInteger_compare,
Lev Walkinf15320b2004-06-03 03:38:44 +000026 asn_generic_no_constraint,
27 NativeInteger_decode_ber,
28 NativeInteger_encode_der,
Lev Walkin435cb282004-10-21 14:13:48 +000029 NativeInteger_decode_xer,
Lev Walkina9cc46e2004-09-22 16:06:28 +000030 NativeInteger_encode_xer,
Lev Walkincc159472017-07-06 08:26:36 -070031#ifdef ASN_DISABLE_OER_SUPPORT
32 0,
33 0,
34#else
Lev Walkin9ae018e2017-07-24 01:45:57 +040035 NativeInteger_decode_oer, /* OER decoder */
36 NativeInteger_encode_oer, /* Canonical OER encoder */
Lev Walkincc159472017-07-06 08:26:36 -070037#endif /* ASN_DISABLE_OER_SUPPORT */
Lev Walkinb33425f2017-07-14 14:59:52 +040038#ifdef ASN_DISABLE_PER_SUPPORT
39 0,
40 0,
41#else
42 NativeInteger_decode_uper, /* Unaligned PER decoder */
43 NativeInteger_encode_uper, /* Unaligned PER encoder */
44#endif /* ASN_DISABLE_PER_SUPPORT */
Bi-Ruei, Chiu1f87ac02017-08-20 01:25:45 +080045 0 /* Use generic outmost tag fetcher */
46};
47asn_TYPE_descriptor_t asn_DEF_NativeInteger = {
48 "INTEGER", /* The ASN.1 type is still INTEGER */
49 "INTEGER",
50 &asn_OP_NativeInteger,
51 asn_generic_no_constraint,
Lev Walkin5e033762004-09-29 13:26:15 +000052 asn_DEF_NativeInteger_tags,
53 sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]),
54 asn_DEF_NativeInteger_tags, /* Same as above */
55 sizeof(asn_DEF_NativeInteger_tags) / sizeof(asn_DEF_NativeInteger_tags[0]),
Lev Walkin76780762017-07-07 10:07:30 -070056 0, /* No OER visible constraints */
Lev Walkin59b176e2005-11-26 11:25:14 +000057 0, /* No PER visible constraints */
Lev Walkin449f8322004-08-20 13:23:42 +000058 0, 0, /* No members */
Lev Walkind9bd7752004-06-05 08:17:50 +000059 0 /* No specifics */
Lev Walkinf15320b2004-06-03 03:38:44 +000060};
61
62/*
63 * Decode INTEGER type.
64 */
Lev Walkindc06f6b2004-10-20 15:50:55 +000065asn_dec_rval_t
Lev Walkin5e033762004-09-29 13:26:15 +000066NativeInteger_decode_ber(asn_codec_ctx_t *opt_codec_ctx,
67 asn_TYPE_descriptor_t *td,
Lev Walkin8c3b8542005-03-10 18:52:02 +000068 void **nint_ptr, const void *buf_ptr, size_t size, int tag_mode) {
Lev Walkind62a6622017-08-22 02:31:02 -070069 const asn_INTEGER_specifics_t *specs =
70 (const asn_INTEGER_specifics_t *)td->specifics;
71 long *native = (long *)*nint_ptr;
Lev Walkindc06f6b2004-10-20 15:50:55 +000072 asn_dec_rval_t rval;
Lev Walkinf15320b2004-06-03 03:38:44 +000073 ber_tlv_len_t length;
74
75 /*
76 * If the structure is not there, allocate it.
77 */
Lev Walkine0b56e02005-02-25 12:10:27 +000078 if(native == NULL) {
79 native = (long *)(*nint_ptr = CALLOC(1, sizeof(*native)));
80 if(native == NULL) {
Lev Walkinf15320b2004-06-03 03:38:44 +000081 rval.code = RC_FAIL;
82 rval.consumed = 0;
83 return rval;
84 }
85 }
86
87 ASN_DEBUG("Decoding %s as INTEGER (tm=%d)",
88 td->name, tag_mode);
89
90 /*
91 * Check tags.
92 */
Lev Walkin5e033762004-09-29 13:26:15 +000093 rval = ber_check_tags(opt_codec_ctx, td, 0, buf_ptr, size,
94 tag_mode, 0, &length, 0);
Lev Walkinf15320b2004-06-03 03:38:44 +000095 if(rval.code != RC_OK)
96 return rval;
97
98 ASN_DEBUG("%s length is %d bytes", td->name, (int)length);
99
100 /*
101 * Make sure we have this length.
102 */
Lev Walkin8c3b8542005-03-10 18:52:02 +0000103 buf_ptr = ((const char *)buf_ptr) + rval.consumed;
Lev Walkinf15320b2004-06-03 03:38:44 +0000104 size -= rval.consumed;
Lev Walkind9bd7752004-06-05 08:17:50 +0000105 if(length > (ber_tlv_len_t)size) {
Lev Walkinf15320b2004-06-03 03:38:44 +0000106 rval.code = RC_WMORE;
107 rval.consumed = 0;
108 return rval;
109 }
110
111 /*
112 * ASN.1 encoded INTEGER: buf_ptr, length
Lev Walkine0b56e02005-02-25 12:10:27 +0000113 * Fill the native, at the same time checking for overflow.
Lev Walkinf15320b2004-06-03 03:38:44 +0000114 * If overflow occured, return with RC_FAIL.
115 */
116 {
117 INTEGER_t tmp;
Lev Walkin7e033b52005-07-02 08:19:17 +0000118 union {
119 const void *constbuf;
120 void *nonconstbuf;
121 } unconst_buf;
Lev Walkinf15320b2004-06-03 03:38:44 +0000122 long l;
Lev Walkin7e033b52005-07-02 08:19:17 +0000123
124 unconst_buf.constbuf = buf_ptr;
125 tmp.buf = (uint8_t *)unconst_buf.nonconstbuf;
Lev Walkinf15320b2004-06-03 03:38:44 +0000126 tmp.size = length;
127
Lev Walkin8bb57a22007-12-03 13:41:36 +0000128 if((specs&&specs->field_unsigned)
Lev Walkinaaae9bf2010-10-24 16:56:30 -0700129 ? asn_INTEGER2ulong(&tmp, (unsigned long *)&l) /* sic */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000130 : asn_INTEGER2long(&tmp, &l)) {
Lev Walkinf15320b2004-06-03 03:38:44 +0000131 rval.code = RC_FAIL;
132 rval.consumed = 0;
133 return rval;
134 }
135
Lev Walkine0b56e02005-02-25 12:10:27 +0000136 *native = l;
Lev Walkinf15320b2004-06-03 03:38:44 +0000137 }
138
139 rval.code = RC_OK;
140 rval.consumed += length;
141
Lev Walkine0b56e02005-02-25 12:10:27 +0000142 ASN_DEBUG("Took %ld/%ld bytes to encode %s (%ld)",
143 (long)rval.consumed, (long)length, td->name, (long)*native);
Lev Walkinf15320b2004-06-03 03:38:44 +0000144
145 return rval;
146}
147
148/*
149 * Encode the NativeInteger using the standard INTEGER type DER encoder.
150 */
Lev Walkina9cc46e2004-09-22 16:06:28 +0000151asn_enc_rval_t
Lev Walkin5e033762004-09-29 13:26:15 +0000152NativeInteger_encode_der(asn_TYPE_descriptor_t *sd, void *ptr,
Lev Walkinf15320b2004-06-03 03:38:44 +0000153 int tag_mode, ber_tlv_tag_t tag,
154 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkine0b56e02005-02-25 12:10:27 +0000155 unsigned long native = *(unsigned long *)ptr; /* Disable sign ext. */
Lev Walkina9cc46e2004-09-22 16:06:28 +0000156 asn_enc_rval_t erval;
Lev Walkinf15320b2004-06-03 03:38:44 +0000157 INTEGER_t tmp;
158
159#ifdef WORDS_BIGENDIAN /* Opportunistic optimization */
160
Lev Walkine0b56e02005-02-25 12:10:27 +0000161 tmp.buf = (uint8_t *)&native;
162 tmp.size = sizeof(native);
Lev Walkinf15320b2004-06-03 03:38:44 +0000163
164#else /* Works even if WORDS_BIGENDIAN is not set where should've been */
Lev Walkine0b56e02005-02-25 12:10:27 +0000165 uint8_t buf[sizeof(native)];
Lev Walkinf15320b2004-06-03 03:38:44 +0000166 uint8_t *p;
167
Lev Walkind54f2552004-10-27 13:24:51 +0000168 /* Prepare a fake INTEGER */
Lev Walkine0b56e02005-02-25 12:10:27 +0000169 for(p = buf + sizeof(buf) - 1; p >= buf; p--, native >>= 8)
Lev Walkinf3c089e2007-11-13 23:53:13 +0000170 *p = (uint8_t)native;
Lev Walkinf15320b2004-06-03 03:38:44 +0000171
172 tmp.buf = buf;
173 tmp.size = sizeof(buf);
174#endif /* WORDS_BIGENDIAN */
175
176 /* Encode fake INTEGER */
177 erval = INTEGER_encode_der(sd, &tmp, tag_mode, tag, cb, app_key);
178 if(erval.encoded == -1) {
179 assert(erval.structure_ptr == &tmp);
180 erval.structure_ptr = ptr;
181 }
182 return erval;
183}
184
Lev Walkin435cb282004-10-21 14:13:48 +0000185/*
186 * Decode the chunk of XML text encoding INTEGER.
187 */
188asn_dec_rval_t
189NativeInteger_decode_xer(asn_codec_ctx_t *opt_codec_ctx,
190 asn_TYPE_descriptor_t *td, void **sptr, const char *opt_mname,
Lev Walkin8c3b8542005-03-10 18:52:02 +0000191 const void *buf_ptr, size_t size) {
Lev Walkind62a6622017-08-22 02:31:02 -0700192 const asn_INTEGER_specifics_t *specs =
193 (const asn_INTEGER_specifics_t *)td->specifics;
194 asn_dec_rval_t rval;
Lev Walkin59b176e2005-11-26 11:25:14 +0000195 INTEGER_t st;
Lev Walkinf0b7c9a2005-01-27 17:54:57 +0000196 void *st_ptr = (void *)&st;
Lev Walkine0b56e02005-02-25 12:10:27 +0000197 long *native = (long *)*sptr;
Lev Walkin435cb282004-10-21 14:13:48 +0000198
Lev Walkine0b56e02005-02-25 12:10:27 +0000199 if(!native) {
Lev Walkin59b176e2005-11-26 11:25:14 +0000200 native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
Lev Walkin7c1dc052016-03-14 03:08:15 -0700201 if(!native) ASN__DECODE_FAILED;
Lev Walkin435cb282004-10-21 14:13:48 +0000202 }
203
Lev Walkin59b176e2005-11-26 11:25:14 +0000204 memset(&st, 0, sizeof(st));
205 rval = INTEGER_decode_xer(opt_codec_ctx, td, &st_ptr,
Lev Walkinf0b7c9a2005-01-27 17:54:57 +0000206 opt_mname, buf_ptr, size);
Lev Walkin435cb282004-10-21 14:13:48 +0000207 if(rval.code == RC_OK) {
208 long l;
Lev Walkin8bb57a22007-12-03 13:41:36 +0000209 if((specs&&specs->field_unsigned)
Lev Walkinaaae9bf2010-10-24 16:56:30 -0700210 ? asn_INTEGER2ulong(&st, (unsigned long *)&l) /* sic */
Lev Walkin8bb57a22007-12-03 13:41:36 +0000211 : asn_INTEGER2long(&st, &l)) {
Lev Walkin435cb282004-10-21 14:13:48 +0000212 rval.code = RC_FAIL;
213 rval.consumed = 0;
214 } else {
Lev Walkine0b56e02005-02-25 12:10:27 +0000215 *native = l;
Lev Walkin435cb282004-10-21 14:13:48 +0000216 }
217 } else {
Lev Walkine0b56e02005-02-25 12:10:27 +0000218 /*
219 * Cannot restart from the middle;
220 * there is no place to save state in the native type.
221 * Request a continuation from the very beginning.
222 */
Lev Walkin435cb282004-10-21 14:13:48 +0000223 rval.consumed = 0;
224 }
Lev Walkinadcb5862006-03-17 02:11:12 +0000225 ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &st);
Lev Walkin435cb282004-10-21 14:13:48 +0000226 return rval;
227}
228
229
Lev Walkina9cc46e2004-09-22 16:06:28 +0000230asn_enc_rval_t
Lev Walkin5e033762004-09-29 13:26:15 +0000231NativeInteger_encode_xer(asn_TYPE_descriptor_t *td, void *sptr,
Lev Walkina9cc46e2004-09-22 16:06:28 +0000232 int ilevel, enum xer_encoder_flags_e flags,
233 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkind62a6622017-08-22 02:31:02 -0700234 const asn_INTEGER_specifics_t *specs =
235 (const asn_INTEGER_specifics_t *)td->specifics;
236 char scratch[32]; /* Enough for 64-bit int */
Lev Walkina9cc46e2004-09-22 16:06:28 +0000237 asn_enc_rval_t er;
Lev Walkine0b56e02005-02-25 12:10:27 +0000238 const long *native = (const long *)sptr;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000239
240 (void)ilevel;
241 (void)flags;
242
Lev Walkin7c1dc052016-03-14 03:08:15 -0700243 if(!native) ASN__ENCODE_FAILED;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000244
Lev Walkin8bb57a22007-12-03 13:41:36 +0000245 er.encoded = snprintf(scratch, sizeof(scratch),
246 (specs && specs->field_unsigned)
247 ? "%lu" : "%ld", *native);
Lev Walkina9cc46e2004-09-22 16:06:28 +0000248 if(er.encoded <= 0 || (size_t)er.encoded >= sizeof(scratch)
249 || cb(scratch, er.encoded, app_key) < 0)
Lev Walkin7c1dc052016-03-14 03:08:15 -0700250 ASN__ENCODE_FAILED;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000251
Lev Walkin7c1dc052016-03-14 03:08:15 -0700252 ASN__ENCODED_OK(er);
Lev Walkin59b176e2005-11-26 11:25:14 +0000253}
254
Lev Walkin62d76872017-08-05 22:49:42 -0700255#ifndef ASN_DISABLE_PER_SUPPORT
256
Lev Walkin59b176e2005-11-26 11:25:14 +0000257asn_dec_rval_t
258NativeInteger_decode_uper(asn_codec_ctx_t *opt_codec_ctx,
Lev Walkin494fb702017-08-07 20:07:00 -0700259 asn_TYPE_descriptor_t *td,
260 const asn_per_constraints_t *constraints, void **sptr,
261 asn_per_data_t *pd) {
Lev Walkind62a6622017-08-22 02:31:02 -0700262 const asn_INTEGER_specifics_t *specs =
263 (const asn_INTEGER_specifics_t *)td->specifics;
264 asn_dec_rval_t rval;
Lev Walkin59b176e2005-11-26 11:25:14 +0000265 long *native = (long *)*sptr;
266 INTEGER_t tmpint;
267 void *tmpintptr = &tmpint;
268
269 (void)opt_codec_ctx;
270 ASN_DEBUG("Decoding NativeInteger %s (UPER)", td->name);
271
272 if(!native) {
273 native = (long *)(*sptr = CALLOC(1, sizeof(*native)));
Lev Walkin7c1dc052016-03-14 03:08:15 -0700274 if(!native) ASN__DECODE_FAILED;
Lev Walkin59b176e2005-11-26 11:25:14 +0000275 }
276
277 memset(&tmpint, 0, sizeof tmpint);
278 rval = INTEGER_decode_uper(opt_codec_ctx, td, constraints,
279 &tmpintptr, pd);
Lev Walkinb2bed822005-11-27 12:40:43 +0000280 if(rval.code == RC_OK) {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000281 if((specs&&specs->field_unsigned)
Lev Walkinaaae9bf2010-10-24 16:56:30 -0700282 ? asn_INTEGER2ulong(&tmpint, (unsigned long *)native)
Lev Walkin8bb57a22007-12-03 13:41:36 +0000283 : asn_INTEGER2long(&tmpint, native))
Lev Walkin59b176e2005-11-26 11:25:14 +0000284 rval.code = RC_FAIL;
285 else
286 ASN_DEBUG("NativeInteger %s got value %ld",
287 td->name, *native);
Lev Walkinb2bed822005-11-27 12:40:43 +0000288 }
Lev Walkinadcb5862006-03-17 02:11:12 +0000289 ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
Lev Walkin59b176e2005-11-26 11:25:14 +0000290
291 return rval;
Lev Walkina9cc46e2004-09-22 16:06:28 +0000292}
293
Lev Walkin523de9e2006-08-18 01:34:18 +0000294asn_enc_rval_t
295NativeInteger_encode_uper(asn_TYPE_descriptor_t *td,
Lev Walkin494fb702017-08-07 20:07:00 -0700296 const asn_per_constraints_t *constraints, void *sptr,
297 asn_per_outp_t *po) {
Lev Walkind62a6622017-08-22 02:31:02 -0700298 const asn_INTEGER_specifics_t *specs =
299 (const asn_INTEGER_specifics_t *)td->specifics;
300 asn_enc_rval_t er;
Lev Walkin523de9e2006-08-18 01:34:18 +0000301 long native;
302 INTEGER_t tmpint;
303
Lev Walkin7c1dc052016-03-14 03:08:15 -0700304 if(!sptr) ASN__ENCODE_FAILED;
Lev Walkin523de9e2006-08-18 01:34:18 +0000305
306 native = *(long *)sptr;
307
308 ASN_DEBUG("Encoding NativeInteger %s %ld (UPER)", td->name, native);
309
310 memset(&tmpint, 0, sizeof(tmpint));
Lev Walkin8bb57a22007-12-03 13:41:36 +0000311 if((specs&&specs->field_unsigned)
312 ? asn_ulong2INTEGER(&tmpint, native)
313 : asn_long2INTEGER(&tmpint, native))
Lev Walkin7c1dc052016-03-14 03:08:15 -0700314 ASN__ENCODE_FAILED;
Lev Walkin523de9e2006-08-18 01:34:18 +0000315 er = INTEGER_encode_uper(td, constraints, &tmpint, po);
316 ASN_STRUCT_FREE_CONTENTS_ONLY(asn_DEF_INTEGER, &tmpint);
317 return er;
318}
319
Lev Walkin62d76872017-08-05 22:49:42 -0700320#endif /* ASN_DISABLE_PER_SUPPORT */
321
Lev Walkinf15320b2004-06-03 03:38:44 +0000322/*
323 * INTEGER specific human-readable output.
324 */
325int
Lev Walkin5e033762004-09-29 13:26:15 +0000326NativeInteger_print(asn_TYPE_descriptor_t *td, const void *sptr, int ilevel,
Lev Walkinf15320b2004-06-03 03:38:44 +0000327 asn_app_consume_bytes_f *cb, void *app_key) {
Lev Walkind62a6622017-08-22 02:31:02 -0700328 const asn_INTEGER_specifics_t *specs =
329 (const asn_INTEGER_specifics_t *)td->specifics;
330 const long *native = (const long *)sptr;
Lev Walkindb13f512004-07-19 17:30:25 +0000331 char scratch[32]; /* Enough for 64-bit int */
Lev Walkinf15320b2004-06-03 03:38:44 +0000332 int ret;
333
Lev Walkind9bd7752004-06-05 08:17:50 +0000334 (void)td; /* Unused argument */
335 (void)ilevel; /* Unused argument */
336
Lev Walkine0b56e02005-02-25 12:10:27 +0000337 if(native) {
Lev Walkin8bb57a22007-12-03 13:41:36 +0000338 ret = snprintf(scratch, sizeof(scratch),
339 (specs && specs->field_unsigned)
340 ? "%lu" : "%ld", *native);
Lev Walkine0b56e02005-02-25 12:10:27 +0000341 assert(ret > 0 && (size_t)ret < sizeof(scratch));
Lev Walkin8e8078a2004-09-26 13:10:40 +0000342 return (cb(scratch, ret, app_key) < 0) ? -1 : 0;
Lev Walkinf15320b2004-06-03 03:38:44 +0000343 } else {
Lev Walkin8e8078a2004-09-26 13:10:40 +0000344 return (cb("<absent>", 8, app_key) < 0) ? -1 : 0;
Lev Walkinf15320b2004-06-03 03:38:44 +0000345 }
346}
347
348void
Lev Walkinf6853ce2017-08-11 00:50:27 -0700349NativeInteger_free(const asn_TYPE_descriptor_t *td, void *ptr,
350 int contents_only) {
351 if(!td || !ptr)
Lev Walkinf15320b2004-06-03 03:38:44 +0000352 return;
353
354 ASN_DEBUG("Freeing %s as INTEGER (%d, %p, Native)",
355 td->name, contents_only, ptr);
356
357 if(!contents_only) {
358 FREEMEM(ptr);
359 }
360}
361
Lev Walkincd2f48e2017-08-10 02:14:59 -0700362int
363NativeInteger_compare(const asn_TYPE_descriptor_t *td, const void *aptr, const void *bptr) {
364 (void)td;
365
366 if(aptr && bptr) {
367 const asn_INTEGER_specifics_t *specs =
368 (const asn_INTEGER_specifics_t *)td->specifics;
Lev Walkinf6853ce2017-08-11 00:50:27 -0700369 if(specs && specs->field_unsigned) {
Lev Walkincd2f48e2017-08-10 02:14:59 -0700370 const unsigned long *a = aptr;
371 const unsigned long *b = bptr;
372 if(*a < *b) {
373 return -1;
374 } else if(*a > *b) {
375 return 1;
376 } else {
Lev Walkinf6853ce2017-08-11 00:50:27 -0700377 return 0;
Lev Walkincd2f48e2017-08-10 02:14:59 -0700378 }
379 } else {
380 const long *a = aptr;
381 const long *b = bptr;
382 if(*a < *b) {
383 return -1;
384 } else if(*a > *b) {
385 return 1;
386 } else {
Lev Walkinf6853ce2017-08-11 00:50:27 -0700387 return 0;
Lev Walkincd2f48e2017-08-10 02:14:59 -0700388 }
389 }
390 } else if(!aptr) {
391 return -1;
392 } else {
393 return 1;
394 }
395}