]> git.saurik.com Git - apple/security.git/blob - OSX/sec/Security/Regressions/secitem/si-73-secpasswordgenerate.c
Security-58286.251.4.tar.gz
[apple/security.git] / OSX / sec / Security / Regressions / secitem / si-73-secpasswordgenerate.c
1 //
2 // si-73-secpasswordgenerate.c
3 // sec
4 //
5
6 #include <stdio.h>
7 #include <Security/SecPasswordGenerate.h>
8 #include <utilities/SecCFRelease.h>
9 #include "Security_regressions.h"
10 #include <stdarg.h>
11
12 static void test_password_generate(bool ok, SecPasswordType type, int n,...)
13 {
14 va_list argp;
15 CFTypeRef key, value;
16 va_start(argp, n);
17 int i;
18
19 CFMutableDictionaryRef passwordRequirements = NULL;
20 CFStringRef password = NULL;
21 CFErrorRef error = NULL;
22
23 passwordRequirements = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
24
25 for(i=0; i<n; i++) {
26 key = va_arg(argp, CFTypeRef);
27 value = va_arg(argp, CFTypeRef);
28 CFDictionaryAddValue(passwordRequirements, key, value);
29 }
30
31 password = SecPasswordGenerate(type, &error, passwordRequirements);
32
33 if(ok) {
34 isnt(password, NULL);
35 is(error, NULL);
36 if((password==NULL) || (error!=NULL))
37 {
38 printf("Oh no!\n");
39 }
40 } else {
41 is(password, NULL);
42 isnt(error, NULL);
43 }
44
45 CFReleaseSafe(password);
46 CFReleaseSafe(passwordRequirements);
47 CFReleaseSafe(error);
48
49 va_end(argp);
50 }
51
52 static void tests(void)
53 {
54 CFErrorRef error = NULL;
55 CFStringRef password = NULL;
56
57 //Create dictionary for common required character sets
58 CFCharacterSetRef uppercaseLetterCharacterSet = CFCharacterSetGetPredefined(kCFCharacterSetUppercaseLetter);
59 CFCharacterSetRef lowercaseLetterCharacterSet = CFCharacterSetGetPredefined(kCFCharacterSetLowercaseLetter);
60 CFCharacterSetRef decimalDigitCharacterSet = CFCharacterSetGetPredefined(kCFCharacterSetDecimalDigit);
61
62 CFMutableArrayRef requiredCharacterSets = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
63 CFArrayAppendValue(requiredCharacterSets, uppercaseLetterCharacterSet);
64 CFArrayAppendValue(requiredCharacterSets, lowercaseLetterCharacterSet);
65 CFArrayAppendValue(requiredCharacterSets, decimalDigitCharacterSet);
66
67 //Create common CFNumbers
68 int i2 = 2;
69 int i4 = 4;
70 int i5 = 5;
71 int i6 = 6;
72 int i12 = 12;
73 int i19 = 19;
74 int i20 = 20;
75 int i23 = 23;
76 int i24 = 24;
77 int i32 = 32;
78 int i56 = 56;
79
80 CFNumberRef cf2 = CFNumberCreate(NULL, kCFNumberIntType, &i2);
81 CFNumberRef cf4 = CFNumberCreate(NULL, kCFNumberIntType, &i4);
82 CFNumberRef cf5 = CFNumberCreate(NULL, kCFNumberIntType, &i5);
83 CFNumberRef cf6 = CFNumberCreate(NULL, kCFNumberIntType, &i6);
84 CFNumberRef cf12 = CFNumberCreate(NULL, kCFNumberIntType, &i12);
85 CFNumberRef cf19 = CFNumberCreate(NULL, kCFNumberIntType, &i19);
86 CFNumberRef cf20 = CFNumberCreate(NULL, kCFNumberIntType, &i20);
87 CFNumberRef cf23 = CFNumberCreate(NULL, kCFNumberIntType, &i23);
88 CFNumberRef cf24 = CFNumberCreate(NULL, kCFNumberIntType, &i24);
89 CFNumberRef cf32 = CFNumberCreate(NULL, kCFNumberIntType, &i32);
90 CFNumberRef cf56 = CFNumberCreate(NULL, kCFNumberIntType, &i56);
91
92
93 //generates random digit string
94 is(true, (password = SecPasswordCreateWithRandomDigits(8, &error)) != NULL) ;
95 CFReleaseNull(password);
96
97 is(true, (password = SecPasswordCreateWithRandomDigits(7, &error)) != NULL) ;
98 CFReleaseNull(password);
99
100 is(true, (password = SecPasswordCreateWithRandomDigits(6, &error)) != NULL) ;
101 CFReleaseNull(password);
102
103 is(true, (password = SecPasswordCreateWithRandomDigits(5, &error)) != NULL) ;
104 CFReleaseNull(password);
105
106 //test default PIN
107 test_password_generate(true, kSecPasswordTypePIN, 1,
108 kSecPasswordDefaultForType, CFSTR("true"));
109
110 //test default icloud recovery code
111 test_password_generate(true, kSecPasswordTypeiCloudRecovery, 1,
112 kSecPasswordDefaultForType, CFSTR("true"));
113
114 //test default wifi
115 test_password_generate(true, kSecPasswordTypeWifi, 1,
116 kSecPasswordDefaultForType, CFSTR("true"));
117
118 //test default safari
119 test_password_generate(true, kSecPasswordTypeSafari, 1,
120 kSecPasswordDefaultForType, CFSTR("true"));
121
122 //test icloud recovery code generation
123 test_password_generate(true, kSecPasswordTypeiCloudRecovery, 1,
124 kSecPasswordDefaultForType, CFSTR("true"));
125
126 //dictionary setup
127 test_password_generate(true, kSecPasswordTypeWifi, 4,
128 kSecPasswordMinLengthKey, cf20,
129 kSecPasswordMaxLengthKey, cf32,
130 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
131 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
132
133 //test with max == min
134 test_password_generate(true, kSecPasswordTypeWifi, 4,
135 kSecPasswordMinLengthKey, cf24,
136 kSecPasswordMaxLengthKey, cf24,
137 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
138 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
139
140 //test disallowed characters
141 test_password_generate(true, kSecPasswordTypeWifi, 5,
142 kSecPasswordMinLengthKey, cf24,
143 kSecPasswordMaxLengthKey, cf24,
144 kSecPasswordAllowedCharactersKey, CFSTR("abcdefghijklmnopqrstuvwxyz0123456789"),
145 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
146 kSecPasswordDisallowedCharacters, CFSTR("aidfl"));
147
148
149 //test can't start with characters
150 test_password_generate(true, kSecPasswordTypeWifi, 5,
151 kSecPasswordMinLengthKey, cf24,
152 kSecPasswordMaxLengthKey, cf56,
153 kSecPasswordAllowedCharactersKey, CFSTR("diujk"),
154 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
155 kSecPasswordCantStartWithChars, CFSTR("d"));
156
157 //test can't end with characters
158 test_password_generate(true, kSecPasswordTypeWifi, 5,
159 kSecPasswordMinLengthKey, cf24,
160 kSecPasswordMaxLengthKey, cf56,
161 kSecPasswordAllowedCharactersKey, CFSTR("diujk89"),
162 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
163 kSecPasswordCantEndWithChars, CFSTR("d"));
164
165 //test 4 digit pin generation
166 for(int i =0 ; i< 100; i++){
167 password = SecPasswordGenerate(kSecPasswordTypePIN, &error, NULL);
168 isnt(password, NULL);
169 ok(error == NULL);
170
171 error = NULL;
172 CFReleaseNull(password);
173 }
174
175 //test 6 digit pin
176 test_password_generate(true, kSecPasswordTypePIN, 2,
177 kSecPasswordMinLengthKey, cf4,
178 kSecPasswordMaxLengthKey, cf6);
179 //test 5 digit pin
180 test_password_generate(true, kSecPasswordTypePIN, 2,
181 kSecPasswordMinLengthKey, cf5,
182 kSecPasswordMaxLengthKey, cf6);
183
184 //test safari password
185 test_password_generate(true, kSecPasswordTypeSafari, 4,
186 kSecPasswordMinLengthKey, cf20,
187 kSecPasswordMaxLengthKey, cf32,
188 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
189 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
190
191 //test flexible group size and number of groups in the password
192 //test safari password
193 test_password_generate(true, kSecPasswordTypeSafari, 7,
194 kSecPasswordMinLengthKey, cf12,
195 kSecPasswordMaxLengthKey, cf19,
196 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
197 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
198 kSecPasswordGroupSize, cf5,
199 kSecPasswordNumberOfGroups, cf23,
200 kSecPasswordSeparator, CFSTR("*"));
201
202 //test at least N characters
203 //test safari password
204 CFMutableDictionaryRef atLeast = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
205 CFDictionaryAddValue(atLeast, kSecPasswordCharacters, CFSTR("ab"));
206 CFDictionaryAddValue(atLeast, kSecPasswordCharacterCount, cf5);
207
208 test_password_generate(true, kSecPasswordTypeSafari, 5,
209 kSecPasswordMinLengthKey, cf12,
210 kSecPasswordMaxLengthKey, cf19,
211 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
212 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
213 kSecPasswordContainsAtLeastNSpecificCharacters, atLeast);
214
215 CFReleaseSafe(atLeast);
216
217 //test no More than N characters
218 //test safari password
219 CFMutableDictionaryRef noMoreThan = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
220 CFDictionaryAddValue(noMoreThan, kSecPasswordCharacters, CFSTR("ab"));
221 CFDictionaryAddValue(noMoreThan, kSecPasswordCharacterCount, cf5);
222
223 test_password_generate(true, kSecPasswordTypeSafari, 5,
224 kSecPasswordMinLengthKey, cf12,
225 kSecPasswordMaxLengthKey, cf19,
226 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
227 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
228 kSecPasswordContainsNoMoreThanNSpecificCharacters, noMoreThan);
229
230 CFReleaseSafe(noMoreThan);
231
232 //test identical character threshold
233 //test safari password
234 test_password_generate(true, kSecPasswordTypeSafari, 5,
235 kSecPasswordMinLengthKey, cf12,
236 kSecPasswordMaxLengthKey, cf19,
237 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
238 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
239 kSecPasswordContainsNoMoreThanNConsecutiveIdenticalCharacters, cf2);
240
241
242
243 /////////////////now test all the error cases
244 //test with no required characters
245 CFMutableArrayRef emptyCharacterSets = CFArrayCreateMutable(NULL, 0, &kCFTypeArrayCallBacks);
246
247 test_password_generate(false, kSecPasswordTypeWifi, 4,
248 kSecPasswordMinLengthKey, cf24,
249 kSecPasswordMaxLengthKey, cf32,
250 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
251 kSecPasswordRequiredCharactersKey, emptyCharacterSets);
252
253 CFReleaseSafe(emptyCharacterSets);
254
255 //test with no allowed characters
256 test_password_generate(false, kSecPasswordTypeWifi, 4,
257 kSecPasswordMinLengthKey, cf24,
258 kSecPasswordMaxLengthKey, cf32,
259 kSecPasswordAllowedCharactersKey, CFSTR(""),
260 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
261
262 //test with min > max
263 test_password_generate(false, kSecPasswordTypeWifi, 4,
264 kSecPasswordMinLengthKey, cf32,
265 kSecPasswordMaxLengthKey, cf24,
266 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
267 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
268
269 //test by ommitting dictionary parameters
270
271 //omit max length
272 test_password_generate(false, kSecPasswordTypeWifi, 3,
273 kSecPasswordMinLengthKey, cf20,
274 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
275 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
276
277 //omit min length
278 test_password_generate(false, kSecPasswordTypeWifi, 3,
279 kSecPasswordMaxLengthKey, cf32,
280 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
281 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
282
283 //omit allowed characters
284 test_password_generate(false, kSecPasswordTypeWifi, 3,
285 kSecPasswordMinLengthKey, cf20,
286 kSecPasswordMaxLengthKey, cf32,
287 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
288
289 //omit required characters
290 test_password_generate(false, kSecPasswordTypeWifi, 3,
291 kSecPasswordMinLengthKey, cf20,
292 kSecPasswordMaxLengthKey, cf32,
293 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"));
294
295
296 //pass in wrong type for min
297 test_password_generate(false, kSecPasswordTypeWifi, 4,
298 kSecPasswordMinLengthKey, CFSTR("20"),
299 kSecPasswordMaxLengthKey, cf32,
300 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
301 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
302
303 //pass in wrong type for max
304 test_password_generate(false, kSecPasswordTypeWifi, 4,
305 kSecPasswordMinLengthKey, cf20,
306 kSecPasswordMaxLengthKey, CFSTR("32"),
307 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
308 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
309
310 //pass in wrong type for allowed
311 test_password_generate(false, kSecPasswordTypeWifi, 4,
312 kSecPasswordMinLengthKey, cf20,
313 kSecPasswordMaxLengthKey, cf32,
314 kSecPasswordAllowedCharactersKey, requiredCharacterSets,
315 kSecPasswordRequiredCharactersKey, requiredCharacterSets);
316
317 //pass in wrong type for required
318 test_password_generate(false, kSecPasswordTypeWifi, 4,
319 kSecPasswordMinLengthKey, cf20,
320 kSecPasswordMaxLengthKey, cf32,
321 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
322 kSecPasswordRequiredCharactersKey, CFSTR("abcdsefw2345"));
323
324 //pass in wrong type for no less than
325 test_password_generate(false, kSecPasswordTypeWifi, 5,
326 kSecPasswordMinLengthKey, cf20,
327 kSecPasswordMaxLengthKey, cf32,
328 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
329 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
330 kSecPasswordContainsAtLeastNSpecificCharacters, CFSTR("hehe"));
331
332
333 //pass in wrong type for no more than
334 test_password_generate(false, kSecPasswordTypeWifi, 5,
335 kSecPasswordMinLengthKey, cf20,
336 kSecPasswordMaxLengthKey, cf32,
337 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
338 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
339 kSecPasswordContainsNoMoreThanNSpecificCharacters, CFSTR("hehe"));
340
341 //pass in wrong disallowed characters
342 test_password_generate(false, kSecPasswordTypeWifi, 5,
343 kSecPasswordMinLengthKey, cf20,
344 kSecPasswordMaxLengthKey, cf32,
345 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
346 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
347 kSecPasswordDisallowedCharacters, requiredCharacterSets);
348
349 //pass in wrong type for no more than's dictionary
350 CFMutableDictionaryRef wrongCount = CFDictionaryCreateMutable(NULL, 0, NULL, NULL);
351 CFDictionaryAddValue(wrongCount, kSecPasswordCharacters, CFSTR("lkj"));
352 CFDictionaryAddValue(wrongCount, kSecPasswordCharacterCount, CFSTR("sdf"));
353
354 test_password_generate(false, kSecPasswordTypeWifi, 5,
355 kSecPasswordMinLengthKey, cf20,
356 kSecPasswordMaxLengthKey, cf32,
357 kSecPasswordAllowedCharactersKey, CFSTR("abcdsefw2345"),
358 kSecPasswordRequiredCharactersKey, requiredCharacterSets,
359 kSecPasswordContainsNoMoreThanNSpecificCharacters, wrongCount);
360
361 CFReleaseSafe(wrongCount);
362
363
364 //release CF objects:
365 CFReleaseSafe(cf2);
366 CFReleaseSafe(cf4);
367 CFReleaseSafe(cf5);
368 CFReleaseSafe(cf6);
369 CFReleaseSafe(cf12);
370 CFReleaseSafe(cf19);
371 CFReleaseSafe(cf20);
372 CFReleaseSafe(cf23);
373 CFReleaseSafe(cf24);
374 CFReleaseSafe(cf32);
375 CFReleaseSafe(cf56);
376
377 CFReleaseSafe(requiredCharacterSets);
378
379
380 // Weak Passwords tests
381 password = CFSTR("Apple1?");
382 isnt(true, SecPasswordIsPasswordWeak(password));
383 CFRelease(password);
384
385 password = CFSTR("Singhal190");
386 isnt(true, SecPasswordIsPasswordWeak(password));
387 CFRelease(password);
388
389 password = CFSTR("1Hollow2");
390 isnt(true, SecPasswordIsPasswordWeak(password));
391 CFRelease(password);
392
393 password = CFSTR("1Hollow/");
394 isnt(true, SecPasswordIsPasswordWeak(password));
395 CFRelease(password);
396
397 password = CFSTR("baj/paj1");
398 isnt(true, SecPasswordIsPasswordWeak(password));
399 CFRelease(password);
400
401 password = CFSTR("Zaxs1009?");
402 isnt(true, SecPasswordIsPasswordWeak(password));
403 CFRelease(password);
404
405 password = CFSTR("6666");
406 isnt(false, SecPasswordIsPasswordWeak(password));
407 CFRelease(password);
408
409 password = CFSTR("123456");
410 isnt(false, SecPasswordIsPasswordWeak(password));
411 CFRelease(password);
412
413 password = CFSTR("654321");
414 isnt(false, SecPasswordIsPasswordWeak(password));
415 CFRelease(password);
416
417 password = CFSTR("A");
418 isnt(false, SecPasswordIsPasswordWeak(password));
419 CFRelease(password);
420
421 password = CFSTR("password");
422 isnt(true, SecPasswordIsPasswordWeak(password));
423 CFRelease(password);
424
425 password = CFSTR("password1");
426 isnt(true, SecPasswordIsPasswordWeak(password));
427 CFRelease(password);
428
429 password = CFSTR("P@ssw0rd");
430 isnt(true, SecPasswordIsPasswordWeak(password));
431 CFRelease(password);
432
433 password = CFSTR("facebook!{}");
434 isnt(true, SecPasswordIsPasswordWeak(password));
435 CFRelease(password);
436
437 password = CFSTR("12345678");
438 isnt(false, SecPasswordIsPasswordWeak(password));
439 CFRelease(password);
440
441 bool isSimple = false;
442
443 password = CFSTR("Apple1?");
444 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
445 CFRelease(password);
446
447 password = CFSTR("Singhal190");
448 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
449 CFRelease(password);
450
451 password = CFSTR("1Hollow2");
452 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
453 CFRelease(password);
454
455 password = CFSTR("1Hollow/");
456 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
457 CFRelease(password);
458
459 password = CFSTR("baj/paj1");
460 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
461 CFRelease(password);
462
463 password = CFSTR("Zaxs1009?");
464 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
465 CFRelease(password);
466
467 password = CFSTR("6666");
468 is(true, SecPasswordIsPasswordWeak2(isSimple, password));
469 CFRelease(password);
470
471 password = CFSTR("1235");
472 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
473 CFRelease(password);
474
475 isSimple = true;
476 password = CFSTR("6666");
477 is(true, SecPasswordIsPasswordWeak2(isSimple, password));
478 CFRelease(password);
479
480 password = CFSTR("1235");
481 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
482 CFRelease(password);
483
484 isSimple = false;
485 password = CFSTR("123456");
486 is(true, SecPasswordIsPasswordWeak2(isSimple, password));
487 CFRelease(password);
488
489 password = CFSTR("654321");
490 is(true, SecPasswordIsPasswordWeak2(isSimple, password));
491 CFRelease(password);
492
493 password = CFSTR("1577326");
494 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
495 CFRelease(password);
496
497 password = CFSTR("A");
498 is(true, SecPasswordIsPasswordWeak2(isSimple, password));
499 CFRelease(password);
500
501 password = CFSTR("password");
502 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
503 CFRelease(password);
504
505 password = CFSTR("password1");
506 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
507 CFRelease(password);
508
509 password = CFSTR("P@ssw0rd");
510 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
511 CFRelease(password);
512
513 password = CFSTR("facebook!{}");
514 is(false, SecPasswordIsPasswordWeak2(isSimple, password));
515 CFRelease(password);
516
517 password = CFSTR("12345678");
518 is(true, SecPasswordIsPasswordWeak2(isSimple, password));
519 CFRelease(password);
520
521 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("666666")));
522 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("123456")));
523 is(false, SecPasswordIsPasswordWeak2(true, CFSTR("666166")));
524 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("525252")));
525 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("525252")));
526 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("52525")));
527
528 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("098765")));
529 is(true, SecPasswordIsPasswordWeak(CFSTR("0987")));
530
531 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("122222")));
532 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("222221")));
533 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("222114")));
534 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("221114")));
535 is(false, SecPasswordIsPasswordWeak2(false, CFSTR("221144")));
536
537 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("123456")));
538 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("666666")));
539 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("111111")));
540 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("520520")));
541 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("121212")));
542 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("000000")));
543 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("654321")));
544
545 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("123456")));
546 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("666666")));
547 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("111111")));
548 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("520520")));
549 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("121212")));
550 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("000000")));
551 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("654321")));
552
553 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("030379")));
554 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("101471")));
555 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("112233")));
556 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("123123")));
557 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("123321")));
558
559 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("123654")));
560 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("147258")));
561 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("159753")));
562 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("321654")));
563 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("520131")));
564 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("520520")));
565 is(true, SecPasswordIsPasswordWeak2(true, CFSTR("789456")));
566
567 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("123654")));
568 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("147258")));
569 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("159753")));
570 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("321654")));
571 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("520131")));
572 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("520520")));
573 is(true, SecPasswordIsPasswordWeak2(false, CFSTR("789456")));
574 }
575
576 int si_73_secpasswordgenerate(int argc, char *const *argv)
577 {
578 plan_tests(348);
579 tests();
580
581 return 0;
582 }