source: EcnlProtoTool/trunk/openssl-1.1.0e/crypto/rsa/rsa_null.c

Last change on this file was 331, checked in by coas-nagasima, 6 years ago

prototoolに関連するプロジェクトをnewlibからmuslを使うよう変更・更新
ntshellをnewlibの下位の実装から、muslのsyscallの実装に変更・更新
以下のOSSをアップデート
・mruby-1.3.0
・musl-1.1.18
・onigmo-6.1.3
・tcc-0.9.27
以下のOSSを追加
・openssl-1.1.0e
・curl-7.57.0
・zlib-1.2.11
以下のmrbgemsを追加
・iij/mruby-digest
・iij/mruby-env
・iij/mruby-errno
・iij/mruby-iijson
・iij/mruby-ipaddr
・iij/mruby-mock
・iij/mruby-require
・iij/mruby-tls-openssl

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-csrc
File size: 2.9 KB
Line 
1/*
2 * Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
3 *
4 * Licensed under the OpenSSL license (the "License"). You may not use
5 * this file except in compliance with the License. You can obtain a copy
6 * in the file LICENSE in the source distribution or at
7 * https://www.openssl.org/source/license.html
8 */
9
10#include <stdio.h>
11#include "internal/cryptlib.h"
12#include <openssl/bn.h>
13#include "rsa_locl.h"
14
15/*
16 * This is a dummy RSA implementation that just returns errors when called.
17 * It is designed to allow some RSA functions to work while stopping those
18 * covered by the RSA patent. That is RSA, encryption, decryption, signing
19 * and verify is not allowed but RSA key generation, key checking and other
20 * operations (like storing RSA keys) are permitted.
21 */
22
23static int RSA_null_public_encrypt(int flen, const unsigned char *from,
24 unsigned char *to, RSA *rsa, int padding);
25static int RSA_null_private_encrypt(int flen, const unsigned char *from,
26 unsigned char *to, RSA *rsa, int padding);
27static int RSA_null_public_decrypt(int flen, const unsigned char *from,
28 unsigned char *to, RSA *rsa, int padding);
29static int RSA_null_private_decrypt(int flen, const unsigned char *from,
30 unsigned char *to, RSA *rsa, int padding);
31static int RSA_null_init(RSA *rsa);
32static int RSA_null_finish(RSA *rsa);
33static RSA_METHOD rsa_null_meth = {
34 "Null RSA",
35 RSA_null_public_encrypt,
36 RSA_null_public_decrypt,
37 RSA_null_private_encrypt,
38 RSA_null_private_decrypt,
39 NULL,
40 NULL,
41 RSA_null_init,
42 RSA_null_finish,
43 0,
44 NULL,
45 NULL,
46 NULL,
47 NULL
48};
49
50const RSA_METHOD *RSA_null_method(void)
51{
52 return (&rsa_null_meth);
53}
54
55static int RSA_null_public_encrypt(int flen, const unsigned char *from,
56 unsigned char *to, RSA *rsa, int padding)
57{
58 RSAerr(RSA_F_RSA_NULL_PUBLIC_ENCRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
59 return -1;
60}
61
62static int RSA_null_private_encrypt(int flen, const unsigned char *from,
63 unsigned char *to, RSA *rsa, int padding)
64{
65 RSAerr(RSA_F_RSA_NULL_PRIVATE_ENCRYPT,
66 RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
67 return -1;
68}
69
70static int RSA_null_private_decrypt(int flen, const unsigned char *from,
71 unsigned char *to, RSA *rsa, int padding)
72{
73 RSAerr(RSA_F_RSA_NULL_PRIVATE_DECRYPT,
74 RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
75 return -1;
76}
77
78static int RSA_null_public_decrypt(int flen, const unsigned char *from,
79 unsigned char *to, RSA *rsa, int padding)
80{
81 RSAerr(RSA_F_RSA_NULL_PUBLIC_DECRYPT, RSA_R_RSA_OPERATIONS_NOT_SUPPORTED);
82 return -1;
83}
84
85static int RSA_null_init(RSA *rsa)
86{
87 return (1);
88}
89
90static int RSA_null_finish(RSA *rsa)
91{
92 return (1);
93}
Note: See TracBrowser for help on using the repository browser.