From lmcdasi at yahoo.com Thu Jun 15 14:25:32 2023 From: lmcdasi at yahoo.com (lmcdasi at yahoo.com) Date: Thu, 15 Jun 2023 18:25:32 +0000 (UTC) Subject: [libsrtp] Q: libsrtp debug References: <473648027.427002.1686853532995.ref@mail.yahoo.com> Message-ID: <473648027.427002.1686853532995@mail.yahoo.com> I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting?SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From paulej at packetizer.com Thu Jun 15 15:53:29 2023 From: paulej at packetizer.com (Paul E. Jones) Date: Thu, 15 Jun 2023 19:53:29 +0000 Subject: [libsrtp] Q: libsrtp debug In-Reply-To: <473648027.427002.1686853532995@mail.yahoo.com> References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> Message-ID: Do you mean this? https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here: https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------ >From "lmcdasi--- via libsrtp" To "libsrtp at lists.packetizer.com" Date 6/15/2023 2:25:32 PM Subject [libsrtp] Q: libsrtp debug >I'm trying to use the library in java. I have wrote all jna mapping's >required. When the code is executing create_session I'm getting >SRTP_ERR_STATUS_BAD_PARAM > >I do not see where my error is & enabling logs in the library may help. > >Any suggestions ? Thx. > -------------- next part -------------- An HTML attachment was scrubbed... URL: From lmcdasi at yahoo.com Thu Jun 15 20:08:48 2023 From: lmcdasi at yahoo.com (lmcdasi at yahoo.com) Date: Fri, 16 Jun 2023 00:08:48 +0000 (UTC) Subject: [libsrtp] Q: libsrtp debug In-Reply-To: References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> Message-ID: <1111842130.570205.1686874128150@mail.yahoo.com> It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy);libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values and srtp_valid_policy should not fail with BAD_PARAM there. Then, I did: ? ? ? ? ? ? rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion? ? ? ? ? ? rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); ? ? ? ? ? ? final var srtpPolicy = new srtp_policy_t();? ? ? ? ? ? srtpPolicy.setAllow_repeat_tx(0);? ? ? ? ? ? srtpPolicy.setRtp(rtpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setRtcp(rtcpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setKey(srtpKey);? ? ? ? ? ? srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: ? ? ? ? ? ? session = new srtp_ctx_t.ByReference();? ? ? ? ? ? final var srtpSsrc = new srtp_ssrc_t(0);? ?// I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to:?SrtpSsrcType.ssrc_any_inbound.getValue();? ? ? ? ? ? srtpPolicy.setSsrc(srtpSsrc);? ? ? ? ? ? final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug?libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a:?srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this?https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here:https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing?? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------From "lmcdasi--- via libsrtp" To "libsrtp at lists.packetizer.com" Date 6/15/2023 2:25:32 PMSubject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting?SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pabuhler at cisco.com Fri Jun 16 03:50:49 2023 From: pabuhler at cisco.com (=?iso-8859-1?Q?Pascal_B=FChler_=28pabuhler=29?=) Date: Fri, 16 Jun 2023 07:50:49 +0000 Subject: [libsrtp] Q: libsrtp debug In-Reply-To: <1111842130.570205.1686874128150@mail.yahoo.com> References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> <1111842130.570205.1686874128150@mail.yahoo.com> Message-ID: Hi, The best would be to recreate with simple c code, ie find out the values you pass and try to reproduce. Bad param is returned from a lot of places so it is hard for use to guess what you are doing. Enabling some debug is an option to try and help isolate the issue, but a reproducible test case would be the best. pascal ________________________________ From: libsrtp on behalf of lmcdasi--- via libsrtp Sent: Friday, June 16, 2023 2:08 AM To: libsrtp at lists.packetizer.com ; Paul E. Jones Subject: Re: [libsrtp] Q: libsrtp debug It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy); libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values and srtp_valid_policy should not fail with BAD_PARAM there. Then, I did: rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); final var srtpPolicy = new srtp_policy_t(); srtpPolicy.setAllow_repeat_tx(0); srtpPolicy.setRtp(rtpCryptoPolicy); srtpPolicy.setRtcp(rtcpCryptoPolicy); srtpPolicy.setKey(srtpKey); srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: session = new srtp_ctx_t.ByReference(); final var srtpSsrc = new srtp_ssrc_t(0); // I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to: SrtpSsrcType.ssrc_any_inbound.getValue(); srtpPolicy.setSsrc(srtpSsrc); final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a: srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this? https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here: https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------ >From "lmcdasi--- via libsrtp" > To "libsrtp at lists.packetizer.com" > Date 6/15/2023 2:25:32 PM Subject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lmcdasi at yahoo.com Mon Jun 19 10:00:13 2023 From: lmcdasi at yahoo.com (lmcdasi at yahoo.com) Date: Mon, 19 Jun 2023 14:00:13 +0000 (UTC) Subject: [libsrtp] Q: libsrtp debug In-Reply-To: References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> <1111842130.570205.1686874128150@mail.yahoo.com> Message-ID: <30586610.1449993.1687183213471@mail.yahoo.com> H, ? ?Thank you. I finally figure out that I had a JNA memory map issue in srtp_policy_t. The?deprecated_ekt was set to null.?Now I'm getting an SRTP_ERR_STATUS_AUTH_FAIL?failure. I think I pass the key properly tough I might be wrong. ? ?I'm sending audio using gstreamer. The 'srtpenc' plugin is using OpenSSL to encrypt the audio pkt. ? ?I'm wondering if I have some form of incompatibility between the openssl encryption used by gstreamer and libsrtp. I have seen that libsrtp can use openssl but I do not know if there is any extra setup. ? ?If this is not a concern then I need to focus on the key .... BR,Dan S. On Friday, June 16, 2023 at 03:50:53 a.m. EDT, Pascal B?hler (pabuhler) wrote: Hi,?The best would be to recreate with simple c code, ie find out the values you pass and try to reproduce.Bad param is returned from a lot of places so it is hard for use to guess what you are doing.Enabling some debug is an option to try and help isolate the issue, but a reproducible test case would be the best. pascalFrom: libsrtp on behalf of lmcdasi--- via libsrtp Sent: Friday, June 16, 2023 2:08 AM To: libsrtp at lists.packetizer.com ; Paul E. Jones Subject: Re: [libsrtp] Q: libsrtp debug?It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy);libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values andsrtp_valid_policy should not fail with BAD_PARAM there. Then, I did: ? ? ? ? ? ? rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion? ? ? ? ? ? rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); ? ? ? ? ? ? final var srtpPolicy = new srtp_policy_t();? ? ? ? ? ? srtpPolicy.setAllow_repeat_tx(0);? ? ? ? ? ? srtpPolicy.setRtp(rtpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setRtcp(rtcpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setKey(srtpKey);? ? ? ? ? ? srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: ? ? ? ? ? ? session = new srtp_ctx_t.ByReference();? ? ? ? ? ? final var srtpSsrc = new srtp_ssrc_t(0);? ?// I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to:?SrtpSsrcType.ssrc_any_inbound.getValue();? ? ? ? ? ? srtpPolicy.setSsrc(srtpSsrc);? ? ? ? ? ? final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug?libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a:?srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this?https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here:https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing?? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------From "lmcdasi--- via libsrtp" To "libsrtp at lists.packetizer.com" Date 6/15/2023 2:25:32 PMSubject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting?SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pabuhler at cisco.com Mon Jun 19 10:07:59 2023 From: pabuhler at cisco.com (=?iso-8859-1?Q?Pascal_B=FChler_=28pabuhler=29?=) Date: Mon, 19 Jun 2023 14:07:59 +0000 Subject: [libsrtp] Q: libsrtp debug In-Reply-To: <30586610.1449993.1687183213471@mail.yahoo.com> References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> <1111842130.570205.1686874128150@mail.yahoo.com> <30586610.1449993.1687183213471@mail.yahoo.com> Message-ID: It should not be a compatibility issue as long as you use the same cipher suite combination in the policy. In general, though I would suggest using openssl with libsrtp. It might be your key or some other config that is not matching. The best is to have some kind of test setup with predicable outcomes when debugging auth/encryption failures. good luck. ________________________________ From: lmcdasi at yahoo.com Sent: Monday, June 19, 2023 4:00 PM To: libsrtp at lists.packetizer.com ; Paul E. Jones ; Pascal B?hler (pabuhler) Subject: Re: [libsrtp] Q: libsrtp debug H, Thank you. I finally figure out that I had a JNA memory map issue in srtp_policy_t. The deprecated_ekt was set to null. Now I'm getting an SRTP_ERR_STATUS_AUTH_FAIL failure. I think I pass the key properly tough I might be wrong. I'm sending audio using gstreamer. The 'srtpenc' plugin is using OpenSSL to encrypt the audio pkt. I'm wondering if I have some form of incompatibility between the openssl encryption used by gstreamer and libsrtp. I have seen that libsrtp can use openssl but I do not know if there is any extra setup. If this is not a concern then I need to focus on the key .... BR, Dan S. On Friday, June 16, 2023 at 03:50:53 a.m. EDT, Pascal B?hler (pabuhler) wrote: Hi, The best would be to recreate with simple c code, ie find out the values you pass and try to reproduce. Bad param is returned from a lot of places so it is hard for use to guess what you are doing. Enabling some debug is an option to try and help isolate the issue, but a reproducible test case would be the best. pascal ________________________________ From: libsrtp on behalf of lmcdasi--- via libsrtp Sent: Friday, June 16, 2023 2:08 AM To: libsrtp at lists.packetizer.com ; Paul E. Jones Subject: Re: [libsrtp] Q: libsrtp debug It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy); libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values and srtp_valid_policy should not fail with BAD_PARAM there. Then, I did: rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); final var srtpPolicy = new srtp_policy_t(); srtpPolicy.setAllow_repeat_tx(0); srtpPolicy.setRtp(rtpCryptoPolicy); srtpPolicy.setRtcp(rtcpCryptoPolicy); srtpPolicy.setKey(srtpKey); srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: session = new srtp_ctx_t.ByReference(); final var srtpSsrc = new srtp_ssrc_t(0); // I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to: SrtpSsrcType.ssrc_any_inbound.getValue(); srtpPolicy.setSsrc(srtpSsrc); final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a: srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this? https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here: https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------ >From "lmcdasi--- via libsrtp" > To "libsrtp at lists.packetizer.com" > Date 6/15/2023 2:25:32 PM Subject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lmcdasi at yahoo.com Mon Jun 19 10:59:42 2023 From: lmcdasi at yahoo.com (lmcdasi at yahoo.com) Date: Mon, 19 Jun 2023 14:59:42 +0000 (UTC) Subject: [libsrtp] Q: libsrtp debug In-Reply-To: References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> <1111842130.570205.1686874128150@mail.yahoo.com> <30586610.1449993.1687183213471@mail.yahoo.com> Message-ID: <1662525262.1478156.1687186782342@mail.yahoo.com> Thank you for your answers. Do you have any links describing how I can use openssl with libsrtp ? I've seen the build options. I'm currently using the default rpm from ubuntu jammy. BR,Dan S. On Monday, June 19, 2023 at 10:08:02 a.m. EDT, Pascal B?hler (pabuhler) wrote: It should not be a compatibility issue as long as you use the same cipher suite combination in the policy.In general, though I would suggest using openssl with libsrtp.It might be your key or some other config that is not matching.The best is to have some kind of test setup with predicable outcomes when debugging auth/encryption failures. good luck.?From: lmcdasi at yahoo.com Sent: Monday, June 19, 2023 4:00 PM To: libsrtp at lists.packetizer.com ; Paul E. Jones ; Pascal B?hler (pabuhler) Subject: Re: [libsrtp] Q: libsrtp debug?H, ? ?Thank you. I finally figure out that I had a JNA memory map issue in srtp_policy_t. The?deprecated_ekt was set to null.?Now I'm getting anSRTP_ERR_STATUS_AUTH_FAIL?failure. I think I pass the key properly tough I might be wrong. ? ?I'm sending audio using gstreamer. The 'srtpenc' plugin is using OpenSSL to encrypt the audio pkt. ? ?I'm wondering if I have some form of incompatibility between the openssl encryption used by gstreamer and libsrtp. I have seen that libsrtp can use openssl but I do not know if there is any extra setup. ? ?If this is not a concern then I need to focus on the key .... BR,Dan S. On Friday, June 16, 2023 at 03:50:53 a.m. EDT, Pascal B?hler (pabuhler) wrote: Hi,?The best would be to recreate with simple c code, ie find out the values you pass and try to reproduce.Bad param is returned from a lot of places so it is hard for use to guess what you are doing.Enabling some debug is an option to try and help isolate the issue, but a reproducible test case would be the best. pascalFrom: libsrtp on behalf of lmcdasi--- via libsrtp Sent: Friday, June 16, 2023 2:08 AM To: libsrtp at lists.packetizer.com ; Paul E. Jones Subject: Re: [libsrtp] Q: libsrtp debug?It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy);libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values andsrtp_valid_policy should not fail with BAD_PARAM there. Then, I did: ? ? ? ? ? ? rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion? ? ? ? ? ? rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); ? ? ? ? ? ? final var srtpPolicy = new srtp_policy_t();? ? ? ? ? ? srtpPolicy.setAllow_repeat_tx(0);? ? ? ? ? ? srtpPolicy.setRtp(rtpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setRtcp(rtcpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setKey(srtpKey);? ? ? ? ? ? srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: ? ? ? ? ? ? session = new srtp_ctx_t.ByReference();? ? ? ? ? ? final var srtpSsrc = new srtp_ssrc_t(0);? ?// I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to:?SrtpSsrcType.ssrc_any_inbound.getValue();? ? ? ? ? ? srtpPolicy.setSsrc(srtpSsrc);? ? ? ? ? ? final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug?libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a:?srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this?https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here:https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing?? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------From "lmcdasi--- via libsrtp" To "libsrtp at lists.packetizer.com" Date 6/15/2023 2:25:32 PMSubject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting?SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From pabuhler at cisco.com Mon Jun 19 11:44:42 2023 From: pabuhler at cisco.com (=?iso-8859-1?Q?Pascal_B=FChler_=28pabuhler=29?=) Date: Mon, 19 Jun 2023 15:44:42 +0000 Subject: [libsrtp] Q: libsrtp debug In-Reply-To: <1662525262.1478156.1687186782342@mail.yahoo.com> References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> <1111842130.570205.1686874128150@mail.yahoo.com> <30586610.1449993.1687183213471@mail.yahoo.com> <1662525262.1478156.1687186782342@mail.yahoo.com> Message-ID: It needs to be built with it: https://github.com/cisco/libsrtp#installing-and-building-libsrtp I am not familiar with what the rpm does, I would have thought it used openssl already otherwise what is the point. pascal ________________________________ From: lmcdasi at yahoo.com Sent: Monday, June 19, 2023 4:59 PM To: libsrtp at lists.packetizer.com ; Paul E. Jones ; Pascal B?hler (pabuhler) Subject: Re: [libsrtp] Q: libsrtp debug Thank you for your answers. Do you have any links describing how I can use openssl with libsrtp ? I've seen the build options. I'm currently using the default rpm from ubuntu jammy. BR, Dan S. On Monday, June 19, 2023 at 10:08:02 a.m. EDT, Pascal B?hler (pabuhler) wrote: It should not be a compatibility issue as long as you use the same cipher suite combination in the policy. In general, though I would suggest using openssl with libsrtp. It might be your key or some other config that is not matching. The best is to have some kind of test setup with predicable outcomes when debugging auth/encryption failures. good luck. ________________________________ From: lmcdasi at yahoo.com Sent: Monday, June 19, 2023 4:00 PM To: libsrtp at lists.packetizer.com ; Paul E. Jones ; Pascal B?hler (pabuhler) Subject: Re: [libsrtp] Q: libsrtp debug H, Thank you. I finally figure out that I had a JNA memory map issue in srtp_policy_t. The deprecated_ekt was set to null. Now I'm getting an SRTP_ERR_STATUS_AUTH_FAIL failure. I think I pass the key properly tough I might be wrong. I'm sending audio using gstreamer. The 'srtpenc' plugin is using OpenSSL to encrypt the audio pkt. I'm wondering if I have some form of incompatibility between the openssl encryption used by gstreamer and libsrtp. I have seen that libsrtp can use openssl but I do not know if there is any extra setup. If this is not a concern then I need to focus on the key .... BR, Dan S. On Friday, June 16, 2023 at 03:50:53 a.m. EDT, Pascal B?hler (pabuhler) wrote: Hi, The best would be to recreate with simple c code, ie find out the values you pass and try to reproduce. Bad param is returned from a lot of places so it is hard for use to guess what you are doing. Enabling some debug is an option to try and help isolate the issue, but a reproducible test case would be the best. pascal ________________________________ From: libsrtp on behalf of lmcdasi--- via libsrtp Sent: Friday, June 16, 2023 2:08 AM To: libsrtp at lists.packetizer.com ; Paul E. Jones Subject: Re: [libsrtp] Q: libsrtp debug It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy); libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values and srtp_valid_policy should not fail with BAD_PARAM there. Then, I did: rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); final var srtpPolicy = new srtp_policy_t(); srtpPolicy.setAllow_repeat_tx(0); srtpPolicy.setRtp(rtpCryptoPolicy); srtpPolicy.setRtcp(rtcpCryptoPolicy); srtpPolicy.setKey(srtpKey); srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: session = new srtp_ctx_t.ByReference(); final var srtpSsrc = new srtp_ssrc_t(0); // I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to: SrtpSsrcType.ssrc_any_inbound.getValue(); srtpPolicy.setSsrc(srtpSsrc); final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a: srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this? https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here: https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------ >From "lmcdasi--- via libsrtp" > To "libsrtp at lists.packetizer.com" > Date 6/15/2023 2:25:32 PM Subject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: From lmcdasi at yahoo.com Mon Jun 19 11:54:43 2023 From: lmcdasi at yahoo.com (lmcdasi at yahoo.com) Date: Mon, 19 Jun 2023 15:54:43 +0000 (UTC) Subject: [libsrtp] Q: libsrtp debug In-Reply-To: References: <473648027.427002.1686853532995.ref@mail.yahoo.com> <473648027.427002.1686853532995@mail.yahoo.com> <1111842130.570205.1686874128150@mail.yahoo.com> <30586610.1449993.1687183213471@mail.yahoo.com> <1662525262.1478156.1687186782342@mail.yahoo.com> Message-ID: <1687262730.1507111.1687190083264@mail.yahoo.com> Thank you! On Monday, June 19, 2023 at 11:44:46 a.m. EDT, Pascal B?hler (pabuhler) wrote: It needs to be built with it:?https://github.com/cisco/libsrtp#installing-and-building-libsrtp I am not familiar with what the rpm does,? I would have thought it used openssl already otherwise what is the point. pascalFrom: lmcdasi at yahoo.com Sent: Monday, June 19, 2023 4:59 PM To: libsrtp at lists.packetizer.com ; Paul E. Jones ; Pascal B?hler (pabuhler) Subject: Re: [libsrtp] Q: libsrtp debug?Thank you for your answers. Do you have any links describing how I can use openssl with libsrtp ? I've seen the build options. I'm currently using the default rpm from ubuntu jammy. BR,Dan S. On Monday, June 19, 2023 at 10:08:02 a.m. EDT, Pascal B?hler (pabuhler) wrote: It should not be a compatibility issue as long as you use the same cipher suite combination in the policy.In general, though I would suggest using openssl with libsrtp.It might be your key or some other config that is not matching.The best is to have some kind of test setup with predicable outcomes when debugging auth/encryption failures. good luck.?From: lmcdasi at yahoo.com Sent: Monday, June 19, 2023 4:00 PM To: libsrtp at lists.packetizer.com ; Paul E. Jones ; Pascal B?hler (pabuhler) Subject: Re: [libsrtp] Q: libsrtp debug?H, ? ?Thank you. I finally figure out that I had a JNA memory map issue in srtp_policy_t. The?deprecated_ekt was set to null.?Now I'm getting anSRTP_ERR_STATUS_AUTH_FAIL?failure. I think I pass the key properly tough I might be wrong. ? ?I'm sending audio using gstreamer. The 'srtpenc' plugin is using OpenSSL to encrypt the audio pkt. ? ?I'm wondering if I have some form of incompatibility between the openssl encryption used by gstreamer and libsrtp. I have seen that libsrtp can use openssl but I do not know if there is any extra setup. ? ?If this is not a concern then I need to focus on the key .... BR,Dan S. On Friday, June 16, 2023 at 03:50:53 a.m. EDT, Pascal B?hler (pabuhler) wrote: Hi,?The best would be to recreate with simple c code, ie find out the values you pass and try to reproduce.Bad param is returned from a lot of places so it is hard for use to guess what you are doing.Enabling some debug is an option to try and help isolate the issue, but a reproducible test case would be the best. pascalFrom: libsrtp on behalf of lmcdasi--- via libsrtp Sent: Friday, June 16, 2023 2:08 AM To: libsrtp at lists.packetizer.com ; Paul E. Jones Subject: Re: [libsrtp] Q: libsrtp debug?It is the 2nd parameter because if I call in the java intelij debugger srtp_create(session, null) it works. I did print the policy .... it is not null & the deprecated field == null so it cannot be that bad param. I do call: libSrtp.srtp_crypto_policy_set_rtp_default(rtpCryptoPolicy);libSrtp.srtp_crypto_policy_set_rtp_default(rtcpCryptoPolicy); I did look at the 'C' code and unless I miss something I think I got the correct values andsrtp_valid_policy should not fail with BAD_PARAM there. Then, I did: ? ? ? ? ? ? rtpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_conf_and_auth.getValue()); // I was unable so far to map the enum with jna thus I used the enum - int conversion? ? ? ? ? ? rtcpCryptoPolicy.setSec_serv(SrtpSecServ.sec_serv_none.getValue()); ? ? ? ? ? ? final var srtpPolicy = new srtp_policy_t();? ? ? ? ? ? srtpPolicy.setAllow_repeat_tx(0);? ? ? ? ? ? srtpPolicy.setRtp(rtpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setRtcp(rtcpCryptoPolicy);? ? ? ? ? ? srtpPolicy.setKey(srtpKey);? ? ? ? ? ? srtpPolicy.setWindow_size(128); So far - I think I match the +/- same steps as the test/rtpdecoder.c But then the session is created when 1st rtp pkt is received: ? ? ? ? ? ? session = new srtp_ctx_t.ByReference();? ? ? ? ? ? final var srtpSsrc = new srtp_ssrc_t(0);? ?// I used the ssrc from the rtp pkt - same error. By default the constructor is setting type to:?SrtpSsrcType.ssrc_any_inbound.getValue();? ? ? ? ? ? srtpPolicy.setSsrc(srtpSsrc);? ? ? ? ? ? final var srtpErrStatus = libSrtp.srtp_create(session, srtpPolicy); I'm getting BAD_PARAM ....Calling manually in the debug?libSrtp.srtp_create(session, null); gives OK .... I just noticed that there is a:?srtp_set_debug_module method but when I used it I get fail as status code. I'm trying to see if I can activate that and hope it might print some useful info On Thursday, June 15, 2023 at 03:53:41 p.m. EDT, Paul E. Jones wrote: Do you mean this?https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L2975 Is the first parameter NULL? The call to srtp_valid_policy() can also return that here:https://github.com/cisco/libsrtp/blob/main/srtp/srtp.c#L326 Or are you making another call that is failing?? In any case, the best way to find it is to read the C code to see what conditions return that result. Paul ------ Original Message ------From "lmcdasi--- via libsrtp" To "libsrtp at lists.packetizer.com" Date 6/15/2023 2:25:32 PMSubject [libsrtp] Q: libsrtp debug I'm trying to use the library in java. I have wrote all jna mapping's required. When the code is executing create_session I'm getting?SRTP_ERR_STATUS_BAD_PARAM I do not see where my error is & enabling logs in the library may help. Any suggestions ? Thx. -------------- next part -------------- An HTML attachment was scrubbed... URL: