]>
Commit | Line | Data |
---|---|---|
d2e9e320 | 1 | /* |
c4d3c19b | 2 | * Copyright 1998-2018 The OpenSSL Project Authors. All Rights Reserved. |
981b87f7 | 3 | * |
2d48d5dd | 4 | * Licensed under the Apache License 2.0 (the "License"). You may not use |
d2e9e320 RS |
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 { | |
4cffafe9 | 16 | if (RAND_priv_bytes((unsigned char *)ret, sizeof(DES_cblock)) != 1) |
26a7d938 | 17 | return 0; |
0f113f3e MC |
18 | } while (DES_is_weak_key(ret)); |
19 | DES_set_odd_parity(ret); | |
208fb891 | 20 | return 1; |
0f113f3e | 21 | } |