diff options
author | Mike DePaulo <mikedep333@gmail.com> | 2015-01-10 12:26:41 -0500 |
---|---|---|
committer | Mike DePaulo <mikedep333@gmail.com> | 2015-01-10 13:07:24 -0500 |
commit | 4668cbfa14460fbead98ec3a904a58df1f41c4c3 (patch) | |
tree | 72b1fec2e5bfb8ea8ffad514d923c65e9ef38135 /openssl/crypto/ecdsa/ecs_vrf.c | |
parent | 15915c262c1334282d0ab2a3fdb2c416e91b51cf (diff) | |
download | vcxsrv-4668cbfa14460fbead98ec3a904a58df1f41c4c3.tar.gz vcxsrv-4668cbfa14460fbead98ec3a904a58df1f41c4c3.tar.bz2 vcxsrv-4668cbfa14460fbead98ec3a904a58df1f41c4c3.zip |
Update openssl to version openssl-1.0.1k
Conflicts:
openssl/Makefile
Diffstat (limited to 'openssl/crypto/ecdsa/ecs_vrf.c')
-rw-r--r-- | openssl/crypto/ecdsa/ecs_vrf.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/openssl/crypto/ecdsa/ecs_vrf.c b/openssl/crypto/ecdsa/ecs_vrf.c index ef9acf7b6..2836efe5e 100644 --- a/openssl/crypto/ecdsa/ecs_vrf.c +++ b/openssl/crypto/ecdsa/ecs_vrf.c @@ -57,6 +57,7 @@ */ #include "ecs_locl.h" +#include "cryptlib.h" #ifndef OPENSSL_NO_ENGINE #include <openssl/engine.h> #endif @@ -84,13 +85,25 @@ int ECDSA_verify(int type, const unsigned char *dgst, int dgst_len, const unsigned char *sigbuf, int sig_len, EC_KEY *eckey) { ECDSA_SIG *s; + const unsigned char *p = sigbuf; + unsigned char *der = NULL; + int derlen = -1; int ret=-1; s = ECDSA_SIG_new(); if (s == NULL) return(ret); - if (d2i_ECDSA_SIG(&s, &sigbuf, sig_len) == NULL) goto err; + if (d2i_ECDSA_SIG(&s, &p, sig_len) == NULL) goto err; + /* Ensure signature uses DER and doesn't have trailing garbage */ + derlen = i2d_ECDSA_SIG(s, &der); + if (derlen != sig_len || memcmp(sigbuf, der, derlen)) + goto err; ret=ECDSA_do_verify(dgst, dgst_len, s, eckey); err: + if (derlen > 0) + { + OPENSSL_cleanse(der, derlen); + OPENSSL_free(der); + } ECDSA_SIG_free(s); return(ret); } |