Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
f46ca5fb
Commit
f46ca5fb
authored
Sep 20, 2003
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge bk-internal.mysql.com:/home/bk/mysql-4.0
into mysql.com:/home/dlenev/src/mysql-4.0-opssl
parents
0a58c2ae
867aec2f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
33 additions
and
23 deletions
+33
-23
include/my_global.h
include/my_global.h
+10
-0
sql/des_key_file.cc
sql/des_key_file.cc
+4
-4
sql/item_strfunc.cc
sql/item_strfunc.cc
+17
-17
sql/mysql_priv.h
sql/mysql_priv.h
+2
-2
No files found.
include/my_global.h
View file @
f46ca5fb
...
@@ -1105,4 +1105,14 @@ typedef union {
...
@@ -1105,4 +1105,14 @@ typedef union {
#define statistic_add(V,C,L) (V)+=(C)
#define statistic_add(V,C,L) (V)+=(C)
#endif
#endif
#ifdef HAVE_OPENSSL
#include <openssl/opensslv.h>
#if OPENSSL_VERSION_NUMBER < 0x0090700f
#define DES_cblock des_cblock
#define DES_key_schedule des_key_schedule
#define DES_set_key_unchecked(k,ks) des_set_key_unchecked((k),*(ks))
#define DES_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e) des_ede3_cbc_encrypt((i),(o),(l),*(k1),*(k2),*(k3),(iv),(e))
#endif
#endif
#endif
/* my_global_h */
#endif
/* my_global_h */
sql/des_key_file.cc
View file @
f46ca5fb
...
@@ -76,16 +76,16 @@ load_des_key_file(const char *file_name)
...
@@ -76,16 +76,16 @@ load_des_key_file(const char *file_name)
if
(
start
!=
end
)
if
(
start
!=
end
)
{
{
des
_cblock
ivec
;
DES
_cblock
ivec
;
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
// We make good 24-byte (168 bit) key from given plaintext key with MD5
// We make good 24-byte (168 bit) key from given plaintext key with MD5
EVP_BytesToKey
(
EVP_des_ede3_cbc
(),
EVP_md5
(),
NULL
,
EVP_BytesToKey
(
EVP_des_ede3_cbc
(),
EVP_md5
(),
NULL
,
(
uchar
*
)
start
,
(
int
)
(
end
-
start
),
1
,
(
uchar
*
)
start
,
(
int
)
(
end
-
start
),
1
,
(
uchar
*
)
&
keyblock
,
(
uchar
*
)
&
keyblock
,
ivec
);
ivec
);
des_set_key_unchecked
(
&
keyblock
.
key1
,
des_keyschedule
[(
int
)
offset
].
ks1
);
DES_set_key_unchecked
(
&
keyblock
.
key1
,
&
(
des_keyschedule
[(
int
)
offset
].
ks1
)
);
des_set_key_unchecked
(
&
keyblock
.
key2
,
des_keyschedule
[(
int
)
offset
].
ks2
);
DES_set_key_unchecked
(
&
keyblock
.
key2
,
&
(
des_keyschedule
[(
int
)
offset
].
ks2
)
);
des_set_key_unchecked
(
&
keyblock
.
key3
,
des_keyschedule
[(
int
)
offset
].
ks3
);
DES_set_key_unchecked
(
&
keyblock
.
key3
,
&
(
des_keyschedule
[(
int
)
offset
].
ks3
)
);
if
(
des_default_key
==
15
)
if
(
des_default_key
==
15
)
des_default_key
=
(
uint
)
offset
;
// use first as def.
des_default_key
=
(
uint
)
offset
;
// use first as def.
}
}
...
...
sql/item_strfunc.cc
View file @
f46ca5fb
...
@@ -330,7 +330,7 @@ void Item_func_concat::fix_length_and_dec()
...
@@ -330,7 +330,7 @@ void Item_func_concat::fix_length_and_dec()
String
*
Item_func_des_encrypt
::
val_str
(
String
*
str
)
String
*
Item_func_des_encrypt
::
val_str
(
String
*
str
)
{
{
#ifdef HAVE_OPENSSL
#ifdef HAVE_OPENSSL
des
_cblock
ivec
;
DES
_cblock
ivec
;
struct
st_des_keyblock
keyblock
;
struct
st_des_keyblock
keyblock
;
struct
st_des_keyschedule
keyschedule
;
struct
st_des_keyschedule
keyschedule
;
const
char
*
append_str
=
"********"
;
const
char
*
append_str
=
"********"
;
...
@@ -370,9 +370,9 @@ String *Item_func_des_encrypt::val_str(String *str)
...
@@ -370,9 +370,9 @@ String *Item_func_des_encrypt::val_str(String *str)
EVP_BytesToKey
(
EVP_des_ede3_cbc
(),
EVP_md5
(),
NULL
,
EVP_BytesToKey
(
EVP_des_ede3_cbc
(),
EVP_md5
(),
NULL
,
(
uchar
*
)
keystr
->
ptr
(),
(
int
)
keystr
->
length
(),
(
uchar
*
)
keystr
->
ptr
(),
(
int
)
keystr
->
length
(),
1
,
(
uchar
*
)
&
keyblock
,
ivec
);
1
,
(
uchar
*
)
&
keyblock
,
ivec
);
des_set_key_unchecked
(
&
keyblock
.
key1
,
keyschedule
.
ks1
);
DES_set_key_unchecked
(
&
keyblock
.
key1
,
&
keyschedule
.
ks1
);
des_set_key_unchecked
(
&
keyblock
.
key2
,
keyschedule
.
ks2
);
DES_set_key_unchecked
(
&
keyblock
.
key2
,
&
keyschedule
.
ks2
);
des_set_key_unchecked
(
&
keyblock
.
key3
,
keyschedule
.
ks3
);
DES_set_key_unchecked
(
&
keyblock
.
key3
,
&
keyschedule
.
ks3
);
}
}
/*
/*
...
@@ -393,12 +393,12 @@ String *Item_func_des_encrypt::val_str(String *str)
...
@@ -393,12 +393,12 @@ String *Item_func_des_encrypt::val_str(String *str)
tmp_value
[
0
]
=
(
char
)
(
128
|
key_number
);
tmp_value
[
0
]
=
(
char
)
(
128
|
key_number
);
// Real encryption
// Real encryption
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
des
_ede3_cbc_encrypt
((
const
uchar
*
)
(
res
->
ptr
()),
DES
_ede3_cbc_encrypt
((
const
uchar
*
)
(
res
->
ptr
()),
(
uchar
*
)
(
tmp_value
.
ptr
()
+
1
),
(
uchar
*
)
(
tmp_value
.
ptr
()
+
1
),
res_length
,
res_length
,
keyschedule
.
ks1
,
&
keyschedule
.
ks1
,
keyschedule
.
ks2
,
&
keyschedule
.
ks2
,
keyschedule
.
ks3
,
&
keyschedule
.
ks3
,
&
ivec
,
TRUE
);
&
ivec
,
TRUE
);
return
&
tmp_value
;
return
&
tmp_value
;
...
@@ -412,8 +412,8 @@ String *Item_func_des_encrypt::val_str(String *str)
...
@@ -412,8 +412,8 @@ String *Item_func_des_encrypt::val_str(String *str)
String
*
Item_func_des_decrypt
::
val_str
(
String
*
str
)
String
*
Item_func_des_decrypt
::
val_str
(
String
*
str
)
{
{
#ifdef HAVE_OPENSSL
#ifdef HAVE_OPENSSL
des
_key_schedule
ks1
,
ks2
,
ks3
;
DES
_key_schedule
ks1
,
ks2
,
ks3
;
des
_cblock
ivec
;
DES
_cblock
ivec
;
struct
st_des_keyblock
keyblock
;
struct
st_des_keyblock
keyblock
;
struct
st_des_keyschedule
keyschedule
;
struct
st_des_keyschedule
keyschedule
;
String
*
res
=
args
[
0
]
->
val_str
(
str
);
String
*
res
=
args
[
0
]
->
val_str
(
str
);
...
@@ -447,20 +447,20 @@ String *Item_func_des_decrypt::val_str(String *str)
...
@@ -447,20 +447,20 @@ String *Item_func_des_decrypt::val_str(String *str)
(
uchar
*
)
keystr
->
ptr
(),(
int
)
keystr
->
length
(),
(
uchar
*
)
keystr
->
ptr
(),(
int
)
keystr
->
length
(),
1
,(
uchar
*
)
&
keyblock
,
ivec
);
1
,(
uchar
*
)
&
keyblock
,
ivec
);
// Here we set all 64-bit keys (56 effective) one by one
// Here we set all 64-bit keys (56 effective) one by one
des_set_key_unchecked
(
&
keyblock
.
key1
,
keyschedule
.
ks1
);
DES_set_key_unchecked
(
&
keyblock
.
key1
,
&
keyschedule
.
ks1
);
des_set_key_unchecked
(
&
keyblock
.
key2
,
keyschedule
.
ks2
);
DES_set_key_unchecked
(
&
keyblock
.
key2
,
&
keyschedule
.
ks2
);
des_set_key_unchecked
(
&
keyblock
.
key3
,
keyschedule
.
ks3
);
DES_set_key_unchecked
(
&
keyblock
.
key3
,
&
keyschedule
.
ks3
);
}
}
if
(
tmp_value
.
alloc
(
length
-
1
))
if
(
tmp_value
.
alloc
(
length
-
1
))
goto
error
;
goto
error
;
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
bzero
((
char
*
)
&
ivec
,
sizeof
(
ivec
));
des
_ede3_cbc_encrypt
((
const
uchar
*
)
res
->
ptr
()
+
1
,
DES
_ede3_cbc_encrypt
((
const
uchar
*
)
res
->
ptr
()
+
1
,
(
uchar
*
)
(
tmp_value
.
ptr
()),
(
uchar
*
)
(
tmp_value
.
ptr
()),
length
-
1
,
length
-
1
,
keyschedule
.
ks1
,
&
keyschedule
.
ks1
,
keyschedule
.
ks2
,
&
keyschedule
.
ks2
,
keyschedule
.
ks3
,
&
keyschedule
.
ks3
,
&
ivec
,
FALSE
);
&
ivec
,
FALSE
);
/* Restore old length of key */
/* Restore old length of key */
if
((
tail
=
(
uint
)
(
uchar
)
tmp_value
[
length
-
2
])
>
8
)
if
((
tail
=
(
uint
)
(
uchar
)
tmp_value
[
length
-
2
])
>
8
)
...
...
sql/mysql_priv.h
View file @
f46ca5fb
...
@@ -474,11 +474,11 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
...
@@ -474,11 +474,11 @@ Field *find_field_in_table(THD *thd,TABLE *table,const char *name,uint length,
#include <openssl/des.h>
#include <openssl/des.h>
struct
st_des_keyblock
struct
st_des_keyblock
{
{
des
_cblock
key1
,
key2
,
key3
;
DES
_cblock
key1
,
key2
,
key3
;
};
};
struct
st_des_keyschedule
struct
st_des_keyschedule
{
{
des
_key_schedule
ks1
,
ks2
,
ks3
;
DES
_key_schedule
ks1
,
ks2
,
ks3
;
};
};
extern
char
*
des_key_file
;
extern
char
*
des_key_file
;
extern
struct
st_des_keyschedule
des_keyschedule
[
10
];
extern
struct
st_des_keyschedule
des_keyschedule
[
10
];
...
...
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