mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-18 02:32:36 +00:00
Fix little oops on sizeof()
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@3609 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -299,7 +299,7 @@ static char *binary(int y, int len)
|
|||||||
int ast_sign_bin(struct ast_key *key, char *msg, int msglen, unsigned char *dsig)
|
int ast_sign_bin(struct ast_key *key, char *msg, int msglen, unsigned char *dsig)
|
||||||
{
|
{
|
||||||
unsigned char digest[20];
|
unsigned char digest[20];
|
||||||
int siglen = sizeof(dsig);
|
int siglen = 128;
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
if (key->ktype != AST_KEY_PRIVATE) {
|
if (key->ktype != AST_KEY_PRIVATE) {
|
||||||
@@ -318,8 +318,8 @@ int ast_sign_bin(struct ast_key *key, char *msg, int msglen, unsigned char *dsig
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (siglen != sizeof(dsig)) {
|
if (siglen != 128) {
|
||||||
ast_log(LOG_WARNING, "Unexpected signature length %d, expecting %d\n", (int)siglen, (int)sizeof(dsig));
|
ast_log(LOG_WARNING, "Unexpected signature length %d, expecting %d\n", (int)siglen, (int)128);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -356,7 +356,7 @@ int ast_check_signature_bin(struct ast_key *key, char *msg, int msglen, unsigned
|
|||||||
SHA1((unsigned char *)msg, msglen, digest);
|
SHA1((unsigned char *)msg, msglen, digest);
|
||||||
|
|
||||||
/* Verify signature */
|
/* Verify signature */
|
||||||
res = RSA_verify(NID_sha1, digest, sizeof(digest), dsig, sizeof(dsig), key->rsa);
|
res = RSA_verify(NID_sha1, digest, sizeof(digest), dsig, 128, key->rsa);
|
||||||
|
|
||||||
if (!res) {
|
if (!res) {
|
||||||
ast_log(LOG_DEBUG, "Key failed verification\n");
|
ast_log(LOG_DEBUG, "Key failed verification\n");
|
||||||
|
Reference in New Issue
Block a user