Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yapet-2.6 does not accept (correctly typed) password with openssl-3.2.0 #24

Open
ursjoss opened this issue Dec 20, 2023 · 5 comments
Open

Comments

@ursjoss
Copy link

ursjoss commented Dec 20, 2023

On Archlinux, yapet-2.6 worked like a charm until the system was updated from openssl-3.1.4-1-x86_64 to openssl-3.2.0-1-x86_64.

Since the upgrade, when starting yapet, the login screen appears, I can seemingly enter the password, but it is declined.

After downgrading to openssl-3.1.4, the password is accepted.

Not sure if this is of any importance - the NEWS.md in the openssl project reports significant/incompatible changes:

  • The default SSL/TLS security level has been changed from 1 to 2.
  • The x509, ca, and req apps now always produce X.509v3 certificates.
  • Subject or issuer names in X.509 objects are now displayed as UTF-8 strings by default.
@lucatrv
Copy link

lucatrv commented Dec 22, 2023

Same here...

@lucatrv
Copy link

lucatrv commented Jan 7, 2024

This is an advice for everyone who, like myself, has all his passwords locked due to this issue. Once you have temporarily reinstalled OpenSSL 3.1, you can convert your password pet file into a csv file using the yapet2csv tool, see yapet2csv -h for help.

@ursjoss
Copy link
Author

ursjoss commented Jan 7, 2024

My way of working around the issue on archlinux is the following:

sudo pacman -U /var/cache/pacman/pkg/openssl-3.1.4-1-x86_64.pkg.tar.zst && yapet && sudo pacman -Syu

If you don't have the package anymore in your local pacman cache, you can download it from here: https://archive.archlinux.org/packages/o/openssl/

@ursjoss
Copy link
Author

ursjoss commented Jan 13, 2024

I was digging a bit. My yapet file was still a yapet 10 file, The issue occurred here:

return std::shared_ptr<AbstractCryptoFactory>{

However, I noticed that yapet had no problem encrypting and decrypting a new file (which subsequently was created as yapet 20 file).

Hence, my permanent workaround was to install openssl-3.1.4 (as described in the previous comment), use yapet2csv to export my passwords to csv, bump openssl to 3.2.0 and create a new yapet file from csv using csv2yapet. This resolves it for me.

Not sure if this workaround is a general good strategy. If yapet was my project, I might even consider instructing users to use yapet2csv/csv2yapet to migrate their password files and subsequently dropping the yapet 10 suport entirely (thus simplifying the code).

@lucatrv
Copy link

lucatrv commented Jan 13, 2024

Not sure if this workaround is a general good strategy. If yapet was my project, I might even consider instructing users to use yapet2csv/csv2yapet to migrate their password files and subsequently dropping the yapet 10 suport entirely (thus simplifying the code).

I completely agree, yapet 10 format should be deprecated, documenting the command to upgrade to yapet 20 format:

yapet2csv passwords_old.pet passwords_tmp.csv
csv2yapet passwords_tmp.csv passwords_new.pet
rm passwords_tmp.csv

It would also be very useful to add stdout / stdin support to the yapet2csv / csv2yapet tools, which would allow for instance to write:

yapet2csv -stdout passwords_old.pet | csv2yapet -stdin passwords_new.pet

sebastianas added a commit to sebastianas/yapet that referenced this issue Apr 8, 2024
yapet did for blowfish:

|     EVP_CipherInit_ex(ctx, cipher, NULL, KEY, iv, mode);
|     EVP_CIPHER_CTX_set_key_length(ctx, KEY_LENGTH);
|     EVP_CipherUpdate(ctx, …);

this worked in earlier OpenSSL versions and stopped working in
openssl-3.0.13. The problem here is that the
EVP_CIPHER_CTX_set_key_length() is ignored and the later OpenSSL version
returns rightfully an error "Provider routines::no key set" here.

Blowfish does support variable key lenghts but the key length has to be
set first followed by the actual key. Otherwise the blocksize (16) will
be used.
The correct way to deal with this would be:
|     EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, mode);
|     EVP_CIPHER_CTX_set_key_length(ctx, KEY_LENGTH);
|     EVP_CipherInit_ex(ctx, NULL, NULL, KEY, IV, mode);
|     EVP_CipherUpdate(ctx, …);

Using now the proper way will break earlier databases because in the
blowfish case, always the default blocksize / 16 has been used.

In order to keep compatibility with earlier versions of the database and
openssl remove the EVP_CIPHER_CTX_set_key_length() invocation.

Fixes RafaelOstertag#26
Fixes RafaelOstertag#24

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
sebastianas added a commit to sebastianas/yapet that referenced this issue Apr 8, 2024
yapet did for blowfish:

|     EVP_CipherInit_ex(ctx, cipher, NULL, KEY, iv, mode);
|     EVP_CIPHER_CTX_set_key_length(ctx, KEY_LENGTH);
|     EVP_CipherUpdate(ctx, …);

this worked in earlier OpenSSL versions and stopped working in
openssl-3.0.13. The problem here is that the
EVP_CIPHER_CTX_set_key_length() is ignored and the later OpenSSL version
returns rightfully an error "Provider routines::no key set" here.

Blowfish does support variable key lenghts but the key length has to be
set first followed by the actual key. Otherwise the blocksize (16) will
be used.
The correct way to deal with this would be:
|     EVP_CipherInit_ex(ctx, cipher, NULL, NULL, NULL, mode);
|     EVP_CIPHER_CTX_set_key_length(ctx, KEY_LENGTH);
|     EVP_CipherInit_ex(ctx, NULL, NULL, KEY, IV, mode);
|     EVP_CipherUpdate(ctx, …);

Using now the proper way will break earlier databases because in the
blowfish case, always the default blocksize / 16 has been used.

In order to keep compatibility with earlier versions of the database and
openssl remove the EVP_CIPHER_CTX_set_key_length() invocation.

Fixes RafaelOstertag#26
Fixes RafaelOstertag#24

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants