2 * Copyright 1995-2017 The OpenSSL Project Authors. All Rights Reserved.
4 * Licensed under the Apache License 2.0 (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
11 * RSA low level APIs are deprecated for public use, but still ok for
14 #include "internal/deprecated.h"
16 #include "internal/cryptlib.h"
17 #include <openssl/bn.h>
18 #include <openssl/rsa.h>
20 int RSA_padding_add_none(unsigned char *to
, int tlen
,
21 const unsigned char *from
, int flen
)
24 RSAerr(RSA_F_RSA_PADDING_ADD_NONE
, RSA_R_DATA_TOO_LARGE_FOR_KEY_SIZE
);
29 RSAerr(RSA_F_RSA_PADDING_ADD_NONE
, RSA_R_DATA_TOO_SMALL_FOR_KEY_SIZE
);
33 memcpy(to
, from
, (unsigned int)flen
);
37 int RSA_padding_check_none(unsigned char *to
, int tlen
,
38 const unsigned char *from
, int flen
, int num
)
42 RSAerr(RSA_F_RSA_PADDING_CHECK_NONE
, RSA_R_DATA_TOO_LARGE
);
46 memset(to
, 0, tlen
- flen
);
47 memcpy(to
+ tlen
- flen
, from
, flen
);