X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=CryptoPkg%2FLibrary%2FBaseCryptLib%2FPk%2FCryptDh.c;h=5e0447b488a3396adaab31076af078fb63f86bae;hp=9cbf182c70f5b292a39ab2b67107208fa0173e26;hb=8824c6144c73fe4b6355df6dfaee3e80e068c3b1;hpb=d8162f5b3283a06a6dc4e2e05cd0c45fc4358eb0 diff --git a/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c b/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c index 9cbf182c70..5e0447b488 100644 --- a/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c +++ b/CryptoPkg/Library/BaseCryptLib/Pk/CryptDh.c @@ -1,7 +1,7 @@ /** @file Diffie-Hellman Wrapper Implementation over OpenSSL. -Copyright (c) 2010 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -246,7 +246,11 @@ DhGenerateKey ( RetVal = (BOOLEAN) DH_generate_key (DhContext); if (RetVal) { Size = BN_num_bytes (Dh->pub_key); - if ((Size > 0) && (*PublicKeySize < (UINTN) Size)) { + if (Size <= 0) { + *PublicKeySize = 0; + return FALSE; + } + if (*PublicKeySize < (UINTN) Size) { *PublicKeySize = Size; return FALSE; }