| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Cryptographic API. |
|---|
| 3 | 4 | * |
|---|
| .. | .. |
|---|
| 6 | 7 | * Copyright (c) 2010 Nokia Corporation |
|---|
| 7 | 8 | * Author: Dmitry Kasatkin <dmitry.kasatkin@nokia.com> |
|---|
| 8 | 9 | * Copyright (c) 2011 Texas Instruments Incorporated |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 11 | | - * it under the terms of the GNU General Public License version 2 as published |
|---|
| 12 | | - * by the Free Software Foundation. |
|---|
| 13 | | - * |
|---|
| 14 | 10 | */ |
|---|
| 15 | 11 | |
|---|
| 16 | 12 | #define pr_fmt(fmt) "%20s: " fmt, __func__ |
|---|
| .. | .. |
|---|
| 107 | 103 | dd->err = 0; |
|---|
| 108 | 104 | } |
|---|
| 109 | 105 | |
|---|
| 110 | | - err = pm_runtime_get_sync(dd->dev); |
|---|
| 106 | + err = pm_runtime_resume_and_get(dd->dev); |
|---|
| 111 | 107 | if (err < 0) { |
|---|
| 112 | 108 | dev_err(dd->dev, "failed to get sync: %d\n", err); |
|---|
| 113 | 109 | return err; |
|---|
| .. | .. |
|---|
| 143 | 139 | |
|---|
| 144 | 140 | for (i = 0; i < key32; i++) { |
|---|
| 145 | 141 | omap_aes_write(dd, AES_REG_KEY(dd, i), |
|---|
| 146 | | - __le32_to_cpu(dd->ctx->key[i])); |
|---|
| 142 | + (__force u32)cpu_to_le32(dd->ctx->key[i])); |
|---|
| 147 | 143 | } |
|---|
| 148 | 144 | |
|---|
| 149 | | - if ((dd->flags & (FLAGS_CBC | FLAGS_CTR)) && dd->req->info) |
|---|
| 150 | | - omap_aes_write_n(dd, AES_REG_IV(dd, 0), dd->req->info, 4); |
|---|
| 145 | + if ((dd->flags & (FLAGS_CBC | FLAGS_CTR)) && dd->req->iv) |
|---|
| 146 | + omap_aes_write_n(dd, AES_REG_IV(dd, 0), (void *)dd->req->iv, 4); |
|---|
| 151 | 147 | |
|---|
| 152 | 148 | if ((dd->flags & (FLAGS_GCM)) && dd->aead_req->iv) { |
|---|
| 153 | 149 | rctx = aead_request_ctx(dd->aead_req); |
|---|
| .. | .. |
|---|
| 273 | 269 | struct scatterlist *out_sg, |
|---|
| 274 | 270 | int in_sg_len, int out_sg_len) |
|---|
| 275 | 271 | { |
|---|
| 276 | | - struct dma_async_tx_descriptor *tx_in, *tx_out; |
|---|
| 272 | + struct dma_async_tx_descriptor *tx_in, *tx_out = NULL, *cb_desc; |
|---|
| 277 | 273 | struct dma_slave_config cfg; |
|---|
| 278 | 274 | int ret; |
|---|
| 279 | 275 | |
|---|
| 280 | 276 | if (dd->pio_only) { |
|---|
| 281 | 277 | scatterwalk_start(&dd->in_walk, dd->in_sg); |
|---|
| 282 | | - scatterwalk_start(&dd->out_walk, dd->out_sg); |
|---|
| 278 | + if (out_sg_len) |
|---|
| 279 | + scatterwalk_start(&dd->out_walk, dd->out_sg); |
|---|
| 283 | 280 | |
|---|
| 284 | 281 | /* Enable DATAIN interrupt and let it take |
|---|
| 285 | 282 | care of the rest */ |
|---|
| .. | .. |
|---|
| 316 | 313 | |
|---|
| 317 | 314 | /* No callback necessary */ |
|---|
| 318 | 315 | tx_in->callback_param = dd; |
|---|
| 316 | + tx_in->callback = NULL; |
|---|
| 319 | 317 | |
|---|
| 320 | 318 | /* OUT */ |
|---|
| 321 | | - ret = dmaengine_slave_config(dd->dma_lch_out, &cfg); |
|---|
| 322 | | - if (ret) { |
|---|
| 323 | | - dev_err(dd->dev, "can't configure OUT dmaengine slave: %d\n", |
|---|
| 324 | | - ret); |
|---|
| 325 | | - return ret; |
|---|
| 326 | | - } |
|---|
| 319 | + if (out_sg_len) { |
|---|
| 320 | + ret = dmaengine_slave_config(dd->dma_lch_out, &cfg); |
|---|
| 321 | + if (ret) { |
|---|
| 322 | + dev_err(dd->dev, "can't configure OUT dmaengine slave: %d\n", |
|---|
| 323 | + ret); |
|---|
| 324 | + return ret; |
|---|
| 325 | + } |
|---|
| 327 | 326 | |
|---|
| 328 | | - tx_out = dmaengine_prep_slave_sg(dd->dma_lch_out, out_sg, out_sg_len, |
|---|
| 329 | | - DMA_DEV_TO_MEM, |
|---|
| 330 | | - DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
|---|
| 331 | | - if (!tx_out) { |
|---|
| 332 | | - dev_err(dd->dev, "OUT prep_slave_sg() failed\n"); |
|---|
| 333 | | - return -EINVAL; |
|---|
| 327 | + tx_out = dmaengine_prep_slave_sg(dd->dma_lch_out, out_sg, |
|---|
| 328 | + out_sg_len, |
|---|
| 329 | + DMA_DEV_TO_MEM, |
|---|
| 330 | + DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
|---|
| 331 | + if (!tx_out) { |
|---|
| 332 | + dev_err(dd->dev, "OUT prep_slave_sg() failed\n"); |
|---|
| 333 | + return -EINVAL; |
|---|
| 334 | + } |
|---|
| 335 | + |
|---|
| 336 | + cb_desc = tx_out; |
|---|
| 337 | + } else { |
|---|
| 338 | + cb_desc = tx_in; |
|---|
| 334 | 339 | } |
|---|
| 335 | 340 | |
|---|
| 336 | 341 | if (dd->flags & FLAGS_GCM) |
|---|
| 337 | | - tx_out->callback = omap_aes_gcm_dma_out_callback; |
|---|
| 342 | + cb_desc->callback = omap_aes_gcm_dma_out_callback; |
|---|
| 338 | 343 | else |
|---|
| 339 | | - tx_out->callback = omap_aes_dma_out_callback; |
|---|
| 340 | | - tx_out->callback_param = dd; |
|---|
| 344 | + cb_desc->callback = omap_aes_dma_out_callback; |
|---|
| 345 | + cb_desc->callback_param = dd; |
|---|
| 346 | + |
|---|
| 341 | 347 | |
|---|
| 342 | 348 | dmaengine_submit(tx_in); |
|---|
| 343 | | - dmaengine_submit(tx_out); |
|---|
| 349 | + if (tx_out) |
|---|
| 350 | + dmaengine_submit(tx_out); |
|---|
| 344 | 351 | |
|---|
| 345 | 352 | dma_async_issue_pending(dd->dma_lch_in); |
|---|
| 346 | | - dma_async_issue_pending(dd->dma_lch_out); |
|---|
| 353 | + if (out_sg_len) |
|---|
| 354 | + dma_async_issue_pending(dd->dma_lch_out); |
|---|
| 347 | 355 | |
|---|
| 348 | 356 | /* start DMA */ |
|---|
| 349 | 357 | dd->pdata->trigger(dd, dd->total); |
|---|
| .. | .. |
|---|
| 355 | 363 | { |
|---|
| 356 | 364 | int err; |
|---|
| 357 | 365 | |
|---|
| 358 | | - pr_debug("total: %d\n", dd->total); |
|---|
| 366 | + pr_debug("total: %zu\n", dd->total); |
|---|
| 359 | 367 | |
|---|
| 360 | 368 | if (!dd->pio_only) { |
|---|
| 361 | 369 | err = dma_map_sg(dd->dev, dd->in_sg, dd->in_sg_len, |
|---|
| .. | .. |
|---|
| 365 | 373 | return -EINVAL; |
|---|
| 366 | 374 | } |
|---|
| 367 | 375 | |
|---|
| 368 | | - err = dma_map_sg(dd->dev, dd->out_sg, dd->out_sg_len, |
|---|
| 369 | | - DMA_FROM_DEVICE); |
|---|
| 370 | | - if (!err) { |
|---|
| 371 | | - dev_err(dd->dev, "dma_map_sg() error\n"); |
|---|
| 372 | | - return -EINVAL; |
|---|
| 376 | + if (dd->out_sg_len) { |
|---|
| 377 | + err = dma_map_sg(dd->dev, dd->out_sg, dd->out_sg_len, |
|---|
| 378 | + DMA_FROM_DEVICE); |
|---|
| 379 | + if (!err) { |
|---|
| 380 | + dev_err(dd->dev, "dma_map_sg() error\n"); |
|---|
| 381 | + return -EINVAL; |
|---|
| 382 | + } |
|---|
| 373 | 383 | } |
|---|
| 374 | 384 | } |
|---|
| 375 | 385 | |
|---|
| .. | .. |
|---|
| 377 | 387 | dd->out_sg_len); |
|---|
| 378 | 388 | if (err && !dd->pio_only) { |
|---|
| 379 | 389 | dma_unmap_sg(dd->dev, dd->in_sg, dd->in_sg_len, DMA_TO_DEVICE); |
|---|
| 380 | | - dma_unmap_sg(dd->dev, dd->out_sg, dd->out_sg_len, |
|---|
| 381 | | - DMA_FROM_DEVICE); |
|---|
| 390 | + if (dd->out_sg_len) |
|---|
| 391 | + dma_unmap_sg(dd->dev, dd->out_sg, dd->out_sg_len, |
|---|
| 392 | + DMA_FROM_DEVICE); |
|---|
| 382 | 393 | } |
|---|
| 383 | 394 | |
|---|
| 384 | 395 | return err; |
|---|
| .. | .. |
|---|
| 386 | 397 | |
|---|
| 387 | 398 | static void omap_aes_finish_req(struct omap_aes_dev *dd, int err) |
|---|
| 388 | 399 | { |
|---|
| 389 | | - struct ablkcipher_request *req = dd->req; |
|---|
| 400 | + struct skcipher_request *req = dd->req; |
|---|
| 390 | 401 | |
|---|
| 391 | 402 | pr_debug("err: %d\n", err); |
|---|
| 392 | 403 | |
|---|
| 393 | | - crypto_finalize_ablkcipher_request(dd->engine, req, err); |
|---|
| 404 | + crypto_finalize_skcipher_request(dd->engine, req, err); |
|---|
| 394 | 405 | |
|---|
| 395 | 406 | pm_runtime_mark_last_busy(dd->dev); |
|---|
| 396 | 407 | pm_runtime_put_autosuspend(dd->dev); |
|---|
| .. | .. |
|---|
| 398 | 409 | |
|---|
| 399 | 410 | int omap_aes_crypt_dma_stop(struct omap_aes_dev *dd) |
|---|
| 400 | 411 | { |
|---|
| 401 | | - pr_debug("total: %d\n", dd->total); |
|---|
| 412 | + pr_debug("total: %zu\n", dd->total); |
|---|
| 402 | 413 | |
|---|
| 403 | 414 | omap_aes_dma_stop(dd); |
|---|
| 404 | 415 | |
|---|
| .. | .. |
|---|
| 407 | 418 | } |
|---|
| 408 | 419 | |
|---|
| 409 | 420 | static int omap_aes_handle_queue(struct omap_aes_dev *dd, |
|---|
| 410 | | - struct ablkcipher_request *req) |
|---|
| 421 | + struct skcipher_request *req) |
|---|
| 411 | 422 | { |
|---|
| 412 | 423 | if (req) |
|---|
| 413 | | - return crypto_transfer_ablkcipher_request_to_engine(dd->engine, req); |
|---|
| 424 | + return crypto_transfer_skcipher_request_to_engine(dd->engine, req); |
|---|
| 414 | 425 | |
|---|
| 415 | 426 | return 0; |
|---|
| 416 | 427 | } |
|---|
| .. | .. |
|---|
| 418 | 429 | static int omap_aes_prepare_req(struct crypto_engine *engine, |
|---|
| 419 | 430 | void *areq) |
|---|
| 420 | 431 | { |
|---|
| 421 | | - struct ablkcipher_request *req = container_of(areq, struct ablkcipher_request, base); |
|---|
| 422 | | - struct omap_aes_ctx *ctx = crypto_ablkcipher_ctx( |
|---|
| 423 | | - crypto_ablkcipher_reqtfm(req)); |
|---|
| 424 | | - struct omap_aes_reqctx *rctx = ablkcipher_request_ctx(req); |
|---|
| 432 | + struct skcipher_request *req = container_of(areq, struct skcipher_request, base); |
|---|
| 433 | + struct omap_aes_ctx *ctx = crypto_skcipher_ctx( |
|---|
| 434 | + crypto_skcipher_reqtfm(req)); |
|---|
| 435 | + struct omap_aes_reqctx *rctx = skcipher_request_ctx(req); |
|---|
| 425 | 436 | struct omap_aes_dev *dd = rctx->dd; |
|---|
| 426 | 437 | int ret; |
|---|
| 427 | 438 | u16 flags; |
|---|
| .. | .. |
|---|
| 431 | 442 | |
|---|
| 432 | 443 | /* assign new request to device */ |
|---|
| 433 | 444 | dd->req = req; |
|---|
| 434 | | - dd->total = req->nbytes; |
|---|
| 435 | | - dd->total_save = req->nbytes; |
|---|
| 445 | + dd->total = req->cryptlen; |
|---|
| 446 | + dd->total_save = req->cryptlen; |
|---|
| 436 | 447 | dd->in_sg = req->src; |
|---|
| 437 | 448 | dd->out_sg = req->dst; |
|---|
| 438 | 449 | dd->orig_out = req->dst; |
|---|
| .. | .. |
|---|
| 473 | 484 | static int omap_aes_crypt_req(struct crypto_engine *engine, |
|---|
| 474 | 485 | void *areq) |
|---|
| 475 | 486 | { |
|---|
| 476 | | - struct ablkcipher_request *req = container_of(areq, struct ablkcipher_request, base); |
|---|
| 477 | | - struct omap_aes_reqctx *rctx = ablkcipher_request_ctx(req); |
|---|
| 487 | + struct skcipher_request *req = container_of(areq, struct skcipher_request, base); |
|---|
| 488 | + struct omap_aes_reqctx *rctx = skcipher_request_ctx(req); |
|---|
| 478 | 489 | struct omap_aes_dev *dd = rctx->dd; |
|---|
| 479 | 490 | |
|---|
| 480 | 491 | if (!dd) |
|---|
| 481 | 492 | return -ENODEV; |
|---|
| 482 | 493 | |
|---|
| 483 | 494 | return omap_aes_crypt_dma_start(dd); |
|---|
| 495 | +} |
|---|
| 496 | + |
|---|
| 497 | +static void omap_aes_copy_ivout(struct omap_aes_dev *dd, u8 *ivbuf) |
|---|
| 498 | +{ |
|---|
| 499 | + int i; |
|---|
| 500 | + |
|---|
| 501 | + for (i = 0; i < 4; i++) |
|---|
| 502 | + ((u32 *)ivbuf)[i] = omap_aes_read(dd, AES_REG_IV(dd, i)); |
|---|
| 484 | 503 | } |
|---|
| 485 | 504 | |
|---|
| 486 | 505 | static void omap_aes_done_task(unsigned long data) |
|---|
| .. | .. |
|---|
| 498 | 517 | omap_aes_crypt_dma_stop(dd); |
|---|
| 499 | 518 | } |
|---|
| 500 | 519 | |
|---|
| 501 | | - omap_crypto_cleanup(dd->in_sgl, NULL, 0, dd->total_save, |
|---|
| 520 | + omap_crypto_cleanup(dd->in_sg, NULL, 0, dd->total_save, |
|---|
| 502 | 521 | FLAGS_IN_DATA_ST_SHIFT, dd->flags); |
|---|
| 503 | 522 | |
|---|
| 504 | | - omap_crypto_cleanup(&dd->out_sgl, dd->orig_out, 0, dd->total_save, |
|---|
| 523 | + omap_crypto_cleanup(dd->out_sg, dd->orig_out, 0, dd->total_save, |
|---|
| 505 | 524 | FLAGS_OUT_DATA_ST_SHIFT, dd->flags); |
|---|
| 525 | + |
|---|
| 526 | + /* Update IV output */ |
|---|
| 527 | + if (dd->flags & (FLAGS_CBC | FLAGS_CTR)) |
|---|
| 528 | + omap_aes_copy_ivout(dd, dd->req->iv); |
|---|
| 506 | 529 | |
|---|
| 507 | 530 | omap_aes_finish_req(dd, 0); |
|---|
| 508 | 531 | |
|---|
| 509 | 532 | pr_debug("exit\n"); |
|---|
| 510 | 533 | } |
|---|
| 511 | 534 | |
|---|
| 512 | | -static int omap_aes_crypt(struct ablkcipher_request *req, unsigned long mode) |
|---|
| 535 | +static int omap_aes_crypt(struct skcipher_request *req, unsigned long mode) |
|---|
| 513 | 536 | { |
|---|
| 514 | | - struct omap_aes_ctx *ctx = crypto_ablkcipher_ctx( |
|---|
| 515 | | - crypto_ablkcipher_reqtfm(req)); |
|---|
| 516 | | - struct omap_aes_reqctx *rctx = ablkcipher_request_ctx(req); |
|---|
| 537 | + struct omap_aes_ctx *ctx = crypto_skcipher_ctx( |
|---|
| 538 | + crypto_skcipher_reqtfm(req)); |
|---|
| 539 | + struct omap_aes_reqctx *rctx = skcipher_request_ctx(req); |
|---|
| 517 | 540 | struct omap_aes_dev *dd; |
|---|
| 518 | 541 | int ret; |
|---|
| 519 | 542 | |
|---|
| 520 | | - pr_debug("nbytes: %d, enc: %d, cbc: %d\n", req->nbytes, |
|---|
| 543 | + if ((req->cryptlen % AES_BLOCK_SIZE) && !(mode & FLAGS_CTR)) |
|---|
| 544 | + return -EINVAL; |
|---|
| 545 | + |
|---|
| 546 | + pr_debug("nbytes: %d, enc: %d, cbc: %d\n", req->cryptlen, |
|---|
| 521 | 547 | !!(mode & FLAGS_ENCRYPT), |
|---|
| 522 | 548 | !!(mode & FLAGS_CBC)); |
|---|
| 523 | 549 | |
|---|
| 524 | | - if (req->nbytes < aes_fallback_sz) { |
|---|
| 525 | | - SKCIPHER_REQUEST_ON_STACK(subreq, ctx->fallback); |
|---|
| 526 | | - |
|---|
| 527 | | - skcipher_request_set_tfm(subreq, ctx->fallback); |
|---|
| 528 | | - skcipher_request_set_callback(subreq, req->base.flags, NULL, |
|---|
| 529 | | - NULL); |
|---|
| 530 | | - skcipher_request_set_crypt(subreq, req->src, req->dst, |
|---|
| 531 | | - req->nbytes, req->info); |
|---|
| 550 | + if (req->cryptlen < aes_fallback_sz) { |
|---|
| 551 | + skcipher_request_set_tfm(&rctx->fallback_req, ctx->fallback); |
|---|
| 552 | + skcipher_request_set_callback(&rctx->fallback_req, |
|---|
| 553 | + req->base.flags, |
|---|
| 554 | + req->base.complete, |
|---|
| 555 | + req->base.data); |
|---|
| 556 | + skcipher_request_set_crypt(&rctx->fallback_req, req->src, |
|---|
| 557 | + req->dst, req->cryptlen, req->iv); |
|---|
| 532 | 558 | |
|---|
| 533 | 559 | if (mode & FLAGS_ENCRYPT) |
|---|
| 534 | | - ret = crypto_skcipher_encrypt(subreq); |
|---|
| 560 | + ret = crypto_skcipher_encrypt(&rctx->fallback_req); |
|---|
| 535 | 561 | else |
|---|
| 536 | | - ret = crypto_skcipher_decrypt(subreq); |
|---|
| 537 | | - |
|---|
| 538 | | - skcipher_request_zero(subreq); |
|---|
| 562 | + ret = crypto_skcipher_decrypt(&rctx->fallback_req); |
|---|
| 539 | 563 | return ret; |
|---|
| 540 | 564 | } |
|---|
| 541 | 565 | dd = omap_aes_find_dev(rctx); |
|---|
| .. | .. |
|---|
| 549 | 573 | |
|---|
| 550 | 574 | /* ********************** ALG API ************************************ */ |
|---|
| 551 | 575 | |
|---|
| 552 | | -static int omap_aes_setkey(struct crypto_ablkcipher *tfm, const u8 *key, |
|---|
| 576 | +static int omap_aes_setkey(struct crypto_skcipher *tfm, const u8 *key, |
|---|
| 553 | 577 | unsigned int keylen) |
|---|
| 554 | 578 | { |
|---|
| 555 | | - struct omap_aes_ctx *ctx = crypto_ablkcipher_ctx(tfm); |
|---|
| 579 | + struct omap_aes_ctx *ctx = crypto_skcipher_ctx(tfm); |
|---|
| 556 | 580 | int ret; |
|---|
| 557 | 581 | |
|---|
| 558 | 582 | if (keylen != AES_KEYSIZE_128 && keylen != AES_KEYSIZE_192 && |
|---|
| .. | .. |
|---|
| 575 | 599 | return 0; |
|---|
| 576 | 600 | } |
|---|
| 577 | 601 | |
|---|
| 578 | | -static int omap_aes_ecb_encrypt(struct ablkcipher_request *req) |
|---|
| 602 | +static int omap_aes_ecb_encrypt(struct skcipher_request *req) |
|---|
| 579 | 603 | { |
|---|
| 580 | 604 | return omap_aes_crypt(req, FLAGS_ENCRYPT); |
|---|
| 581 | 605 | } |
|---|
| 582 | 606 | |
|---|
| 583 | | -static int omap_aes_ecb_decrypt(struct ablkcipher_request *req) |
|---|
| 607 | +static int omap_aes_ecb_decrypt(struct skcipher_request *req) |
|---|
| 584 | 608 | { |
|---|
| 585 | 609 | return omap_aes_crypt(req, 0); |
|---|
| 586 | 610 | } |
|---|
| 587 | 611 | |
|---|
| 588 | | -static int omap_aes_cbc_encrypt(struct ablkcipher_request *req) |
|---|
| 612 | +static int omap_aes_cbc_encrypt(struct skcipher_request *req) |
|---|
| 589 | 613 | { |
|---|
| 590 | 614 | return omap_aes_crypt(req, FLAGS_ENCRYPT | FLAGS_CBC); |
|---|
| 591 | 615 | } |
|---|
| 592 | 616 | |
|---|
| 593 | | -static int omap_aes_cbc_decrypt(struct ablkcipher_request *req) |
|---|
| 617 | +static int omap_aes_cbc_decrypt(struct skcipher_request *req) |
|---|
| 594 | 618 | { |
|---|
| 595 | 619 | return omap_aes_crypt(req, FLAGS_CBC); |
|---|
| 596 | 620 | } |
|---|
| 597 | 621 | |
|---|
| 598 | | -static int omap_aes_ctr_encrypt(struct ablkcipher_request *req) |
|---|
| 622 | +static int omap_aes_ctr_encrypt(struct skcipher_request *req) |
|---|
| 599 | 623 | { |
|---|
| 600 | 624 | return omap_aes_crypt(req, FLAGS_ENCRYPT | FLAGS_CTR); |
|---|
| 601 | 625 | } |
|---|
| 602 | 626 | |
|---|
| 603 | | -static int omap_aes_ctr_decrypt(struct ablkcipher_request *req) |
|---|
| 627 | +static int omap_aes_ctr_decrypt(struct skcipher_request *req) |
|---|
| 604 | 628 | { |
|---|
| 605 | 629 | return omap_aes_crypt(req, FLAGS_CTR); |
|---|
| 606 | 630 | } |
|---|
| .. | .. |
|---|
| 610 | 634 | static int omap_aes_crypt_req(struct crypto_engine *engine, |
|---|
| 611 | 635 | void *req); |
|---|
| 612 | 636 | |
|---|
| 613 | | -static int omap_aes_cra_init(struct crypto_tfm *tfm) |
|---|
| 637 | +static int omap_aes_init_tfm(struct crypto_skcipher *tfm) |
|---|
| 614 | 638 | { |
|---|
| 615 | | - const char *name = crypto_tfm_alg_name(tfm); |
|---|
| 616 | | - const u32 flags = CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK; |
|---|
| 617 | | - struct omap_aes_ctx *ctx = crypto_tfm_ctx(tfm); |
|---|
| 639 | + const char *name = crypto_tfm_alg_name(&tfm->base); |
|---|
| 640 | + struct omap_aes_ctx *ctx = crypto_skcipher_ctx(tfm); |
|---|
| 618 | 641 | struct crypto_skcipher *blk; |
|---|
| 619 | 642 | |
|---|
| 620 | | - blk = crypto_alloc_skcipher(name, 0, flags); |
|---|
| 643 | + blk = crypto_alloc_skcipher(name, 0, CRYPTO_ALG_NEED_FALLBACK); |
|---|
| 621 | 644 | if (IS_ERR(blk)) |
|---|
| 622 | 645 | return PTR_ERR(blk); |
|---|
| 623 | 646 | |
|---|
| 624 | 647 | ctx->fallback = blk; |
|---|
| 625 | 648 | |
|---|
| 626 | | - tfm->crt_ablkcipher.reqsize = sizeof(struct omap_aes_reqctx); |
|---|
| 649 | + crypto_skcipher_set_reqsize(tfm, sizeof(struct omap_aes_reqctx) + |
|---|
| 650 | + crypto_skcipher_reqsize(blk)); |
|---|
| 627 | 651 | |
|---|
| 628 | 652 | ctx->enginectx.op.prepare_request = omap_aes_prepare_req; |
|---|
| 629 | 653 | ctx->enginectx.op.unprepare_request = NULL; |
|---|
| .. | .. |
|---|
| 632 | 656 | return 0; |
|---|
| 633 | 657 | } |
|---|
| 634 | 658 | |
|---|
| 635 | | -static int omap_aes_gcm_cra_init(struct crypto_aead *tfm) |
|---|
| 659 | +static void omap_aes_exit_tfm(struct crypto_skcipher *tfm) |
|---|
| 636 | 660 | { |
|---|
| 637 | | - struct omap_aes_dev *dd = NULL; |
|---|
| 638 | | - struct omap_aes_ctx *ctx = crypto_aead_ctx(tfm); |
|---|
| 639 | | - int err; |
|---|
| 640 | | - |
|---|
| 641 | | - /* Find AES device, currently picks the first device */ |
|---|
| 642 | | - spin_lock_bh(&list_lock); |
|---|
| 643 | | - list_for_each_entry(dd, &dev_list, list) { |
|---|
| 644 | | - break; |
|---|
| 645 | | - } |
|---|
| 646 | | - spin_unlock_bh(&list_lock); |
|---|
| 647 | | - |
|---|
| 648 | | - err = pm_runtime_get_sync(dd->dev); |
|---|
| 649 | | - if (err < 0) { |
|---|
| 650 | | - dev_err(dd->dev, "%s: failed to get_sync(%d)\n", |
|---|
| 651 | | - __func__, err); |
|---|
| 652 | | - return err; |
|---|
| 653 | | - } |
|---|
| 654 | | - |
|---|
| 655 | | - tfm->reqsize = sizeof(struct omap_aes_reqctx); |
|---|
| 656 | | - ctx->ctr = crypto_alloc_skcipher("ecb(aes)", 0, 0); |
|---|
| 657 | | - if (IS_ERR(ctx->ctr)) { |
|---|
| 658 | | - pr_warn("could not load aes driver for encrypting IV\n"); |
|---|
| 659 | | - return PTR_ERR(ctx->ctr); |
|---|
| 660 | | - } |
|---|
| 661 | | - |
|---|
| 662 | | - return 0; |
|---|
| 663 | | -} |
|---|
| 664 | | - |
|---|
| 665 | | -static void omap_aes_cra_exit(struct crypto_tfm *tfm) |
|---|
| 666 | | -{ |
|---|
| 667 | | - struct omap_aes_ctx *ctx = crypto_tfm_ctx(tfm); |
|---|
| 661 | + struct omap_aes_ctx *ctx = crypto_skcipher_ctx(tfm); |
|---|
| 668 | 662 | |
|---|
| 669 | 663 | if (ctx->fallback) |
|---|
| 670 | 664 | crypto_free_skcipher(ctx->fallback); |
|---|
| .. | .. |
|---|
| 672 | 666 | ctx->fallback = NULL; |
|---|
| 673 | 667 | } |
|---|
| 674 | 668 | |
|---|
| 675 | | -static void omap_aes_gcm_cra_exit(struct crypto_aead *tfm) |
|---|
| 676 | | -{ |
|---|
| 677 | | - struct omap_aes_ctx *ctx = crypto_aead_ctx(tfm); |
|---|
| 678 | | - |
|---|
| 679 | | - omap_aes_cra_exit(crypto_aead_tfm(tfm)); |
|---|
| 680 | | - |
|---|
| 681 | | - if (ctx->ctr) |
|---|
| 682 | | - crypto_free_skcipher(ctx->ctr); |
|---|
| 683 | | -} |
|---|
| 684 | | - |
|---|
| 685 | 669 | /* ********************** ALGS ************************************ */ |
|---|
| 686 | 670 | |
|---|
| 687 | | -static struct crypto_alg algs_ecb_cbc[] = { |
|---|
| 671 | +static struct skcipher_alg algs_ecb_cbc[] = { |
|---|
| 688 | 672 | { |
|---|
| 689 | | - .cra_name = "ecb(aes)", |
|---|
| 690 | | - .cra_driver_name = "ecb-aes-omap", |
|---|
| 691 | | - .cra_priority = 300, |
|---|
| 692 | | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | |
|---|
| 693 | | - CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 694 | | - CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 695 | | - .cra_blocksize = AES_BLOCK_SIZE, |
|---|
| 696 | | - .cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 697 | | - .cra_alignmask = 0, |
|---|
| 698 | | - .cra_type = &crypto_ablkcipher_type, |
|---|
| 699 | | - .cra_module = THIS_MODULE, |
|---|
| 700 | | - .cra_init = omap_aes_cra_init, |
|---|
| 701 | | - .cra_exit = omap_aes_cra_exit, |
|---|
| 702 | | - .cra_u.ablkcipher = { |
|---|
| 703 | | - .min_keysize = AES_MIN_KEY_SIZE, |
|---|
| 704 | | - .max_keysize = AES_MAX_KEY_SIZE, |
|---|
| 705 | | - .setkey = omap_aes_setkey, |
|---|
| 706 | | - .encrypt = omap_aes_ecb_encrypt, |
|---|
| 707 | | - .decrypt = omap_aes_ecb_decrypt, |
|---|
| 708 | | - } |
|---|
| 673 | + .base.cra_name = "ecb(aes)", |
|---|
| 674 | + .base.cra_driver_name = "ecb-aes-omap", |
|---|
| 675 | + .base.cra_priority = 300, |
|---|
| 676 | + .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 677 | + CRYPTO_ALG_ASYNC | |
|---|
| 678 | + CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 679 | + .base.cra_blocksize = AES_BLOCK_SIZE, |
|---|
| 680 | + .base.cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 681 | + .base.cra_module = THIS_MODULE, |
|---|
| 682 | + |
|---|
| 683 | + .min_keysize = AES_MIN_KEY_SIZE, |
|---|
| 684 | + .max_keysize = AES_MAX_KEY_SIZE, |
|---|
| 685 | + .setkey = omap_aes_setkey, |
|---|
| 686 | + .encrypt = omap_aes_ecb_encrypt, |
|---|
| 687 | + .decrypt = omap_aes_ecb_decrypt, |
|---|
| 688 | + .init = omap_aes_init_tfm, |
|---|
| 689 | + .exit = omap_aes_exit_tfm, |
|---|
| 709 | 690 | }, |
|---|
| 710 | 691 | { |
|---|
| 711 | | - .cra_name = "cbc(aes)", |
|---|
| 712 | | - .cra_driver_name = "cbc-aes-omap", |
|---|
| 713 | | - .cra_priority = 300, |
|---|
| 714 | | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | |
|---|
| 715 | | - CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 716 | | - CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 717 | | - .cra_blocksize = AES_BLOCK_SIZE, |
|---|
| 718 | | - .cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 719 | | - .cra_alignmask = 0, |
|---|
| 720 | | - .cra_type = &crypto_ablkcipher_type, |
|---|
| 721 | | - .cra_module = THIS_MODULE, |
|---|
| 722 | | - .cra_init = omap_aes_cra_init, |
|---|
| 723 | | - .cra_exit = omap_aes_cra_exit, |
|---|
| 724 | | - .cra_u.ablkcipher = { |
|---|
| 725 | | - .min_keysize = AES_MIN_KEY_SIZE, |
|---|
| 726 | | - .max_keysize = AES_MAX_KEY_SIZE, |
|---|
| 727 | | - .ivsize = AES_BLOCK_SIZE, |
|---|
| 728 | | - .setkey = omap_aes_setkey, |
|---|
| 729 | | - .encrypt = omap_aes_cbc_encrypt, |
|---|
| 730 | | - .decrypt = omap_aes_cbc_decrypt, |
|---|
| 731 | | - } |
|---|
| 692 | + .base.cra_name = "cbc(aes)", |
|---|
| 693 | + .base.cra_driver_name = "cbc-aes-omap", |
|---|
| 694 | + .base.cra_priority = 300, |
|---|
| 695 | + .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 696 | + CRYPTO_ALG_ASYNC | |
|---|
| 697 | + CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 698 | + .base.cra_blocksize = AES_BLOCK_SIZE, |
|---|
| 699 | + .base.cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 700 | + .base.cra_module = THIS_MODULE, |
|---|
| 701 | + |
|---|
| 702 | + .min_keysize = AES_MIN_KEY_SIZE, |
|---|
| 703 | + .max_keysize = AES_MAX_KEY_SIZE, |
|---|
| 704 | + .ivsize = AES_BLOCK_SIZE, |
|---|
| 705 | + .setkey = omap_aes_setkey, |
|---|
| 706 | + .encrypt = omap_aes_cbc_encrypt, |
|---|
| 707 | + .decrypt = omap_aes_cbc_decrypt, |
|---|
| 708 | + .init = omap_aes_init_tfm, |
|---|
| 709 | + .exit = omap_aes_exit_tfm, |
|---|
| 732 | 710 | } |
|---|
| 733 | 711 | }; |
|---|
| 734 | 712 | |
|---|
| 735 | | -static struct crypto_alg algs_ctr[] = { |
|---|
| 713 | +static struct skcipher_alg algs_ctr[] = { |
|---|
| 736 | 714 | { |
|---|
| 737 | | - .cra_name = "ctr(aes)", |
|---|
| 738 | | - .cra_driver_name = "ctr-aes-omap", |
|---|
| 739 | | - .cra_priority = 300, |
|---|
| 740 | | - .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER | |
|---|
| 741 | | - CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 742 | | - CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 743 | | - .cra_blocksize = AES_BLOCK_SIZE, |
|---|
| 744 | | - .cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 745 | | - .cra_alignmask = 0, |
|---|
| 746 | | - .cra_type = &crypto_ablkcipher_type, |
|---|
| 747 | | - .cra_module = THIS_MODULE, |
|---|
| 748 | | - .cra_init = omap_aes_cra_init, |
|---|
| 749 | | - .cra_exit = omap_aes_cra_exit, |
|---|
| 750 | | - .cra_u.ablkcipher = { |
|---|
| 751 | | - .min_keysize = AES_MIN_KEY_SIZE, |
|---|
| 752 | | - .max_keysize = AES_MAX_KEY_SIZE, |
|---|
| 753 | | - .geniv = "eseqiv", |
|---|
| 754 | | - .ivsize = AES_BLOCK_SIZE, |
|---|
| 755 | | - .setkey = omap_aes_setkey, |
|---|
| 756 | | - .encrypt = omap_aes_ctr_encrypt, |
|---|
| 757 | | - .decrypt = omap_aes_ctr_decrypt, |
|---|
| 758 | | - } |
|---|
| 759 | | -} , |
|---|
| 715 | + .base.cra_name = "ctr(aes)", |
|---|
| 716 | + .base.cra_driver_name = "ctr-aes-omap", |
|---|
| 717 | + .base.cra_priority = 300, |
|---|
| 718 | + .base.cra_flags = CRYPTO_ALG_KERN_DRIVER_ONLY | |
|---|
| 719 | + CRYPTO_ALG_ASYNC | |
|---|
| 720 | + CRYPTO_ALG_NEED_FALLBACK, |
|---|
| 721 | + .base.cra_blocksize = 1, |
|---|
| 722 | + .base.cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 723 | + .base.cra_module = THIS_MODULE, |
|---|
| 724 | + |
|---|
| 725 | + .min_keysize = AES_MIN_KEY_SIZE, |
|---|
| 726 | + .max_keysize = AES_MAX_KEY_SIZE, |
|---|
| 727 | + .ivsize = AES_BLOCK_SIZE, |
|---|
| 728 | + .setkey = omap_aes_setkey, |
|---|
| 729 | + .encrypt = omap_aes_ctr_encrypt, |
|---|
| 730 | + .decrypt = omap_aes_ctr_decrypt, |
|---|
| 731 | + .init = omap_aes_init_tfm, |
|---|
| 732 | + .exit = omap_aes_exit_tfm, |
|---|
| 733 | +} |
|---|
| 760 | 734 | }; |
|---|
| 761 | 735 | |
|---|
| 762 | 736 | static struct omap_aes_algs_info omap_aes_algs_info_ecb_cbc[] = { |
|---|
| .. | .. |
|---|
| 775 | 749 | .cra_flags = CRYPTO_ALG_ASYNC | |
|---|
| 776 | 750 | CRYPTO_ALG_KERN_DRIVER_ONLY, |
|---|
| 777 | 751 | .cra_blocksize = 1, |
|---|
| 778 | | - .cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 752 | + .cra_ctxsize = sizeof(struct omap_aes_gcm_ctx), |
|---|
| 779 | 753 | .cra_alignmask = 0xf, |
|---|
| 780 | 754 | .cra_module = THIS_MODULE, |
|---|
| 781 | 755 | }, |
|---|
| 782 | 756 | .init = omap_aes_gcm_cra_init, |
|---|
| 783 | | - .exit = omap_aes_gcm_cra_exit, |
|---|
| 784 | 757 | .ivsize = GCM_AES_IV_SIZE, |
|---|
| 785 | 758 | .maxauthsize = AES_BLOCK_SIZE, |
|---|
| 786 | 759 | .setkey = omap_aes_gcm_setkey, |
|---|
| 760 | + .setauthsize = omap_aes_gcm_setauthsize, |
|---|
| 787 | 761 | .encrypt = omap_aes_gcm_encrypt, |
|---|
| 788 | 762 | .decrypt = omap_aes_gcm_decrypt, |
|---|
| 789 | 763 | }, |
|---|
| .. | .. |
|---|
| 795 | 769 | .cra_flags = CRYPTO_ALG_ASYNC | |
|---|
| 796 | 770 | CRYPTO_ALG_KERN_DRIVER_ONLY, |
|---|
| 797 | 771 | .cra_blocksize = 1, |
|---|
| 798 | | - .cra_ctxsize = sizeof(struct omap_aes_ctx), |
|---|
| 772 | + .cra_ctxsize = sizeof(struct omap_aes_gcm_ctx), |
|---|
| 799 | 773 | .cra_alignmask = 0xf, |
|---|
| 800 | 774 | .cra_module = THIS_MODULE, |
|---|
| 801 | 775 | }, |
|---|
| 802 | 776 | .init = omap_aes_gcm_cra_init, |
|---|
| 803 | | - .exit = omap_aes_gcm_cra_exit, |
|---|
| 804 | 777 | .maxauthsize = AES_BLOCK_SIZE, |
|---|
| 805 | 778 | .ivsize = GCM_RFC4106_IV_SIZE, |
|---|
| 806 | 779 | .setkey = omap_aes_4106gcm_setkey, |
|---|
| 780 | + .setauthsize = omap_aes_4106gcm_setauthsize, |
|---|
| 807 | 781 | .encrypt = omap_aes_4106gcm_encrypt, |
|---|
| 808 | 782 | .decrypt = omap_aes_4106gcm_decrypt, |
|---|
| 809 | 783 | }, |
|---|
| .. | .. |
|---|
| 1127 | 1101 | { |
|---|
| 1128 | 1102 | struct device *dev = &pdev->dev; |
|---|
| 1129 | 1103 | struct omap_aes_dev *dd; |
|---|
| 1130 | | - struct crypto_alg *algp; |
|---|
| 1104 | + struct skcipher_alg *algp; |
|---|
| 1131 | 1105 | struct aead_alg *aalg; |
|---|
| 1132 | 1106 | struct resource res; |
|---|
| 1133 | 1107 | int err = -ENOMEM, i, j, irq = -1; |
|---|
| .. | .. |
|---|
| 1159 | 1133 | pm_runtime_set_autosuspend_delay(dev, DEFAULT_AUTOSUSPEND_DELAY); |
|---|
| 1160 | 1134 | |
|---|
| 1161 | 1135 | pm_runtime_enable(dev); |
|---|
| 1162 | | - err = pm_runtime_get_sync(dev); |
|---|
| 1136 | + err = pm_runtime_resume_and_get(dev); |
|---|
| 1163 | 1137 | if (err < 0) { |
|---|
| 1164 | 1138 | dev_err(dev, "%s: failed to get_sync(%d)\n", |
|---|
| 1165 | 1139 | __func__, err); |
|---|
| .. | .. |
|---|
| 1186 | 1160 | |
|---|
| 1187 | 1161 | irq = platform_get_irq(pdev, 0); |
|---|
| 1188 | 1162 | if (irq < 0) { |
|---|
| 1189 | | - dev_err(dev, "can't get IRQ resource\n"); |
|---|
| 1190 | 1163 | err = irq; |
|---|
| 1191 | 1164 | goto err_irq; |
|---|
| 1192 | 1165 | } |
|---|
| .. | .. |
|---|
| 1202 | 1175 | spin_lock_init(&dd->lock); |
|---|
| 1203 | 1176 | |
|---|
| 1204 | 1177 | INIT_LIST_HEAD(&dd->list); |
|---|
| 1205 | | - spin_lock(&list_lock); |
|---|
| 1178 | + spin_lock_bh(&list_lock); |
|---|
| 1206 | 1179 | list_add_tail(&dd->list, &dev_list); |
|---|
| 1207 | | - spin_unlock(&list_lock); |
|---|
| 1180 | + spin_unlock_bh(&list_lock); |
|---|
| 1208 | 1181 | |
|---|
| 1209 | 1182 | /* Initialize crypto engine */ |
|---|
| 1210 | 1183 | dd->engine = crypto_engine_alloc_init(dev, 1); |
|---|
| .. | .. |
|---|
| 1222 | 1195 | for (j = 0; j < dd->pdata->algs_info[i].size; j++) { |
|---|
| 1223 | 1196 | algp = &dd->pdata->algs_info[i].algs_list[j]; |
|---|
| 1224 | 1197 | |
|---|
| 1225 | | - pr_debug("reg alg: %s\n", algp->cra_name); |
|---|
| 1226 | | - INIT_LIST_HEAD(&algp->cra_list); |
|---|
| 1198 | + pr_debug("reg alg: %s\n", algp->base.cra_name); |
|---|
| 1227 | 1199 | |
|---|
| 1228 | | - err = crypto_register_alg(algp); |
|---|
| 1200 | + err = crypto_register_skcipher(algp); |
|---|
| 1229 | 1201 | if (err) |
|---|
| 1230 | 1202 | goto err_algs; |
|---|
| 1231 | 1203 | |
|---|
| .. | .. |
|---|
| 1238 | 1210 | !dd->pdata->aead_algs_info->registered) { |
|---|
| 1239 | 1211 | for (i = 0; i < dd->pdata->aead_algs_info->size; i++) { |
|---|
| 1240 | 1212 | aalg = &dd->pdata->aead_algs_info->algs_list[i]; |
|---|
| 1241 | | - algp = &aalg->base; |
|---|
| 1242 | 1213 | |
|---|
| 1243 | | - pr_debug("reg alg: %s\n", algp->cra_name); |
|---|
| 1244 | | - INIT_LIST_HEAD(&algp->cra_list); |
|---|
| 1214 | + pr_debug("reg alg: %s\n", aalg->base.cra_name); |
|---|
| 1245 | 1215 | |
|---|
| 1246 | 1216 | err = crypto_register_aead(aalg); |
|---|
| 1247 | 1217 | if (err) |
|---|
| .. | .. |
|---|
| 1266 | 1236 | err_algs: |
|---|
| 1267 | 1237 | for (i = dd->pdata->algs_info_size - 1; i >= 0; i--) |
|---|
| 1268 | 1238 | for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) |
|---|
| 1269 | | - crypto_unregister_alg( |
|---|
| 1239 | + crypto_unregister_skcipher( |
|---|
| 1270 | 1240 | &dd->pdata->algs_info[i].algs_list[j]); |
|---|
| 1271 | 1241 | |
|---|
| 1272 | 1242 | err_engine: |
|---|
| .. | .. |
|---|
| 1294 | 1264 | if (!dd) |
|---|
| 1295 | 1265 | return -ENODEV; |
|---|
| 1296 | 1266 | |
|---|
| 1297 | | - spin_lock(&list_lock); |
|---|
| 1267 | + spin_lock_bh(&list_lock); |
|---|
| 1298 | 1268 | list_del(&dd->list); |
|---|
| 1299 | | - spin_unlock(&list_lock); |
|---|
| 1269 | + spin_unlock_bh(&list_lock); |
|---|
| 1300 | 1270 | |
|---|
| 1301 | 1271 | for (i = dd->pdata->algs_info_size - 1; i >= 0; i--) |
|---|
| 1302 | | - for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) |
|---|
| 1303 | | - crypto_unregister_alg( |
|---|
| 1272 | + for (j = dd->pdata->algs_info[i].registered - 1; j >= 0; j--) { |
|---|
| 1273 | + crypto_unregister_skcipher( |
|---|
| 1304 | 1274 | &dd->pdata->algs_info[i].algs_list[j]); |
|---|
| 1275 | + dd->pdata->algs_info[i].registered--; |
|---|
| 1276 | + } |
|---|
| 1305 | 1277 | |
|---|
| 1306 | | - for (i = dd->pdata->aead_algs_info->size - 1; i >= 0; i--) { |
|---|
| 1278 | + for (i = dd->pdata->aead_algs_info->registered - 1; i >= 0; i--) { |
|---|
| 1307 | 1279 | aalg = &dd->pdata->aead_algs_info->algs_list[i]; |
|---|
| 1308 | 1280 | crypto_unregister_aead(aalg); |
|---|
| 1281 | + dd->pdata->aead_algs_info->registered--; |
|---|
| 1282 | + |
|---|
| 1309 | 1283 | } |
|---|
| 1310 | 1284 | |
|---|
| 1311 | 1285 | crypto_engine_exit(dd->engine); |
|---|
| .. | .. |
|---|
| 1313 | 1287 | tasklet_kill(&dd->done_task); |
|---|
| 1314 | 1288 | omap_aes_dma_cleanup(dd); |
|---|
| 1315 | 1289 | pm_runtime_disable(dd->dev); |
|---|
| 1316 | | - dd = NULL; |
|---|
| 1290 | + |
|---|
| 1291 | + sysfs_remove_group(&dd->dev->kobj, &omap_aes_attr_group); |
|---|
| 1317 | 1292 | |
|---|
| 1318 | 1293 | return 0; |
|---|
| 1319 | 1294 | } |
|---|