]>
git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Application/Cryptest/DhVerify.c
2 Application for Diffie-Hellman Primitives Validation.
4 Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 Validate UEFI-OpenSSL DH Interfaces.
20 @retval EFI_SUCCESS Validation succeeded.
21 @retval EFI_ABORTED Validation failed.
33 UINTN PublicKey1Length
;
35 UINTN PublicKey2Length
;
42 Print (L
"\nUEFI-OpenSSL DH Engine Testing:\n");
45 // Generate & Initialize DH Context
47 Print (L
"- Context1 ... ");
54 Print (L
"Context2 ... ");
61 Print (L
"Parameter1 ... ");
62 Status
= DhGenerateParameter (Dh1
, 2, 64, Prime
);
68 Print (L
"Parameter2 ... ");
69 Status
= DhSetParameter (Dh2
, 2, 64, Prime
);
75 Print (L
"Generate key1 ... ");
76 Status
= DhGenerateKey (Dh1
, PublicKey1
, &PublicKey1Length
);
82 Print (L
"Generate key2 ... ");
83 Status
= DhGenerateKey (Dh2
, PublicKey2
, &PublicKey2Length
);
89 Print (L
"Compute key1 ... ");
90 Status
= DhComputeKey (Dh1
, PublicKey2
, PublicKey2Length
, Key1
, &Key1Length
);
96 Print (L
"Compute key2 ... ");
97 Status
= DhComputeKey (Dh2
, PublicKey1
, PublicKey1Length
, Key2
, &Key2Length
);
103 Print (L
"Compare Keys ... ");
104 if (Key1Length
!= Key2Length
) {
109 if (CompareMem (Key1
, Key2
, Key1Length
) != 0) {