1 /* 2 * This file is part of the openHiTLS project. 3 * 4 * openHiTLS is licensed under the Mulan PSL v2. 5 * You can use this software according to the terms and conditions of the Mulan PSL v2. 6 * You may obtain a copy of Mulan PSL v2 at: 7 * 8 * http://license.coscl.org.cn/MulanPSL2 9 * 10 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, 11 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, 12 * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. 13 * See the Mulan PSL v2 for more details. 14 */ 15 16 #ifndef CRYPT_SHA2_H 17 #define CRYPT_SHA2_H 18 19 #include "hitls_build.h" 20 #ifdef HITLS_CRYPTO_SHA2 21 22 #include <stdint.h> 23 #include <stdlib.h> 24 #include "crypt_types.h" 25 #include "bsl_params.h" 26 27 #ifdef __cplusplus 28 extern "C" { 29 #endif /* __cpluscplus */ 30 31 /** @defgroup LLF SHA2 Low level function */ 32 33 #ifdef HITLS_CRYPTO_SHA224 34 #define CRYPT_SHA2_224_BLOCKSIZE 64 35 #define CRYPT_SHA2_224_DIGESTSIZE 28 36 #endif // HITLS_CRYPTO_SHA224 37 38 #ifdef HITLS_CRYPTO_SHA256 39 #define CRYPT_SHA2_256_BLOCKSIZE 64 40 #define CRYPT_SHA2_256_DIGESTSIZE 32 41 #endif // HITLS_CRYPTO_SHA256 42 43 #ifdef HITLS_CRYPTO_SHA384 44 #define CRYPT_SHA2_384_BLOCKSIZE 128 45 #define CRYPT_SHA2_384_DIGESTSIZE 48 46 #endif // HITLS_CRYPTO_SHA384 47 48 #ifdef HITLS_CRYPTO_SHA512 49 #define CRYPT_SHA2_512_BLOCKSIZE 128 50 #define CRYPT_SHA2_512_DIGESTSIZE 64 51 #endif // HITLS_CRYPTO_SHA512 52 53 #ifdef HITLS_CRYPTO_SHA224 54 55 typedef struct CryptSha256Ctx CRYPT_SHA2_224_Ctx; 56 57 /** 58 * @ingroup SHA2_224 59 * @brief Generate md context. 60 * 61 * @retval Success: cipher ctx. 62 * Fails: NULL. 63 */ 64 CRYPT_SHA2_224_Ctx *CRYPT_SHA2_224_NewCtx(void); 65 66 /** 67 * @ingroup SHA2_224 68 * @brief free md context. 69 * 70 * @param ctx [IN] md handle 71 */ 72 void CRYPT_SHA2_224_FreeCtx(CRYPT_SHA2_224_Ctx *ctx); 73 74 /** 75 * @defgroup CRYPT_SHA2_224_Init 76 * @ingroup LLF Low Level Functions 77 * @par Prototype 78 * @code 79 * int32_t CRYPT_SHA2_224_Init(CRYPT_SHA2_224_Ctx *ctx) 80 * @endcode 81 * 82 * @par Purpose 83 * This is used to initialize the SHA224 ctx for a digest operation. 84 * 85 * @par Description 86 * CRYPT_SHA2_224_Init function initializes the ctx for a digest operation. This function must be called before 87 * CRYPT_SHA2_224_Update or CRYPT_SHA2_224_Final operations. This function will not allocate memory for any of the 88 * ctx variables. Instead the caller is expected to pass a ctx pointer pointing to a valid memory location 89 * (either locally or dynamically allocated). 90 * 91 * @param[in] ctx The sha224 ctx 92 * @param *param [in] Pointer to the parameter. 93 * 94 * @retval #CRYPT_SUCCESS ctx is initialized 95 * @retval #CRYPT_NULL_INPUT ctx is NULL 96 */ 97 int32_t CRYPT_SHA2_224_Init(CRYPT_SHA2_224_Ctx *ctx, BSL_Param *param); 98 99 /** 100 * @defgroup CRYPT_SHA2_224_Update 101 * @ingroup LLF Low Level Functions 102 * @par Prototype 103 * @code 104 * int32_t CRYPT_SHA2_224_Update(CRYPT_SHA2_224_Ctx *ctx, const uint8_t *data, usize_t nbytes) 105 * @endcode 106 * 107 * @par Purpose 108 * This is used to perform sha224 digest operation on chunks of data. 109 * 110 * @par Description 111 * CRYPT_SHA2_224_Update function performs digest operation on chunks of data. This method of digesting is used when 112 * data is present in multiple buffers or not available all at once. CRYPT_SHA2_224_Init must have been called before 113 * calling this function. 114 * 115 * @param[in] ctx The sha224 ctx 116 * @param[in] data The input data 117 * @param[in] nbytes The input data length 118 * 119 * @retval #CRYPT_SUCCESS If partial digest is calculated 120 * @retval #CRYPT_NULL_INPUT input arguments is NULL 121 * @retval #CRYPT_SHA2_ERR_OVERFLOW input message is overflow 122 */ 123 int32_t CRYPT_SHA2_224_Update(CRYPT_SHA2_224_Ctx *ctx, const uint8_t *data, uint32_t nbytes); 124 125 /** 126 * @defgroup CRYPT_SHA2_224_Final 127 * @ingroup LLF Low Level Functions 128 * @par Prototype 129 * @code 130 * int32_t CRYPT_SHA2_224_Final(CRYPT_SHA2_224_Ctx *ctx, uint8_t *digest, uint32_t *len) 131 * @endcode 132 * 133 * @par Purpose 134 * This is used to complete sha224 digest operation on remaining data, and is 135 * called at the end of digest operation. 136 * 137 * @par Description 138 * CRYPT_SHA2_224_Final function completes digest operation on remaining data, and is called at the end of digest 139 * operation. CRYPT_SHA2_224_Init must have been called before calling this function. This function calculates the 140 * digest. The memory for digest must already have been allocated. 141 * 142 * @param[in] ctx The sha224 ctx 143 * @param[out] digest The digest 144 * 145 * @retval #CRYPT_SUCCESS If partial digest is calculated 146 * @retval #CRYPT_NULL_INPUT input arguments is NULL 147 * @retval #CRYPT_SHA2_ERR_OVERFLOW input message is overflow 148 * @retval #CRYPT_SHA2_OUT_BUFF_LEN_NOT_ENOUGH output buffer is not enough 149 */ 150 int32_t CRYPT_SHA2_224_Final(CRYPT_SHA2_224_Ctx *ctx, uint8_t *digest, uint32_t *len); 151 #endif // HITLS_CRYPTO_SHA224 152 153 #ifdef HITLS_CRYPTO_SHA256 154 155 typedef struct CryptSha256Ctx CRYPT_SHA2_256_Ctx; 156 157 /** 158 * @ingroup SHA2_256 159 * @brief Generate md context. 160 * 161 * @retval Success: cipher ctx. 162 * Fails: NULL. 163 */ 164 CRYPT_SHA2_256_Ctx *CRYPT_SHA2_256_NewCtx(void); 165 166 /** 167 * @ingroup SHA2_256 168 * @brief free md context. 169 * 170 * @param ctx [IN] md handle 171 */ 172 void CRYPT_SHA2_256_FreeCtx(CRYPT_SHA2_256_Ctx *ctx); 173 174 /** 175 * @defgroup CRYPT_SHA2_256_Init 176 * @ingroup LLF Low Level Functions 177 * @par Prototype 178 * @code 179 * int32_t CRYPT_SHA2_256_Init(CRYPT_SHA2_256_Ctx *ctx) 180 * @endcode 181 * 182 * @par Purpose 183 * This is used to initialize the SHA256 ctx for a digest operation. 184 * 185 * @par Description 186 * CRYPT_SHA2_256_Init function initializes the ctx for 187 * a digest operation. This function must be called before 188 * CRYPT_SHA2_256_Update or CRYPT_SHA2_256_Final operations. This function will not 189 * allocate memory for any of the ctx variables. Instead the caller is 190 * expected to pass a ctx pointer pointing to a valid memory location 191 * (either locally or dynamically allocated). 192 * 193 * @param[in] ctx The sha256 ctx 194 * @param *param [in] Pointer to the parameter. 195 * 196 * @retval #CRYPT_SUCCESS ctx is initialized 197 * @retval #CRYPT_NULL_INPUT ctx is NULL 198 */ 199 int32_t CRYPT_SHA2_256_Init(CRYPT_SHA2_256_Ctx *ctx, BSL_Param *param); 200 201 /** 202 * @defgroup CRYPT_SHA2_256_Update 203 * @ingroup LLF Low Level Functions 204 * @par Prototype 205 * @code 206 * int32_t CRYPT_SHA2_256_Update(CRYPT_SHA2_256_Ctx *ctx, const uint8_t *data, usize_t nbytes) 207 * @endcode 208 * 209 * @par Purpose 210 * This is used to perform sha256 digest operation on chunks of data. 211 * 212 * @par Description 213 * CRYPT_SHA2_256_Update function performs digest operation on 214 * chunks of data. This method of digesting is used when data is 215 * present in multiple buffers or not available all at once. 216 * CRYPT_SHA2_256_Init must have been called before calling this 217 * function. 218 * 219 * @param[in] ctx The sha256 ctx 220 * @param[in] data The input data 221 * @param[in] nbytes The input data length 222 * 223 * @retval #CRYPT_SUCCESS If partial digest is calculated 224 * @retval #CRYPT_NULL_INPUT input arguments is NULL 225 * @retval #CRYPT_SHA2_ERR_OVERFLOW input message is overflow 226 */ 227 int32_t CRYPT_SHA2_256_Update(CRYPT_SHA2_256_Ctx *ctx, const uint8_t *data, uint32_t nbytes); 228 229 /** 230 * @defgroup CRYPT_SHA2_256_Final 231 * @ingroup LLF Low Level Functions 232 * @par Prototype 233 * @code 234 * int32_t CRYPT_SHA2_256_Final(CRYPT_SHA2_256_Ctx *ctx, uint8_t *digest, uint32_t *len) 235 * @endcode 236 * 237 * @par Purpose 238 * This is used to complete sha256 digest operation on remaining data, and is 239 * called at the end of digest operation. 240 * 241 * @par Description 242 * CRYPT_SHA2_256_Final function completes digest operation on remaining data, and 243 * is called at the end of digest operation. 244 * CRYPT_SHA2_256_Init must have been called before calling this function. This 245 * function calculates the digest. The memory for digest must 246 * already have been allocated. 247 * 248 * @param[in] ctx The sha256 ctx 249 * @param[out] digest The digest 250 * 251 * @retval #CRYPT_SUCCESS If partial digest is calculated 252 * @retval #CRYPT_NULL_INPUT input arguments is NULL 253 * @retval #CRYPT_SHA2_ERR_OVERFLOW input message is overflow 254 * @retval #CRYPT_SHA2_OUT_BUFF_LEN_NOT_ENOUGH output buffer is not enough 255 */ 256 int32_t CRYPT_SHA2_256_Final(CRYPT_SHA2_256_Ctx *ctx, uint8_t *digest, uint32_t *outlen); 257 #endif // HITLS_CRYPTO_SHA256 258 259 #ifdef HITLS_CRYPTO_SHA384 260 261 typedef struct CryptSha2512Ctx CRYPT_SHA2_384_Ctx; 262 263 /** 264 * @ingroup SHA2_384 265 * @brief Generate md context. 266 * 267 * @retval Success: cipher ctx. 268 * Fails: NULL. 269 */ 270 CRYPT_SHA2_384_Ctx *CRYPT_SHA2_384_NewCtx(void); 271 272 /** 273 * @ingroup SHA2_384 274 * @brief free md context. 275 * 276 * @param ctx [IN] md handle 277 */ 278 void CRYPT_SHA2_384_FreeCtx(CRYPT_SHA2_384_Ctx *ctx); 279 280 /** 281 * @ingroup LLF Low Level Functions 282 * @par Prototype 283 * @code 284 * int32_t CRYPT_SHA2_384_Init(CRYPT_SHA2_384_Ctx *ctx) 285 * @endcode 286 * 287 * @par Purpose 288 * This is used to initialize the SHA384 ctx for a digest operation. 289 * 290 * @par Description 291 * CRYPT_SHA2_384_Init function initializes the ctx for a digest operation. This function must be called before 292 * CRYPT_SHA2_384_Update or CRYPT_SHA2_384_Final operations. This function will not allocate memory for any of the 293 * ctx variables. Instead the caller is expected to pass a ctx pointer pointing to a valid memory location 294 * (either locally or dynamically allocated). 295 * 296 * @param[in,out] ctx The sha384 ctx 297 * @param *param [in] Pointer to the parameter. 298 * 299 * @retval #CRYPT_SUCCESS ctx is initialized 300 * @retval #CRYPT_NULL_INPUT ctx is NULL 301 */ 302 int32_t CRYPT_SHA2_384_Init(CRYPT_SHA2_384_Ctx *ctx, BSL_Param *param); 303 304 /** 305 * @ingroup LLF Low Level Functions 306 * @par Prototype 307 * @code 308 * int32_t CRYPT_SHA2_384_Update(CRYPT_SHA2_384_Ctx *ctx, const uint8_t *data, uint32_t nbytes) 309 * @endcode 310 * 311 * @par Purpose 312 * This is used to perform sha384 digest operation on chunks of data. 313 * 314 * @par Description 315 * CRYPT_SHA2_384_Update function performs digest operation on chunks of data. This method of digesting is used when 316 * data is present in multiple buffers or not available all at once. CRYPT_SHA2_384_Init must have been called before 317 * calling this function. 318 * 319 * @param[in,out] ctx The sha384 ctx 320 * @param[in] data The input data 321 * @param[in] nbytes The input data length 322 * 323 * @retval #CRYPT_SUCCESS If partial digest is calculated 324 * @retval #CRYPT_NULL_INPUT input arguments is NULL 325 * @retval #CRYPT_SHA2_INPUT_OVERFLOW input message is overflow 326 * @retval #CRYPT_SECUREC_FAIL secure c function fail. 327 */ 328 int32_t CRYPT_SHA2_384_Update(CRYPT_SHA2_384_Ctx *ctx, const uint8_t *data, uint32_t nbytes); 329 /** 330 * @ingroup LLF Low Level Functions 331 * @par Prototype 332 * @code 333 * int32_t CRYPT_SHA2_384_Final(CRYPT_SHA2_384_Ctx *ctx, uint8_t *digest, uint32_t *len) 334 * @endcode 335 * 336 * @par Purpose 337 * This is used to complete sha384 digest operation on remaining data, and is 338 * called at the end of digest operation. 339 * 340 * @par Description 341 * CRYPT_SHA2_384_Final function completes digest operation on remaining data, and is called at the end of digest 342 * operation. CRYPT_SHA2_384_Init must have been called before calling this function. This function calculates the 343 * digest. The memory for digest must already have been allocated. 344 * 345 * @param[in,out] ctx The sha384 ctx 346 * @param[out] digest The digest 347 * @param[in,out] len length of buffer 348 * 349 * @retval #CRYPT_SUCCESS If partial digest is calculated 350 * @retval #CRYPT_NULL_INPUT input arguments is NULL 351 * @retval #CRYPT_SHA2_INPUT_OVERFLOW input message is overflow 352 * @retval #CRYPT_SHA2_OUT_BUFF_LEN_NOT_ENOUGH output buffer is not enough 353 */ 354 int32_t CRYPT_SHA2_384_Final(CRYPT_SHA2_384_Ctx *ctx, uint8_t *digest, uint32_t *len); 355 #endif // HITLS_CRYPTO_SHA384 356 357 #ifdef HITLS_CRYPTO_SHA512 358 359 typedef struct CryptSha2512Ctx CRYPT_SHA2_512_Ctx; 360 361 /** 362 * @ingroup SHA2_512 363 * @brief Generate md context. 364 * 365 * @retval Success: cipher ctx. 366 * Fails: NULL. 367 */ 368 CRYPT_SHA2_512_Ctx *CRYPT_SHA2_512_NewCtx(void); 369 370 /** 371 * @ingroup SHA2_512 372 * @brief free md context. 373 * 374 * @param ctx [IN] md handle 375 */ 376 void CRYPT_SHA2_512_FreeCtx(CRYPT_SHA2_512_Ctx *ctx); 377 378 /** 379 * @ingroup LLF Low Level Functions 380 * @par Prototype 381 * @code 382 * int32_t CRYPT_SHA2_512_Init(CRYPT_SHA2_512_Ctx *ctx) 383 * @endcode 384 * 385 * @par Purpose 386 * This is used to initialize the SHA512 ctx for a digest operation. 387 * 388 * @par Description 389 * CRYPT_SHA2_512_Init function initializes the ctx for a digest operation. This function must be called before 390 * CRYPT_SHA2_512_Update or CRYPT_SHA2_512_Final operations. This function will not allocate memory for any of the 391 * ctx variable. Instead the caller is expected to pass a ctx pointer pointing to a valid memory location 392 * (either locally or dynamically allocated). 393 * 394 * @param[in,out] ctx The sha512 ctx 395 * @param *param [in] Pointer to the parameter. 396 * 397 * @retval #CRYPT_SUCCESS ctx is initialized 398 * @retval #CRYPT_NULL_INPUT ctx is NULL 399 */ 400 int32_t CRYPT_SHA2_512_Init(CRYPT_SHA2_512_Ctx *ctx, BSL_Param *param); 401 402 /** 403 * @ingroup LLF Low Level Functions 404 * @par Prototype 405 * @code 406 * int32_t CRYPT_SHA2_512_Update(CRYPT_SHA2_512_Ctx *ctx, const uint8_t *data, usize_t nbytes) 407 * @endcode 408 * 409 * @par Purpose 410 * This is used to perform sha512 digest operation on chunks of data. 411 * 412 * @par Description 413 * CRYPT_SHA2_512_Update function performs digest operation on chunks of data. This method of digesting is used when 414 * data is present in multiple buffers or not available all at once. CRYPT_SHA2_512_Init must have been called before 415 * calling this function. 416 * 417 * @param[in,out] ctx The sha512 ctx 418 * @param[in] data The input data 419 * @param[in] nbytes The input data length 420 * 421 * @retval #CRYPT_SUCCESS If partial digest is calculated 422 * @retval #CRYPT_NULL_INPUT input arguments is NULL 423 * @retval #CRYPT_SHA2_INPUT_OVERFLOW input message is overflow 424 * @retval #CRYPT_SECUREC_FAIL secure c function fail. 425 */ 426 int32_t CRYPT_SHA2_512_Update(CRYPT_SHA2_512_Ctx *ctx, const uint8_t *data, uint32_t nbytes); 427 428 /** 429 * @ingroup LLF Low Level Functions 430 * @par Prototype 431 * @code 432 * int32_t CRYPT_SHA2_512_Final(CRYPT_SHA2_512_Ctx *ctx, uint8_t *digest, uint32_t *len) 433 * @endcode 434 * 435 * @par Purpose 436 * This is used to complete sha512 digest operation on remaining data, and is called at the end of digest operation. 437 * 438 * @par Description 439 * CRYPT_SHA2_512_Final function completes digest operation on remaining data, and is called at the end of digest 440 * operation. CRYPT_SHA2_512_Init must have been called before calling this function. This function calculates the 441 * digest. The memory for digest must already have been allocated. 442 * 443 * @param[in,out] ctx The sha512 ctx 444 * @param[out] digest The digest 445 * @param[in,out] len length of buffer 446 * 447 * @retval #CRYPT_SUCCESS If partial digest is calculated 448 * @retval #CRYPT_NULL_INPUT input arguments is NULL 449 * @retval #CRYPT_SHA2_INPUT_OVERFLOW input message is overflow 450 * @retval #CRYPT_SHA2_OUT_BUFF_LEN_NOT_ENOUGH output buffer is not enough 451 */ 452 int32_t CRYPT_SHA2_512_Final(CRYPT_SHA2_512_Ctx *ctx, uint8_t *digest, uint32_t *len); 453 #endif // HITLS_CRYPTO_SHA512 454 455 #ifdef HITLS_CRYPTO_SHA224 456 /** 457 * @ingroup LLF Low Level Functions 458 * 459 * @brief SHA224 deinit function 460 * 461 * @param[in,out] ctx The SHA224 ctx 462 */ 463 void CRYPT_SHA2_224_Deinit(CRYPT_SHA2_224_Ctx *ctx); 464 465 /** 466 * @ingroup SHA224 467 * @brief SHA224 copy CTX function 468 * @param dst [out] Pointer to the new SHA224 context. 469 * @param src [in] Pointer to the original SHA224 context. 470 */ 471 int32_t CRYPT_SHA2_224_CopyCtx(CRYPT_SHA2_224_Ctx *dst, const CRYPT_SHA2_224_Ctx *src); 472 473 /** 474 * @ingroup SHA224 475 * @brief SHA224 dup CTX function 476 * @param src [in] Pointer to the original SHA224 context. 477 */ 478 CRYPT_SHA2_224_Ctx *CRYPT_SHA2_224_DupCtx(const CRYPT_SHA2_224_Ctx *src); 479 #endif // HITLS_CRYPTO_SHA224 480 481 #ifdef HITLS_CRYPTO_SHA256 482 /** 483 * @ingroup LLF Low Level Functions 484 * 485 * @brief SHA256 deinit function 486 * 487 * @param[in,out] ctx The SHA256 ctx 488 */ 489 void CRYPT_SHA2_256_Deinit(CRYPT_SHA2_256_Ctx *ctx); 490 491 /** 492 * @ingroup SHA256 493 * @brief SHA256 copy CTX function 494 * @param dst [out] Pointer to the new SHA256 context. 495 * @param src [in] Pointer to the original SHA256 context. 496 */ 497 int32_t CRYPT_SHA2_256_CopyCtx(CRYPT_SHA2_256_Ctx *dst, const CRYPT_SHA2_256_Ctx *src); 498 499 /** 500 * @ingroup SHA256 501 * @brief SHA256 dup CTX function 502 * @param src [in] Pointer to the original SHA256 context. 503 */ 504 CRYPT_SHA2_256_Ctx *CRYPT_SHA2_256_DupCtx(const CRYPT_SHA2_256_Ctx *src); 505 #endif // HITLS_CRYPTO_SHA256 506 507 #ifdef HITLS_CRYPTO_SHA384 508 /** 509 * @ingroup LLF Low Level Functions 510 * 511 * @brief SHA384 deinit function 512 * 513 * @param[in,out] ctx The SHA384 ctx 514 */ 515 void CRYPT_SHA2_384_Deinit(CRYPT_SHA2_384_Ctx *ctx); 516 517 /** 518 * @ingroup SHA384 519 * @brief SHA384 copy CTX function 520 * @param dst [out] Pointer to the new SHA384 context. 521 * @param src [in] Pointer to the original SHA384 context. 522 */ 523 int32_t CRYPT_SHA2_384_CopyCtx(CRYPT_SHA2_384_Ctx *dst, const CRYPT_SHA2_384_Ctx *src); 524 525 /** 526 * @ingroup SHA384 527 * @brief SHA384 dup CTX function 528 * @param src [in] Pointer to the original SHA384 context. 529 */ 530 CRYPT_SHA2_384_Ctx *CRYPT_SHA2_384_DupCtx(const CRYPT_SHA2_384_Ctx *src); 531 #endif // HITLS_CRYPTO_SHA384 532 533 #ifdef HITLS_CRYPTO_SHA512 534 /** 535 * @ingroup LLF Low Level Functions 536 * 537 * @brief SHA512 deinit function 538 * 539 * @param[in,out] ctx The SHA512 ctx 540 */ 541 void CRYPT_SHA2_512_Deinit(CRYPT_SHA2_512_Ctx *ctx); 542 543 /** 544 * @ingroup SHA512 545 * @brief SHA512 copy CTX function 546 * @param dst [out] Pointer to the new SHA512 context. 547 * @param src [in] Pointer to the original SHA512 context. 548 */ 549 int32_t CRYPT_SHA2_512_CopyCtx(CRYPT_SHA2_512_Ctx *dst, const CRYPT_SHA2_512_Ctx *src); 550 551 /** 552 * @ingroup SHA512 553 * @brief SHA512 dup CTX function 554 * @param src [in] Pointer to the original SHA512 context. 555 */ 556 CRYPT_SHA2_512_Ctx *CRYPT_SHA2_512_DupCtx(const CRYPT_SHA2_512_Ctx *src); 557 #endif // HITLS_CRYPTO_SHA512 558 559 #ifdef __cplusplus 560 } 561 #endif 562 563 #endif // HITLS_CRYPTO_SHA2 564 565 #endif // CRYPT_SHA2_H 566