| .. | .. |
|---|
| 31 | 31 | |
|---|
| 32 | 32 | :: |
|---|
| 33 | 33 | |
|---|
| 34 | | - int crypto_unregister_alg(struct crypto_alg *alg); |
|---|
| 35 | | - int crypto_unregister_algs(struct crypto_alg *algs, int count); |
|---|
| 34 | + void crypto_unregister_alg(struct crypto_alg *alg); |
|---|
| 35 | + void crypto_unregister_algs(struct crypto_alg *algs, int count); |
|---|
| 36 | 36 | |
|---|
| 37 | 37 | |
|---|
| 38 | | -Notice that both registration and unregistration functions do return a |
|---|
| 39 | | -value, so make sure to handle errors. A return code of zero implies |
|---|
| 40 | | -success. Any return code < 0 implies an error. |
|---|
| 38 | +The registration functions return 0 on success, or a negative errno |
|---|
| 39 | +value on failure. crypto_register_algs() succeeds only if it |
|---|
| 40 | +successfully registered all the given algorithms; if it fails partway |
|---|
| 41 | +through, then any changes are rolled back. |
|---|
| 41 | 42 | |
|---|
| 42 | | -The bulk registration/unregistration functions register/unregister each |
|---|
| 43 | | -transformation in the given array of length count. They handle errors as |
|---|
| 44 | | -follows: |
|---|
| 45 | | - |
|---|
| 46 | | -- crypto_register_algs() succeeds if and only if it successfully |
|---|
| 47 | | - registers all the given transformations. If an error occurs partway |
|---|
| 48 | | - through, then it rolls back successful registrations before returning |
|---|
| 49 | | - the error code. Note that if a driver needs to handle registration |
|---|
| 50 | | - errors for individual transformations, then it will need to use the |
|---|
| 51 | | - non-bulk function crypto_register_alg() instead. |
|---|
| 52 | | - |
|---|
| 53 | | -- crypto_unregister_algs() tries to unregister all the given |
|---|
| 54 | | - transformations, continuing on error. It logs errors and always |
|---|
| 55 | | - returns zero. |
|---|
| 43 | +The unregistration functions always succeed, so they don't have a |
|---|
| 44 | +return value. Don't try to unregister algorithms that aren't |
|---|
| 45 | +currently registered. |
|---|
| 56 | 46 | |
|---|
| 57 | 47 | Single-Block Symmetric Ciphers [CIPHER] |
|---|
| 58 | 48 | --------------------------------------- |
|---|
| 59 | 49 | |
|---|
| 60 | | -Example of transformations: aes, arc4, ... |
|---|
| 50 | +Example of transformations: aes, serpent, ... |
|---|
| 61 | 51 | |
|---|
| 62 | 52 | This section describes the simplest of all transformation |
|---|
| 63 | 53 | implementations, that being the CIPHER type used for symmetric ciphers. |
|---|
| .. | .. |
|---|
| 108 | 98 | Multi-Block Ciphers |
|---|
| 109 | 99 | ------------------- |
|---|
| 110 | 100 | |
|---|
| 111 | | -Example of transformations: cbc(aes), ecb(arc4), ... |
|---|
| 101 | +Example of transformations: cbc(aes), chacha20, ... |
|---|
| 112 | 102 | |
|---|
| 113 | 103 | This section describes the multi-block cipher transformation |
|---|
| 114 | 104 | implementations. The multi-block ciphers are used for transformations |
|---|
| .. | .. |
|---|
| 128 | 118 | overhead as the kernel crypto API needs to perform the realignment of |
|---|
| 129 | 119 | the data which may imply moving of data. |
|---|
| 130 | 120 | |
|---|
| 131 | | -Cipher Definition With struct blkcipher_alg and ablkcipher_alg |
|---|
| 132 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 121 | +Cipher Definition With struct skcipher_alg |
|---|
| 122 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 133 | 123 | |
|---|
| 134 | | -Struct blkcipher_alg defines a synchronous block cipher whereas struct |
|---|
| 135 | | -ablkcipher_alg defines an asynchronous block cipher. |
|---|
| 124 | +Struct skcipher_alg defines a multi-block cipher, or more generally, a |
|---|
| 125 | +length-preserving symmetric cipher algorithm. |
|---|
| 136 | 126 | |
|---|
| 137 | | -Please refer to the single block cipher description for schematics of |
|---|
| 138 | | -the block cipher usage. |
|---|
| 127 | +Scatterlist handling |
|---|
| 128 | +~~~~~~~~~~~~~~~~~~~~ |
|---|
| 139 | 129 | |
|---|
| 140 | | -Specifics Of Asynchronous Multi-Block Cipher |
|---|
| 141 | | -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
|---|
| 142 | | - |
|---|
| 143 | | -There are a couple of specifics to the asynchronous interface. |
|---|
| 144 | | - |
|---|
| 145 | | -First of all, some of the drivers will want to use the Generic |
|---|
| 146 | | -ScatterWalk in case the hardware needs to be fed separate chunks of the |
|---|
| 147 | | -scatterlist which contains the plaintext and will contain the |
|---|
| 148 | | -ciphertext. Please refer to the ScatterWalk interface offered by the |
|---|
| 149 | | -Linux kernel scatter / gather list implementation. |
|---|
| 130 | +Some drivers will want to use the Generic ScatterWalk in case the |
|---|
| 131 | +hardware needs to be fed separate chunks of the scatterlist which |
|---|
| 132 | +contains the plaintext and will contain the ciphertext. Please refer |
|---|
| 133 | +to the ScatterWalk interface offered by the Linux kernel scatter / |
|---|
| 134 | +gather list implementation. |
|---|
| 150 | 135 | |
|---|
| 151 | 136 | Hashing [HASH] |
|---|
| 152 | 137 | -------------- |
|---|
| .. | .. |
|---|
| 174 | 159 | |
|---|
| 175 | 160 | :: |
|---|
| 176 | 161 | |
|---|
| 177 | | - int crypto_unregister_ahash(struct ahash_alg *alg); |
|---|
| 162 | + void crypto_unregister_ahash(struct ahash_alg *alg); |
|---|
| 178 | 163 | |
|---|
| 179 | | - int crypto_unregister_shash(struct shash_alg *alg); |
|---|
| 180 | | - int crypto_unregister_shashes(struct shash_alg *algs, int count); |
|---|
| 164 | + void crypto_unregister_shash(struct shash_alg *alg); |
|---|
| 165 | + void crypto_unregister_shashes(struct shash_alg *algs, int count); |
|---|
| 181 | 166 | |
|---|
| 182 | 167 | |
|---|
| 183 | 168 | Cipher Definition With struct shash_alg and ahash_alg |
|---|