projects
/
silc.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added preliminary Symbian support.
[silc.git]
/
lib
/
silccrypt
/
silcpkcs1.c
diff --git
a/lib/silccrypt/silcpkcs1.c
b/lib/silccrypt/silcpkcs1.c
index 0094e13089bf348da224efe520ac4d600be0ad84..e3c6b68f38f75e305728f57c0d0fed4f7c1dd494 100644
(file)
--- a/
lib/silccrypt/silcpkcs1.c
+++ b/
lib/silccrypt/silcpkcs1.c
@@
-4,7
+4,7
@@
Author: Pekka Riikonen <priikone@silcnet.org>
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 2003 - 200
6
Pekka Riikonen
+ Copyright (C) 2003 - 200
7
Pekka Riikonen
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@
-74,14
+74,15
@@
SilcBool silc_pkcs1_encode(SilcPkcs1BlockType bt,
case SILC_PKCS1_BT_PUB:
/* Encryption */
case SILC_PKCS1_BT_PUB:
/* Encryption */
+ if (!rng) {
+ SILC_LOG_ERROR(("Cannot encrypt: random number generator not provided"));
+ return FALSE;
+ }
/* It is guaranteed this routine does not return zero byte. */
/* It is guaranteed this routine does not return zero byte. */
- if (rng)
- for (i = 2; i < padlen; i++)
- dest_data[i] = silc_rng_get_byte_fast(rng);
- else
- for (i = 2; i < padlen; i++)
- dest_data[i] = silc_rng_global_get_byte_fast();
+ for (i = 2; i < padlen; i++)
+ dest_data[i] = silc_rng_get_byte_fast(rng);
+
break;
}
break;
}
@@
-473,7
+474,8
@@
SilcBool silc_pkcs1_encrypt(void *public_key,
SilcUInt32 src_len,
unsigned char *dst,
SilcUInt32 dst_size,
SilcUInt32 src_len,
unsigned char *dst,
SilcUInt32 dst_size,
- SilcUInt32 *ret_dst_len)
+ SilcUInt32 *ret_dst_len,
+ SilcRng rng)
{
RsaPublicKey *key = public_key;
SilcMPInt mp_tmp;
{
RsaPublicKey *key = public_key;
SilcMPInt mp_tmp;
@@
-488,7
+490,7
@@
SilcBool silc_pkcs1_encrypt(void *public_key,
/* Pad data */
if (!silc_pkcs1_encode(SILC_PKCS1_BT_PUB, src, src_len,
/* Pad data */
if (!silc_pkcs1_encode(SILC_PKCS1_BT_PUB, src, src_len,
- padded, len,
NULL
))
+ padded, len,
rng
))
return FALSE;
silc_mp_init(&mp_tmp);
return FALSE;
silc_mp_init(&mp_tmp);