зеркало из https://github.com/github/ruby.git
* ext/digest/sha2/sha2.c (REVERSE32): exlicitly cast since unsigned
long may be larger than sha2_word32. * ext/digest/sha2/sha2.c (SHA{256,512,384}_{Final,End}): should clear whole content, not pointer size. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35505 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
26e258c807
Коммит
e1d1397af8
|
@ -1,4 +1,10 @@
|
|||
Tue May 1 06:03:34 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
Tue May 1 06:04:14 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* ext/digest/sha2/sha2.c (REVERSE32): exlicitly cast since unsigned
|
||||
long may be larger than sha2_word32.
|
||||
|
||||
* ext/digest/sha2/sha2.c (SHA{256,512,384}_{Final,End}): should clear
|
||||
whole content, not pointer size.
|
||||
|
||||
* ext/digest/*/extconf.rb: use pkg_config to use same library with
|
||||
openssl. [ruby-core:44755][Bug #6379]
|
||||
|
|
|
@ -138,7 +138,7 @@ typedef u_int64_t sha2_word64; /* Exactly 8 bytes */
|
|||
#define REVERSE32(w,x) { \
|
||||
sha2_word32 tmp = (w); \
|
||||
tmp = (tmp >> 16) | (tmp << 16); \
|
||||
(x) = ((tmp & 0xff00ff00UL) >> 8) | ((tmp & 0x00ff00ffUL) << 8); \
|
||||
(x) = ((tmp & (sha2_word32)0xff00ff00UL) >> 8) | ((tmp & (sha2_word32)0x00ff00ffUL) << 8); \
|
||||
}
|
||||
#define REVERSE64(w,x) { \
|
||||
sha2_word64 tmp = (w); \
|
||||
|
@ -633,7 +633,7 @@ void SHA256_Final(sha2_byte digest[], SHA256_CTX* context) {
|
|||
}
|
||||
|
||||
/* Clean up state data: */
|
||||
MEMSET_BZERO(context, sizeof(context));
|
||||
MEMSET_BZERO(context, sizeof(*context));
|
||||
usedspace = 0;
|
||||
}
|
||||
|
||||
|
@ -653,7 +653,7 @@ char *SHA256_End(SHA256_CTX* context, char buffer[]) {
|
|||
}
|
||||
*buffer = (char)0;
|
||||
} else {
|
||||
MEMSET_BZERO(context, sizeof(context));
|
||||
MEMSET_BZERO(context, sizeof(*context));
|
||||
}
|
||||
MEMSET_BZERO(digest, SHA256_DIGEST_LENGTH);
|
||||
return buffer;
|
||||
|
@ -963,7 +963,7 @@ void SHA512_Final(sha2_byte digest[], SHA512_CTX* context) {
|
|||
}
|
||||
|
||||
/* Zero out state data */
|
||||
MEMSET_BZERO(context, sizeof(context));
|
||||
MEMSET_BZERO(context, sizeof(*context));
|
||||
}
|
||||
|
||||
char *SHA512_End(SHA512_CTX* context, char buffer[]) {
|
||||
|
@ -982,7 +982,7 @@ char *SHA512_End(SHA512_CTX* context, char buffer[]) {
|
|||
}
|
||||
*buffer = (char)0;
|
||||
} else {
|
||||
MEMSET_BZERO(context, sizeof(context));
|
||||
MEMSET_BZERO(context, sizeof(*context));
|
||||
}
|
||||
MEMSET_BZERO(digest, SHA512_DIGEST_LENGTH);
|
||||
return buffer;
|
||||
|
@ -1037,7 +1037,7 @@ void SHA384_Final(sha2_byte digest[], SHA384_CTX* context) {
|
|||
}
|
||||
|
||||
/* Zero out state data */
|
||||
MEMSET_BZERO(context, sizeof(context));
|
||||
MEMSET_BZERO(context, sizeof(*context));
|
||||
}
|
||||
|
||||
char *SHA384_End(SHA384_CTX* context, char buffer[]) {
|
||||
|
@ -1056,7 +1056,7 @@ char *SHA384_End(SHA384_CTX* context, char buffer[]) {
|
|||
}
|
||||
*buffer = (char)0;
|
||||
} else {
|
||||
MEMSET_BZERO(context, sizeof(context));
|
||||
MEMSET_BZERO(context, sizeof(*context));
|
||||
}
|
||||
MEMSET_BZERO(digest, SHA384_DIGEST_LENGTH);
|
||||
return buffer;
|
||||
|
|
Загрузка…
Ссылка в новой задаче