* the default method, then just call RAND_bytes(). Otherwise make
* sure we're instantiated and use the private DRBG.
*/
-int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num,
+int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
unsigned int strength)
{
EVP_RAND_CTX *rand;
int RAND_priv_bytes(unsigned char *buf, int num)
{
- return RAND_priv_bytes_ex(NULL, buf, num, 0);
+ if (num < 0)
+ return 0;
+ return RAND_priv_bytes_ex(NULL, buf, (size_t)num, 0);
}
-int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num,
+int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
unsigned int strength)
{
EVP_RAND_CTX *rand;
int RAND_bytes(unsigned char *buf, int num)
{
- return RAND_bytes_ex(NULL, buf, num, 0);
+ if (num < 0)
+ return 0;
+ return RAND_bytes_ex(NULL, buf, (size_t)num, 0);
}
typedef struct rand_global_st {
int RAND_bytes(unsigned char *buf, int num);
int RAND_priv_bytes(unsigned char *buf, int num);
- int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num,
+ int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
unsigned int strength);
- int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num,
+ int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
unsigned int strength);
Deprecated since OpenSSL 1.1.0, can be hidden entirely by defining
/*
* Generated by util/mkerr.pl DO NOT EDIT
- * Copyright 2020 The OpenSSL Project Authors. All Rights Reserved.
+ * Copyright 2020-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
# define EC_R_INVALID_GENERATOR 173
# define EC_R_INVALID_GROUP_ORDER 122
# define EC_R_INVALID_KEY 116
+# define EC_R_INVALID_LENGTH 117
# define EC_R_INVALID_NAMED_GROUP_CONVERSION 174
# define EC_R_INVALID_OUTPUT_LENGTH 161
# define EC_R_INVALID_P 172
* Equivalent of RAND_priv_bytes() but additionally taking an OSSL_LIB_CTX and
* a strength.
*/
-int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num,
+int RAND_priv_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
unsigned int strength);
/*
* Equivalent of RAND_bytes() but additionally taking an OSSL_LIB_CTX and
* a strength.
*/
-int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, int num,
+int RAND_bytes_ex(OSSL_LIB_CTX *ctx, unsigned char *buf, size_t num,
unsigned int strength);
# ifndef OPENSSL_NO_DEPRECATED_1_1_0
# define RSA_R_INVALID_KEYPAIR 171
# define RSA_R_INVALID_KEY_LENGTH 173
# define RSA_R_INVALID_LABEL 160
+# define RSA_R_INVALID_LENGTH 181
# define RSA_R_INVALID_MESSAGE_LENGTH 131
# define RSA_R_INVALID_MGF1_MD 156
# define RSA_R_INVALID_MODULUS 174