Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| eab41809a0 |
@@ -46,14 +46,12 @@ _internals_:
|
||||
For utils:
|
||||
|
||||
* libcurl
|
||||
* openssl
|
||||
* OpenSSL
|
||||
* libzip
|
||||
* libpugixml
|
||||
|
||||
|
||||
External & utils dependencies has to be installed by your package manager (_apt_ for example).
|
||||
Use _-dev_ flavours to get needed headers.
|
||||
Internal libraries are automatically fetched and statically compiled during the first compilation.
|
||||
Internal libraries are automatically fetched and statically compiled during the first run.
|
||||
When you update libgourou's repository, **don't forget to update internal libraries** with:
|
||||
|
||||
make update_lib
|
||||
@@ -126,12 +124,6 @@ To return a loaned book:
|
||||
You can get utils full options description with -h or --help switch
|
||||
|
||||
|
||||
Binary packages
|
||||
---------------
|
||||
|
||||
Compiled version (and AppImage) of libgourou and utils are available in [Release page](https://forge.soutade.fr/soutade/libgourou/releases)
|
||||
|
||||
|
||||
Docker
|
||||
------
|
||||
|
||||
@@ -172,4 +164,3 @@ Donators
|
||||
* _Berwyn H_
|
||||
* _bwitt_
|
||||
* _Ismail_
|
||||
* _Radon_
|
||||
|
||||
+1
-1
@@ -37,7 +37,7 @@
|
||||
#define ACS_SERVER "http://adeactivate.adobe.com/adept"
|
||||
#endif
|
||||
|
||||
#define LIBGOUROU_VERSION "0.8.7"
|
||||
#define LIBGOUROU_VERSION "0.8.6"
|
||||
|
||||
namespace gourou
|
||||
{
|
||||
|
||||
+10
-1
@@ -2,8 +2,17 @@
|
||||
|
||||
# uPDFParser
|
||||
if [ ! -d lib/updfparser ] ; then
|
||||
git clone https://forge.soutade.fr/soutade/uPDFParser.git lib/updfparser
|
||||
git clone git://soutade.fr/updfparser.git lib/updfparser
|
||||
pushd lib/updfparser
|
||||
make BUILD_STATIC=1 BUILD_SHARED=0
|
||||
popd
|
||||
fi
|
||||
|
||||
# OpenSSL legacy
|
||||
if [ ! -d lib/openssl ] ; then
|
||||
git clone --branch openssl-3.3 https://github.com/openssl/openssl.git lib/openssl
|
||||
pushd lib/openssl
|
||||
./Configure disable-apps disable-shared enable-legacy
|
||||
make -j4
|
||||
popd
|
||||
fi
|
||||
|
||||
+7
-14
@@ -859,21 +859,14 @@ namespace gourou
|
||||
std::string DRMProcessor::getDefaultAdeptDir(void)
|
||||
{
|
||||
#ifndef DEFAULT_ADEPT_DIR
|
||||
const char* home = getenv("HOME");
|
||||
|
||||
if (home)
|
||||
return home + std::string("/.config/adept/");
|
||||
else
|
||||
{
|
||||
const char* user = getenv("USER");
|
||||
const char* user = getenv("USER");
|
||||
|
||||
if (user && user[0])
|
||||
{
|
||||
return std::string("/home/") + user + std::string("/.config/adept/");
|
||||
}
|
||||
else
|
||||
return LOCAL_ADEPT_DIR;
|
||||
}
|
||||
if (user && user[0])
|
||||
{
|
||||
return std::string("/home/") + user + std::string("/.config/adept/");
|
||||
}
|
||||
else
|
||||
return LOCAL_ADEPT_DIR;
|
||||
#else
|
||||
return DEFAULT_ADEPT_DIR "/";
|
||||
#endif
|
||||
|
||||
@@ -10,6 +10,7 @@ CXXFLAGS=-Wall -fPIC -I$(ROOT)/include
|
||||
|
||||
STATIC_DEP=
|
||||
LDFLAGS += -L$(ROOT) -lcrypto -lzip -lz -lcurl -lpugixml
|
||||
LDFLAGS += -L$(ROOT) $(ROOT)/lib/openssl/libcrypto.a -lzip -lz -lcurl -lpugixml
|
||||
|
||||
ifneq ($(STATIC_UTILS),)
|
||||
STATIC_DEP = $(ROOT)/libgourou.a
|
||||
|
||||
@@ -68,13 +68,7 @@ DRMProcessorClientImpl::DRMProcessorClientImpl():
|
||||
strcpy(cookiejar, "/tmp/libgourou_cookie_jar_XXXXXX");
|
||||
#endif
|
||||
|
||||
int fd = mkstemp(cookiejar);
|
||||
if (fd >= 0)
|
||||
close(fd);
|
||||
else
|
||||
{
|
||||
EXCEPTION(gourou::CLIENT_FILE_ERROR, "mkstemp error");
|
||||
}
|
||||
mkstemp(cookiejar);
|
||||
}
|
||||
|
||||
DRMProcessorClientImpl::~DRMProcessorClientImpl()
|
||||
@@ -339,33 +333,11 @@ void DRMProcessorClientImpl::padWithPKCS1(unsigned char* out, unsigned int outLe
|
||||
0x00 0x01 0xff * n 0x00 dataIn
|
||||
*/
|
||||
|
||||
memset(out, 0xFF, outLength - inLength - 1);
|
||||
memset(out, 0xFF, outLength);
|
||||
|
||||
out[0] = 0x0;
|
||||
out[1] = 0x1;
|
||||
out[outLength - inLength - 1] = 0x00;
|
||||
|
||||
memcpy(&out[outLength - inLength], in, inLength);
|
||||
}
|
||||
|
||||
void DRMProcessorClientImpl::padWithPKCS1Type2(unsigned char* out, unsigned int outLength,
|
||||
const unsigned char* in, unsigned int inLength)
|
||||
{
|
||||
if (outLength < (inLength + 3))
|
||||
EXCEPTION(gourou::CLIENT_RSA_ERROR, "Not enough space for PKCS1 padding");
|
||||
|
||||
/*
|
||||
PKCS1v5 type 2 Padding is :
|
||||
0x00 0x02 0xXX * n 0x00 dataIn
|
||||
XX is random non zero data
|
||||
*/
|
||||
|
||||
RAND_bytes(&out[2], outLength - inLength - 1);
|
||||
|
||||
out[0] = 0x0;
|
||||
out[1] = 0x2;
|
||||
out[outLength - inLength - 1] = 0x00;
|
||||
|
||||
memcpy(&out[outLength - inLength], in, inLength);
|
||||
}
|
||||
|
||||
@@ -457,45 +429,33 @@ void DRMProcessorClientImpl::RSAPublicEncrypt(const unsigned char* RSAKey, unsig
|
||||
unsigned char* res)
|
||||
{
|
||||
size_t outlen;
|
||||
unsigned char* tmp;
|
||||
|
||||
|
||||
X509 * x509 = d2i_X509(0, &RSAKey, RSAKeyLength);
|
||||
if (!x509)
|
||||
EXCEPTION(gourou::CLIENT_INVALID_CERTIFICATE, "Invalid certificate");
|
||||
|
||||
EVP_PKEY_CTX *ctx;
|
||||
EVP_PKEY * pkey = X509_get_pubkey(x509);
|
||||
EVP_PKEY * evpKey = X509_get_pubkey(x509);
|
||||
|
||||
if (!pkey)
|
||||
if (!evpKey)
|
||||
EXCEPTION(gourou::CLIENT_NO_PUB_KEY, "No public key in certificate");
|
||||
|
||||
ctx = EVP_PKEY_CTX_new(pkey, NULL);
|
||||
ctx = EVP_PKEY_CTX_new(evpKey, NULL);
|
||||
|
||||
if (EVP_PKEY_encrypt_init(ctx) <= 0)
|
||||
EXCEPTION(gourou::CLIENT_RSA_ERROR, ERR_error_string(ERR_get_error(), NULL));
|
||||
|
||||
if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_NO_PADDING) <= 0)
|
||||
EXCEPTION(gourou::CLIENT_RSA_ERROR, ERR_error_string(ERR_get_error(), NULL));
|
||||
if (EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING) <= 0)
|
||||
EXCEPTION(gourou::CLIENT_RSA_ERROR, ERR_error_string(ERR_get_error(), NULL));
|
||||
|
||||
outlen = EVP_PKEY_get_size(pkey);
|
||||
|
||||
tmp = (unsigned char*)malloc(outlen);
|
||||
|
||||
/*
|
||||
PKCS1 functions are no more exported.
|
||||
Some OpenSSL libraries still use type 1
|
||||
*/
|
||||
padWithPKCS1Type2(tmp, outlen, data, dataLength);
|
||||
|
||||
int ret = EVP_PKEY_encrypt(ctx, res, &outlen, tmp, outlen);
|
||||
int ret = EVP_PKEY_encrypt(ctx, res, &outlen, data, dataLength);
|
||||
|
||||
EVP_PKEY_CTX_free(ctx);
|
||||
free(tmp);
|
||||
|
||||
EVP_PKEY_free(pkey);
|
||||
|
||||
if (ret < 0)
|
||||
EXCEPTION(gourou::CLIENT_RSA_ERROR, ERR_error_string(ERR_get_error(), NULL));
|
||||
|
||||
EVP_PKEY_free(evpKey);
|
||||
}
|
||||
|
||||
void* DRMProcessorClientImpl::generateRSAKey(int keyLengthBits)
|
||||
@@ -509,6 +469,7 @@ void* DRMProcessorClientImpl::generateRSAKey(int keyLengthBits)
|
||||
EVP_PKEY_keygen_init(ctx);
|
||||
|
||||
EVP_PKEY_CTX_set_rsa_keygen_bits(ctx, keyLengthBits);
|
||||
EVP_PKEY_CTX_set_rsa_padding(ctx, RSA_PKCS1_PADDING);
|
||||
EVP_PKEY_CTX_set1_rsa_keygen_pubexp(ctx, bn);
|
||||
EVP_PKEY_keygen(ctx, &key);
|
||||
|
||||
|
||||
@@ -130,8 +130,6 @@ private:
|
||||
|
||||
void padWithPKCS1(unsigned char* out, unsigned int outLength,
|
||||
const unsigned char* in, unsigned int inLength);
|
||||
void padWithPKCS1Type2(unsigned char* out, unsigned int outLength,
|
||||
const unsigned char* in, unsigned int inLength);
|
||||
|
||||
#if OPENSSL_VERSION_MAJOR >= 3
|
||||
OSSL_PROVIDER *legacy, *deflt;
|
||||
|
||||
Reference in New Issue
Block a user