Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpenBoard
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lifo
Nicolas Ollinger
OpenBoard
Commits
0d6f19c0
Commit
0d6f19c0
authored
Feb 06, 2019
by
Clément Fauconnier
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' into dev-18.04
parents
43977465
3506afa3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
57 additions
and
17 deletions
+57
-17
UBBoardController.cpp
src/board/UBBoardController.cpp
+16
-16
UBDownloadManager.cpp
src/core/UBDownloadManager.cpp
+1
-1
UBCryptoUtils.cpp
src/frameworks/UBCryptoUtils.cpp
+35
-0
UBCryptoUtils.h
src/frameworks/UBCryptoUtils.h
+5
-0
No files found.
src/board/UBBoardController.cpp
View file @
0d6f19c0
...
...
@@ -741,7 +741,7 @@ UBGraphicsItem *UBBoardController::duplicateItem(UBItem *item)
return
retItem
;
}
UBItem
*
createdItem
=
downloadFinished
(
true
,
sourceUrl
,
srcFile
,
contentTypeHeader
,
pData
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
);
UBItem
*
createdItem
=
downloadFinished
(
true
,
sourceUrl
,
QUrl
::
fromLocalFile
(
srcFile
)
,
contentTypeHeader
,
pData
,
itemPos
,
QSize
(
itemSize
.
width
(),
itemSize
.
height
()),
false
);
if
(
createdItem
)
{
createdItem
->
setSourceUrl
(
item
->
sourceUrl
());
...
...
@@ -1375,11 +1375,8 @@ UBItem *UBBoardController::downloadFinished(bool pSuccess, QUrl sourceUrl, QUrl
widgetItem
->
setSourceUrl
(
QUrl
::
fromLocalFile
(
widgetUrl
));
qDebug
()
<<
widgetItem
->
getOwnFolder
();
qDebug
()
<<
widgetItem
->
getSnapshotPath
();
QString
ownFolder
=
selectedDocument
()
->
persistencePath
()
+
"/"
+
UBPersistenceManager
::
widgetDirectory
+
"/"
+
widgetItem
->
uuid
().
toString
()
+
".wgt"
;
widgetItem
->
setOwnFolder
(
ownFolder
);
QString
adaptedUUid
=
widgetItem
->
uuid
().
toString
().
replace
(
"{"
,
""
).
replace
(
"}"
,
""
);
ownFolder
=
ownFolder
.
replace
(
widgetItem
->
uuid
().
toString
()
+
".wgt"
,
adaptedUUid
+
".png"
);
widgetItem
->
setSnapshotPath
(
ownFolder
);
widgetItem
->
setSnapshotPath
(
widgetItem
->
getOwnFolder
());
UBDrawingController
::
drawingController
()
->
setStylusTool
(
UBStylusTool
::
Selector
);
...
...
@@ -2500,22 +2497,25 @@ void UBBoardController::togglePodcast(bool checked)
void
UBBoardController
::
moveGraphicsWidgetToControlView
(
UBGraphicsWidgetItem
*
graphicsWidget
)
{
mActiveScene
->
setURStackEnable
(
false
);
UBGraphicsItem
*
toolW3C
=
duplicateItem
(
dynamic_cast
<
UBItem
*>
(
graphicsWidget
));
UBGraphicsItem
*
toolW3C
=
duplicateItem
(
dynamic_cast
<
UBItem
*>
(
graphicsWidget
));
UBGraphicsWidgetItem
*
copyedGraphicsWidget
=
NULL
;
if
(
UBGraphicsWidgetItem
::
Type
==
toolW3C
->
type
())
copyedGraphicsWidget
=
static_cast
<
UBGraphicsWidgetItem
*>
(
toolW3C
);
if
(
toolW3C
)
{
if
(
UBGraphicsWidgetItem
::
Type
==
toolW3C
->
type
())
copyedGraphicsWidget
=
static_cast
<
UBGraphicsWidgetItem
*>
(
toolW3C
);
UBToolWidget
*
toolWidget
=
new
UBToolWidget
(
copyedGraphicsWidget
,
mControlView
);
UBToolWidget
*
toolWidget
=
new
UBToolWidget
(
copyedGraphicsWidget
,
mControlView
);
graphicsWidget
->
remove
(
false
);
mActiveScene
->
addItemToDeletion
(
graphicsWidget
);
graphicsWidget
->
remove
(
false
);
mActiveScene
->
addItemToDeletion
(
graphicsWidget
);
mActiveScene
->
setURStackEnable
(
true
);
mActiveScene
->
setURStackEnable
(
true
);
QPoint
controlViewPos
=
mControlView
->
mapFromScene
(
graphicsWidget
->
sceneBoundingRect
().
center
());
toolWidget
->
centerOn
(
mControlView
->
mapTo
(
mControlContainer
,
controlViewPos
));
toolWidget
->
show
();
QPoint
controlViewPos
=
mControlView
->
mapFromScene
(
graphicsWidget
->
sceneBoundingRect
().
center
());
toolWidget
->
centerOn
(
mControlView
->
mapTo
(
mControlContainer
,
controlViewPos
));
toolWidget
->
show
();
}
}
...
...
src/core/UBDownloadManager.cpp
View file @
0d6f19c0
...
...
@@ -93,7 +93,7 @@ void UBAsyncLocalFileDownloader::run()
QFile
::
remove
(
mTo
);
}
else
emit
signal_asyncCopyFinished
(
mDesc
.
id
,
!
mTo
.
isEmpty
(),
QUrl
::
fromLocalFile
(
mTo
),
QUrl
(
mDesc
.
originalSrcUrl
),
""
,
NULL
,
mDesc
.
pos
,
mDesc
.
size
,
mDesc
.
isBackground
);
emit
signal_asyncCopyFinished
(
mDesc
.
id
,
!
mTo
.
isEmpty
(),
QUrl
::
fromLocalFile
(
mTo
),
QUrl
::
fromLocalFile
(
mDesc
.
originalSrcUrl
),
""
,
NULL
,
mDesc
.
pos
,
mDesc
.
size
,
mDesc
.
isBackground
);
}
void
UBAsyncLocalFileDownloader
::
abort
()
...
...
src/frameworks/UBCryptoUtils.cpp
View file @
0d6f19c0
...
...
@@ -63,6 +63,10 @@ UBCryptoUtils::UBCryptoUtils(QObject * pParent)
UBCryptoUtils
::~
UBCryptoUtils
()
{
// TODO UB 4.x aes destroy
#if OPENSSL_VERSION_NUMBER >= 10100000L
EVP_CIPHER_CTX_free
(
mAesEncryptContext
);
EVP_CIPHER_CTX_free
(
mAesDecryptContext
);
#endif
}
...
...
@@ -74,18 +78,30 @@ QString UBCryptoUtils::symetricEncrypt(const QString& clear)
int
paddingLength
=
0
;
unsigned
char
*
ciphertext
=
(
unsigned
char
*
)
malloc
(
cipheredLength
);
#if OPENSSL_VERSION_NUMBER >= 10100000L
if
(
!
EVP_EncryptInit_ex
(
mAesEncryptContext
,
NULL
,
NULL
,
NULL
,
NULL
)){
#else
if
(
!
EVP_EncryptInit_ex
(
&
mAesEncryptContext
,
NULL
,
NULL
,
NULL
,
NULL
)){
#endif
free
(
ciphertext
);
return
QString
();
}
#if OPENSSL_VERSION_NUMBER >= 10100000L
if
(
!
EVP_EncryptUpdate
(
mAesEncryptContext
,
ciphertext
,
&
cipheredLength
,
(
unsigned
char
*
)
clearData
.
data
(),
clearData
.
length
())){
#else
if
(
!
EVP_EncryptUpdate
(
&
mAesEncryptContext
,
ciphertext
,
&
cipheredLength
,
(
unsigned
char
*
)
clearData
.
data
(),
clearData
.
length
())){
#endif
free
(
ciphertext
);
return
QString
();
}
/* update ciphertext with the final remaining bytes */
#if OPENSSL_VERSION_NUMBER >= 10100000L
if
(
!
EVP_EncryptFinal_ex
(
mAesEncryptContext
,
ciphertext
+
cipheredLength
,
&
paddingLength
)){
#else
if
(
!
EVP_EncryptFinal_ex
(
&
mAesEncryptContext
,
ciphertext
+
cipheredLength
,
&
paddingLength
)){
#endif
free
(
ciphertext
);
return
QString
();
}
...
...
@@ -106,17 +122,29 @@ QString UBCryptoUtils::symetricDecrypt(const QString& encrypted)
int
paddingLength
=
0
;
unsigned
char
*
plaintext
=
(
unsigned
char
*
)
malloc
(
encryptedLength
);
#if OPENSSL_VERSION_NUMBER >= 10100000L
if
(
!
EVP_DecryptInit_ex
(
mAesDecryptContext
,
NULL
,
NULL
,
NULL
,
NULL
)){
#else
if
(
!
EVP_DecryptInit_ex
(
&
mAesDecryptContext
,
NULL
,
NULL
,
NULL
,
NULL
)){
#endif
free
(
plaintext
);
return
QString
();
}
#if OPENSSL_VERSION_NUMBER >= 10100000L
if
(
!
EVP_DecryptUpdate
(
mAesDecryptContext
,
plaintext
,
&
encryptedLength
,
(
const
unsigned
char
*
)
encryptedData
.
data
(),
encryptedData
.
length
())){
#else
if
(
!
EVP_DecryptUpdate
(
&
mAesDecryptContext
,
plaintext
,
&
encryptedLength
,
(
const
unsigned
char
*
)
encryptedData
.
data
(),
encryptedData
.
length
())){
#endif
free
(
plaintext
);
return
QString
();
}
#if OPENSSL_VERSION_NUMBER >= 10100000L
if
(
!
EVP_DecryptFinal_ex
(
mAesDecryptContext
,
plaintext
+
encryptedLength
,
&
paddingLength
)){
#else
if
(
!
EVP_DecryptFinal_ex
(
&
mAesDecryptContext
,
plaintext
+
encryptedLength
,
&
paddingLength
)){
#endif
free
(
plaintext
);
return
QString
();
}
...
...
@@ -146,8 +174,15 @@ void UBCryptoUtils::aesInit()
return
;
}
#if OPENSSL_VERSION_NUMBER >= 10100000L
mAesEncryptContext
=
EVP_CIPHER_CTX_new
();
EVP_EncryptInit_ex
(
mAesEncryptContext
,
EVP_aes_256_cbc
(),
NULL
,
key
,
iv
);
mAesDecryptContext
=
EVP_CIPHER_CTX_new
();
EVP_DecryptInit_ex
(
mAesDecryptContext
,
EVP_aes_256_cbc
(),
NULL
,
key
,
iv
);
#else
EVP_CIPHER_CTX_init
(
&
mAesEncryptContext
);
EVP_EncryptInit_ex
(
&
mAesEncryptContext
,
EVP_aes_256_cbc
(),
NULL
,
key
,
iv
);
EVP_CIPHER_CTX_init
(
&
mAesDecryptContext
);
EVP_DecryptInit_ex
(
&
mAesDecryptContext
,
EVP_aes_256_cbc
(),
NULL
,
key
,
iv
);
#endif
}
src/frameworks/UBCryptoUtils.h
View file @
0d6f19c0
...
...
@@ -60,8 +60,13 @@ class UBCryptoUtils : public QObject
void
aesInit
();
#if OPENSSL_VERSION_NUMBER >= 10100000L
EVP_CIPHER_CTX
*
mAesEncryptContext
;
EVP_CIPHER_CTX
*
mAesDecryptContext
;
#else
EVP_CIPHER_CTX
mAesEncryptContext
;
EVP_CIPHER_CTX
mAesDecryptContext
;
#endif
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment