···298298 struct crypto_akcipher *tfm = crypto_akcipher_reqtfm(req);299299 struct pkcs1pad_ctx *ctx = akcipher_tfm_ctx(tfm);300300 struct pkcs1pad_request *req_ctx = akcipher_request_ctx(req);301301+ unsigned int dst_len;301302 unsigned int pos;302302-303303- if (err == -EOVERFLOW)304304- /* Decrypted value had no leading 0 byte */305305- err = -EINVAL;303303+ u8 *out_buf;306304307305 if (err)308306 goto done;309307310310- if (req_ctx->child_req.dst_len != ctx->key_size - 1) {311311- err = -EINVAL;308308+ err = -EINVAL;309309+ dst_len = req_ctx->child_req.dst_len;310310+ if (dst_len < ctx->key_size - 1)312311 goto done;312312+313313+ out_buf = req_ctx->out_buf;314314+ if (dst_len == ctx->key_size) {315315+ if (out_buf[0] != 0x00)316316+ /* Decrypted value had no leading 0 byte */317317+ goto done;318318+319319+ dst_len--;320320+ out_buf++;313321 }314322315315- if (req_ctx->out_buf[0] != 0x02) {316316- err = -EINVAL;323323+ if (out_buf[0] != 0x02)317324 goto done;318318- }319319- for (pos = 1; pos < req_ctx->child_req.dst_len; pos++)320320- if (req_ctx->out_buf[pos] == 0x00)325325+326326+ for (pos = 1; pos < dst_len; pos++)327327+ if (out_buf[pos] == 0x00)321328 break;322322- if (pos < 9 || pos == req_ctx->child_req.dst_len) {323323- err = -EINVAL;329329+ if (pos < 9 || pos == dst_len)324330 goto done;325325- }326331 pos++;327332328328- if (req->dst_len < req_ctx->child_req.dst_len - pos)333333+ err = 0;334334+335335+ if (req->dst_len < dst_len - pos)329336 err = -EOVERFLOW;330330- req->dst_len = req_ctx->child_req.dst_len - pos;337337+ req->dst_len = dst_len - pos;331338332339 if (!err)333340 sg_copy_from_buffer(req->dst,334341 sg_nents_for_len(req->dst, req->dst_len),335335- req_ctx->out_buf + pos, req->dst_len);342342+ out_buf + pos, req->dst_len);336343337344done:338345 kzfree(req_ctx->out_buf);
+1-1
drivers/char/hw_random/Kconfig
···244244245245config HW_RANDOM_MXC_RNGA246246 tristate "Freescale i.MX RNGA Random Number Generator"247247- depends on ARCH_HAS_RNGA247247+ depends on SOC_IMX31248248 default HW_RANDOM249249 ---help---250250 This driver provides kernel-side support for the Random Number