# define ALG_OP_TYPE unsigned int
# define ALG_OP_LEN (sizeof(ALG_OP_TYPE))
-#define ALG_MAX_SALG_NAME 64
-#define ALG_MAX_SALG_TYPE 14
-
# ifdef OPENSSL_NO_DYNAMIC_ENGINE
void engine_load_afalg_int(void);
# endif
memset(&sa, 0, sizeof(sa));
sa.salg_family = AF_ALG;
- strncpy((char *) sa.salg_type, ciphertype, ALG_MAX_SALG_TYPE);
- sa.salg_type[ALG_MAX_SALG_TYPE-1] = '\0';
- strncpy((char *) sa.salg_name, ciphername, ALG_MAX_SALG_NAME);
- sa.salg_name[ALG_MAX_SALG_NAME-1] = '\0';
+ OPENSSL_strlcpy((char *) sa.salg_type, ciphertype, sizeof(sa.salg_type));
+ OPENSSL_strlcpy((char *) sa.salg_name, ciphername, sizeof(sa.salg_name));
actx->bfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
if (actx->bfd == -1) {
int ciphertype;
int ret;
afalg_ctx *actx;
- char ciphername[ALG_MAX_SALG_NAME];
+ const char *ciphername;
if (ctx == NULL || key == NULL) {
ALG_WARN("%s(%d): Null Parameter\n", __FILE__, __LINE__);
case NID_aes_128_cbc:
case NID_aes_192_cbc:
case NID_aes_256_cbc:
- strncpy(ciphername, "cbc(aes)", ALG_MAX_SALG_NAME);
+ ciphername = "cbc(aes)";
break;
default:
ALG_WARN("%s(%d): Unsupported Cipher type %d\n", __FILE__, __LINE__,
ciphertype);
return 0;
}
- ciphername[ALG_MAX_SALG_NAME-1]='\0';
if (ALG_AES_IV_LEN != EVP_CIPHER_CTX_iv_length(ctx)) {
ALG_WARN("%s(%d): Unsupported IV length :%d\n", __FILE__, __LINE__,