projects
/
crypto.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added support for default hash functions in all PKCS algorithm schemes.
[crypto.git]
/
lib
/
silccrypt
/
rsa.c
diff --git
a/lib/silccrypt/rsa.c
b/lib/silccrypt/rsa.c
index e58bca153c741c8c02b0d9d01b4f37de32c878c6..cc5e09885906813975be848d2d2e8a6b819d2b19 100644
(file)
--- a/
lib/silccrypt/rsa.c
+++ b/
lib/silccrypt/rsa.c
@@
-5,7
+5,7
@@
Author: Pekka Riikonen <priikone@silcnet.org>
Author: Pekka Riikonen <priikone@silcnet.org>
- Copyright (C) 1997 - 200
6
Pekka Riikonen
+ Copyright (C) 1997 - 200
8
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
@@
-46,7
+46,6
@@
everything else too about cryptography.
*/
everything else too about cryptography.
*/
-/* $Id$ */
/*
ChangeLog
/*
ChangeLog
@@
-74,15
+73,15
@@
starting point in key generation.
*/
starting point in key generation.
*/
-#include "silc.h"
+#include "silc
crypto
.h"
#include "rsa.h"
/* Generates RSA public and private keys. Primes p and q that are used
to compute the modulus n has to be generated before calling this. They
are then sent as argument for the function. */
#include "rsa.h"
/* Generates RSA public and private keys. Primes p and q that are used
to compute the modulus n has to be generated before calling this. They
are then sent as argument for the function. */
-SilcBool rsa_generate_keys(SilcUInt32 bits, SilcMPInt *p, SilcMPInt *q,
- void **ret_public_key, void **ret_private_key)
+SilcBool
silc_
rsa_generate_keys(SilcUInt32 bits, SilcMPInt *p, SilcMPInt *q,
+
void **ret_public_key, void **ret_private_key)
{
RsaPublicKey *pubkey;
RsaPrivateKey *privkey;
{
RsaPublicKey *pubkey;
RsaPrivateKey *privkey;
@@
-98,6
+97,10
@@
SilcBool rsa_generate_keys(SilcUInt32 bits, SilcMPInt *p, SilcMPInt *q,
if (!privkey)
return FALSE;
if (!privkey)
return FALSE;
+ /* Default hash shall be sha1 */
+ silc_hash_alloc("sha1", &pubkey->hash);
+ silc_hash_alloc("sha1", &privkey->hash);
+
/* Initialize variables */
silc_mp_init(&privkey->n);
silc_mp_init(&privkey->e);
/* Initialize variables */
silc_mp_init(&privkey->n);
silc_mp_init(&privkey->e);
@@
-167,8
+170,8
@@
SilcBool rsa_generate_keys(SilcUInt32 bits, SilcMPInt *p, SilcMPInt *q,
/* RSA public key operation */
/* RSA public key operation */
-SilcBool rsa_public_operation(RsaPublicKey *key, SilcMPInt *src,
- SilcMPInt *dst)
+SilcBool
silc_
rsa_public_operation(RsaPublicKey *key, SilcMPInt *src,
+
SilcMPInt *dst)
{
/* dst = src ^ e mod n */
silc_mp_pow_mod(dst, src, &key->e, &key->n);
{
/* dst = src ^ e mod n */
silc_mp_pow_mod(dst, src, &key->e, &key->n);
@@
-177,8
+180,8
@@
SilcBool rsa_public_operation(RsaPublicKey *key, SilcMPInt *src,
/* RSA private key operation */
/* RSA private key operation */
-SilcBool rsa_private_operation(RsaPrivateKey *key, SilcMPInt *src,
- SilcMPInt *dst)
+SilcBool
silc_
rsa_private_operation(RsaPrivateKey *key, SilcMPInt *src,
+
SilcMPInt *dst)
{
SilcMPInt tmp;
{
SilcMPInt tmp;