]>
git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Application/Cryptest/DhVerify.c
2 Application for Diffie-Hellman Primitives Validation.
4 Copyright (c) 2010 - 2014, 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 // Initialize Key Length
47 PublicKey1Length
= sizeof (PublicKey1
);
48 PublicKey2Length
= sizeof (PublicKey2
);
49 Key1Length
= sizeof (Key1
);
50 Key2Length
= sizeof (Key2
);
53 // Generate & Initialize DH Context
55 Print (L
"- Context1 ... ");
62 Print (L
"Context2 ... ");
69 Print (L
"Parameter1 ... ");
70 Status
= DhGenerateParameter (Dh1
, 2, 64, Prime
);
76 Print (L
"Parameter2 ... ");
77 Status
= DhSetParameter (Dh2
, 2, 64, Prime
);
83 Print (L
"Generate key1 ... ");
84 Status
= DhGenerateKey (Dh1
, PublicKey1
, &PublicKey1Length
);
90 Print (L
"Generate key2 ... ");
91 Status
= DhGenerateKey (Dh2
, PublicKey2
, &PublicKey2Length
);
97 Print (L
"Compute key1 ... ");
98 Status
= DhComputeKey (Dh1
, PublicKey2
, PublicKey2Length
, Key1
, &Key1Length
);
104 Print (L
"Compute key2 ... ");
105 Status
= DhComputeKey (Dh2
, PublicKey1
, PublicKey1Length
, Key2
, &Key2Length
);
111 Print (L
"Compare Keys ... ");
112 if (Key1Length
!= Key2Length
) {
117 if (CompareMem (Key1
, Key2
, Key1Length
) != 0) {