------- Comment From <email address hidden> 2018-11-26 03:00 EDT-------
I checked the libcryptsetup code further:
crypt_init() just initializes the context, and sets the type inside the context to NULL.
A subsequent crypt_get_type() will therefore return NULL in any case.
The type field of the context is only set during crypt_load() or during crypt_format(). Thus it does not make much sense to call crypt_get_type() before crypt_load() or crypt_format().
So your patch is essentially the same as mine. Both pass NULL to crypt_load() as type, resulting in LUKS 1 or 2. Yours is just somewhat more obfuscating? :-)
------- Comment From <email address hidden> 2018-11-26 03:00 EDT-------
I checked the libcryptsetup code further:
crypt_init() just initializes the context, and sets the type inside the context to NULL.
A subsequent crypt_get_type() will therefore return NULL in any case.
The type field of the context is only set during crypt_load() or during crypt_format(). Thus it does not make much sense to call crypt_get_type() before crypt_load() or crypt_format().
So your patch is essentially the same as mine. Both pass NULL to crypt_load() as type, resulting in LUKS 1 or 2. Yours is just somewhat more obfuscating? :-)