1 /* $OpenBSD: xform.c,v 1.55 2016/09/19 18:09:40 tedu Exp $ */ 2 /* 3 * The authors of this code are John Ioannidis (ji@tla.org), 4 * Angelos D. Keromytis (kermit@csd.uch.gr), 5 * Niels Provos (provos@physnet.uni-hamburg.de), 6 * Damien Miller (djm@mindrot.org) and 7 * Mike Belopuhov (mikeb@openbsd.org). 8 * 9 * This code was written by John Ioannidis for BSD/OS in Athens, Greece, 10 * in November 1995. 11 * 12 * Ported to OpenBSD and NetBSD, with additional transforms, in December 1996, 13 * by Angelos D. Keromytis. 14 * 15 * Additional transforms and features in 1997 and 1998 by Angelos D. Keromytis 16 * and Niels Provos. 17 * 18 * Additional features in 1999 by Angelos D. Keromytis. 19 * 20 * AES XTS implementation in 2008 by Damien Miller 21 * 22 * AES-GCM-16 and Chacha20-Poly1305 AEAD modes by Mike Belopuhov. 23 * 24 * Copyright (C) 1995, 1996, 1997, 1998, 1999 by John Ioannidis, 25 * Angelos D. Keromytis and Niels Provos. 26 * 27 * Copyright (C) 2001, Angelos D. Keromytis. 28 * 29 * Copyright (C) 2008, Damien Miller 30 * 31 * Copyright (C) 2010, 2015, Mike Belopuhov 32 * 33 * Permission to use, copy, and modify this software with or without fee 34 * is hereby granted, provided that this entire notice is included in 35 * all copies of any software which is or includes a copy or 36 * modification of this software. 37 * You may use this code under the GNU public license if you so wish. Please 38 * contribute changes back to the authors under this freer than GPL license 39 * so that we may further the use of strong encryption without limitations to 40 * all. 41 * 42 * THIS SOFTWARE IS BEING PROVIDED "AS IS", WITHOUT ANY EXPRESS OR 43 * IMPLIED WARRANTY. IN PARTICULAR, NONE OF THE AUTHORS MAKES ANY 44 * REPRESENTATION OR WARRANTY OF ANY KIND CONCERNING THE 45 * MERCHANTABILITY OF THIS SOFTWARE OR ITS FITNESS FOR ANY PARTICULAR 46 * PURPOSE. 47 */ 48 49 #include <sys/param.h> 50 #include <sys/systm.h> 51 #include <sys/errno.h> 52 #include <sys/time.h> 53 #include <sys/kernel.h> 54 #include <machine/cpu.h> 55 56 #include <crypto/md5.h> 57 #include <crypto/sha1.h> 58 #include <crypto/sha2.h> 59 #include <crypto/rmd160.h> 60 #include <crypto/blf.h> 61 #include <crypto/cast.h> 62 #include <crypto/rijndael.h> 63 #include <crypto/cryptodev.h> 64 #include <crypto/xform.h> 65 #include <crypto/gmac.h> 66 #include <crypto/chachapoly.h> 67 68 extern void des_ecb3_encrypt(caddr_t, caddr_t, caddr_t, caddr_t, caddr_t, int); 69 70 int des_set_key(void *, caddr_t); 71 int des3_setkey(void *, u_int8_t *, int); 72 int blf_setkey(void *, u_int8_t *, int); 73 int cast5_setkey(void *, u_int8_t *, int); 74 int rijndael128_setkey(void *, u_int8_t *, int); 75 int aes_ctr_setkey(void *, u_int8_t *, int); 76 int aes_xts_setkey(void *, u_int8_t *, int); 77 int null_setkey(void *, u_int8_t *, int); 78 79 void des3_encrypt(caddr_t, u_int8_t *); 80 void blf_encrypt(caddr_t, u_int8_t *); 81 void cast5_encrypt(caddr_t, u_int8_t *); 82 void rijndael128_encrypt(caddr_t, u_int8_t *); 83 void null_encrypt(caddr_t, u_int8_t *); 84 void aes_xts_encrypt(caddr_t, u_int8_t *); 85 86 void des3_decrypt(caddr_t, u_int8_t *); 87 void blf_decrypt(caddr_t, u_int8_t *); 88 void cast5_decrypt(caddr_t, u_int8_t *); 89 void rijndael128_decrypt(caddr_t, u_int8_t *); 90 void null_decrypt(caddr_t, u_int8_t *); 91 void aes_xts_decrypt(caddr_t, u_int8_t *); 92 93 void aes_ctr_crypt(caddr_t, u_int8_t *); 94 95 void aes_ctr_reinit(caddr_t, u_int8_t *); 96 void aes_xts_reinit(caddr_t, u_int8_t *); 97 void aes_gcm_reinit(caddr_t, u_int8_t *); 98 99 int MD5Update_int(void *, const u_int8_t *, u_int16_t); 100 int SHA1Update_int(void *, const u_int8_t *, u_int16_t); 101 int RMD160Update_int(void *, const u_int8_t *, u_int16_t); 102 int SHA256Update_int(void *, const u_int8_t *, u_int16_t); 103 int SHA384Update_int(void *, const u_int8_t *, u_int16_t); 104 int SHA512Update_int(void *, const u_int8_t *, u_int16_t); 105 106 u_int32_t deflate_compress(u_int8_t *, u_int32_t, u_int8_t **); 107 u_int32_t deflate_decompress(u_int8_t *, u_int32_t, u_int8_t **); 108 u_int32_t lzs_dummy(u_int8_t *, u_int32_t, u_int8_t **); 109 110 #define AESCTR_NONCESIZE 4 111 #define AESCTR_IVSIZE 8 112 #define AESCTR_BLOCKSIZE 16 113 114 struct aes_ctr_ctx { 115 u_int32_t ac_ek[4*(AES_MAXROUNDS + 1)]; 116 u_int8_t ac_block[AESCTR_BLOCKSIZE]; 117 int ac_nr; 118 }; 119 120 #define AES_XTS_BLOCKSIZE 16 121 #define AES_XTS_IVSIZE 8 122 #define AES_XTS_ALPHA 0x87 /* GF(2^128) generator polynomial */ 123 124 struct aes_xts_ctx { 125 rijndael_ctx key1; 126 rijndael_ctx key2; 127 u_int8_t tweak[AES_XTS_BLOCKSIZE]; 128 }; 129 130 /* Helper */ 131 void aes_xts_crypt(struct aes_xts_ctx *, u_int8_t *, u_int); 132 133 /* Encryption instances */ 134 struct enc_xform enc_xform_3des = { 135 CRYPTO_3DES_CBC, "3DES", 136 8, 8, 24, 24, 384, 137 des3_encrypt, 138 des3_decrypt, 139 des3_setkey, 140 NULL 141 }; 142 143 struct enc_xform enc_xform_blf = { 144 CRYPTO_BLF_CBC, "Blowfish", 145 8, 8, 5, 56 /* 448 bits, max key */, 146 sizeof(blf_ctx), 147 blf_encrypt, 148 blf_decrypt, 149 blf_setkey, 150 NULL 151 }; 152 153 struct enc_xform enc_xform_cast5 = { 154 CRYPTO_CAST_CBC, "CAST-128", 155 8, 8, 5, 16, 156 sizeof(cast_key), 157 cast5_encrypt, 158 cast5_decrypt, 159 cast5_setkey, 160 NULL 161 }; 162 163 struct enc_xform enc_xform_rijndael128 = { 164 CRYPTO_RIJNDAEL128_CBC, "Rijndael-128/AES", 165 16, 16, 16, 32, 166 sizeof(rijndael_ctx), 167 rijndael128_encrypt, 168 rijndael128_decrypt, 169 rijndael128_setkey, 170 NULL 171 }; 172 173 struct enc_xform enc_xform_aes_ctr = { 174 CRYPTO_AES_CTR, "AES-CTR", 175 16, 8, 16+4, 32+4, 176 sizeof(struct aes_ctr_ctx), 177 aes_ctr_crypt, 178 aes_ctr_crypt, 179 aes_ctr_setkey, 180 aes_ctr_reinit 181 }; 182 183 struct enc_xform enc_xform_aes_gcm = { 184 CRYPTO_AES_GCM_16, "AES-GCM", 185 1, 8, 16+4, 32+4, 186 sizeof(struct aes_ctr_ctx), 187 aes_ctr_crypt, 188 aes_ctr_crypt, 189 aes_ctr_setkey, 190 aes_gcm_reinit 191 }; 192 193 struct enc_xform enc_xform_aes_gmac = { 194 CRYPTO_AES_GMAC, "AES-GMAC", 195 1, 8, 16+4, 32+4, 0, 196 NULL, 197 NULL, 198 NULL, 199 NULL 200 }; 201 202 struct enc_xform enc_xform_aes_xts = { 203 CRYPTO_AES_XTS, "AES-XTS", 204 16, 8, 32, 64, 205 sizeof(struct aes_xts_ctx), 206 aes_xts_encrypt, 207 aes_xts_decrypt, 208 aes_xts_setkey, 209 aes_xts_reinit 210 }; 211 212 struct enc_xform enc_xform_chacha20_poly1305 = { 213 CRYPTO_CHACHA20_POLY1305, "CHACHA20-POLY1305", 214 1, 8, 32+4, 32+4, 215 sizeof(struct chacha20_ctx), 216 chacha20_crypt, 217 chacha20_crypt, 218 chacha20_setkey, 219 chacha20_reinit 220 }; 221 222 struct enc_xform enc_xform_null = { 223 CRYPTO_NULL, "NULL", 224 4, 0, 0, 256, 0, 225 null_encrypt, 226 null_decrypt, 227 null_setkey, 228 NULL 229 }; 230 231 /* Authentication instances */ 232 struct auth_hash auth_hash_hmac_md5_96 = { 233 CRYPTO_MD5_HMAC, "HMAC-MD5", 234 16, 16, 12, sizeof(MD5_CTX), HMAC_MD5_BLOCK_LEN, 235 (void (*) (void *)) MD5Init, NULL, NULL, 236 MD5Update_int, 237 (void (*) (u_int8_t *, void *)) MD5Final 238 }; 239 240 struct auth_hash auth_hash_hmac_sha1_96 = { 241 CRYPTO_SHA1_HMAC, "HMAC-SHA1", 242 20, 20, 12, sizeof(SHA1_CTX), HMAC_SHA1_BLOCK_LEN, 243 (void (*) (void *)) SHA1Init, NULL, NULL, 244 SHA1Update_int, 245 (void (*) (u_int8_t *, void *)) SHA1Final 246 }; 247 248 struct auth_hash auth_hash_hmac_ripemd_160_96 = { 249 CRYPTO_RIPEMD160_HMAC, "HMAC-RIPEMD-160", 250 20, 20, 12, sizeof(RMD160_CTX), HMAC_RIPEMD160_BLOCK_LEN, 251 (void (*)(void *)) RMD160Init, NULL, NULL, 252 RMD160Update_int, 253 (void (*)(u_int8_t *, void *)) RMD160Final 254 }; 255 256 struct auth_hash auth_hash_hmac_sha2_256_128 = { 257 CRYPTO_SHA2_256_HMAC, "HMAC-SHA2-256", 258 32, 32, 16, sizeof(SHA2_CTX), HMAC_SHA2_256_BLOCK_LEN, 259 (void (*)(void *)) SHA256Init, NULL, NULL, 260 SHA256Update_int, 261 (void (*)(u_int8_t *, void *)) SHA256Final 262 }; 263 264 struct auth_hash auth_hash_hmac_sha2_384_192 = { 265 CRYPTO_SHA2_384_HMAC, "HMAC-SHA2-384", 266 48, 48, 24, sizeof(SHA2_CTX), HMAC_SHA2_384_BLOCK_LEN, 267 (void (*)(void *)) SHA384Init, NULL, NULL, 268 SHA384Update_int, 269 (void (*)(u_int8_t *, void *)) SHA384Final 270 }; 271 272 struct auth_hash auth_hash_hmac_sha2_512_256 = { 273 CRYPTO_SHA2_512_HMAC, "HMAC-SHA2-512", 274 64, 64, 32, sizeof(SHA2_CTX), HMAC_SHA2_512_BLOCK_LEN, 275 (void (*)(void *)) SHA512Init, NULL, NULL, 276 SHA512Update_int, 277 (void (*)(u_int8_t *, void *)) SHA512Final 278 }; 279 280 struct auth_hash auth_hash_gmac_aes_128 = { 281 CRYPTO_AES_128_GMAC, "GMAC-AES-128", 282 16+4, GMAC_BLOCK_LEN, GMAC_DIGEST_LEN, sizeof(AES_GMAC_CTX), 283 AESCTR_BLOCKSIZE, AES_GMAC_Init, AES_GMAC_Setkey, AES_GMAC_Reinit, 284 AES_GMAC_Update, AES_GMAC_Final 285 }; 286 287 struct auth_hash auth_hash_gmac_aes_192 = { 288 CRYPTO_AES_192_GMAC, "GMAC-AES-192", 289 24+4, GMAC_BLOCK_LEN, GMAC_DIGEST_LEN, sizeof(AES_GMAC_CTX), 290 AESCTR_BLOCKSIZE, AES_GMAC_Init, AES_GMAC_Setkey, AES_GMAC_Reinit, 291 AES_GMAC_Update, AES_GMAC_Final 292 }; 293 294 struct auth_hash auth_hash_gmac_aes_256 = { 295 CRYPTO_AES_256_GMAC, "GMAC-AES-256", 296 32+4, GMAC_BLOCK_LEN, GMAC_DIGEST_LEN, sizeof(AES_GMAC_CTX), 297 AESCTR_BLOCKSIZE, AES_GMAC_Init, AES_GMAC_Setkey, AES_GMAC_Reinit, 298 AES_GMAC_Update, AES_GMAC_Final 299 }; 300 301 struct auth_hash auth_hash_chacha20_poly1305 = { 302 CRYPTO_CHACHA20_POLY1305_MAC, "CHACHA20-POLY1305", 303 CHACHA20_KEYSIZE+CHACHA20_SALT, POLY1305_BLOCK_LEN, POLY1305_TAGLEN, 304 sizeof(CHACHA20_POLY1305_CTX), CHACHA20_BLOCK_LEN, 305 Chacha20_Poly1305_Init, Chacha20_Poly1305_Setkey, 306 Chacha20_Poly1305_Reinit, Chacha20_Poly1305_Update, 307 Chacha20_Poly1305_Final 308 }; 309 310 /* Compression instance */ 311 struct comp_algo comp_algo_deflate = { 312 CRYPTO_DEFLATE_COMP, "Deflate", 313 90, deflate_compress, 314 deflate_decompress 315 }; 316 317 struct comp_algo comp_algo_lzs = { 318 CRYPTO_LZS_COMP, "LZS", 319 90, lzs_dummy, 320 lzs_dummy 321 }; 322 323 /* 324 * Encryption wrapper routines. 325 */ 326 void 327 des3_encrypt(caddr_t key, u_int8_t *blk) 328 { 329 des_ecb3_encrypt(blk, blk, key, key + 128, key + 256, 1); 330 } 331 332 void 333 des3_decrypt(caddr_t key, u_int8_t *blk) 334 { 335 des_ecb3_encrypt(blk, blk, key + 256, key + 128, key, 0); 336 } 337 338 int 339 des3_setkey(void *sched, u_int8_t *key, int len) 340 { 341 if (des_set_key(key, sched) < 0 || des_set_key(key + 8, sched + 128) 342 < 0 || des_set_key(key + 16, sched + 256) < 0) 343 return -1; 344 345 return 0; 346 } 347 348 void 349 blf_encrypt(caddr_t key, u_int8_t *blk) 350 { 351 blf_ecb_encrypt((blf_ctx *) key, blk, 8); 352 } 353 354 void 355 blf_decrypt(caddr_t key, u_int8_t *blk) 356 { 357 blf_ecb_decrypt((blf_ctx *) key, blk, 8); 358 } 359 360 int 361 blf_setkey(void *sched, u_int8_t *key, int len) 362 { 363 blf_key((blf_ctx *)sched, key, len); 364 365 return 0; 366 } 367 368 int 369 null_setkey(void *sched, u_int8_t *key, int len) 370 { 371 return 0; 372 } 373 374 void 375 null_encrypt(caddr_t key, u_int8_t *blk) 376 { 377 } 378 379 void 380 null_decrypt(caddr_t key, u_int8_t *blk) 381 { 382 } 383 384 void 385 cast5_encrypt(caddr_t key, u_int8_t *blk) 386 { 387 cast_encrypt((cast_key *) key, blk, blk); 388 } 389 390 void 391 cast5_decrypt(caddr_t key, u_int8_t *blk) 392 { 393 cast_decrypt((cast_key *) key, blk, blk); 394 } 395 396 int 397 cast5_setkey(void *sched, u_int8_t *key, int len) 398 { 399 cast_setkey((cast_key *)sched, key, len); 400 401 return 0; 402 } 403 404 void 405 rijndael128_encrypt(caddr_t key, u_int8_t *blk) 406 { 407 rijndael_encrypt((rijndael_ctx *) key, (u_char *) blk, (u_char *) blk); 408 } 409 410 void 411 rijndael128_decrypt(caddr_t key, u_int8_t *blk) 412 { 413 rijndael_decrypt((rijndael_ctx *) key, (u_char *) blk, (u_char *) blk); 414 } 415 416 int 417 rijndael128_setkey(void *sched, u_int8_t *key, int len) 418 { 419 return rijndael_set_key((rijndael_ctx *)sched, (u_char *)key, len * 8); 420 } 421 422 void 423 aes_ctr_reinit(caddr_t key, u_int8_t *iv) 424 { 425 struct aes_ctr_ctx *ctx; 426 427 ctx = (struct aes_ctr_ctx *)key; 428 bcopy(iv, ctx->ac_block + AESCTR_NONCESIZE, AESCTR_IVSIZE); 429 430 /* reset counter */ 431 bzero(ctx->ac_block + AESCTR_NONCESIZE + AESCTR_IVSIZE, 4); 432 } 433 434 void 435 aes_gcm_reinit(caddr_t key, u_int8_t *iv) 436 { 437 struct aes_ctr_ctx *ctx; 438 439 ctx = (struct aes_ctr_ctx *)key; 440 bcopy(iv, ctx->ac_block + AESCTR_NONCESIZE, AESCTR_IVSIZE); 441 442 /* reset counter */ 443 bzero(ctx->ac_block + AESCTR_NONCESIZE + AESCTR_IVSIZE, 4); 444 ctx->ac_block[AESCTR_BLOCKSIZE - 1] = 1; /* GCM starts with 1 */ 445 } 446 447 void 448 aes_ctr_crypt(caddr_t key, u_int8_t *data) 449 { 450 struct aes_ctr_ctx *ctx; 451 u_int8_t keystream[AESCTR_BLOCKSIZE]; 452 int i; 453 454 ctx = (struct aes_ctr_ctx *)key; 455 /* increment counter */ 456 for (i = AESCTR_BLOCKSIZE - 1; 457 i >= AESCTR_NONCESIZE + AESCTR_IVSIZE; i--) 458 if (++ctx->ac_block[i]) /* continue on overflow */ 459 break; 460 rijndaelEncrypt(ctx->ac_ek, ctx->ac_nr, ctx->ac_block, keystream); 461 for (i = 0; i < AESCTR_BLOCKSIZE; i++) 462 data[i] ^= keystream[i]; 463 explicit_bzero(keystream, sizeof(keystream)); 464 } 465 466 int 467 aes_ctr_setkey(void *sched, u_int8_t *key, int len) 468 { 469 struct aes_ctr_ctx *ctx; 470 471 if (len < AESCTR_NONCESIZE) 472 return -1; 473 474 ctx = (struct aes_ctr_ctx *)sched; 475 ctx->ac_nr = rijndaelKeySetupEnc(ctx->ac_ek, (u_char *)key, 476 (len - AESCTR_NONCESIZE) * 8); 477 if (ctx->ac_nr == 0) 478 return -1; 479 bcopy(key + len - AESCTR_NONCESIZE, ctx->ac_block, AESCTR_NONCESIZE); 480 return 0; 481 } 482 483 void 484 aes_xts_reinit(caddr_t key, u_int8_t *iv) 485 { 486 struct aes_xts_ctx *ctx = (struct aes_xts_ctx *)key; 487 u_int64_t blocknum; 488 u_int i; 489 490 /* 491 * Prepare tweak as E_k2(IV). IV is specified as LE representation 492 * of a 64-bit block number which we allow to be passed in directly. 493 */ 494 memcpy(&blocknum, iv, AES_XTS_IVSIZE); 495 for (i = 0; i < AES_XTS_IVSIZE; i++) { 496 ctx->tweak[i] = blocknum & 0xff; 497 blocknum >>= 8; 498 } 499 /* Last 64 bits of IV are always zero */ 500 bzero(ctx->tweak + AES_XTS_IVSIZE, AES_XTS_IVSIZE); 501 502 rijndael_encrypt(&ctx->key2, ctx->tweak, ctx->tweak); 503 } 504 505 void 506 aes_xts_crypt(struct aes_xts_ctx *ctx, u_int8_t *data, u_int do_encrypt) 507 { 508 u_int8_t block[AES_XTS_BLOCKSIZE]; 509 u_int i, carry_in, carry_out; 510 511 for (i = 0; i < AES_XTS_BLOCKSIZE; i++) 512 block[i] = data[i] ^ ctx->tweak[i]; 513 514 if (do_encrypt) 515 rijndael_encrypt(&ctx->key1, block, data); 516 else 517 rijndael_decrypt(&ctx->key1, block, data); 518 519 for (i = 0; i < AES_XTS_BLOCKSIZE; i++) 520 data[i] ^= ctx->tweak[i]; 521 522 /* Exponentiate tweak */ 523 carry_in = 0; 524 for (i = 0; i < AES_XTS_BLOCKSIZE; i++) { 525 carry_out = ctx->tweak[i] & 0x80; 526 ctx->tweak[i] = (ctx->tweak[i] << 1) | (carry_in ? 1 : 0); 527 carry_in = carry_out; 528 } 529 if (carry_in) 530 ctx->tweak[0] ^= AES_XTS_ALPHA; 531 explicit_bzero(block, sizeof(block)); 532 } 533 534 void 535 aes_xts_encrypt(caddr_t key, u_int8_t *data) 536 { 537 aes_xts_crypt((struct aes_xts_ctx *)key, data, 1); 538 } 539 540 void 541 aes_xts_decrypt(caddr_t key, u_int8_t *data) 542 { 543 aes_xts_crypt((struct aes_xts_ctx *)key, data, 0); 544 } 545 546 int 547 aes_xts_setkey(void *sched, u_int8_t *key, int len) 548 { 549 struct aes_xts_ctx *ctx; 550 551 if (len != 32 && len != 64) 552 return -1; 553 554 ctx = (struct aes_xts_ctx *)sched; 555 556 rijndael_set_key(&ctx->key1, key, len * 4); 557 rijndael_set_key(&ctx->key2, key + (len / 2), len * 4); 558 559 return 0; 560 } 561 562 /* 563 * And now for auth. 564 */ 565 566 int 567 RMD160Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) 568 { 569 RMD160Update(ctx, buf, len); 570 return 0; 571 } 572 573 int 574 MD5Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) 575 { 576 MD5Update(ctx, buf, len); 577 return 0; 578 } 579 580 int 581 SHA1Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) 582 { 583 SHA1Update(ctx, buf, len); 584 return 0; 585 } 586 587 int 588 SHA256Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) 589 { 590 SHA256Update(ctx, buf, len); 591 return 0; 592 } 593 594 int 595 SHA384Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) 596 { 597 SHA384Update(ctx, buf, len); 598 return 0; 599 } 600 601 int 602 SHA512Update_int(void *ctx, const u_int8_t *buf, u_int16_t len) 603 { 604 SHA512Update(ctx, buf, len); 605 return 0; 606 } 607 608 609 u_int32_t deflate_global(u_int8_t *, u_int32_t, int, u_int8_t **); 610 611 struct deflate_buf { 612 u_int8_t *out; 613 u_int32_t size; 614 int flag; 615 }; 616 617 /* 618 * And compression 619 */ 620 621 u_int32_t 622 deflate_compress(u_int8_t *data, u_int32_t size, u_int8_t **out) 623 { 624 return deflate_global(data, size, 0, out); 625 } 626 627 u_int32_t 628 deflate_decompress(u_int8_t *data, u_int32_t size, u_int8_t **out) 629 { 630 return deflate_global(data, size, 1, out); 631 } 632 633 u_int32_t 634 lzs_dummy(u_int8_t *data, u_int32_t size, u_int8_t **out) 635 { 636 *out = NULL; 637 return (0); 638 } 639