mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 11:25:35 +00:00
test: Add coverage for res_crypto
We're validating the following functionality: encrypting a block of data with RSA decrypting a block of data with RSA signing a block of data with RSA verifying a signature with RSA encrypting a block of data with AES-ECB encrypting a block of data with AES-ECB as well as accessing test keys from the keystore. ASTERISK-30045 #close Change-Id: I0d10e7b41009c5290a4356c6480e636712d5c96d
This commit is contained in:
committed by
George Joseph
parent
c1f5913b45
commit
2fb9373b24
@@ -320,7 +320,7 @@ int AST_OPTIONAL_API_NAME(ast_sign_bin)(struct ast_key *key, const char *msg, in
|
||||
SHA1((unsigned char *)msg, msglen, digest);
|
||||
|
||||
/* Verify signature */
|
||||
if (!(res = RSA_sign(NID_sha1, digest, sizeof(digest), dsig, &siglen, key->rsa))) {
|
||||
if ((res = RSA_sign(NID_sha1, digest, sizeof(digest), dsig, &siglen, key->rsa)) != 1) {
|
||||
ast_log(LOG_WARNING, "RSA Signature (key %s) failed\n", key->name);
|
||||
return -1;
|
||||
}
|
||||
@@ -433,7 +433,7 @@ int AST_OPTIONAL_API_NAME(ast_check_signature_bin)(struct ast_key *key, const ch
|
||||
SHA1((unsigned char *)msg, msglen, digest);
|
||||
|
||||
/* Verify signature */
|
||||
if (!(res = RSA_verify(NID_sha1, digest, sizeof(digest), (unsigned char *)dsig, 128, key->rsa))) {
|
||||
if ((res = RSA_verify(NID_sha1, digest, sizeof(digest), (unsigned char *)dsig, 128, key->rsa)) != 1) {
|
||||
ast_debug(1, "Key failed verification: %s\n", key->name);
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user