summaryrefslogtreecommitdiffstats
path: root/apps/apps.c
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2016-08-17 13:34:22 +0200
committerDr. Stephen Henson <steve@openssl.org>2016-08-17 13:34:22 +0200
commita0754084f82cf1cd0c8629d61f779bb6a6c6b1a6 (patch)
treee1287c54eeea701518d4f18c87dc2ffc106b07db /apps/apps.c
parentConvert OCSP* functions to use const getters (diff)
downloadopenssl-a0754084f82cf1cd0c8629d61f779bb6a6c6b1a6.tar.xz
openssl-a0754084f82cf1cd0c8629d61f779bb6a6c6b1a6.zip
Corrupt signature in place.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'apps/apps.c')
-rw-r--r--apps/apps.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/apps/apps.c b/apps/apps.c
index 17a9fdc267..10ab6262c8 100644
--- a/apps/apps.c
+++ b/apps/apps.c
@@ -2583,15 +2583,8 @@ int has_stdin_waiting(void)
#endif
/* Corrupt a signature by modifying final byte */
-int corrupt_signature(ASN1_STRING *signature)
+void corrupt_signature(const ASN1_STRING *signature)
{
- unsigned char *s;
- size_t slen = ASN1_STRING_length(signature);
-
- s = OPENSSL_memdup(ASN1_STRING_get0_data(signature), slen);
- if (s == NULL)
- return 0;
- s[slen - 1] ^= 0x1;
- ASN1_STRING_set0(signature, s, slen);
- return 1;
+ unsigned char *s = signature->data;
+ s[signature->length - 1] ^= 0x1;
}