mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-11 19:00:02 +01:00
Fix token assignement API.
There was a bug in both crypt_token_assign_keyslot and crypt_token_unsassign_keyslot where CRYPT_ANY_TOKEN special value could be passed in token parameter. It would correctly assign/unassign all tokens to/from the specified keyslot (or from any in case of CRYPT_ANY_SLOT), but it returned -1 (CRYPT_ANY_TOKEN) which fited error return values as per API documentation. We fixed that by not supporting CRYPT_ANY_TOKEN since it does not make much sense. It can be workarounded by iterating over all available tokens and calling crypt_token_assign_keyslot or crypt_token_unassign_keyslot accodingly. Fixes: #914.
This commit is contained in:
@@ -2601,11 +2601,11 @@ int crypt_token_luks2_keyring_get(struct crypt_device *cd,
|
||||
* (There can be more keyslots assigned to one token id.)
|
||||
*
|
||||
* @param cd crypt device handle
|
||||
* @param token token id
|
||||
* @param token specific token id
|
||||
* @param keyslot keyslot to be assigned to token (CRYPT_ANY SLOT
|
||||
* assigns all active keyslots to token)
|
||||
*
|
||||
* @return allocated token id or negative errno otherwise.
|
||||
* @return requested token id to be assigned or negative errno otherwise.
|
||||
*/
|
||||
int crypt_token_assign_keyslot(struct crypt_device *cd,
|
||||
int token,
|
||||
@@ -2616,11 +2616,11 @@ int crypt_token_assign_keyslot(struct crypt_device *cd,
|
||||
* (There can be more keyslots assigned to one token id.)
|
||||
*
|
||||
* @param cd crypt device handle
|
||||
* @param token token id
|
||||
* @param token specific token id
|
||||
* @param keyslot keyslot to be unassigned from token (CRYPT_ANY SLOT
|
||||
* unassigns all active keyslots from token)
|
||||
*
|
||||
* @return allocated token id or negative errno otherwise.
|
||||
* @return requested token id to be unassigned or negative errno otherwise.
|
||||
*/
|
||||
int crypt_token_unassign_keyslot(struct crypt_device *cd,
|
||||
int token,
|
||||
|
||||
Reference in New Issue
Block a user