]>
Commit | Line | Data |
---|---|---|
d2e9e320 RS |
1 | /* |
2 | * Copyright 1998-2016 The OpenSSL Project Authors. All Rights Reserved. | |
981b87f7 | 3 | * |
d2e9e320 RS |
4 | * Licensed under the OpenSSL license (the "License"). You may not use |
5 | * this file except in compliance with the License. You can obtain a copy | |
6 | * in the file LICENSE in the source distribution or at | |
7 | * https://www.openssl.org/source/license.html | |
d02b48c6 RE |
8 | */ |
9 | ||
981b87f7 UM |
10 | #include <openssl/des.h> |
11 | #include <openssl/rand.h> | |
d02b48c6 | 12 | |
c2e4f17c | 13 | int DES_random_key(DES_cblock *ret) |
0f113f3e MC |
14 | { |
15 | do { | |
16 | if (RAND_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) | |
17 | return (0); | |
18 | } while (DES_is_weak_key(ret)); | |
19 | DES_set_odd_parity(ret); | |
208fb891 | 20 | return 1; |
0f113f3e | 21 | } |