diff options
Diffstat (limited to 'src/lib/libcrypto/rsa/rsa_null.c')
-rw-r--r-- | src/lib/libcrypto/rsa/rsa_null.c | 87 |
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 | ||
95 | const RSA_METHOD *RSA_null_method(void) | 96 | const RSA_METHOD * |
96 | { | 97 | RSA_null_method(void) |
97 | return(&rsa_null_meth); | 98 | { |
98 | } | 99 | return &rsa_null_meth; |
100 | } | ||
99 | 101 | ||
100 | static int RSA_null_public_encrypt(int flen, const unsigned char *from, | 102 | static int |
101 | unsigned char *to, RSA *rsa, int padding) | 103 | RSA_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 | ||
107 | static int RSA_null_private_encrypt(int flen, const unsigned char *from, | 111 | static int |
108 | unsigned char *to, RSA *rsa, int padding) | 112 | RSA_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 | ||
114 | static int RSA_null_private_decrypt(int flen, const unsigned char *from, | 120 | static int |
115 | unsigned char *to, RSA *rsa, int padding) | 121 | RSA_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 | ||
121 | static int RSA_null_public_decrypt(int flen, const unsigned char *from, | 129 | static int |
122 | unsigned char *to, RSA *rsa, int padding) | 130 | RSA_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 */ |
129 | static int RSA_null_mod_exp(BIGNUM *r0, BIGNUM *I, RSA *rsa) | 139 | static int |
130 | { | 140 | RSA_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 | ||
136 | static int RSA_null_init(RSA *rsa) | 147 | static int |
137 | { | 148 | RSA_null_init(RSA *rsa) |
138 | return(1); | 149 | { |
139 | } | 150 | return 1; |
151 | } | ||
140 | 152 | ||
141 | static int RSA_null_finish(RSA *rsa) | 153 | static int |
142 | { | 154 | RSA_null_finish(RSA *rsa) |
143 | return(1); | 155 | { |
144 | } | 156 | return 1; |
157 | } | ||