summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_oaep.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_oaep.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_oaep.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_oaep.c b/src/lib/libcrypto/rsa/rsa_oaep.c
index 9be0f9be31..8585d7c3aa 100644
--- a/src/lib/libcrypto/rsa/rsa_oaep.c
+++ b/src/lib/libcrypto/rsa/rsa_oaep.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_oaep.c,v 1.23 2014/07/11 08:44:49 jsing Exp $ */ 1/* $OpenBSD: rsa_oaep.c,v 1.24 2014/10/22 13:02:04 jsing Exp $ */
2/* Written by Ulf Moeller. This software is distributed on an "AS IS" 2/* Written by Ulf Moeller. This software is distributed on an "AS IS"
3 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */ 3 basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. */
4 4
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <stdio.h> 21#include <stdio.h>
22#include <stdlib.h>
22#include <string.h> 23#include <string.h>
23 24
24#include <openssl/opensslconf.h> 25#include <openssl/opensslconf.h>
@@ -28,7 +29,6 @@
28#include <openssl/bn.h> 29#include <openssl/bn.h>
29#include <openssl/err.h> 30#include <openssl/err.h>
30#include <openssl/evp.h> 31#include <openssl/evp.h>
31#include <openssl/rand.h>
32#include <openssl/rsa.h> 32#include <openssl/rsa.h>
33#include <openssl/sha.h> 33#include <openssl/sha.h>
34 34
@@ -65,8 +65,7 @@ RSA_padding_add_PKCS1_OAEP(unsigned char *to, int tlen,
65 emlen - flen - 2 * SHA_DIGEST_LENGTH - 1); 65 emlen - flen - 2 * SHA_DIGEST_LENGTH - 1);
66 db[emlen - flen - SHA_DIGEST_LENGTH - 1] = 0x01; 66 db[emlen - flen - SHA_DIGEST_LENGTH - 1] = 0x01;
67 memcpy(db + emlen - flen - SHA_DIGEST_LENGTH, from, flen); 67 memcpy(db + emlen - flen - SHA_DIGEST_LENGTH, from, flen);
68 if (RAND_bytes(seed, SHA_DIGEST_LENGTH) <= 0) 68 arc4random_buf(seed, SHA_DIGEST_LENGTH);
69 return 0;
70 69
71 dbmask = malloc(emlen - SHA_DIGEST_LENGTH); 70 dbmask = malloc(emlen - SHA_DIGEST_LENGTH);
72 if (dbmask == NULL) { 71 if (dbmask == NULL) {