af_alg.c (866c9b94ef968445c52214b3748ecc52a8491bca) af_alg.c (7d2c3f54e6f646887d019faa45f35d6fe9fe82ce)
1/*
2 * af_alg: User-space algorithm interface
3 *
4 * This file provides the user-space API for algorithms.
5 *
6 * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
7 *
8 * This program is free software; you can redistribute it and/or modify it

--- 1007 unchanged lines hidden (view full) ---

1016 af_alg_data_wakeup(sk);
1017 release_sock(sk);
1018
1019 return err ?: size;
1020}
1021EXPORT_SYMBOL_GPL(af_alg_sendpage);
1022
1023/**
1/*
2 * af_alg: User-space algorithm interface
3 *
4 * This file provides the user-space API for algorithms.
5 *
6 * Copyright (c) 2010 Herbert Xu <herbert@gondor.apana.org.au>
7 *
8 * This program is free software; you can redistribute it and/or modify it

--- 1007 unchanged lines hidden (view full) ---

1016 af_alg_data_wakeup(sk);
1017 release_sock(sk);
1018
1019 return err ?: size;
1020}
1021EXPORT_SYMBOL_GPL(af_alg_sendpage);
1022
1023/**
1024 * af_alg_free_resources - release resources required for crypto request
1025 */
1026void af_alg_free_resources(struct af_alg_async_req *areq)
1027{
1028 struct sock *sk = areq->sk;
1029
1030 af_alg_free_areq_sgls(areq);
1031 sock_kfree_s(sk, areq, areq->areqlen);
1032}
1033EXPORT_SYMBOL_GPL(af_alg_free_resources);
1034
1035/**
1024 * af_alg_async_cb - AIO callback handler
1025 *
1026 * This handler cleans up the struct af_alg_async_req upon completion of the
1027 * AIO operation.
1028 *
1029 * The number of bytes to be generated with the AIO operation must be set
1030 * in areq->outlen before the AIO callback handler is invoked.
1031 */
1032void af_alg_async_cb(struct crypto_async_request *_req, int err)
1033{
1034 struct af_alg_async_req *areq = _req->data;
1035 struct sock *sk = areq->sk;
1036 struct kiocb *iocb = areq->iocb;
1037 unsigned int resultlen;
1038
1036 * af_alg_async_cb - AIO callback handler
1037 *
1038 * This handler cleans up the struct af_alg_async_req upon completion of the
1039 * AIO operation.
1040 *
1041 * The number of bytes to be generated with the AIO operation must be set
1042 * in areq->outlen before the AIO callback handler is invoked.
1043 */
1044void af_alg_async_cb(struct crypto_async_request *_req, int err)
1045{
1046 struct af_alg_async_req *areq = _req->data;
1047 struct sock *sk = areq->sk;
1048 struct kiocb *iocb = areq->iocb;
1049 unsigned int resultlen;
1050
1039 lock_sock(sk);
1040
1041 /* Buffer size written by crypto operation. */
1042 resultlen = areq->outlen;
1043
1051 /* Buffer size written by crypto operation. */
1052 resultlen = areq->outlen;
1053
1044 af_alg_free_areq_sgls(areq);
1045 sock_kfree_s(sk, areq, areq->areqlen);
1046 __sock_put(sk);
1054 af_alg_free_resources(areq);
1055 sock_put(sk);
1047
1048 iocb->ki_complete(iocb, err ? err : resultlen, 0);
1056
1057 iocb->ki_complete(iocb, err ? err : resultlen, 0);
1049
1050 release_sock(sk);
1051}
1052EXPORT_SYMBOL_GPL(af_alg_async_cb);
1053
1054/**
1055 * af_alg_poll - poll system call handler
1056 */
1057unsigned int af_alg_poll(struct file *file, struct socket *sock,
1058 poll_table *wait)

--- 144 unchanged lines hidden ---
1058}
1059EXPORT_SYMBOL_GPL(af_alg_async_cb);
1060
1061/**
1062 * af_alg_poll - poll system call handler
1063 */
1064unsigned int af_alg_poll(struct file *file, struct socket *sock,
1065 poll_table *wait)

--- 144 unchanged lines hidden ---