Lines Matching refs:ctx

63     struct trad_pkware *ctx;  in zip_source_pkware()  local
75 if ((ctx=(struct trad_pkware *)malloc(sizeof(*ctx))) == NULL) { in zip_source_pkware()
80 zip_error_init(&ctx->error); in zip_source_pkware()
82 ctx->key[0] = KEY0; in zip_source_pkware()
83 ctx->key[1] = KEY1; in zip_source_pkware()
84 ctx->key[2] = KEY2; in zip_source_pkware()
85 decrypt(ctx, NULL, (const zip_uint8_t *)password, strlen(password), 1); in zip_source_pkware()
87 if ((s2=zip_source_layered(za, src, pkware_decrypt, ctx)) == NULL) { in zip_source_pkware()
88 pkware_free(ctx); in zip_source_pkware()
97 decrypt(struct trad_pkware *ctx, zip_uint8_t *out, const zip_uint8_t *in, in decrypt() argument
109 tmp = (zip_uint16_t)(ctx->key[2] | 2); in decrypt()
119 ctx->key[0] = (zip_uint32_t)crc32(ctx->key[0] ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL; in decrypt()
120 ctx->key[1] = (ctx->key[1] + (ctx->key[0] & 0xff)) * 134775813 + 1; in decrypt()
121 b = (Bytef)(ctx->key[1] >> 24); in decrypt()
122 ctx->key[2] = (zip_uint32_t)crc32(ctx->key[2] ^ 0xffffffffUL, &b, 1) ^ 0xffffffffUL; in decrypt()
128 decrypt_header(zip_source_t *src, struct trad_pkware *ctx) in decrypt_header() argument
136 _zip_error_set_from_source(&ctx->error, src); in decrypt_header()
141 zip_error_set(&ctx->error, ZIP_ER_EOF, 0); in decrypt_header()
145 decrypt(ctx, header, header, HEADERLEN, 0); in decrypt_header()
155 zip_error_set(&ctx->error, ZIP_ER_WRONGPASSWD, 0); in decrypt_header()
167 struct trad_pkware *ctx; in pkware_decrypt() local
170 ctx = (struct trad_pkware *)ud; in pkware_decrypt()
174 if (decrypt_header(src, ctx) < 0) in pkware_decrypt()
180 _zip_error_set_from_source(&ctx->error, src); in pkware_decrypt()
209 return zip_error_to_data(&ctx->error, data, len); in pkware_decrypt()
212 pkware_free(ctx); in pkware_decrypt()
216 zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); in pkware_decrypt()
223 pkware_free(struct trad_pkware *ctx) in pkware_free() argument
225 free(ctx); in pkware_free()