Skip to content

Commit

Permalink
changes for using openssl 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Bailey Brown committed Aug 13, 2023
1 parent 4d4eef3 commit 5d6ee51
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ To start an elevated command prompt in Windows 10, click on the search (magnifyi
Whether or not you are using git, everything will go easier if you put everything in c:\git.

Getting OpenSSL from github will get you the latest development version of OpenSSL. However, the cppcryptfs releases are built using the
current 1.1.1x Long Term Support (LTS) version of OpenSSL (currently openssl-1.1.1n). These are available from https://www.openssl.org/source/. To use those, you will need to download
current 3.0.x Long Term Support (LTS) version of OpenSSL (currently openssl-3.0.10). These are available from https://www.openssl.org/source/. To use those, you will need to download
the .tar.gz and extract it into a directory. You can build it with the same instructions that follow regardless of how you get OpenSSL.

Microsoft has announced a compiler-based mitigation for one variant of the Spectre vulnerability. To use it, you need to have version 15.5 or higher of Visual Studio. To use the mitigation with OpenSSL, you need to add the /Qspectre flag to the compiler optimization flags. OpenSSL currently does not use this flag. Also, to be extra safe, add the /guard:cf (Control Flow Guard) flag. To use these, you need to edit c:\\git\openssl\\Configurations\\10-main.conf and change "/O2" to "/O2 /Qspectre /guard:cf".
Expand Down
Binary file modified cppcryptfs/cppcryptfs.rc
Binary file not shown.
8 changes: 4 additions & 4 deletions cppcryptfsctl/cppcryptfsctl.rc
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@ END
//

VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,4,4,1
PRODUCTVERSION 1,4,4,1
FILEVERSION 1,4,4,2
PRODUCTVERSION 1,4,4,2
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Expand All @@ -69,12 +69,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "Bailey Brown"
VALUE "FileDescription", "cppcryptfsctl"
VALUE "FileVersion", "1.4.4.1"
VALUE "FileVersion", "1.4.4.2"
VALUE "InternalName", "cppcryptfsctl.exe"
VALUE "LegalCopyright", "Copyright (C) 2020-2023 Bailey Brown. All rights reserved."
VALUE "OriginalFilename", "cppcryptfsctl.exe"
VALUE "ProductName", "cppcryptfsctl"
VALUE "ProductVersion", "1.4.4.1"
VALUE "ProductVersion", "1.4.4.2"
END
END
BLOCK "VarFileInfo"
Expand Down
12 changes: 12 additions & 0 deletions libcppcryptfs/crypt/aes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ void AES::initialize_keys(const unsigned char *key, int keylen /* in bits */,
} else
#endif
{
// low-level AES functions are deprecated in Openssl 3.0
#pragma warning( push )
#pragma warning(disable : 4996)
AES_set_encrypt_key(key, keylen, encrypt_key);
AES_set_decrypt_key(key, keylen, decrypt_key);
#pragma warning( pop )
}
}

Expand Down Expand Up @@ -105,7 +109,11 @@ void AES::encrypt(const unsigned char* plain, unsigned char *cipher) const
} else
#endif
{
// low-level AES functions are deprecated in Openssl 3.0
#pragma warning( push )
#pragma warning(disable : 4996)
AES_encrypt(plain, cipher, m_key_encrypt);
#pragma warning( pop )
}
}

Expand All @@ -118,7 +126,11 @@ void AES::decrypt(const unsigned char *cipher, unsigned char *plain) const
} else
#endif
{
// low-level AES functions are deprecated in Openssl 3.0
#pragma warning( push )
#pragma warning(disable : 4996)
AES_decrypt(cipher, plain, m_key_decrypt);
#pragma warning( pop )
}
}

2 changes: 1 addition & 1 deletion libcppcryptfs/crypt/crypt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ bool hkdfDerive(const BYTE *masterKey, int masterKeyLen, BYTE *newKey, int newKe
#endif
if (EVP_PKEY_CTX_set1_hkdf_key(pctx, masterKey, masterKeyLen) <= 0)
throw(-1);
if (EVP_PKEY_CTX_add1_hkdf_info(pctx, info, (int)strlen(info)) <= 0)
if (EVP_PKEY_CTX_add1_hkdf_info(pctx, reinterpret_cast<const unsigned char *>(info), (int)strlen(info)) <= 0)
throw(-1);
if (EVP_PKEY_derive(pctx, newKey, &outLen) <= 0)
throw(-1);
Expand Down

0 comments on commit 5d6ee51

Please sign in to comment.