summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/rsa/rsa_null.c
diff options
context:
space:
mode:
authormiod <>2014-07-09 08:20:08 +0000
committermiod <>2014-07-09 08:20:08 +0000
commit8cbe58f0d357b14b0ce292d336469d0554a567bc (patch)
tree07872a7ef59da8cea3b3b4a101fa3580e4d658c0 /src/lib/libcrypto/rsa/rsa_null.c
parentbc1209e388500a20f5e75cab35d1b543ce0bbe74 (diff)
downloadopenbsd-8cbe58f0d357b14b0ce292d336469d0554a567bc.tar.gz
openbsd-8cbe58f0d357b14b0ce292d336469d0554a567bc.tar.bz2
openbsd-8cbe58f0d357b14b0ce292d336469d0554a567bc.zip
KNF
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_null.c')
-rw-r--r--src/lib/libcrypto/rsa/rsa_null.c87
1 files changed, 50 insertions, 37 deletions
diff --git a/src/lib/libcrypto/rsa/rsa_null.c b/src/lib/libcrypto/rsa/rsa_null.c
index c4404fbe44..54f1cabc74 100644
--- a/src/lib/libcrypto/rsa/rsa_null.c
+++ b/src/lib/libcrypto/rsa/rsa_null.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: rsa_null.c,v 1.6 2014/06/12 15:49:30 deraadt Exp $ */ 1/* $OpenBSD: rsa_null.c,v 1.7 2014/07/09 08:20:08 miod Exp $ */
2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL 2/* Written by Dr Stephen N Henson (steve@openssl.org) for the OpenSSL
3 * project 1999. 3 * project 1999.
4 */ 4 */
@@ -62,7 +62,8 @@
62#include <openssl/rsa.h> 62#include <openssl/rsa.h>
63#include <openssl/rand.h> 63#include <openssl/rand.h>
64 64
65/* This is a dummy RSA implementation that just returns errors when called. 65/*
66 * This is a dummy RSA implementation that just returns errors when called.
66 * It is designed to allow some RSA functions to work while stopping those 67 * It is designed to allow some RSA functions to work while stopping those
67 * covered by the RSA patent. That is RSA, encryption, decryption, signing 68 * covered by the RSA patent. That is RSA, encryption, decryption, signing
68 * and verify is not allowed but RSA key generation, key checking and other 69 * and verify is not allowed but RSA key generation, key checking and other
@@ -92,53 +93,65 @@ static RSA_METHOD rsa_null_meth = {
92 .finish = RSA_null_finish, 93 .finish = RSA_null_finish,
93}; 94};
94 95
95const RSA_METHOD *RSA_null_method(void) 96const RSA_METHOD *
96 { 97RSA_null_method(void)
97 return(&rsa_null_meth); 98{
98 } 99 return &rsa_null_meth;
100}
99 101
100static int RSA_null_public_encrypt(int flen, const unsigned char *from, 102static int
101 unsigned char *to, RSA *rsa, int padding) 103RSA_null_public_encrypt(int flen, const unsigned char *from, unsigned char *to,
102 { 104 RSA *rsa, int padding)
103 RSAerr(RSA_F_RSA_NULL_PUBLIC_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); 105{
106 RSAerr(RSA_F_RSA_NULL_PUBLIC_ENCRYPT,
107 RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
104 return -1; 108 return -1;
105 } 109}
106 110
107static int RSA_null_private_encrypt(int flen, const unsigned char *from, 111static int
108 unsigned char *to, RSA *rsa, int padding) 112RSA_null_private_encrypt(int flen, const unsigned char *from, unsigned char *to,
109 { 113 RSA *rsa, int padding)
110 RSAerr(RSA_F_RSA_NULL_PRIVATE_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); 114{
115 RSAerr(RSA_F_RSA_NULL_PRIVATE_ENCRYPT,
116 RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
111 return -1; 117 return -1;
112 } 118}
113 119
114static int RSA_null_private_decrypt(int flen, const unsigned char *from, 120static int
115 unsigned char *to, RSA *rsa, int padding) 121RSA_null_private_decrypt(int flen, const unsigned char *from, unsigned char *to,
116 { 122 RSA *rsa, int padding)
117 RSAerr(RSA_F_RSA_NULL_PRIVATE_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); 123{
124 RSAerr(RSA_F_RSA_NULL_PRIVATE_DECRYPT,
125 RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
118 return -1; 126 return -1;
119 } 127}
120 128
121static int RSA_null_public_decrypt(int flen, const unsigned char *from, 129static int
122 unsigned char *to, RSA *rsa, int padding) 130RSA_null_public_decrypt(int flen, const unsigned char *from, unsigned char *to,
123 { 131 RSA *rsa, int padding)
124 RSAerr(RSA_F_RSA_NULL_PUBLIC_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); 132{
133 RSAerr(RSA_F_RSA_NULL_PUBLIC_DECRYPT,
134 RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
125 return -1; 135 return -1;
126 } 136}
127 137
128#if 0 /* not currently used */ 138#if 0 /* not currently used */
129static int RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) 139static int
130 { 140RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa)
141{
131 ...err(RSA_F_RSA_NULL_MOD_EXP, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED); 142 ...err(RSA_F_RSA_NULL_MOD_EXP, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
132 return -1; 143 return -1;
133 } 144}
134#endif 145#endif
135 146
136static int RSA_null_init(RSA *rsa) 147static int
137 { 148RSA_null_init(RSA *rsa)
138 return(1); 149{
139 } 150 return 1;
151}
140 152
141static int RSA_null_finish(RSA *rsa) 153static int
142 { 154RSA_null_finish(RSA *rsa)
143 return(1); 155{
144 } 156 return 1;
157}