Fixed one typo in MathRShiftU64.S stub implementation; Add one digest algorithm registration to make sure the underlying algorithm is available for the default OpenSSL software PRNG implementation.

Signed-off-by: Long, Qin <qin.long@intel.com>
Reviewed-by: Fu, Siyuan <siyuan.fu@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14860 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Long, Qin 2013-11-19 02:57:19 +00:00 committed by sfu5
parent 86e9f87ec8
commit 38d91622fa
4 changed files with 32 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/** @file /** @file
Pseudorandom Number Generator Wrapper Implementation over OpenSSL. Pseudorandom Number Generator Wrapper Implementation over OpenSSL.
Copyright (c) 2010 - 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2010 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "InternalCryptLib.h" #include "InternalCryptLib.h"
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/evp.h>
// //
// Default seed for UEFI Crypto Library // Default seed for UEFI Crypto Library
@ -47,6 +48,14 @@ RandomSeed (
return FALSE; return FALSE;
} }
//
// The software PRNG implementation built in OpenSSL depends on message digest algorithm.
// Make sure SHA-1 digest algorithm is available here.
//
if (EVP_add_digest (EVP_sha1 ()) == 0) {
return FALSE;
}
// //
// Seed the pseudorandom number generator with user-supplied value. // Seed the pseudorandom number generator with user-supplied value.
// NOTE: A cryptographic PRNG must be seeded with unpredictable data. // NOTE: A cryptographic PRNG must be seeded with unpredictable data.

View File

@ -1,7 +1,7 @@
/** @file /** @file
Pseudorandom Number Generator Wrapper Implementation over OpenSSL. Pseudorandom Number Generator Wrapper Implementation over OpenSSL.
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "InternalCryptLib.h" #include "InternalCryptLib.h"
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/evp.h>
#include <Library/PrintLib.h> #include <Library/PrintLib.h>
/** /**
@ -45,6 +46,14 @@ RandomSeed (
return FALSE; return FALSE;
} }
//
// The software PRNG implementation built in OpenSSL depends on message digest algorithm.
// Make sure SHA-1 digest algorithm is available here.
//
if (EVP_add_digest (EVP_sha1 ()) == 0) {
return FALSE;
}
// //
// Seed the pseudorandom number generator with user-supplied value. // Seed the pseudorandom number generator with user-supplied value.
// NOTE: A cryptographic PRNG must be seeded with unpredictable data. // NOTE: A cryptographic PRNG must be seeded with unpredictable data.

View File

@ -1,7 +1,7 @@
/** @file /** @file
Pseudorandom Number Generator Wrapper Implementation over OpenSSL. Pseudorandom Number Generator Wrapper Implementation over OpenSSL.
Copyright (c) 2012, Intel Corporation. All rights reserved.<BR> Copyright (c) 2012 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -14,6 +14,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include "InternalCryptLib.h" #include "InternalCryptLib.h"
#include <openssl/rand.h> #include <openssl/rand.h>
#include <openssl/evp.h>
#include <Library/PrintLib.h> #include <Library/PrintLib.h>
/** /**
@ -45,6 +46,14 @@ RandomSeed (
return FALSE; return FALSE;
} }
//
// The software PRNG implementation built in OpenSSL depends on message digest algorithm.
// Make sure SHA-1 digest algorithm is available here.
//
if (EVP_add_digest (EVP_sha1 ()) == 0) {
return FALSE;
}
// //
// Seed the pseudorandom number generator with user-supplied value. // Seed the pseudorandom number generator with user-supplied value.
// NOTE: A cryptographic PRNG must be seeded with unpredictable data. // NOTE: A cryptographic PRNG must be seeded with unpredictable data.

View File

@ -1,6 +1,6 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# #
# Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR> # Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
# This program and the accompanying materials # This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
@ -53,7 +53,7 @@ ASM_PFX(__ashrdi3):
More32: More32:
movl %edx, %eax movl %edx, %eax
xor %edx, %edx xor %edx, %edx
and $32, %cl and $31, %cl
shr %cl, %eax shr %cl, %eax
ret ret