]>
git.saurik.com Git - apple/security.git/blob - OSX/sec/Security/Regressions/vmdh/vmdh-40.c
2 * Copyright (c) 2006-2007,2012 Apple Inc. All Rights Reserved.
5 #include <Security/vmdh.h>
9 #include "Security_regressions.h"
11 static uint8_t dh512_p
[] = {
12 0xb7, 0x15, 0xb9, 0x4d, 0x16, 0xbc, 0x9f, 0xa9,
13 0x2f, 0xee, 0x52, 0x28, 0x12, 0x91, 0x81, 0xaa,
14 0x16, 0x65, 0x90, 0x99, 0x73, 0xff, 0x2d, 0xae,
15 0xeb, 0x5b, 0x11, 0x7f, 0x98, 0x57, 0x54, 0xe2,
16 0x85, 0x30, 0x28, 0x58, 0xac, 0x7a, 0x5e, 0x67,
17 0x45, 0x01, 0x2c, 0x3f, 0xff, 0xc8, 0x6a, 0x64,
18 0x1d, 0x3e, 0x2d, 0xe2, 0x30, 0xb3, 0x7f, 0x64,
19 0xca, 0x96, 0xe2, 0x0b, 0x51, 0xab, 0x53, 0xa3,
22 static uint32_t dh512_g
= 2;
24 static uint8_t dh512_r
[] = {
25 0x00, 0x01, 0x65, 0xf4, 0x48, 0x8c, 0xe7, 0xdc,
26 0x75, 0xa5, 0xee, 0x3f, 0x93, 0x64, 0xcd, 0xf1,
27 0x81, 0x7b, 0xfb, 0xd9, 0x12, 0x79, 0xa8, 0x2d,
28 0xdb, 0x31, 0x72, 0xe5, 0x01, 0xe8, 0xb5, 0x32,
29 0x1a, 0xe1, 0x8e, 0x30, 0x9c, 0x67, 0x58, 0xcc,
30 0xf9, 0x72, 0x35, 0xc3, 0x66, 0xeb, 0xe4, 0x50,
31 0x41, 0x6e, 0xe2, 0x94, 0x97, 0xfb, 0x4b, 0xab,
32 0x50, 0x99, 0x2c, 0xaa, 0xf7, 0x6f, 0xa0, 0x51,
36 /* Test basic add delete update copy matching stuff. */
37 static void tests(void)
40 ok((vmdh
= vmdh_create(dh512_g
, dh512_p
, sizeof(dh512_p
),
41 dh512_r
, sizeof(dh512_r
))), "vmdh_create");
43 size_t pub_key_len
= sizeof(pub_key
);
44 ok((vmdh_generate_key(vmdh
, pub_key
, &pub_key_len
)),
47 uint8_t pw
[] = { 0x31, 0x32, 0x33, 0x34 };
48 size_t pw_len
= sizeof(pw
);
50 uint8_t encpw
[vmdh_encpw_len(sizeof(pw
))];
51 size_t encpw_len
= sizeof(encpw
);
53 ok(vmdh_encrypt_password(vmdh
, pub_key
, pub_key_len
, pw
, pw_len
,
54 encpw
, &encpw_len
), "vmdh_encrypt_password");
56 is(encpw_len
, (size_t)16, "encrypted pw is 16 bytes");
61 int vmdh_40(int argc
, char *const *argv
)